예제 #1
0
    def create(self):
        self.dialog = wx.Dialog(wxgui_api.get_main_frame(),
                                title="Old alarms search",
                                style=wx.DEFAULT_DIALOG_STYLE & ~wx.CLOSE_BOX)

        self.csizer = wx.BoxSizer(wx.VERTICAL)
        self.dialog.SetSizer(self.csizer)

        self.vsizer = wx.BoxSizer(wx.VERTICAL)
        self.csizer.Add(self.vsizer, 1, flag=wx.EXPAND | wx.ALL, border=12)

        hsizer = wx.BoxSizer(wx.HORIZONTAL)
        self.vsizer.Add(hsizer, flag=wx.EXPAND | wx.BOTTOM, border=4)

        icon = wx.StaticBitmap(self.dialog, bitmap=wxgui_api.get_dialog_icon(
                                                        '@oldalarmsdialog'))
        hsizer.Add(icon, flag=wx.ALIGN_TOP | wx.RIGHT, border=12)

        self.label = wx.StaticText(self.dialog, label="Filtering the old "
                                "alarms found for {}...".format(self.filename))
        self.label.Wrap(self.WRAP)
        hsizer.Add(self.label)

        self.gauge = wx.Gauge(self.dialog)
        self.vsizer.Add(self.gauge, flag=wx.EXPAND | wx.BOTTOM, border=4)
        self.timer = wx.CallLater(100, self._pulse)

        self.csizer.Fit(self.dialog)

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

        # Don't show it modal because only one modal dialog can be shown at a
        # time, and managing the races among them would be a bigger mess than
        # making it safe to show them non modal
        self.dialog.Show()
예제 #2
0
def warn_user_rights(filename):
    return wx.MessageDialog(wxgui_api.get_main_frame(),
                            'You are not '
                            'authorized to '
                            'create or overwrite {}.'.format(filename),
                            caption="Export schedule view",
                            style=wx.OK | wx.ICON_EXCLAMATION)
예제 #3
0
def save_to_xml():
    return wx.FileDialog(wxgui_api.get_main_frame(),
                            message="Export schedule view",
                            defaultDir=os.path.expanduser('~'),
                            defaultFile="outspline_events.xml",
                            wildcard="XML (*.xml)|*.xml|All files (*)|*",
                            style=wx.SAVE | wx.FD_OVERWRITE_PROMPT)
예제 #4
0
def save_to_xml():
    return wx.FileDialog(wxgui_api.get_main_frame(),
                            message="Export schedule view",
                            defaultDir=os.path.expanduser('~'),
                            defaultFile="outspline_events.xml",
                            wildcard="XML (*.xml)|*.xml|All files (*)|*",
                            style=wx.SAVE | wx.FD_OVERWRITE_PROMPT)
예제 #5
0
def all_items_not_found():
    return wx.MessageDialog(
        wxgui_api.get_main_frame(),
        'All the selected search result items do not exist '
        'anymore. Re-execute the search for up-to-date results.',
        caption="Search",
        style=wx.OK | wx.ICON_EXCLAMATION)
예제 #6
0
    def create(self):
        self.dialog = wx.Dialog(wxgui_api.get_main_frame(),
                                title="Old alarms search",
                                style=wx.DEFAULT_DIALOG_STYLE & ~wx.CLOSE_BOX)

        self.csizer = wx.BoxSizer(wx.VERTICAL)
        self.dialog.SetSizer(self.csizer)

        self.vsizer = wx.BoxSizer(wx.VERTICAL)
        self.csizer.Add(self.vsizer, 1, flag=wx.EXPAND | wx.ALL, border=12)

        hsizer = wx.BoxSizer(wx.HORIZONTAL)
        self.vsizer.Add(hsizer, flag=wx.EXPAND | wx.BOTTOM, border=4)

        icon = wx.StaticBitmap(
            self.dialog, bitmap=wxgui_api.get_dialog_icon('@oldalarmsdialog'))
        hsizer.Add(icon, flag=wx.ALIGN_TOP | wx.RIGHT, border=12)

        self.label = wx.StaticText(self.dialog,
                                   label="Filtering the old "
                                   "alarms found for {}...".format(
                                       self.filename))
        self.label.Wrap(self.WRAP)
        hsizer.Add(self.label)

        self.gauge = wx.Gauge(self.dialog)
        self.vsizer.Add(self.gauge, flag=wx.EXPAND | wx.BOTTOM, border=4)
        self.timer = wx.CallLater(100, self._pulse)

        self.csizer.Fit(self.dialog)

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

        # Don't show it modal because only one modal dialog can be shown at a
        # time, and managing the races among them would be a bigger mess than
        # making it safe to show them non modal
        self.dialog.Show()
예제 #7
0
def warn_generic(text):
    return wx.MessageDialog(wxgui_api.get_main_frame(),
                            text,
                            caption="Test: generic warning",
                            style=wx.OK | wx.ICON_EXCLAMATION)
예제 #8
0
    def create(self):
        self.dialog = wx.Dialog(wxgui_api.get_main_frame(),
                                title="Old alarms search",
                                style=wx.DEFAULT_DIALOG_STYLE & ~wx.CLOSE_BOX)

        self.csizer = wx.BoxSizer(wx.VERTICAL)
        self.dialog.SetSizer(self.csizer)

        vsizer = wx.BoxSizer(wx.VERTICAL)
        self.csizer.Add(vsizer, 1, flag=wx.EXPAND | wx.ALL, border=12)

        hsizer1 = wx.BoxSizer(wx.HORIZONTAL)
        vsizer.Add(hsizer1, flag=wx.EXPAND | wx.BOTTOM, border=4)

        icon = wx.StaticBitmap(self.dialog, bitmap=wxgui_api.get_dialog_icon(
                                                        '@oldalarmsdialog'))
        hsizer1.Add(icon, flag=wx.ALIGN_TOP | wx.RIGHT, border=12)

        self.labeltext = ("{} was last saved {} days ago: searching the "
            "alarms that should have been activated since {{}}...".format(
                        self.filename,
                        int(round((time_.time() - self.last_search) / 86400))))
        self.label1 = wx.StaticText(self.dialog,
                                        label=self.labeltext.format("then"))
        self.label1.Wrap(self.WRAP)
        hsizer1.Add(self.label1)

        self.gauge = wx.Gauge(self.dialog)
        vsizer.Add(self.gauge, flag=wx.EXPAND | wx.BOTTOM, border=4)
        self.timer = wx.CallLater(100, self._pulse)

        hsizer2 = wx.BoxSizer(wx.HORIZONTAL)
        vsizer.Add(hsizer2, flag=wx.ALIGN_CENTER | wx.BOTTOM, border=4)

        restrict = wx.Button(self.dialog, label="&Restrict")
        hsizer2.Add(restrict, flag=wx.ALIGN_CENTER_VERTICAL | wx.RIGHT,
                                                                    border=4)

        label2 = wx.StaticText(self.dialog, label="the search to the last")
        hsizer2.Add(label2, flag=wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, border=4)

        self.number = NarrowSpinCtrl(self.dialog, min=1, max=99,
                                                        style=wx.SP_ARROW_KEYS)
        self.number.SetValue(1)
        hsizer2.Add(self.number, flag=wx.ALIGN_CENTER_VERTICAL | wx.RIGHT,
                                                                    border=4)

        label3 = wx.StaticText(self.dialog, label="days")
        hsizer2.Add(label3, flag=wx.ALIGN_CENTER_VERTICAL)

        self.dialog.Bind(wx.EVT_BUTTON, self._restrict_search, restrict)

        abort = wx.Button(self.dialog, label="&Skip searching for old alarms")
        vsizer.Add(abort, flag=wx.ALIGN_CENTER)

        self.dialog.Bind(wx.EVT_BUTTON, self._abort_search, abort)

        self.csizer.Fit(self.dialog)

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

        # Don't show it modal because only one modal dialog can be shown at a
        # time, and managing the races among them would be a bigger mess than
        # making it safe to show them non modal
        self.dialog.Show()
예제 #9
0
파일: __init__.py 프로젝트: xguse/outspline
def main():
    global alarmswindow
    alarmswindow = AlarmsWindow(wxgui_api.get_main_frame())
예제 #10
0
def warn_generic(text):
    return wx.MessageDialog(wxgui_api.get_main_frame(), text,
                                            caption="Test: generic warning",
                                            style=wx.OK | wx.ICON_EXCLAMATION)
예제 #11
0
def warn_bad_rule(message):
    return wx.MessageDialog(wxgui_api.get_main_frame(),
                            message,
                            caption="Create rule",
                            style=wx.OK | wx.ICON_EXCLAMATION)
예제 #12
0
파일: __init__.py 프로젝트: xguse/outspline
def main():
    global alarmswindow
    alarmswindow = AlarmsWindow(wxgui_api.get_main_frame())
예제 #13
0
    def create(self):
        self.dialog = wx.Dialog(wxgui_api.get_main_frame(),
                                title="Old alarms search",
                                style=wx.DEFAULT_DIALOG_STYLE & ~wx.CLOSE_BOX)

        self.csizer = wx.BoxSizer(wx.VERTICAL)
        self.dialog.SetSizer(self.csizer)

        vsizer = wx.BoxSizer(wx.VERTICAL)
        self.csizer.Add(vsizer, 1, flag=wx.EXPAND | wx.ALL, border=12)

        hsizer1 = wx.BoxSizer(wx.HORIZONTAL)
        vsizer.Add(hsizer1, flag=wx.EXPAND | wx.BOTTOM, border=4)

        icon = wx.StaticBitmap(
            self.dialog, bitmap=wxgui_api.get_dialog_icon('@oldalarmsdialog'))
        hsizer1.Add(icon, flag=wx.ALIGN_TOP | wx.RIGHT, border=12)

        self.labeltext = (
            "{} was last saved {} days ago: searching the "
            "alarms that should have been activated since {{}}...".format(
                self.filename,
                int(round((time_.time() - self.last_search) / 86400))))
        self.label1 = wx.StaticText(self.dialog,
                                    label=self.labeltext.format("then"))
        self.label1.Wrap(self.WRAP)
        hsizer1.Add(self.label1)

        self.gauge = wx.Gauge(self.dialog)
        vsizer.Add(self.gauge, flag=wx.EXPAND | wx.BOTTOM, border=4)
        self.timer = wx.CallLater(100, self._pulse)

        hsizer2 = wx.BoxSizer(wx.HORIZONTAL)
        vsizer.Add(hsizer2, flag=wx.ALIGN_CENTER | wx.BOTTOM, border=4)

        restrict = wx.Button(self.dialog, label="&Restrict")
        hsizer2.Add(restrict,
                    flag=wx.ALIGN_CENTER_VERTICAL | wx.RIGHT,
                    border=4)

        label2 = wx.StaticText(self.dialog, label="the search to the last")
        hsizer2.Add(label2, flag=wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, border=4)

        self.number = NarrowSpinCtrl(self.dialog,
                                     min=1,
                                     max=99,
                                     style=wx.SP_ARROW_KEYS)
        self.number.SetValue(1)
        hsizer2.Add(self.number,
                    flag=wx.ALIGN_CENTER_VERTICAL | wx.RIGHT,
                    border=4)

        label3 = wx.StaticText(self.dialog, label="days")
        hsizer2.Add(label3, flag=wx.ALIGN_CENTER_VERTICAL)

        self.dialog.Bind(wx.EVT_BUTTON, self._restrict_search, restrict)

        abort = wx.Button(self.dialog, label="&Skip searching for old alarms")
        vsizer.Add(abort, flag=wx.ALIGN_CENTER)

        self.dialog.Bind(wx.EVT_BUTTON, self._abort_search, abort)

        self.csizer.Fit(self.dialog)

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

        # Don't show it modal because only one modal dialog can be shown at a
        # time, and managing the races among them would be a bigger mess than
        # making it safe to show them non modal
        self.dialog.Show()
예제 #14
0
def warn_user_rights(filename):
    return wx.MessageDialog(wxgui_api.get_main_frame(), 'You are not '
                            'authorized to '
                            'create or overwrite {}.'.format(filename),
                            caption="Export schedule view",
                            style=wx.OK | wx.ICON_EXCLAMATION)
예제 #15
0
    def __init__(self):
        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.Dialog(wxgui_api.get_main_frame(), size=[int(s)
                        for s in self.config['initial_geometry'].split('x')],
                        style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER |
                        wx.DIALOG_NO_PARENT)

        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)
예제 #16
0
def unsafe_paste_confirm():
    return wx.MessageDialog(wxgui_api.get_main_frame(), 'The destination '
        'database does not support all the data copied from the origin '
        'database: consider upgrading the destination database first.\n'
        'Paste the items anyway, discarding the unsupported data?',
        caption="Paste items", style=wx.OK | wx.CANCEL | wx.ICON_EXCLAMATION)
예제 #17
0
def bad_regular_expression():
    return wx.MessageDialog(wxgui_api.get_main_frame(),
                        'Bad regular expression.',
                        caption="Search", style=wx.OK | wx.ICON_EXCLAMATION)
예제 #18
0
def warn_bad_rule(message):
    return wx.MessageDialog(wxgui_api.get_main_frame(), message,
                    caption="Create rule", style=wx.OK | wx.ICON_EXCLAMATION)
예제 #19
0
파일: msgboxes.py 프로젝트: xguse/outspline
def all_items_not_found():
    return wx.MessageDialog(wxgui_api.get_main_frame(),
                    'All the selected search result items do not exist '
                    'anymore. Re-execute the search for up-to-date results.',
                    caption="Search", style=wx.OK | wx.ICON_EXCLAMATION)