Exemple #1
0
    def __init__(self, parent, **params):
        self.params = Params(**params)

        self.__splitter_idx__ = 0
        self.data_vectors_accessor_group = \
            self.params.data_vectors_accessor_group  # alias
        if not self.data_vectors_accessor_group == None:
            self.main_data_accessor = \
                self.data_vectors_accessor_group.group_data_vector_accessor
        else:
            self.main_data_accessor = self.params.data_accessor  # alias

        super(PoincarePlotSettingsDockWidget,
              self).__init__(parent,
                             title=params.get('title',
                                              'Poincare plot settings'),
                             **params)
        self.__splitter__ = SplitterWidget(self.dockComposite,
                                           orientation=Qt.Vertical)
        self.__splitter__.setHandleWidth(5)

        self.__createStatisticsWidget__(QVBoxLayout())
        self.__createFiltersWidget__(QHBoxLayout())
        self.__createOutputSpecificationWidget__(QVBoxLayout())
        self.__createMiscellaneousWidget__(QVBoxLayout())

        parent.addDockWidget(Qt.LeftDockWidgetArea, self)
Exemple #2
0
    def __init__(self, parent, **params):
        get_or_put(params, 'layout', QVBoxLayout())
        super(FiltersWidget, self).__init__(parent, **params)
        self.params = Params(**params)
        self.data_accessor = self.params.data_accessor  # alias
        #if self.params.use_apply_button == True:
        if 1 == 1:
            self.data_accessor.addListener(self,
                                __FilterActivatedDataVectorListener__(self))

        filtersGroup = GroupBoxWidget(self, layout=QVBoxLayout(),
                                      i18n_def=params.get('title', 'Filters'))
        annotation_widget_class = params.get('annotation_widget_class', False)
        if annotation_widget_class:
            self.__annotation_filter__ = annotation_widget_class(
                                filtersGroup, data_accessor=self.data_accessor)
        else:
            self.__annotation_filter__ = CommonAnnotationFilterWidget(
                                filtersGroup, data_accessor=self.data_accessor)

        self.__square_filter__ = SquareFilterWidget(filtersGroup,
                                data_accessor=self.data_accessor,
                                use_apply_button=self.params.use_apply_button)

        if params.get('restore_button', False):
            self.__restore_button__ = PushButtonWidget(filtersGroup,
                                     i18n_def='Back to unfiltered data',
                                     clicked_handler=self.__restore_handler__,
                                     enabled=False)
 def __init__(self, parent, **params):
     params = Params(**params)
     super(ListWidgetItemWidget, self).__init__(nvl(params.text, ''),
                                                parent)
     #store in data buffer of list item for later use
     if params.data:
         self.setData(Qt.UserRole, QVariant(params.data))
Exemple #4
0
 def __init__(self, **params):
     '''
     Constructor
     '''
     self.__params__ = Params(**params)
     if self.__params__.signal_unit is None:
         self.__params__.signal_unit = Millisecond
    def __init__(self, parent, **params):
        get_or_put(params, 'layout', QVBoxLayout())
        get_or_put(params, 'i18n_def', 'Statistics')
        super(StatisticsWidget, self).__init__(parent, **params)
        self.params = Params(**params)

        self.data_accessors = []
        self.main_data_accessor = None
        if not self.params.data_vectors_accessor_group == None:
            self.data_accessors = self.params.data_vectors_accessor_group.data_vectors_accessors  # @IgnorePep8
            self.main_data_accessor = self.params.data_vectors_accessor_group.group_data_vector_accessor  # @IgnorePep8
        elif not self.params.data_accessor == None:
            self.main_data_accessor = self.params.data_accessor
            self.data_accessors = [self.main_data_accessor]

        for data_accessor in self.data_accessors:
            data_accessor.addListener(self, __StatisticsVectorListener__(self))

        self.__createButtons__()
        self.__statistics_widget__ = StatisticsSelectionWidget(
            self,
            layout=QVBoxLayout(),
            i18n_def='',
            check_handler=self.__change_statistics_handler__)

        self.__summary_statistics_widget__ = SummaryStatisticsSelectionWidget(
            self,
            layout=QVBoxLayout(),
            i18n_def='Summary statistics',
            check_handler=self.__change_statistics_handler__)
Exemple #6
0
    def __init__(self, parent, **params):
        get_or_put(params, 'layout', QVBoxLayout())
        get_or_put(params, 'i18n_def', 'Miscellaneous')
        super(MiscellaneousWidget, self).__init__(parent, **params)

        LabelWidget(self, i18n_def='Data window shift: 1')
        self.params = Params(**params)
        self.params.data_accessor.addListener(
            self, __MiscellaneousVectorListener__(self))
        self.__window_size__ = __DataWindowSizeWidget__(
            self, self.params.data_accessor)

        self.__unitsWidget__ = TimeUnitsWidget(
            self,
            i18n_def='Units',
            default_unit=self.params.data_accessor.signal_x_unit,
            change_unit_handler=self.changeUnit,
            layout=QHBoxLayout())
        self.__unitsWidget__.addUnit(OrderUnit)

        self.__use_parameters__ = CompositeWidget(self, layout=QHBoxLayout())
        self.__use_buffer__ = CheckBoxWidget(self.__use_parameters__,
                                             i18n_def='Use buffer',
                                             checked=True)
        self.__use_identity_line__ = CheckBoxWidget(
            self.__use_parameters__,
            i18n_def='Use identity line',
            checked=True)

        self.__sample_step__ = __SampleStepWidget__(self,
                                                    self.params.data_accessor)

        self.__stepper_size__ = __StepperSizeWidget__(
            self, self.params.data_accessor)
Exemple #7
0
    def __init__(self, parent, **params):
        self.parent = parent
        self.__completed_count__ = 0
        self.selectedRow = None
        self.params = Params(**params)
        labels = [
            "",  # first column is checkable column
            QT_I18N("datasource.files.column.filename", "Filename"),
            QT_I18N("datasource.files.column.size", "Size"),
            QT_I18N("datasource.files.column.path", "File path")
        ]
        self.labels = QStringList(labels)

        self.filesTableView = TableViewWidget(
            parent,
            selectionBehavior=QAbstractItemView.SelectRows,
            selectionMode=QAbstractItemView.SingleSelection,
            enabled_precheck_handler=self.params.enabled_precheck_handler)
        if self.params.model:
            self.filesTableView.setModel(self.params.model)
        self.filesTableView.model().setHorizontalHeaderLabels(labels)
        self.filesTableView.setEditTriggers(QAbstractItemView.NoEditTriggers)
        if self.params.onClickedAction:
            self.filesTableView.connect(self.filesTableView,
                                        SIGNAL('clicked(QModelIndex)'),
                                        self.params.onClickedAction)
            if not self.filesTableView.model() == None:
                #a signal used when selected row state is changed
                self.filesTableView.connect(
                    self.filesTableView.model(),
                    SIGNAL('itemChanged(QStandardItem *)'),
                    self.__itemChanged__)
        if self.params.sorting:
            self.filesTableView.setSortingEnabled(True)
Exemple #8
0
    def __init__(self, parent, **params):
        get_or_put(params, 'layout', QHBoxLayout())
        self.params = Params(**params)
        self.data_accessor = self.params.data_accessor  # alias
        i18n_def = "Square filter " + self.data_accessor.signal_unit.display_label  # @IgnorePep8
        super(SquareFilterWidget, self).__init__(parent,
                                                 i18n_def=i18n_def,
                                                 **params)

        self.__filter__ = SquareFilter()

        LabelWidget(self, i18n_def="Min value")
        self.__min_value__ = NumberEditWidget(
            self, text_changed_handler=self.__min_handler__)
        LabelWidget(self, i18n_def="Max value")
        self.__max_value__ = NumberEditWidget(
            self, text_changed_handler=self.__max_handler__)

        if self.params.use_apply_button:
            self.__action_button__ = PushButtonWidget(
                self,
                i18n_def='Apply',
                clicked_handler=self.__filter_handler__)
        else:
            self.__action_button__ = CheckBoxWidget(
                self,
                i18n_def='Use filter',
                clicked_handler=self.__use_handler__)
            self.data_accessor.addListener(
                self, __SquareFilterDataVectorListener__(self))
            self.__action_button__.setChecked(False)

        self.reset()
Exemple #9
0
    def __init__(self, parent, **params):
        #super(TachogramPlotCanvas, self).__init__(parent,
        #                                not_add_widget_to_parent_layout=True)
        self.params = Params(**params)
        self.title_manager = __TitleManager__(
                                    NormalTachogramPlotEngine.DEFAULT_TITLE)
        self.data_accessor = self.params.data_accessor  # alias
        self.data_accessor.addListener(self, __CanvasDataVectorListener__(self)) # @IgnorePep8
        self.fig = Figure()
        self.axes = self.fig.add_subplot(111)

        self.__current_plot_engine__ = None

        FigureCanvas.__init__(self, self.fig)
        self.title_text = self.fig.suptitle(self.title_manager.title,
                                            fontsize=12)

        self.plot(NormalTachogramPlotEngine)

        # automatic layout adjustment to use available space more efficiently
        self.fig.tight_layout()
        self.setParent(parent)

        FigureCanvas.setSizePolicy(self, QSizePolicy.Expanding,
                                    QSizePolicy.Expanding)
        FigureCanvas.updateGeometry(self)
        self.__dropper__ = CopyDropper(self, STATISTIC_MIME_ID)
Exemple #10
0
 def __set_title__(self, **params):
     params = Params(**params)
     if params.filter_name:
         self.__canvas__.title_manager.addTitlePart('filtered',
                                                 params.filter_name)
     if params.remove_filter_names:
         self.__canvas__.title_manager.removeTitlePart('filtered')
Exemple #11
0
    def invoke(self, **params):
        local_params = Params(**params)
        if self.__plugin__ == None:
            return
        if self.__host_stack_object__ == None:
            return

        if self.__host_stack_object__:
            for signal in self.__plugin__.signals:
                _params = []
                for param in signal.params:
                    if not param.key == None:
                        _params.append(getattr(local_params, param.key))
                    elif not param.value == None:
                        if param.value.title() in ('True', 'False'):
                            _params.append(param.value.title() == 'True')
                        elif param.value == "None":
                            _params.append(None)
                        else:
                            _params.append(param.value)
                if local_params.activity_description \
                    and local_params.activity_params:
                    ActivityManager.saveActivity(
                        PluginActivity(
                            self.__ident__,
                            description=local_params.activity_description,
                            **get_subdict(params,
                                          keys=local_params.activity_params)))
                if len(params) > 0:
                    self.__host_stack_object__.emit(signal.resolveIdent,
                                                    *_params)
                else:
                    self.__host_stack_object__.emit(signal.resolveIdent)
Exemple #12
0
    def __init__(self,
                 parent=None,
                 create_menus=True,
                 main_workspace_name=GLOBALS.WORKSPACE_NAME,
                 main_widget_name=GLOBALS.TAB_MAIN_NAME,
                 **params):
        super(ApplicationMainWindow, self).__init__(parent)
        self.params = Params(**params)
        self.setObjectName(GLOBALS.MAIN_WINDOW_NAME)

        self.setWindowTitle(self.params.window_title)

        if create_menus == True:
            menuBuilder = QTMenuBuilder(self)
            menuBuilder.createMenus()

            if GLOBALS.START_MENU_ID:
                if menuBuilder.invokeMenuItem(GLOBALS.START_MENU_ID):
                    sys.exit(0)

        self.applicationMainTabWidget = None
        if main_workspace_name:
            self.applicationMainTabWidget = TabWidgetCommon(
                self,
                object_name=main_workspace_name,
                not_add_widget_to_parent_layout=True)
            if main_widget_name:
                self.mainWidget = MainTabItemWindow(
                    self.applicationMainTabWidget)
                self.applicationMainTabWidget.addTab(self.mainWidget,
                                                     main_widget_name)
                self.setCentralWidget(self.applicationMainTabWidget)

        self.connect(self, ADD_TAB_ITEM_WIDGET_SIGNAL, self.addTabWidget)
Exemple #13
0
    def __init__(self, parent, **params):
        super(DockWidgetWidget,
              self).__init__(nvl(params.get('title', None), ''), parent)
        if params.get('not_add_widget_to_parent_layout', None) == None:
            params['not_add_widget_to_parent_layout'] = True
        prepareWidget(parent=parent, widget=self, **params)
        self.params = Params(**params)
        if self.params.use_scroll_area == None:
            self.params.use_scroll_area = True
        if not self.params.dock_widget_location_changed == None:
            self.connect(self, DOCK_WIDGET_LOCATION_CHANGED_SIGNAL,
                         self.__dock_widget_location_changed__)
        self.setObjectName(self.__class__.__name__)
        self.setAllowedAreas(Qt.LeftDockWidgetArea | Qt.RightDockWidgetArea
                             | Qt.TopDockWidgetArea | Qt.BottomDockWidgetArea)
        layout = nvl(self.params.layout, QVBoxLayout())
        if hasattr(layout, 'setMargin'):
            layout.setMargin(0)
        self.scrollArea = None
        if self.params.use_scroll_area:
            self.scrollArea = QScrollArea(self)

        self.dockComposite = CompositeWidget(
            self, layout=layout, not_add_widget_to_parent_layout=True)

        if self.params.use_scroll_area:
            self.scrollArea.setWidget(self.dockComposite)
            self.scrollArea.setWidgetResizable(True)
            self.setWidget(self.scrollArea)
        else:
            self.setWidget(self.dockComposite)
Exemple #14
0
 def __init__(self, **params):
     self.params = Params(**params)
     self.__iconId = self.params.iconId
     self.__tipId = self.params.tipId
     self.__signal = self.params.signal
     self.__slot = self.params.handler
     self.__title = self.params.title
     self.__checkable = ("True" == str(self.params.checkable))
Exemple #15
0
 def __init__(self, default, **params):
     params = Params(**params)
     self.active = nvl(params.active, default.active)
     self.button_groups = nvl(params.button_groups, default.button_groups)
     self.handler_name = nvl(params.handler_name, default.handler_name)
     self.icon_id = nvl(params.icon_id, default.icon_id)
     self.title = nvl(params.title, default.title)
     self.handler_callable_name = default.handler_callable_name
    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__)
Exemple #17
0
 def __init__(self, _parent, _mime_id, **params):
     self.__mime_id__ = _mime_id
     self.__parent__ = _parent
     params = Params(**params)
     self.__parent__.setDragEnabled(True)
     if params.drag_only:
         if hasattr(self, 'setDragDropMode'):
             self.__parent__.setDragDropMode(QAbstractItemView.DragOnly)
     self.__objects__ = {}
 def __init__(self, parent, **params):
     self.params = Params(**params)
     super(TabularDataVectorPreviewDockWidget,
           self).__init__(parent,
                          title=params.get('title', 'Data preview'),
                          **params)
     self.data_accessor = self.params.data_accessor  # alias
     self.__createPreviewWidget__(QVBoxLayout())
     parent.addDockWidget(Qt.RightDockWidgetArea, self)
 def __init__(self, parent, **params):
     get_or_put(params, 'layout', QHBoxLayout())
     super(CommonAnnotationFilterWidget, self).__init__(parent, **params)
     self.params = Params(**params)
     self.data_accessor = self.params.data_accessor  # alias
     self.__filter__ = AnnotationFilter()
     self.__createAnnotationButtons__()
     self.createActionButton()
     self.__activateActionButton__(False)
Exemple #20
0
 def data(self, _data):
     self.__params__ = Params(signal=_data.signal,
                              signal_plus=_data.signal_plus,
                              signal_minus=_data.signal_minus,
                              annotation=_data.annotation,
                              signal_unit=_data.signal_unit,
                              time=_data.time,
                              signal_header=_data.signal_header,
                              annotation_header=_data.annotation_header,
                              time_header=_data.time_header)
    def __init__(self, parent, **params):
        get_or_put(params, 'layout', QVBoxLayout())
        get_or_put(params, 'i18n_def', 'Selected poincare plot datasources')
        super(PoincarePlotDatasourcesTableWidget, self).__init__(parent,
                                                                 **params)

        self.params = Params(**params)

        self.__createTable__()
        self.__createModel__()
Exemple #22
0
 def __init__(self,
              parent,
              data_vector_accessor_list,
              label_text=None,
              max_value=None,
              **params):
     self.parent = parent
     self.label_text = nvl(label_text, "Poincare plot generation")
     self.max_value = max_value
     self.__data_vector_accessor_list__ = data_vector_accessor_list
     self.params = Params(**params)
Exemple #23
0
    def __init__(self, parent, **params):
        get_or_put(params, 'layout', QVBoxLayout())
        get_or_put(params, 'i18n_def', 'Files')
        super(FilesTrackerWidget, self).__init__(parent, **params)

        self.params = Params(**params)

        self.__create_oper_buttons__()
        self.__createTable__()
        self.__createModel__()
        self.__create_misc_buttons__()
    def __init__(self, parent, **params):
        self.params = Params(**params)
        self.data_accessor = self.params.data_accessor  # alias
        super(OutcomeFilesTrackerDockWidget,
              self).__init__(parent,
                             title=params.get('title',
                                              'Outcome files tracker'),
                             **params)

        self.__createFilesTrackerWidget__(QVBoxLayout())

        parent.addDockWidget(Qt.RightDockWidgetArea, self)
 def __init__(self, parent, **params):
     self.params = Params(**params)
     super(TachogramPlotStatisticsDockWidget,
           self).__init__(parent,
                          title=params.get('title',
                                           'Tachogram plot statistics'),
                          **params)
     self.data_accessor = self.params.data_accessor  # alias
     self.data_accessor.addListener(
         self, __TachogramStatisticsDataVectorListener__(self))
     self.__createStatisticsWidget__(QVBoxLayout())
     parent.addDockWidget(Qt.RightDockWidgetArea, self)
    def __init__(self, parent, **params):
        super(TachogramPlotCompositeWidget, self).__init__(parent, **params)
        self.params = Params(**params)
        self.data_accessor = get_data_accessor_from_file_specification(
            self, self.params.file_specification)

        self.addToolBar(OperationalToolBarWidget(self))
        self.addToolBar(PoincareToolBarWidget(self))

        signal_unit = get_unit_by_class_name(
            self.params.file_specification.signal_unit_class_name)
        self.setCentralWidget(__TachogramPlot__(self, signal_unit=signal_unit))
Exemple #27
0
 def __init__(self, parent, **params):
     get_or_put(params, 'orientation', Qt.Horizontal)
     self.params = Params(**params)
     QSplitter.__init__(self, self.params.orientation, parent=parent)
     prepareWidget(parent=parent, widget=self, **params)
     self.setHandleWidth(self.handleWidth() * 2)
     if self.params.save_state:
         SettingsFactory.loadSettings(
             self,
             Setter(sizes_list=None,
                    _conv=QVariant.toPyObject,
                    _conv_2level=self.conv2level,
                    objectName=self.params.objectName))
Exemple #28
0
    def __init__(self, parent, **params):
        super(GlobalSeparatorWidget, self).__init__(parent, **params)
        self.params = Params(**params)

        self.globalSettingsCheckBox = None
        if self.params.globalHandler:
            self.globalSettingsCheckBox = CheckBoxWidget(
                                        self.separatorsGroupBox,
                                        i18n="separator.global.separator",
                                        i18n_def="Global separator")
            self.separatorsGroupBox.connect(self.globalSettingsCheckBox,
                                        SIGNAL("clicked()"),
                                        self.globalSettingsButtonClicked)
 def __init__(self, **params):
     self.params = Params(**params)
     self.__indexes__ = __Entities__(nvl(self.params.signal_index, -1),
                                     nvl(self.params.annotation_index, -1),
                                     nvl(self.params.time_index, -1))
     self.__headers__ = None
     self.__data_vector__ = None
     if not is_positive(self.params.time_index):
         self.__data_source__ = NumericalFileDataSource(**params)
     else:
         #if there is separate column of time all data are loaded
         #in string format, getDataVector method do further processing
         #and change into numerical values
         self.__data_source__ = TextFileDataSource(**params)
Exemple #30
0
def __message__(parent=None, **params):
    local_params = Params(**params)
    if local_params.title_id == None and local_params.title_default == None \
        and local_params.title == None:
        title = "Information"
    else:
        title = QT_I18N(local_params.title_id,
                        _default=local_params.title if local_params.title \
                                        else local_params.title_default,
                        **params)
    message = QT_I18N(local_params.message_id,
                      _default=local_params.message,
                      **params)
    return (title, message)