Exemple #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()
Exemple #2
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()
Exemple #3
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()
Exemple #4
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()