diff --git a/curses/curses_misc.py b/curses/curses_misc.py index fbe607d..9e641fc 100644 --- a/curses/curses_misc.py +++ b/curses/curses_misc.py @@ -34,8 +34,8 @@ def error(ui,parent,message): return dialog.run(ui,parent) # My savior. :-) -# Although I could have made this myself pretty easily, just want to give credit where -# its due. +# Although I could have made this myself pretty easily, just want to give credit +# where it's due. # http://excess.org/urwid/browser/contrib/trunk/rbreu_filechooser.py class SelText(urwid.Text): """A selectable text widget. See urwid.Text.""" @@ -137,14 +137,14 @@ class MaskingEdit(urwid.Edit): focus. """ # If we aren't masking anything ATM, then act like an Edit. No problems. - if self.mask_mode == "off" or (self.mask_mode == 'on_focus' and focus == True): + if self.mask_mode == "off" or (self.mask_mode == 'on_focus' and focus == True): canv = self.__super.render((maxcol,),focus) - # The cache messes this thing up, because I am totally changing what is - # displayed. + # The cache messes this thing up, because I am totally changing what + # is displayed. self._invalidate() return canv - # Else, we have a slight mess to deal with... + # Else, we have a slight mess to deal with... self._shift_view_to_cursor = not not focus # force bool text, attr = self.get_text() @@ -218,14 +218,13 @@ class TabColumns(urwid.WidgetWrap): ### Combo box code begins here - class ComboBoxException(Exception): pass # A "combo box" of SelTexts # I based this off of the code found here: # http://excess.org/urwid/browser/contrib/trunk/rbreu_menus.py -# This is a hack. It isn't without quirks, but it more or less works. +# This is a hack/kludge. It isn't without quirks, but it more or less works. # We need to wait for changes in urwid's Canvas controls before we can actually # make a real ComboBox. class ComboBox(urwid.WidgetWrap): @@ -342,9 +341,11 @@ class ComboBox(urwid.WidgetWrap): str,trash = self.label.get_text() - self.cbox = DynWrap(SelText([self.list[self.focus]+' vvv']),attrs=self.attrs,focus_attr=self.focus_attr) + self.cbox = DynWrap(SelText([self.list[self.focus]+' vvv']), + attrs=self.attrs,focus_attr=self.focus_attr) if str != '': - w = urwid.Columns([('fixed',len(str),self.label),self.cbox],dividechars=1) + w = urwid.Columns([('fixed',len(str),self.label),self.cbox], + dividechars=1) self.overlay = self.ComboSpace(self.list,parent,ui,self.focus, pos=(len(str)+1,row)) else: @@ -371,7 +372,8 @@ class ComboBox(urwid.WidgetWrap): self.set_focus(self.list.index(retval)) #self.cbox.set_w(SelText(retval+' vvv')) if self.callback != None: - self.callback(self,self.overlay._listbox.get_focus()[1],self.user_args) + self.callback(self,self.overlay._listbox.get_focus()[1], + self.user_args) return self._w.keypress(size,key) def selectable(self): @@ -417,6 +419,7 @@ class Dialog2(urwid.WidgetWrap): #w = urwid.Padding(w, ('fixed left',2), ('fixed right',2)) #w = urwid.Filler(w, ('fixed top',1), ('fixed bottom',1)) #w = urwid.AttrWrap(w, 'body') + # buttons: tuple of name,exitcode def add_buttons(self, buttons): l = [] @@ -509,8 +512,3 @@ class InputDialog(Dialog2): def on_exit(self, exitcode): return exitcode, self.edit.get_edit_text() - -# Pile that has an edit and a label saying that the file at the path specified -# does not exist -#class FileGuessEdit(urwid.WidgetWrap): -# def __init__(self,caption='', diff --git a/curses/prefs_curses.py b/curses/prefs_curses.py index f5c5b4d..992bc84 100755 --- a/curses/prefs_curses.py +++ b/curses/prefs_curses.py @@ -110,7 +110,8 @@ class PrefsDialog(urwid.WidgetWrap): backend_cat_t = ('header',language['backend']) backend_t = language['backend']+':' backend_list = ['spam','double spam','triple spam','quadruple spam'] - #backend_warn_t = ('important','Changes to the backend (probably) requires a daemon restart') + #backend_warn_t = ('important', + # 'Changes to the backend (probably) requires a daemon restart') debug_cat_t = ('header',language['debugging']) debug_mode_t = language['use_debug_mode'] @@ -145,10 +146,10 @@ class PrefsDialog(urwid.WidgetWrap): self.always_show_wired_checkb = urwid.CheckBox(always_show_wired_t) self.wired_auto_l = [] - self.wired_auto_cat = urwid.Text(wired_auto_cat_t) - self.wired_auto_1 = urwid.RadioButton(self.wired_auto_l,wired_auto_1_t) - self.wired_auto_2 = urwid.RadioButton(self.wired_auto_l,wired_auto_2_t) - self.wired_auto_3 = urwid.RadioButton(self.wired_auto_l,wired_auto_3_t) + self.wired_auto_cat= urwid.Text(wired_auto_cat_t) + self.wired_auto_1 = urwid.RadioButton(self.wired_auto_l,wired_auto_1_t) + self.wired_auto_2 = urwid.RadioButton(self.wired_auto_l,wired_auto_2_t) + self.wired_auto_3 = urwid.RadioButton(self.wired_auto_l,wired_auto_3_t) self.auto_reconn_cat = urwid.Text(auto_reconn_cat_t) self.auto_reconn_checkb = urwid.CheckBox(auto_reconn_t) @@ -247,23 +248,10 @@ class PrefsDialog(urwid.WidgetWrap): self.OK_PRESSED = False - self.button_cols = urwid.Columns([ok_button,cancel_button],dividechars=1) - #self.active_tab = self.header0 + self.button_cols = urwid.Columns([ok_button,cancel_button], + dividechars=1) - #self.columns = urwid.Columns([('fixed',len(header0_t),self.header0), - # ('fixed',len(header1_t),self.header1), - # ('fixed',len(header2_t),self.header2), - # urwid.Text(('header',title),align='right')], - # dividechars=1) - - #content = [self.columns,generalPile] - #self._label = urwid.AttrWrap(SelText(titles),attr[0],attr[1]) - #self.walker = urwid.SimpleListWalker(content) - #self.listbox = urwid.ListBox(self.walker) - #self._linebox = urwid.LineBox(self._listbox) self.tabs = TabColumns(headerList,lbList,language['preferences'],self.button_cols) - #overlay = urwid.Overlay(self.tabs, body, ('fixed left', pos[0]), - # width, ('fixed top', pos[1]), height) self.__super.__init__(self.tabs) def load_settings(self): @@ -272,7 +260,7 @@ class PrefsDialog(urwid.WidgetWrap): self.OK_PRESSED = False ### General Settings - # Urwid does not like dbus.Strings as text markups + # ComboBox does not like dbus.Strings as text markups. My fault. :/ wless_iface = unicode(daemon.GetWirelessInterface()) wired_iface = unicode(daemon.GetWiredInterface()) self.wless_edit.set_edit_text(wless_iface) @@ -292,7 +280,6 @@ class PrefsDialog(urwid.WidgetWrap): # Wired Automatic Connection self.wired_auto_l[daemon.GetWiredAutoConnectMethod()-1] - self.auto_reconn_checkb.set_state(daemon.GetAutoReconnect()) ### External Programs @@ -320,7 +307,7 @@ class PrefsDialog(urwid.WidgetWrap): try: self.wpa_cbox.set_focus(self.wpadrivers.index(def_driver)) except ValueError: - pass # It defaults to 0 anyway + pass # It defaults to 0 anyway (I hope) self.backends = daemon.GetBackendList() self.thebackends= [unicode(w) for w in self.backends] @@ -405,9 +392,6 @@ class PrefsDialog(urwid.WidgetWrap): def run(self,ui, dim, display): width,height = ui.get_cols_rows() self.load_settings() - # TODO: The below, if things go 'well' - # If we are small, "tabbify" the interface - # Else, pile it together overlay = urwid.Overlay(self.tabs, display, ('fixed left', 0),width , ('fixed top',1), height-3) diff --git a/curses/wicd-curses.py b/curses/wicd-curses.py index fc2293c..3fe5994 100644 --- a/curses/wicd-curses.py +++ b/curses/wicd-curses.py @@ -100,7 +100,7 @@ class wrap_exceptions: except : # If the UI isn't inactive (redraw_tag wouldn't normally be # set), then don't try to stop it, just gracefully die. - if redraw_tag != None: + if redraw_tag != -1: # Remove update_ui from the event queue gobject.source_remove(redraw_tag) # Quit the loop @@ -702,9 +702,9 @@ class appGUI(): # something, and we aren't connecting to something, return False # immediately. if from_idle and not self.connecting: - self.update_netlist() + #self.update_netlist() self.update_status() - self.update_ui() + #self.update_ui() return False toAppend = '' # If we are connecting and being called from the idle function, spin @@ -759,11 +759,11 @@ class appGUI(): #canvaso = urwid.CanvasOverlay(self.dialog.render( (80,20),True),canvas,0,1) ui.draw_screen((self.size),canvas) keys = ui.get_input() - # Should make a keyhandler method, but this will do until I get around to - # that stage + + # Handle keystrokes if "f8" in keys or 'Q' in keys or 'q' in keys: loop.quit() - return False + #return False if "f5" in keys or 'R' in keys: self.lock_screen() wireless.Scan(True) @@ -906,7 +906,7 @@ def run(): global loop,redraw_tag ui.set_mouse_tracking() - redraw_tag = None + redraw_tag = -1 app = appGUI() # Connect signals and whatnot to UI screen control functions diff --git a/setup.py b/setup.py index 3d69126..5c88c27 100755 --- a/setup.py +++ b/setup.py @@ -27,7 +27,7 @@ import subprocess # VERSIONNUMBER VERSION_NUM = '1.6.0' REVISION_NUM = 'unknown' -CURSES_REVNO = 'r272' +CURSES_REVNO = 'r273' try: if not os.path.exists('vcsinfo.py'):