def getForegroundObject(): hdMain = ctypes.windll.user32.GetForegroundWindow() if not getString( vlc_strings.ID_VLCAppTitle) in winUser.getWindowText(hdMain): hdMain = winUser.getWindow(winUser.getWindow(hdMain, 2), 2) o = getNVDAObjectFromEvent(hdMain, -4, 0) return o
def isRealWindow(hWnd): name = winUser.getWindowText(hWnd) visible = winUser.isWindowVisible(hWnd) lExStyle = getExtendedWindowStyle(hWnd) isToolWindow = (lExStyle & WS_EX_TOOLWINDOW) == 0 isAppWindow = (lExStyle & WS_EX_APPWINDOW) == 0 hasOwner = winUser.getWindow(hWnd, winUser.GW_OWNER) if not winUser.isWindowVisible(hWnd): return False if getParent(hWnd): return False if (isToolWindow and not hasOwner) or ( (isAppWindow and hasOwner)): if winUser.getWindowText(hWnd): return True return False
def maximizeWindow(hWnd): windowStyle = winUser.getWindowStyle(hWnd) maximized = windowStyle & WS_MAXIMIZE if not maximized and windowStyle & WS_MAXIMIZEBOX: try: winUser.PostMessage(hWnd, WM_SYSCOMMAND, SC_MAXIMIZE, 0) log.warning("Window maximized: %s" % winUser.getWindowText(hWnd)) except: # noqa:E722 pass
def callback(hWnd, windows): # we exclude non real windows if not isRealWindow(hWnd): return True title = winUser.getWindowText(hWnd) placement = getWindowPlacement(hwnd) if not placement or title in _windowsToIgnore.split("|"): return True windows.append((title, hWnd)) return True
def chooseNVDAObjectOverlayClasses(self, obj, clsList): # Note: chooseNVDAObjectOverlayClasses needs to be explicitely called in the mother class; else, NVDA will skip it. for cls in clsList: if issubclass(cls, editableText.EditableText): isEditable = True break else: isEditable = False if isEditable: isLogViewer = False hParent = winUser.getAncestor(obj.windowHandle, winUser.GA_PARENT) if hParent: text = winUser.getWindowText(hParent) isLogViewer = text == nvdaTranslations("NVDA Log Viewer") if isLogViewer: clsList.insert(0, LogViewerLogContainer) else: clsList.insert(0, EditableTextLogContainer) if obj.role == controlTypes.Role.DOCUMENT: clsList.insert(0, DocumentWithLog)
def _get_name(self): return winUser.getWindowText(self.windowHandle)
def windowText(self): return winUser.getWindowText(self.handle)
def event_NVDAObject_init(self,obj): if obj.windowClassName=="Button" and not obj.role in [controlTypes.ROLE_MENUBAR, controlTypes.ROLE_MENUITEM, controlTypes.ROLE_POPUPMENU]: obj.name=winUser.getWindowText(obj.windowHandle).replace('&','')
def event_NVDAObject_init(self, obj): if obj.windowClassName == "Button" and not obj.role in [ controlTypes.ROLE_MENUBAR, controlTypes.ROLE_MENUITEM, controlTypes.ROLE_POPUPMENU ]: obj.name = winUser.getWindowText(obj.windowHandle).replace('&', '')