Python wx.ICON_ERROR Examples

The following are 30 code examples of wx.ICON_ERROR(). 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: main.py    From wxGlade with MIT License 6 votes vote down vote up
def on_close(self, event):
        if not event.CanVeto():
            event.Skip
            return
        if self.ask_save():
            # close application
            # first, let's see if we have to save the geometry...
            prefs = config.preferences
            if prefs.remember_geometry:
                self._store_layout()
                prefs.set_dict("layout", self.layout_settings)
                prefs.changed = True
            common.root.clear()
            common.root.new()
            try:
                common.save_preferences()
            except Exception as e:
                wx.MessageBox( _('Error saving preferences:\n%s') % e,
                               _('Error'), wx.OK|wx.CENTRE|wx.ICON_ERROR )
            self.Destroy()
            common.remove_autosaved()
            wx.CallAfter(wx.GetApp().ExitMainLoop)
        elif event.CanVeto():
            event.Veto() 
Example #2
Source File: elecsus_gui.py    From ElecSus with Apache License 2.0 6 votes vote down vote up
def SaveTheoryCurves(self,filename):
		""" 
		Method to actually do the saving of xy data to csv file. 
		Separate to the OnSaveCSVData method in case a filename is automatically chosen
		- i.e. when fitting data, there is an option to autosave the results which calls this method
		"""
		#print len(self.y_arrays)
		#print self.y_arrays		
					
		xy_data = list(zip(self.x_array,self.y_arrays[0].real,self.y_arrays[1].real,self.y_arrays[2].real,self.y_arrays[3].real,\
			self.y_arrays[4][0].real, self.y_arrays[4][1].real,\
			self.y_arrays[5][0].real, self.y_arrays[5][1].real, \
			self.y_arrays[6][0].real, self.y_arrays[6][1].real,\
			self.y_arrays[7][0].real, self.y_arrays[7][1].real, self.y_arrays[7][2].real))
		print('Here fine1')
		success = write_CSV(xy_data, filename, titles=['Detuning']+OutputTypes)
		if not success:
			problem_dlg = wx.MessageDialog(self, "There was an error saving the data...", "Error saving", wx.OK|wx.ICON_ERROR)
			problem_dlg.ShowModal()

############## 
Example #3
Source File: ConfigEditor.py    From OpenPLC_Editor with GNU General Public License v3.0 6 votes vote down vote up
def OnProcessVariablesGridCellChange(self, event):
        row, col = event.GetRow(), event.GetCol()
        colname = self.ProcessVariablesTable.GetColLabelValue(col, False)
        value = self.ProcessVariablesTable.GetValue(row, col)
        message = None
        if colname == "Name":
            if not TestIdentifier(value):
                message = _("\"%s\" is not a valid identifier!") % value
            elif value.upper() in IEC_KEYWORDS:
                message = _("\"%s\" is a keyword. It can't be used!") % value
            elif value.upper() in [var["Name"].upper() for idx, var in enumerate(self.ProcessVariablesTable.GetData()) if idx != row]:
                message = _("An variable named \"%s\" already exists!") % value
        if message is None:
            self.SaveProcessVariables()
            wx.CallAfter(self.ProcessVariablesTable.ResetView, self.ProcessVariablesGrid)
            event.Skip()
        else:
            dialog = wx.MessageDialog(self, message, _("Error"), wx.OK | wx.ICON_ERROR)
            dialog.ShowModal()
            dialog.Destroy()
            event.Veto() 
Example #4
Source File: app.py    From thotkeeper with BSD 2-Clause "Simplified" License 6 votes vote down vote up
def _HelpUpdateMenu(self, event):
        new_version = None
        from .utils import (update_check, get_update_message)
        try:
            new_version, info_url = update_check()
        except Exception as e:
            wx.MessageBox((f'Error occurred while checking for updates\n'
                           f'{e}'),
                          'Update Check',
                          wx.OK | wx.ICON_ERROR,
                          self.frame)
            return
        wx.MessageBox(get_update_message(new_version, info_url),
                      'Update Check', wx.OK, self.frame)

    # -----------------------------------------------------------------
    # Miscellaneous Event Handlers
    # ----------------------------------------------------------------- 
Example #5
Source File: activities.py    From grass-tangible-landscape with GNU General Public License v2.0 6 votes vote down vote up
def _loadConfiguration(self, event):
        self.configFile = self.configPath.GetValue().strip()
        if self.configFile:
            self.settings['activities']['config'] = self.configFile
            self._enableGUI(True)
            with open(self.configFile, 'r') as f:
                try:
                    self.configuration = json.load(f)
                    self.tasks = self.configuration['tasks']
                    self.title.SetLabel(self.tasks[self.current]['title'])
                    self.instructions.SetLabel(self._getInstructions())
                except ValueError:
                    self.configuration = {}
                    self.settings['activities']['config'] = ''
                    self._enableGUI(False)
                    wx.MessageBox(parent=self, message='Parsing error while reading JSON file, please correct it and try again.',
                                  caption="Can't read JSON file", style=wx.OK | wx.ICON_ERROR)
            self._bindUserStop()
        else:
            self.settings['activities']['config'] = ''
            self._enableGUI(False)

        self.slidesStatus.Show(bool('slides' in self.configuration and self.configuration['slides']))
        self.Layout() 
Example #6
Source File: ForceVariableDialog.py    From OpenPLC_Editor with GNU General Public License v3.0 6 votes vote down vote up
def OnOK(self, event):
        """
        Checks new entered value
        before closing dialog window
        """
        message = None
        ret = True
        value = self.GetEnteredValue()
        if value == "":
            message = _("You must type a value!")
        elif GetTypeValue[self.IEC_Type](value) is None:
            message = _("Invalid value \"{a1}\" for \"{a2}\" variable!").format(a1=value, a2=self.IEC_Type)
        if message is not None:
            dialog = wx.MessageDialog(self, message, _("Error"), wx.OK | wx.ICON_ERROR)
            dialog.ShowModal()
            dialog.Destroy()
            ret = False
        else:
            self.EndModal(wx.ID_OK)
        event.Skip(ret) 
Example #7
Source File: guiminer.py    From poclbm with GNU General Public License v3.0 6 votes vote down vote up
def launch_solo_server(self, event):
        """Launch the official bitcoin client in server mode.

        This allows poclbm to connect to it for mining solo.
        """
        if self.blockchain_directory and os.path.exists(self.blockchain_directory):
            datadir = " -datadir=%s" % self.blockchain_directory
        else:
            datadir = ""
        try:
            subprocess.Popen(self.bitcoin_executable + " -server" + datadir)
        except OSError:
            self.message(
                _("Couldn't find Bitcoin at %s. Is your path set correctly?") % self.bitcoin_executable,
                _("Launch failed"), wx.ICON_ERROR | wx.OK)
            return
        self.message(
            _("The Bitcoin client will now launch in server mode.\nOnce it connects to the network and downloads the block chain, you can start a miner in 'solo' mode."),
            _("Launched ok."),
            wx.OK) 
Example #8
Source File: PouNameDialog.py    From OpenPLC_Editor with GNU General Public License v3.0 6 votes vote down vote up
def OnOK(self, event):
        message = None
        step_name = self.GetSizer().GetItem(1).GetWindow().GetValue()
        if step_name == "":
            message = _("You must type a name!")
        elif not TestIdentifier(step_name):
            message = _("\"%s\" is not a valid identifier!") % step_name
        elif step_name.upper() in IEC_KEYWORDS:
            message = _("\"%s\" is a keyword. It can't be used!") % step_name
        elif step_name.upper() in self.PouNames:
            message = _("A POU named \"%s\" already exists!") % step_name
        if message is not None:
            dialog = wx.MessageDialog(self, message, _("Error"), wx.OK | wx.ICON_ERROR)
            dialog.ShowModal()
            dialog.Destroy()
        else:
            self.EndModal(wx.ID_OK)
        event.Skip() 
Example #9
Source File: SFCStepNameDialog.py    From OpenPLC_Editor with GNU General Public License v3.0 6 votes vote down vote up
def OnOK(self, event):
        message = None
        step_name = self.GetSizer().GetItem(1).GetWindow().GetValue()
        if step_name == "":
            message = _("You must type a name!")
        elif not TestIdentifier(step_name):
            message = _("\"%s\" is not a valid identifier!") % step_name
        elif step_name.upper() in IEC_KEYWORDS:
            message = _("\"%s\" is a keyword. It can't be used!") % step_name
        elif step_name.upper() in self.PouNames:
            message = _("A POU named \"%s\" already exists!") % step_name
        elif step_name.upper() in self.Variables:
            message = _("A variable with \"%s\" as name already exists in this pou!") % step_name
        elif step_name.upper() in self.StepNames:
            message = _("\"%s\" step already exists!") % step_name
        if message is not None:
            dialog = wx.MessageDialog(self, message, _("Error"), wx.OK | wx.ICON_ERROR)
            dialog.ShowModal()
            dialog.Destroy()
        else:
            self.EndModal(wx.ID_OK)
        event.Skip() 
Example #10
Source File: guiminer.py    From poclbm with GNU General Public License v3.0 6 votes vote down vote up
def new_external_profile(self, event):
        """Prompt for an external miner path, then create a miner.

        On Windows we validate against legal miners; on Linux they can pick
        whatever they want.
        """
        wildcard = _('External miner (*.exe)|*.exe|(*.py)|*.py') if sys.platform == 'win32' else '*.*'
        dialog = wx.FileDialog(self,
                               _("Select external miner:"),
                               defaultDir=os.path.join(get_module_path(), 'miners'),
                               defaultFile="",
                               wildcard=wildcard,
                               style=wx.OPEN)
        if dialog.ShowModal() != wx.ID_OK:
            return

        if sys.platform == 'win32' and dialog.GetFilename() not in SUPPORTED_BACKENDS:
            self.message(
                _("Unsupported external miner %(filename)s. Supported are: %(supported)s") % \
                  dict(filename=dialog.GetFilename(), supported='\n'.join(SUPPORTED_BACKENDS)),
                _("Miner not supported"), wx.OK | wx.ICON_ERROR)
            return
        path = os.path.join(dialog.GetDirectory(), dialog.GetFilename())
        dialog.Destroy()
        self.name_new_profile(extra_profile_data=dict(external_path="CGMINER")) 
Example #11
Source File: GoSyncController.py    From gosync with GNU General Public License v2.0 6 votes vote down vote up
def OnSyncDone(self, event):
        if not event.data:
            if self.sync_model.GetUseSystemNotifSetting():
                if wxgtk4:
                    nmsg = wx.adv.NotificationMessage(title="GoSync", message="Sync Completed!")
                    nmsg.SetFlags(wx.ICON_INFORMATION)
                    nmsg.Show(timeout=wx.adv.NotificationMessage.Timeout_Auto)
                else:
                    nmsg = wx.NotificationMessage("GoSync", "Sync Completed!")
                    nmsg.SetFlags(wx.ICON_INFORMATION)
                    nmsg.Show(timeout=wx.NotificationMessage.Timeout_Auto)
            self.sb.SetStatusText("Sync completed.")
        else:
            if self.sync_model.GetUseSystemNotifSetting():
                if wxgtk4:
                    nmsg = wx.adv.NotificationMessage(title="GoSync", message="Sync Completed with errors!\nPlease check ~/GoSync.log")
                    nmsg.SetFlags(wx.ICON_ERROR)
                    nmsg.Show(timeout=wx.adv.NotificationMessage.Timeout_Auto)
                else:
                    nmsg = wx.NotificationMessage("GoSync", "Sync Completed with errors!\nPlease check ~/GoSync.log")
                    nmsg.SetFlags(wx.ICON_ERROR)
                    nmsg.Show(timeout=wx.NotificationMessage.Timeout_Auto)
            self.sb.SetStatusText("Sync failed. Please check the logs.")
        self.sync_now_mitem.Enable(True)
        self.rcu.Enable(True) 
Example #12
Source File: gui.py    From report-ng with GNU General Public License v2.0 6 votes vote down vote up
def Save_Report_As(self, e):
            openFileDialog = wx.FileDialog(self, 'Save Report As', self.save_into_directory, '',
                                           'XML files (*.xml)|*.xml|All files (*.*)|*.*',
                                           wx.FD_SAVE | wx.wx.FD_OVERWRITE_PROMPT)
            if openFileDialog.ShowModal() == wx.ID_CANCEL:
                return
            filename = openFileDialog.GetPath()
            if filename == self.report._template_filename:
                wx.MessageBox('For safety reasons, template overwriting with generated report is not allowed!', 'Error',
                              wx.OK | wx.ICON_ERROR)
                return
            self.status('Generating and saving the report...')
            self.report.scan = self.scan
            self._clean_template()
            #self.report.xml_apply_meta()
            self.report.xml_apply_meta(vulnparam_highlighting=self.menu_view_v.IsChecked(), truncation=self.menu_view_i.IsChecked(), pPr_annotation=self.menu_view_p.IsChecked())
            self.report.save_report_xml(filename)
            #self._clean_template()

            # merge kb before generate
            self.ctrl_tc_k.SetValue('')
            self.menu_tools_merge_kb_into_content.Enable(False)

            self.status('Report saved') 
Example #13
Source File: DurationEditorDialog.py    From OpenPLC_Editor with GNU General Public License v3.0 6 votes vote down vote up
def OnCloseDialog(self):
        errors = []
        for control, name in [(self.Days, _("days")), (self.Hours, _("hours")),
                              (self.Minutes, _("minutes")), (self.Seconds, _("seconds")),
                              (self.Milliseconds, _("milliseconds")),
                              (self.Microseconds, _("microseconds"))]:
            try:
                float(control.GetValue())
            except ValueError:
                errors.append(name)
        if len(errors) > 0:
            if len(errors) == 1:
                message = _("Field %s hasn't a valid value!") % errors[0]
            else:
                message = _("Fields %s haven't a valid value!") % ",".join(errors)
            dialog = wx.MessageDialog(self, message, _("Error"), wx.OK | wx.ICON_ERROR)
            dialog.ShowModal()
            dialog.Destroy()
        else:
            self.EndModal(wx.ID_OK) 
Example #14
Source File: bugdialog.py    From wxGlade with MIT License 6 votes vote down vote up
def ShowEnvironmentError(msg, inst):
    """Show EnvironmentError exceptions detailed and user-friendly

    msg:  Error message
    inst: The caught exception"""

    details = {'msg':msg, 'type':inst.__class__.__name__}

    if inst.filename:
        details['filename'] = _('Filename:   %s') % inst.filename

    if inst.errno is not None and inst.strerror is not None:
        details['error'] = '%s - %s' % (inst.errno, inst.strerror)
    else:
        details['error'] = str(inst.args)

    text = _("""%(msg)s

Error type: %(type)s
Error code: %(error)s
%(filename)s""") % details

    wx.MessageBox(text, _('Error'), wx.OK | wx.CENTRE | wx.ICON_ERROR) 
Example #15
Source File: url_handler.py    From NVDARemote with GNU General Public License v2.0 6 votes vote down vote up
def windowProc(self, hwnd, msg, wParam, lParam):
		if msg != WM_COPYDATA:
			return
		hwnd = wParam
		struct_pointer = lParam
		message_data = ctypes.cast(struct_pointer, PCOPYDATASTRUCT)
		url = ctypes.wstring_at(message_data.contents.lpData)
		log.info("Received url: %s" % url)
		try:
			con_info = connection_info.ConnectionInfo.from_url(url)
		except connection_info.URLParsingError:
			wx.CallLater(50, gui.messageBox, parent=gui.mainFrame, caption=_("Invalid URL"),
			# Translators: Message shown when an invalid URL has been provided.
			message=_("Unable to parse url \"%s\"")%url, style=wx.OK | wx.ICON_ERROR)
			log.exception("unable to parse nvdaremote:// url %s" % url)
			raise
		log.info("Connection info: %r" % con_info)
		if callable(self.callback):
			wx.CallLater(50, self.callback, con_info) 
Example #16
Source File: gui.py    From RF-Monitor with GNU General Public License v2.0 6 votes vote down vote up
def open(self, filename):
        try:
            freq, gain, cal, dynP, monitors = load_recordings(filename)
        except ValueError:
            msg = '\'' + os.path.split(filename)[1] + '\' is corrupt.'
            wx.MessageBox(msg, 'Error',
                          wx.OK | wx.ICON_ERROR)
            return

        self._filename = filename
        self.__set_title()
        self._toolbar.set_freq(freq)
        self._toolbar.set_gain(gain)
        self._toolbar.set_cal(cal)
        self._toolbar.set_dynamic_percentile(dynP)
        self.__clear_monitors()
        self.__add_monitors(monitors)
        self.__enable_controls(True)
        self.__set_timeline()
        self.__set_spectrum()
        self._isSaved = True
        self._warnedPush = False 
Example #17
Source File: DurationEditorDialog.py    From OpenPLC_Editor with GNU General Public License v3.0 5 votes vote down vote up
def GetControlValueTestFunction(self, control):
        def OnValueChanged(event):
            try:
                float(control.GetValue())
            except ValueError:
                message = wx.MessageDialog(self, _("Invalid value!\nYou must fill a numeric value."), _("Error"), wx.OK | wx.ICON_ERROR)
                message.ShowModal()
                message.Destroy()
            event.Skip()
            self.OnCloseDialog()
        return OnValueChanged 
Example #18
Source File: flow.py    From iqiyi-parser with MIT License 5 votes vote down vote up
def empty():
        dlg = wx.MessageDialog(gui.frame_parse, u'数据返回为空。', u'错误', wx.OK | wx.ICON_ERROR)
        dlg.ShowModal()
        dlg.Destroy() 
Example #19
Source File: BlockPreviewDialog.py    From OpenPLC_Editor with GNU General Public License v3.0 5 votes vote down vote up
def ShowErrorMessage(self, message):
        """
        Show an error message dialog over this dialog
        @param message: Error message to display
        """
        dialog = wx.MessageDialog(self, message,
                                  _("Error"),
                                  wx.OK | wx.ICON_ERROR)
        dialog.ShowModal()
        dialog.Destroy() 
Example #20
Source File: flow.py    From iqiyi-parser with MIT License 5 votes vote down vote up
def fail():
        dlg = wx.MessageDialog(gui.frame_downloader, '发生未知错误,无法生成最终视频!', '错误', wx.OK | wx.ICON_ERROR)
        dlg.ShowModal()
        dlg.Destroy() 
Example #21
Source File: flow.py    From iqiyi-parser with MIT License 5 votes vote down vote up
def timeout():
            dlg = wx.MessageDialog(gui.frame_parse, u'Msg:\"请求被服务器中止或网络超时。\"', u'错误', wx.OK | wx.ICON_ERROR)
            dlg.ShowModal()
            dlg.Destroy()
            # gui.frame_parse.button_godownload.Enable(True) 
Example #22
Source File: flow.py    From iqiyi-parser with MIT License 5 votes vote down vote up
def do(parser_info):
            avl = list(parser_info.keys())
            dlg = wx.MultiChoiceDialog(gui.frame_parse, u'以下核心可以更新', u'更新核心', avl)
            if dlg.ShowModal() != wx.ID_OK:
                dlg.Destroy()
                return False
            sel = dlg.GetSelections()
            for i in sel:

                # for i, j in parser_info.items():
                dlm = nbdler.Manager()
                dl = nbdler.open(urls=[urljoin(cv.REPO, avl[i])], max_conn=3, filename=avl[i] + '.gzip', block_size=1,
                                 filepath=cv.PARSER_PATH)
                dlm.addHandler(dl)
                dlg = gui.DialogGetTool(gui.frame_parse, u'正在下载 %s.gzip' % avl[i], dl.getFileSize(), dlm)

                dlg.Bind(wx.EVT_TIMER, GetTool._process, dlg.timer)
                dlg.timer.Start(50, oneShot=False)
                dlm.run()
                msg = dlg.ShowModal()
                if msg != wx.ID_OK:
                    return False
                else:
                    try:
                        with open(os.path.join(cv.PARSER_PATH, avl[i]), 'w') as f:
                            f.write(gzip.open(os.path.join(cv.PARSER_PATH, avl[i] + '.gzip')).read().decode('utf-8'))
                        os.remove(os.path.join(cv.PARSER_PATH, avl[i] + '.gzip'))
                    except:
                        dlg = wx.MessageDialog(gui.frame_parse, traceback.format_exc(), avl[i], wx.OK | wx.ICON_ERROR)
                        dlg.ShowModal()
                        dlg.Destroy()

            dlg.Destroy()
            dlg = wx.MessageDialog(gui.frame_parse, '核心更新完成!', '提示', wx.OK | wx.ICON_INFORMATION)
            dlg.ShowModal()
            dlg.Destroy()

            LoadParserCore.handle() 
Example #23
Source File: ConfigEditor.py    From OpenPLC_Editor with GNU General Public License v3.0 5 votes vote down vote up
def ShowMessage(self, message):
        message = wx.MessageDialog(self.ParentWindow, message, _("Error"), wx.OK | wx.ICON_ERROR)
        message.ShowModal()
        message.Destroy() 
Example #24
Source File: flow.py    From iqiyi-parser with MIT License 5 votes vote down vote up
def timeout():
            dlg = wx.MessageDialog(gui.dialog_copylink, u'请求超时,请重试!', u'错误', wx.OK | wx.ICON_ERROR)
            dlg.ShowModal()
            dlg.Destroy() 
Example #25
Source File: flow.py    From iqiyi-parser with MIT License 5 votes vote down vote up
def exception(msg):
            wx.MessageDialog(gui.frame_parse, msg, u'解析异常', wx.OK | wx.ICON_ERROR).ShowModal() 
Example #26
Source File: flow.py    From iqiyi-parser with MIT License 5 votes vote down vote up
def timeout():
            dlg = wx.MessageDialog(gui.frame_parse, u'请求超时,请重试!', u'错误', wx.OK | wx.ICON_ERROR)
            dlg.ShowModal()
            dlg.Destroy() 
Example #27
Source File: misc.py    From wxGlade with MIT License 5 votes vote down vote up
def error_message(msg, title="Error", display_traceback=False):
    if config.use_gui:
        wx.MessageBox( _(msg), _(title), wx.OK | wx.CENTRE | wx.ICON_ERROR )
    else:
        logging.error(msg) 
Example #28
Source File: flow.py    From iqiyi-parser with MIT License 5 votes vote down vote up
def timeout():
        dlg = wx.MessageDialog(gui.frame_parse, u'请求超时,是否重试?', u'错误', wx.YES_NO | wx.ICON_ERROR)
        if dlg.ShowModal() == wx.ID_YES:
            UndoneJob.do()
        else:
            UndoneJob.skip()
        dlg.Destroy() 
Example #29
Source File: flow.py    From iqiyi-parser with MIT License 5 votes vote down vote up
def handle():
        try:
            err_msg = parser.init()
            if err_msg:
                dlg = wx.MessageDialog(gui.frame_parse, '\n'.join(err_msg), u'核心加载错误信息', wx.OK | wx.ICON_ERROR)
                dlg.ShowModal()
                dlg.Destroy()
        except:
            err_msg = traceback.format_exc()
            dlg = wx.MessageDialog(gui.frame_parse, err_msg, u'错误', wx.OK | wx.ICON_ERROR)
            dlg.ShowModal()
            dlg.Destroy() 
Example #30
Source File: flow.py    From iqiyi-parser with MIT License 5 votes vote down vote up
def _do():
        def __(sel_res):
            if not sel_res:
                dlg = wx.MessageDialog(None, u'没有解析到匹配的资源。', '错误', wx.OK | wx.ICON_ERROR)
                dlg.ShowModal()
                dlg.Destroy()
                ShutDown.handle()
                return
            if FrameParser.MenuGoDownload.handler_audio(sel_res):
                FrameDownload.handle()
            else:
                FrameParser.handle()

        try:
            url = cv.UNDONE_JOB['url']
            quality = cv.UNDONE_JOB['quality']
            features = cv.UNDONE_JOB['features']
            sel_res = parser.matchParse(url, quality, features)
        except (socket.timeout, URLError, SSLError):
            wx.CallAfter(UndoneJob.timeout)
        else:
            if not sel_res:
                wx.CallAfter(UndoneJob.empty)
            else:
                cv.SEL_RES = sel_res
                wx.CallAfter(__, sel_res)