当前位置: 首页>>代码示例>>Python>>正文


Python Engine.start方法代码示例

本文整理汇总了Python中engine.Engine.start方法的典型用法代码示例。如果您正苦于以下问题:Python Engine.start方法的具体用法?Python Engine.start怎么用?Python Engine.start使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在engine.Engine的用法示例。


在下文中一共展示了Engine.start方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: Controller

# 需要导入模块: from engine import Engine [as 别名]
# 或者: from engine.Engine import start [as 别名]
class Controller(threading.Thread):
    def __init__(self):
        threading.Thread.__init__(self)
        #是否更新
        #False表示下载url_queue的链接,True表示更新,
        self.run_list=[False,True]
        self.run_sqe=0
        self.engine_is_running=False
        
    def run(self):
        '''循环运行'''
        self.is_running=True
        #设置运行类型
        self.is_update=self.run_list[self.run_sqe]
        settings.S_is_update=self.is_update

        self.eng=Engine(settings.S_target_website)
        self.eng.start()
        
        self.run_sqe+=1
        if self.run_sqe>=len(self.run_list):
            self.run_sqe=0
            
        self.engine_is_running=True
        self.eng.join()
        if self.is_running:
            self.run()
        
    def stop(self):
        self.eng.is_running=False
        self.is_running=False
开发者ID:lvshuchengyin,项目名称:mycode,代码行数:33,代码来源:controller.py

示例2: default

# 需要导入模块: from engine import Engine [as 别名]
# 或者: from engine.Engine import start [as 别名]
    def default(self, obj):
        if isinstance(obj, (datetime.datetime, datetime.date)):
            return obj.isoformat()
        elif isinstance(obj, ObjectId):
            return str(obj)
        return json.JSONEncoder.default(self, obj)

def jsonify(*args):
    """ jsonify with support for MongoDB ObjectId
    """
    return Response(json.dumps(*args, cls=MongoJsonEncoder), mimetype='application/json')

app = Flask(__name__)
engine = Engine(True, True)
#engine = Engine()
engine.start()

@app.route('/', methods=['GET', 'POST'])
def requesting():
    """
        request from client arrive here.
    """
    if request.method == 'POST':
        if request.is_json:
            requestjs = request.get_json()
            player = requestjs['player']
            typerq = requestjs['type']
        print(requestjs)

        if typerq == 'get' or typerq == 'get_all':
            cls = requestjs['cls']
开发者ID:matteli,项目名称:histemul,代码行数:33,代码来源:histemul_server.py

示例3: Engine

# 需要导入模块: from engine import Engine [as 别名]
# 或者: from engine.Engine import start [as 别名]
from engine import Engine
from player import Player
from tk_win import Tk_win

if __name__ == "__main__":
    game = Engine(Player(), Tk_win())
    game.preload_cfg()
    game.start()
开发者ID:Senso,项目名称:Kapital,代码行数:10,代码来源:main.py

示例4: start

# 需要导入模块: from engine import Engine [as 别名]
# 或者: from engine.Engine import start [as 别名]
 def start(self):
     """start
     """
     engine = Engine(self)
     engine.start()
开发者ID:kaito-kidd,项目名称:mini-scrapy,代码行数:7,代码来源:spider.py

示例5: __init__

# 需要导入模块: from engine import Engine [as 别名]
# 或者: from engine.Engine import start [as 别名]
class Handler:

	def __init__(self, builder):
		self.queue = Queue.Queue()
		self.debugger = Engine(self.queue)
		self.debugger.start()
		self.builder = builder
		self.codeview = self.setup_codeview()
		self.watchesview = self.setup_watchesview()
		self.open_file = None
		glib.timeout_add(200, self.handle_queue)

	def delete_window(self, *args):
		print "Waiting for socket to close..."
		self.debugger.signal = 'kill'
		Gtk.main_quit(*args)

	def handle_queue(self):
		time.sleep(0.1) #doesn't work without it
		try:
			msg = self.queue.get_nowait()
		except Queue.Empty:
			msg = ''
		if (msg):
			if 'console' in msg:
				self.update_console(msg['console'])
			if 'stack' in msg:
				self.update_stack(msg['stack'])
			if 'code' in msg:
				self.update_codeview(msg['code'])
			if 'watchview' in msg:
				self.update_watchesview(msg['watchview'])

		self.update_buttons()
		self.set_status('Status: ' + str(self.debugger.status))
		return True

	def update_buttons(self):
		listen_button = self.builder.get_object("button_listen")
		status = self.debugger.status
		if (status == 'idle'):
			listen_button.set_sensitive(True)
			listen_button.set_label('Listen')
		elif (status == 'listening'):
			listen_button.set_sensitive(False)
			listen_button.set_label('Listening...')
		elif (status == 'running'):
			listen_button.set_sensitive(True)
			listen_button.set_label('Stop')



# BUTTONS ACTIONS

	def run(self, button):
		self.debugger.xrun()

	def step_over(self, button):
		self.debugger.step_over()

	def step_into(self, button):
		self.debugger.step_into()

	def listen(self, button):
		status = self.debugger.status
		if (status == 'idle'):
			self.debugger.signal = "listen"
		elif (status == 'listening'):
			self.debugger.signal = "stop=listening"
		elif (status == 'running'):
			self.debugger.signal = "stop"



# CONSOLE & STATUS

	def update_console(self, text):
		self.builder.get_object("console").get_buffer().set_text(text)

	def update_stack(self, text):
		s = text.replace('\x00', '')
		stack_iter = list(ElementTree.XML(s).iter())
		stack_str = ''
		for e in stack_iter:
			temp = e.get('filename')
			if temp:
				stack_str += temp + '\n'
		self.builder.get_object("stack").get_buffer().set_text(stack_str)

	def set_status(self, text):
		context_id = Gtk.Statusbar().get_context_id("Connection");
		self.builder.get_object("statusbar_main").push(context_id, text)

	def execute_command(self, widget, event):
		if (event.keyval ==	65293):
			r = self.debugger.execute(widget.get_text())
			self.update_console(r)



#.........这里部分代码省略.........
开发者ID:artbek,项目名称:PyXdebugClient,代码行数:103,代码来源:gui_handler.py

示例6: main

# 需要导入模块: from engine import Engine [as 别名]
# 或者: from engine.Engine import start [as 别名]
def main():
	filename = 'seed.txt'
	e = Engine(filename)
	e.start()
开发者ID:srt4-archive,项目名称:Qrawler,代码行数:6,代码来源:main.py


注:本文中的engine.Engine.start方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。