Merge pull request #11 from APEbbers/Develop

Changed Serialize.py to Serialize_SearcdhBar.py
This commit is contained in:
Paul Ebbers 2024-11-30 18:23:53 +01:00 committed by GitHub
commit e72eb1f21b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 18 additions and 15 deletions

View File

@ -48,9 +48,9 @@ def getItemGroups():
itemGroups = RefreshTools.refreshToolbars(doLoadAllWorkbenches=False)
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
import SearchResults

View File

@ -41,18 +41,18 @@ def gatherTools():
def writeCacheTools():
import Serialize
import Serialize_SearchBar
serializedItemGroups = Serialize.serialize(gatherTools())
serializedItemGroups = Serialize_SearchBar.serialize(gatherTools())
# Todo: use wb and a specific encoding.
with open(cachePath(), "w") as cache:
cache.write(serializedItemGroups)
# I prefer to systematically deserialize, instead of taking the original version,
# this avoids possible inconsistencies between the original and the cache and
# 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.")
return itemGroups
@ -61,9 +61,9 @@ def readCacheTools():
# Todo: use rb and a specific encoding.
with open(cachePath(), "r") as cache:
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.")
return itemGroups

View File

@ -2,7 +2,7 @@ import os
import FreeCAD as App
import FreeCADGui
from PySide import QtGui
import Serialize
import Serialize_SearchBar
genericToolIcon = QtGui.QIcon(QtGui.QIcon(os.path.dirname(__file__) + "/Tango-Tools-spanner-hammer.svg"))

View File

@ -1,6 +1,6 @@
import os
from PySide import QtGui
import Serialize
import Serialize_SearchBar
def refreshToolsAction(nfo):
@ -11,7 +11,7 @@ def refreshToolsAction(nfo):
def refreshToolsToolTip(nfo, setParent):
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>"
)

View File

@ -1,6 +1,6 @@
from PySide import QtGui
import FreeCADGui
import Serialize
import Serialize_SearchBar
def toolbarAction(nfo):
@ -61,7 +61,10 @@ def subToolAction(nfo):
def toolbarToolTip(nfo, setParent):
workbenches = FreeCADGui.listWorkbenches()
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"]
]
return (
@ -74,7 +77,7 @@ def toolbarToolTip(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():

View File

@ -5,7 +5,7 @@
<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>