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


Python urwid.SolidFill方法代码示例

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


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

示例1: _construct_spacer

# 需要导入模块: import urwid [as 别名]
# 或者: from urwid import SolidFill [as 别名]
def _construct_spacer(self, pos, acc):
        """
        build a spacer that occupies the horizontally indented space between
        pos's parent and the root node. It will return a list of tuples to be
        fed into a Columns widget.
        """
        parent = self._walker.parent_position(pos)
        if parent is not None:
            grandparent = self._walker.parent_position(parent)
            if self._indent > 0 and grandparent is not None:
                parent_sib = self._walker.next_sibling_position(parent)
                draw_vbar = parent_sib is not None and self._arrow_vbar_char is not None
                space_width = self._indent - 1 * (
                    draw_vbar) - self._childbar_offset
                if space_width > 0:
                    void = AttrMap(urwid.SolidFill(' '), self._arrow_att)
                    acc.insert(0, ((space_width, void)))
                if draw_vbar:
                    barw = urwid.SolidFill(self._arrow_vbar_char)
                    bar = AttrMap(
                        barw, self._arrow_vbar_att or self._arrow_att)
                    acc.insert(0, ((1, bar)))
            return self._construct_spacer(parent, acc)
        else:
            return acc 
开发者ID:kdart,项目名称:pycopia,代码行数:27,代码来源:treewidgets.py

示例2: on_unicode_checkbox

# 需要导入模块: import urwid [as 别名]
# 或者: from urwid import SolidFill [as 别名]
def on_unicode_checkbox(self, w=None, state=False):
        """Enable smooth edges if utf-8 is supported"""
        logging.debug("unicode State is %s", state)

        # Update the controller to the state of the checkbox
        self.controller.smooth_graph_mode = state
        if state:
            self.hline = urwid.AttrWrap(
                urwid.SolidFill(u'\N{LOWER ONE QUARTER BLOCK}'), 'line')
        else:
            self.hline = urwid.AttrWrap(urwid.SolidFill(u' '), 'line')

        for graph in self.graphs.values():
            graph.set_smooth_colors(state)

        self.show_graphs() 
开发者ID:amanusk,项目名称:s-tui,代码行数:18,代码来源:s_tui.py

示例3: test_overlay

# 需要导入模块: import urwid [as 别名]
# 或者: from urwid import SolidFill [as 别名]
def test_overlay(self):
        s1 = urwid.SolidFill(u'1')
        s2 = urwid.SolidFill(u'2')
        o = urwid.Overlay(s1, s2,
            'center', ('relative', 50), 'middle', ('relative', 50))
        self.assertEqual(o.focus, s1)
        self.assertEqual(o.focus_position, 1)
        self.assertRaises(IndexError, lambda: setattr(o, 'focus_position',
            None))
        self.assertRaises(IndexError, lambda: setattr(o, 'focus_position', 2))

        self.assertEqual(o.contents[0], (s2,
            urwid.Overlay._DEFAULT_BOTTOM_OPTIONS))
        self.assertEqual(o.contents[1], (s1, (
            'center', None, 'relative', 50, None, 0, 0,
            'middle', None, 'relative', 50, None, 0, 0))) 
开发者ID:AnyMesh,项目名称:anyMesh-Python,代码行数:18,代码来源:test_container.py

示例4: test_focus_path

# 需要导入模块: import urwid [as 别名]
# 或者: from urwid import SolidFill [as 别名]
def test_focus_path(self):
        # big tree of containers
        t = urwid.Text(u'x')
        e = urwid.Edit(u'?')
        c = urwid.Columns([t, e, t, t])
        p = urwid.Pile([t, t, c, t])
        a = urwid.AttrMap(p, 'gets ignored')
        s = urwid.SolidFill(u'/')
        o = urwid.Overlay(e, s, 'center', 'pack', 'middle', 'pack')
        lb = urwid.ListBox(urwid.SimpleFocusListWalker([t, a, o, t]))
        lb.focus_position = 1
        g = urwid.GridFlow([t, t, t, t, e, t], 10, 0, 0, 'left')
        g.focus_position = 4
        f = urwid.Frame(lb, header=t, footer=g)

        self.assertEqual(f.get_focus_path(), ['body', 1, 2, 1])
        f.set_focus_path(['footer']) # same as f.focus_position = 'footer'
        self.assertEqual(f.get_focus_path(), ['footer', 4])
        f.set_focus_path(['body', 1, 2, 2])
        self.assertEqual(f.get_focus_path(), ['body', 1, 2, 2])
        self.assertRaises(IndexError, lambda: f.set_focus_path([0, 1, 2]))
        self.assertRaises(IndexError, lambda: f.set_focus_path(['body', 2, 2]))
        f.set_focus_path(['body', 2]) # focus the overlay
        self.assertEqual(f.get_focus_path(), ['body', 2, 1]) 
开发者ID:AnyMesh,项目名称:anyMesh-Python,代码行数:26,代码来源:test_container.py

示例5: get_app_in_loop

# 需要导入模块: import urwid [as 别名]
# 或者: from urwid import SolidFill [as 别名]
def get_app_in_loop(pallete):
    screen = urwid.raw_display.Screen()
    screen.set_terminal_properties(256)
    screen.register_palette(pallete)

    ui = UI(urwid.SolidFill())
    decorated_ui = urwid.AttrMap(ui, "root")
    loop = ThreadSafeLoop(decorated_ui, screen=screen, event_loop=urwid.AsyncioEventLoop(),
                          handle_mouse=False)
    ui.loop = loop

    return loop, ui 
开发者ID:TomasTomecek,项目名称:sen,代码行数:14,代码来源:ui.py

示例6: _construct_line

# 需要导入模块: import urwid [as 别名]
# 或者: from urwid import SolidFill [as 别名]
def _construct_line(self, pos):
        """
        builds a list element for given position in the tree.
        It consists of the original widget taken from the TreeWalker and some
        decoration columns depending on the existence of parent and sibling
        positions. The result is a urwid.Culumns widget.
        """
        line = None
        if pos is not None:
            indent = self._walker.depth(pos) * self._indent
            cols = [(indent, urwid.SolidFill(' ')),  # spacer
                    self._walker[pos]]  # original widget ]
            # construct a Columns, defining all spacer as Box widgets
            line = urwid.Columns(cols, box_columns=range(len(cols))[:-1])
        return line 
开发者ID:kdart,项目名称:pycopia,代码行数:17,代码来源:treewidgets.py

示例7: __init__

# 需要导入模块: import urwid [as 别名]
# 或者: from urwid import SolidFill [as 别名]
def __init__(self, controller):
        # constants
        self.left_margin = 0
        self.top_margin = 0

        # main control
        self.controller = controller
        self.main_window_w = []

        # general urwid items
        self.clock_view = urwid.Text(ZERO_TIME, align="center")
        self.refresh_rate_ctrl = urwid.Edit((u'Refresh[s]:'),
                                            self.controller.refresh_rate)
        self.hline = urwid.AttrWrap(urwid.SolidFill(u' '), 'line')

        self.mode_buttons = []

        self.summary_widget_index = None

        # Visible graphs are the graphs currently displayed, this is a
        # subset of the available graphs for display
        self.graph_place_holder = urwid.WidgetPlaceholder(urwid.Pile([]))

        # construct the various menus during init phase
        self.stress_menu = StressMenu(self.on_menu_close,
                                      self.controller.stress_exe)
        self.help_menu = HelpMenu(self.on_menu_close)
        self.about_menu = AboutMenu(self.on_menu_close)
        self.graphs_menu = SensorsMenu(self.on_graphs_menu_close,
                                       self.controller.sources,
                                       self.controller.graphs_default_conf)
        self.summary_menu = SensorsMenu(self.on_summary_menu_close,
                                        self.controller.sources,
                                        self.controller.summary_default_conf)

        # call super
        urwid.WidgetPlaceholder.__init__(self, self.main_window())
        urwid.connect_signal(self.refresh_rate_ctrl, 'change',
                             self.update_refresh_rate) 
开发者ID:amanusk,项目名称:s-tui,代码行数:41,代码来源:s_tui.py

示例8: solidfill

# 需要导入模块: import urwid [as 别名]
# 或者: from urwid import SolidFill [as 别名]
def solidfill(s, theme='basic'):
    return urwid.AttrMap(urwid.SolidFill(s), theme) 
开发者ID:vilmibm,项目名称:tildemush,代码行数:4,代码来源:ui.py

示例9: __init__

# 需要导入模块: import urwid [as 别名]
# 或者: from urwid import SolidFill [as 别名]
def __init__(self, loop):
        base = urwid.SolidFill("")
        self.loop = urwid.MainLoop(
            base,
            event_loop=urwid.AsyncioEventLoop(loop=loop),
            palette=palettes)
        self.base = base 
开发者ID:vilmibm,项目名称:tildemush,代码行数:9,代码来源:ui.py

示例10: __init__

# 需要导入模块: import urwid [as 别名]
# 或者: from urwid import SolidFill [as 别名]
def __init__(self, text, width, host_view, loop=None):
        self.running = False
        self.lock = EasyLock()
        self.loop = loop
        self.overlay = urwid.Overlay(
            urwid.LineBox(urwid.Text(text)), host_view,  # urwid.SolidFill(),
            'center', width, 'middle', None)
        urwid.Frame.__init__(self, self.overlay) 
开发者ID:chishui,项目名称:terminal-leetcode,代码行数:10,代码来源:loading.py

示例11: show_loading

# 需要导入模块: import urwid [as 别名]
# 或者: from urwid import SolidFill [as 别名]
def show_loading(self, text, width, host_view=urwid.SolidFill()):
        self.loading_view = LoadingView(text, width, host_view, self.loop)
        self.loop.widget = self.loading_view
        self.loading_view.start() 
开发者ID:chishui,项目名称:terminal-leetcode,代码行数:6,代码来源:terminal.py

示例12: createLoop

# 需要导入模块: import urwid [as 别名]
# 或者: from urwid import SolidFill [as 别名]
def createLoop(self):
        placeholder = urwid.SolidFill()
        urwid.set_encoding("UTF-8")
        self.loop = urwid.MainLoop(placeholder,self.palette,unhandled_input=exit_on_alt_q)
        self.loop.screen.set_terminal_properties(colors=256)
        self.loop.widget = urwid.AttrMap(placeholder, 'bg')
        self.loop.widget.original_widget = urwid.Filler(self.createLayout())
        self.loop.run() 
开发者ID:huanglizhuo,项目名称:TWchat,代码行数:10,代码来源:gui.py

示例13: test_zero_weight

# 需要导入模块: import urwid [as 别名]
# 或者: from urwid import SolidFill [as 别名]
def test_zero_weight(self):
        p = urwid.Pile([
            urwid.SolidFill('a'),
            ('weight', 0, urwid.SolidFill('d')),
            ])
        p.render((5, 4)) 
开发者ID:AnyMesh,项目名称:anyMesh-Python,代码行数:8,代码来源:test_container.py

示例14: test_old_attributes

# 需要导入模块: import urwid [as 别名]
# 或者: from urwid import SolidFill [as 别名]
def test_old_attributes(self):
        c = urwid.Columns([urwid.Text(u'a'), urwid.SolidFill(u'x')],
            box_columns=[1])
        self.assertEqual(c.box_columns, [1])
        c.box_columns=[]
        self.assertEqual(c.box_columns, []) 
开发者ID:AnyMesh,项目名称:anyMesh-Python,代码行数:8,代码来源:test_container.py

示例15: test_old_params

# 需要导入模块: import urwid [as 别名]
# 或者: from urwid import SolidFill [as 别名]
def test_old_params(self):
        o1 = urwid.Overlay(urwid.SolidFill(u'X'), urwid.SolidFill(u'O'),
            ('fixed left', 5), ('fixed right', 4),
            ('fixed top', 3), ('fixed bottom', 2),)
        self.assertEqual(o1.contents[1][1], (
            'left', None, 'relative', 100, None, 5, 4,
            'top', None, 'relative', 100, None, 3, 2))
        o2 = urwid.Overlay(urwid.SolidFill(u'X'), urwid.SolidFill(u'O'),
            ('fixed right', 5), ('fixed left', 4),
            ('fixed bottom', 3), ('fixed top', 2),)
        self.assertEqual(o2.contents[1][1], (
            'right', None, 'relative', 100, None, 4, 5,
            'bottom', None, 'relative', 100, None, 2, 3)) 
开发者ID:AnyMesh,项目名称:anyMesh-Python,代码行数:15,代码来源:test_container.py


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