toolbar button to open preferences
This commit is contained in:
parent
b19c95cd2e
commit
7ee3ed89c6
2 changed files with 28 additions and 1 deletions
24
freecad/kiconnect/commands/cmd_edit_prefs.py
Normal file
24
freecad/kiconnect/commands/cmd_edit_prefs.py
Normal file
|
@ -0,0 +1,24 @@
|
|||
import importlib
|
||||
import FreeCADGui as Gui
|
||||
import os
|
||||
import sys
|
||||
|
||||
from .. import settings
|
||||
from ..project import Project
|
||||
|
||||
class EditPrefs:
|
||||
def GetResources(self):
|
||||
tooltip = '<p>EditPrefs KiConnect Workbench for development.\nNOTE: Does not reload toolbars.</p>'
|
||||
iconFile = 'preferences-system.svg'
|
||||
|
||||
return {
|
||||
'MenuText': 'Edit Preferences',
|
||||
'ToolTip': tooltip,
|
||||
'Pixmap' : iconFile
|
||||
}
|
||||
|
||||
def Activated(self):
|
||||
Gui.showPreferences("KiConnect")
|
||||
|
||||
|
||||
Gui.addCommand('cmd_edit_prefs', EditPrefs())
|
|
@ -7,7 +7,7 @@ sys.path.insert(1, os.path.join(os.path.dirname(os.path.realpath(__file__)), '..
|
|||
import FreeCADGui as Gui
|
||||
import FreeCAD as App
|
||||
|
||||
from .commands import cmd_new_pcb, cmd_reload, cmd_sync_from, cmd_sync_to
|
||||
from .commands import cmd_edit_prefs, cmd_new_pcb, cmd_reload, cmd_sync_from, cmd_sync_to
|
||||
from . import settings
|
||||
|
||||
translate=App.Qt.translate
|
||||
|
@ -51,6 +51,9 @@ class KiConnect(Gui.Workbench):
|
|||
if settings.preferences.GetBool('debug_reload'):
|
||||
self.toolbox.append('kiconn_reload')
|
||||
|
||||
if settings.preferences.GetBool('prefs_toolbar'):
|
||||
self.toolbox.append('cmd_edit_prefs')
|
||||
|
||||
print('setting up toolbar')
|
||||
# NOTE: Context for this commands must be "Workbench"
|
||||
self.appendToolbar(QT_TRANSLATE_NOOP("Workbench", "KiConnect"), self.toolbox)
|
||||
|
|
Loading…
Add table
Reference in a new issue