Exemplo n.º 1
0
 def init_other_optcols(self):
     """ Init "tabbed" preferences dialog. """
     self.prefCols = OptCols([('S', _('Save')), (
         'page up',
         _('Tab Left'),
     ), ('page down', _('Tab Right')), ('esc', _('Cancel'))],
                             self.handle_keys)
     self.confCols = OptCols([('S', _('Save')), ('esc', _('Cancel'))],
                             self.handle_keys)
Exemplo n.º 2
0
    def __init__(self):
        self.conn_status = False
        self.tcount = 0  # Counter for connection twirl indicator

        self.size = ui.get_cols_rows()
        # Happy screen saying that you can't do anything because we're scanning
        # for networks.  :-)
        self.screen_locker = urwid.Filler(
            urwid.Text(('important', _('Scanning networks... stand by...')),
                       align='center'))
        self.no_wlan = urwid.Filler(
            urwid.Text(('important', _('No wireless networks found.')),
                       align='center'))
        self.TITLE = _('Wicd Curses Interface')
        self.WIRED_IDX = 1
        self.WLESS_IDX = 3

        header = urwid.AttrWrap(urwid.Text(self.TITLE, align='right'),
                                'header')
        self.wiredH = urwid.Filler(urwid.Text(_('Wired Networks')))
        self.list_header = urwid.AttrWrap(urwid.Text(gen_list_header()),
                                          'listbar')
        self.wlessH = NSelListBox(
            [urwid.Text(_('Wireless Networks')), self.list_header])

        # Init this earlier to make update_status happy
        self.update_tag = None

        # FIXME: This should be two variables
        self.focusloc = [1, 0]

        # These are empty to make sure that things go my way.
        wiredL, wlessL = [], []

        self.frame = None
        self.diag = None

        self.wiredCB = urwid.Filler(WiredComboBox(wiredL))
        self.wlessLB = urwid.ListBox(wlessL)
        self.update_netlist(force_check=True, firstrun=True)

        # Keymappings proposed by nanotube in #wicd
        keys = [
            ('H', _('Help'), None),
            ('right', _('Config'), None),
            #('  ', '         ', None),
            ('K', _('RfKill'), None),
            ('C', _('Connect'), None),
            ('D', _('Disconn'), None),
            ('R', _('Refresh'), None),
            ('P', _('Prefs'), None),
            ('I', _('Hidden'), None),
            ('A', _('About'), None),
            ('Q', _('Quit'), loop.quit)
        ]

        self.primaryCols = OptCols(keys, self.handle_keys)
        self.status_label = urwid.AttrWrap(urwid.Text(''), 'important')
        self.footer2 = urwid.Columns([self.status_label])
        self.footerList = urwid.Pile([self.primaryCols, self.footer2])

        self.frame = urwid.Frame(self.thePile,
                                 header=header,
                                 footer=self.footerList)
        self.wiredCB.get_body().build_combobox(self.frame, ui, 3)

        # Init the other columns used in the program
        self.init_other_optcols()

        self.frame.set_body(self.thePile)
        # Booleans gallore!
        self.prev_state = False
        self.connecting = False
        self.screen_locked = False
        self.do_diag_lock = False  # Whether the screen is locked beneath a dialog
        self.diag_type = 'none'  # The type of dialog that is up
        self.scanning = False

        self.pref = None

        self.update_status()