def connectConsole(obj):
    global consoleObject, consoleOutputHandle, checkDeadTimer
    #Get the process ID of the console this NVDAObject is fore
    processID, threadID = winUser.getWindowThreadProcessID(obj.windowHandle)
    #Attach NVDA to this console so we can access its text etc
    try:
        wincon.AttachConsole(processID)
    except WindowsError as e:
        log.debugWarning("Could not attach console: %r" % e)
        return False
    wincon.SetConsoleCtrlHandler(_consoleCtrlHandler, True)
    consoleOutputHandle = winKernel.CreateFile(
        u"CONOUT$", winKernel.GENERIC_READ | winKernel.GENERIC_WRITE,
        winKernel.FILE_SHARE_READ | winKernel.FILE_SHARE_WRITE, None,
        winKernel.OPEN_EXISTING, 0, None)
    #Register this callback with all the win events we need, storing the given handles for removal later
    for eventID in (winUser.EVENT_CONSOLE_CARET,
                    winUser.EVENT_CONSOLE_UPDATE_REGION,
                    winUser.EVENT_CONSOLE_UPDATE_SIMPLE,
                    winUser.EVENT_CONSOLE_UPDATE_SCROLL,
                    winUser.EVENT_CONSOLE_LAYOUT):
        handle = winUser.setWinEventHook(eventID, eventID, 0,
                                         consoleWinEventHook, 0, 0, 0)
        if not handle:
            raise OSError("could not register eventID %s" % eventID)
        consoleWinEventHookHandles.append(handle)
    consoleObject = obj
    checkDeadTimer = gui.NonReEntrantTimer(_checkDead)
    checkDeadTimer.Start(CHECK_DEAD_INTERVAL)
    return True
Esempio n. 2
0
 def __init__(self):
     self.pendingEmitsTimer = gui.NonReEntrantTimer(core.requestPump)
     super(TouchHandler, self).__init__()
     self._curTouchMode = 'object'
     self.initializedEvent = threading.Event()
     self.threadExc = None
     self.start()
     self.initializedEvent.wait()
     if self.threadExc:
         raise self.threadExc
Esempio n. 3
0
	def __init__(self):
		self.pendingEmitsTimer=gui.NonReEntrantTimer(core.requestPump)
		super().__init__(name=f"{self.__class__.__module__}.{self.__class__.__qualname__}")
		self._curTouchMode='object'
		self.initializedEvent=threading.Event()
		self.threadExc=None
		self.start()
		self.initializedEvent.wait()
		if self.threadExc:
			raise self.threadExc
Esempio n. 4
0
	def __init__(self):
		self._checkTimer = gui.NonReEntrantTimer(self.check)
		if config.conf["update"]["startupNotification"] and isPendingUpdate():
			secsTillNext = 0 # Display the update message instantly
		else:
			# Set the initial check based on the last check time.
			# #3260: If the system time is earlier than the last check,
			# treat the last check as being right now (so the next will be tomorrow).
			secsSinceLast = max(time.time() - state["lastCheck"], 0)
			# The maximum time till the next check is CHECK_INTERVAL.
			secsTillNext = CHECK_INTERVAL - int(min(secsSinceLast, CHECK_INTERVAL))
		self._checkTimer.Start(secsTillNext * 1000, True)
Esempio n. 5
0
def initialize():
    global curMousePos, scrBmpObj, _shapeTimer
    scrBmpObj = screenBitmap.ScreenBitmap(1, 1)
    (x, y) = winUser.getCursorPos()
    desktopObject = api.getDesktopObject()
    try:
        mouseObject = desktopObject.objectFromPoint(x, y)
    except:
        log.exception("Error retrieving initial mouse object")
        mouseObject = None
    if not mouseObject:
        mouseObject = api.getDesktopObject()
    api.setMouseObject(mouseObject)
    curMousePos = (x, y)
    winInputHook.initialize()
    winInputHook.setCallbacks(mouse=internal_mouseEvent)
    _shapeTimer = gui.NonReEntrantTimer(_reportShape)
Esempio n. 6
0
	def start(self):
		"""Start the download.
		"""
		self._shouldCancel = False
		# Use a timer because timers aren't re-entrant.
		self._guiExecTimer = gui.NonReEntrantTimer(self._guiExecNotify)
		gui.mainFrame.prePopup()
		# Translators: The title of the dialog displayed while downloading an NVDA update.
		self._progressDialog = wx.ProgressDialog(_("Downloading Update"),
			# Translators: The progress message indicating that a connection is being established.
			_("Connecting"),
			# PD_AUTO_HIDE is required because ProgressDialog.Update blocks at 100%
			# and waits for the user to press the Close button.
			style=wx.PD_CAN_ABORT | wx.PD_ELAPSED_TIME | wx.PD_REMAINING_TIME | wx.PD_AUTO_HIDE,
			parent=gui.mainFrame)
		self._progressDialog.Raise()
		t = threading.Thread(target=self._bg)
		t.daemon = True
		t.start()