本文整理汇总了Python中wx.ICON_ERROR属性的典型用法代码示例。如果您正苦于以下问题:Python wx.ICON_ERROR属性的具体用法?Python wx.ICON_ERROR怎么用?Python wx.ICON_ERROR使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类wx
的用法示例。
在下文中一共展示了wx.ICON_ERROR属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: open
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ICON_ERROR [as 别名]
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
示例2: windowProc
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ICON_ERROR [as 别名]
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)
示例3: Save_Report_As
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ICON_ERROR [as 别名]
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')
示例4: OnSyncDone
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ICON_ERROR [as 别名]
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)
示例5: new_external_profile
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ICON_ERROR [as 别名]
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"))
示例6: launch_solo_server
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ICON_ERROR [as 别名]
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)
示例7: SaveTheoryCurves
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ICON_ERROR [as 别名]
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()
##############
示例8: _HelpUpdateMenu
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ICON_ERROR [as 别名]
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
# -----------------------------------------------------------------
示例9: _loadConfiguration
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ICON_ERROR [as 别名]
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()
示例10: on_close
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ICON_ERROR [as 别名]
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()
示例11: ShowEnvironmentError
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ICON_ERROR [as 别名]
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)
示例12: OnProcessVariablesGridCellChange
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ICON_ERROR [as 别名]
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()
示例13: OnOK
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ICON_ERROR [as 别名]
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)
示例14: OnOK
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ICON_ERROR [as 别名]
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()
示例15: OnOK
# 需要导入模块: import wx [as 别名]
# 或者: from wx import ICON_ERROR [as 别名]
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()