Example #1
0
    def __init__(self):
        # create the se Toolbar
        self.mw = FreeCADGui.getMainWindow()
        self.seWidget = QtGui.QDockWidget()
        self.baseWidget = DraftDockWidget()
        self.seWidget.setObjectName("seToolbar")
        self.seWidget.setTitleBarWidget(self.baseWidget)
        self.seWidget.setWindowTitle(
            translate("se", "Surface Editor Command Bar"))
        self.mw.addDockWidget(QtCore.Qt.TopDockWidgetArea, self.seWidget)
        self.baseWidget.setVisible(False)
        self.seWidget.setVisible(False)
        #self.seWidget.toggleViewAction().setVisible(False)
        #self.sourceCmd = None
        #self.taskmode = Draft.getParam("UiMode")
        self.layout = QtGui.QBoxLayout(QtGui.QBoxLayout.LeftToRight,
                                       self.baseWidget)
        self.layout.setDirection(QtGui.QBoxLayout.LeftToRight)
        self.layout.setObjectName("layout")

        self.l1 = self.label("l1", "current command: ")
        self.lcommand = self.label("lcommand", "None")
        self.w1 = self.lineedit("w1", width=100)
        self.l2 = self.label("l1", "value:")
        self.w2 = self.lineedit("w2", width=100)
        self.q1 = self.combo("q1", [("String", "App::PropertyString"),
                                    ("Float", "App::PropertyFloat"),
                                    ("Vector", "App::PropertyVector")])
        self.b1 = self.button("b1", "OK")

        self.layout.addStretch(100)
    def __init__(self):
            # create the se Toolbar
            self.mw = getMainWindow()
            self.seWidget = QtGui.QDockWidget()
            self.baseWidget = DraftDockWidget()
            self.seWidget.setObjectName("seToolbar")
            self.seWidget.setTitleBarWidget(self.baseWidget)
            self.seWidget.setWindowTitle(translate("se", "Surface Editor Command Bar"))
            self.mw.addDockWidget(QtCore.Qt.TopDockWidgetArea,self.seWidget)
            self.baseWidget.setVisible(False)
            self.seWidget.setVisible(False)
            #self.seWidget.toggleViewAction().setVisible(False)
            #self.sourceCmd = None
            #self.taskmode = Draft.getParam("UiMode")
            self.layout = QtGui.QBoxLayout(QtGui.QBoxLayout.LeftToRight,self.baseWidget)
            self.layout.setDirection(QtGui.QBoxLayout.LeftToRight)
            self.layout.setObjectName("layout")

            self.l1 = self.label("l1","current command: ")
            self.lcommand = self.label("lcommand", "None")
            self.w1 = self.lineedit("w1",width=100)
            self.l2 = self.label("l1","value:")
            self.w2 = self.lineedit("w2",width=100)
            self.q1 = self.combo("q1",[("String","App::PropertyString"),("Float","App::PropertyFloat"),("Vector","App::PropertyVector")])
            self.b1 = self.button("b1","OK")

            self.layout.addStretch(100)
Example #3
0
class SEToolbar:
    def __init__(self):
        # create the se Toolbar
        self.mw = FreeCADGui.getMainWindow()
        self.seWidget = QtGui.QDockWidget()
        self.baseWidget = DraftDockWidget()
        self.seWidget.setObjectName("seToolbar")
        self.seWidget.setTitleBarWidget(self.baseWidget)
        self.seWidget.setWindowTitle(
            translate("se", "Surface Editor Command Bar"))
        self.mw.addDockWidget(QtCore.Qt.TopDockWidgetArea, self.seWidget)
        self.baseWidget.setVisible(False)
        self.seWidget.setVisible(False)
        #self.seWidget.toggleViewAction().setVisible(False)
        #self.sourceCmd = None
        #self.taskmode = Draft.getParam("UiMode")
        self.layout = QtGui.QBoxLayout(QtGui.QBoxLayout.LeftToRight,
                                       self.baseWidget)
        self.layout.setDirection(QtGui.QBoxLayout.LeftToRight)
        self.layout.setObjectName("layout")

        self.l1 = self.label("l1", "current command: ")
        self.lcommand = self.label("lcommand", "None")
        self.w1 = self.lineedit("w1", width=100)
        self.l2 = self.label("l1", "value:")
        self.w2 = self.lineedit("w2", width=100)
        self.q1 = self.combo("q1", [("String", "App::PropertyString"),
                                    ("Float", "App::PropertyFloat"),
                                    ("Vector", "App::PropertyVector")])
        self.b1 = self.button("b1", "OK")

        self.layout.addStretch(100)

    def show(self, text=None):
        self.l1.show()
        self.lcommand.show()
        self.baseWidget.show()
        self.seWidget.setVisible(True)
        if text:
            self.lcommand.setText(text)

    def hide(self):
        self.seWidget.setVisible(False)
        self.reset()

    def showPropEntry(self, callback):
        """
        Shows the widgets for property entry
        """
        self.show()
        self.lcommand.setText("Add Property")
        self.w1.show()
        self.l2.show()
        self.w2.show()
        self.q1.show()
        self.b1.show()

    def reset(self):
        self.w1.hide()
        self.l2.hide()
        self.w2.hide()
        self.q1.hide()
        self.b1.hide()
        self.lcommand.setText('None')

    def button(self,
               name,
               text,
               hide=True,
               icon=None,
               width=66,
               checkable=False):
        button = QtGui.QPushButton(self.baseWidget)
        button.setObjectName(name)
        button.setText(text)
        button.setMaximumSize(QtCore.QSize(width, 26))
        if hide:
            button.hide()
        if checkable:
            button.setCheckable(True)
            button.setChecked(False)
        self.layout.addWidget(button)
        return button

    def combo(self, name, choices, hide=True):
        combo = QtGui.QComboBox(self.baseWidget)
        combo.setObjectName(name)
        if hide: combo.hide()
        for (name, userdata) in choices:
            combo.addItem(name, userdata)
        self.layout.addWidget(combo)
        return combo

    def label(self, name, text=None, hide=True):
        label = QtGui.QLabel(self.baseWidget)
        label.setObjectName(name)
        if hide: label.hide()
        if text: label.setText(text)
        self.layout.addWidget(label)
        return label

    def lineedit(self, name, hide=True, width=None):
        lineedit = DraftLineEdit(self.baseWidget)
        lineedit.setObjectName(name)
        if hide: lineedit.hide()
        if not width: width = 800
        lineedit.setMaximumSize(QtCore.QSize(width, 22))
        self.layout.addWidget(lineedit)
        return lineedit
class SEToolbar:
    def __init__(self):
            # create the se Toolbar
            self.mw = getMainWindow()
            self.seWidget = QtGui.QDockWidget()
            self.baseWidget = DraftDockWidget()
            self.seWidget.setObjectName("seToolbar")
            self.seWidget.setTitleBarWidget(self.baseWidget)
            self.seWidget.setWindowTitle(translate("se", "Surface Editor Command Bar"))
            self.mw.addDockWidget(QtCore.Qt.TopDockWidgetArea,self.seWidget)
            self.baseWidget.setVisible(False)
            self.seWidget.setVisible(False)
            #self.seWidget.toggleViewAction().setVisible(False)
            #self.sourceCmd = None
            #self.taskmode = Draft.getParam("UiMode")
            self.layout = QtGui.QBoxLayout(QtGui.QBoxLayout.LeftToRight,self.baseWidget)
            self.layout.setDirection(QtGui.QBoxLayout.LeftToRight)
            self.layout.setObjectName("layout")

            self.l1 = self.label("l1","current command: ")
            self.lcommand = self.label("lcommand", "None")
            self.w1 = self.lineedit("w1",width=100)
            self.l2 = self.label("l1","value:")
            self.w2 = self.lineedit("w2",width=100)
            self.q1 = self.combo("q1",[("String","App::PropertyString"),("Float","App::PropertyFloat"),("Vector","App::PropertyVector")])
            self.b1 = self.button("b1","OK")

            self.layout.addStretch(100)

    def show(self,text=None):
        self.l1.show()
        self.lcommand.show()
        self.baseWidget.show()
        self.seWidget.setVisible(True)
        if text:
            self.lcommand.setText(text)

    def hide(self):
        self.seWidget.setVisible(False)
        self.reset()
        
    def showPropEntry(self,callback):
        """
        Shows the widgets for property entry
        """
        self.show()
        self.lcommand.setText("Add Property")
        self.w1.show()
        self.l2.show()
        self.w2.show()
        self.q1.show()
        self.b1.show()

    def reset(self):
        self.w1.hide()
        self.l2.hide()
        self.w2.hide()
        self.q1.hide()
        self.b1.hide()
        self.lcommand.setText('None')
        

    def button (self,name, text, hide=True, icon=None, width=66, checkable=False):
        button = QtGui.QPushButton(self.baseWidget)
        button.setObjectName(name)
        button.setText(text)
        button.setMaximumSize(QtCore.QSize(width,26))
        if hide:
            button.hide()
        if checkable:
            button.setCheckable(True)
            button.setChecked(False)
        self.layout.addWidget(button)
        return button

    def combo(self, name, choices, hide=True):
        combo = QtGui.QComboBox(self.baseWidget)
        combo.setObjectName(name)
        if hide: combo.hide()
        for (name,userdata) in choices:
            combo.addItem(name,userdata)
        self.layout.addWidget(combo)
        return combo

    def label (self,name, text=None, hide=True):
        label = QtGui.QLabel(self.baseWidget)
        label.setObjectName(name)
        if hide: label.hide()
        if text: label.setText(text)
        self.layout.addWidget(label)
        return label

    def lineedit (self, name, hide=True, width=None):
        lineedit = DraftLineEdit(self.baseWidget)
        lineedit.setObjectName(name)
        if hide: lineedit.hide()
        if not width: width = 800
        lineedit.setMaximumSize(QtCore.QSize(width,22))
        self.layout.addWidget(lineedit)
        return lineedit