本文整理汇总了Python中winUser.getGUIThreadInfo函数的典型用法代码示例。如果您正苦于以下问题:Python getGUIThreadInfo函数的具体用法?Python getGUIThreadInfo怎么用?Python getGUIThreadInfo使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getGUIThreadInfo函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _get_shouldAllowIAccessibleFocusEvent
def _get_shouldAllowIAccessibleFocusEvent(self):
focusWindow = winUser.getGUIThreadInfo(self.windowThreadID).hwndFocus
if self.windowHandle != focusWindow:
# This window doesn't have the focus, which means the embedded object's window probably already has the focus.
# We don't want to override the focus event fired by the embedded object.
return False
return super(EmbeddedObject, self).shouldAllowIAccessibleFocusEvent
示例2: _getCaretOffset
def _getCaretOffset(self):
caretRect = winUser.getGUIThreadInfo(self.obj.windowThreadID).rcCaret
objLocation = self.obj.location
objRect = RECT(objLocation[0], objLocation[1], objLocation[0] + objLocation[2], objLocation[1] + objLocation[3])
tempPoint = winUser.POINT()
tempPoint.x = caretRect.left
tempPoint.y = caretRect.top
winUser.user32.ClientToScreen(self.obj.windowHandle, byref(tempPoint))
caretRect.left = max(objRect.left, tempPoint.x)
caretRect.top = max(objRect.top, tempPoint.y)
tempPoint.x = caretRect.right
tempPoint.y = caretRect.bottom
winUser.user32.ClientToScreen(self.obj.windowHandle, byref(tempPoint))
caretRect.right = min(objRect.right, tempPoint.x)
caretRect.bottom = min(objRect.bottom, tempPoint.y)
for charOffset, (charLeft, charTop, charRight, charBottom, charBaseline) in enumerate(self._textAndRects[1]):
# Real text with a character baseline
# The caret must be anywhere before the horizontal center of the character and the bottom of the caret must touch or go through the character baseline
if (
charBaseline >= 0
and caretRect.left < ((charLeft + charRight) / 2)
and caretRect.top < charBaseline <= caretRect.bottom
):
return charOffset
for charOffset, (charLeft, charTop, charRight, charBottom, charBaseline) in enumerate(self._textAndRects[1]):
# vertical whitespace (possible blank lines)
# The caret must be fully contained in the whitespace to match
if (
charBaseline == -1
and caretRect.left >= charLeft
and caretRect.right <= charRight
and not (caretRect.bottom <= charTop or charBottom <= caretRect.top)
):
return charOffset
raise RuntimeError
示例3: event_NVDAObject_init
def event_NVDAObject_init(self,obj):
if controlTypes.STATE_FOCUSED in obj.states:
obj.windowHandle=winUser.getGUIThreadInfo(None).hwndFocus
obj.windowClassName=winUser.getClassName(obj.windowHandle)
if obj.value and obj.windowClassName in ["TMainUserList", "TConversationList", "TInboxList", "TActiveConversationList", "TConversationsControl"] and not obj.role in [controlTypes.ROLE_MENUBAR, controlTypes.ROLE_MENUITEM, controlTypes.ROLE_POPUPMENU]:
obj.name=obj.value
obj.value=None
示例4: _get_SDMChild
def _get_SDMChild(self):
if controlTypes.STATE_FOCUSED in self.states:
hwndFocus=winUser.getGUIThreadInfo(0).hwndFocus
if hwndFocus and hwndFocus!=self.windowHandle and not winUser.getClassName(hwndFocus).startswith('bosa_sdm'):
obj=getNVDAObjectFromEvent(hwndFocus,winUser.OBJID_CLIENT,0)
if not obj: return None
if getattr(obj,'parentSDMCanOverrideName',True):
obj.name=self.name
return obj
return None
示例5: WindowSelectionChange
def WindowSelectionChange(self,sel):
i=winUser.getGUIThreadInfo(0)
oldFocus=api.getFocusObject()
if not isinstance(oldFocus,Window) or i.hwndFocus!=oldFocus.windowHandle:
return
if isinstance(oldFocus,DocumentWindow):
documentWindow=oldFocus
elif isinstance(oldFocus,PpObject):
documentWindow=oldFocus.documentWindow
else:
return
documentWindow.ppSelection=sel
documentWindow.handleSelectionChange()
示例6: shouldConfigProfileTriggersBeSuspended
def shouldConfigProfileTriggersBeSuspended():
"""Determine whether configuration profile triggers should be suspended in relation to NVDA's GUI.
For NVDA configuration dialogs, the configuration should remain the same as it was before the GUI was popped up
so the user can change settings in the correct profile.
Top-level windows that require this behavior should have a C{shouldSuspendConfigProfileTriggers} attribute set to C{True}.
Because these dialogs are often opened via the NVDA menu, this applies to the NVDA menu as well.
"""
if winUser.getGUIThreadInfo(ctypes.windll.kernel32.GetCurrentThreadId()).flags & 0x00000010:
# The NVDA menu is active.
return True
for window in wx.GetTopLevelWindows():
if window.IsShown() and getattr(window, "shouldSuspendConfigProfileTriggers", False):
return True
return False
示例7: event_NVDAObject_init
def event_NVDAObject_init(self,obj):
if isinstance(obj, NVDAObjects.IAccessible.IAccessible) and obj.event_objectID is None and controlTypes.STATE_FOCUSED in obj.states and obj.role not in (controlTypes.ROLE_POPUPMENU,controlTypes.ROLE_MENUITEM,controlTypes.ROLE_MENUBAR):
# The window handle reported by Skype accessibles is sometimes incorrect.
# This object is focused, so we can override with the focus window.
obj.windowHandle=winUser.getGUIThreadInfo(None).hwndFocus
obj.windowClassName=winUser.getClassName(obj.windowHandle)
if obj.value and obj.windowClassName in ("TMainUserList", "TConversationList", "TInboxList", "TActiveConversationList", "TConversationsControl"):
# The name and value both include the user's name, so kill the value to avoid doubling up.
# The value includes the Skype name,
# but we care more about the additional info (e.g. new event count) included in the name.
obj.value=None
elif isinstance(obj, NVDAObjects.IAccessible.IAccessible) and obj.IAccessibleRole == oleacc.ROLE_SYSTEM_PANE and not obj.name:
# Prevent extraneous reporting of pane when tabbing through a conversation form.
obj.shouldAllowIAccessibleFocusEvent = False
示例8: kwargsFromSuper
def kwargsFromSuper(cls,kwargs,relation=None):
windowHandle=None
if relation in ('focus','foreground'):
windowHandle=winUser.getForegroundWindow()
if not windowHandle: windowHandle=winUser.getDesktopWindow()
if windowHandle and relation=="focus":
threadID=winUser.getWindowThreadProcessID(windowHandle)[1]
threadInfo=winUser.getGUIThreadInfo(threadID)
if threadInfo.hwndFocus: windowHandle=threadInfo.hwndFocus
elif isinstance(relation,tuple):
windowHandle=_windowFromPoint(ctypes.wintypes.POINT(relation[0],relation[1]))
if not windowHandle:
return False
kwargs['windowHandle']=windowHandle
return True
示例9: _shouldRecoverAfterMinTimeout
def _shouldRecoverAfterMinTimeout():
info=winUser.getGUIThreadInfo(0)
#If hwndFocus is 0, then the OS is clearly busy and we don't want to timeout prematurely.
if not info.hwndFocus: return False
# Import late to avoid circular import.
import api
#If a system menu has been activated but NVDA's focus is not yet in the menu then use min timeout
if info.flags&winUser.GUI_SYSTEMMENUMODE and info.hwndMenuOwner and api.getFocusObject().windowClassName!='#32768':
return True
if winUser.getClassName(info.hwndFocus) in safeWindowClassSet:
return False
if not winUser.isDescendantWindow(info.hwndActive, api.getFocusObject().windowHandle):
# The foreground window has changed.
return True
newHwnd=info.hwndFocus
newThreadID=winUser.getWindowThreadProcessID(newHwnd)[1]
return newThreadID!=api.getFocusObject().windowThreadID
示例10: _shouldRecoverAfterMinTimeout
def _shouldRecoverAfterMinTimeout():
info=winUser.getGUIThreadInfo(0)
if not info.hwndFocus:
# The foreground thread is frozen or there is no foreground thread (probably due to a freeze elsewhere).
return True
# Import late to avoid circular import.
import api
#If a system menu has been activated but NVDA's focus is not yet in the menu then use min timeout
if info.flags&winUser.GUI_SYSTEMMENUMODE and info.hwndMenuOwner and api.getFocusObject().windowClassName!='#32768':
return True
if winUser.getClassName(info.hwndFocus) in safeWindowClassSet:
return False
if not winUser.isDescendantWindow(info.hwndActive, api.getFocusObject().windowHandle):
# The foreground window has changed.
return True
newHwnd=info.hwndFocus
newThreadID=winUser.getWindowThreadProcessID(newHwnd)[1]
return newThreadID!=api.getFocusObject().windowThreadID
示例11: _getCaretOffset
def _getCaretOffset(self):
caretRect = winUser.getGUIThreadInfo(self.obj.windowThreadID).rcCaret
objLocation=self.obj.location
objRect=RECT(objLocation[0],objLocation[1],objLocation[0]+objLocation[2],objLocation[1]+objLocation[3])
tempPoint = winUser.POINT()
tempPoint.x=caretRect.left
tempPoint.y=caretRect.top
winUser.user32.ClientToScreen(self.obj.windowHandle, byref(tempPoint))
caretRect.left=max(objRect.left,tempPoint.x)
caretRect.top=max(objRect.top,tempPoint.y)
tempPoint.x=caretRect.right
tempPoint.y=caretRect.bottom
winUser.user32.ClientToScreen(self.obj.windowHandle, byref(tempPoint))
caretRect.right=min(objRect.right,tempPoint.x)
caretRect.bottom=min(objRect.bottom,tempPoint.y)
import speech
for charOffset, (charLeft, charTop, charRight, charBottom) in enumerate(self._textAndRects[1]):
#speech.speakMessage("caret %d,%d char %d,%d"%(caretRect.top,caretRect.bottom,charTop,charBottom))
if caretRect.left>=charLeft and caretRect.right<=charRight and ((caretRect.top<=charTop and caretRect.bottom>=charBottom) or (caretRect.top>=charTop and caretRect.bottom<=charBottom)):
return charOffset
raise RuntimeError
示例12: findOverlayClasses
def findOverlayClasses(self,clsList):
windowClassName=self.normalizeWindowClassName(self.windowClassName)
newCls=None
if windowClassName=="#32769":
newCls=Desktop
elif windowClassName=="Edit":
from .edit import Edit as newCls
elif windowClassName=="RichEdit":
from .edit import RichEdit as newCls
elif windowClassName in ("RichEdit20","REComboBox20W"):
from .edit import RichEdit20 as newCls
elif windowClassName=="RICHEDIT50W":
from .edit import RichEdit50 as newCls
elif windowClassName in ("Scintilla","TScintilla"):
from .scintilla import Scintilla as newCls
elif windowClassName in ("AkelEditW", "AkelEditA"):
from .akelEdit import AkelEdit as newCls
elif windowClassName=="ConsoleWindowClass":
from .winConsole import WinConsole as newCls
elif windowClassName=="EXCEL7":
from .excel import Excel7Window as newCls
if newCls:
clsList.append(newCls)
# If none of the chosen classes seem to support text editing
# but there is a caret currently in the window,
# check whether this window exposes its content without using the display model.
# If not, use the displayModelEditableText class to emulate text editing capabilities
if not any(issubclass(cls,EditableText) for cls in clsList):
gi=winUser.getGUIThreadInfo(self.windowThreadID)
if gi.hwndCaret==self.windowHandle and gi.flags&winUser.GUI_CARETBLINKING:
if self.windowTextLineCount:
from .edit import UnidentifiedEdit
clsList.append(UnidentifiedEdit)
else:
clsList.append(DisplayModelEditableText)
clsList.append(Window)
super(Window,self).findOverlayClasses(clsList)
示例13: findOverlayClasses
def findOverlayClasses(self,clsList):
windowClassName=self.normalizeWindowClassName(self.windowClassName)
newCls=None
if windowClassName=="#32769":
newCls=Desktop
elif windowClassName=="Edit":
from .edit import Edit as newCls
elif windowClassName=="RichEdit":
from .edit import RichEdit as newCls
elif windowClassName in ("RichEdit20","REComboBox20W"):
from .edit import RichEdit20 as newCls
elif windowClassName=="RICHEDIT50W":
from .edit import RichEdit50 as newCls
elif windowClassName in ("Scintilla","TScintilla"):
from .scintilla import Scintilla as newCls
elif windowClassName in ("AkelEditW", "AkelEditA"):
from .akelEdit import AkelEdit as newCls
elif windowClassName=="ConsoleWindowClass":
from .winConsole import WinConsole as newCls
elif windowClassName=="_WwG":
from .winword import WordDocument as newCls
elif windowClassName in ("_WwN","_WwO"):
from .winword import WordDocument_WwN as newCls
elif windowClassName=="EXCEL7":
from .excel import Excel7Window as newCls
if newCls:
clsList.append(newCls)
#If none of the chosen classes seem to support text editing
#But there is a caret currently in the window
#Then use the displayModelEditableText class to emulate text editing capabilities
if not any(issubclass(cls,EditableText) for cls in clsList):
gi=winUser.getGUIThreadInfo(self.windowThreadID)
if gi.hwndCaret==self.windowHandle and gi.flags&winUser.GUI_CARETBLINKING:
clsList.append(DisplayModelEditableText)
clsList.append(Window)
super(Window,self).findOverlayClasses(clsList)
示例14: _get_shouldAllowIAccessibleFocusEvent
def _get_shouldAllowIAccessibleFocusEvent(self):
# The window must really have focus.
# Outlook can sometimes fire invalid focus events when showing daily tasks within the calendar.
if winUser.getGUIThreadInfo(self.windowThreadID).hwndFocus!=self.windowHandle:
return False
return super(SuperGridClient2010,self).shouldAllowIAccessibleFocusEvent
示例15: SlideShowNextSlide
def SlideShowNextSlide(self,slideShowWindow=None):
i=winUser.getGUIThreadInfo(0)
oldFocus=api.getFocusObject()
if not isinstance(oldFocus,SlideShowWindow) or i.hwndFocus!=oldFocus.windowHandle:
return
oldFocus.treeInterceptor.rootNVDAObject.handleSlideChange()