當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。