Exemplo n.º 1
0
    def __init__(self, wxtrayicon_id=None):
        Notify.init("Outspline")

        # It should be safe if the icon is not found in the system
        self.ICON = "outspline-alarm"
        self.wxtrayicon_id = wxtrayicon_id

        organism_alarms_api.bind_to_alarm(self._handle_alarm)
Exemplo n.º 2
0
    def _enable(self):
        self.list_.enable_refresh()
        self.list_.refresh()
        self._update_tab_label()

        organism_alarms_api.bind_to_alarm(self._update_tab_label_after)
        organism_alarms_api.bind_to_alarm_off(self._update_tab_label)
        wxgui_api.bind_to_close_database(self._update_tab_label)
Exemplo n.º 3
0
    def __init__(self, wxtrayicon_id=None):
        Notify.init("Outspline")

        # It should be safe if the icon is not found in the system
        self.ICON = "outspline-alarm"
        self.wxtrayicon_id = wxtrayicon_id

        organism_alarms_api.bind_to_alarm(self._handle_alarm)
Exemplo n.º 4
0
    def __init__(self):
        self.ref_id = wx.NewId()
        self.DELAY = 50
        # Set SDELAY shorter than DELAY, so that if an alarm is activated at
        # the same time an alarm is dismissed, there's a better chance that
        # the icon starts blinking
        self.SDELAY = 30

        # Initialize self.delay and self.sdelay with a dummy function (int)
        self.delay = wx.CallLater(1, int)
        self.sdelay = wx.CallLater(1, int)

        self.active_alarms = {}

        self._update_tooltip()

        organism_alarms_api.bind_to_alarm(self._blink_after)
        organism_alarms_api.bind_to_alarm_off(self._stop_after)
        wxgui_api.bind_to_close_database(self._stop_after)
        core_api.bind_to_exit_app_2(self._exit)
Exemplo n.º 5
0
    def __init__(self):
        self.ref_id = wx.NewId()
        self.DELAY = 50
        # Set SDELAY shorter than DELAY, so that if an alarm is activated at
        # the same time an alarm is dismissed, there's a better chance that
        # the icon starts blinking
        self.SDELAY = 30

        # Initialize self.delay and self.sdelay with a dummy function (int)
        self.delay = wx.CallLater(1, int)
        self.sdelay = wx.CallLater(1, int)

        self.active_alarms = {}

        self._update_tooltip()

        organism_alarms_api.bind_to_alarm(self._blink_after)
        organism_alarms_api.bind_to_alarm_off(self._stop_after)
        wxgui_api.bind_to_close_database(self._stop_after)
        core_api.bind_to_exit_app_2(self._exit)
Exemplo n.º 6
0
    def _disable(self):
        self.list_.disable_refresh()

        organism_alarms_api.bind_to_alarm(self._update_tab_label_after, False)
        organism_alarms_api.bind_to_alarm_off(self._update_tab_label, False)
        wxgui_api.bind_to_close_database(self._update_tab_label, False)
Exemplo n.º 7
0
    def __init__(self, parent):
        wxgui_api.install_icon_bundle("wxalarms", '&alarmswin',
                                (("alarmswin16.png", ), ("alarmswin24.png", ),
                                ("alarmswin32.png", ), ("alarmswin48.png", ),
                                ("alarmswin64.png", ), ("alarmswin128.png", )))

        self.ALARMS_MIN_HEIGHT = 140
        self.ALARMS_ICON_BUNDLE = wxgui_api.get_frame_icon_bundle('&alarmswin')

        self.config = coreaux_api.get_plugin_configuration('wxalarms')

        self.window = wx.Frame(parent, size=[int(s)
                          for s in self.config['initial_geometry'].split('x')])

        self.window.SetIcons(self.ALARMS_ICON_BUNDLE)

        self.alarms = {}
        self._update_title()

        self.box = wx.BoxSizer(wx.VERTICAL)
        self.window.SetSizer(self.box)

        self.panel = wx.ScrolledWindow(self.window, style=wx.BORDER_THEME)
        self.panel.SetScrollRate(20, 20)
        self.pbox = wx.BoxSizer(wx.VERTICAL)
        self.panel.SetSizer(self.pbox)
        self.box.Add(self.panel, proportion=1, flag=wx.EXPAND | wx.ALL,
                                                                    border=4)

        self.hidden_panel = wx.BoxSizer(wx.HORIZONTAL)
        self._init_hidden_panel()
        self.box.Add(self.hidden_panel, flag=wx.LEFT | wx.RIGHT | wx.BOTTOM |
                                                        wx.EXPAND, border=4)
        self._hide_hidden_panel()

        self.bottom = wx.BoxSizer(wx.HORIZONTAL)
        self._init_bottom()
        self.box.Add(self.bottom, flag=wx.LEFT | wx.RIGHT | wx.EXPAND,
                                                                    border=4)

        # Set the minimum width so that the bottom controls can fit, and also
        # add 20 px for the stretch spacer
        minwidth = self.bottom.ComputeFittingWindowSize(self.window).GetWidth()
        self.window.SetMinSize((minwidth + 20, self.ALARMS_MIN_HEIGHT))

        self.DELAY = 50
        # Set CDELAY shorter than DELAY, so that if an alarm is activated at
        # the same time an alarm is dismissed, there's a better chance that
        # the alarm window requests the user attention
        self.CDELAY = 30

        # Initialize self.timer and self.stimer with a dummy function (int)
        self.timer = wx.CallLater(1, int)
        self.stimer = wx.CallLater(1, int)

        self.LIMIT = self.config.get_int('limit')
        self.hiddenalarms = set()

        self.ID_SHOW_MENU = wx.NewId()
        self.menushow = wx.MenuItem(wxgui_api.get_menu_view(),
                                self.ID_SHOW_MENU,
                                "Show &alarms window\t{}".format(
                                    self.config('GlobalShortcuts')['show']),
                                "Show the alarms window", kind=wx.ITEM_CHECK)
        wxgui_api.add_menu_view_item(self.menushow)

        TrayMenu(self)

        self.window.Bind(wx.EVT_CLOSE, self._handle_close)

        wxgui_api.bind_to_menu(self.toggle_shown, self.menushow)
        wxgui_api.bind_to_menu_view_update(self._handle_menu_view_update)

        organism_alarms_api.bind_to_alarm(self._handle_alarm)
        organism_alarms_api.bind_to_alarm_off(self._handle_alarm_off)
        wxgui_api.bind_to_close_database(self._handle_close_db)
Exemplo n.º 8
0
    def __init__(self, parent):
        wxgui_api.install_icon_bundle(
            "wxalarms",
            "&alarmswin",
            (
                ("alarmswin16.png",),
                ("alarmswin24.png",),
                ("alarmswin32.png",),
                ("alarmswin48.png",),
                ("alarmswin64.png",),
                ("alarmswin128.png",),
            ),
        )

        self.ALARMS_MIN_HEIGHT = 140
        self.ALARMS_ICON_BUNDLE = wxgui_api.get_frame_icon_bundle("&alarmswin")

        self.config = coreaux_api.get_plugin_configuration("wxalarms")

        self.window = wx.Frame(parent, size=[int(s) for s in self.config["initial_geometry"].split("x")])

        self.window.SetIcons(self.ALARMS_ICON_BUNDLE)

        self.alarms = {}
        self._update_title()

        self.box = wx.BoxSizer(wx.VERTICAL)
        self.window.SetSizer(self.box)

        self.panel = wx.ScrolledWindow(self.window, style=wx.BORDER_THEME)
        self.panel.SetScrollRate(20, 20)
        self.pbox = wx.BoxSizer(wx.VERTICAL)
        self.panel.SetSizer(self.pbox)
        self.box.Add(self.panel, proportion=1, flag=wx.EXPAND | wx.ALL, border=4)

        self.hidden_panel = wx.BoxSizer(wx.HORIZONTAL)
        self._init_hidden_panel()
        self.box.Add(self.hidden_panel, flag=wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.EXPAND, border=4)
        self._hide_hidden_panel()

        self.bottom = wx.BoxSizer(wx.HORIZONTAL)
        self._init_bottom()
        self.box.Add(self.bottom, flag=wx.LEFT | wx.RIGHT | wx.EXPAND, border=4)

        # Set the minimum width so that the bottom controls can fit, and also
        # add 20 px for the stretch spacer
        minwidth = self.bottom.ComputeFittingWindowSize(self.window).GetWidth()
        self.window.SetMinSize((minwidth + 20, self.ALARMS_MIN_HEIGHT))

        self.DELAY = 50
        # Set CDELAY shorter than DELAY, so that if an alarm is activated at
        # the same time an alarm is dismissed, there's a better chance that
        # the alarm window requests the user attention
        self.CDELAY = 30

        # Initialize self.timer and self.stimer with a dummy function (int)
        self.timer = wx.CallLater(1, int)
        self.stimer = wx.CallLater(1, int)

        self.LIMIT = self.config.get_int("limit")
        self.hiddenalarms = set()

        self.ID_SHOW_MENU = wx.NewId()
        self.menushow = wx.MenuItem(
            wxgui_api.get_menu_view(),
            self.ID_SHOW_MENU,
            "Show &alarms window\t{}".format(self.config("GlobalShortcuts")["show"]),
            "Show the alarms window",
            kind=wx.ITEM_CHECK,
        )
        wxgui_api.add_menu_view_item(self.menushow)

        TrayMenu(self)

        self.window.Bind(wx.EVT_CLOSE, self._handle_close)

        wxgui_api.bind_to_menu(self.toggle_shown, self.menushow)
        wxgui_api.bind_to_menu_view_update(self._handle_menu_view_update)

        organism_alarms_api.bind_to_alarm(self._handle_alarm)
        organism_alarms_api.bind_to_alarm_off(self._handle_alarm_off)
        wxgui_api.bind_to_close_database(self._handle_close_db)