def __init__(self, parent): QtGui.QStatusBar.__init__(self, parent) from camelot.view.controls.busy_widget import BusyWidget self.busy_widget = BusyWidget(self) self.busy_widget.setMinimumWidth(100) self.addPermanentWidget(self.busy_widget, 0) mt = get_model_thread() mt.thread_busy_signal.connect(self.busy_widget.set_busy) # the model thread might allready be busy before we connected to it self.busy_widget.set_busy(mt.busy())
class StatusBar(QtGui.QStatusBar): def __init__(self, parent): QtGui.QStatusBar.__init__(self, parent) from camelot.view.controls.busy_widget import BusyWidget self.busy_widget = BusyWidget(self) self.busy_widget.setMinimumWidth(100) self.addPermanentWidget(self.busy_widget, 0) mt = get_model_thread() mt.thread_busy_signal.connect( self.busy_widget.set_busy ) # the model thread might allready be busy before we connected to it self.busy_widget.set_busy(mt.busy())
def __init__(self, parent=None): from camelot.view.controls.busy_widget import BusyWidget from camelot.view.model_thread import get_model_thread super(Dashboard, self).__init__(parent) desktop = QCoreApplication.instance().desktop() self.resize(desktop.width() * Dashboard.SCALE, desktop.height() * Dashboard.SCALE) self.closemark = CloseMark(QPixmap('close-mark.png'), self) self.setBGColor(Qt.white) busy_widget = BusyWidget(self) busy_widget.setMinimumSize( desktop.width() * Dashboard.SCALE, desktop.height() * Dashboard.SCALE ) #self.addPermanentWidget(busy_widget, 0) mt = get_model_thread() mt.thread_busy_signal.connect( busy_widget.set_busy ) busy_widget.set_busy(mt.busy())
def set_toolbar_actions(self, toolbar_area, toolbar_actions): """Set the toolbar for a specific area :param toolbar_area: the area on which to put the toolbar, from :class:`Qt.LeftToolBarArea` through :class:`Qt.BottomToolBarArea` :param toolbar_actions: a list of :class:`camelot.admin.action..base.Action` objects, as returned by the :meth:`camelot.admin.application_admin.ApplicationAdmin.get_toolbar_actions` method. """ from camelot.view.controls.action_widget import ActionAction if toolbar_actions != None: # # gather menu bar actions to prevent duplication of QActions # qactions = dict() menu_bar = self.menuBar() if menu_bar: for qaction in menu_bar.findChildren(ActionAction): qactions[qaction.action] = qaction toolbar = QtGui.QToolBar(_('Toolbar')) self.addToolBar(toolbar_area, toolbar) toolbar.setObjectName('MainWindowToolBar_%i' % toolbar_area) toolbar.setMovable(False) toolbar.setFloatable(False) for action in toolbar_actions: qaction = qactions.get(action, None) if qaction == None: qaction = action.render(self.gui_context, toolbar) qaction.triggered.connect(self.action_triggered) toolbar.addAction(qaction) self.toolbars.append(toolbar) toolbar.addWidget(BusyWidget())
def set_toolbar_actions(self, actions): layout = self.findChild( QtGui.QLayout, 'layout' ) if layout and actions: toolbar = QtWidgets.QToolBar() for action in actions: qaction = action.render( self.gui_context, toolbar ) qaction.triggered.connect( self.action_triggered ) toolbar.addAction( qaction ) toolbar.addWidget( BusyWidget() ) layout.insertWidget( 0, toolbar, 0, Qt.AlignTop ) # @todo : this show is needed on OSX or the form window # is hidden after the toolbar is added, maybe this can # be solved using windowflags, since this causes some # flicker self.show()
def __init__(self, parent=None): from camelot.view.controls.busy_widget import BusyWidget from camelot.view.model_thread import get_model_thread super(Dashboard, self).__init__(parent) desktop = QCoreApplication.instance().desktop() self.resize(desktop.width() * Dashboard.SCALE, desktop.height() * Dashboard.SCALE) self.closemark = CloseMark(QPixmap('close-mark.png'), self) self.setBGColor(Qt.white) busy_widget = BusyWidget(self) busy_widget.setMinimumSize(desktop.width() * Dashboard.SCALE, desktop.height() * Dashboard.SCALE) #self.addPermanentWidget(busy_widget, 0) mt = get_model_thread() mt.thread_busy_signal.connect(busy_widget.set_busy) busy_widget.set_busy(mt.busy())