Task Panel don't load with Workbench

Need help, or want to share a macro? Post here!
Post Reply
Jee-Bee
Posts: 1992
Joined: Tue Jun 16, 2015 10:32 am
Location: Netherlands

Task Panel don't load with Workbench

Post by Jee-Bee » Tue Jan 28, 2020 1:16 pm

I have a question regarding ui task panels for a custom workbench(es).
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:
simple_ui_FC.png
simple_ui_FC.png (3.03 KiB) Viewed 88 times

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())
I have added the 7zip workbench copy added as attachment.

Maybe a additional point if this can be resolved add something similar to the Workbench-Starterkit ?
Attachments
Workbench-Copy.7z
(18.31 KiB) Downloaded 3 times
Post Reply

Who is online

Users browsing this forum: Baidu [Spider] and 3 guests