Python wx.ICON_WARNING Examples

The following are 30 code examples of wx.ICON_WARNING(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module wx , or try the search function .
Example #1
Source File: gui.py    From RF-Monitor with GNU General Public License v2.0 6 votes vote down vote up
def __on_rec(self, recording):
        timestamp = time.time()
        for monitor in self._monitors:
            if not recording:
                monitor.set_level(None, timestamp, None)
            monitor.set_recording(recording, timestamp)

        if recording:
            self.__on_start()
        else:
            while self._push.hasFailed():
                resp = wx.MessageBox('Web push has failed, retry?', 'Warning',
                                     wx.OK | wx.CANCEL | wx.ICON_WARNING)
                if resp == wx.OK:
                    busy = wx.BusyInfo('Pushing...', self)
                    self._push.send_failed(self._settings.get_push_uri())
                    del busy
                else:
                    self._push.clear_failed()

        self._warnedPush = False
        self.__set_timeline() 
Example #2
Source File: multiple_individuals_refinement_toolbox.py    From DeepLabCut with GNU Lesser General Public License v3.0 6 votes vote down vote up
def quitButton(self, event):
        """
        Quits the GUI
        """
        self.statusbar.SetStatusText("")
        dlg = wx.MessageDialog(
            None, "Are you sure?", "Quit!", wx.YES_NO | wx.ICON_WARNING
        )
        result = dlg.ShowModal()
        if result == wx.ID_YES:
            print(
                "Closing... The refined labels are stored in a subdirectory under labeled-data. Use the function 'merge_datasets' to augment the training dataset, and then re-train a network using create_training_dataset followed by train_network!"
            )
            self.Destroy()
        else:
            self.save.Enable(True) 
Example #3
Source File: refinement.py    From DeepLabCut with GNU Lesser General Public License v3.0 6 votes vote down vote up
def quitButton(self, event):
        """
        Quits the GUI
        """
        self.statusbar.SetStatusText("")
        dlg = wx.MessageDialog(
            None, "Are you sure?", "Quit!", wx.YES_NO | wx.ICON_WARNING
        )
        result = dlg.ShowModal()
        if result == wx.ID_YES:
            print(
                "Closing... The refined labels are stored in a subdirectory under labeled-data. Use the function 'merge_datasets' to augment the training dataset, and then re-train a network using create_training_dataset followed by train_network!"
            )
            self.Destroy()
        else:
            self.save.Enable(True) 
Example #4
Source File: refinement.py    From DeepLabCut with GNU Lesser General Public License v3.0 6 votes vote down vote up
def OnKeyPressed(self, event=None):
        if event.GetKeyCode() == wx.WXK_RIGHT:
            self.nextImage(event=None)
        elif event.GetKeyCode() == wx.WXK_LEFT:
            self.prevImage(event=None)
        elif event.GetKeyCode() == wx.WXK_BACK:
            pos_abs = event.GetPosition()
            inv = self.axes.transData.inverted()
            pos_rel = list(inv.transform(pos_abs))
            pos_rel[1] = (
                self.axes.get_ylim()[0] - pos_rel[1]
            )  # Recall y-axis is inverted
            i = np.nanargmin(
                [self.calc_distance(*dp.point.center, *pos_rel) for dp in self.drs]
            )
            closest_dp = self.drs[i]
            msg = wx.MessageBox(
                "Do you want to remove the label %s ?" % closest_dp.bodyParts,
                "Remove!",
                wx.YES_NO | wx.ICON_WARNING,
            )
            if msg == 2:
                closest_dp.delete_data() 
Example #5
Source File: g.gui.tangible.py    From grass-tangible-landscape with GNU General Public License v2.0 6 votes vote down vote up
def CalibrateModelBBox(self, event):
        if self.IsScanning():
            dlg = wx.MessageDialog(self, 'In order to calibrate, please stop scanning process first.',
                                   'Stop scanning',
                                   wx.OK | wx.ICON_WARNING)
            dlg.ShowModal()
            dlg.Destroy()
            return
        params = {}
        if self.calib_matrix:
            params['calib_matrix'] = self.calib_matrix
        params['rotate'] = self.scan['rotation_angle']
        zrange = ','.join(self.scan['trim_nsewtb'].split(',')[4:])
        params['zrange'] = zrange
        res = gscript.parse_command('r.in.kinect', flags='m', overwrite=True, **params)
        if not res['bbox']:
            gscript.message(_("Failed to find model extent"))
        offsetcm = 2
        n, s, e, w = [int(round(float(each))) for each in res['bbox'].split(',')]
        self.scanning_panel.trim['n'].SetValue(str(n + offsetcm))
        self.scanning_panel.trim['s'].SetValue(str(abs(s) + offsetcm))
        self.scanning_panel.trim['e'].SetValue(str(e + offsetcm))
        self.scanning_panel.trim['w'].SetValue(str(abs(w) + offsetcm)) 
Example #6
Source File: g.gui.tangible.py    From grass-tangible-landscape with GNU General Public License v2.0 6 votes vote down vote up
def OnColorCalibration(self, event):
        if self.scaniface.IsScanning():
            dlg = wx.MessageDialog(self, 'In order to calibrate, please stop scanning process first.',
                                   'Stop scanning',
                                   wx.OK | wx.ICON_WARNING)
            dlg.ShowModal()
            dlg.Destroy()
            return

        training = self.trainingAreas.GetValue()
        if not training:
            return
        if self.settings['output']['color'] and self.settings['output']['color_name']:
            self.group = self.settings['output']['color_name']
        else:
            self.group = None
            dlg = wx.MessageDialog(self, "In order to calibrate colors, please specify name of output color raster in 'Output' tab.",
                                   'Need color output',
                                   wx.OK | wx.ICON_WARNING)
            dlg.ShowModal()
            dlg.Destroy()
            return

        self.CalibrateColor() 
Example #7
Source File: svg2border.py    From kicad_mmccoo with Apache License 2.0 6 votes vote down vote up
def Run(self):
        dlg = SVG2ZoneDialog()
        res = dlg.ShowModal()

        if res == wx.ID_OK:
            print("ok")

            if (dlg.net.value == None):
                warndlg = wx.MessageDialog(self, "no net was selected", "Error", wx.OK | wx.ICON_WARNING)
                warndlg.ShowModal()
                warndlg.Destroy()
                return

            # do it.
            SVG2Zone(dlg.file_picker.value,
                     pcbnew.GetBoard(),
                     dlg.basic_layer.valueint,
                     dlg.net.GetValuePtr())
        else:
            print("cancel") 
Example #8
Source File: dxf_plugins.py    From kicad_mmccoo with Apache License 2.0 6 votes vote down vote up
def Run(self):
        dlg = DXFZoneDialog()
        res = dlg.ShowModal()

        if res == wx.ID_OK:
            print("ok")
            if (dlg.net.value == None):
                warndlg = wx.MessageDialog(self, "no net was selected", "Error", wx.OK | wx.ICON_WARNING)
                warndlg.ShowModal()
                warndlg.Destroy()
                return

            net = dlg.net.GetValuePtr()

            traverse_dxf(dlg.file_picker.value,
                         zone_actions(pcbnew.GetBoard(),
                                      net,
                                      dlg.basic_layer.valueint),
                         merge_polys=True,
                         break_curves=True
            )
            #pcbnew.Refresh()
        else:
            print("cancel") 
Example #9
Source File: GoSyncController.py    From gosync with GNU General Public License v2.0 6 votes vote down vote up
def OnInternetDown(self, event):
        if event.data == 1:
            self.sb.SetStatusText("Network is down")
            if self.sync_model.GetUseSystemNotifSetting():
                if wxgtk4:
                    nmsg = wx.adv.NotificationMessage(title="GoSync", message="Network has gone down!")
                    nmsg.SetFlags(wx.ICON_WARNING)
                    nmsg.Show(timeout=wx.adv.NotificationMessage.Timeout_Auto)
                else:
                    nmsg = wx.NotificationMessage("GoSync", "Network has gone down!")
                    nmsg.SetFlags(wx.ICON_WARNING)
                    nmsg.Show(timeout=wx.NotificationMessage.Timeout_Auto)
        else:
            self.sb.SetStatusText("Network is up!")
            if self.sync_model.GetUseSystemNotifSetting():
                if wxgtk4:
                    nmsg = wx.adv.NotificationMessage(title="GoSync", message="Network is up!")
                    nmsg.SetFlags(wx.ICON_INFORMATION)
                    nmsg.Show(timeout=wx.adv.NotificationMessage.Timeout_Auto)
                else:
                    nmsg = wx.NotificationMessage("GoSync", "Network is up!")
                    nmsg.SetFlags(wx.ICON_INFORMATION)
                    nmsg.Show(timeout=wx.NotificationMessage.Timeout_Auto) 
Example #10
Source File: DeviceManager.py    From meerk40t with MIT License 6 votes vote down vote up
def on_list_item_activated(self, event):  # wxGlade: DeviceManager.<event_handler>
        uid = event.GetLabel()
        try:
            device = self.device.instances['device'][uid]
        except KeyError:
            device_name = self.device.read_persistent(str, 'device_name', 'Lhystudios', uid)
            device = self.device.open('device', device_name, root=self.device, uid=int(uid), instance_name=str(uid))
        if device.state == STATE_UNKNOWN:
            device.open('window', "MeerK40t", None, -1, "")
            device.boot()
            self.Close()
        else:
            dlg = wx.MessageDialog(None, _("That device already booted."),
                                   _("Cannot Boot Selected Device"), wx.OK | wx.ICON_WARNING)
            result = dlg.ShowModal()
            dlg.Destroy() 
Example #11
Source File: __init__.py    From NVDARemote with GNU General Public License v2.0 6 votes vote down vote up
def verify_connect(self, con_info):
		if self.is_connected() or self.connecting:
			gui.messageBox(_("NVDA Remote is already connected. Disconnect before opening a new connection."), _("NVDA Remote Already Connected"), wx.OK|wx.ICON_WARNING)
			return
		self.connecting = True
		server_addr = con_info.get_address()
		key = con_info.key
		if con_info.mode == 'master':
			message = _("Do you wish to control the machine on server {server} with key {key}?").format(server=server_addr, key=key)
		elif con_info.mode == 'slave':
			message = _("Do you wish to allow this machine to be controlled on server {server} with key {key}?").format(server=server_addr, key=key)
		if gui.messageBox(message, _("NVDA Remote Connection Request"), wx.YES|wx.NO|wx.NO_DEFAULT|wx.ICON_WARNING) != wx.YES:
			self.connecting = False
			return
		if con_info.mode == 'master':
			self.connect_as_master((con_info.hostname, con_info.port), key=key)
		elif con_info.mode == 'slave':
			self.connect_as_slave((con_info.hostname, con_info.port), key=key)
		self.connecting = False 
Example #12
Source File: RotarySettings.py    From meerk40t with MIT License 6 votes vote down vote up
def initialize(self):
        self.device.close('window', self.name)
        self.Show()
        if self.device.is_root():
            for attr in dir(self):
                value = getattr(self, attr)
                if isinstance(value, wx.Control):
                    value.Enable(False)
            dlg = wx.MessageDialog(None, _("You do not have a selected device."),
                                   _("No Device Selected."), wx.OK | wx.ICON_WARNING)
            result = dlg.ShowModal()
            dlg.Destroy()
            return
        self.device.setting(bool, 'rotary', False)
        self.device.setting(float, 'scale_x', 1.0)
        self.device.setting(float, 'scale_y', 1.0)
        self.spin_rotary_scalex.SetValue(self.device.scale_x)
        self.spin_rotary_scaley.SetValue(self.device.scale_y)
        self.checkbox_rotary.SetValue(self.device.rotary)
        self.on_check_rotary(None) 
Example #13
Source File: refine_labels.py    From DeepLabCut with GNU Lesser General Public License v3.0 5 votes vote down vote up
def merge_dataset(self, event):
        dlg = wx.MessageDialog(
            None,
            "1. Make sure that you have refined all the labels before merging the dataset.\n\n2. If you merge the dataset, you need to re-create the training dataset before you start the training.\n\n3. Are you ready to merge the dataset?",
            "Warning",
            wx.YES_NO | wx.ICON_WARNING,
        )
        result = dlg.ShowModal()
        if result == wx.ID_YES:
            notebook = self.GetParent()
            notebook.SetSelection(4)
            deeplabcut.merge_datasets(self.config, forceiterate=None) 
Example #14
Source File: trace_clearance.py    From RF-tools-KiCAD with GNU General Public License v3.0 5 votes vote down vote up
def Warn(self, message, caption="Warning!"):
        """
        """
        dlg = wx.MessageDialog(None, message, caption, wx.OK | wx.ICON_WARNING)
        dlg.ShowModal()
        dlg.Destroy() 
Example #15
Source File: panel_monitor.py    From RF-Monitor with GNU General Public License v2.0 5 votes vote down vote up
def __on_del(self, _event):
        if len(self._signals):
            resp = wx.MessageBox('''Remove monitor?\n'''
                                 '''The recording on this monitor will be lost''',
                                 'Warning',
                                 wx.OK | wx.CANCEL | wx.ICON_WARNING)
            if resp != wx.OK:
                return
        self._on_del(self) 
Example #16
Source File: round_trk.py    From RF-tools-KiCAD with GNU General Public License v3.0 5 votes vote down vote up
def Warn(self, message, caption='Warning!'):
        dlg = wx.MessageDialog(
            None, message, caption, wx.OK | wx.ICON_WARNING)
        dlg.ShowModal()
        dlg.Destroy() 
Example #17
Source File: auxfun_drag_label_multiple_individuals.py    From DeepLabCut with GNU Lesser General Public License v3.0 5 votes vote down vote up
def on_press(self, event):
        """
        Define the event for the button press!
        """
        if event.inaxes != self.point.axes:
            return
        if DraggablePoint.lock is not None:
            return
        contains, attrd = self.point.contains(event)
        if not contains:
            return
        if event.button == 1:
            """
            This button press corresponds to the left click
            """
            self.press = (self.point.center), event.xdata, event.ydata
            DraggablePoint.lock = self
            canvas = self.point.figure.canvas
            axes = self.point.axes
            self.point.set_animated(True)
            canvas.draw()
            self.background = canvas.copy_from_bbox(self.point.axes.bbox)
            axes.draw_artist(self.point)
            canvas.blit(axes.bbox)
        elif event.button == 2:
            """
            To remove a predicted label. Internally, the coordinates of the selected predicted label is replaced with nan. The user needs to right click for the event.After right
            click the data point is removed from the plot.
            """
            msg = wx.MessageBox(
                "Do you want to remove the label %s ?" % self.bodyParts,
                "Remove!",
                wx.YES_NO | wx.ICON_WARNING,
            )
            if msg == 2:
                self.delete_data() 
Example #18
Source File: multiple_individuals_labeling_toolbox.py    From DeepLabCut with GNU Lesser General Public License v3.0 5 votes vote down vote up
def OnKeyPressed(self, event=None):
        if event.GetKeyCode() == wx.WXK_RIGHT:
            self.nextImage(event=None)
        elif event.GetKeyCode() == wx.WXK_LEFT:
            self.prevImage(event=None)
        elif event.GetKeyCode() == wx.WXK_DOWN:
            self.nextLabel(event=None)
        elif event.GetKeyCode() == wx.WXK_UP:
            self.previousLabel(event=None)
        elif event.GetKeyCode() == wx.WXK_BACK:
            pos_abs = event.GetPosition()
            inv = self.axes.transData.inverted()
            pos_rel = list(inv.transform(pos_abs))
            pos_rel[1] = (
                self.axes.get_ylim()[0] - pos_rel[1]
            )  # Recall y-axis is inverted
            i = np.nanargmin(
                [self.calc_distance(*dp.point.center, *pos_rel) for dp in self.drs]
            )
            closest_dp = self.drs[i]
            msg = wx.MessageBox(
                f"Do you want to remove the label {closest_dp.individual_names}:{closest_dp.bodyParts}?",
                "Remove!",
                wx.YES_NO | wx.ICON_WARNING,
            )
            if msg == 2:
                closest_dp.delete_data()
                self.buttonCounter[closest_dp.individual_names].remove(
                    closest_dp.bodyParts
                ) 
Example #19
Source File: labeling_toolbox.py    From DeepLabCut with GNU Lesser General Public License v3.0 5 votes vote down vote up
def OnKeyPressed(self, event=None):
        if event.GetKeyCode() == wx.WXK_RIGHT:
            self.nextImage(event=None)
        elif event.GetKeyCode() == wx.WXK_LEFT:
            self.prevImage(event=None)
        elif event.GetKeyCode() == wx.WXK_DOWN:
            self.nextLabel(event=None)
        elif event.GetKeyCode() == wx.WXK_UP:
            self.previousLabel(event=None)
        elif event.GetKeyCode() == wx.WXK_BACK:
            pos_abs = event.GetPosition()
            inv = self.axes.transData.inverted()
            pos_rel = list(inv.transform(pos_abs))
            pos_rel[1] = (
                self.axes.get_ylim()[0] - pos_rel[1]
            )  # Recall y-axis is inverted
            i = np.nanargmin(
                [self.calc_distance(*dp.point.center, *pos_rel) for dp in self.drs]
            )
            closest_dp = self.drs[i]
            msg = wx.MessageBox(
                "Do you want to remove the label %s ?" % closest_dp.bodyParts,
                "Remove!",
                wx.YES_NO | wx.ICON_WARNING,
            )
            if msg == 2:
                closest_dp.delete_data()
                self.buttonCounter.remove(
                    self.bodyparts.index(closest_dp.bodyParts)
                ) 
Example #20
Source File: auxfun_drag_label.py    From DeepLabCut with GNU Lesser General Public License v3.0 5 votes vote down vote up
def on_press(self, event):
        """
        Define the event for the button press!
        """
        if event.inaxes != self.point.axes:
            return
        if DraggablePoint.lock is not None:
            return
        contains, attrd = self.point.contains(event)
        if not contains:
            return
        if event.button == 1:
            """
            This button press corresponds to the left click
            """
            self.press = (self.point.center), event.xdata, event.ydata
            DraggablePoint.lock = self
            canvas = self.point.figure.canvas
            axes = self.point.axes
            self.point.set_animated(True)
            canvas.draw()
            self.background = canvas.copy_from_bbox(self.point.axes.bbox)
            axes.draw_artist(self.point)
            canvas.blit(axes.bbox)
        elif event.button == 2:
            """
            To remove a predicted label. Internally, the coordinates of the selected predicted label is replaced with nan. The user needs to right click for the event.After right
            click the data point is removed from the plot.
            """
            msg = wx.MessageBox(
                "Do you want to remove the label %s ?" % self.bodyParts,
                "Remove!",
                wx.YES_NO | wx.ICON_WARNING,
            )
            if msg == 2:
                self.delete_data() 
Example #21
Source File: trace_solder_expander.py    From RF-tools-KiCAD with GNU General Public License v3.0 5 votes vote down vote up
def Warn(self, message, caption='Warning!'):
        dlg = wx.MessageDialog(
            None, message, caption, wx.OK | wx.ICON_WARNING)
        dlg.ShowModal()
        dlg.Destroy() 
Example #22
Source File: Navigation.py    From meerk40t with MIT License 5 votes vote down vote up
def initialize(self):
        device = self.device
        kernel = self.device.device_root
        self.elements = kernel.elements
        device.close('window', self.name)
        self.Show()
        if device.is_root():
            for attr in dir(self):
                value = getattr(self, attr)
                if isinstance(value, wx.Control):
                    value.Enable(False)
            dlg = wx.MessageDialog(None, _("You do not have a selected device."),
                                   _("No Device Selected."), wx.OK | wx.ICON_WARNING)
            dlg.ShowModal()
            dlg.Destroy()
            return

        device.setting(float, "navigate_jog", self.spin_jog_mils.GetValue())
        device.setting(float, "navigate_pulse", self.spin_pulse_duration.GetValue())
        self.spin_pulse_duration.SetValue(self.device.navigate_pulse)
        self.set_jog_distances(self.device.navigate_jog)

        kernel.listen('emphasized', self.on_emphasized_elements_changed)
        device.listen('interpreter;position', self.on_position_update)
        self.console = self.device.using('module', 'Console')
        self.update_matrix_text() 
Example #23
Source File: Alignment.py    From meerk40t with MIT License 5 votes vote down vote up
def initialize(self):
        self.device.close('window', self.name)
        self.Show()
        if self.device.is_root():
            for attr in dir(self):
                value = getattr(self, attr)
                if isinstance(value, wx.Control):
                    value.Enable(False)
            dlg = wx.MessageDialog(None, _("You do not have a selected device."),
                                   _("No Device Selected."), wx.OK | wx.ICON_WARNING)
            result = dlg.ShowModal()
            dlg.Destroy() 
Example #24
Source File: misc.py    From wxGlade with MIT License 5 votes vote down vote up
def warning_message(msg, title="Warning"):
    if config.use_gui:
        wx.MessageBox( _(msg), _(title), wx.OK | wx.CENTRE | wx.ICON_WARNING )
    else:
        logging.warning(msg)


########################################################################################################################
# menu helpers 
Example #25
Source File: Controller.py    From meerk40t with MIT License 5 votes vote down vote up
def initialize(self):
        self.device.close('window', self.name)
        self.Show()

        if self.device.is_root():
            for attr in dir(self):
                value = getattr(self, attr)
                if isinstance(value, wx.Control):
                    value.Enable(False)
            dlg = wx.MessageDialog(None, _("You do not have a selected device."),
                                   _("No Device Selected."), wx.OK | wx.ICON_WARNING)
            result = dlg.ShowModal()
            dlg.Destroy()
            return

        self.device.setting(int, "buffer_max", 1500)
        self.device.setting(bool, "buffer_limit", True)
        self.device.listen('pipe;status', self.update_status)
        self.device.listen('pipe;packet_text', self.update_packet_text)
        self.device.listen('pipe;buffer', self.on_buffer_update)
        self.device.listen('pipe;usb_state', self.on_connection_state_change)
        self.device.listen('pipe;thread', self.on_control_state)
        self.checkbox_limit_buffer.SetValue(self.device.buffer_limit)
        self.spin_packet_buffer_max.SetValue(self.device.buffer_max)
        self.text_device.SetValue(self.device.device_name)
        self.text_location.SetValue(self.device.device_location) 
Example #26
Source File: Controller.py    From meerk40t with MIT License 5 votes vote down vote up
def on_button_connect(self, event):  # wxGlade: Controller.<event_handler>
        state = self.device.last_signal('pipe;usb_state')
        if state is not None and isinstance(state, tuple):
            state = state[0]
        if state in (STATE_USB_DISCONNECTED, STATE_UNINITIALIZED, STATE_CONNECTION_FAILED, STATE_DRIVER_MOCK, None):
            try:
                self.device.execute("Connect_USB")
            except ConnectionRefusedError:
                dlg = wx.MessageDialog(None, _("Connection Refused. See USB Log for detailed information."),
                                       _("Manual Connection"), wx.OK | wx.ICON_WARNING)
                result = dlg.ShowModal()
                dlg.Destroy()
        elif state in (STATE_CONNECTED, STATE_USB_CONNECTED):
            self.device.execute("Disconnect_USB") 
Example #27
Source File: JobInfo.py    From meerk40t with MIT License 5 votes vote down vote up
def initialize(self):
        self.device.close('module', self.name)
        self.Show()
        self.operations = []
        self.device.setting(bool, "rotary", False)
        self.device.setting(float, "scale_x", 1.0)
        self.device.setting(float, "scale_y", 1.0)
        self.device.setting(bool, "prehome", False)
        self.device.setting(bool, "autohome", False)
        self.device.setting(bool, "autobeep", True)
        self.device.setting(bool, "autostart", True)
        self.device.listen('element_property_update', self.on_element_property_update)

        if self.device.is_root():
            for attr in dir(self):
                value = getattr(self, attr)
                if isinstance(value, wx.Control):
                    value.Enable(False)
            dlg = wx.MessageDialog(None, _("You do not have a selected device."),
                                   _("No Device Selected."), wx.OK | wx.ICON_WARNING)
            result = dlg.ShowModal()
            dlg.Destroy()
            return
        self.menu_prehome.Check(self.device.prehome)
        self.menu_autohome.Check(self.device.autohome)
        self.menu_autobeep.Check(self.device.autobeep)
        self.menu_autostart.Check(self.device.autostart) 
Example #28
Source File: BufferView.py    From meerk40t with MIT License 5 votes vote down vote up
def initialize(self):
        self.device.close('window', self.name)
        self.Show()
        if self.device.is_root():
            for attr in dir(self):
                value = getattr(self, attr)
                if isinstance(value, wx.Control):
                    value.Enable(False)
            dlg = wx.MessageDialog(None, _("You do not have a selected device."),
                                   _("No Device Selected."), wx.OK | wx.ICON_WARNING)
            result = dlg.ShowModal()
            dlg.Destroy()
            return
        pipe = self.device.interpreter.pipe
        buffer = None
        if pipe is not None:
            try:
                buffer = pipe._buffer + pipe._queue
            except AttributeError:
                buffer = None
        if buffer is None:
            buffer = _("Could not find buffer.\n")

        try:
            bufferstr = buffer.decode()
        except ValueError:
            bufferstr = buffer.decode("ascii")
        except AttributeError:
            bufferstr = buffer

        self.text_buffer_length = self.text_buffer_length.SetValue(str(len(bufferstr)))
        self.text_buffer_info = self.text_buffer_info.SetValue(bufferstr) 
Example #29
Source File: JobSpooler.py    From meerk40t with MIT License 5 votes vote down vote up
def initialize(self):
        self.device.close('window', self.name)
        self.Show()
        if self.device.is_root():
            for attr in dir(self):
                value = getattr(self, attr)
                if isinstance(value, wx.Control):
                    value.Enable(False)
            dlg = wx.MessageDialog(None, _("You do not have a selected device."),
                                   _("No Device Selected."), wx.OK | wx.ICON_WARNING)
            result = dlg.ShowModal()
            dlg.Destroy()
            return
        self.device.listen('spooler;queue', self.on_spooler_update)
        self.refresh_spooler_list() 
Example #30
Source File: GoSyncSettingPage.py    From gosync with GNU General Public License v2.0 5 votes vote down vote up
def OnChangeMirror(self, event):
        new_dir_help = "Your new local mirror directory is set. This will take effect after GoSync restart.\n\nPlease note that GoSync hasn't moved your files from old location. You would need to copy or move your current directory to new location before restarting GoSync."

        dlg = wx.DirDialog(None, "Choose target directory", "",
                           wx.DD_DEFAULT_STYLE | wx.DD_DIR_MUST_EXIST)

        if dlg.ShowModal() == wx.ID_OK:
            self.sync_model.SetLocalMirrorDirectory(dlg.GetPath())
            resp = wx.MessageBox(new_dir_help, "IMPORTANT INFORMATION", (wx.OK | wx.ICON_WARNING))
            self.md.SetLabel(self.sync_model.GetLocalMirrorDirectory())

        dlg.Destroy()