本文整理汇总了Python中queueHandler.queueFunction函数的典型用法代码示例。如果您正苦于以下问题:Python queueFunction函数的具体用法?Python queueFunction怎么用?Python queueFunction使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了queueFunction函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __call__
def __call__(self): # calling this object with no arguments will work. This way we can use the class as the object to call.
queueHandler.queueFunction(queueHandler.eventQueue, tipDialog.create) #This should queue this to open in the future when NVDA is ready. Seems to prevent an issue with the dialog not appearing thince this gets called randomly.
lastUse = TipTimeManager(time.time())
config = tipConfig.conf
config["internal"]["lastUse"] = lastUse.toNormalizedTime()
config.save()
lastUse.alert(self) #register callBack again. If we die before the next day, that's fine, but we want to make sure the tip will pop up in one day if need be.
示例2: changeNotify
def changeNotify(cls, rootDocHandle, rootID):
try:
queueHandler.queueFunction(
queueHandler.eventQueue, cls.rootIdentifiers[rootDocHandle, rootID]._handleUpdate
)
except KeyError:
pass
示例3: nvdaControllerInternal_inputLangChangeNotify
def nvdaControllerInternal_inputLangChangeNotify(threadID,hkl,layoutString):
global lastInputLangChangeTime
import queueHandler
import ui
curTime=time.time()
if (curTime-lastInputLangChangeTime)<0.2:
return 0
lastInputLangChangeTime=curTime
#layoutString can sometimes be None, yet a registry entry still exists for a string representation of hkl
if not layoutString:
layoutString=hex(hkl)[2:].rstrip('L').upper().rjust(8,'0')
log.debugWarning("layoutString was None, generated new one from hkl as %s"%layoutString)
layoutName=_lookupKeyboardLayoutNameWithHexString(layoutString)
if not layoutName and hkl<0xd0000000:
#Try using the high word of hkl as the lang ID for a default layout for that language
simpleLayoutString=layoutString[0:4].rjust(8,'0')
log.debugWarning("trying simple version: %s"%simpleLayoutString)
layoutName=_lookupKeyboardLayoutNameWithHexString(simpleLayoutString)
if not layoutName:
#Try using the low word of hkl as the lang ID for a default layout for that language
simpleLayoutString=layoutString[4:].rjust(8,'0')
log.debugWarning("trying simple version: %s"%simpleLayoutString)
layoutName=_lookupKeyboardLayoutNameWithHexString(simpleLayoutString)
if not layoutName:
log.debugWarning("Could not find layout name for keyboard layout, reporting as unknown")
layoutName=_("unknown layout")
queueHandler.queueFunction(queueHandler.eventQueue,ui.message,_("layout %s")%layoutName)
return 0
示例4: _monitor
def _monitor(self):
try:
oldLines = self._getTextLines()
except:
log.exception("Error getting initial lines")
oldLines = []
while self._keepMonitoring:
self._event.wait()
if not self._keepMonitoring:
break
if self.STABILIZE_DELAY > 0:
# wait for the text to stabilise.
time.sleep(self.STABILIZE_DELAY)
if not self._keepMonitoring:
# Monitoring was stopped while waiting for the text to stabilise.
break
self._event.clear()
try:
newLines = self._getTextLines()
if config.conf["presentation"]["reportDynamicContentChanges"]:
outLines = self._calculateNewText(newLines, oldLines)
if len(outLines) == 1 and len(outLines[0]) == 1:
# This is only a single character,
# which probably means it is just a typed character,
# so ignore it.
del outLines[0]
for line in outLines:
queueHandler.queueFunction(queueHandler.eventQueue, self._reportNewText, line)
oldLines = newLines
except:
log.exception("Error getting lines or calculating new text")
示例5: updateSupportedSettings
def updateSupportedSettings(self,synth):
import ui
from scriptHandler import _isScriptRunning
#Save name of the current setting to restore ring position after reconstruction
prevName=self.settings[self._current].setting.name if self._current is not None and hasattr(self,'settings') else None
list = []
for s in synth.supportedSettings:
if not s.availableInSynthSettingsRing: continue
if prevName==s.name: #restore the last setting
self._current=len(list)
if isinstance(s,synthDriverHandler.NumericSynthSetting):
cls=SynthSetting
elif isinstance(s,synthDriverHandler.BooleanSynthSetting):
cls=BooleanSynthSetting
else:
cls=StringSynthSetting
list.append(cls(synth,s))
if len(list) == 0:
self._current = None
self.settings = None
else:
self.settings = list
if not prevName or not self.settings or len(self.settings)<=self._current or prevName!=self.settings[self._current].setting.name:
#Previous chosen setting doesn't exists. Set position to default
self._current = synth.initialSettingsRingSetting
if _isScriptRunning:
#User changed some setting from ring and that setting no more exists. We have just reverted to first setting, so report this change to user
queueHandler.queueFunction(queueHandler.eventQueue,ui.message,"%s %s" % (self.currentSettingName,self.currentSettingValue))
示例6: event_valueChange
def event_valueChange(self):
pbConf=config.conf["presentation"]["progressBarUpdates"]
states=self.states
if pbConf["progressBarOutputMode"]=="off" or controlTypes.STATE_INVISIBLE in states or controlTypes.STATE_OFFSCREEN in states:
return super(ProgressBar,self).event_valueChange()
val=self.value
try:
percentage = min(max(0.0, float(val.strip("%\0"))), 100.0)
except (AttributeError, ValueError):
log.debugWarning("Invalid value: %r" % val)
return super(ProgressBar, self).event_valueChange()
braille.handler.handleUpdate(self)
if not pbConf["reportBackgroundProgressBars"] and not self.isInForeground:
return
try:
left,top,width,height=self.location
except:
left=top=width=height=0
x=left+(width/2)
y=top+(height/2)
lastBeepProgressValue=self.progressValueCache.get("beep,%d,%d"%(x,y),None)
if pbConf["progressBarOutputMode"] in ("beep","both") and (lastBeepProgressValue is None or abs(percentage-lastBeepProgressValue)>=pbConf["beepPercentageInterval"]):
tones.beep(pbConf["beepMinHZ"]*2**(percentage/25.0),40)
self.progressValueCache["beep,%d,%d"%(x,y)]=percentage
lastSpeechProgressValue=self.progressValueCache.get("speech,%d,%d"%(x,y),None)
if pbConf["progressBarOutputMode"] in ("speak","both") and (lastSpeechProgressValue is None or abs(percentage-lastSpeechProgressValue)>=pbConf["speechPercentageInterval"]):
queueHandler.queueFunction(queueHandler.eventQueue,speech.speakMessage,_("%d percent")%percentage)
self.progressValueCache["speech,%d,%d"%(x,y)]=percentage
示例7: _metadataAnnouncerInternal
def _metadataAnnouncerInternal(status, startup=False):
import nvwave, queueHandler, speech
if not startup: speech.cancelSpeech()
queueHandler.queueFunction(queueHandler.eventQueue, ui.message, status)
nvwave.playWaveFile(os.path.join(os.path.dirname(__file__), "SPL_Metadata.wav"))
# #51 (18.03/15.14-LTS): close link to metadata announcer thread when finished.
global _earlyMetadataAnnouncer
_earlyMetadataAnnouncer = None
示例8: nvdaController_cancelSpeech
def nvdaController_cancelSpeech():
focus=api.getFocusObject()
if focus.sleepMode==focus.SLEEP_FULL:
return -1
import queueHandler
import speech
queueHandler.queueFunction(queueHandler.eventQueue,speech.cancelSpeech)
return 0
示例9: _insertCompletion
def _insertCompletion(self, original, completed):
self.completionAmbiguous = False
insert = completed[len(original):]
if not insert:
return
self.inputCtrl.SetValue(self.inputCtrl.GetValue() + insert)
queueHandler.queueFunction(queueHandler.eventQueue, speech.speakText, insert)
self.inputCtrl.SetInsertionPointEnd()
示例10: nvdaController_speakText
def nvdaController_speakText(text):
focus=api.getFocusObject()
if focus.sleepMode==focus.SLEEP_FULL:
return -1
import queueHandler
import speech
queueHandler.queueFunction(queueHandler.eventQueue,speech.speakText,text)
return 0
示例11: nvdaController_brailleMessage
def nvdaController_brailleMessage(text):
focus=api.getFocusObject()
if focus.sleepMode==focus.SLEEP_FULL:
return -1
import queueHandler
import braille
queueHandler.queueFunction(queueHandler.eventQueue,braille.handler.message,text)
return 0
示例12: nvdaControllerInternal_inputLangChangeNotify
def nvdaControllerInternal_inputLangChangeNotify(threadID,hkl,layoutString):
global lastInputMethodName, lastInputLanguageName
focus=api.getFocusObject()
#This callback can be called before NVDa is fully initialized
#So also handle focus object being None as well as checking for sleepMode
if not focus or focus.sleepMode:
return 0
import NVDAObjects.window
#Generally we should not allow input lang changes from threads that are not focused.
#But threadIDs for console windows are always wrong so don't ignore for those.
if not isinstance(focus,NVDAObjects.window.Window) or (threadID!=focus.windowThreadID and focus.windowClassName!="ConsoleWindowClass"):
return 0
import sayAllHandler
#Never announce changes while in sayAll (#1676)
if sayAllHandler.isRunning():
return 0
import queueHandler
import ui
languageID=hkl&0xffff
buf=create_unicode_buffer(1024)
res=windll.kernel32.GetLocaleInfoW(languageID,2,buf,1024)
# Translators: the label for an unknown language when switching input methods.
inputLanguageName=buf.value if res else _("unknown language")
layoutStringCodes=[]
inputMethodName=None
#layoutString can either be a real input method name, a hex string for an input method name in the registry, or an empty string.
#If its a real input method name its used as is.
#If its a hex string or its empty, then the method name is looked up by trying:
#The full hex string, the hkl as a hex string, the low word of the hex string or hkl, the high word of the hex string or hkl.
if layoutString:
try:
int(layoutString,16)
layoutStringCodes.append(layoutString)
except ValueError:
inputMethodName=layoutString
if not inputMethodName:
layoutStringCodes.insert(0,hex(hkl)[2:].rstrip('L').upper().rjust(8,'0'))
for stringCode in list(layoutStringCodes):
layoutStringCodes.append(stringCode[4:].rjust(8,'0'))
if stringCode[0]<'D':
layoutStringCodes.append(stringCode[0:4].rjust(8,'0'))
for stringCode in layoutStringCodes:
inputMethodName=_lookupKeyboardLayoutNameWithHexString(stringCode)
if inputMethodName: break
if not inputMethodName:
log.debugWarning("Could not find layout name for keyboard layout, reporting as unknown")
# Translators: The label for an unknown input method when switching input methods.
inputMethodName=_("unknown input method")
if ' - ' in inputMethodName:
inputMethodName="".join(inputMethodName.split(' - ')[1:])
if inputLanguageName!=lastInputLanguageName:
lastInputLanguageName=inputLanguageName
# Translators: the message announcing the language and keyboard layout when it changes
inputMethodName=_("{language} - {layout}").format(language=inputLanguageName,layout=inputMethodName)
if inputMethodName!=lastInputMethodName:
lastInputMethodName=inputMethodName
queueHandler.queueFunction(queueHandler.eventQueue,ui.message,inputMethodName)
return 0
示例13: onOk
def onOk(self, evt):
action=self.actionsList.GetSelection()
if action == 0:
wx.GetApp().ExitMainLoop()
elif action == 1:
queueHandler.queueFunction(queueHandler.eventQueue,core.restart)
elif action == 2:
queueHandler.queueFunction(queueHandler.eventQueue,core.restart,True)
self.Destroy()
示例14: onSaveConfigurationCommand
def onSaveConfigurationCommand(self,evt):
if globalVars.appArgs.secure:
queueHandler.queueFunction(queueHandler.eventQueue,ui.message,_("Cannot save configuration - NVDA in secure mode"))
return
try:
config.save()
queueHandler.queueFunction(queueHandler.eventQueue,ui.message,_("Configuration saved"))
except:
messageBox(_("Could not save configuration - probably read only file system"),_("Error"),wx.OK | wx.ICON_ERROR)
示例15: _loadBuffer
def _loadBuffer(self):
try:
self.VBufHandle=NVDAHelper.localLib.VBuf_createBuffer(self.rootNVDAObject.appModule.helperLocalBindingHandle,self.rootDocHandle,self.rootID,unicode(self.backendName))
if not self.VBufHandle:
raise RuntimeError("Could not remotely create virtualBuffer")
except:
log.error("", exc_info=True)
queueHandler.queueFunction(queueHandler.eventQueue, self._loadBufferDone, success=False)
return
queueHandler.queueFunction(queueHandler.eventQueue, self._loadBufferDone)