本文整理汇总了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
示例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']
示例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()
示例4: start
# 需要导入模块: from engine import Engine [as 别名]
# 或者: from engine.Engine import start [as 别名]
def start(self):
"""start
"""
engine = Engine(self)
engine.start()
示例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)
#.........这里部分代码省略.........
示例6: main
# 需要导入模块: from engine import Engine [as 别名]
# 或者: from engine.Engine import start [as 别名]
def main():
filename = 'seed.txt'
e = Engine(filename)
e.start()