def activate(self):
        ''' Extend the plugin activate method.
        '''
        OptionPlugin.activate(self)

        # Initialize the catalog names.
        catalog_names = self.parent.event_library.get_catalogs_in_db(
            self.parent.project)
        self.pref_manager.set_limit('event_catalog', catalog_names)
        if catalog_names:
            self.pref_manager.set_value('event_catalog', catalog_names[0])

        # If an event already was selected, share it again.
        # TODO: Think about not deleting the shared information if the plugin
        # is deactivated. Otherwise not many plugins can be opened at a time.
        if self.selected_event:
            self.parent.add_shared_info(origin_rid=self.rid,
                                        name='selected_event',
                                        value=self.selected_event)

            # Add the pre- and post event time.
            start_time = self.selected_event[
                'start_time'] - self.pref_manager.get_value('pre_et')
            end_time = self.selected_event[
                'end_time'] + self.pref_manager.get_value('post_et')

            self.parent.displayManager.setTimeLimits(startTime=start_time,
                                                     endTime=end_time)
            self.clear_annotation()
            self.parent.updateDisplay()
Esempio n. 2
0
    def __init__(self):
        ''' Initialize the instance.

        '''
        OptionPlugin.__init__(self,
                              name='show detections',
                              category='view',
                              tags=['show', 'detection'])

        # Create the logging logger instance.
        logger_prefix = psysmon.logConfig['package_prefix']
        loggerName = logger_prefix + "." + __name__ + "." + self.__class__.__name__
        self.logger = logging.getLogger(loggerName)

        self.icons['active'] = icons.lighting_icon_16

        # The detection library.
        self.library = detect.Library(self.rid)

        # The selected catalog.
        self.selected_catalog = None

        # The plot colors used by the plugin.
        self.colors = {}
        self.colors['detection_vspan'] = '0.9'

        # Create the preferences.
        self.create_select_preferences()
 def activate(self):
     ''' Extend the plugin deactivate method.
     '''
     OptionPlugin.activate(self)
     if self.selected_event:
         self.parent.add_shared_info(origin_rid=self.rid,
                                     name='selected_event',
                                     value=self.selected_event)
Esempio n. 4
0
 def deactivate(self):
     ''' Extend the plugin deactivate method.
     '''
     OptionPlugin.deactivate(self)
     self.clear_annotation()
     # TODO: Think about not deleting the shared information if the plugin
     # is deactivated. Otherwise not many plugins can be opened at a time.
     self.parent.plugins_information_bag.remove_info(origin_rid=self.rid)
Esempio n. 5
0
    def activate(self):
        ''' Extend the plugin activate method.
        '''
        OptionPlugin.activate(self)

        # Initialize the catalog names.
        catalog_names = self.library.get_catalogs_in_db(self.parent.project)
        self.pref_manager.set_limit('detection_catalog', catalog_names)
        if catalog_names:
            self.pref_manager.set_value('detection_catalog', catalog_names[0])
            self.on_catalog_selected()
    def __init__(self):
        ''' Initialize the instance.
        '''
        OptionPlugin.__init__(self,
                              name='select array',
                              category='view',
                              tags=['array', 'view', 'select'])
        # The logging logger instance.
        logger_prefix = psysmon.logConfig['package_prefix']
        loggerName = logger_prefix + "." + __name__ + "." + self.__class__.__name__
        self.logger = logging.getLogger(loggerName)

        self.icons['active'] = icons._2x2_grid_icon_16

        self.lb = None
    def __init__(self):
        ''' The constructor

        '''
        OptionPlugin.__init__(self,
                              name='select station',
                              category='view',
                              tags=['station', 'view', 'select'])

        # Create the logging logger instance.
        loggerName = __name__ + "." + self.__class__.__name__
        self.logger = logging.getLogger(loggerName)

        self.icons['active'] = icons.pin_map_icon_16

        self.lb = None
    def __init__(self, with_run_button = True):
        ''' The constructor

        '''
        OptionPlugin.__init__(self,
                              name = 'processing stack',
                              category = 'proc',
                              tags = ['process', 'data']
                             )

        # Create the logging logger instance.
        loggerName = __name__ + "." + self.__class__.__name__
        self.logger = logging.getLogger(loggerName)

        self.icons['active'] = icons.layers_1_icon_16

        self.with_run_button = with_run_button
    def __init__(self):
        ''' The constructor.

        '''

        OptionPlugin.__init__(
            self,
            name='select channel',
            category='view',
            tags=['channel', 'view', 'select'],
        )

        # Create the logging logger instance.
        loggerName = __name__ + "." + self.__class__.__name__
        self.logger = logging.getLogger(loggerName)

        self.icons['active'] = icons.pin_sq_right_icon_16
Esempio n. 10
0
    def __init__(self):
        ''' Initialize the instance.

        '''
        OptionPlugin.__init__(self,
                              name='select event',
                              category='select',
                              tags=['event', 'select'])

        # Create the logging logger instance.
        logger_prefix = psysmon.logConfig['package_prefix']
        loggerName = logger_prefix + "." + __name__ + "." + self.__class__.__name__
        self.logger = logging.getLogger(loggerName)

        self.icons['active'] = icons.flag_icon_16

        # The events library.
        self.library = ev_core.Library(name=self.rid)

        # The currently selected event.
        self.selected_event = {}

        # The plot colors used by the plugin.
        self.colors = {}

        # Setup the pages of the preference manager.
        select_page = self.pref_manager.add_page('Select')
        dts_group = select_page.add_group('detection time span')
        es_group = select_page.add_group('event selection')

        item = psy_pm.DateTimeEditPrefItem(
            name='start_time',
            label='start time',
            value=UTCDateTime('2015-01-01T00:00:00'),
            tool_tip=
            'The start time of the detection time span (UTCDateTime string format YYYY-MM-DDTHH:MM:SS).'
        )
        dts_group.add_item(item)

        item = psy_pm.FloatSpinPrefItem(
            name='window_length',
            label='window length [s]',
            value=3600,
            limit=(0, 86400),
            digits=1,
            tool_tip=
            'The length of the time window for which events should be loaded.')
        dts_group.add_item(item)

        item = psy_pm.SingleChoicePrefItem(
            name='event_catalog',
            label='event catalog',
            value='',
            limit=[],
            tool_tip='Select an event catalog for which to load the events.')
        es_group.add_item(item)

        item = psy_pm.ActionItem(name='load_events',
                                 label='load events',
                                 mode='button',
                                 action=self.on_load_events)
        es_group.add_item(item)

        column_labels = [
            'db_id', 'start_time', 'length', 'public_id', 'description',
            'agency_uri', 'author_uri', 'comment'
        ]
        item = psy_pm.ListCtrlEditPrefItem(
            name='events',
            label='events',
            value=[],
            column_labels=column_labels,
            limit=[],
            hooks={'on_value_change': self.on_event_selected},
            tool_tip='The available events.')
        es_group.add_item(item)
Esempio n. 11
0
 def deactivate(self):
     ''' Extend the plugin deactivate method.
     '''
     OptionPlugin.deactivate(self)
     self.clear_annotation()
     self.parent.plugins_information_bag.remove_info(origin_rid=self.rid)
Esempio n. 12
0
    def __init__(self):
        ''' Initialize the instance.

        '''
        OptionPlugin.__init__(self,
                              name='show events',
                              category='view',
                              tags=['show', 'events'])

        # Create the logging logger instance.
        logger_prefix = psysmon.logConfig['package_prefix']
        loggerName = logger_prefix + "." + __name__ + "." + self.__class__.__name__
        self.logger = logging.getLogger(loggerName)

        self.icons['active'] = icons.flag_icon_16

        # The currently selected event.
        self.selected_event = {}

        # The plot colors used by the plugin.
        self.colors = {}
        self.colors['event_vspan'] = '0.9'

        # Setup the pages of the preference manager.
        self.pref_manager.add_page('Select')
        self.pref_manager.add_page('Display')

        item = psy_pm.DateTimeEditPrefItem(
            name='start_time',
            label='start time',
            group='detection time span',
            value=UTCDateTime('2015-01-01T00:00:00'),
            tool_tip=
            'The start time of the detection time span (UTCDateTime string format YYYY-MM-DDTHH:MM:SS).'
        )
        self.pref_manager.add_item(pagename='Select', item=item)

        item = psy_pm.FloatSpinPrefItem(
            name='window_length',
            label='window length [s]',
            group='detection time span',
            value=3600,
            limit=(0, 86400),
            digits=1,
            tool_tip=
            'The length of the time window for which events should be loaded.')
        self.pref_manager.add_item(pagename='Select', item=item)

        item = psy_pm.SingleChoicePrefItem(
            name='event_catalog',
            label='event catalog',
            group='event selection',
            value='',
            limit=[],
            tool_tip='Select an event catalog for which to load the events.')
        self.pref_manager.add_item(pagename='Select', item=item)

        #        item = psy_pm.CustomPrefItem(name = 'events',
        #                                     label = 'events',
        #                                     group = 'event selection',
        #                                     value = [],
        #                                     gui_class = EventListField,
        #                                     tool_tip = 'The start time of the detection time span (UTCDateTime string format YYYY-MM-DDTHH:MM:SS).')
        column_labels = [
            'db_id', 'start_time', 'length', 'public_id', 'description',
            'agency_uri', 'author_uri', 'comment'
        ]
        item = psy_pm.ListCtrlEditPrefItem(
            name='events',
            label='events',
            group='event selection',
            value=[],
            column_labels=column_labels,
            limit=[],
            hooks={'on_value_change': self.on_event_selected},
            tool_tip='The available events.')
        self.pref_manager.add_item(pagename='Select', item=item)

        item = psy_pm.ActionItem(name='load_events',
                                 label='load events',
                                 group='detection time span',
                                 mode='button',
                                 action=self.on_load_events)
        self.pref_manager.add_item(pagename='Select', item=item)

        item = psy_pm.FloatSpinPrefItem(
            name='pre_et',
            label='pre event time [s]',
            group='display range',
            value=5,
            limit=(0, 86400),
            digits=1,
            tool_tip=
            'The length of the time window to show before the event start.')
        self.pref_manager.add_item(pagename='Display', item=item)

        item = psy_pm.FloatSpinPrefItem(
            name='post_et',
            label='post event time [s]',
            group='display range',
            value=10,
            limit=(0, 86400),
            digits=1,
            tool_tip=
            'The length of the time window to show after the event end.')
        self.pref_manager.add_item(pagename='Display', item=item)

        item = psy_pm.CheckBoxPrefItem(
            name='show_event_limits',
            label='show event limits',
            value=True,
            hooks={'on_value_change': self.on_show_event_limits_changed},
            tool_tip='Show the limits of the selected event in the views.')
        self.pref_manager.add_item(pagename='Display', item=item)