当前位置: 首页>>代码示例>>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;未经允许,请勿转载。