def create(name, oname): oname += "-dock" d = QDockWidget(name, self) d.setObjectName(oname) # Needed for saveState ac = d.toggleViewAction() desc = _("Toggle %s") % name.replace("&", "") self.keyboard.register_shortcut(oname, desc, description=desc, action=ac, group=_("Windows")) actions[oname] = ac setattr(self, oname.replace("-", "_"), d) return d
def create(name, oname): oname += '-dock' d = QDockWidget(name, self) d.setObjectName(oname) # Needed for saveState ac = d.toggleViewAction() desc = _('Toggle %s') % name.replace('&', '') self.keyboard.register_shortcut( oname, desc, description=desc, action=ac, group=_('Windows')) actions[oname] = ac setattr(self, oname.replace('-', '_'), d) return d
def hide_DISABLED(self): """ Hide this widget. Makes sure that this widget is closed (hidden ) only when the B{View > Reports} action is unchecked @see: self.closeEvent @deprecated: Not needed and marked for removal. Mark 2008-01-18 """ if self.win.viewReportsAction.isChecked(): self.win.viewReportsAction.setChecked(False) # setChecked() generates signal and calls toggle() slot. return QDockWidget.hide(self)
def closeEvent(self, event): """ Makes sure that this widget is closed (hidden) only when the B{View > Reports} action is unchecked. Overrides QDockWidget.closeEvent() @parameter event: closeEvent for the QDockWidget """ if self.win.viewReportsAction.isChecked(): self.win.viewReportsAction.setChecked(False) # setChecked() generates signal and calls toggle() slot. return QDockWidget.closeEvent(self, event)
def show(self): """ Show this widget. Makes sure that this widget is shown only when the B{View > Reports} action is checked @see: B{self.closeEvent} """ if not env.prefs[displayReportsWidget_prefs_key]: return if not self.win.viewReportsAction.isChecked(): self.win.viewReportsAction.setChecked(True) return QDockWidget.show(self)
def __init__(self, win): QDockWidget.__init__(self, win) self.win = win #self.setupUi(self.win) self.setupUi(self) win.standardViewMethodDict = {} win.namedViewMethodDict = {} self.lastViewList = None #Signals QtCore.QObject.connect(self.saveNamedViewToolButton,QtCore.SIGNAL("clicked()"), win.saveNamedView) QtCore.QObject.connect(self.orientationViewList, SIGNAL("itemDoubleClicked(QListWidgetItem*)"), self.changeViewOrientation) QtCore.QObject.connect(self.pinOrientationWindowToolButton, SIGNAL("clicked()"), self.changePinIcon)
def __init__(self, win): QDockWidget.__init__(self, win) self.win = win #self.setupUi(self.win) self.setupUi(self) win.standardViewMethodDict = {} win.namedViewMethodDict = {} self.lastViewList = None #Signals QtCore.QObject.connect(self.saveNamedViewToolButton, QtCore.SIGNAL("clicked()"), win.saveNamedView) QtCore.QObject.connect(self.orientationViewList, SIGNAL("itemDoubleClicked(QListWidgetItem*)"), self.changeViewOrientation) QtCore.QObject.connect(self.pinOrientationWindowToolButton, SIGNAL("clicked()"), self.changePinIcon)
def __init__(self, win): """ Constructor for Ui_ReportsDockWidget. @param win: The main window @type win: QMainWindow """ QDockWidget.__init__(self, win) self.win = win #Define layout self._containerWidget = QWidget() self.setWidget(self._containerWidget) # Create vertical box layout self.vBoxLayout = QVBoxLayout(self._containerWidget) vBoxLayout = self.vBoxLayout vBoxLayout.setMargin(0) vBoxLayout.setSpacing(0) self.setEnabled(True) self.setFloating(False) self.setVisible(True) self.setWindowTitle(self._title) self.setAutoFillBackground(True) self.setPalette(getPalette( None, QPalette.Window, pmGrpBoxColor)) # Create the reports tabwidget. It will contain the history tab # and possibly other tabs containing reports. self.reportsTabWidget = QTabWidget() self.reportsTabWidget.setObjectName("reportsTabWidget") self.reportsTabWidget.setCurrentIndex(0) self.reportsTabWidget.setAutoFillBackground(True) vBoxLayout.addWidget(self.reportsTabWidget) # Create the history tab. It will contain the history widget. self.historyTab = QWidget() self.historyTab.setObjectName("historyTab") self.reportsTabWidget.addTab(self.historyTab, "History") self.historyTabLayout = QVBoxLayout(self.historyTab) historyTabLayout = self.historyTabLayout historyTabLayout.setMargin(0) historyTabLayout.setSpacing(0) self._addHistoryWidget() self.setMinimumHeight(100) self.setSizePolicy( QSizePolicy(QSizePolicy.Policy(QSizePolicy.Expanding), QSizePolicy.Policy(QSizePolicy.Expanding))) win.addDockWidget(Qt.BottomDockWidgetArea, self) # Since the connection to the toggle() slot hasn't been made yet, # we must set the checkmark and hide/show self manually. if env.prefs[displayReportsWidget_prefs_key]: self.win.viewReportsAction.setChecked(True) # No slot connected yet, so show self manually. self.show() else: self.win.viewReportsAction.setChecked(False) # No slot connected yet, so hide self manually. self.hide()
def __init__(self, parent=None): QDockWidget.__init__(self, parent)
def __init__(self, parentWidget, title = "", showWidget = True): """ Constructor for PM_dockWidget @param showWidget: If true, this class will show the widget immediately in the __init__ method itself. This is the default behavior and subclasses may pass appropriate value to this flag @type showWidget: bool """ self.labelWidget = None self._title = "" self._widgetList = [] self._rowCount = 0 QDockWidget.__init__(self, parentWidget) self.parentWidget = parentWidget self._title = title self.label = '' self.labelColumn = 0 self.spanWidth = True self.labelWidget = None if self.label: # Create this widget's QLabel. self.labelWidget = QLabel() self.labelWidget.setText(self.label) self.setEnabled(True) self.setFloating(False) self.setVisible(showWidget) self.setWindowTitle(self._title) self.setAutoFillBackground(True) self.setPalette(getPalette( None, QPalette.Window, pmGrpBoxColor)) self.parentWidget.addDockWidget(Qt.BottomDockWidgetArea, self) #Define layout self._containerWidget = QWidget() self.setWidget(self._containerWidget) # Create vertical box layout self.vBoxLayout = QVBoxLayout(self._containerWidget) self.vBoxLayout.setMargin(1) self.vBoxLayout.setSpacing(0) # Create grid layout self.gridLayout = QGridLayout() self.gridLayout.setMargin(1) self.gridLayout.setSpacing(1) # Insert grid layout in its own vBoxLayout self.vBoxLayout.addLayout(self.gridLayout) #self.parentWidget.addPmWidget(self) self._loadWidgets() try: self._addWhatsThisText() except: print_compact_traceback("Error loading whatsthis text for this " \ "property manager dock widget.") try: self._addToolTipText() except: print_compact_traceback("Error loading tool tip text for this " \ "property manager dock widget.")