本文整理汇总了Python中JABHandler类的典型用法代码示例。如果您正苦于以下问题:Python JABHandler类的具体用法?Python JABHandler怎么用?Python JABHandler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了JABHandler类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Notify
def Notify(self):
try:
JABHandler.pumpAll()
IAccessibleHandler.pumpAll()
queueHandler.pumpAll()
mouseHandler.pumpAll()
except:
log.exception("errors in this core pump cycle")
baseObject.AutoPropertyObject.invalidateCaches()
watchdog.alive()
示例2: processPendingEvents
def processPendingEvents(processEventQueue=True):
# Import late to avoid circular import.
import IAccessibleHandler
import JABHandler
import wx
import queueHandler
watchdog.alive()
wx.Yield()
JABHandler.pumpAll()
IAccessibleHandler.pumpAll()
import baseObject
baseObject.AutoPropertyObject.invalidateCaches()
if processEventQueue:
queueHandler.flushQueue(queueHandler.eventQueue)
示例3: getPossibleAPIClasses
def getPossibleAPIClasses(cls,kwargs,relation=None):
windowHandle=kwargs['windowHandle']
windowClassName=winUser.getClassName(windowHandle)
#The desktop window should stay as a window
if windowClassName=="#32769":
return
#If this window has a ghost window its too dangerous to try any higher APIs
if GhostWindowFromHungWindow and GhostWindowFromHungWindow(windowHandle):
return
if windowClassName=="EXCEL7" and (relation=='focus' or isinstance(relation,tuple)):
from . import excel
yield excel.ExcelCell
if windowClassName=="EXCEL:":
from .excel import ExcelDropdown as newCls
yield newCls
import JABHandler
if JABHandler.isJavaWindow(windowHandle):
import NVDAObjects.JAB
yield NVDAObjects.JAB.JAB
import UIAHandler
if UIAHandler.handler and UIAHandler.handler.isUIAWindow(windowHandle):
import NVDAObjects.UIA
yield NVDAObjects.UIA.UIA
import NVDAObjects.IAccessible
yield NVDAObjects.IAccessible.IAccessible
示例4: processFocusWinEvent
def processFocusWinEvent(window,objectID,childID,force=False):
"""checks to see if the focus win event is not the same as the existing focus,
then converts the win event to an NVDA event (instanciating an NVDA Object) then calls processFocusNVDAEvent. If all is ok it returns True.
@type window: integer
@param objectID: a win event's object ID
@type objectID: integer
@param childID: a win event's child ID
@type childID: integer
@param force: If True, the shouldAllowIAccessibleFocusEvent property of the object is ignored.
@type force: boolean
@returns: True if the focus is valid and was handled, False otherwise.
@rtype: boolean
"""
windowClassName=winUser.getClassName(window)
# Generally, we must ignore focus on child windows of SDM windows as we only want the SDM MSAA events.
# However, we don't want to ignore focus if the child ID isn't 0,
# as this is a child control and the SDM MSAA events don't handle child controls.
if childID==0 and not windowClassName.startswith('bosa_sdm') and winUser.getClassName(winUser.getAncestor(window,winUser.GA_PARENT)).startswith('bosa_sdm'):
return False
rootWindow=winUser.getAncestor(window,winUser.GA_ROOT)
# If this window is not within the foreground window and this window or its root window is not a popup window, and this window's root window is not the highest in the z-order
if not winUser.isDescendantWindow(winUser.getForegroundWindow(),window) and not (winUser.getWindowStyle(window) & winUser.WS_POPUP or winUser.getWindowStyle(rootWindow)&winUser.WS_POPUP) and winUser.getPreviousWindow(rootWindow)!=0:
# This is a focus event from a background window, so ignore it.
return False
#Notify appModuleHandler of this new foreground window
appModuleHandler.update(winUser.getWindowThreadProcessID(window)[0])
#If Java access bridge is running, and this is a java window, then pass it to java and forget about it
if JABHandler.isRunning and JABHandler.isJavaWindow(window):
JABHandler.event_enterJavaWindow(window)
return True
#Convert the win event to an NVDA event
NVDAEvent=winEventToNVDAEvent(winUser.EVENT_OBJECT_FOCUS,window,objectID,childID,useCache=False)
if not NVDAEvent:
return False
eventName,obj=NVDAEvent
if (childID==0 and obj.IAccessibleRole==oleacc.ROLE_SYSTEM_LIST) or (objectID==winUser.OBJID_CLIENT and "SysListView32" in obj.windowClassName):
# Some controls incorrectly fire focus on child ID 0, even when there is a child with focus.
try:
realChildID=obj.IAccessibleObject.accFocus
except:
realChildID=None
if isinstance(realChildID,int) and realChildID>0 and realChildID!=childID:
realObj=NVDAObjects.IAccessible.IAccessible(IAccessibleObject=obj.IAccessibleObject,IAccessibleChildID=realChildID,event_windowHandle=window,event_objectID=objectID,event_childID=realChildID)
if realObj:
obj=realObj
return processFocusNVDAEvent(obj,force=force)
示例5: doAction
def doAction(self, index=None):
if index is None:
index = self.defaultActionIndex
try:
JABHandler.bridgeDll.doAccessibleActions(self.jabContext.vmID, self.jabContext.accContext,
JABHandler.AccessibleActionsToDo(actionsCount=1, actions=(self._actions[index],)),
JABHandler.jint())
except (IndexError, RuntimeError):
raise NotImplementedError
示例6: run
def run(self):
global _isPumpPending
_isPumpPending = False
watchdog.alive()
try:
if touchHandler.handler:
touchHandler.handler.pump()
JABHandler.pumpAll()
IAccessibleHandler.pumpAll()
queueHandler.pumpAll()
mouseHandler.pumpAll()
braille.pumpAll()
except:
log.exception("errors in this core pump cycle")
baseObject.AutoPropertyObject.invalidateCaches()
watchdog.asleep()
if _isPumpPending and not _pump.IsRunning():
# #3803: Another pump was requested during this pump execution.
# As our pump is not re-entrant, schedule another pump.
_pump.Start(PUMP_MAX_DELAY, True)
示例7: processForegroundWinEvent
def processForegroundWinEvent(window,objectID,childID):
"""checks to see if the foreground win event is not the same as the existing focus or any of its parents,
then converts the win event to an NVDA event (instanciating an NVDA Object) and then checks the NVDAObject against the existing focus object.
If all is ok it queues the foreground event to NVDA and returns True.
@param window: a win event's window handle
@type window: integer
@param objectID: a win event's object ID
@type objectID: integer
@param childID: a win event's child ID
@type childID: integer
@returns: True if the foreground was processed, False otherwise.
@rtype: boolean
"""
#Ignore foreground events on windows that aren't the current foreground window
if window!=winUser.getForegroundWindow():
return False
# If there is a pending gainFocus, it will handle the foreground object.
oldFocus=eventHandler.lastQueuedFocusObject
#If this foreground win event's window is an ancestor of the existing focus's window, then ignore it
if isinstance(oldFocus,NVDAObjects.window.Window) and winUser.isDescendantWindow(window,oldFocus.windowHandle):
return False
#If the existing focus has the same win event params as these, then ignore this event
if isinstance(oldFocus,NVDAObjects.IAccessible.IAccessible) and window==oldFocus.event_windowHandle and objectID==oldFocus.event_objectID and childID==oldFocus.event_childID:
return False
#Notify appModuleHandler of this new foreground window
appModuleHandler.update(winUser.getWindowThreadProcessID(window)[0])
#If Java access bridge is running, and this is a java window, then pass it to java and forget about it
if JABHandler.isRunning and JABHandler.isJavaWindow(window):
JABHandler.event_enterJavaWindow(window)
return True
#Convert the win event to an NVDA event
NVDAEvent=winEventToNVDAEvent(winUser.EVENT_SYSTEM_FOREGROUND,window,objectID,childID,useCache=False)
if not NVDAEvent:
return False
eventHandler.queueEvent(*NVDAEvent)
return True
示例8: getPossibleAPIClasses
def getPossibleAPIClasses(cls,kwargs,relation=None):
windowHandle=kwargs['windowHandle']
windowClassName=winUser.getClassName(windowHandle)
#The desktop window should stay as a window
if windowClassName=="#32769":
return
if windowClassName=="EXCEL7" and (relation=='focus' or isinstance(relation,tuple)):
from . import excel
yield excel.ExcelCell
import JABHandler
if JABHandler.isJavaWindow(windowHandle):
import NVDAObjects.JAB
yield NVDAObjects.JAB.JAB
import UIAHandler
if UIAHandler.handler and UIAHandler.handler.isUIAWindow(windowHandle):
import NVDAObjects.UIA
yield NVDAObjects.UIA.UIA
import NVDAObjects.IAccessible
yield NVDAObjects.IAccessible.IAccessible
示例9: main
#.........这里部分代码省略.........
ui.message(_("Not charging battery. %d percent") %sps.BatteryLifePercent)
messageWindow = MessageWindow(unicode(versionInfo.name))
# initialize wxpython localization support
locale = wx.Locale()
lang=languageHandler.getLanguage()
wxLang=locale.FindLanguageInfo(lang)
if not wxLang and '_' in lang:
wxLang=locale.FindLanguageInfo(lang.split('_')[0])
if hasattr(sys,'frozen'):
locale.AddCatalogLookupPathPrefix(os.path.join(os.getcwdu(),"locale"))
# #8064: Wx might know the language, but may not actually contain a translation database for that language.
# If we try to initialize this language, wx will show a warning dialog.
# Therefore treat this situation like wx not knowing the language at all.
if not locale.IsAvailable(wxLang.Language):
wxLang=None
if wxLang:
try:
locale.Init(wxLang.Language)
except:
log.error("Failed to initialize wx locale",exc_info=True)
else:
log.debugWarning("wx does not support language %s" % lang)
import api
import winUser
import NVDAObjects.window
desktopObject=NVDAObjects.window.Window(windowHandle=winUser.getDesktopWindow())
api.setDesktopObject(desktopObject)
api.setFocusObject(desktopObject)
api.setNavigatorObject(desktopObject)
api.setMouseObject(desktopObject)
import JABHandler
log.debug("initializing Java Access Bridge support")
try:
JABHandler.initialize()
except NotImplementedError:
log.warning("Java Access Bridge not available")
except:
log.error("Error initializing Java Access Bridge support", exc_info=True)
import winConsoleHandler
log.debug("Initializing winConsole support")
winConsoleHandler.initialize()
import UIAHandler
log.debug("Initializing UIA support")
try:
UIAHandler.initialize()
except NotImplementedError:
log.warning("UIA not available")
except:
log.error("Error initializing UIA support", exc_info=True)
import IAccessibleHandler
log.debug("Initializing IAccessible support")
IAccessibleHandler.initialize()
log.debug("Initializing input core")
import inputCore
inputCore.initialize()
import keyboardHandler
log.debug("Initializing keyboard handler")
keyboardHandler.initialize()
import mouseHandler
log.debug("initializing mouse handler")
mouseHandler.initialize()
import touchHandler
log.debug("Initializing touchHandler")
示例10: main
#.........这里部分代码省略.........
import braille
log.debug("Initializing braille")
braille.initialize()
log.debug("Initializing braille input")
import brailleInput
brailleInput.initialize()
import displayModel
log.debug("Initializing displayModel")
displayModel.initialize()
log.debug("Initializing GUI")
import gui
gui.initialize()
# initialize wxpython localization support
locale = wx.Locale()
lang=languageHandler.getLanguage()
if '_' in lang:
wxLang=lang.split('_')[0]
else:
wxLang=lang
if hasattr(sys,'frozen'):
locale.AddCatalogLookupPathPrefix(os.path.join(os.getcwdu(),"locale"))
try:
locale.Init(lang,wxLang)
except:
pass
import api
import winUser
import NVDAObjects.window
desktopObject=NVDAObjects.window.Window(windowHandle=winUser.getDesktopWindow())
api.setDesktopObject(desktopObject)
api.setFocusObject(desktopObject)
api.setNavigatorObject(desktopObject)
api.setMouseObject(desktopObject)
import JABHandler
log.debug("initializing Java Access Bridge support")
try:
JABHandler.initialize()
except NotImplementedError:
log.warning("Java Access Bridge not available")
except:
log.error("Error initializing Java Access Bridge support", exc_info=True)
import winConsoleHandler
log.debug("Initializing winConsole support")
winConsoleHandler.initialize()
import UIAHandler
log.debug("Initializing UIA support")
try:
UIAHandler.initialize()
except NotImplementedError:
log.warning("UIA not available")
except:
log.error("Error initializing UIA support", exc_info=True)
import IAccessibleHandler
log.debug("Initializing IAccessible support")
IAccessibleHandler.initialize()
log.debug("Initializing input core")
import inputCore
inputCore.initialize()
import keyboardHandler
log.debug("Initializing keyboard handler")
keyboardHandler.initialize()
import mouseHandler
log.debug("initializing mouse handler")
mouseHandler.initialize()
import touchHandler
log.debug("Initializing touchHandler")