本文整理匯總了Python中ubuntui.ev.EventLoop.exit方法的典型用法代碼示例。如果您正苦於以下問題:Python EventLoop.exit方法的具體用法?Python EventLoop.exit怎麽用?Python EventLoop.exit使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ubuntui.ev.EventLoop
的用法示例。
在下文中一共展示了EventLoop.exit方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: finish
# 需要導入模塊: from ubuntui.ev import EventLoop [as 別名]
# 或者: from ubuntui.ev.EventLoop import exit [as 別名]
def finish(self, needs_lxd_setup=False, lxdnetwork=None, back=False):
""" Processes the new LXD setup and loads the controller to
finish bootstrapping the model.
Arguments:
back: if true loads previous controller
needs_lxd_setup: if true prompt user to run lxd init
"""
if back:
return controllers.use('clouds').render()
if needs_lxd_setup:
EventLoop.remove_alarms()
EventLoop.exit(1)
if lxdnetwork is None:
return app.ui.show_exception_message(
Exception("Unable to configure LXD network bridge."))
formatted_network = self.__format_input(lxdnetwork)
app.log.debug("LXD Config {}".format(formatted_network))
out = self.__format_conf(formatted_network)
with NamedTemporaryFile(mode="w", encoding="utf-8",
delete=False) as tempf:
app.log.debug("Saving LXD config to {}".format(tempf.name))
utils.spew(tempf.name, out)
sh = utils.run('sudo mv {} /etc/default/lxd-bridge'.format(
tempf.name), shell=True)
if sh.returncode > 0:
return app.ui.show_exception_message(
Exception("Problem saving config: {}".format(
sh.stderr.decode('utf8'))))
app.log.debug("Restarting lxd-bridge")
utils.run("sudo systemctl restart lxd-bridge.service", shell=True)
utils.pollinate(app.session_id, 'L002')
controllers.use('newcloud').render(
cloud='localhost', bootstrap=True)
示例2: unhandled_input
# 需要導入模塊: from ubuntui.ev import EventLoop [as 別名]
# 或者: from ubuntui.ev.EventLoop import exit [as 別名]
def unhandled_input(self, key):
if key in ['q', 'Q']:
EventLoop.exit(0)
示例3: cancel
# 需要導入模塊: from ubuntui.ev import EventLoop [as 別名]
# 或者: from ubuntui.ev.EventLoop import exit [as 別名]
def cancel(self, btn):
EventLoop.exit(0)
示例4: finish
# 需要導入模塊: from ubuntui.ev import EventLoop [as 別名]
# 或者: from ubuntui.ev.EventLoop import exit [as 別名]
def finish(self):
EventLoop.remove_alarms()
EventLoop.exit(0)
示例5: cancel
# 需要導入模塊: from ubuntui.ev import EventLoop [as 別名]
# 或者: from ubuntui.ev.EventLoop import exit [as 別名]
def cancel(self, button):
pollinate(app.session_id, 'UC')
EventLoop.exit(0)
示例6: cancel
# 需要導入模塊: from ubuntui.ev import EventLoop [as 別名]
# 或者: from ubuntui.ev.EventLoop import exit [as 別名]
def cancel(self, button):
EventLoop.exit(0)
示例7: unhandled_input
# 需要導入模塊: from ubuntui.ev import EventLoop [as 別名]
# 或者: from ubuntui.ev.EventLoop import exit [as 別名]
def unhandled_input(key):
if key in ['q', 'Q']:
async.shutdown()
EventLoop.exit(0)
示例8: done_cb
# 需要導入模塊: from ubuntui.ev import EventLoop [as 別名]
# 或者: from ubuntui.ev.EventLoop import exit [as 別名]
def done_cb(self):
log.debug("done_cb called")
EventLoop.exit(0)