Ejemplo n.º 1
0
    def setup_view(self):
        self.object_buttons = self.get_object_buttons()

        # Title
        self.bigtext = urwid.BigText('pyrasite ' + __version__, None)
        self.bigtext.set_font(urwid.Thin6x6Font())
        bt = urwid.Padding(self.bigtext, 'left', None)
        bt = urwid.AttrWrap(bt, 'bigtext')

        # Create the object outpu
        self.object_output = urwid.Text("", wrap='any')
        ca = urwid.AttrWrap(self.object_output, 'object_output')

        # Select the first object
        self.object_buttons[2].set_state(True)

        # ListBox
        obj_out = urwid.Pile([urwid.Divider(), ca])
        objects = urwid.Pile(self.object_buttons)
        l = [objects, obj_out]
        w = urwid.ListBox(urwid.SimpleListWalker(l))

        # Frame
        w = urwid.AttrWrap(w, 'body')
        w = urwid.Frame(header=bt, body=w)

        # Exit message
        exit = urwid.BigText(('exit', " Quit? "), urwid.Thin6x6Font())
        exit = urwid.Overlay(exit, w, 'center', None, 'middle', None)

        return w, exit
Ejemplo n.º 2
0
    def setup_view(self):
        fonts = urwid.get_all_fonts()
        # setup mode radio buttons
        self.font_buttons = []
        group = []
        utf8 = urwid.get_encoding_mode() == "utf8"
        for name, fontcls in fonts:
            font = fontcls()
            if font.utf8_required and not utf8:
                rb = self.create_disabled_radio_button(name)
            else:
                rb = self.create_radio_button(group, name, font,
                    self.set_font_event)
                if fontcls == urwid.Thin6x6Font:
                    chosen_font_rb = rb
                    exit_font = font
            self.font_buttons.append( rb )

        # Create BigText
        self.bigtext = urwid.BigText("", None)
        bt = SwitchingPadding(self.bigtext, 'left', None)
        bt = urwid.AttrWrap(bt, 'bigtext')
        bt = urwid.Filler(bt, 'bottom', None, 7)
        bt = urwid.BoxAdapter(bt, 7)

        # Create chars_avail
        cah = urwid.Text("Characters Available:")
        self.chars_avail = urwid.Text("", wrap='any')
        ca = urwid.AttrWrap(self.chars_avail, 'chars')

        chosen_font_rb.set_state(True) # causes set_font_event call

        # Create Edit widget
        edit = self.create_edit("", "Urwid "+urwid.__version__,
            self.edit_change_event)

        # ListBox
        chars = urwid.Pile([cah, ca])
        fonts = urwid.Pile([urwid.Text("Fonts:")] + self.font_buttons,
            focus_item=1)
        col = urwid.Columns([('fixed',16,chars), fonts], 3,
            focus_column=1)
        bt = urwid.Pile([bt, edit], focus_item=1)
        l = [bt, urwid.Divider(), col]
        w = urwid.ListBox(urwid.SimpleListWalker(l))

        # Frame
        w = urwid.AttrWrap(w, 'body')
        hdr = urwid.Text("Urwid BigText example program - F8 exits.")
        hdr = urwid.AttrWrap(hdr, 'header')
        w = urwid.Frame(header=hdr, body=w)

        # Exit message
        exit = urwid.BigText(('exit'," Quit? "), exit_font)
        exit = urwid.Overlay(exit, w, 'center', None, 'middle', None)
        return w, exit
Ejemplo n.º 3
0
 def test_overlay(self):
     self.wstest(
         urwid.Overlay(urwid.BigText("hello", urwid.Thin6x6Font()),
                       urwid.SolidFill(), 'center', None, 'middle', None))
     self.wstest(
         urwid.Overlay(urwid.Text("hello"), urwid.SolidFill(), 'center',
                       ('relative', 100), 'middle', None))
Ejemplo n.º 4
0
    def __init__(self, parent, language=modulehelper.LanguageType.CHINESE):
        self.parent = parent
        self.screen = None
        self.name = 'Login'
        self.visible = True
        self.language = language
        self.user = "******"

        ##draw header_content
        # logo
        self.logo = urwid.AttrWrap(urwid.BigText('DASONE', urwid.Thin6x6Font()), 'red')
        self.logo_padded = urwid.Padding(self.logo, 'center', None)
        self.logo_pd_fd = urwid.Filler(self.logo_padded, 'bottom', 'pack')
        self.logo = urwid.BoxAdapter(self.logo_pd_fd, 8)
        # user with fixed name
        self.name_field = urwid.AttrWrap(urwid.Text(["USER:"******"SYSADMIN")]), 'red')

        # every time login in has a challenge for forgetting password in case
        self.challenge_generate = self.get_challenge()
        self.challenge_field = urwid.AttrWrap(urwid.Text(["CHALLENGE:".ljust(20),
                                                          ('editcp', self.challenge_generate)]), 'red')

        #create header_content
        self.header_content = [self.logo, blank, blank, self.name_field, self.challenge_field]

        ## draw_fields with default info
        self.fields = ['SYS_PASSWORD']
        self.defaults = \
            {
                "SYS_PASSWORD": {"label": "PASSWORD",
                               "tooltip": "if you forget password, contact with us and login using a challenge code",
                               "value": ""}
            }
Ejemplo n.º 5
0
 def __init__(self, exit=lambda _:True):
     bt = urwid.BigText('WELCOME TO TILDEMUSH', urwid.font.HalfBlock5x4Font())
     bt = urwid.Padding(bt, 'center', None)
     bt = urwid.Filler(bt, 'middle', None, 7)
     ftr = ColorText('~ press any key to jack in ~', align='center')
     self.base = urwid.Frame(body=bt, footer=ftr)
     super().__init__(self.base, exit=exit)
Ejemplo n.º 6
0
 def __init__(self):
     font = urwid.font.HalfBlock5x4Font()
     txt = urwid.BigText("Spotidex", font)
     txt = urwid.Padding(txt, "center", width="clip")
     version = urwid.Text(("border", "v 1.0"), align='center')
     div = urwid.Divider(top=4)
     self.__body = [txt, version, div]
Ejemplo n.º 7
0
 def buildtui(self):
     self.footer=urwid.Text(('footer','Hotkeys: [S]top run, [T]erminate, [Q]uit'))
     footer=urwid.Padding(self.footer)
     footer=urwid.AttrWrap(footer,'footer')
     header=urwid.Columns([
       ('pack',urwid.Text('ITS3 Run Control')),
       urwid.Text(' '),
       ('pack',urwid.Text('V1.0')),
     ])
     header=urwid.AttrWrap(header,'header')
     self.state=urwid.BigText('',font=self.statefont)
     self.progress_tot=urwid_timed_progress.TimedProgressBar('progress-normal','progress-complete',label='TOTAL:',      label_width=12,units='runs'  ,done=len(self.rc.configs))
     self.progress_run=urwid_timed_progress.TimedProgressBar('progress-normal','progress-complete',label='Current run:',label_width=12,units='events',done=1)
     progress=urwid.BoxAdapter(urwid.ListBox([
       self.progress_tot,
       self.progress_run,
     ]),height=4)
     self.producers={}
     self.collectors={}
     self.configs_list=urwid.Text('')
     main=urwid.ListBox([
       urwid.LineBox(urwid.Padding(self.state,'center',None),title='Status'),
       urwid.LineBox(progress,title='Progress'),
       urwid.LineBox(self.build_table(self.rc.dataproducers+self.rc.moreproducers,self.producers),title='Producers'),
       urwid.LineBox(self.build_table(self.rc.collectors,self.collectors),title='Collector(s)'),
       urwid.LineBox(self.configs_list, title='Pending configs')
     ])
     return urwid.Frame(main,header=header,footer=footer)
Ejemplo n.º 8
0
 def setup_view(self):
     color = 'start' if self.seconds > 3 else 'finish'
     self.count_text = urwid.BigText(
         time.strftime('%H:%M:%S', time.gmtime(self.seconds)),
         urwid.font.HalfBlock6x5Font())
     self.view = urwid.Padding(self.count_text, 'center', width='clip')
     self.view = urwid.AttrMap(self.view, color)
     self.view = urwid.Filler(self.view, 'middle')
Ejemplo n.º 9
0
 def configurer_horloge(self):
     text = time.strftime('%H:%M:%S')
     font = urwid.font.HalfBlock7x7Font()
     self.texte_horloge = urwid.BigText(text, font)
     self.horloge = urwid.Filler(
         urwid.AttrMap(
             urwid.Padding(self.texte_horloge, 'center', width='clip'),
             'horloge'), 'middle')
Ejemplo n.º 10
0
 def configurer_horloge(self):
     text = time.strftime("%H:%M:%S")
     font = urwid.font.HalfBlock7x7Font()
     self.texte_horloge = urwid.BigText(text, font)
     self.horloge = urwid.Filler(
         urwid.AttrMap(
             urwid.Padding(self.texte_horloge, "center", width="clip"),
             "horloge"), "middle")
Ejemplo n.º 11
0
 def u(self):
     mc = uC([
         ('weight',2,uT(str(self.world.turn_order))),
         ('weight', 10, uP([(500,self.deck.u())])),
         urwid.Padding(urwid.BigText(str(self.life), urwid.font.HalfBlock5x4Font()), 'right', width='clip',right=1),
     ])
     m = uLineB(uA(uF(mc),'default'), title=self.name)
     return m
Ejemplo n.º 12
0
def init_widget():
    banner = urwid.BigText(markup=("programpresentation", "Windows Exploder"),
                           font=urwid.HalfBlock5x4Font())
    banner = urwid.Padding(w=banner, align="center", width="clip")
    signature = urwid.Text(markup=("programpresentation",
                                   "V.0.1 by Olav Fønstelien"),
                           align="center")
    divider = [urwid.Divider()] * 5
    return urwid.SimpleListWalker(divider + [banner, signature])
Ejemplo n.º 13
0
    def __init__(self, settings, greet, font):
        self.group = []
        self.gui_items = urwid.SimpleListWalker([])
        self.cli_items = urwid.SimpleListWalker([])

        #header = urwid.AttrMap(urwid.Text('selected:'), 'head')
        self.gui_listbox = urwid.ListBox(self.gui_items)
        #add widget for consolekit checkbox
        self.cli_listbox = urwid.ListBox(self.cli_items)
        #add widget for fbterm checkbox and settings
        self.fb_check = urwid.CheckBox("Enable background image", state=False)
        self.ck_check = urwid.CheckBox("Enable Consolekit", state=False)

        cli_box = urwid.Pile([
            urwid.BoxAdapter(self.cli_listbox, 15),
            urwid.AttrMap(self.fb_check, 'body', 'body')
        ])
        gui_box = urwid.Pile([
            urwid.BoxAdapter(self.gui_listbox, 15),
            urwid.AttrMap(self.ck_check, 'body', 'body')
        ])

        tabs = TabColumns([
            urwid.AttrWrap(SelText("GUI"), 'tab active', 'focus'),
            urwid.AttrWrap(SelText("CLI"), 'body', 'focus')
        ], [urwid.Filler(gui_box),
            urwid.Filler(cli_box)], 'Sessions')

        ulabel = urwid.Text("Username")
        plabel = urwid.Text("Password")
        utext = urwid.Edit()
        ptext = urwid.Edit(mask="*")
        ustuff = urwid.Columns(
            [urwid.AttrWrap(ulabel, 'uname'),
             urwid.AttrWrap(utext, 'uname')])
        pstuff = urwid.Columns(
            [urwid.AttrWrap(plabel, 'pw'),
             urwid.AttrWrap(ptext, 'pw')])
        ffont = font()
        banner = urwid.BigText(greet, ffont)
        banner = urwid.AttrWrap(banner, 'banner')
        banner = urwid.Padding(banner, 'left', width='clip')
        banner = urwid.Filler(banner, height=ffont.height)

        #banner = urwid.Padding(banner,align='center')
        login_details = urwid.Pile([
            ustuff, pstuff,
            urwid.AttrWrap(urwid.Text("Press enter to log in"), 'body', 'body')
        ])
        #sessions_box = urwid.Pile([urwid.Text("Sessions"),
        #							urwid.BoxAdapter(listbox, 40)])
        self.__super.__init__(
            [banner,
             urwid.Columns([urwid.Filler(login_details), tabs])])
        self.username = utext
        self.password = ptext
        urwid.connect_signal(utext, 'change', self.refresh_sessions, settings)
Ejemplo n.º 14
0
 def _setup_splash(self):
     logger.info("Creating splash window")
     self.splash_screen = uw.Overlay(
         top_w=uw.BigText(APPLICATION_NAME, uw.Thin6x6Font()),
         bottom_w=uw.SolidFill(),
         align="center",
         width=None,
         valign="middle",
         height=None,
     )
Ejemplo n.º 15
0
 def _create_layout(self) -> urwid.Widget:
     btxt = urwid.BigText("Openvario", urwid.font.Thin6x6Font())
     splash = urwid.Filler(urwid.Padding(btxt, "center", "clip"), "middle")
     self._main_view.original_widget = splash
     self._header = TopBar()
     self._footer = FooterBar()
     return urwid.Frame(
         self._main_view,
         header=self._header,
         footer=urwid.AttrMap(self._footer, "bg"),
     )
Ejemplo n.º 16
0
    def __init__(self, service):
        super().__init__()
        self.service = service

        self.loc_text = urwid.Text('')
        font = urwid.font.HalfBlock7x7Font()
        self.temp_text = urwid.BigText('', font)
        self.desc_text = urwid.Text('')
        self.wind_text = urwid.Text('')
        self.hum_text = urwid.Text('')
        self.upd_text = urwid.Text('')
Ejemplo n.º 17
0
    def __init__(self, modes):
        self.modes = modes

        self.background = urwid.Frame(body=urwid.SolidFill())
        self.clocktext = urwid.BigText('clock', urwid.HalfBlock7x7Font())
        self.modetext = urwid.BigText('mode', urwid.HalfBlock7x7Font())
        self.overlay = urwid.Overlay(self.clocktext, self.background, 'center',
                                     None, 'middle', None)
        self.overlay = urwid.Overlay(self.modetext,
                                     self.overlay,
                                     'center',
                                     None,
                                     'middle',
                                     None,
                                     top=20)
        self.loop = urwid.MainLoop(self.overlay,
                                   unhandled_input=self.unhandled_input)

        self.mode_index = -1
        self.update_mode()
Ejemplo n.º 18
0
def display_version(args=None):
    ver = urwid.BigText(('ver', " kanten v" + __version__), exit_font())
    ver = urwid.Overlay(
        ver,
        K.loop.widget,
        'center',
        'pack',
        'middle',
        'pack',
    )
    K.loop.widget = exit
    return True
Ejemplo n.º 19
0
 def poor_man_refresh(self, what_to_do=True):
     temp_minute = datetime.datetime.now().minute
     if temp_minute < 10:
         temp_minute = "0" + str(temp_minute)
     else:
         temp_minute
     clock_element = urwid.AttrMap(
         urwid.BigText(
             "{0}{1}{2}".format(datetime.datetime.now().hour,
                                ":", temp_minute),
             urwid.font.HalfBlock5x4Font()), "clock_c")
     burger = BoxButton('burger',
                        999,
                        is_sprite=True,
                        on_press=self.show_menu,
                        no_border=True,
                        user_data=None,
                        theme=get_theme("burger"))
     button_line_box = urwid.AttrMap(
         urwid.LineBox(urwid.Pile([
             urwid.Divider(" ", top=0, bottom=0),
             urwid.GridFlow(self.buttons_list[self.page_num][0],
                            cell_width=50,
                            h_sep=0,
                            v_sep=2,
                            align='center'),
             urwid.Divider(" ", top=0, bottom=0)
         ]),
                       trcorner=u"\u2584",
                       tlcorner=u"\u2584",
                       tline=u"\u2584",
                       bline=u"\u2580",
                       blcorner=u"\u2580",
                       brcorner=u"\u2580",
                       lline=u"\u2588",
                       rline=u"\u2588"), "outer_box_c")
     base = urwid.Filler(
         urwid.Pile([
             urwid.Columns([
                 urwid.Padding(clock_element, 'left', width='clip'),
                 urwid.Padding(burger, 'right', width=('relative', 19))
             ]), button_line_box,
             urwid.Divider(" ", top=0, bottom=0),
             urwid.GridFlow(self.nav_array,
                            cell_width=50,
                            h_sep=0,
                            v_sep=0,
                            align='center')
         ]), 'top')
     if what_to_do:
         self.loop.widget = base
     else:
         return base
Ejemplo n.º 20
0
    def __init__ (self, title, choices, width = 60, height = 60):
        self.choices = choices
        self.mainpd = urwid.Padding(self.menu(title, choices), left=1, right=1)
        self.top = urwid.Overlay(self.mainpd, urwid.SolidFill(u'\N{MEDIUM SHADE}'),
            align='center', width=('relative', 60),
            valign='middle', height=('relative', 60),
            min_width=20, min_height=9)

        bt = urwid.BigText("Notology.", urwid.font.HalfBlock5x4Font())
        bt = urwid.Padding(bt, "center", width = "clip")
        bt = urwid.Filler(bt, "bottom")
        bt = urwid.BoxAdapter(bt, height = 5)
        self.main_frame = urwid.Frame(self.top, header = bt)
Ejemplo n.º 21
0
    def create(self) -> urwid.Widget:
        btxt = urwid.BigText("Openvario", urwid.font.Thin6x6Font())
        logo = urwid.Padding(btxt, "center", "clip")

        m_pinned_apps = self._get_pinned_apps()
        if m_pinned_apps:
            m_pinned_apps.append(urwid.Divider())

        m_apps = widget.SelectableListItem("Applications")
        urwid.connect_signal(m_apps, "click", self._on_apps)
        m_settings = widget.SelectableListItem("Settings")
        urwid.connect_signal(m_settings, "click", self._on_settings)
        m_shutdown = widget.SelectableListItem("Shut down")
        urwid.connect_signal(m_shutdown, "click", self._on_quit)
        menu = urwid.Pile(
            m_pinned_apps + [m_apps, m_settings, urwid.Divider(), m_shutdown]
        )

        # Reserve space for counter
        self.autostart_counter = urwid.WidgetPlaceholder(
            urwid.BoxAdapter(urwid.SolidFill(" "), 2)
        )

        view = urwid.Filler(
            urwid.Pile(
                [
                    logo,
                    urwid.Text(self._get_version(), align=urwid.CENTER),
                    urwid.Divider(),
                    urwid.Padding(
                        urwid.LineBox(menu, "Main Menu", title_align="left"),
                        width=("relative", 40),
                        align=urwid.CENTER,
                    ),
                    urwid.Divider(),
                    urwid.Divider(),
                    self.autostart_counter,
                ]
            ),
            "middle",
        )
        self.autostart_canceller = AutostartCanceller(view)
        urwid.connect_signal(
            self.autostart_canceller, "anykey", self._on_cancel_autostart
        )
        view = widget.KeySignals(self.autostart_canceller)
        urwid.connect_signal(view, "cancel", self._on_quit)
        return view
Ejemplo n.º 22
0
 def build(self):
     bt = urwid.BigText("Test Case Manager", urwid.HalfBlock5x4Font())
     bt = urwid.Padding(bt, "center", None)
     # Primary functions
     menulist = [
         widgets.MenuItemWidget("Run Test Code", self.do_run),
         widgets.MenuItemWidget("Run Test Job", self.do_job),
     ]
     pmenu = urwid.GridFlow(menulist, 20, 2, 1, "left")
     # heading blurb
     subhead = urwid.AttrMap(urwid.Text("Choose your desired activity."),
                             "subhead")
     divider = urwid.Divider(u"-", top=1, bottom=1)
     formlist = [bt, divider, subhead, pmenu]
     listbox = urwid.ListBox(urwid.SimpleListWalker(formlist))
     return urwid.Frame(listbox)
Ejemplo n.º 23
0
    def __init__(self, parent):
        self.parent = parent

        help_commands = [
            ('F1 or H', 'Display Help'),
            ('F2', 'Decrease refresh time'),
            ('F3', 'Increase refresh time'),
            ('F4 or P', 'Pause'),
            ('F5 or R', 'Refresh screen'),
            ('F6 or Enter or +/-', 'Fold/Unfold'),
            ('F7 or D', 'Display task detail'),
            ('F8 or C', 'Cancel task'),
            ('F10 or Q', 'Quit program')
        ]

        items = [
            urwid.Padding(urwid.BigText('EsTop', urwid.HalfBlock5x4Font()), width='clip'),
            urwid.Divider('-'),
            urwid.Text('A Task manager for Elasticsearch'),
            urwid.Divider('-'),
        ]

        for key, desc in help_commands:
            item = urwid.Columns(
                [
                    (20, urwid.Text(key)),
                    urwid.Text(desc)
                ]
            )
            items.append(urwid.AttrMap(item, None, 'reveal focus'))

        listbox = urwid.ListBox(urwid.SimpleListWalker(items))

        self.txt_footer = urwid.Text(
            [
                'Press ',
                ('key', 'Enter'),
                ' to close',
            ]
        )

        self.frm_main = urwid.Frame(
            listbox,
            footer=urwid.AttrWrap(self.txt_footer, 'footer')
        )
        self.__super.__init__(urwid.LineBox(self.frm_main, title='Help'))
Ejemplo n.º 24
0
    def __init__(self, app):
        import urwid
        self.app = app

        font = urwid.font.HalfBlock5x4Font()

        big_text = urwid.BigText(("intro_title", self.app.config["textui"]["intro_text"]), font)
        big_text = urwid.Padding(big_text, align="center", width="clip")

        intro = urwid.Pile([
            big_text,
            urwid.Text(("Version %s" % (str(self.app.version))), align="center"),
            urwid.Divider(),
            urwid.Text(("-= Starting =- "), align="center"),
        ])

        self.widget = urwid.Filler(intro)
Ejemplo n.º 25
0
    def build_view(self):
        '''Set up frame for interface'''
        self.bt = urwid.BigText('Recipes', urwid.font.Thin6x6Font())
        header = urwid.AttrMap(self.bt, 'header')
        header = urwid.Padding(header, width='clip', align='center')
        header = urwid.LineBox(header)

        footer = urwid.Text(['Press ', ('quit_button', 'Q'), ' to quit'])

        self.main = urwid.Padding(urwid.Text('placeholder'), left=2, right=2)
        #body = urwid.Filler(self.main,height=10,valign='middle',top=1)
        body = urwid.LineBox(self.main)
        #body = urwid.Overlay(body, urwid.SolidFill(u' '), align='center', width=40, valign='middle', height=10)
        self.top = urwid.Frame(body=body, header=header, footer=footer)

        self.show_menu()
        return
Ejemplo n.º 26
0
    def setup_view(self):
        self.logger_box = urwid.SimpleListWalker([])

        self._state_overview = urwid.Text("Starting")
        # ListBox
        self.job_box = urwid.ListBox(urwid.SimpleListWalker([]))

        w = urwid.Pile([urwid.AttrWrap(self.job_box, 'body')])

        # Frame
        hdr = urwid.Text(
            "Sisyphus | CWD: %s | Call: %s | Press h for help | press q or esc to quit"
            % (os.path.abspath('.'), ' '.join(sys.argv)),
            wrap='clip')
        self.header = hdr = urwid.AttrWrap(hdr, 'header')
        hdr = urwid.Pile([
            hdr,
            (10, urwid.AttrWrap(urwid.ListBox(self.logger_box), 'body')),
            urwid.AttrWrap(self._state_overview, 'note'),
        ])

        self.setup_menu_view()
        self.main_view = self.menu_view
        self.job_view = urwid.Frame(header=hdr, body=w)

        # Exit message
        exit = urwid.BigText(('exit', " Quit? "), font=urwid.Thin6x6Font())
        self.exit_view = urwid.Overlay(exit, w, 'center', None, 'middle', None)

        self.question_text = urwid.Text("  ")
        self.question_queue = Queue()
        self.question_sem = Semaphore()
        self.question_view = urwid.Overlay(self.question_text, self.main_view,
                                           'center', ('relative', 80),
                                           'middle', None)

        help = urwid.Text(help_text)
        self.help_view = urwid.Frame(header=self.header,
                                     body=urwid.ListBox([help]))

        self.setup_object_view()

        self.history = []
        self.stop_job_view_update = False
        self.current_jobs = []
Ejemplo n.º 27
0
    def __init__(self):
        super().__init__(urwid.SolidFill(), None)
        self.big_text = urwid.BigText([('banner_hi', "bib"),
                                       ('banner_lo', "rarian")],
                                      urwid.font.HalfBlock7x7Font())

        self.big_text_clipped = urwid.Padding(self.big_text,
                                              'center',
                                              width='clip')

        self.subtitle = urwid.Text(
            ('banner_hi', "A BibTeX Management Tool Powered By D.B.L.P"),
            align='center')
        self.version = urwid.Text(('banner_lo', "version 1.0"), align='center')

        self.original_widget = urwid.Filler(
            urwid.Pile([self.big_text_clipped, self.subtitle, self.version]),
            'middle')
Ejemplo n.º 28
0
def display_help(args=None):
    c(next(help))
    #exit = urwid.BigText(('exit'," kanten v" + __version__), exit_font())
    exit = urwid.BigText(('exit', " kanten v" + str(__version__)), exit_font())
    #exit = urwid.Pile([exit, ])
    #exit = urwid.Padding(exit,('relative', 100), width, left=2, right=2 )
    exit = urwid.Overlay(exit,
                         K.loop.widget,
                         'center',
                         'pack', ('relative', 90),
                         'pack',
                         min_height=15)
    #min_width=20, min_height=5)
    # TODO: maybe do some overlay later - inserting into col content is pretty
    # good for now
    #cols.contents.insert(0, exit)
    K.loop.widget = exit
    return True
Ejemplo n.º 29
0
    def setup_view(self):

        # File list
        fnamews = []
        newnamews = []
        tracks = albumtag.namebinder_trackorder(self.filelist, self.album,
                                                self.encoding)
        for i, (fpath, track) in enumerate(zip(self.filelist, tracks)):
            fname = fpath.getName()
            fbox = urwid.Text(fname)
            fbox = urwid.AttrWrap(fbox, 'filename normal', 'filename select')
            fnamews.append(fbox)
            newname = policy.genfilename(fpath, self.album, track)
            fbox = ListItem(newname, on_press=self.switchSelect)
            fbox.idx = i
            fbox = urwid.AttrWrap(fbox, 'filename normal', 'filename select')
            newnamews.append(fbox)

        # Left ListBox
        fnames = urwid.Pile(fnamews, focus_item=0)
        fnamesSlw = urwid.SimpleListWalker([fnames])
        lstfnames = border(urwid.ListBox(fnamesSlw))

        # XXX: synchronized scrolling, or better yet, one listbox

        # Right ListBox
        newnames = MovePile(newnamews, focus_item=0)
        self.newNamesList = newnames
        newnamesSlw = urwid.SimpleListWalker([newnames])
        mvl = urwid.ListBox(newnamesSlw)
        lstnewnames = border(mvl)

        col = urwid.Columns([lstfnames, lstnewnames], 1, focus_column=1)

        # Frame
        w = urwid.AttrWrap(col, 'body')
        hdr = urwid.Text("Line up the files with their new names")
        hdr = urwid.AttrWrap(hdr, 'header')
        w = urwid.Frame(header=hdr, body=w)

        # Exit message
        exit = urwid.BigText(('exit', " Quit? "), urwid.Thin6x6Font())
        exit = urwid.Overlay(exit, w, 'center', None, 'middle', None)
        return w, exit
Ejemplo n.º 30
0
    def __init__(self, game):
        self._game = game
        self._board = Board()
        self._score_text = urwid.BigText(self.get_score_text(0),
                                         urwid.font.HalfBlock5x4Font())
        fill = urwid.Filler(urwid.Pile([
            urwid.AttrMap(self._board, "tile-0"),
            urwid.Padding(self._score_text, width='clip')
        ]),
                            valign="top")

        self.unhandled_input = None
        self._screen = urwid.raw_display.Screen()
        self._screen.register_palette(palette)
        self._screen.set_terminal_properties(colors=256)
        self._loop = urwid.MainLoop(fill,
                                    screen=self._screen,
                                    unhandled_input=self.handle_input)
        self.update()