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


Python win32con.CTRL_C_EVENT屬性代碼示例

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


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

示例1: handle

# 需要導入模塊: import win32con [as 別名]
# 或者: from win32con import CTRL_C_EVENT [as 別名]
def handle(self, event):
        """Handle console control events (like Ctrl-C)."""
        if event in (win32con.CTRL_C_EVENT, win32con.CTRL_LOGOFF_EVENT,
                     win32con.CTRL_BREAK_EVENT, win32con.CTRL_SHUTDOWN_EVENT,
                     win32con.CTRL_CLOSE_EVENT):
            self.bus.log('Console event %s: shutting down bus' % event)

            # Remove self immediately so repeated Ctrl-C doesn't re-call it.
            try:
                self.stop()
            except ValueError:
                pass

            self.bus.exit()
            # 'First to return True stops the calls'
            return 1
        return 0 
開發者ID:cherrypy,項目名稱:cherrypy,代碼行數:19,代碼來源:win32.py

示例2: handle

# 需要導入模塊: import win32con [as 別名]
# 或者: from win32con import CTRL_C_EVENT [as 別名]
def handle(self, event):
        """Handle console control events (like Ctrl-C)."""
        if event in (win32con.CTRL_C_EVENT, win32con.CTRL_LOGOFF_EVENT,
                     win32con.CTRL_BREAK_EVENT, win32con.CTRL_SHUTDOWN_EVENT,
                     win32con.CTRL_CLOSE_EVENT):
            self.bus.log('Console event %s: shutting down bus' % event)
            
            # Remove self immediately so repeated Ctrl-C doesn't re-call it.
            try:
                self.stop()
            except ValueError:
                pass
            
            self.bus.exit()
            # 'First to return True stops the calls'
            return 1
        return 0 
開發者ID:binhex,項目名稱:moviegrabber,代碼行數:19,代碼來源:win32.py

示例3: _DebugCtrlHandler

# 需要導入模塊: import win32con [as 別名]
# 或者: from win32con import CTRL_C_EVENT [as 別名]
def _DebugCtrlHandler(evt):
    if evt in (win32con.CTRL_C_EVENT, win32con.CTRL_BREAK_EVENT):
        assert g_debugService
        print "Stopping debug service."
        g_debugService.SvcStop()
        return True
    return False 
開發者ID:IronLanguages,項目名稱:ironpython2,代碼行數:9,代碼來源:win32serviceutil.py

示例4: __close_internal_windows

# 需要導入模塊: import win32con [as 別名]
# 或者: from win32con import CTRL_C_EVENT [as 別名]
def __close_internal_windows(self):
		self.log.debug("Sending CTRL_C_EVENT to chromium")

		win32api.GenerateConsoleCtrlEvent(win32con.CTRL_C_EVENT, self.cr_proc.pid)
		self.cr_proc.send_signal(signal.CTRL_BREAK_EVENT)
		self.cr_proc.send_signal(signal.CTRL_C_EVENT)
		self.cr_proc.send_signal(1)
		self.log.debug("Sent")
		try:
			self.check_process_ded()  # Needed to flush the communcation pipes, sometimes

			# I can't get this to fucking ever work,
			# so just skip and go straight to termination.
			# self.log.debug("Waiting for chromium to exit")
			# try:
			# 	self.cr_proc.wait(timeout=5)
			# except subprocess.TimeoutExpired:
			# 	pass

			try:
				self.cr_proc.terminate()
			except ProcessLookupError:
				self.log.debug("Process exited normally, no need to terminate.")

			self.check_process_ded()  # Processes may dangle until the pipes are closed.

			try:
				self.cr_proc.kill()
			except ProcessLookupError:
				self.log.debug("Process exited normally, no need to terminate.")

			self.check_process_ded()  # Processes may dangle until the pipes are closed.

		except cr_exceptions.ChromeDiedError:
			self.log.debug("ChromeDiedError while polling. Ignoring due to shutdown.")
			# Considering we're /trying/ to kill chrome, it
			# dying is OK.

		self.log.debug("Pid: %s, Return code: %s", self.cr_proc.pid, self.cr_proc.returncode)
		self.log.debug("Chromium closed!") 
開發者ID:fake-name,項目名稱:ChromeController,代碼行數:42,代碼來源:transport.py


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