本文整理汇总了Python中wx.CENTRE属性的典型用法代码示例。如果您正苦于以下问题:Python wx.CENTRE属性的具体用法?Python wx.CENTRE怎么用?Python wx.CENTRE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类wx
的用法示例。
在下文中一共展示了wx.CENTRE属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: onSaveDiagInch
# 需要导入模块: import wx [as 别名]
# 或者: from wx import CENTRE [as 别名]
def onSaveDiagInch(self, event):
"""Save user modified display sizes to DisplaySystem."""
inches = []
for tc in self.tc_list_diaginch:
tc_val = tc.GetValue()
user_inch = self.test_diag_value(tc_val)
if user_inch:
inches.append(user_inch)
else:
# error msg
msg = ("Display size must be a positive number, "
"'{}' was entered.".format(tc_val))
sp_logging.G_LOGGER.info(msg)
dial = wx.MessageDialog(self, msg, "Error", wx.OK|wx.STAY_ON_TOP|wx.CENTRE)
dial.ShowModal()
return -1
self.display_sys.update_display_diags(inches)
self.display_sys.save_system()
display_data = self.display_sys.get_disp_list(self.show_advanced_settings)
self.wpprev_pnl.update_display_data(
display_data,
self.show_advanced_settings,
self.use_multi_image
)
示例2: AskSave
# 需要导入模块: import wx [as 别名]
# 或者: from wx import CENTRE [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
示例3: on_close
# 需要导入模块: import wx [as 别名]
# 或者: from wx import CENTRE [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()
示例4: ShowEnvironmentError
# 需要导入模块: import wx [as 别名]
# 或者: from wx import CENTRE [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)
示例5: Open
# 需要导入模块: import wx [as 别名]
# 或者: from wx import CENTRE [as 别名]
def Open(self, filePath=None):
self.ShowFrame()
if filePath is not None:
res = wx.MessageBox(
"Do you really want to load the tree file:\n%s" % filePath,
eg.APP_NAME,
wx.YES_NO | wx.CENTRE | wx.ICON_QUESTION,
parent = self.frame,
)
if res == wx.ID_NO:
return wx.ID_CANCEL
if self.CheckFileNeedsSave() == wx.ID_CANCEL:
return wx.ID_CANCEL
if filePath is None:
filePath = self.AskFile(wx.OPEN)
if filePath is None:
return wx.ID_CANCEL
self.StartSession(filePath)
示例6: error_msg_wx
# 需要导入模块: import wx [as 别名]
# 或者: from wx import CENTRE [as 别名]
def error_msg_wx(msg, parent=None):
"""
Signal an error condition -- in a GUI, popup a error dialog
"""
dialog =wx.MessageDialog(parent = parent,
message = msg,
caption = 'Matplotlib backend_wx error',
style=wx.OK | wx.CENTRE)
dialog.ShowModal()
dialog.Destroy()
return None
示例7: error_msg_wx
# 需要导入模块: import wx [as 别名]
# 或者: from wx import CENTRE [as 别名]
def error_msg_wx(msg, parent=None):
"""
Signal an error condition -- in a GUI, popup a error dialog
"""
dialog = wx.MessageDialog(parent=parent,
message=msg,
caption='Matplotlib backend_wx error',
style=wx.OK | wx.CENTRE)
dialog.ShowModal()
dialog.Destroy()
return None
示例8: show_message_dialog
# 需要导入模块: import wx [as 别名]
# 或者: from wx import CENTRE [as 别名]
def show_message_dialog(message, msg_type="Info", parent=None, style="OK"):
"""General purpose info dialog in GUI mode."""
# Type can be 'Info', 'Error', 'Question', 'Exclamation'
if style == "OK":
dial = wx.MessageDialog(parent, message, msg_type, wx.OK|wx.STAY_ON_TOP|wx.CENTRE)
dial.ShowModal()
elif style == "YES_NO":
dial = wx.MessageDialog(parent, message, msg_type, wx.YES_NO|wx.STAY_ON_TOP|wx.CENTRE)
res = dial.ShowModal()
if res == wx.ID_YES:
return True
else:
return False
示例9: onApply
# 需要导入模块: import wx [as 别名]
# 或者: from wx import CENTRE [as 别名]
def onApply(self, event):
entered_val = self.test_bezel_value()
if entered_val is False:
# Abort applying and alert user but don't
# Dismiss popup to fascilitate fixing.
msg = ("Bezel thickness must be a non-negative number, "
"'{}' was entered.".format(self.tc_bez.GetValue()))
sp_logging.G_LOGGER.info(msg)
self.Hide()
dial = wx.MessageDialog(self, msg, "Error", wx.OK|wx.STAY_ON_TOP|wx.CENTRE)
dial.ShowModal()
self.Show()
return -1
self.current_bez_val = entered_val
display_sys = self.preview.display_sys
pops = self.preview.bezel_popups
bezel_mms = []
for pop_pair in pops:
bezel_mms.append(
(
pop_pair[0].bezel_value(),
pop_pair[1].bezel_value()
)
)
self.Dismiss()
# propagate values and refresh preview
self.preview.display_sys.update_bezels(bezel_mms)
self.preview.display_data = self.preview.display_sys.get_disp_list(True)
self.preview.full_refresh_preview(True, True, False)
# self.preview.show_staticbmps(False) # Use PaintDC drawing separately from staticbitmaps
# self.preview.draggable_shapes = []
# self.preview.create_shapes(enable_movement=False)
示例10: _init_ctrls
# 需要导入模块: import wx [as 别名]
# 或者: from wx import CENTRE [as 别名]
def _init_ctrls(self, prnt):
wx.Dialog.__init__(self, id=ID_ADDSLAVEDIALOG,
name='AddSlaveDialog', parent=prnt, pos=wx.Point(376, 223),
size=wx.Size(300, 250), style=wx.DEFAULT_DIALOG_STYLE|wx.RESIZE_BORDER,
title=_('Add a slave to nodelist'))
self.SetClientSize(wx.Size(300, 250))
self.staticText1 = wx.StaticText(id=ID_ADDSLAVEDIALOGSTATICTEXT1,
label=_('Slave Name:'), name='staticText1', parent=self,
pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0)
self.SlaveName = wx.TextCtrl(id=ID_ADDSLAVEDIALOGSLAVENAME,
name='SlaveName', parent=self, pos=wx.Point(0, 0),
size=wx.Size(0, 24), style=0)
self.staticText2 = wx.StaticText(id=ID_ADDSLAVEDIALOGSTATICTEXT2,
label=_('Slave Node ID:'), name='staticText2', parent=self,
pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0)
self.SlaveNodeID = wx.TextCtrl(id=ID_ADDSLAVEDIALOGSLAVENODEID,
name='SlaveName', parent=self, pos=wx.Point(0, 0),
size=wx.Size(0, 24), style=wx.ALIGN_RIGHT)
self.staticText3 = wx.StaticText(id=ID_ADDSLAVEDIALOGSTATICTEXT3,
label=_('EDS File:'), name='staticText3', parent=self,
pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0)
self.EDSFile = wx.ComboBox(id=ID_ADDSLAVEDIALOGEDSFILE,
name='EDSFile', parent=self, pos=wx.Point(0, 0),
size=wx.Size(0, 28), style=wx.CB_READONLY)
self.ImportEDS = wx.Button(id=ID_ADDSLAVEDIALOGIMPORTEDS, label=_('Import EDS'),
name='ImportEDS', parent=self, pos=wx.Point(0, 0),
size=wx.Size(100, 32), style=0)
self.ImportEDS.Bind(wx.EVT_BUTTON, self.OnImportEDSButton,
id=ID_ADDSLAVEDIALOGIMPORTEDS)
self.ButtonSizer = self.CreateButtonSizer(wx.OK|wx.CANCEL|wx.CENTRE)
self.Bind(wx.EVT_BUTTON, self.OnOK, id=self.ButtonSizer.GetAffirmativeButton().GetId())
self._init_sizers()
示例11: OnAbout
# 需要导入模块: import wx [as 别名]
# 或者: from wx import CENTRE [as 别名]
def OnAbout(self, evt):
str = '''\
XRCed version %s
(c) Roman Rolinsky <rollrom@users.sourceforge.net>
Homepage: http://xrced.sourceforge.net\
''' % version
dlg = wx.MessageDialog(self, str, 'About XRCed', wx.OK | wx.CENTRE)
dlg.ShowModal()
dlg.Destroy()
示例12: on_autosave_timer
# 需要导入模块: import wx [as 别名]
# 或者: from wx import CENTRE [as 别名]
def on_autosave_timer(self, event):
res = common.autosave_current()
if res == 2:
self.user_message(_("Auto saving... done"))
elif not res:
self.autosave_timer.Stop()
config.preferences.autosave = False
logging.info(_('Disable autosave function permanently'))
wx.MessageBox(
_('The autosave function failed. It has been disabled\n'
'permanently due to this error. Use the preferences\n'
'dialog to re-enable this functionality.\n'
'The details have been written to the wxGlade log file\n\n'
'The log file is: %s' % config.log_file ),
_('Autosave Failed'), wx.OK | wx.CENTRE | wx.ICON_ERROR )
示例13: edit_preferences
# 需要导入模块: import wx [as 别名]
# 或者: from wx import CENTRE [as 别名]
def edit_preferences(self):
dialog = preferencesdialog.wxGladePreferences(config.preferences)
if dialog.ShowModal() == wx.ID_OK:
wx.MessageBox( _('Changes will take effect after wxGlade is restarted'),
_('Preferences saved'), wx.OK|wx.CENTRE|wx.ICON_INFORMATION )
dialog.set_preferences()
dialog.Destroy()
示例14: ask_save
# 需要导入模块: import wx [as 别名]
# 或者: from wx import CENTRE [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
示例15: on_delete
# 需要导入模块: import wx [as 别名]
# 或者: from wx import CENTRE [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