I know there are serval topics about the implementation of task panels... But basically i can't figure out what i'm doing wrong.
What i've done is creating a fresh copy of the Workbench-Starterkit. created a simple ui file(one push button and one line edit).
But i'm not able to show it.
The code below is part of the file open_panel.py but i only get this:
Code: Select all
import FreeCADGui
import sys
import os
from PySide import QtUiTools
from PySide import QtGui
from PySide import QtCore
from freecad.workbench_copy import ICONPATH
from freecad.workbench_copy import UIPATH
class Panel():
"""Open Panel"""
def __init__(self):
""""""
return
def GetResources(self):
return {'Pixmap' : os.path.join(ICONPATH, 'box.svg'), # the name of a svg file available in the resources
'Accel' : "Shift+S", # a default shortcut (optional)
'MenuText': "Open panel",
'ToolTip' : "Open simple panel"}
def Activated(self):
ui_file = os.path.join(UIPATH, "simpleUI.ui")
print(ui_file)
self.form = FreeCADGui.PySideUic.loadUi(ui_file)
FreeCADGui.Control.showDialog(self.form)
return()
def IsActive(self):
"""Here you can define if the command must be active or not (greyed) if certain conditions
are met or not. This function is optional."""
return(True)
FreeCADGui.addCommand('open_panel',Panel())
Maybe a additional point if this can be resolved add something similar to the Workbench-Starterkit ?