我们从Python开源项目中,提取了以下11个代码示例,用于说明如何使用PySide.QtGui.QDockWidget()。
def __init__(self, sandbox, *args, **kwargs): QtGui.QDockWidget.__init__(self, 'Sources', *args, **kwargs) self.sandbox = sandbox layout = QtGui.QVBoxLayout() layout.setContentsMargins(3, 3, 3, 3) sources = SourcesList(sandbox) sources_add_menu = SourcesAddButton(sandbox) self.setFeatures(QtGui.QDockWidget.DockWidgetFloatable | QtGui.QDockWidget.DockWidgetMovable) self.widget = QtGui.QWidget() self.widget.setLayout(layout) self.widget.layout().addWidget(sources) self.widget.layout().addWidget(sources_add_menu) self.setWidget(self.widget)
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")
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)
def run(): dw=QtGui.QDockWidget() dw.setWindowTitle("Zebra Tool") centralWidget = QtGui.QWidget() dw.setWidget(centralWidget) layout = QtGui.QVBoxLayout() centralWidget.setLayout(layout) dw.setMinimumSize(250, 305) z=zebra() layout.addWidget(z.zebraWidget) FreeCADWindow = FreeCADGui.getMainWindow() FreeCADWindow.addDockWidget(QtCore.Qt.LeftDockWidgetArea,dw)
def createDockWidget (self) : ''' Put GetInputs widget in dock ''' self.dockWidget = QtGui.QDockWidget(self) self.inputs = GetInputs () self.inputs.runButton.clicked.connect (self.newFamily) self.inputs.runButton.setStatusTip ("Initiate processing.") self.dockWidget.setWidget(self.inputs) self.addDockWidget(QtCore.Qt.BottomDockWidgetArea, self.dockWidget)
def importBRD(filename, wersjaFormatu): ''' ''' #try: #mw = QtGui.qApp.activeWindow() #mw.findChild(QtGui.QDockWidget, "Report view").layout().itemAt(0).widget().clear() #except AttributeError: # Linux #pass mw = FreeCADGui.getMainWindow() mw.findChild(QtGui.QDockWidget, "Report view").layout().itemAt(0).widget().clear() if wersjaFormatu == "eagle": plytkaPCB = EaglePCB(filename) elif wersjaFormatu == "freepcb": plytkaPCB = FreePCB() elif wersjaFormatu == "geda": plytkaPCB = gEDA_PCB(filename) elif wersjaFormatu == "fidocadj": plytkaPCB = FidoCadJ_PCB(filename) elif wersjaFormatu == "razen": plytkaPCB = Razen_PCB() elif wersjaFormatu == "kicad_v3": plytkaPCB = KiCadv3_PCB(filename) elif wersjaFormatu == "kicad_v4": plytkaPCB = KiCadv4_PCB(filename) elif wersjaFormatu == "idf_v2": plytkaPCB = IDFv2_PCB(filename) elif wersjaFormatu == "idf_v3": plytkaPCB = IDFv3_PCB(filename) elif wersjaFormatu == "idf_v4": plytkaPCB = IDFv4_PCB(filename) elif wersjaFormatu == "diptrace": plytkaPCB = DipTrace_PCB(filename) elif wersjaFormatu == "hyp_v2": plytkaPCB = HYP_PCB(filename) dial = plytkaPCB.dialogMAIN if dial.exec_(): docname = os.path.splitext(os.path.basename(filename))[0] doc = FreeCAD.newDocument(docname) groupBRD = createGroup_PCB() ###### start = time.time() plytkaPCB.setProject(filename) plytka = plytkaPCB.generate(doc, groupBRD, filename) FreeCAD.Console.PrintWarning('Total time: %i[s]\n' % (time.time() - start)) ###### FreeCADGui.ActiveDocument.ActiveView.viewAxometric() FreeCADGui.ActiveDocument.ActiveView.fitAll() view = pcbToolBarView() view.changeDisplayMode('Shaded') return plytka
def __init__(self, *args, **kwargs): QtGui.QMainWindow.__init__(self, *args, **kwargs) self.loadUi() self.views = [KiteScene, KiteQuadtree, KiteCovariance] self.ptree = KiteParameterTree(showHeader=False) self.ptree_dock = QtGui.QDockWidget('Parameters', self) self.ptree_dock.setFeatures(QtGui.QDockWidget.DockWidgetFloatable | QtGui.QDockWidget.DockWidgetMovable) self.ptree_dock.setWidget(self.ptree) self.addDockWidget( QtCore.Qt.LeftDockWidgetArea, self.ptree_dock) self.model = SceneModel() self.model.sigSceneModelChanged.connect( self.buildViews) self.sigLoadFile.connect( self.model.loadFile) self.sigImportFile.connect( self.model.importFile) self.sigLoadConfig.connect( self.model.loadConfig) self.sigExportWeightMatrix.connect( self.model.exportWeightMatrix) self.actionSave_config.triggered.connect( self.onSaveConfig) self.actionSave_scene.triggered.connect( self.onSaveScene) self.actionLoad_config.triggered.connect( self.onLoadConfig) self.actionLoad_scene.triggered.connect( self.onOpenScene) self.actionImport_scene.triggered.connect( self.onImportScene) self.actionExport_quadtree.triggered.connect( self.onExportQuadtree) self.actionExport_weights.triggered.connect( self.onExportWeightMatrix) self.actionAbout_Spool.triggered.connect( self.aboutDialog().show) self.actionHelp.triggered.connect( lambda: QtGui.QDesktopServices.openUrl('http://pyrocko.org')) self.log = SceneLog(self, self.model) self.actionLog.triggered.connect( self.log.show) self.progress = QtGui.QProgressDialog('', None, 0, 0, self) self.progress.setValue(0) self.progress.closeEvent = lambda ev: ev.ignore() self.progress.setMinimumWidth(400) self.progress.setWindowTitle('processing...') self.model.sigProcessingFinished.connect(self.progress.reset)