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


Python urwid.MainLoop方法代码示例

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


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

示例1: __init__

# 需要导入模块: import urwid [as 别名]
# 或者: from urwid import MainLoop [as 别名]
def __init__(self, connection_name):
        try:
            self.connection_name = connection_name
            frame = self.getFrame()
            comp = self.getCommandProcessor()
            self.loop = urwid.MainLoop(urwid.AttrMap(frame, 'bg'),
                                        unhandled_input=comp.onInput,
                                        palette=themes['dark'])

            self.consoleMonitor = ScreepsConsoleMonitor(connection_name,
                                                        self.consoleWidget,
                                                        self.listWalker,
                                                        self.loop)

            comp.setDisplayWidgets(self.loop,
                                   frame,
                                   self.getConsole(),
                                   self.getConsoleListWalker(),
                                   self.getEdit(),
                                   self.consoleMonitor)
            self.loop.run()
        except KeyboardInterrupt:
            exit(0) 
开发者ID:screepers,项目名称:screeps_console,代码行数:25,代码来源:interactive.py

示例2: setup_widgets

# 需要导入模块: import urwid [as 别名]
# 或者: from urwid import MainLoop [as 别名]
def setup_widgets(self):
        self.intro_frame = urwid.LineBox(
            urwid.Filler(
                urwid.Text(('body_text', self.INTRO_MESSAGE.format("")), align=urwid.CENTER),
                valign=urwid.MIDDLE,
            )
        )

        self.frame = urwid.Frame(
            body=self.intro_frame,
            footer=urwid.Text(
                [self.FOOTER_START, ('heartbeat_inactive', self.HEARTBEAT_ICON)],
                align=urwid.CENTER
            )
        )

        self.loop = urwid.MainLoop(
            urwid.AttrMap(self.frame, 'body_text'),
            unhandled_input=show_or_exit,
            palette=PALETTE,
        )

        self.list_walker = urwid.SimpleListWalker(self.message_list)
        self.list_box = urwid.ListBox(self.list_walker)
        urwid.connect_signal(self.list_walker, "modified", self.item_focused) 
开发者ID:CaliDog,项目名称:certstream-python,代码行数:27,代码来源:gui.py

示例3: __init__

# 需要导入模块: import urwid [as 别名]
# 或者: from urwid import MainLoop [as 别名]
def __init__(self, client):
        self.client = client

        self.screen = urwid.raw_display.Screen()
        # self.screen = self.DummyScreen()

        self.frame = urwid.Frame(
            client.default_view,
            footer=urwid.Text("", align='center'),
        )

        self.client.frame = self.frame

        self.urwid_loop = urwid.MainLoop(
            self.frame,
            screen=self.screen,
            palette=palette,
            event_loop=self.FixedAsyncLoop(loop=client.loop),
            unhandled_input=client.handle_keypresses,
            pop_ups=True
        ) 
开发者ID:Fitblip,项目名称:wsstat,代码行数:23,代码来源:gui.py

示例4: main

# 需要导入模块: import urwid [as 别名]
# 或者: from urwid import MainLoop [as 别名]
def main():

    app = App()
    app.cfg = Config()

    app.hosts = load_test_data()

    page = UI_Credentials(parent=app)

    page.refresh()

    ui = page.render_page

    app.loop = urwid.MainLoop(ui,
                              palette,
                              unhandled_input=unknown_input)
    app.loop.run() 
开发者ID:pcuzner,项目名称:ceph-ansible-copilot,代码行数:19,代码来源:test_ui.py

示例5: run

# 需要导入模块: import urwid [as 别名]
# 或者: from urwid import MainLoop [as 别名]
def run():
    loop = MainLoop(wrapper, palette, handle_mouse=False,
                    unhandled_input=key_pressed)
    loop.run() 
开发者ID:leejaycoke,项目名称:ec2-gazua,代码行数:6,代码来源:gazua.py

示例6: main

# 需要导入模块: import urwid [as 别名]
# 或者: from urwid import MainLoop [as 别名]
def main(self) -> None:
        screen = Screen()
        screen.set_terminal_properties(colors=self.color_depth)
        self.loop = urwid.MainLoop(self.view,
                                   self.theme,
                                   screen=screen)
        self.update_pipe = self.loop.watch_pipe(self.draw_screen)

        # Register new ^C handler
        signal.signal(signal.SIGINT, self.exit_handler)

        try:
            # TODO: Enable resuming? (in which case, remove ^Z below)
            disabled_keys = {
                'susp': 'undefined',  # Disable ^Z - no suspending
                'stop': 'undefined',  # Disable ^S - enabling shortcut key use
                'quit': 'undefined',  # Disable ^\, ^4
            }
            old_signal_list = screen.tty_signal_keys(**disabled_keys)
            self.loop.run()

        except Exception:
            self.restore_stdout()
            screen.tty_signal_keys(*old_signal_list)
            raise

        finally:
            self.restore_stdout()
            screen.tty_signal_keys(*old_signal_list) 
开发者ID:zulip,项目名称:zulip-terminal,代码行数:31,代码来源:core.py

示例7: __init__

# 需要导入模块: import urwid [as 别名]
# 或者: from urwid import MainLoop [as 别名]
def __init__(self):
        self.prefs = bbjrc("load")
        self.client_pinned_threads = load_client_pins()
        self.usermap = {}
        self.match_data = {
            "query": "",
            "matches": [],
            "position": 0,
        }

        try:
            self.theme = themes[self.prefs["frame_theme"]].copy()
            if isinstance(self.prefs["custom_divider_char"], str):
                self.theme["divider"] = self.prefs["custom_divider_char"]
        except KeyError:
            exit("Selected theme does not exist. Please check "
                 "the `frame_theme` value in ~/.bbjrc")

        self.mode = None
        self.thread = None
        self.window_split = False
        self.last_index_pos = None
        self.last_alarm = None

        if self.prefs["use_custom_frame_title"]:
            self.frame_title = self.prefs["frame_title"]
        else:
            self.frame_title = network.instance_info["instance_name"]

        self.walker = urwid.SimpleFocusListWalker([])
        self.box = ActionBox(self.walker)
        self.body = urwid.AttrMap(
            urwid.LineBox(self.box, **self.frame_theme(self.frame_title)),
            "default"
        )
        self.loop = urwid.MainLoop(
            urwid.Frame(self.body),
            palette=colormap,
            handle_mouse=self.prefs["mouse_integration"]) 
开发者ID:bbj-dev,项目名称:bbj,代码行数:41,代码来源:main.py

示例8: wipe_screen

# 需要导入模块: import urwid [as 别名]
# 或者: from urwid import MainLoop [as 别名]
def wipe_screen(*_):
    """
    A crude hack to repaint the whole screen. I didnt immediately
    see anything to acheive this in the MainLoop methods so this
    will do, I suppose.
    """
    app.loop.stop()
    call("clear", shell=True)
    app.loop.start() 
开发者ID:bbj-dev,项目名称:bbj,代码行数:11,代码来源:main.py

示例9: loop

# 需要导入模块: import urwid [as 别名]
# 或者: from urwid import MainLoop [as 别名]
def loop(self, *args, **kwargs):
        kwargs.setdefault('unhandled_input', self.unhandled_input)
        loop = urwid.MainLoop(self.widget, self.palette, *args, **kwargs)
        return loop 
开发者ID:what-studio,项目名称:profiling,代码行数:6,代码来源:viewer.py

示例10: __init__

# 需要导入模块: import urwid [as 别名]
# 或者: from urwid import MainLoop [as 别名]
def __init__(self, update_mission=None, spin_switch=None):
    self.update_mission = update_mission or self.nothing
    self.spin_switch = spin_switch or self.nothing


    self.initAll()
    self.loop = urwid.MainLoop(self.columns, self.palette,
                                   unhandled_input=self._unhandled) 
开发者ID:AlexisTM,项目名称:flyingros,代码行数:10,代码来源:urwid_app.py

示例11: run

# 需要导入模块: import urwid [as 别名]
# 或者: from urwid import MainLoop [as 别名]
def run(self):
        loop = urwid.MainLoop(self._w, PALETTE, unhandled_input=self.unhandled_input, #pop_ups=True,
                event_loop=eventloop.PycopiaEventLoop())
        loop.run() 
开发者ID:kdart,项目名称:pycopia,代码行数:6,代码来源:widgets.py

示例12: run

# 需要导入模块: import urwid [as 别名]
# 或者: from urwid import MainLoop [as 别名]
def run(self):
        self.loop = urwid.MainLoop(self.top, widgets.PALETTE, unhandled_input=self.unhandled_input,
                event_loop=eventloop.PycopiaEventLoop())
        self.loop.run()
        self.loop = None 
开发者ID:kdart,项目名称:pycopia,代码行数:7,代码来源:main.py

示例13: run

# 需要导入模块: import urwid [as 别名]
# 或者: from urwid import MainLoop [as 别名]
def run(self):
        loop = urwid.MainLoop(self, PALETTE, unhandled_input=self.unhandled_input, pop_ups=True,
                event_loop=urwid.GLibEventLoop())
        loop.run() 
开发者ID:kdart,项目名称:pycopia,代码行数:6,代码来源:widgets.py

示例14: run

# 需要导入模块: import urwid [as 别名]
# 或者: from urwid import MainLoop [as 别名]
def run(self):
        self.loop = urwid.MainLoop(self.top, widgets.PALETTE,
                unhandled_input=self.unhandled_input, pop_ups=True, event_loop=eventloop.PycopiaEventLoop())
        self.loop.run()
        self.loop = None 
开发者ID:kdart,项目名称:pycopia,代码行数:7,代码来源:main.py

示例15: __init__

# 需要导入模块: import urwid [as 别名]
# 或者: from urwid import MainLoop [as 别名]
def __init__(self, config):
        self._loading = False
        self.config = config
        self.quick_switcher = None
        self.set_snooze_widget = None
        self.workspaces = list(config['workspaces'].items())
        self.store = Store(self.workspaces, self.config)
        Store.instance = self.store
        urwid.set_encoding('UTF-8')
        sidebar = LoadingSideBar()
        chatbox = LoadingChatBox('Everything is terrible!')
        palette = themes.get(config['theme'], themes['default'])

        custom_loop = SclackEventLoop(loop=loop)
        custom_loop.set_exception_handler(self._exception_handler)

        if len(self.workspaces) <= 1:
            self.workspaces_line = None
        else:
            self.workspaces_line = Workspaces(self.workspaces)

        self.columns = urwid.Columns([
            ('fixed', config['sidebar']['width'], urwid.AttrWrap(sidebar, 'sidebar')),
            urwid.AttrWrap(chatbox, 'chatbox')
        ])
        self._body = urwid.Frame(self.columns, header=self.workspaces_line)

        self.urwid_loop = urwid.MainLoop(
            self._body,
            palette=palette,
            event_loop=custom_loop,
            unhandled_input=self.unhandled_input
        )
        self.configure_screen(self.urwid_loop.screen)
        self.last_keypress = (0, None) 
开发者ID:haskellcamargo,项目名称:sclack,代码行数:37,代码来源:app.py


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