本文整理汇总了Python中wx.YES属性的典型用法代码示例。如果您正苦于以下问题:Python wx.YES属性的具体用法?Python wx.YES怎么用?Python wx.YES使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类wx
的用法示例。
在下文中一共展示了wx.YES属性的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: verify_connect
# 需要导入模块: import wx [as 别名]
# 或者: from wx import YES [as 别名]
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
示例2: _wantToReuseAvailableCert
# 需要导入模块: import wx [as 别名]
# 或者: from wx import YES [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)
示例3: prompt_for_quit_for_new_version
# 需要导入模块: import wx [as 别名]
# 或者: from wx import YES [as 别名]
def prompt_for_quit_for_new_version(self, version):
d = wx.MessageBox(
message=_(("%s is ready to install a new version (%s). Do you "
"want to quit now so that the new version can be "
"installed? If not, the new version will be installed "
"the next time you quit %s."
) % (app_name, version, app_name)),
caption=_("Install update now?"),
style=wx.YES_NO|wx.YES_DEFAULT,
parent=self.main_window
)
if d == wx.YES:
self.quit(confirm_quit=False)
示例4: ConfirmDelete
# 需要导入模块: import wx [as 别名]
# 或者: from wx import YES [as 别名]
def ConfirmDelete(msg, hdr, force=False):
if confirmDeletes or force:
rc=wx.MessageBox(msg, hdr, wx.YES_NO|wx.ICON_EXCLAMATION|wx.YES_DEFAULT)
return rc == wx.YES
else:
return True
示例5: check_autosaved
# 需要导入模块: import wx [as 别名]
# 或者: from wx import YES [as 别名]
def check_autosaved(self):
if not common.check_autosaved(None): return
res = wx.MessageBox(
_('There seems to be auto saved data from last wxGlade session: do you want to restore it?'),
_('Auto save detected'), style=wx.ICON_QUESTION | wx.YES_NO)
if res == wx.YES:
filename = common.get_name_for_autosave()
if self._open_app(filename, add_to_history=False):
self.cur_dir = os.path.dirname(filename)
common.root.saved = False
common.root.filename = None
self.user_message(_('Auto save loaded'))
common.remove_autosaved()
示例6: ask_save
# 需要导入模块: import wx [as 别名]
# 或者: from wx import YES [as 别名]
def ask_save(self):
"""checks whether the current app has changed and needs to be saved:
if so, prompts the user;
returns False if the operation has been cancelled"""
if not common.root.saved:
ok = wx.MessageBox(_("Save changes to the current app?"),
_("Confirm"), wx.YES_NO|wx.CANCEL|wx.CENTRE|wx.ICON_QUESTION)
if ok == wx.YES:
self.save_app()
return ok != wx.CANCEL
return True
示例7: _open
# 需要导入模块: import wx [as 别名]
# 或者: from wx import YES [as 别名]
def _open(self, filename):
# called by open_app and open_from_history
if common.check_autosaved(filename):
res = wx.MessageBox( _('There seems to be auto saved data for this file: do you want to restore it?'),
_('Auto save detected'), style=wx.ICON_QUESTION | wx.YES_NO )
if res == wx.YES:
common.restore_from_autosaved(filename)
else:
common.remove_autosaved(filename)
else:
common.remove_autosaved(filename)
path = position = None
if filename == common.root.filename:
# if we are re-loading the file, store path and position
if misc.focused_widget:
path = misc.focused_widget.get_path()
if misc.focused_widget.widget is not None and not misc.focused_widget.IS_ROOT:
toplevel = misc.get_toplevel_parent(misc.focused_widget.widget)
if toplevel: position = toplevel.GetPosition()
self._open_app(filename)
self.cur_dir = os.path.dirname(filename)
if not path: return
editor = common.root.find_widget_from_path(path)
if not editor: return
misc.set_focused_widget(editor)
if editor is common.root: return
editor.toplevel_parent.create()
common.app_tree.ExpandAllChildren(editor.item)
if not position or not editor.widget: return
misc.get_toplevel_parent(editor.widget).SetPosition(position)
示例8: on_delete
# 需要导入模块: import wx [as 别名]
# 或者: from wx import YES [as 别名]
def on_delete(self, event):
self.selected_template = self.get_selected()
if self.selected_template is not None:
name = self.template_names.GetStringSelection()
if wx.MessageBox( _("Delete template '%s'?") % misc.wxstr(name),
_("Are you sure?"), style=wx.YES|wx.NO|wx.CENTRE) == wx.YES:
try:
os.unlink(self.selected_template)
except Exception:
logging.exception(_('Internal Error'))
self.fill_template_list()
self.selected_template = None
示例9: save_template
# 需要导入模块: import wx [as 别名]
# 或者: from wx import YES [as 别名]
def save_template(data=None):
"Returns an out file name and template description for saving a template"
dlg = templates_ui.TemplateInfoDialog(None, -1, "")
if data is not None:
dlg.template_name.SetValue( misc.wxstr(os.path.basename(os.path.splitext(data.filename)[0])) )
dlg.author.SetValue(misc.wxstr(data.author))
dlg.description.SetValue(misc.wxstr(data.description))
dlg.instructions.SetValue(misc.wxstr(data.instructions))
ret = None
retdata = Template()
if dlg.ShowModal() == wx.ID_OK:
ret = dlg.template_name.GetValue().strip()
retdata.author = dlg.author.GetValue()
retdata.description = dlg.description.GetValue()
retdata.instructions = dlg.instructions.GetValue()
if not ret:
wx.MessageBox( _("Can't save a template with an empty name"), _("Error"), wx.OK|wx.ICON_ERROR )
dlg.Destroy()
name = ret
if ret:
template_directory = os.path.join(config.appdata_path, 'templates')
if not os.path.exists(template_directory):
try:
os.makedirs(template_directory)
except EnvironmentError:
logging.exception( _('ERROR creating directory "%s"'), template_directory )
return None, retdata
ret = os.path.join(template_directory, ret + '.wgt')
if ret and os.path.exists(ret) and \
wx.MessageBox( _("A template called '%s' already exists:\ndo you want to overwrite it?") % name,
_("Question"), wx.YES|wx.NO|wx.ICON_QUESTION) != wx.YES:
ret = None
return ret, retdata
示例10: InstallDriver
# 需要导入模块: import wx [as 别名]
# 或者: from wx import YES [as 别名]
def InstallDriver(cls):
while True:
with cls.installThreadLock:
if cls.installQueue.empty():
cls.installThread = None
return
self = cls.installQueue.get()
if wx.YES != eg.CallWait(
wx.MessageBox,
Text.installMsg % self.plugin.name,
caption=Text.dialogCaption % self.plugin.name,
style=wx.YES_NO | wx.ICON_QUESTION | wx.STAY_ON_TOP,
parent=eg.document.frame
):
continue
if not self.CheckAddOnFiles():
continue
self.CreateInf()
result = -1
cmdLine = '"%s" /f /lm' % join(INSTALLATION_ROOT, "dpinst.exe")
try:
result = ExecAs(
"subprocess",
eg.WindowsVersion >= 'Vista' or not IsAdmin(),
"call",
cmdLine.encode('mbcs'),
)
except WindowsError, exc:
#only silence "User abort"
if exc.winerror != 1223:
raise
if result == 1:
eg.actionThread.Call(self.plugin.info.Start)
示例11: ShowDownloadMessage
# 需要导入模块: import wx [as 别名]
# 或者: from wx import YES [as 别名]
def ShowDownloadMessage(self):
return wx.YES == wx.MessageBox(
Text.downloadMsg % self.plugin.name,
caption=Text.dialogCaption % self.plugin.name,
style=wx.YES_NO | wx.ICON_QUESTION | wx.STAY_ON_TOP,
parent=eg.document.frame
)
示例12: ShowRestartMessage
# 需要导入模块: import wx [as 别名]
# 或者: from wx import YES [as 别名]
def ShowRestartMessage(self):
res = wx.MessageBox(
Text.restartMsg,
caption=eg.APP_NAME,
style=wx.YES_NO | wx.ICON_QUESTION | wx.STAY_ON_TOP,
parent=eg.document.frame
)
if res == wx.YES:
eg.app.Restart()
示例13: OnDeleteButton
# 需要导入模块: import wx [as 别名]
# 或者: from wx import YES [as 别名]
def OnDeleteButton(self, evt):
items = self.dvc.GetSelections()
rows = [self.model.GetRow(item) for item in items]
# Ask if user really wants to delete
if wx.MessageBox(_('Are you sure to delete selected IDs?'),
_('Delete IDs'),
wx.YES_NO | wx.CENTRE | wx.NO_DEFAULT) != wx.YES:
return
self.model.DeleteRows(rows)
示例14: OnFitButton
# 需要导入模块: import wx [as 别名]
# 或者: from wx import YES [as 别名]
def OnFitButton(self,event):
""" Call elecsus to fit data. Some sanity checking takes place first. """
## check for things that will prevent fitting from working, e.g. no data loaded - halt fitting if found
if len(self.y_fit_array) == 0:
#warn about no data present
dlg = wx.MessageDialog(self, "No experimental data has been loaded, cannot proceed with fitting...", "No no no", wx.OK|wx.ICON_EXCLAMATION)
dlg.ShowModal()
return
self.fit_bools = [checkbox.IsChecked() for checkbox in self.FitOptions.main_paramlist_bools]
self.fit_bools += [checkbox.IsChecked() for checkbox in self.FitOptions.magnet_paramlist_bools]
self.fit_bools += [self.FitOptions.fit_polarisation_checkbox.IsChecked()]
if self.fit_bools.count(True) == 0:
dlg = wx.MessageDialog(self, "No fit parameters are floating, cannot proceed with fitting...", "No no no", wx.OK|wx.ICON_EXCLAMATION)
dlg.ShowModal()
return
## check for non-optimal conditions and warn user
if self.warnings:
## if number of booleans > 3 and ML fitting selected, warn about fitting methods
if self.fit_bools.count(True) > 3 and self.fit_algorithm=='Marquardt-Levenberg':
dlg = wx.MessageDialog(self, "The number of fitted parameters is large and the Marquardt-Levenberg algorithm is selected. There is a high probability that the fit will return a local minimum, rather than the global minimum. \n\nTo find the global minimum more reliably, consider changing to either Random-Restart or Simulated Annealing algorithms.\n\n Continue with fitting anyway?", "Warning", wx.YES|wx.NO|wx.ICON_WARNING)
if dlg.ShowModal() == wx.ID_NO:
return
## if large number of data points
if len(self.x_fit_array) > 5000:
dlg = wx.MessageDialog(self, "The number of data points is quite high and fitting may be very slow, especially with Random-Restart or Simulated Annealing methods. \n\nConsider reducing the number of data points by binning data (Menu Fit --> Data Processing... --> Bin Data).\n\n Continue with fitting anyway?", "Warning", wx.YES|wx.NO|wx.ICON_WARNING)
if dlg.ShowModal() == wx.ID_NO:
return
# Bounds on fit parameters must be enabled for differential evolution
if self.fit_algorithm=='Differential Evolution':
# status of checkboxes for floated params must equal checkboxes ticked for bounds
ticked_bools = [i for i, box in enumerate(self.FitOptions.main_paramlist_bools+self.FitOptions.magnet_paramlist_bools) if box.IsChecked()]
print(ticked_bools)
ticked_bounds = [i for i, box in enumerate(self.FitOptions.main_paramlist_usebounds+self.FitOptions.magnet_paramlist_usebounds) if box.IsChecked()]
print(ticked_bounds)
if ticked_bools != ticked_bounds:
dlg = wx.MessageDialog(self,"Bounds on fit parameters must be specified to use Differential Evolution algorithm","Bounds not specified",style=wx.OK|wx.CENTRE|wx.ICON_ERROR)
dlg.ShowModal()
return
# If all conditions satisfied, start the fitting process
self.Call_ElecSus('Fit')