本文整理汇总了Python中ui.UI.get_message方法的典型用法代码示例。如果您正苦于以下问题:Python UI.get_message方法的具体用法?Python UI.get_message怎么用?Python UI.get_message使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ui.UI
的用法示例。
在下文中一共展示了UI.get_message方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run
# 需要导入模块: from ui import UI [as 别名]
# 或者: from ui.UI import get_message [as 别名]
def run(self):
"""
Main loop of the application
"""
print(UI.get_help_menu())
while True:
# get the command from the user
command = UI.get_command()
# find out the command type and handle each command correctly
if "help" in command:
UI.set_message(UI.get_help_menu())
elif ("quit" in command) or ("exit" in command):
self.exit()
elif "insert" in command:
if self.bloc.insert_apartment_parse(command):
self._undo_start("insert")
self.bloc.insert_apartment()
elif "replace" in command:
if self.bloc.replace_apartment_parse(command):
self._undo_start("replace")
self.bloc.insert_apartment()
elif "remove" in command:
if self.bloc.remove_apartment_parse(command):
self._undo_start("remove")
self.bloc.remove_apartment()
elif "list" in command:
if "list" == command:
self.bloc.list_all()
elif "greater" in command:
if self.bloc.list_greater_than_parse(command):
self.bloc.list_greater_than()
elif "less" in command:
if self.bloc.list_less_than_parse(command):
self.bloc.list_less_than()
elif ("sold" in command) or ("total" in command):
if self.bloc.list_total_apartment_parse(command):
self.bloc.list_total_apartment()
else: # check list by type
if self.bloc.list_by_type_parse(command):
self.bloc.list_by_type()
elif "sum" in command:
if self.bloc.stat_total_type_parse(command):
self.bloc.stat_total_type()
elif "max" in command:
if self.bloc.stat_max_apartment_parse(command):
self.bloc.stat_max_apartment()
elif "filter" in command:
if self.bloc.filter_parse(command):
self._undo_start("filter")
self.bloc.filter()
elif "sort" in command:
if "asc" in command:
if self.bloc.sort_parse(command, reverse=False):
self.bloc.sort()
elif "desc" in command:
if self.bloc.sort_parse(command, reverse=True):
self.bloc.sort()
else:
UI.set_message(UI.get_error_sort())
elif "undo" in command:
if self._undo_last_operation:
UI.set_message("Undo operation '" + self._undo_last_operation + "' finished")
self._undo_end()
else:
UI.set_message("Nothing to undo")
elif "save" == command:
self.save()
UI.set_message("Current bloc state saved to file.")
else:
UI.set_message("Command unknown. type help for a list of commands")
# print all messages
print(UI.get_message())