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


Python ui.UI类代码示例

本文整理汇总了Python中ui.UI的典型用法代码示例。如果您正苦于以下问题:Python UI类的具体用法?Python UI怎么用?Python UI使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: __init__

class DandelionApp:
    def __init__(self, config_file=None):
        self._config_manager = ConfigurationManager(config_file)

    def start_server(self):
        self._server = Server(
            self._config_manager.local_address,
            self._config_manager.local_port,
            self._config_manager.server,  # info_dict
            self._config_manager.content_db,
        )
        self._server.start()

    def start_content_synchronizer(self):
        self._synchronizer = Synchronizer(
            self._config_manager.local_address,
            self._config_manager.local_port,
            self._config_manager.type,
            self._config_manager.content_db,
        )
        self._synchronizer.start()

    def run_ui(self):

        self._ui = UI(
            self._config_manager.ui, self._config_manager.content_db, self._server, self._synchronizer  # dict
        )
        self._ui.run()

    def exit(self):
        self._synchronizer.stop()
        self._server.stop()
开发者ID:vojd,项目名称:Dandelion-Message-Service,代码行数:32,代码来源:app.py

示例2: reset

def reset(keep_player=False):
    global SCREEN_SIZE, RANDOM_SEED, MAP, PLAYER

    RANDOM_SEED += 1
    UI.clear_all()
    TurnTaker.clear_all()

    if keep_player:
        PLAYER.refresh_turntaker()
        PLAYER.levels_seen += 1

    else:

        if not PLAYER is None:
            print("Game Over")
            print("%d evidence in %d turns; %d levels seen" %(len(PLAYER.evidence),PLAYER.turns,PLAYER.levels_seen))

        PLAYER = Player()

    if not MAP is None:
        MAP.close()
        del MAP

    MAP = Map.random(RANDOM_SEED,SCREEN_SIZE-(0,4),PLAYER)
    MAP.generate()
开发者ID:frogbotherer,项目名称:DalekRL,代码行数:25,代码来源:DalekRL.py

示例3: main

def main(args):
    print(c.GROUP_NAME, "Attendance Tracker Version", c.VERSION)
    # Init textMode
    textMode = 1 #1 for text, 0 for UI
    # Process the arguments
    if len(args) > 1:
        arg = args[1].lower()
        if arg == "--help":
            showHelp()
            sys.exit(0)
        elif arg == "--version":
            showVersion()
            sys.exit(0)
        elif arg == "--nogui":
            textMode = 1
        else:
            print("Invalid argument:", args[1])
            sys.exit(0)

    # Start the program into either textmode or GUI mode
    if textMode == 0:
        global app
        app = UI(args)
        app.exec_()
    else:
        TextUI().start()

    # Exit normally
    sys.exit(0)
开发者ID:clemsonMakerspace,项目名称:Magstripe_Attendance,代码行数:29,代码来源:checkIn.py

示例4: filter

    def filter(self):
        """
        Filter the list of apartments on specific criteria
        """
        self._validate_parsed_command(["greater", "type"])

        # filter by type
        if self._parsed_command["type"]:
            expense_type = self._parsed_command["type"]
            filtered_bloc_dict = {}
            for apartment_id in self._bloc_dict.keys():
                if self._bloc_dict[apartment_id].expenses[expense_type]:
                    filtered_bloc_dict[apartment_id] = self._bloc_dict[apartment_id]

            self._bloc_dict = filtered_bloc_dict

        # filter by total greater than
        if self._parsed_command["greater"]:
            amount_greater = float(self._parsed_command["greater"])
            filtered_bloc_dict = {}
            for apartment_id in self._bloc_dict.keys():
                if self._bloc_dict[apartment_id].get_total_expenses() > amount_greater:
                    filtered_bloc_dict[apartment_id] = self._bloc_dict[apartment_id]

            self._bloc_dict = filtered_bloc_dict

        # print(filtered_bloc_dict)
        if not filtered_bloc_dict:
            UI.set_message("No apartment fits the criteria")
        else:
            UI.set_message("Apartments filtered successfully")
开发者ID:leyyin,项目名称:university,代码行数:31,代码来源:bloc.py

示例5: list_total_apartment

    def list_total_apartment(self):
        """
        Displays the total expenses for an apartment
        """
        self._validate_parsed_command(["id"])

        apartment_id = self._parsed_command["id"]
        UI.set_message("Total expenses = " + str(self._bloc_dict[apartment_id].get_total_expenses()))
开发者ID:leyyin,项目名称:university,代码行数:8,代码来源:bloc.py

示例6: SvcStop

    def SvcStop(self):
        self.ReportServiceStatus(win32service.SERVICE_STOP_PENDING)
        win32event.SetEvent(self.stop_event)
        logging.info('Stopping ShakeCast Server...')
        self.stop_requested = True

        ui = UI()
        ui.send('shutdown')
开发者ID:dslosky-usgs,项目名称:shakecast,代码行数:8,代码来源:server_service.py

示例7: start

 def start(self):
     while True:
         command = UI.get_input("> ")
         if command == 'start':
             self.ask()
         elif command == 'highscores':
             UI.display(self.show_highscores())
         elif command == 'help':
             UI.display(self.__HELP_MESSAGE)
         elif command == 'exit':
             return
开发者ID:betrakiss,项目名称:HackBulgaria,代码行数:11,代码来源:game.py

示例8: stat_total_type

    def stat_total_type(self):
        """
        Displays the total for an expense type
        """
        self._validate_parsed_command(["expense_type"])

        sum_type = self._parsed_command["expense_type"]
        total = sum([self._bloc_dict[i].expenses[sum_type] for i in self._bloc_dict])
        # for apartment_id in self._bloc_dict:
        #    total += self._bloc_dict[apartment_id].expenses[sum_type]

        UI.set_message("Total expenses for " + sum_type + " = " + str(total))
开发者ID:leyyin,项目名称:university,代码行数:12,代码来源:bloc.py

示例9: stat_max_apartment

    def stat_max_apartment(self):
        """
        Displays the biggest expense in an apartment
        """
        self._validate_parsed_command(["id"])

        apartment_id = self._parsed_command["id"]
        biggest_types = self._bloc_dict[apartment_id].get_max_expenses_type()

        if biggest_types:
            UI.set_message("Biggest expense is " + biggest_types.__str__() + " = " + str(
                self._bloc_dict[apartment_id].expenses[biggest_types[0]]))
        else:
            UI.set_message("Apartment has all expenses = 0")
开发者ID:leyyin,项目名称:university,代码行数:14,代码来源:bloc.py

示例10: redraw_screen

    def redraw_screen(self,t=0):
        # draw and flush screen
        if not UI.need_update(t):
            # clearly one of the libtcod functions here causes the wait for the next frame
            sleep(1.0/Player.LIMIT_FPS)
            return

        self.map.draw()
        self.draw_ui(Position(0,Player.SCREEN_SIZE.y-3))
        UI.draw_all(t)

        libtcod.console_flush()

        # clear screen
        libtcod.console_clear(0)
开发者ID:frogbotherer,项目名称:DalekRL,代码行数:15,代码来源:player.py

示例11: run

    def run(self):
        self.player = Monster(name='Player')
        self._load_history(self.player)

        monster = random.choice(list(monsters.viewkeys()))
        self.monster = Monster(monsters[monster][0], monster, description=monsters[monster][1])
        self.ui = UI(self.player)
        self.ui.monster = self.monster

        self.ui.welcome()
        
        a = 1
        while a != 0:
            self._load_history(self.monster)

            a = self.run_loop()

            if a != 0:
                self.ui.update_display()

            self._save_history(self.player)
            self._save_history(self.monster)
            
            monster = random.choice(list(monsters.viewkeys()))
            self.monster = Monster(monsters[monster][0], monster, description=monsters[monster][1])
            self.ui.monster = self.monster
开发者ID:schiem,项目名称:ai_project,代码行数:26,代码来源:world.py

示例12: list_by_type

    def list_by_type(self):
        """
        Displays only the apartments having a specific expense type
        """
        self._validate_parsed_command(["expense_type"])

        expense_type = self._parsed_command["expense_type"]
        filtered_bloc_dict = {}
        for apartment_id in self._bloc_dict.keys():
            if self._bloc_dict[apartment_id].expenses[expense_type] != 0:
                filtered_bloc_dict[apartment_id] = self._bloc_dict[apartment_id]

        if filtered_bloc_dict:
            UI.set_message(UI.get_bloc_table(filtered_bloc_dict))
        else:
            UI.set_message("There are no apartments with " + expense_type)
开发者ID:leyyin,项目名称:university,代码行数:16,代码来源:bloc.py

示例13: _initme

    def _initme(self, userdata=None):
        #the main classes
        self.m = Model(self)
        self.capture = Capture(self)
        self.ui = UI(self)

        return False
开发者ID:mpaolino,项目名称:cuadraditosxo,代码行数:7,代码来源:cuadraditos.py

示例14: __init__

 def __init__(self, current=0):
     State.__init__(self)
     self.ui = UI(self, Jules_UIContext)
     self.nextState = GameStart
     logo_duration = 20 * 1000
     scores_duration = 5 * 1000
     self.displays = [(logo_duration, self.draw_logo),
                     (scores_duration, self.draw_high_scores)]
     self.eventid = TimerEvents.SplashScreen
     self.current = current
     self.draw = self.displays[self.current][1]
     self.instructions = ['Can you think fast and react faster?',
                          'This game will test both.',
                          'Your job is to destroy the bonus blocks.',
                          'Sounds easy, right?... Wrong!',
                          'There are several problems.',
                          'If you destroy a penalty block you lose 200 pts.',
                          'If you get 3 penalties, you lose a life.',
                          'If you lose 3 lives, the game is over.',
                          'The bonus and penalty blocks',
                          'change colors every 5 seconds.',
                          'And on top of that, if you do not destroy a',
                          'random non-bonus, non-penalty block every',
                          'couple of seconds, that will give you a',
                          'penalty too. Think you got all that?']
开发者ID:CodeSkool,项目名称:SimpleGUI2Pygame,代码行数:25,代码来源:React.py

示例15: ui

 def ui ( self, context, parent        = None, 
                         kind          = None, 
                         view_elements = None, 
                         handler       = None ):
     """ Creates a UI user interface object.
     """
     if type( context ) is not dict:
         context = { 'object': context }
     ui = UI( view          = self,
              context       = context,
              handler       = handler or self.handler or default_handler(),
              view_elements = view_elements )
     if kind is None:
         kind = self.kind
     ui.ui( parent, kind )
     return ui
开发者ID:pv,项目名称:matplotlib-cvs,代码行数:16,代码来源:view.py


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