Python PySide.QtGui.QDockWidget() Examples

The following are 18 code examples of PySide.QtGui.QDockWidget(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module PySide.QtGui , or try the search function .
Example #1
Source File: cq_cad_tools.py    From kicad-3d-models-in-freecad with GNU General Public License v2.0 6 votes vote down vote up
def restore_Main_Tools():

    #Getting the main window will allow us to start setting things up the way we want
    mw = FreeCADGui.getMainWindow()

    #Adjust the docks as usual
    dockWidgets = mw.findChildren(QtGui.QDockWidget)
    for widget in dockWidgets:
        if (widget.objectName() == "Report view") or (widget.objectName() == "Python console") or (widget.objectName() == "Combo View"):
            widget.setVisible(True)
        if (widget.objectName()=="cqCodeView"):
            widget.setVisible(False)

    return 0


###################################################################
# z_RotateObject()  maui
#   Function to z-rotate an object
#
################################################################### 
Example #2
Source File: a2p_constraintDialog.py    From A2plus with GNU Lesser General Public License v2.1 6 votes vote down vote up
def onTimer(self):
        if a2plib.getConstraintEditorRef(): # != None
            # the editor box is active, do not show self
            self.hide()
        else:
            if not self.isVisible():
                self.show()
                self.resize(200,250)
            # calculate window center position and save it
            # self.rect().center() does not work here somehow
            frame = QtGui.QDockWidget.frameGeometry(self)
            x = frame.x()
            y = frame.y()

            global CONSTRAINT_DIALOG_STORED_POSITION
            CONSTRAINT_DIALOG_STORED_POSITION = QtCore.QPoint(x,y)

        self.timer.start(100) 
Example #3
Source File: Command.py    From cadquery-freecad-module with GNU Lesser General Public License v3.0 5 votes vote down vote up
def Activated(self):
        mw = FreeCADGui.getMainWindow()

        # Tracks whether or not we have already added the variables editor
        isPresent = False

        # If the widget is open, we need to close it
        dockWidgets = mw.findChildren(QtGui.QDockWidget)
        for widget in dockWidgets:
            if widget.objectName() == "cqVarsEditor":
                # Toggle the visibility of the widget
                if widget.visibleRegion().isEmpty():
                    widget.setVisible(True)
                else:
                    widget.setVisible(False)

                isPresent = True

        if not isPresent:
            cqVariablesEditor = QtGui.QDockWidget("CadQuery Variables Editor")
            cqVariablesEditor.setObjectName("cqVarsEditor")

            mw.addDockWidget(QtCore.Qt.LeftDockWidgetArea, cqVariablesEditor)

        # Go ahead and populate the view if there are variables in the script
        CadQueryValidateScript().Activated() 
Example #4
Source File: PySimulator.py    From PySimulator with GNU Lesser General Public License v3.0 5 votes vote down vote up
def createConsoleWindow(self):
        '''  The information output shall replace the outputs from the python shell '''

        self.textOutput = windowConsole.WindowConsole(self)
        self.dockTextOutput = QtGui.QDockWidget('Information output', self)
        self.dockTextOutput.setWidget(self.textOutput)
        self.addDockWidget(QtCore.Qt.BottomDockWidgetArea, self.dockTextOutput)
        self._origStdout = sys.stdout
        sys.stdout = self.textOutput  # sometimes causes crashes of Python.exe 
Example #5
Source File: cq_cad_tools.py    From kicad-3d-models-in-freecad with GNU General Public License v2.0 5 votes vote down vote up
def close_CQ_Example(App, Gui):

    #close the example
    App.setActiveDocument("Ex000_Introduction")
    App.ActiveDocument=App.getDocument("Ex000_Introduction")
    Gui.ActiveDocument=Gui.getDocument("Ex000_Introduction")
    App.closeDocument("Ex000_Introduction")
    FreeCAD.Console.PrintMessage('\r\nEx000 Closed\r\n')

    #Getting the main window will allow us to start setting things up the way we want
    mw = FreeCADGui.getMainWindow()

    #Adjust the docks as usual
    dockWidgets = mw.findChildren(QtGui.QDockWidget)
    for widget in dockWidgets:
        if (widget.objectName() == "Report view") or (widget.objectName() == "Python console") or (widget.objectName() == "Combo View"):
            widget.setVisible(True)
        if (widget.objectName()=="cqCodeView"):
            widget.setVisible(False)
    FreeCAD.Console.PrintMessage('Dock adjusted\r\n')

    return 0


###################################################################
# FuseObjs_wColors()  maui
#   Function to fuse two objects together.
################################################################### 
Example #6
Source File: transform.py    From Animation with GNU General Public License v2.0 5 votes vote down vote up
def config(self):
		self.dialog=TelescopWidget(self)
		#self.dialog.show()
		mw = FreeCADGui.getMainWindow()
		#dock = QtGui.QDockWidget("Mein Dock", mw)
		dock = QtGui.QDockWidget(self.Object.Label, mw)
		dock.setStyleSheet("background-color:yellow;color:brown;")
		mw.centralWidget = QtGui.QWidget(dock)
		mw.addDockWidget(QtCore.Qt.LeftDockWidgetArea, dock)
		dock.setWidget(self.dialog) 
Example #7
Source File: transform.py    From Animation with GNU General Public License v2.0 5 votes vote down vote up
def config(self):
		self.dialog=HingeWidget(self)
		# self.dialog.show()
		
		mw = FreeCADGui.getMainWindow()
		dock = QtGui.QDockWidget(self.Object.Label, mw)
		dock.setStyleSheet("background-color:lightblue;color:blue;")
		mw.centralWidget = QtGui.QWidget(dock)
		mw.addDockWidget(QtCore.Qt.LeftDockWidgetArea, dock)
		dock.setWidget(self.dialog)
		say("widget set") 
Example #8
Source File: mainwindow.py    From MARA_Framework with GNU Lesser General Public License v3.0 5 votes vote down vote up
def setupDock(self):
        '''Setup empty Dock at startup. '''
        self.dock = QtGui.QDockWidget("Classes", self)
        self.dock.setWidget(self.tree)
        self.dock.setFeatures(QtGui.QDockWidget.NoDockWidgetFeatures)
        self.addDockWidget(QtCore.Qt.LeftDockWidgetArea, self.dock) 
Example #9
Source File: Shared.py    From cadquery-freecad-module with GNU Lesser General Public License v3.0 5 votes vote down vote up
def populateParameterEditor(parameters):
    """Puts the proper controls in the script variable editor pane based on the parameters found"""

    mw = FreeCADGui.getMainWindow()

    # If the widget is open, we need to close it
    dockWidgets = mw.findChildren(QtGui.QDockWidget)
    for widget in dockWidgets:
        if widget.objectName() == "cqVarsEditor":
            gridLayout = QtGui.QGridLayout()

            line = 1

            # Add controls for all the parameters so that they can be edited from the GUI
            for pKey, pVal in list(parameters.items()):
                label = QtGui.QLabel(pKey)

                # We want to keep track of this parameter value field so that we can pull its value later when executing
                value = QtGui.QLineEdit()
                value.setText(str(pVal.default_value))
                value.setObjectName("pcontrol_" + pKey)

                # Add the parameter control sets, one set per line
                gridLayout.addWidget(label, line, 0)
                gridLayout.addWidget(value, line, 1)

                line += 1

            # Create a widget we can put the layout in and add a scrollbar
            newWidget = QtGui.QWidget()
            newWidget.setLayout(gridLayout)

            # Add a scroll bar in case there are a lot of variables in the script
            scrollArea = QtGui.QScrollArea()
            scrollArea.setBackgroundRole(QtGui.QPalette.Light)
            scrollArea.setStyleSheet("QLabel { color : black; }");
            scrollArea.setWidget(newWidget)

            widget.setWidget(scrollArea) 
Example #10
Source File: InitGui.py    From cadquery-freecad-module with GNU Lesser General Public License v3.0 5 votes vote down vote up
def Activated(self):
        import os
        try:
            from . import module_locator
        except:
            import module_locator
        try:
            from CadQuery.CQGui import ImportCQ
        except:
            from CQGui import ImportCQ

        module_base_path = module_locator.module_path()

        import cadquery
        from PySide import QtGui, QtCore

        msg = QtGui.QApplication.translate(
            "cqCodeWidget",
            "CadQuery " + cadquery.__version__ + "\r\n"
            "CadQuery is a parametric scripting API "
            "for creating and traversing CAD models\r\n"
            "Author: David Cowden\r\n"
            "License: Apache-2.0\r\n"
            "Website: https://github.com/dcowden/cadquery\r\n",
            None)
        FreeCAD.Console.PrintMessage(msg)

        #Getting the main window will allow us to start setting things up the way we want
        mw = FreeCADGui.getMainWindow()

        dockWidgets = mw.findChildren(QtGui.QDockWidget)

        for widget in dockWidgets:
            if widget.objectName() == "Report view":
                widget.setVisible(True)

        # Set up the paths to allow us to open the template
        # template_path = os.path.join(module_base_path, 'Templates')
        # template_path = os.path.join(template_path, 'script_template.py')
        #
        # ImportCQ.open(template_path) 
Example #11
Source File: SurfaceEdit.py    From CurvesWB with GNU Lesser General Public License v2.1 5 votes vote down vote up
def getComboView(mw):
   dw=mw.findChildren(QtGui.QDockWidget)
   for i in dw:
       if str(i.objectName()) == "Combo View":
           return i.findChild(QtGui.QTabWidget)
       elif str(i.objectName()) == "Python Console":
           return i.findChild(QtGui.QTabWidget)
   raise Exception ("No tab widget found") 
Example #12
Source File: Command.py    From cadquery-freecad-module with GNU Lesser General Public License v3.0 5 votes vote down vote up
def Activated(self):
        # Grab our main window so we can interact with it
        mw = FreeCADGui.getMainWindow()

        reportView = mw.findChild(QtGui.QDockWidget, "Report view")

        # Clear the view because it gets overwhelmed sometimes and won't scroll to the bottom
        reportView.widget().clear() 
Example #13
Source File: mainwindow.py    From AndroBugs_Framework with GNU General Public License v3.0 5 votes vote down vote up
def setupDock(self):
        '''Setup empty Dock at startup. '''
        self.dock = QtGui.QDockWidget("Classes", self)
        self.dock.setWidget(self.tree)
        self.dock.setFeatures(QtGui.QDockWidget.NoDockWidgetFeatures)
        self.addDockWidget(QtCore.Qt.LeftDockWidgetArea, self.dock) 
Example #14
Source File: mainwindow.py    From TimeMachine with GNU Lesser General Public License v3.0 5 votes vote down vote up
def setupDock(self):
        '''Setup empty Dock at startup. '''
        self.dock = QtGui.QDockWidget("Classes", self)
        self.dock.setWidget(self.tree)
        self.dock.setFeatures(QtGui.QDockWidget.NoDockWidgetFeatures)
        self.addDockWidget(QtCore.Qt.LeftDockWidgetArea, self.dock) 
Example #15
Source File: a2p_constraintDialog.py    From A2plus with GNU Lesser General Public License v2.1 5 votes vote down vote up
def storeWindowPosition(self):
        # ConstraintDialog has Priority on storing its position
        if a2plib.getConstraintDialogRef() != None:
            return
        frame = QtGui.QDockWidget.frameGeometry(self)
        x = frame.x()
        y = frame.y()

        global CONSTRAINT_DIALOG_STORED_POSITION
        CONSTRAINT_DIALOG_STORED_POSITION = QtCore.QPoint(x,y) 
Example #16
Source File: ZebraTool.py    From CurvesWB with GNU Lesser General Public License v2.1 5 votes vote down vote up
def getComboView(mw):
   dw=mw.findChildren(QtGui.QDockWidget)
   for i in dw:
       if str(i.objectName()) == "Combo View":
           return i.findChild(QtGui.QTabWidget)
       elif str(i.objectName()) == "Python Console":
           return i.findChild(QtGui.QTabWidget)
   raise Exception ("No tab widget found") 
Example #17
Source File: sublink_edit.py    From CurvesWB with GNU Lesser General Public License v2.1 5 votes vote down vote up
def __init__(self, obj):
        self.obj = obj
        self.main_win = FreeCADGui.getMainWindow()
        self.widget = QtGui.QDockWidget()
        self.widget.ui = myWidget_Ui(obj)
        self.widget.ui.setupUi(self.widget)
        
        self.widget.ui.pushButton_7.clicked.connect(self.accept)
        
        self.main_win.addDockWidget(QtCore.Qt.RightDockWidgetArea,self.widget)
        self.widget.setFloating(True)
        
        self.initial_visibility = self.obj.ViewObject.Visibility
        self.obj.ViewObject.Visibility = False 
Example #18
Source File: sublink_edit.py    From CurvesWB with GNU Lesser General Public License v2.1 5 votes vote down vote up
def getComboView(mw):
   dw = mw.findChildren(QtGui.QDockWidget)
   for i in dw:
       if str(i.objectName()) == "Combo View":
           return i.findChild(QtGui.QTabWidget)
       elif str(i.objectName()) == "Python Console":
           return i.findChild(QtGui.QTabWidget)
   raise Exception ("No tab widget found")