本文整理匯總了Python中wx.CallAfter方法的典型用法代碼示例。如果您正苦於以下問題:Python wx.CallAfter方法的具體用法?Python wx.CallAfter怎麽用?Python wx.CallAfter使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類wx
的用法示例。
在下文中一共展示了wx.CallAfter方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: write
# 需要導入模塊: import wx [as 別名]
# 或者: from wx import CallAfter [as 別名]
def write(self, text):
"""
Create the output window if needed and write the string to it.
If not called in the context of the gui thread then CallAfter is
used to do the work there.
"""
if self.frame is None:
if not wx.IsMainThread():
wx.CallAfter(self.CreateOutputWindow, text)
else:
self.CreateOutputWindow(text)
else:
if not wx.IsMainThread():
wx.CallAfter(self.text.AppendText, text)
else:
self.text.AppendText(text)
示例2: request_payout_btcmp
# 需要導入模塊: import wx [as 別名]
# 或者: from wx import CallAfter [as 別名]
def request_payout_btcmp(self, balance_auth_token):
"""Request payout from btcmp's server via HTTP POST."""
response, data = http_request(
self.server_config['balance_host'],
"GET",
self.server_config["payout_url"] % balance_auth_token,
use_https=False
)
if self.is_auth_token_rejected(response):
data = _("Auth token rejected by server.")
elif not data:
data = STR_CONNECTION_ERROR
else:
data = _("Withdraw OK")
wx.CallAfter(self.on_balance_received, data)
示例3: request_payout_deepbit
# 需要導入模塊: import wx [as 別名]
# 或者: from wx import CallAfter [as 別名]
def request_payout_deepbit(self, balance_auth_token):
"""Request payout from deepbit's server via HTTP POST."""
post_params = dict(id=1,
method="request_payout")
response, data = http_request(
self.server_config['balance_host'],
"POST",
self.server_config['balance_url'] % balance_auth_token,
json.dumps(post_params),
{"Content-type": "application/json; charset=utf-8",
"User-Agent": USER_AGENT}
)
if self.is_auth_token_rejected(response):
data = _("Auth token rejected by server.")
elif not data:
data = STR_CONNECTION_ERROR
else:
data = _("Withdraw OK")
wx.CallAfter(self.on_balance_received, data)
示例4: request_balance_eligius
# 需要導入模塊: import wx [as 別名]
# 或者: from wx import CallAfter [as 別名]
def request_balance_eligius(self):
"""Request our balance from Eligius
"""
response, data = http_request(
self.server_config['balance_host'],
"POST",
self.server_config['balance_url'] % (self.txt_username.GetValue(),),
)
if not data:
data = STR_CONNECTION_ERROR
try:
data = json.loads(data)
data = data['expected'] / 1e8
except BaseException as e:
data = str(e)
wx.CallAfter(self.on_balance_received, data)
示例5: OnInit
# 需要導入模塊: import wx [as 別名]
# 或者: from wx import CallAfter [as 別名]
def OnInit(self, profile=None, memoryProfile=None):
"""Initialise the application"""
wx.Image.AddHandler(self.handler)
frame = MainFrame( config_parser = load_config())
frame.Show(True)
self.SetTopWindow(frame)
if profile:
wx.CallAfter(frame.load, *[profile])
elif sys.argv[1:]:
if sys.argv[1] == '-m':
if sys.argv[2:]:
wx.CallAfter( frame.load_memory, sys.argv[2] )
else:
log.warn( 'No memory file specified' )
else:
wx.CallAfter(frame.load, *sys.argv[1:])
return True
示例6: __init__
# 需要導入模塊: import wx [as 別名]
# 或者: from wx import CallAfter [as 別名]
def __init__(self, parent, frame, interpreter):
self._frame = frame
wx.Panel.__init__(self, parent, -1)
bookStyle = aui.AUI_NB_DEFAULT_STYLE
bookStyle &= ~(aui.AUI_NB_CLOSE_ON_ACTIVE_TAB)
self.rawpanel = HttpRawPanel(self, self)
self.renderpanel = self.create_web_view()
self.nb = aui.AuiNotebook(self, style=bookStyle)
self.nb.AddPage(self.rawpanel, "HTML Raw")
self.nb.AddPage(self.renderpanel, "HTML Render")
sizer = wx.BoxSizer()
sizer.Add(self.nb, 1, wx.EXPAND)
self.SetSizer(sizer)
wx.CallAfter(self.nb.SendSizeEvent)
pub.subscribe(self.on_selected_row, "selected_row")
示例7: syncronize_from_model
# 需要導入模塊: import wx [as 別名]
# 或者: from wx import CallAfter [as 別名]
def syncronize_from_model(self):
#TODO move this out of the presenter
#TODO Make all view interactions thread safe
wx.CallAfter(self.syncronize_from_model_async)
示例8: update_console_async
# 需要導入模塊: import wx [as 別名]
# 或者: from wx import CallAfter [as 別名]
def update_console_async(self, msg):
wx.CallAfter(self.runtime_display.append_text, msg)
示例9: update_progress_aync
# 需要導入模塊: import wx [as 別名]
# 或者: from wx import CallAfter [as 別名]
def update_progress_aync(self, progress, disable_animation=False):
wx.CallAfter(self.UpdateProgressBar, progress, disable_animation)
示例10: hook_callback
# 需要導入模塊: import wx [as 別名]
# 或者: from wx import CallAfter [as 別名]
def hook_callback(self, **kwargs):
#Prevent disabling sending keys if another key is held down
if not self.sending_keys:
return False
if kwargs['vk_code'] != VK_F11:
self.key_modified = kwargs['pressed']
if kwargs['vk_code'] == VK_F11 and kwargs['pressed'] and not self.key_modified:
self.sending_keys = False
self.set_receiving_braille(False)
# This is called from the hook thread and should be executed on the main thread.
# Translators: Presented when keyboard control is back to the controlling computer.
wx.CallAfter(ui.message, _("Controlling local machine."))
return True #Don't pass it on
self.master_transport.send(type="key", **kwargs)
return True #Don't pass it on
示例11: do_portcheck
# 需要導入模塊: import wx [as 別名]
# 或者: from wx import CallAfter [as 別名]
def do_portcheck(self, port):
temp_server = server.Server(port=port, password=None)
try:
req = request.urlopen('https://portcheck.nvdaremote.com/port/%s' % port)
data = req.read()
result = json.loads(data)
wx.CallAfter(self.on_get_IP_success, result)
except Exception as e:
self.on_get_IP_fail(e)
raise
finally:
temp_server.close()
self.get_IP.Enable(True)
示例12: call_callbacks
# 需要導入模塊: import wx [as 別名]
# 或者: from wx import CallAfter [as 別名]
def call_callbacks(self, type, *args, **kwargs):
"""Calls all callbacks for a given event type with the provided args and kwargs"""
for callback in self.callbacks[type]:
try:
wx.CallAfter(callback, *args, **kwargs)
except Exception as e:
logger.exception("Error calling callback %r" % callback)
for callback in self.callbacks['*']:
try:
wx.CallAfter(callback, type, *args, **kwargs)
except Exception as e:
logger.exception("Error calling callback %r" % callback)
示例13: cancel_speech
# 需要導入模塊: import wx [as 別名]
# 或者: from wx import CallAfter [as 別名]
def cancel_speech(self, **kwargs):
if self.is_muted:
return
wx.CallAfter(speech._manager.cancel)
示例14: speak
# 需要導入模塊: import wx [as 別名]
# 或者: from wx import CallAfter [as 別名]
def speak(
self,
sequence,
priority=speech.priorities.Spri.NORMAL,
**kwargs
):
if self.is_muted:
return
speech.beenCanceled = False
wx.CallAfter(speech._manager.speak, sequence, priority)
示例15: send_key
# 需要導入模塊: import wx [as 別名]
# 或者: from wx import CallAfter [as 別名]
def send_key(self, vk_code=None, extended=None, pressed=None, **kwargs):
wx.CallAfter(input.send_key, vk_code, None, extended, pressed)