Merge pull request #11 from APEbbers/Develop
Changed Serialize.py to Serialize_SearcdhBar.py
This commit is contained in:
commit
e72eb1f21b
|
@ -48,9 +48,9 @@ def getItemGroups():
|
||||||
|
|
||||||
itemGroups = RefreshTools.refreshToolbars(doLoadAllWorkbenches=False)
|
itemGroups = RefreshTools.refreshToolbars(doLoadAllWorkbenches=False)
|
||||||
else:
|
else:
|
||||||
import Serialize
|
import Serialize_SearchBar
|
||||||
|
|
||||||
itemGroups = Serialize.deserialize(serializedItemGroups)
|
itemGroups = Serialize_SearchBar.deserialize(serializedItemGroups)
|
||||||
|
|
||||||
# Aggregate the tools (cached) and document objects (not cached), and assign an index to each
|
# Aggregate the tools (cached) and document objects (not cached), and assign an index to each
|
||||||
import SearchResults
|
import SearchResults
|
||||||
|
|
|
@ -41,18 +41,18 @@ def gatherTools():
|
||||||
|
|
||||||
|
|
||||||
def writeCacheTools():
|
def writeCacheTools():
|
||||||
import Serialize
|
import Serialize_SearchBar
|
||||||
|
|
||||||
serializedItemGroups = Serialize.serialize(gatherTools())
|
serializedItemGroups = Serialize_SearchBar.serialize(gatherTools())
|
||||||
# Todo: use wb and a specific encoding.
|
# Todo: use wb and a specific encoding.
|
||||||
with open(cachePath(), "w") as cache:
|
with open(cachePath(), "w") as cache:
|
||||||
cache.write(serializedItemGroups)
|
cache.write(serializedItemGroups)
|
||||||
# I prefer to systematically deserialize, instead of taking the original version,
|
# I prefer to systematically deserialize, instead of taking the original version,
|
||||||
# this avoids possible inconsistencies between the original and the cache and
|
# this avoids possible inconsistencies between the original and the cache and
|
||||||
# makes sure cache-related bugs are noticed quickly.
|
# makes sure cache-related bugs are noticed quickly.
|
||||||
import Serialize
|
import Serialize_SearchBar
|
||||||
|
|
||||||
itemGroups = Serialize.deserialize(serializedItemGroups)
|
itemGroups = Serialize_SearchBar.deserialize(serializedItemGroups)
|
||||||
print("SearchBox: Cache has been written.")
|
print("SearchBox: Cache has been written.")
|
||||||
return itemGroups
|
return itemGroups
|
||||||
|
|
||||||
|
@ -61,9 +61,9 @@ def readCacheTools():
|
||||||
# Todo: use rb and a specific encoding.
|
# Todo: use rb and a specific encoding.
|
||||||
with open(cachePath(), "r") as cache:
|
with open(cachePath(), "r") as cache:
|
||||||
serializedItemGroups = cache.read()
|
serializedItemGroups = cache.read()
|
||||||
import Serialize
|
import Serialize_SearchBar
|
||||||
|
|
||||||
itemGroups = Serialize.deserialize(serializedItemGroups)
|
itemGroups = Serialize_SearchBar.deserialize(serializedItemGroups)
|
||||||
print("SearchBox: Tools were loaded from the cache.")
|
print("SearchBox: Tools were loaded from the cache.")
|
||||||
return itemGroups
|
return itemGroups
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ import os
|
||||||
import FreeCAD as App
|
import FreeCAD as App
|
||||||
import FreeCADGui
|
import FreeCADGui
|
||||||
from PySide import QtGui
|
from PySide import QtGui
|
||||||
import Serialize
|
import Serialize_SearchBar
|
||||||
|
|
||||||
genericToolIcon = QtGui.QIcon(QtGui.QIcon(os.path.dirname(__file__) + "/Tango-Tools-spanner-hammer.svg"))
|
genericToolIcon = QtGui.QIcon(QtGui.QIcon(os.path.dirname(__file__) + "/Tango-Tools-spanner-hammer.svg"))
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import os
|
import os
|
||||||
from PySide import QtGui
|
from PySide import QtGui
|
||||||
import Serialize
|
import Serialize_SearchBar
|
||||||
|
|
||||||
|
|
||||||
def refreshToolsAction(nfo):
|
def refreshToolsAction(nfo):
|
||||||
|
@ -11,7 +11,7 @@ def refreshToolsAction(nfo):
|
||||||
|
|
||||||
def refreshToolsToolTip(nfo, setParent):
|
def refreshToolsToolTip(nfo, setParent):
|
||||||
return (
|
return (
|
||||||
Serialize.iconToHTML(genericToolIcon)
|
Serialize_SearchBar.iconToHTML(genericToolIcon)
|
||||||
+ "<p>Load all workbenches to refresh this list of tools. This may take a minute, depending on the number of installed workbenches.</p>"
|
+ "<p>Load all workbenches to refresh this list of tools. This may take a minute, depending on the number of installed workbenches.</p>"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
from PySide import QtGui
|
from PySide import QtGui
|
||||||
import FreeCADGui
|
import FreeCADGui
|
||||||
import Serialize
|
import Serialize_SearchBar
|
||||||
|
|
||||||
|
|
||||||
def toolbarAction(nfo):
|
def toolbarAction(nfo):
|
||||||
|
@ -61,7 +61,10 @@ def subToolAction(nfo):
|
||||||
def toolbarToolTip(nfo, setParent):
|
def toolbarToolTip(nfo, setParent):
|
||||||
workbenches = FreeCADGui.listWorkbenches()
|
workbenches = FreeCADGui.listWorkbenches()
|
||||||
in_workbenches = [
|
in_workbenches = [
|
||||||
"<li>" + (Serialize.iconToHTML(QtGui.QIcon(workbenches[wb].Icon)) if wb in workbenches else "? ") + wb + "</li>"
|
"<li>"
|
||||||
|
+ (Serialize_SearchBar.iconToHTML(QtGui.QIcon(workbenches[wb].Icon)) if wb in workbenches else "? ")
|
||||||
|
+ wb
|
||||||
|
+ "</li>"
|
||||||
for wb in nfo["action"]["workbenches"]
|
for wb in nfo["action"]["workbenches"]
|
||||||
]
|
]
|
||||||
return (
|
return (
|
||||||
|
@ -74,7 +77,7 @@ def toolbarToolTip(nfo, setParent):
|
||||||
|
|
||||||
|
|
||||||
def subToolToolTip(nfo, setParent):
|
def subToolToolTip(nfo, setParent):
|
||||||
return Serialize.iconToHTML(nfo["icon"], 32) + "<p>" + nfo["toolTip"] + "</p>"
|
return Serialize_SearchBar.iconToHTML(nfo["icon"], 32) + "<p>" + nfo["toolTip"] + "</p>"
|
||||||
|
|
||||||
|
|
||||||
def getAllToolbars():
|
def getAllToolbars():
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
<description>Adds a search bar widget for tools, document objects, and preferences</description>
|
<description>Adds a search bar widget for tools, document objects, and preferences</description>
|
||||||
|
|
||||||
<version>1.2.0</version>
|
<version>1.2.1</version>
|
||||||
|
|
||||||
<date>2022-06-01</date>
|
<date>2022-06-01</date>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user