本文整理汇总了Python中wx.MessageBox方法的典型用法代码示例。如果您正苦于以下问题:Python wx.MessageBox方法的具体用法?Python wx.MessageBox怎么用?Python wx.MessageBox使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wx
的用法示例。
在下文中一共展示了wx.MessageBox方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: open
# 需要导入模块: import wx [as 别名]
# 或者: from wx import MessageBox [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: __on_rec
# 需要导入模块: import wx [as 别名]
# 或者: from wx import MessageBox [as 别名]
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()
示例3: writeToFile
# 需要导入模块: import wx [as 别名]
# 或者: from wx import MessageBox [as 别名]
def writeToFile(filename, data, frame):
try:
f = open(misc.toPath(filename), "wb")
try:
f.write(data)
finally:
f.close()
return True
except IOError, (errno, strerror):
wx.MessageBox("Error writing file '%s': %s" % (
filename, strerror), "Error", wx.OK, frame)
return False
示例4: showTempPDF
# 需要导入模块: import wx [as 别名]
# 或者: from wx import MessageBox [as 别名]
def showTempPDF(pdfData, cfgGl, mainFrame):
try:
try:
util.removeTempFiles(misc.tmpPrefix)
fd, filename = tempfile.mkstemp(prefix = misc.tmpPrefix,
suffix = ".pdf")
try:
os.write(fd, pdfData)
finally:
os.close(fd)
util.showPDF(filename, cfgGl, mainFrame)
except IOError, (errno, strerror):
raise MiscError("IOError: %s" % strerror)
except TrelbyError, e:
wx.MessageBox("Error writing temporary PDF file: %s" % e,
"Error", wx.OK, mainFrame)
示例5: getPathFromRegistry
# 需要导入模块: import wx [as 别名]
# 或者: from wx import MessageBox [as 别名]
def getPathFromRegistry():
registryPath = r"Software\Microsoft\Windows\CurrentVersion\App Paths\trelby.exe"
try:
import _winreg
regPathKey = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, registryPath)
regPathValue, regPathType = _winreg.QueryValueEx(regPathKey, "Path")
if regPathType == _winreg.REG_SZ:
return regPathValue
else:
raise TypeError
except:
wx.MessageBox("There was an error reading the following registry key: %s.\n"
"You may need to reinstall the program to fix this error." %
registryPath, "Error", wx.OK)
sys.exit()
# convert s, which is returned from the wxWidgets GUI and is an Unicode
# string, to a normal string.
示例6: OnAdd
# 需要导入模块: import wx [as 别名]
# 或者: from wx import MessageBox [as 别名]
def OnAdd(self, event):
dlg = misc.KeyDlg(cfgFrame, self.cmd.name)
key = None
if dlg.ShowModal() == wx.ID_OK:
key = dlg.key
dlg.Destroy()
if key:
kint = key.toInt()
if kint in self.cmd.keys:
wx.MessageBox("The key is already bound to this command.",
"Error", wx.OK, cfgFrame)
return
if key.isValidInputChar():
wx.MessageBox("You can't bind input characters to commands.",
"Error", wx.OK, cfgFrame)
return
self.cmd.keys.append(kint)
self.cfg2gui()
示例7: getExportable
# 需要导入模块: import wx [as 别名]
# 或者: from wx import MessageBox [as 别名]
def getExportable(self, action):
if cfgGl.checkOnExport:
line = self.sp.findError(0)[0]
if line != -1:
if wx.MessageBox(
"The script seems to contain errors.\n"
"Are you sure you want to %s it?" % action, "Confirm",
wx.YES_NO | wx.NO_DEFAULT, mainFrame) == wx.NO:
return None
sp = self.sp
if sp.cfg.pdfRemoveNotes:
sp = copy.deepcopy(self.sp)
sp.removeElementTypes({screenplay.NOTE : None}, False)
sp.paginate()
return sp
示例8: OnFindNextError
# 需要导入模块: import wx [as 别名]
# 或者: from wx import MessageBox [as 别名]
def OnFindNextError(self):
self.clearAutoComp()
line, msg = self.sp.findError(self.sp.line)
if line != -1:
self.sp.line = line
self.sp.column = 0
self.makeLineVisible(self.sp.line)
self.updateScreen()
else:
msg = "No errors found."
wx.MessageBox(msg, "Results", wx.OK, mainFrame)
示例9: updateKbdCommands
# 需要导入模块: import wx [as 别名]
# 或者: from wx import MessageBox [as 别名]
def updateKbdCommands(self):
cfgGl.addShiftKeys()
if cfgGl.getConflictingKeys() != None:
wx.MessageBox("You have at least one key bound to more than one\n"
"command. The program will not work correctly until\n"
"you fix this.",
"Warning", wx.OK, self)
self.kbdCommands = {}
for cmd in cfgGl.commands:
if not (cmd.isFixed and cmd.isMenu):
for key in cmd.keys:
self.kbdCommands[key] = cmd
# open script, in the current tab if it's untouched, or in a new one
# otherwise
示例10: checkFonts
# 需要导入模块: import wx [as 别名]
# 或者: from wx import MessageBox [as 别名]
def checkFonts(self):
names = ["Normal", "Bold", "Italic", "Bold-Italic"]
failed = []
for i, fi in enumerate(cfgGui.fonts):
if not util.isFixedWidth(fi.font):
failed.append(names[i])
if failed:
wx.MessageBox(
"The fonts listed below are not fixed width and\n"
"will cause the program not to function correctly.\n"
"Please change the fonts at File/Settings/Change.\n\n"
+ "\n".join(failed), "Error", wx.OK, self)
# If we get focus, pass it on to ctrl.
示例11: Save_Report_As
# 需要导入模块: import wx [as 别名]
# 或者: from wx import MessageBox [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')
示例12: _wantToReuseAvailableCert
# 需要导入模块: import wx [as 别名]
# 或者: from wx import MessageBox [as 别名]
def _wantToReuseAvailableCert( self, directReuseCert ):
certAnswer = wx.NO
if self.isCertificateGenerated(self.secureBootType):
if not directReuseCert:
msgText = ((uilang.kMsgLanguageContentDict['certGenInfo_reuseOldCert'][self.languageIndex]))
certAnswer = wx.MessageBox(msgText, "Certificate Question", wx.YES_NO | wx.CANCEL | wx.ICON_QUESTION)
if certAnswer == wx.CANCEL:
return None
elif certAnswer == wx.NO:
msgText = ((uilang.kMsgLanguageContentDict['certGenInfo_haveNewCert'][self.languageIndex]))
certAnswer = wx.MessageBox(msgText, "Certificate Question", wx.YES_NO | wx.CANCEL | wx.ICON_QUESTION)
if certAnswer == wx.CANCEL:
return None
elif certAnswer == wx.YES:
certAnswer = wx.NO
else:
certAnswer = wx.YES
else:
certAnswer = wx.YES
return (certAnswer == wx.YES)
示例13: __on_del
# 需要导入模块: import wx [as 别名]
# 或者: from wx import MessageBox [as 别名]
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)
示例14: __on_clear
# 需要导入模块: import wx [as 别名]
# 或者: from wx import MessageBox [as 别名]
def __on_clear(self, _event):
resp = wx.MessageBox('Clear recorded data?', 'Warning',
wx.OK | wx.CANCEL | wx.ICON_WARNING)
if resp != wx.OK:
return
for monitor in self._monitors:
monitor.clear()
self.__set_timeline()
self._isSaved = False
self.__set_title()
示例15: __on_event
# 需要导入模块: import wx [as 别名]
# 或者: from wx import MessageBox [as 别名]
def __on_event(self, event):
if event.type == Events.SCAN_ERROR:
self.__on_scan_error(event.data)
elif event.type == Events.SCAN_DATA:
self.__on_scan_data(event.data)
elif event.type == Events.SERVER_ERROR:
self.__on_server_error(event.data)
elif event.type == Events.GPS_ERROR:
self._status.SetStatusText(event.data['msg'], 1)
self.__restart_gps()
elif event.type == Events.GPS_WARN:
self._status.SetStatusText(event.data['msg'], 1)
elif event.type == Events.GPS_TIMEOUT:
self._status.SetStatusText(event.data['msg'], 1)
self.__restart_gps()
elif event.type == Events.GPS_LOC:
self._location = event.data['loc']
loc = '{:9.5f}, {:9.5f}'.format(*self._location)
self._status.SetStatusText(loc, 1)
elif event.type == Events.MON_ALERT:
now = time.time()
if now - self._alertLast >= ALERT_LENGTH:
self._alertLast = now
self._alert.Play()
elif event.type == Events.CHANGED:
self._isSaved = False
self.__set_timeline()
self.__set_spectrum()
self.__set_title()
elif event.type == Events.PUSH_ERROR:
if not self._warnedPush:
self._warnedPush = True
wx.MessageBox('Error:\n\t' + event.data['msg'],
'Push failed', wx.OK | wx.ICON_ERROR)