コード例 #1
0
    def __output_file_listener__(self, _filename):
        if not hasattr(self, '__outcome_files_tracker__'):
            self.__outcome_files_tracker__ = OutcomeFilesTrackerDockWidget(
                self)
        self.__outcome_files_tracker__.show()
        self.__outcome_files_tracker__.appendFile(_filename)

        if hasattr(self, '__poincare_datasources_table__'):
            self.__poincare_datasources_table__.checkMarkFile(_filename)
コード例 #2
0
class TachogramPlotCompositeWidget(MainWindowWidget):
    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))

    def toolbar_maximum_handler(self):
        SignalDispatcher.broadcastSignal(MAXIMIZE_TACHOGRAM_PLOT_SIGNAL)

    def toolbar_restore_handler(self):
        SignalDispatcher.broadcastSignal(RESTORE_TACHOGRAM_PLOT_SIGNAL)

    def toolbar_close_handler(self):
        SignalDispatcher.broadcastSignal(CLOSE_TACHOGRAM_PLOT_SIGNAL, self)

    def show_poincare_settings_handler(self):
        if not hasattr(self, "__poincare_settings__"):
            self.__poincare_settings__ = PoincarePlotSettingsDockWidget(
                self, data_accessor=self.data_accessor, output_file_listener=self.__output_file_listener__
            )
        self.__poincare_settings__.show()

    #    def __change_unit_handler__(self, _unit):
    #        self.tachogramPlot.changeXUnit(_unit)
    #        statusbar = StatusBarWidget(self.__initial_tab__)
    #        self.__initial_tab__.setStatusBar(statusbar)
    #        statusLabel = LabelWidget(statusbar,
    #                    i18n_def="STATUS",
    #                    add_widget_to_parent=True)
    #

    def __output_file_listener__(self, _filename):
        if not hasattr(self, "__outcome_files_tracker__"):
            self.__outcome_files_tracker__ = OutcomeFilesTrackerDockWidget(self)
        self.__outcome_files_tracker__.show()
        self.__outcome_files_tracker__.appendFile(_filename)

    @property
    def file_specification(self):
        """
        property method returns file_specification object associate with
        tachogram plot window
        """
        return self.params.file_specification

    def show_poincare_movie_handler(self):
        if not hasattr(self, "__poincare_movie__"):
            self.__poincare_movie__ = PoincarePlotMovieDockWidget(
                self, data_accessor=self.data_accessor, output_file_listener=self.__output_file_listener__
            )
        self.__poincare_movie__.show()
コード例 #3
0
    def __output_file_listener__(self, _filename):
        if not hasattr(self, "__outcome_files_tracker__"):
            self.__outcome_files_tracker__ = OutcomeFilesTrackerDockWidget(self)
        self.__outcome_files_tracker__.show()
        self.__outcome_files_tracker__.appendFile(_filename)

        if hasattr(self, "__poincare_datasources_table__"):
            self.__poincare_datasources_table__.checkMarkFile(_filename)
コード例 #4
0
 def __output_file_listener__(self, _filename):
     if not hasattr(self, "__outcome_files_tracker__"):
         self.__outcome_files_tracker__ = OutcomeFilesTrackerDockWidget(self)
     self.__outcome_files_tracker__.show()
     self.__outcome_files_tracker__.appendFile(_filename)
コード例 #5
0
 def __output_file_listener__(self, _filename):
     if not hasattr(self, '__outcome_files_tracker__'):
         self.__outcome_files_tracker__ = OutcomeFilesTrackerDockWidget(
             self)
     self.__outcome_files_tracker__.show()
     self.__outcome_files_tracker__.appendFile(_filename)
コード例 #6
0
class TachogramPlotCompositeWidget(MainWindowWidget):
    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))

    def toolbar_maximum_handler(self):
        SignalDispatcher.broadcastSignal(MAXIMIZE_TACHOGRAM_PLOT_SIGNAL)

    def toolbar_restore_handler(self):
        SignalDispatcher.broadcastSignal(RESTORE_TACHOGRAM_PLOT_SIGNAL)

    def toolbar_close_handler(self):
        SignalDispatcher.broadcastSignal(CLOSE_TACHOGRAM_PLOT_SIGNAL, self)

    def show_poincare_settings_handler(self):
        if not hasattr(self, '__poincare_settings__'):
            self.__poincare_settings__ = PoincarePlotSettingsDockWidget(
                self,
                data_accessor=self.data_accessor,
                output_file_listener=self.__output_file_listener__)
        self.__poincare_settings__.show()


#    def __change_unit_handler__(self, _unit):
#        self.tachogramPlot.changeXUnit(_unit)
#        statusbar = StatusBarWidget(self.__initial_tab__)
#        self.__initial_tab__.setStatusBar(statusbar)
#        statusLabel = LabelWidget(statusbar,
#                    i18n_def="STATUS",
#                    add_widget_to_parent=True)
#

    def __output_file_listener__(self, _filename):
        if not hasattr(self, '__outcome_files_tracker__'):
            self.__outcome_files_tracker__ = OutcomeFilesTrackerDockWidget(
                self)
        self.__outcome_files_tracker__.show()
        self.__outcome_files_tracker__.appendFile(_filename)

    @property
    def file_specification(self):
        """
        property method returns file_specification object associate with
        tachogram plot window
        """
        return self.params.file_specification

    def show_poincare_movie_handler(self):
        if not hasattr(self, '__poincare_movie__'):
            self.__poincare_movie__ = PoincarePlotMovieDockWidget(
                self,
                data_accessor=self.data_accessor,
                output_file_listener=self.__output_file_listener__)
        self.__poincare_movie__.show()
コード例 #7
0
class TachogramPlotSummaryCompositeWidget(MainWindowWidget):
    """
    initial tachogram plot window used to take operations
    on the whole group of tachogram plots
    """

    def __init__(self, parent, **params):
        super(TachogramPlotSummaryCompositeWidget, self).__init__(parent, **params)
        set_temporary_settings_id(self)
        self.params = Params(**params)

        self.addToolBar(OperationalToolBarWidget(self, excluded_buttons=[CloseToolButton]))
        self.addToolBar(PoincareToolBarWidget(self, reload_button=True))

        self.__central_widget__ = CompositeWidget(self, not_add_widget_to_parent_layout=True)
        layout = QVBoxLayout()
        self.__central_widget__.setLayout(layout)
        self.setCentralWidget(self.__central_widget__)
        self.__file_specifications__ = []
        self.__selected_files_specifications_handler__ = None
        SignalDispatcher.addSignalSubscriber(self, CLOSE_TACHOGRAM_PLOT_SIGNAL, self.__removeFileSpecification__)

    def toolbar_maximum_handler(self):
        SignalDispatcher.broadcastSignal(MAXIMIZE_TACHOGRAM_PLOT_SIGNAL)

    def toolbar_restore_handler(self):
        SignalDispatcher.broadcastSignal(RESTORE_TACHOGRAM_PLOT_SIGNAL)

    def toolbar_close_handler(self):
        SignalDispatcher.broadcastSignal(CLOSE_TACHOGRAM_PLOT_SIGNAL, self)

    def addFileSpecification(self, _file_specification):
        if self.__file_specifications__.count(_file_specification) == 0:
            self.__file_specifications__.append(_file_specification)

    def reload_poincare_settings_handler(self):
        """
        handler call by PoincareToolBarWidget toolbar
        reloads poincare plot settings widget
        """
        if hasattr(self, "__poincare_settings__"):
            self.removeDockWidget(self.__poincare_settings__)
            self.layout().removeWidget(self.__poincare_settings__)
            self.__poincare_settings__.deleteLater()
            delattr(self, "__poincare_settings__")

        if hasattr(self, "__poincare_datasources_table__"):
            self.layout().removeWidget(self.__poincare_datasources_table__)
            self.__poincare_datasources_table__.deleteLater()
            delattr(self, "__poincare_datasources_table__")

        self.show_poincare_settings_handler()

    def show_poincare_settings_handler(self):
        """
        handler call by PoincareToolBarWidget toolbar
        """

        if self.__selected_files_specifications_handler__:
            selected_files_specifications = self.__selected_files_specifications_handler__()
            if len(selected_files_specifications) > 0:
                for file_specification in selected_files_specifications:
                    self.addFileSpecification(file_specification)

        if len(self.__file_specifications__) == 0:
            InformationWindow(message="No data sources selected !")
            return
        if not hasattr(self, "__poincare_settings__"):

            # to convert data accessor objects based on file specification
            # objects to inform a user about progression special kind of
            # progress bar is used
            data_accessors_group_converter = FilesSpecificationsToDataAccessorsGroupConverter(
                self, self.__file_specifications__
            )

            data_vectors_accessor_group = data_accessors_group_converter.data_vectors_accessors_group

            self.__poincare_settings__ = PoincarePlotSettingsDockWidget(
                self,
                data_vectors_accessor_group=data_vectors_accessor_group,
                output_file_listener=self.__output_file_listener__,
                # save outcomes button in PoincarePlotSettingsDockWidget
                # have to be in fixed check state
                save_outcomes_fixed_state=True,
            )
        self.__poincare_settings__.show()

        if not hasattr(self, "__poincare_datasources_table__"):
            self.__poincare_datasources_table__ = PoincarePlotDatasourcesTableWidget(
                self.__central_widget__, data_accessors=data_vectors_accessor_group.data_vectors_accessors
            )  # @IgnorePep8
        self.__poincare_datasources_table__.show()

    def __output_file_listener__(self, _filename):
        if not hasattr(self, "__outcome_files_tracker__"):
            self.__outcome_files_tracker__ = OutcomeFilesTrackerDockWidget(self)
        self.__outcome_files_tracker__.show()
        self.__outcome_files_tracker__.appendFile(_filename)

        if hasattr(self, "__poincare_datasources_table__"):
            self.__poincare_datasources_table__.checkMarkFile(_filename)

    def setSelectedFilesSpecificationsHandler(self, _selected_files_specifications_handler):
        self.__selected_files_specifications_handler__ = _selected_files_specifications_handler

    def __removeFileSpecification__(self, _tachogram_plot_tab):
        """
        method is invoked when tachogram plot is closed to remove
        corresponding position from self.__file_specifications__
        """
        if widgets_have_the_same_parent(self, _tachogram_plot_tab, TACHOGRAM_PLOT_TAB_ITEM_WIDGET_OBJECT_NAME):
            if self.__file_specifications__.count(_tachogram_plot_tab.file_specification) > 0:
                del self.__file_specifications__[
                    self.__file_specifications__.index(_tachogram_plot_tab.file_specification)
                ]
コード例 #8
0
class TachogramPlotSummaryCompositeWidget(MainWindowWidget):
    """
    initial tachogram plot window used to take operations
    on the whole group of tachogram plots
    """
    def __init__(self, parent, **params):
        super(TachogramPlotSummaryCompositeWidget,
              self).__init__(parent, **params)
        set_temporary_settings_id(self)
        self.params = Params(**params)

        self.addToolBar(
            OperationalToolBarWidget(self, excluded_buttons=[CloseToolButton]))
        self.addToolBar(PoincareToolBarWidget(self, reload_button=True))

        self.__central_widget__ = CompositeWidget(
            self, not_add_widget_to_parent_layout=True)
        layout = QVBoxLayout()
        self.__central_widget__.setLayout(layout)
        self.setCentralWidget(self.__central_widget__)
        self.__file_specifications__ = []
        self.__selected_files_specifications_handler__ = None
        SignalDispatcher.addSignalSubscriber(self, CLOSE_TACHOGRAM_PLOT_SIGNAL,
                                             self.__removeFileSpecification__)

    def toolbar_maximum_handler(self):
        SignalDispatcher.broadcastSignal(MAXIMIZE_TACHOGRAM_PLOT_SIGNAL)

    def toolbar_restore_handler(self):
        SignalDispatcher.broadcastSignal(RESTORE_TACHOGRAM_PLOT_SIGNAL)

    def toolbar_close_handler(self):
        SignalDispatcher.broadcastSignal(CLOSE_TACHOGRAM_PLOT_SIGNAL, self)

    def addFileSpecification(self, _file_specification):
        if self.__file_specifications__.count(_file_specification) == 0:
            self.__file_specifications__.append(_file_specification)

    def reload_poincare_settings_handler(self):
        """
        handler call by PoincareToolBarWidget toolbar
        reloads poincare plot settings widget
        """
        if hasattr(self, '__poincare_settings__'):
            self.removeDockWidget(self.__poincare_settings__)
            self.layout().removeWidget(self.__poincare_settings__)
            self.__poincare_settings__.deleteLater()
            delattr(self, '__poincare_settings__')

        if hasattr(self, '__poincare_datasources_table__'):
            self.layout().removeWidget(self.__poincare_datasources_table__)
            self.__poincare_datasources_table__.deleteLater()
            delattr(self, '__poincare_datasources_table__')

        self.show_poincare_settings_handler()

    def show_poincare_settings_handler(self):
        """
        handler call by PoincareToolBarWidget toolbar
        """

        if self.__selected_files_specifications_handler__:
            selected_files_specifications = \
                        self.__selected_files_specifications_handler__()
            if len(selected_files_specifications) > 0:
                for file_specification in selected_files_specifications:
                    self.addFileSpecification(file_specification)

        if len(self.__file_specifications__) == 0:
            InformationWindow(message='No data sources selected !')
            return
        if not hasattr(self, '__poincare_settings__'):

            #to convert data accessor objects based on file specification
            #objects to inform a user about progression special kind of
            #progress bar is used
            data_accessors_group_converter = \
                FilesSpecificationsToDataAccessorsGroupConverter(
                                            self, self.__file_specifications__)

            data_vectors_accessor_group = \
                data_accessors_group_converter.data_vectors_accessors_group

            self.__poincare_settings__ = PoincarePlotSettingsDockWidget(
                self,
                data_vectors_accessor_group=data_vectors_accessor_group,
                output_file_listener=self.__output_file_listener__,
                #save outcomes button in PoincarePlotSettingsDockWidget
                #have to be in fixed check state
                save_outcomes_fixed_state=True)
        self.__poincare_settings__.show()

        if not hasattr(self, '__poincare_datasources_table__'):
            self.__poincare_datasources_table__ = \
                    PoincarePlotDatasourcesTableWidget(self.__central_widget__,
                        data_accessors=data_vectors_accessor_group.data_vectors_accessors) # @IgnorePep8
        self.__poincare_datasources_table__.show()

    def __output_file_listener__(self, _filename):
        if not hasattr(self, '__outcome_files_tracker__'):
            self.__outcome_files_tracker__ = OutcomeFilesTrackerDockWidget(
                self)
        self.__outcome_files_tracker__.show()
        self.__outcome_files_tracker__.appendFile(_filename)

        if hasattr(self, '__poincare_datasources_table__'):
            self.__poincare_datasources_table__.checkMarkFile(_filename)

    def setSelectedFilesSpecificationsHandler(
            self, _selected_files_specifications_handler):
        self.__selected_files_specifications_handler__ = \
                                    _selected_files_specifications_handler

    def __removeFileSpecification__(self, _tachogram_plot_tab):
        """
        method is invoked when tachogram plot is closed to remove
        corresponding position from self.__file_specifications__
        """
        if widgets_have_the_same_parent(
                self, _tachogram_plot_tab,
                TACHOGRAM_PLOT_TAB_ITEM_WIDGET_OBJECT_NAME):
            if self.__file_specifications__.count(
                    _tachogram_plot_tab.file_specification) > 0:
                del self.__file_specifications__[
                    self.__file_specifications__.index(
                        _tachogram_plot_tab.file_specification)]