當前位置: 首頁>>代碼示例>>Python>>正文


Python win32event.INFINITE屬性代碼示例

本文整理匯總了Python中win32event.INFINITE屬性的典型用法代碼示例。如果您正苦於以下問題:Python win32event.INFINITE屬性的具體用法?Python win32event.INFINITE怎麽用?Python win32event.INFINITE使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在win32event的用法示例。


在下文中一共展示了win32event.INFINITE屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: wait

# 需要導入模塊: import win32event [as 別名]
# 或者: from win32event import INFINITE [as 別名]
def wait(self, state, interval=0.1, channel=None):
        """Wait for the given state(s), KeyboardInterrupt or SystemExit.

        Since this class uses native win32event objects, the interval
        argument is ignored.
        """
        if isinstance(state, (tuple, list)):
            # Don't wait for an event that beat us to the punch ;)
            if self.state not in state:
                events = tuple([self._get_state_event(s) for s in state])
                win32event.WaitForMultipleObjects(
                    events, 0, win32event.INFINITE)
        else:
            # Don't wait for an event that beat us to the punch ;)
            if self.state != state:
                event = self._get_state_event(state)
                win32event.WaitForSingleObject(event, win32event.INFINITE) 
開發者ID:cherrypy,項目名稱:cherrypy,代碼行數:19,代碼來源:win32.py

示例2: run

# 需要導入模塊: import win32event [as 別名]
# 或者: from win32event import INFINITE [as 別名]
def run(self):
        last_time = os.stat(self.filename)[stat.ST_MTIME]
        while 1:
            try:
                rc = win32event.WaitForSingleObject(self.handle, 
                                                    win32event.INFINITE)
                win32file.FindNextChangeNotification(self.handle)
            except win32event.error, details:
                # handle closed - thread should terminate.
                if details[0] != winerror.ERROR_INVALID_HANDLE:
                    raise
                break
            this_time = os.stat(self.filename)[stat.ST_MTIME]
            if this_time != last_time:
                print "Detected file change - flagging for reload."
                self.change_detected = True
                last_time = this_time 
開發者ID:IronLanguages,項目名稱:ironpython2,代碼行數:19,代碼來源:advanced.py

示例3: CollectorThread

# 需要導入模塊: import win32event [as 別名]
# 或者: from win32event import INFINITE [as 別名]
def CollectorThread(stopEvent, file):
	win32trace.InitRead()
	handle = win32trace.GetHandle()
	# Run this thread at a lower priority to the main message-loop (and printing output)
	# thread can keep up
	import win32process
	win32process.SetThreadPriority(win32api.GetCurrentThread(), win32process.THREAD_PRIORITY_BELOW_NORMAL)

	try:
		while 1:
			rc = win32event.WaitForMultipleObjects((handle, stopEvent), 0, win32event.INFINITE)
			if rc == win32event.WAIT_OBJECT_0:
				# About the only char we can't live with is \0!
				file.write(win32trace.read().replace("\0", "<null>"))
			else:
				# Stop event
				break
	finally:
		win32trace.TermRead()
		print "Thread dieing" 
開發者ID:IronLanguages,項目名稱:ironpython2,代碼行數:22,代碼來源:TraceCollector.py

示例4: Run

# 需要導入模塊: import win32event [as 別名]
# 或者: from win32event import INFINITE [as 別名]
def Run(self):
		while 1:
			handles = [self.stopEvent, self.adminEvent]
			if self.watchEvent is not None:
				handles.append(self.watchEvent)
			rc = win32event.WaitForMultipleObjects(handles, 0, win32event.INFINITE)
			if rc == win32event.WAIT_OBJECT_0:
				break
			elif rc == win32event.WAIT_OBJECT_0+1:
				self.RefreshEvent()
			else:
				win32api.PostMessage(self.hwnd, MSG_CHECK_EXTERNAL_FILE, 0, 0)
				try:
					# If the directory has been removed underneath us, we get this error.
					win32api.FindNextChangeNotification(self.watchEvent)
				except win32api.error, exc:
					print "Can not watch file", self.doc.GetPathName(), "for changes -", exc.strerror
					break

		# close a circular reference 
開發者ID:IronLanguages,項目名稱:ironpython2,代碼行數:22,代碼來源:document.py

示例5: wait

# 需要導入模塊: import win32event [as 別名]
# 或者: from win32event import INFINITE [as 別名]
def wait(self, state, interval=0.1, channel=None):
        """Wait for the given state(s), KeyboardInterrupt or SystemExit.
        
        Since this class uses native win32event objects, the interval
        argument is ignored.
        """
        if isinstance(state, (tuple, list)):
            # Don't wait for an event that beat us to the punch ;)
            if self.state not in state:
                events = tuple([self._get_state_event(s) for s in state])
                win32event.WaitForMultipleObjects(events, 0, win32event.INFINITE)
        else:
            # Don't wait for an event that beat us to the punch ;)
            if self.state != state:
                event = self._get_state_event(state)
                win32event.WaitForSingleObject(event, win32event.INFINITE) 
開發者ID:binhex,項目名稱:moviegrabber,代碼行數:18,代碼來源:win32.py

示例6: Transmit

# 需要導入模塊: import win32event [as 別名]
# 或者: from win32event import INFINITE [as 別名]
def Transmit(self, transmitData):
        """
        This will be called to detect available IR Blasters.
        """
        if not self.file:
            if not self.connecting:
                self.Connect()
            else:
                return False
        while self.receiving:
            time.sleep(0.05)
        writeOvlap = win32file.OVERLAPPED()
        writeOvlap.hEvent = win32event.CreateEvent(None, 0, 0, None)
        win32file.WriteFile(self.file, transmitData, writeOvlap)
        win32event.WaitForSingleObject(writeOvlap.hEvent, win32event.INFINITE)
        return True 
開發者ID:EventGhost,項目名稱:EventGhost,代碼行數:18,代碼來源:__init__.py

示例7: __windows_init__

# 需要導入模塊: import win32event [as 別名]
# 或者: from win32event import INFINITE [as 別名]
def __windows_init__(self):
        import win32event
        semaphore_all_access = 0x1F0003

        self.timeout = 5000 if self.should_timeout else win32event.INFINITE            

        self._semaphore1 = \
            win32event.OpenSemaphore(semaphore_all_access, False,
                                     "Global\\HOLODECK_SEMAPHORE_SERVER" + self._uuid)
        self._semaphore2 = \
            win32event.OpenSemaphore(semaphore_all_access, False,
                                     "Global\\HOLODECK_SEMAPHORE_CLIENT" + self._uuid)

        def windows_acquire_semaphore(sem):
            result = win32event.WaitForSingleObject(sem, self.timeout)

            if result != win32event.WAIT_OBJECT_0:
                raise TimeoutError("Timed out or error waiting for engine!")
            
        def windows_release_semaphore(sem):
            win32event.ReleaseSemaphore(sem, 1)

        def windows_unlink():
            pass

        self._get_semaphore_fn = windows_acquire_semaphore
        self._release_semaphore_fn = windows_release_semaphore
        self.unlink = windows_unlink 
開發者ID:BYU-PCCL,項目名稱:holodeck,代碼行數:30,代碼來源:holodeckclient.py

示例8: wait

# 需要導入模塊: import win32event [as 別名]
# 或者: from win32event import INFINITE [as 別名]
def wait(self):
            """Wait for child process to terminate.  Returns returncode
            attribute."""
            if self.returncode == None:
                obj = WaitForSingleObject(self._handle, INFINITE)
                self.returncode = GetExitCodeProcess(self._handle)
                _active.remove(self)
            return self.returncode 
開發者ID:linuxscout,項目名稱:mishkal,代碼行數:10,代碼來源:subprocess24.py

示例9: transmit

# 需要導入模塊: import win32event [as 別名]
# 或者: from win32event import INFINITE [as 別名]
def transmit(self,dataToTransmit):
        
        # convert to string
        dataToTransmit  = ''.join([chr(b) for b in dataToTransmit])
        
        # write over tuntap interface
        win32file.WriteFile(self.tuntap, dataToTransmit, self.overlappedTx)
        win32event.WaitForSingleObject(self.overlappedTx.hEvent, win32event.INFINITE)
        self.overlappedTx.Offset = self.overlappedTx.Offset + len(dataToTransmit)
    
    #======================== private ========================================= 
開發者ID:alexsunday,項目名稱:pyvpn,代碼行數:13,代碼來源:tun-ping-responder.py

示例10: run

# 需要導入模塊: import win32event [as 別名]
# 或者: from win32event import INFINITE [as 別名]
def run(self):
        self.running = True
        while self.running:
            errCode, bytes, key, overlapped = \
                GetQueuedCompletionStatus(self.io_req_port, INFINITE)
            if key == ISAPI_SHUTDOWN and overlapped is None:
                break

            # Let the parent extension handle the command.
            dispatcher = self.extension.dispatch_map.get(key)
            if dispatcher is None:
                raise RuntimeError("Bad request '%s'" % (key,))
            
            dispatcher(errCode, bytes, key, overlapped) 
開發者ID:IronLanguages,項目名稱:ironpython2,代碼行數:16,代碼來源:threaded_extension.py

示例11: SvcDoRun

# 需要導入模塊: import win32event [as 別名]
# 或者: from win32event import INFINITE [as 別名]
def SvcDoRun(self):
        # do nothing at all - just wait to be stopped
        win32event.WaitForSingleObject(self.hWaitStop, win32event.INFINITE)
        # Write a stop message.
        servicemanager.LogMsg(
                servicemanager.EVENTLOG_INFORMATION_TYPE,
                servicemanager.PYS_SERVICE_STOPPED,
                (self._svc_name_, '')
                ) 
開發者ID:IronLanguages,項目名稱:ironpython2,代碼行數:11,代碼來源:serviceEvents.py

示例12: join

# 需要導入模塊: import win32event [as 別名]
# 或者: from win32event import INFINITE [as 別名]
def join(self):
        win32event.WaitForSingleObject(self.processHandle,
                                       win32event.INFINITE)
        self.exitCode = win32process.GetExitCodeProcess(self.processHandle) 
開發者ID:IronLanguages,項目名稱:ironpython2,代碼行數:6,代碼來源:test_win32trace.py

示例13: testSimpleOverlapped

# 需要導入模塊: import win32event [as 別名]
# 或者: from win32event import INFINITE [as 別名]
def testSimpleOverlapped(self):
        # Create a file in the %TEMP% directory.
        import win32event
        testName = os.path.join( win32api.GetTempPath(), "win32filetest.dat" )
        desiredAccess = win32file.GENERIC_WRITE
        overlapped = pywintypes.OVERLAPPED()
        evt = win32event.CreateEvent(None, 0, 0, None)
        overlapped.hEvent = evt
        # Create the file and write shit-loads of data to it.
        h = win32file.CreateFile( testName, desiredAccess, 0, None, win32file.CREATE_ALWAYS, 0, 0)
        chunk_data = str2bytes("z") * 0x8000
        num_loops = 512
        expected_size = num_loops * len(chunk_data)
        for i in range(num_loops):
            win32file.WriteFile(h, chunk_data, overlapped)
            win32event.WaitForSingleObject(overlapped.hEvent, win32event.INFINITE)
            overlapped.Offset = overlapped.Offset + len(chunk_data)
        h.Close()
        # Now read the data back overlapped
        overlapped = pywintypes.OVERLAPPED()
        evt = win32event.CreateEvent(None, 0, 0, None)
        overlapped.hEvent = evt
        desiredAccess = win32file.GENERIC_READ
        h = win32file.CreateFile( testName, desiredAccess, 0, None, win32file.OPEN_EXISTING, 0, 0)
        buffer = win32file.AllocateReadBuffer(0xFFFF)
        while 1:
            try:
                hr, data = win32file.ReadFile(h, buffer, overlapped)
                win32event.WaitForSingleObject(overlapped.hEvent, win32event.INFINITE)
                overlapped.Offset = overlapped.Offset + len(data)
                if not data is buffer:
                    self.fail("Unexpected result from ReadFile - should be the same buffer we passed it")
            except win32api.error:
                break
        h.Close() 
開發者ID:IronLanguages,項目名稱:ironpython2,代碼行數:37,代碼來源:test_win32file.py

示例14: testCompletionPortsQueued

# 需要導入模塊: import win32event [as 別名]
# 或者: from win32event import INFINITE [as 別名]
def testCompletionPortsQueued(self):
        class Foo: pass
        io_req_port = win32file.CreateIoCompletionPort(-1, None, 0, 0)
        overlapped = pywintypes.OVERLAPPED()
        overlapped.object = Foo()
        win32file.PostQueuedCompletionStatus(io_req_port, 0, 99, overlapped)
        errCode, bytes, key, overlapped = \
                win32file.GetQueuedCompletionStatus(io_req_port, win32event.INFINITE)
        self.failUnlessEqual(errCode, 0)
        self.failUnless(isinstance(overlapped.object, Foo)) 
開發者ID:IronLanguages,項目名稱:ironpython2,代碼行數:12,代碼來源:test_win32file.py

示例15: wait

# 需要導入模塊: import win32event [as 別名]
# 或者: from win32event import INFINITE [as 別名]
def wait(self):
            """Wait for child process to terminate.  Returns returncode
            attribute."""
            if self.returncode is None:
                obj = WaitForSingleObject(self._handle, INFINITE)
                self.returncode = GetExitCodeProcess(self._handle)
            return self.returncode 
開發者ID:bq,項目名稱:web2board,代碼行數:9,代碼來源:_scons_subprocess.py


注:本文中的win32event.INFINITE屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。