示例#1
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
示例#2
0
文件: bigtext.py 项目: dlobue/urwid
    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
示例#3
0
文件: pepi.py 项目: mmisono/pepi
 def make_view(self):
     self.palette = [
             # name          , foreground color , background color
             ('bg'           , 'light gray'     , 'black' )        , 
             ('reveal focus' , 'dark cyan'      , 'light red')     , 
             ('invisible'    , 'black'          , 'black' )        , 
             ('exit'         , 'dark red'       , 'black' )        , 
             ('title'        , 'dark green'     , 'black' )        , 
             ('me'           , 'light red'      , 'black' )        , 
             ('other1'       , 'dark cyan'      , 'black' )        , 
             ('other2'       , 'light magenta'  , 'black' )        , 
             ('other3'       , 'light green'    , 'black' )        , 
             ('other4'       , 'light blue'     , 'black' )        , 
             ('other5'       , 'dark red'       , 'black' )        , 
             ('other6'       , 'brown'          , 'black' )        , 
             ('current_chat' , 'dark green'     , 'black' )        , 
             ('unread'       , 'dark cyan'      , 'black' )        , 
             ('ONLINE'       , 'light red'      , 'black' )        , 
             ('SKYPEME'      , 'light red'      , 'black' )        , 
             ('AWAY'         , 'light blue'     , 'black' )        , 
             ('NA'           , 'light blue'     , 'black' )        , 
             ('DND'          , 'light blue'     , 'black' )        , 
             ('INVISIBLE'    , 'light gray'     , 'black' )        , 
             ('OFFLINE'      , 'light gray'     , 'black' )        , 
             ]
     self.view = ChatView(self)
     self.view = MyAttrMap(self.view,'bg')
     fonts = urwid.get_all_fonts()
     for name, fontcls in fonts:
         font = fontcls()
         if fontcls == urwid.Thin6x6Font:
             exit = urwid.BigText(('exit'," Quit?"), font)
             self.exit_view = urwid.Overlay(\
                     exit,self.view,'center',None,'middle',None)
             break
     else:
         exit = urwid.Filler(urwid.Text(("exit","Quit?")),'top')
         self.exit_view = urwid.Overlay(\
                 exit,self.view,'center',10,'middle',1)
示例#4
0
 def _get_font_instance(self):
     return urwid.get_all_fonts()[-2][1]()
示例#5
0
 def _get_font_instance(self):
     return urwid.get_all_fonts()[-2][1]()
示例#6
0
    def show_closed(self):
        fonts = urwid.get_all_fonts()

        text = urwid.Text("Kitchen is closed, come back tomorrow!",
                          align="center")
        self.body = colors.wrap(text, colors.ERROR)
示例#7
0
文件: main.py 项目: ShadowKyogre/NCDM
 def greeter_font(self):
     return [f for f in urwid.get_all_fonts() if \
       f[0] == self.sysconf.get('DEFAULT','FONT',
       fallback='Thin 6x6')][0][1]
示例#8
0
文件: main.py 项目: ShadowKyogre/NCDM
	def greeter_font(self):
		return [f for f in urwid.get_all_fonts() if \
				f[0] == self.sysconf.get('DEFAULT','FONT',
				fallback='Thin 6x6')][0][1]