本文整理汇总了Python中wx.CANCEL属性的典型用法代码示例。如果您正苦于以下问题:Python wx.CANCEL属性的具体用法?Python wx.CANCEL怎么用?Python wx.CANCEL使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类wx
的用法示例。
在下文中一共展示了wx.CANCEL属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __on_rec
# 需要导入模块: import wx [as 别名]
# 或者: from wx import CANCEL [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()
示例2: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import CANCEL [as 别名]
def __init__(self, parent, id, title):
super().__init__(parent, id, title=title)
main_sizer = self.main_sizer = wx.BoxSizer(wx.VERTICAL)
self.client_or_server = wx.RadioBox(self, wx.ID_ANY, choices=(_("Client"), _("Server")), style=wx.RA_VERTICAL)
self.client_or_server.Bind(wx.EVT_RADIOBOX, self.on_client_or_server)
self.client_or_server.SetSelection(0)
main_sizer.Add(self.client_or_server)
choices = [_("Control another machine"), _("Allow this machine to be controlled")]
self.connection_type = wx.RadioBox(self, wx.ID_ANY, choices=choices, style=wx.RA_VERTICAL)
self.connection_type.SetSelection(0)
main_sizer.Add(self.connection_type)
self.container = wx.Panel(parent=self)
self.panel = ClientPanel(parent=self.container)
main_sizer.Add(self.container)
buttons = self.CreateButtonSizer(wx.OK | wx.CANCEL)
main_sizer.Add(buttons, flag=wx.BOTTOM)
main_sizer.Fit(self)
self.SetSizer(main_sizer)
self.Center(wx.BOTH | WX_CENTER)
ok = wx.FindWindowById(wx.ID_OK, self)
ok.Bind(wx.EVT_BUTTON, self.on_ok)
示例3: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import CANCEL [as 别名]
def __init__(self, parent, title, current_language):
style = wx.DEFAULT_DIALOG_STYLE
vbox = wx.BoxSizer(wx.VERTICAL)
wx.Dialog.__init__(self, parent, -1, title, style=style)
self.lbl = wx.StaticText(self, -1,
_("Choose language (requires restart to take full effect)"))
vbox.Add(self.lbl, 0, wx.ALL, 10)
self.language_choices = wx.ComboBox(self, -1,
choices=sorted(LANGUAGES.keys()),
style=wx.CB_READONLY)
self.language_choices.SetStringSelection(LANGUAGES_REVERSE[current_language])
vbox.Add(self.language_choices, 0, wx.ALL, 10)
buttons = self.CreateButtonSizer(wx.OK | wx.CANCEL)
vbox.Add(buttons, 0, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL, 10)
self.SetSizerAndFit(vbox)
示例4: _wantToReuseAvailableCert
# 需要导入模块: import wx [as 别名]
# 或者: from wx import CANCEL [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)
示例5: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import CANCEL [as 别名]
def __init__(self, parent):
# TODO: try to use MessageBox instead, as they already include buttons, icons, etc.
wx.Dialog.__init__(self, parent, title="SCT Processing")
self.SetSize((300, 120))
vbox = wx.BoxSizer(wx.VERTICAL)
lbldesc = wx.StaticText(self, id=wx.ID_ANY, label="Processing, please wait...")
vbox.Add(lbldesc, 0, wx.ALIGN_LEFT | wx.ALL, 10)
btns = self.CreateSeparatedButtonSizer(wx.CANCEL)
vbox.Add(btns, 0, wx.ALIGN_LEFT | wx.ALL, 5)
hbox = wx.BoxSizer(wx.HORIZONTAL)
# TODO: use a nicer image, showing two gears (similar to ID_EXECUTE)
save_ico = wx.ArtProvider.GetBitmap(wx.ART_INFORMATION, wx.ART_TOOLBAR, (50, 50))
img_info = wx.StaticBitmap(self, -1, save_ico, wx.DefaultPosition, (save_ico.GetWidth(), save_ico.GetHeight()))
hbox.Add(img_info, 0, wx.ALL, 10)
hbox.Add(vbox, 0, wx.ALL, 0)
self.SetSizer(hbox)
self.Centre()
self.CenterOnParent()
# TODO: retrieve action from the cancel button
示例6: _RefuseUnsavedModifications
# 需要导入模块: import wx [as 别名]
# 或者: from wx import CANCEL [as 别名]
def _RefuseUnsavedModifications(self, refuse_modified_options=False):
"""If there exist unsaved entry modifications, inform the user
and return True. Otherwise, return False."""
if self.entry_modified:
wx.MessageBox(('Entry has been modified. You must either '
'save or revert it.'),
'Modified Entry',
wx.OK | wx.ICON_INFORMATION,
self.frame)
return True
elif refuse_modified_options and self.diary_modified:
if wx.OK == wx.MessageBox(('Diary has been modified. Click OK '
'to continue and lose the changes.'),
'Modified Diary',
wx.OK | wx.CANCEL | wx.ICON_QUESTION,
self.frame):
return False
return True
return False
示例7: enter_torrent_url
# 需要导入模块: import wx [as 别名]
# 或者: from wx import CANCEL [as 别名]
def enter_torrent_url(self, widget):
s = ''
if wx.TheClipboard.Open():
do = wx.TextDataObject()
if wx.TheClipboard.GetData(do):
t = do.GetText()
t = t.strip()
if "://" in t or os.path.sep in t or (os.path.altsep and os.path.altsep in t):
s = t
wx.TheClipboard.Close()
d = wx.TextEntryDialog(parent=self.main_window,
message=_("Enter the URL of a torrent file to open:"),
caption=_("Enter torrent URL"),
defaultValue = s,
style=wx.OK|wx.CANCEL,
)
if d.ShowModal() == wx.ID_OK:
path = d.GetValue()
df = self.open_torrent_arg_with_callbacks(path)
示例8: AskSave
# 需要导入模块: import wx [as 别名]
# 或者: from wx import CANCEL [as 别名]
def AskSave(self):
if not (self.modified or panel.IsModified()): return True
flags = wx.ICON_EXCLAMATION | wx.YES_NO | wx.CANCEL | wx.CENTRE
dlg = wx.MessageDialog( self, 'File is modified. Save before exit?',
'Save before too late?', flags )
say = dlg.ShowModal()
dlg.Destroy()
wx.Yield()
if say == wx.ID_YES:
self.OnSaveOrSaveAs(wx.CommandEvent(wx.ID_SAVE))
# If save was successful, modified flag is unset
if not self.modified: return True
elif say == wx.ID_NO:
self.SetModified(False)
panel.SetModified(False)
return True
return False
示例9: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import CANCEL [as 别名]
def __init__(self, parent, enable_required=True):
wx.Dialog.__init__(self, parent, title=_('Project properties'),
style=wx.DEFAULT_DIALOG_STYLE)
main_sizer = wx.FlexGridSizer(cols=1, hgap=0, rows=2, vgap=10)
main_sizer.AddGrowableCol(0)
main_sizer.AddGrowableRow(0)
self.ProjectProperties = ProjectPropertiesPanel(
self, enable_required=enable_required, scrolling=False)
main_sizer.AddWindow(self.ProjectProperties, flag=wx.GROW)
self.ButtonSizer = self.CreateButtonSizer(wx.OK | wx.CANCEL | wx.CENTRE)
self.Bind(wx.EVT_BUTTON, self.OnOK,
self.ButtonSizer.GetAffirmativeButton())
main_sizer.AddSizer(self.ButtonSizer, border=20,
flag=wx.ALIGN_RIGHT | wx.BOTTOM | wx.LEFT | wx.RIGHT)
self.SetSizer(main_sizer)
self.ProjectProperties.Fit()
self.Fit()
示例10: AddInitialStep
# 需要导入模块: import wx [as 别名]
# 或者: from wx import CANCEL [as 别名]
def AddInitialStep(self, pos):
dialog = SFCStepNameDialog(self.ParentWindow, _("Please enter step name"), _("Add a new initial step"), "", wx.OK | wx.CANCEL)
dialog.SetPouNames(self.Controler.GetProjectPouNames(self.Debug))
dialog.SetVariables(self.Controler.GetEditedElementInterfaceVars(self.TagName, debug=self.Debug))
dialog.SetStepNames([block.GetName() for block in self.Blocks if isinstance(block, SFC_Step)])
if dialog.ShowModal() == wx.ID_OK:
id = self.GetNewId()
name = dialog.GetValue()
step = SFC_Step(self, name, True, id)
min_width, min_height = step.GetMinSize()
step.SetPosition(pos.x, pos.y)
width, height = step.GetSize()
step.SetSize(max(min_width, width), max(min_height, height))
self.AddBlock(step)
self.Controler.AddEditedElementStep(self.TagName, id)
self.RefreshStepModel(step)
self.RefreshBuffer()
self.RefreshScrollBars()
self.Refresh(False)
dialog.Destroy()
示例11: EditStepContent
# 需要导入模块: import wx [as 别名]
# 或者: from wx import CANCEL [as 别名]
def EditStepContent(self, step):
if self.GetDrawingMode() == FREEDRAWING_MODE:
Viewer.EditStepContent(self, step)
else:
dialog = SFCStepNameDialog(self.ParentWindow, _("Edit step name"), _("Please enter step name"), step.GetName(), wx.OK | wx.CANCEL)
dialog.SetPouNames(self.Controler.GetProjectPouNames(self.Debug))
dialog.SetVariables(self.Controler.GetEditedElementInterfaceVars(self.TagName, debug=self.Debug))
dialog.SetStepNames([block.GetName() for block in self.Blocks if isinstance(block, SFC_Step) and block.GetName() != step.GetName()])
if dialog.ShowModal() == wx.ID_OK:
value = dialog.GetValue()
step.SetName(value)
min_size = step.GetMinSize()
size = step.GetSize()
step.UpdateSize(max(min_size[0], size[0]), max(min_size[1], size[1]))
step.RefreshModel()
self.RefreshBuffer()
self.RefreshScrollBars()
self.Refresh(False)
dialog.Destroy()
# -------------------------------------------------------------------------------
# Delete element functions
# -------------------------------------------------------------------------------
示例12: CheckSaveBeforeClosing
# 需要导入模块: import wx [as 别名]
# 或者: from wx import CANCEL [as 别名]
def CheckSaveBeforeClosing(self, title=_("Close Project")):
"""Function displaying an question dialog if project is not saved"
:returns: False if closing cancelled.
"""
if not self.Controler.ProjectIsSaved():
dialog = wx.MessageDialog(self, _("There are changes, do you want to save?"), title, wx.YES_NO | wx.CANCEL | wx.ICON_QUESTION)
answer = dialog.ShowModal()
dialog.Destroy()
if answer == wx.ID_YES:
self.SaveProject()
elif answer == wx.ID_CANCEL:
return False
for idx in xrange(self.TabsOpened.GetPageCount()):
window = self.TabsOpened.GetPage(idx)
if not window.CheckSaveBeforeClosing():
return False
return True
# -------------------------------------------------------------------------------
# File Menu Functions
# -------------------------------------------------------------------------------
示例13: __on_del
# 需要导入模块: import wx [as 别名]
# 或者: from wx import CANCEL [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 CANCEL [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: __save_warning
# 需要导入模块: import wx [as 别名]
# 或者: from wx import CANCEL [as 别名]
def __save_warning(self):
if not self._isSaved:
resp = wx.MessageBox('Not saved, continue?', 'Warning',
wx.OK | wx.CANCEL | wx.ICON_WARNING)
if resp != wx.OK:
return False
return True