本文整理汇总了Python中wx.BeginBusyCursor方法的典型用法代码示例。如果您正苦于以下问题:Python wx.BeginBusyCursor方法的具体用法?Python wx.BeginBusyCursor怎么用?Python wx.BeginBusyCursor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wx
的用法示例。
在下文中一共展示了wx.BeginBusyCursor方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: HighlightEvents
# 需要导入模块: import wx [as 别名]
# 或者: from wx import BeginBusyCursor [as 别名]
def HighlightEvents(self, entries):
date = self.GetDate()
year = date.GetYear()
month = date.GetMonth() + 1
has_events = 0
days = []
years = entries.get_years()
if year in years:
months = entries.get_months(year)
if month in months:
has_events = 1
days = entries.get_days(year, month)
wx.BeginBusyCursor()
try:
for day in range(1, 32):
if day in days and has_events:
self.SetDayAttr(day, True)
else:
self.SetDayAttr(day, False)
self.Refresh(True)
finally:
wx.EndBusyCursor()
示例2: _CalendarDisplayChanged
# 需要导入模块: import wx [as 别名]
# 或者: from wx import BeginBusyCursor [as 别名]
def _CalendarDisplayChanged(self, event):
date = event.GetDate()
year = date.GetYear()
month = date.GetMonth() + 1
has_events = 0
days = []
years = self.entries.get_years()
if year in years:
months = self.entries.get_months(year)
if month in months:
has_events = 1
days = self.entries.get_days(year, month)
wx.BeginBusyCursor()
try:
for day in range(1, 32):
if day in days and has_events:
self.cal.SetDayAttr(day, True)
else:
self.cal.SetDayAttr(day, False)
self.cal.Refresh(True)
finally:
wx.EndBusyCursor()
示例3: StartWaiting
# 需要导入模块: import wx [as 别名]
# 或者: from wx import BeginBusyCursor [as 别名]
def StartWaiting(txt=None, mayAbort=False):
frame=GetCurrentFrame()
if frame:
if hasattr(frame, 'tree') and frame.tree:
node=frame.tree.GetNode()
if node:
node.waitingFrame=frame
if not txt:
txt=xlt("working...")
frame.PushStatus(txt)
if not mayAbort:
wx.BeginBusyCursor()
frame.MakeModal(True)
try:
wx.SafeYield()
except:
pass
return frame
示例4: OnOpen
# 需要导入模块: import wx [as 别名]
# 或者: from wx import BeginBusyCursor [as 别名]
def OnOpen(self, evt):
if not self.AskSave(): return
dlg = wx.FileDialog(self, 'Open', os.path.dirname(self.dataFile),
'', '*.xrc', wx.OPEN | wx.CHANGE_DIR)
if dlg.ShowModal() == wx.ID_OK:
path = dlg.GetPath()
self.SetStatusText('Loading...')
wx.BeginBusyCursor()
try:
if self.Open(path):
self.SetStatusText('Data loaded')
else:
self.SetStatusText('Failed')
self.SaveRecent(path)
finally:
wx.EndBusyCursor()
dlg.Destroy()
示例5: create
# 需要导入模块: import wx [as 别名]
# 或者: from wx import BeginBusyCursor [as 别名]
def create(self):
# creates/shows the widget of the given toplevel node and all its children
wx.BeginBusyCursor()
try:
WindowBase.create(self)
finally:
wx.EndBusyCursor()
# from old code:
# below, probably check_prop should be False
## set the best size for the widget (if no one is given)
#if not self.check_prop('size'):
#if self.sizer: # self.sizer is the containing sizer, i.e. the parent
#self.sizer.fit_parent()
#elif self.WX_CLASS=="wxPanel" and self.children:
#wx.Yield() # by now, there are probably many EVT_SIZE in the queue
#self.children[0].fit_parent()
self.widget.GetTopLevelParent().Show()
# SafeYield and SetFocus are required for e.g. Ubuntu w. Python 3.8 and wxPython 4.0.7
# see file SIMPLIFICATIONS\Tests_full.wxg where the first frame will not be layouted
wx.SafeYield()
self.widget.Raise()
self.widget.SetFocus()
示例6: _paste
# 需要导入模块: import wx [as 别名]
# 或者: from wx import BeginBusyCursor [as 别名]
def _paste(parent, index, clipboard_data):
"parse XML and insert widget"
option, span, flag, border, xml_unicode = clipboard2widget( clipboard_data )
if not xml_unicode: return False
import xml_parse
try:
wx.BeginBusyCursor()
# widget representation is still unicode, but parser need UTF8
xml_utf8 = xml_unicode.encode('utf8')
parser = xml_parse.ClipboardXmlWidgetBuilder(parent, index, option, span, flag, border)
with parent and parent.frozen() or misc.dummy_contextmanager():
parser.parse_string(xml_utf8)
if parent and hasattr(parent, "on_child_pasted"):
parent.on_child_pasted() # trigger e.g. re-sizing of the children
freeze = parser._object_counter>80 # for more objects, we freeze the Tree during re-build
misc.rebuild_tree( parser.top_obj, freeze=freeze )
return True # Widget hierarchy pasted.
except xml_parse.XmlParsingError:
if config.debugging: raise
return False
finally:
wx.EndBusyCursor()
示例7: OnSpellCheckerDlg
# 需要导入模块: import wx [as 别名]
# 或者: from wx import BeginBusyCursor [as 别名]
def OnSpellCheckerDlg(self):
self.sp.clearMark()
self.clearAutoComp()
wasAtStart = self.sp.line == 0
wx.BeginBusyCursor()
if not spellcheck.loadDict(mainFrame):
wx.EndBusyCursor()
return
sc = spellcheck.SpellChecker(self.sp, gd.scDict)
found = sc.findNext()
wx.EndBusyCursor()
if not found:
s = ""
if not wasAtStart:
s = "\n\n(Starting position was not at\n"\
"the beginning of the script.)"
wx.MessageBox("Spell checker found no errors." + s, "Results",
wx.OK, mainFrame)
return
dlg = spellcheckdlg.SpellCheckDlg(mainFrame, self, sc, gd.scDict)
dlg.ShowModal()
if dlg.changedGlobalDict:
gd.saveScDict()
dlg.Destroy()
self.sp.clearMark()
self.makeLineVisible(self.sp.line)
self.updateScreen()
示例8: EntryChangedListener
# 需要导入模块: import wx [as 别名]
# 或者: from wx import BeginBusyCursor [as 别名]
def EntryChangedListener(self, entry, year, month, day, id, expand=True):
"""Callback for TKEntries.store_entry()."""
wx.BeginBusyCursor()
try:
stack = self.GetDateStack(year, month, day, id)
if not entry:
if stack[3]:
self.Prune(stack[3])
else:
subject = entry.get_subject()
if not stack[1]:
data = TKEntryKey(year, None, None, None)
stack[1] = self.AppendItem(stack[0],
str(year),
-1, -1, data)
self.SortChildren(stack[0])
if not stack[2]:
data = TKEntryKey(year, month, None, None)
stack[2] = self.AppendItem(stack[1],
month_names[month - 1],
-1, -1, data)
self.SortChildren(stack[1])
if not stack[3]:
data = TKEntryKey(year, month, day, id)
stack[3] = self.AppendItem(stack[2],
self._ItemLabel(day, subject),
-1, -1, data)
self.SortChildren(stack[2])
else:
self.SetItemText(stack[3], self._ItemLabel(day, subject))
if expand:
self.Expand(stack[0])
self.Expand(stack[1])
self.Expand(stack[2])
self.Expand(stack[3])
self.SelectItem(stack[3])
finally:
wx.EndBusyCursor()
示例9: _SetFont
# 需要导入模块: import wx [as 别名]
# 或者: from wx import BeginBusyCursor [as 别名]
def _SetFont(self, font):
"""Set the font used by the entry text field."""
wx.BeginBusyCursor()
self.ignore_text_event = True
try:
self.frame.FindWindowById(self.text_id).SetFont(font)
self.conf.font_face = font.GetFaceName()
self.conf.font_size = font.GetPointSize()
self.options_dialog.FindWindowById(self.font_id).SetLabel(
"%s, %dpt" % (self.conf.font_face, self.conf.font_size))
finally:
self.ignore_text_event = False
wx.EndBusyCursor()
示例10: _FileArchiveMenu
# 需要导入模块: import wx [as 别名]
# 或者: from wx import BeginBusyCursor [as 别名]
def _FileArchiveMenu(self, event):
date = self._QueryChooseDate('Archive files before which date?')
if date is None:
return
path = None
new_basename = ''
if self.conf.data_file is not None:
new_base, new_ext = os.path.splitext(os.path.basename(
self.conf.data_file))
if not new_ext:
new_ext = '.tkj'
new_basename = new_base + '.archive' + new_ext
dialog = self._GetFileDialog('Archive to a new data file',
wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT,
new_basename)
if dialog.ShowModal() == wx.ID_OK:
path = dialog.GetPath()
dialog.Destroy()
if path is None:
return
if len(path) < 5 or not path.endswith('.tkj'):
path = path + '.tkj'
wx.Yield()
wx.BeginBusyCursor()
try:
self._ArchiveEntriesBeforeDate(path,
date.GetYear(),
date.GetMonth() + 1,
date.GetDay())
finally:
wx.EndBusyCursor()
示例11: PostProcessing
# 需要导入模块: import wx [as 别名]
# 或者: from wx import BeginBusyCursor [as 别名]
def PostProcessing(self, onDone=None):
wx.BeginBusyCursor()
wx.SafeYield()
env = get_environment(rast=self.settings['output']['scan'])
try:
postprocess = imp.load_source('postprocess', os.path.join(self._getTaskDir(), self.tasks[self.current]['analyses']))
except Exception as e:
print(e)
return
functions = [func for func in dir(postprocess) if func.startswith('post_')]
for func in functions:
exec('del postprocess.' + func)
try:
postprocess = imp.load_source('postprocess', os.path.join(self._getTaskDir(), self.tasks[self.current]['analyses']))
except Exception as e:
print(e)
return
functions = [func for func in dir(postprocess) if func.startswith('post_')]
for func in functions:
try:
exec('postprocess.' + func + "(real_elev=self.settings['scan']['elevation'],"
" scanned_elev=self.settings['output']['scan'],"
" filterResults=self.scaniface.filter['counter'],"
" timeToFinish=self.endTime,"
" subTask=self.currentSubtask,"
" logDir=self.configuration['logDir'],"
" env=env)")
except (CalledModuleError, Exception, ScriptError) as e:
traceback.print_exc()
wx.EndBusyCursor()
if self.handsoff:
ll = self.giface.GetLayerList()
ll.DeleteLayer(self.handsoff)
self.handsoff = None
if onDone:
onDone()
示例12: OnRecentFile
# 需要导入模块: import wx [as 别名]
# 或者: from wx import BeginBusyCursor [as 别名]
def OnRecentFile(self,evt):
# open recently used file
if not self.AskSave(): return
wx.BeginBusyCursor()
try:
path=conf.recentfiles[evt.GetId()]
if self.Open(path):
self.SetStatusText('Data loaded')
else:
self.SetStatusText('Failed')
except KeyError:
self.SetStatusText('No such file')
wx.EndBusyCursor()
示例13: OnSearch
# 需要导入模块: import wx [as 别名]
# 或者: from wx import BeginBusyCursor [as 别名]
def OnSearch(self, event = None):
l = []
wx.BeginBusyCursor()
s = util.lower(misc.fromGUI(self.searchEntry.GetValue()))
sex = self.sexRb.GetSelection()
nt = self.nameRb.GetSelection()
selTypes = {}
item = -1
while 1:
item = self.typeList.GetNextItem(item, wx.LIST_NEXT_ALL,
wx.LIST_STATE_SELECTED)
if item == -1:
break
selTypes[self.typeList.GetItemData(item)] = True
if len(selTypes) == len(nameArr.typeNamesCnt):
doTypes = False
else:
doTypes = True
for i in xrange(nameArr.count):
if (sex != 2) and (sex == nameArr.sex[i]):
continue
if doTypes and nameArr.type[i] not in selTypes:
continue
if s:
name = util.lower(nameArr.name[i])
if nt == 0:
if not name.startswith(s):
continue
elif nt == 1:
if name.find(s) == -1:
continue
elif nt == 2:
if not name.endswith(s):
continue
l.append(i)
self.list.items = l
self.list.SetItemCount(len(l))
self.list.EnsureVisible(0)
wx.EndBusyCursor()
self.foundLabel.SetLabel("%d names found." % len(l))
示例14: OnSuggest
# 需要导入模块: import wx [as 别名]
# 或者: from wx import BeginBusyCursor [as 别名]
def OnSuggest(self, event):
if not self.sc.word:
return
isAllCaps = self.sc.word == util.upper(self.sc.word)
isCapitalized = self.sc.word[:1] == util.upper(self.sc.word[:1])
word = util.lower(self.sc.word)
wl = len(word)
wstart = word[:2]
d = 500
fifo = util.FIFO(5)
wx.BeginBusyCursor()
for w in spellcheck.prefixDict[util.getWordPrefix(word)]:
if w.startswith(wstart):
d = self.tryWord(word, wl, w, d, fifo)
for w in self.gScDict.words.iterkeys():
if w.startswith(wstart):
d = self.tryWord(word, wl, w, d, fifo)
for w in self.ctrl.sp.scDict.words.iterkeys():
if w.startswith(wstart):
d = self.tryWord(word, wl, w, d, fifo)
items = fifo.get()
wx.EndBusyCursor()
if len(items) == 0:
wx.MessageBox("No similar words found.", "Results",
wx.OK, self)
return
dlg = wx.SingleChoiceDialog(
self, "Most similar words:", "Suggestions", items)
if dlg.ShowModal() == wx.ID_OK:
sel = dlg.GetSelection()
newWord = items[sel]
if isAllCaps:
newWord = util.upper(newWord)
elif isCapitalized:
newWord = util.capitalize(newWord)
self.replaceEntry.SetValue(newWord)
dlg.Destroy()
# if w2 is closer to w1 in Levenshtein distance than d, add it to
# fifo. return min(d, new_distance).
示例15: OnSaveOrSaveAs
# 需要导入模块: import wx [as 别名]
# 或者: from wx import BeginBusyCursor [as 别名]
def OnSaveOrSaveAs(self, evt):
if evt.GetId() == wx.ID_SAVEAS or not self.dataFile:
if self.dataFile: name = ''
else: name = defaultName
dirname = os.path.abspath(os.path.dirname(self.dataFile))
dlg = wx.FileDialog(self, 'Save As', dirname, name, '*.xrc',
wx.SAVE | wx.OVERWRITE_PROMPT | wx.CHANGE_DIR)
if dlg.ShowModal() == wx.ID_OK:
path = dlg.GetPath()
if isinstance(path, unicode):
path = path.encode(sys.getfilesystemencoding())
dlg.Destroy()
else:
dlg.Destroy()
return
if conf.localconf:
# if we already have a localconf then it needs to be
# copied to a new config with the new name
lc = conf.localconf
nc = self.CreateLocalConf(path)
flag, key, idx = lc.GetFirstEntry()
while flag:
nc.Write(key, lc.Read(key))
flag, key, idx = lc.GetNextEntry(idx)
conf.localconf = nc
else:
# otherwise create a new one
conf.localconf = self.CreateLocalConf(path)
else:
path = self.dataFile
self.SetStatusText('Saving...')
wx.BeginBusyCursor()
try:
try:
tmpFile,tmpName = tempfile.mkstemp(prefix='xrced-')
os.close(tmpFile)
self.Save(tmpName) # save temporary file first
shutil.move(tmpName, path)
self.dataFile = path
if conf.localconf.ReadBool("autogenerate", False):
pypath = conf.localconf.Read("filename")
embed = conf.localconf.ReadBool("embedResource", False)
genGettext = conf.localconf.ReadBool("genGettext", False)
self.GeneratePython(self.dataFile, pypath, embed, genGettext)
self.SetStatusText('Data saved')
self.SaveRecent(path)
except IOError:
self.SetStatusText('Failed')
finally:
wx.EndBusyCursor()