• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python ui.UI类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: __init__

    def __init__(self, config_file_path):
        config = ConfigParser.RawConfigParser()
        config.read(config_file_path)

        self._logger = logging.getLogger(__name__)
        self._ui = UI("lazzormanagement\nbooting...")

        user_config_file_path = os.path.dirname(config_file_path) + \
                os.path.sep + config.get('Users', 'users_file')
        self._user_manager = UserManager(user_config_file_path)
        self._lazzor = Lazzor()
 
        while True:
            try:
                self._upay_session_manager = nupay.SessionManager(config)
                break
            except nupay.SessionConnectionError as e:
                self._logger.warning("Can not reach the database")
                self._ui.warning_database_connection(timeout = 5)
            except nupay.TimeoutError as e:
                self._logger.warning("Timeout while connection to the database")
                self._ui.warning_database_connection(timeout = 5)

            self._ui.notify_try_again()


        self._token_reader = nupay.USBTokenReader()
开发者ID:schneider42,项目名称:lazzormanagement,代码行数:27,代码来源:lazzormanager.py


示例17: __init__

    def __init__(self):
        reload(sys)
        sys.setdefaultencoding('UTF-8')

        self.title = 'Nada'
        self.model = ['最新期刊', '分类期刊', '搜索期刊', '收藏夹', '关于']
        self.view = 'menu'
        self.ctrl = 'menu'

        self.offset = 0
        self.index = 0
        self.step = 10
        self.play_id = -1
        self.play_vol = -1

        self.present = []
        self.stack = []

        self.player = Player()
        self.ui = UI()
        self.luoo = Luoo()
        self.downloader = Downloader()

        self.database = Database()
        self.database.load()
        self.collections = self.database.data['collections'][0]

        self.screen = curses.initscr()
        self.screen.keypad(1)
开发者ID:ahonn,项目名称:nada,代码行数:29,代码来源:menu.py


示例18: Cuadraditos

class Cuadraditos(activity.Activity):

    log = logging.getLogger('cuadraditos-activity')

    def __init__(self, handle):
        activity.Activity.__init__(self, handle)
        #flags for controlling the writing to the datastore
        self.I_AM_CLOSING = False
        self.I_AM_SAVED = False
        self.props.enable_fullscreen_mode = False
        self.ui = None
        Constants(self)
        #self.modify_bg(gtk.STATE_NORMAL, Constants.color_black.gColor)

        #wait a moment so that our debug console capture mistakes
        gobject.idle_add(self._initme, None)

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

        return False

    def stop_pipes(self):
        self.capture.stop()

    def restart_pipes(self):
        self.capture.stop()
        self.capture.play()

    def close(self):
        self.I_AM_CLOSING = True
        self.m.UPDATING = False
        if (self.ui != None):
            self.ui.hide_all_windows()
        if (self.capture != None):
            self.capture.stop()

        #this calls write_file
        activity.Activity.close(self)

    def destroy(self):
        if self.I_AM_SAVED:
            activity.Activity.destroy(self)
开发者ID:mpaolino,项目名称:cuadraditosxo,代码行数:46,代码来源:cuadraditos.py


示例19: list_greater_than

    def list_greater_than(self):
        """
        Displays only the apartments with an overall expense greater than the given amount
        """
        self._validate_parsed_command(["greater"])

        greater_than = 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() > greater_than:
                filtered_bloc_dict[apartment_id] = self._bloc_dict[apartment_id]

        # check if empty
        if filtered_bloc_dict:
            UI.set_message(UI.get_bloc_table(filtered_bloc_dict))
        else:
            UI.set_message("There are no apartments with overall expenses greater than " + str(greater_than))
开发者ID:leyyin,项目名称:university,代码行数:17,代码来源:bloc.py


示例20: main

def main():
    """
    The main method of the nuncium application will initialize the execution of
    the program. Threads will be used to query for user input. Each window has
    its own thread to manage the update of its own interface.
    """

    # UI object: The user interface of the nuncium application.
    ui = UI()

    # Integer: The height will consist of the entire screen and the width will
    #          consist of approximately 1/5 of the screen's width.
    height = curses.LINES
    width = int(curses.COLS / 5)

    # String: The default news category that is displayed on startup.
    category = "Top Stories"

    # Window object: The window that will render the menu interface.
    menu_window = ui.window(height, width)
    ui.display_menu(menu_window, category, color=curses.COLOR_BLUE)

    # Integer: The starting position in the x-coordinate of the news window will
    #          be rendered where the last window left off. The width of the news
    #          window will consist of the remaining free space.
    x = width
    width = curses.COLS - width

    # Window object: The window that will render the news content.
    news_window = ui.window(height, width, x, y=0)

    # News object: The news aggregator of the nunicum application.
    news = News()
    news.fetch_news(ui, news_window)

    ui.cursor(menu_window, x=1, y=1, y2=1, current="Top Stories")

    # Thread object: A thread used for updating the menu and news content.
    menu_thread = Thread(target=update, args=(menu_window,), daemon=True)
    news_thread = Thread(target=update, args=(news_window,), daemon=True)

    menu_thread.start()
    news_thread.start()

    # Wait for the threads to finish working.
    while running:
        pass

    ui.cleanup()
开发者ID:massimoca,项目名称:nuncium,代码行数:49,代码来源:nuncium.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python ui.Ui类代码示例发布时间:2022-05-27
下一篇:
Python ui.set_dialog函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap