From 2bf8f7982319bc921c81c0a950a1d22ba735eb0a Mon Sep 17 00:00:00 2001 From: Suzanne Soy Date: Thu, 22 Apr 2021 05:36:15 +0100 Subject: [PATCH] work in progress on rewriting the XML <-> FreeCAD conversion of forms (model, form,types...) --- ReloadCommand.py | 42 +++++++++ ExternalAppsList.py => XternalAppsList.py | 0 icons/reload.svg | 105 ++++++++++++++++++++++ 3 files changed, 147 insertions(+) create mode 100644 ReloadCommand.py rename ExternalAppsList.py => XternalAppsList.py (100%) create mode 100644 icons/reload.svg diff --git a/ReloadCommand.py b/ReloadCommand.py new file mode 100644 index 0000000..925ab72 --- /dev/null +++ b/ReloadCommand.py @@ -0,0 +1,42 @@ +import os +import FreeCAD +import FreeCADGui as Gui +import PySide +from PySide import QtGui +from importlib import reload + +# This command is inserted into each workbench by AppCommand.py + +def R(): + # Clear the report view: + Gui.getMainWindow().findChild(QtGui.QTextEdit, "Report view").clear() + # Reload modules: + import XternalAppsParametricTool + import ReloadCommand + mods = [XternalAppsParametricTool, ReloadCommand] + for m in mods: + reload(m) + print(str(len(mods)) + "modules reloaded") + + +class ReloadCommand(): + def __init__(self, appName): + pass + + def GetResources(self): + return { + 'Pixmap': os.path.dirname(__file__) + '/icons/' + "reload.svg", + 'Accel': "Shit+R", # R for Reload + 'MenuText': "Reload XternalApps (developper tool)", + 'ToolTip': "Reload some modules of the XternalApps workbenches, needed for development only.", + } + + def Activated(self): + R() + + def IsActive(self): + # return false to grey out the command in the menus, toolbars etc. + return True + +def createCommands(appName): + Gui.addCommand('XternalAppsReload' + appName + 'Command', ReloadCommand(appName)) \ No newline at end of file diff --git a/ExternalAppsList.py b/XternalAppsList.py similarity index 100% rename from ExternalAppsList.py rename to XternalAppsList.py diff --git a/icons/reload.svg b/icons/reload.svg new file mode 100644 index 0000000..abcab8b --- /dev/null +++ b/icons/reload.svg @@ -0,0 +1,105 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + + +