本文整理汇总了Python中CeciliaLib.showErrorDialog方法的典型用法代码示例。如果您正苦于以下问题:Python CeciliaLib.showErrorDialog方法的具体用法?Python CeciliaLib.showErrorDialog怎么用?Python CeciliaLib.showErrorDialog使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CeciliaLib
的用法示例。
在下文中一共展示了CeciliaLib.showErrorDialog方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: onSavePreset
# 需要导入模块: import CeciliaLib [as 别名]
# 或者: from CeciliaLib import showErrorDialog [as 别名]
def onSavePreset(self):
dlg = wx.TextEntryDialog(self, 'Enter preset name:','Saving Preset', self.currentPreset)
if dlg.ShowModal() == wx.ID_OK:
newPreset = CeciliaLib.ensureNFD(dlg.GetValue())
else:
return
dlg.Destroy()
if newPreset == '':
CeciliaLib.showErrorDialog('Failed saving preset', 'You must give a name to your preset!')
return
if newPreset == 'init':
CeciliaLib.showErrorDialog('Failed saving preset', '"init" is reserved. You must give another name to your preset!')
return
if newPreset in CeciliaLib.getVar("presets").keys():
dlg2 = wx.MessageDialog(self, 'The preset you entered already exists. Are you sure you want to overwrite it?',
'Existing preset!', wx.YES_NO | wx.NO_DEFAULT | wx.ICON_INFORMATION)
if dlg2.ShowModal() == wx.ID_NO:
return
dlg2.Destroy()
self.currentPreset = newPreset
CeciliaLib.savePresetToDict(self.currentPreset)
self.presetChoice.setChoice(self.orderingPresetNames(), False)
self.presetChoice.setStringSelection(self.currentPreset)
示例2: openRecent
# 需要导入模块: import CeciliaLib [as 别名]
# 或者: from CeciliaLib import showErrorDialog [as 别名]
def openRecent(self, event):
menu = self.GetMenuBar()
id = event.GetId()
file = menu.FindItemById(id).GetLabel()
if os.path.isfile(file[:-1]):
CeciliaLib.openCeciliaFile(self, file[:-1])
self.updateTitle()
else:
CeciliaLib.showErrorDialog("Error while trying to open a file!", "No such file : %s" % file[:-1])
self.newRecent(file[:-1], remove=True)
示例3: buildTogglePopupBox
# 需要导入模块: import CeciliaLib [as 别名]
# 或者: from CeciliaLib import showErrorDialog [as 别名]
def buildTogglePopupBox(parent, list):
mainBox = wx.BoxSizer(wx.VERTICAL)
outBox = wx.BoxSizer(wx.VERTICAL)
objects = []
widgetlist = [widget for widget in list if widget['type'] in ['cpopup', 'ctoggle', 'cbutton']]
widgetCecList = [widget for widget in list if widget['type'] == 'cgen']
widgetpoly = [widget for widget in list if widget['type'] == 'cpoly']
for i, widget in enumerate(widgetlist):
if widget['type'] == 'cpopup':
tooltip = widget.get('help', '')
name = widget['name']
label = widget.get('label', '')
values = widget.get('value')
init = widget.get('init', values[0])
rate = widget.get('rate', 'k')
if rate == 'k':
col = widget.get('col', '')
if col == '':
col = random.choice(COLOUR_CLASSES.keys())
elif col not in COLOUR_CLASSES.keys():
CeciliaLib.showErrorDialog('Wrong colour!', '"%s"\n\nAvailable colours for -col flag are:\n\n%s.' % (col, ', '.join(COLOUR_CLASSES.keys())))
col = random.choice(COLOUR_CLASSES.keys())
colour = CeciliaLib.chooseColourFromName(col)
else:
colour = CeciliaLib.chooseColourFromName("grey")
cpopup = CECPopup(parent, label, values, init, rate, name, colour, tooltip)
box = wx.FlexGridSizer(1,2,2,10)
box.AddMany([(cpopup.label, 0, wx.TOP | wx.ALIGN_RIGHT, 2), (cpopup.popup, 0, wx.TOP | wx.ALIGN_LEFT, 2)])
mainBox.Add(box, 0, wx.TOP | wx.BOTTOM, 1)
objects.append(cpopup)
elif widget['type'] == 'ctoggle':
tooltip = widget.get('help', '')
name = widget['name']
label = widget.get('label', '')
stack = widget.get('stack', False)
init = widget.get('init', 0)
rate = widget.get('rate', 'k')
if rate == 'k':
col = widget.get('col', '')
if col == '':
col = random.choice(COLOUR_CLASSES.keys())
elif col not in COLOUR_CLASSES.keys():
CeciliaLib.showErrorDialog('Wrong colour!', '"%s"\n\nAvailable colours for -col flag are:\n\n%s.' % (col, ', '.join(COLOUR_CLASSES.keys())))
col = random.choice(COLOUR_CLASSES.keys())
colour = CeciliaLib.chooseColourFromName(col)
else:
colour = CeciliaLib.chooseColourFromName("grey")
ctoggle = CECToggle(parent, label, init, rate, name, colour, tooltip, stack)
if stack and label != '':
labelBox = wx.FlexGridSizer(1,1,2,10)
labelBox.Add(ctoggle.label, 0, wx.EXPAND | wx.TOP, 2)
mainBox.Add(labelBox, 0, wx.TOP | wx.BOTTOM, 1)
stackBox = wx.FlexGridSizer(1,8,2,7)
stackBox.Add(ctoggle.toggle, 0, wx.TOP, 2)
mainBox.Add(stackBox, 0, wx.TOP | wx.BOTTOM, 1)
elif stack:
stackBox.Add(ctoggle.toggle, 0, wx.TOP | wx.ALIGN_LEFT, 2)
else:
box = wx.FlexGridSizer(1,2,2,10)
box.AddMany([(ctoggle.label, 0, wx.TOP | wx.ALIGN_RIGHT, 2), (ctoggle.toggle, 0, wx.TOP | wx.ALIGN_LEFT, 2)])
mainBox.Add(box, 0, wx.TOP | wx.BOTTOM, 1)
objects.append(ctoggle)
elif widget['type'] == 'cbutton':
tooltip = widget.get('help', '')
name = widget['name']
label = widget.get('label', '')
col = widget.get('col', '')
if col == '':
col = random.choice(COLOUR_CLASSES.keys())
elif col not in COLOUR_CLASSES.keys():
CeciliaLib.showErrorDialog('Wrong colour!', '"%s"\n\nAvailable colours for -col flag are:\n\n%s.' % (col, ', '.join(COLOUR_CLASSES.keys())))
col = random.choice(COLOUR_CLASSES.keys())
colour = CeciliaLib.chooseColourFromName(col)
cbutton = CECButton(parent, label, name, colour, tooltip)
box = wx.FlexGridSizer(1,2,2,10)
box.AddMany([(cbutton.label, 0, wx.TOP | wx.ALIGN_RIGHT, 2), (cbutton.button, 0, wx.TOP | wx.ALIGN_LEFT, 2)])
mainBox.Add(box, 0, wx.TOP | wx.BOTTOM, 1)
objects.append(cbutton)
for i, widget in enumerate(widgetCecList):
tooltip = widget.get('help', '')
name = widget['name']
init = widget.get('init', '1')
label = widget.get('label', '')
rate = widget.get('rate', 'k')
if rate == 'k':
col = widget.get('col', '')
if col == '':
col = random.choice(COLOUR_CLASSES.keys())
elif col not in COLOUR_CLASSES.keys():
CeciliaLib.showErrorDialog('Wrong colour!', '"%s"\n\nAvailable colours for -col flag are:\n\n%s.' % (col, ', '.join(COLOUR_CLASSES.keys())))
col = random.choice(COLOUR_CLASSES.keys())
colour = CeciliaLib.chooseColourFromName(col)
else:
colour = CeciliaLib.chooseColourFromName("grey")
popup = widget.get("popup", None)
#.........这里部分代码省略.........
示例4: buildTogglePopupBox
# 需要导入模块: import CeciliaLib [as 别名]
# 或者: from CeciliaLib import showErrorDialog [as 别名]
def buildTogglePopupBox(parent, list):
mainBox = wx.BoxSizer(wx.VERTICAL)
box = wx.FlexGridSizer(10,2,2,10)
objects = []
widgetlist = [widget for widget in list if widget['type'] in ['cpopup', 'ctoggle', 'cbutton']]
widgetpoly = [widget for widget in list if widget['type'] == 'cpoly']
widgetCecList = [widget for widget in list if widget['type'] == 'cgen']
for i, widget in enumerate(widgetlist):
if widget['type'] == 'cpopup':
tooltip = widget.get('help', '')
rate = widget.get('rate', 'k')
if rate not in ['i', 'k']:
CeciliaLib.showErrorDialog('Error when building interface!', "-rate option choices are 'i' or 'k'.")
name = widget['name']
if name.startswith('-'):
CeciliaLib.showErrorDialog('Error when building interface!', "Missing name. First argument of cpopup can't be %s." % widget['name'])
label = widget.get('label', '')
if label == '':
CeciliaLib.showErrorDialog('Error when building interface!', "cpopup %s has no -label option." % name)
values = widget.get('value').split(' ')
init = widget.get('init', values[0])
col = widget.get('col', '')
if col == '':
col = random.choice(COLOUR_CLASSES.keys())
elif col not in COLOUR_CLASSES.keys():
CeciliaLib.showErrorDialog('Wrong colour!', '"%s"\n\nAvailable colours for -col flag are:\n\n%s.' % (col, ', '.join(COLOUR_CLASSES.keys())))
col = random.choice(COLOUR_CLASSES.keys())
colour = chooseColourFromName(col)
if rate == 'i':
colour = [LABEL_BACK_COLOUR, "#666666"]
cpopup = CECPopup(parent, label, values, init, name, colour, rate, tooltip)
box.AddMany([(cpopup.label, 0, wx.TOP | wx.ALIGN_RIGHT, 2), (cpopup.popup, 0, wx.TOP | wx.ALIGN_LEFT, 2)])
objects.append(cpopup)
if widget['type'] == 'ctoggle':
tooltip = widget.get('help', '')
rate = widget.get('rate', 'k')
if rate not in ['i', 'k']:
CeciliaLib.showErrorDialog('Error when building interface!', "-rate option choices are 'i' or 'k'.")
name = widget['name']
if name.startswith('-'):
CeciliaLib.showErrorDialog('Error when building interface!', "Missing name. First argument of ctoggle can't be %s." % widget['name'])
label = widget.get('label', '')
if label == '':
CeciliaLib.showErrorDialog('Error when building interface!', "ctoggle %s has no -label option." % name)
init = eval(widget.get('init', '0'))
col = widget.get('col', '')
if col == '':
col = random.choice(COLOUR_CLASSES.keys())
elif col not in COLOUR_CLASSES.keys():
CeciliaLib.showErrorDialog('Wrong colour!', '"%s"\n\nAvailable colours for -col flag are:\n\n%s.' % (col, ', '.join(COLOUR_CLASSES.keys())))
col = random.choice(COLOUR_CLASSES.keys())
colour = chooseColourFromName(col)
if rate == 'i':
colour = [LABEL_BACK_COLOUR, "#666666"]
ctoggle = CECToggle(parent, label, init, name, colour, rate, tooltip)
box.AddMany([(ctoggle.label, 0, wx.TOP | wx.ALIGN_RIGHT, 2), (ctoggle.toggle, 0, wx.TOP | wx.ALIGN_LEFT, 2)])
objects.append(ctoggle)
if widget['type'] == 'cbutton':
tooltip = widget.get('help', '')
trig = eval(widget.get('trig', '0'))
name = widget['name']
if name.startswith('-'):
CeciliaLib.showErrorDialog('Error when building interface!', "Missing name. First argument of cbutton can't be %s." % widget['name'])
label = widget.get('label', '')
col = widget.get('col', '')
if col == '':
col = random.choice(COLOUR_CLASSES.keys())
elif col not in COLOUR_CLASSES.keys():
CeciliaLib.showErrorDialog('Wrong colour!', '"%s"\n\nAvailable colours for -col flag are:\n\n%s.' % (col, ', '.join(COLOUR_CLASSES.keys())))
col = random.choice(COLOUR_CLASSES.keys())
colour = chooseColourFromName(col)
if label == '':
CeciliaLib.showErrorDialog('Error when building interface!', "cbutton %s has no -label option." % name)
cbutton = CECButton(parent, label, name, trig, colour, tooltip)
box.AddMany([(cbutton.label, 0, wx.TOP | wx.ALIGN_RIGHT, 2), (cbutton.button, 0, wx.TOP | wx.ALIGN_LEFT, 2)])
objects.append(cbutton)
for i, widget in enumerate(widgetpoly):
tooltip = widget.get('help', '')
name = widget['name']
if name.startswith('-'):
CeciliaLib.showErrorDialog('Error when building interface!', "Missing name. First argument of cpoly can't be %s." % widget['name'])
minvoices = eval(widget.get('min', '1'))
maxvoices = eval(widget.get('max', '10'))
values = [str(voice) for voice in range(minvoices, maxvoices+1)]
init = widget.get('init', values[0])
label = widget.get('label', '')
if label == '':
CeciliaLib.showErrorDialog('Error when building interface!', "cpoly %s has no -label option." % name)
colour = [LABEL_BACK_COLOUR, "#666666"]
cpoly = CECPoly(parent, label, name, values, init, colour, tooltip)
box.AddMany([(cpoly.popup.label, 0, wx.ALIGN_RIGHT), (cpoly.popup.popup, 0, wx.ALIGN_LEFT),
(cpoly.slider.label, 0, wx.TOP | wx.ALIGN_RIGHT, 2), (cpoly.slider, 0, wx.ALIGN_LEFT | wx.TOP, 5)])
objects.append(cpoly.popup)
objects.append(cpoly.slider)
for i, widget in enumerate(widgetCecList):
#.........这里部分代码省略.........