def __init__(self, parent, model, **params): super(TachogramPlotDatasourceListWidget, self).__init__(parent, add_widget_to_parent=True, layout=QVBoxLayout()) self.params = Params(**params) toolbars = ToolBarManager( self, CheckUncheckToolBarWidget, OperationalToolBarWidget, toolbar_close_handler=self.params.close_tachogram_plot_handler) self.layout().addWidget(toolbars) self.__showTachogramsButton__ = PushButtonWidget( self, i18n="poincare.plot.show.tachograms.button", i18n_def="Show tachograms", enabled=False, clicked_handler=self.__showTachogramsHandler__, enabled_precheck_handler=self.__enabledPrecheckHandler__) self.__allowTachogramsDuplicationButton__ = CheckBoxWidget( self, i18n="poincare.plot.allow.tachograms.duplications.button", i18n_def="Allow tachograms duplication", enabled=False, enabled_precheck_handler=self.__enabledPrecheckHandler__) self.__closeAllTachogramsButton__ = PushButtonWidget( self, i18n="poincare.plot.close.all.tachograms.button", i18n_def="Close all tachograms", enabled=False, clicked_handler=self.__closeTachogramsHandler__) self.__datasourceList__ = \ ListWidgetWidget(self, list_item_clicked_handler=self.__datasourceItemClickedHandler__, # @IgnorePep8 list_item_double_clicked_handler=self.__datasourceDoubleItemClickedHandler__, # @IgnorePep8 selectionMode=QAbstractItemView.MultiSelection, selectionBehavior=QAbstractItemView.SelectRows) if len(model) > 0: for row in range(len(model)): fileSpecification = model[row] ListWidgetItemWidget(self.__datasourceList__, text=fileSpecification.filename, data=fileSpecification) else: ListWidgetItemWidget(self.__datasourceList__, text='model not specified or incorrect type') self.__filesPreviewButton__ = PushButtonWidget( self, i18n="poincare.plot.files.preview.button", i18n_def="Files preview", enabled=False, clicked_handler=self.__filesPreviewHandler__, enabled_precheck_handler=self.__enabledPrecheckHandler__)
def __init__(self, parent, **params): super(ActivityDockWidget, self).__init__(parent, title=params.get('title', 'Activities'), **params) self.setObjectName("ActivityDockWidget") self.setAllowedAreas(Qt.LeftDockWidgetArea | Qt.RightDockWidgetArea | Qt.TopDockWidgetArea | Qt.BottomDockWidgetArea) layout = QVBoxLayout() layout.setMargin(0) # no margin for internal layout self.dockComposite = CompositeWidget( self, layout=layout, not_add_widget_to_parent_layout=True) self.listWidget = ListWidgetWidget( self.dockComposite, list_item_double_clicked_handler=self.__list_item_handler__, selectionMode=QAbstractItemView.MultiSelection, sizePolicy=QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)) for activity in ActivityManager.getActivities(PLUGIN_ACTIVITY_TYPE): if activity: ListWidgetItemWidget(self.listWidget, text=activity.label, data=activity) self.clearAll = PushButtonWidget(self.dockComposite, i18n="clear.all.activity.button", i18n_def="Clear all activities", clicked_handler=self.__clear_list__) self.setWidget(self.dockComposite) parent.addDockWidget(Qt.RightDockWidgetArea, self) SignalDispatcher.addSignalSubscriber(self, ADD_ACTIVITY_SIGNAL, self.__add_activity__) SignalDispatcher.addSignalSubscriber(self, CLEAR_ACTIVITIES_SIGNAL, self.__clear_list__)