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


Python View.get_info方法代码示例

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


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

示例1: __init__

# 需要导入模块: from view import View [as 别名]
# 或者: from view.View import get_info [as 别名]
class Controller:
    def __init__(self):
        self.view = View()

    def menu(self):
        while True:
            point = self.view
            if point == 1:
                self._calculate()
            elif point == 2:
                serialize.load()
            elif point == 3:
                data = self.view.change_serialization_file()
                serialize.change_config(data[0], data[1])
            elif point == 4:
                break

    def _calculate(self):
        gender = self.view.read_gender()
        weight = self.view.read_weight()
        height = self.view.read_height()
        age = self.view.read_age()
        pa = self.view.read_pa()
        model = Model(gender, weight, height, age, pa)
        calories = model.calculate_calories()
        self.view.get_info()
        data = (gender, weight, height, age, pa, calories)
        raw_input()
        if self.view.is_dump():
            serialize.dump(data)
开发者ID:Bodya95,项目名称:ComputerArchitecture,代码行数:32,代码来源:controller.py

示例2: __init__

# 需要导入模块: from view import View [as 别名]
# 或者: from view.View import get_info [as 别名]
class Controller:
    def __init__(self):
        self.view = View()
        self.config = MyConfigParser()
        self.sql_worker = SqlWorker(self.config.read_config())

    def main(self):
        try:
            while True:
                point = self.view.create_menu()
                self.handler(operations[int((point-1) / 3)],
                             tables[(point-1) % 3])
                input()
        except TypeError:
            self.view.show_exit()

    def handler(self, operation, table_name):
        if operation == "load":
            if table_name == "pressure_data":
                id = input("Enter id")
                self.view.get_info(
                    self.sql_worker.load(table_name, id),
                    table_name
                )
            else:
                self.view.get_info(
                    self.sql_worker.load(table_name),
                    table_name
                )
        elif operation == "add":
            data = []
            for i in table_data[table_name]:
                point = input("Enter " + i + " : ")
                data.append(point)
            self.sql_worker.insert(table_name, data)
        elif operation == "change":
            data = []
            id = input("Enter id")
            for i in table_data[table_name]:
                point = input("Enter " + i + " : ")
                data.append(point)
            self.sql_worker.update(table_name, id, data)
        elif operation == "delete":
            id = input("Enter id")
            self.sql_worker.delete(table_name, id)
        elif operation == "config":
            for i in range(1, 4):
                print("%d. %s" % (i, databases[i - 1]))
            point = input()
            self.config.change_config(databases[int(point) - 1])
            self.sql_worker = SqlWorker(self.config.read_config())
开发者ID:itandrik,项目名称:ComputerArchitecture,代码行数:53,代码来源:controller.py


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