コード例 #1
0
 def __init__(self):
     """
     Class __init__ method
     """
     super(AlertsPlugin, self).__init__('alerts', __default_settings__, settings_tab_class=AlertsTab)
     self.weight = -3
     self.icon_path = ':/plugins/plugin_alerts.png'
     self.icon = build_icon(self.icon_path)
     AlertsManager(self)
     self.manager = Manager('alerts', init_schema)
     self.alert_form = AlertForm(self)
コード例 #2
0
ファイル: alertsplugin.py プロジェクト: simhnna/openlp
 def __init__(self):
     """
     Class __init__ method
     """
     super(AlertsPlugin, self).__init__('alerts',
                                        __default_settings__,
                                        settings_tab_class=AlertsTab)
     self.weight = -3
     self.icon_path = UiIcons().alert
     self.icon = self.icon_path
     AlertsManager(self)
     self.manager = Manager('alerts', init_schema)
     self.alert_form = AlertForm(self)
     register_endpoint(alerts_endpoint)
     register_endpoint(api_alerts_endpoint)
コード例 #3
0
ファイル: alertsplugin.py プロジェクト: marmyshev/bug_1117098
 def __init__(self):
     super(AlertsPlugin, self).__init__('alerts', __default_settings__, settings_tab_class=AlertsTab)
     self.weight = -3
     self.icon_path = ':/plugins/plugin_alerts.png'
     self.icon = build_icon(self.icon_path)
     self.alerts_manager = AlertsManager(self)
     self.manager = Manager('alerts', init_schema)
     self.alert_form = AlertForm(self)
コード例 #4
0
ファイル: alertsplugin.py プロジェクト: marmyshev/transitions
 def __init__(self):
     Plugin.__init__(self, u'alerts', __default_settings__, settings_tab_class=AlertsTab)
     self.weight = -3
     self.iconPath = u':/plugins/plugin_alerts.png'
     self.icon = build_icon(self.iconPath)
     self.alertsmanager = AlertsManager(self)
     self.manager = Manager(u'alerts', init_schema)
     self.alertForm = AlertForm(self)
コード例 #5
0
ファイル: alertsplugin.py プロジェクト: simhnna/openlp
class AlertsPlugin(Plugin):
    """
    The Alerts Plugin Class
    """
    log.info('Alerts Plugin loaded')

    def __init__(self):
        """
        Class __init__ method
        """
        super(AlertsPlugin, self).__init__('alerts',
                                           __default_settings__,
                                           settings_tab_class=AlertsTab)
        self.weight = -3
        self.icon_path = UiIcons().alert
        self.icon = self.icon_path
        AlertsManager(self)
        self.manager = Manager('alerts', init_schema)
        self.alert_form = AlertForm(self)
        register_endpoint(alerts_endpoint)
        register_endpoint(api_alerts_endpoint)

    def add_tools_menu_item(self, tools_menu):
        """
        Give the alerts plugin the opportunity to add items to the **Tools** menu.

        :param tools_menu: The actual **Tools** menu item, so that your actions can use it as their parent.
        """
        log.info('add tools menu')
        self.tools_alert_item = create_action(
            tools_menu,
            'toolsAlertItem',
            text=translate('AlertsPlugin', '&Alert'),
            icon=UiIcons().alert,
            statustip=translate('AlertsPlugin', 'Show an alert message.'),
            visible=False,
            can_shortcuts=True,
            triggers=self.on_alerts_trigger)
        self.main_window.tools_menu.addAction(self.tools_alert_item)

    def initialise(self):
        """
        Initialise plugin
        """
        log.info('Alerts Initialising')
        super(AlertsPlugin, self).initialise()
        self.tools_alert_item.setVisible(True)
        action_list = ActionList.get_instance()
        action_list.add_action(self.tools_alert_item, UiStrings().Tools)

    def finalise(self):
        """
        Tidy up on exit
        """
        log.info('Alerts Finalising')
        self.manager.finalise()
        super(AlertsPlugin, self).finalise()
        self.tools_alert_item.setVisible(False)
        action_list = ActionList.get_instance()
        action_list.remove_action(self.tools_alert_item, 'Tools')

    def toggle_alerts_state(self):
        """
        Switch the alerts state
        """
        self.alerts_active = not self.alerts_active
        Settings().setValue(self.settings_section + '/active',
                            self.alerts_active)

    def on_alerts_trigger(self):
        """
        Start of the Alerts dialog triggered from the main menu.
        """
        self.alert_form.load_list()
        self.alert_form.exec()

    @staticmethod
    def about():
        """
        Plugin Alerts about method

        :return: text
        """
        about_text = translate(
            'AlertsPlugin', '<strong>Alerts Plugin</strong>'
            '<br />The alert plugin controls the displaying of alerts on the display screen.'
        )
        return about_text

    def set_plugin_text_strings(self):
        """
        Called to define all translatable texts of the plugin
        """
        # Name PluginList
        self.text_strings[StringContent.Name] = {
            'singular': translate('AlertsPlugin', 'Alert', 'name singular'),
            'plural': translate('AlertsPlugin', 'Alerts', 'name plural')
        }
        # Name for MediaDockManager, SettingsManager
        self.text_strings[StringContent.VisibleName] = {
            'title': translate('AlertsPlugin', 'Alerts', 'container title')
        }

    @staticmethod
    def get_display_javascript():
        """
        Add Javascript to the main display.
        """
        return JAVASCRIPT

    def get_display_css(self):
        """
        Add CSS to the main display.
        """
        align = VerticalType.Names[self.settings_tab.location]
        return CSS.format(vertical_align=align,
                          font_family=self.settings_tab.font_face,
                          font_size=self.settings_tab.font_size,
                          color=self.settings_tab.font_color,
                          background_color=self.settings_tab.background_color)

    @staticmethod
    def get_display_html():
        """
        Add HTML to the main display.
        """
        return HTML

    def refresh_css(self, frame):
        """
        Trigger an update of the CSS in the main display.

        :param frame: The Web frame holding the page.
        """
        align = VerticalType.Names[self.settings_tab.location]
        frame.evaluateJavaScript(
            'update_css("{align}", "{face}", "{size}", "{color}", '
            '"{background}")'.format(
                align=align,
                face=self.settings_tab.font_face,
                size=self.settings_tab.font_size,
                color=self.settings_tab.font_color,
                background=self.settings_tab.background_color))
コード例 #6
0
ファイル: alertsplugin.py プロジェクト: marmyshev/bug_1117098
class AlertsPlugin(Plugin):
    log.info('Alerts Plugin loaded')

    def __init__(self):
        super(AlertsPlugin, self).__init__('alerts', __default_settings__, settings_tab_class=AlertsTab)
        self.weight = -3
        self.icon_path = ':/plugins/plugin_alerts.png'
        self.icon = build_icon(self.icon_path)
        self.alerts_manager = AlertsManager(self)
        self.manager = Manager('alerts', init_schema)
        self.alert_form = AlertForm(self)

    def add_tools_menu_item(self, tools_menu):
        """
        Give the alerts plugin the opportunity to add items to the **Tools** menu.

        ``tools_menu``
            The actual **Tools** menu item, so that your actions can use it as their parent.
        """
        log.info('add tools menu')
        self.tools_alert_item = create_action(tools_menu, 'toolsAlertItem',
            text=translate('AlertsPlugin', '&Alert'), icon=':/plugins/plugin_alerts.png',
            statustip=translate('AlertsPlugin', 'Show an alert message.'),
            visible=False, can_shortcuts=True, triggers=self.on_alerts_trigger)
        self.main_window.tools_menu.addAction(self.tools_alert_item)

    def initialise(self):
        log.info('Alerts Initialising')
        super(AlertsPlugin, self).initialise()
        self.tools_alert_item.setVisible(True)
        action_list = ActionList.get_instance()
        action_list.add_action(self.tools_alert_item, UiStrings().Tools)

    def finalise(self):
        """
        Tidy up on exit
        """
        log.info('Alerts Finalising')
        self.manager.finalise()
        super(AlertsPlugin, self).finalise()
        self.tools_alert_item.setVisible(False)
        action_list = ActionList.get_instance()
        action_list.remove_action(self.tools_alert_item, 'Tools')

    def toggle_alerts_state(self):
        self.alerts_active = not self.alerts_active
        Settings().setValue(self.settings_section + '/active', self.alerts_active)

    def on_alerts_trigger(self):
        self.alert_form.load_list()
        self.alert_form.exec_()

    def about(self):
        about_text = translate('AlertsPlugin', '<strong>Alerts Plugin</strong>'
            '<br />The alert plugin controls the displaying of nursery alerts on the display screen.')
        return about_text

    def set_plugin_text_strings(self):
        """
        Called to define all translatable texts of the plugin
        """
        ## Name PluginList ##
        self.text_strings[StringContent.Name] = {
            'singular': translate('AlertsPlugin', 'Alert', 'name singular'),
            'plural': translate('AlertsPlugin', 'Alerts', 'name plural')
        }
        ## Name for MediaDockManager, SettingsManager ##
        self.text_strings[StringContent.VisibleName] = {
            'title': translate('AlertsPlugin', 'Alerts', 'container title')
        }

    def get_display_javascript(self):
        """
        Add Javascript to the main display.
        """
        return JAVASCRIPT

    def get_display_css(self):
        """
        Add CSS to the main display.
        """
        align = VerticalType.Names[self.settings_tab.location]
        return CSS % (align, self.settings_tab.font_face, self.settings_tab.font_size, self.settings_tab.font_color,
            self.settings_tab.background_color)

    def get_display_html(self):
        """
        Add HTML to the main display.
        """
        return HTML

    def refresh_css(self, frame):
        """
        Trigger an update of the CSS in the maindisplay.

        ``frame``
            The Web frame holding the page.
        """
        align = VerticalType.Names[self.settings_tab.location]
        frame.evaluateJavaScript('update_css("%s", "%s", "%s", "%s", "%s")' %
            (align, self.settings_tab.font_face, self.settings_tab.font_size,
            self.settings_tab.font_color, self.settings_tab.background_color))