Corrections to the adesklets_installer
author <sylvain@sylvain.(none)> <>
Sun, 29 Jan 2006 16:42:35 +0000 (29 11:42 -0500)
committer <sylvain@sylvain.(none)> <>
Sun, 29 Jan 2006 16:42:35 +0000 (29 11:42 -0500)
- the automated interface toggling now works
- better boundary test in the curses interface

utils/adesklets_installer

index bca5b80..2da5269 100755 (executable)
@@ -470,7 +470,7 @@ try:
                         self.lines = data.splitlines()
                     else:
                         self.lines = data
-                    for i, line in zip(xrange(len(self.lines)), self.lines):
+                    for i, line in zip(range(len(self.lines)), self.lines):
                         self.pad.addstr(i, 0, line)
                     self.scroll(0)
                 else:
@@ -496,9 +496,10 @@ try:
                     new = 0
                 elif new >= len(self.lines):
                     new = len(self.lines)-1
-                
-                self.pad.addstr(self.cur, 0, self.lines[self.cur])
-                self.pad.addstr(new, 0, self.lines[new], self.hl)
+
+                if len(self.lines)>1:
+                    self.pad.addstr(self.cur, 0, self.lines[self.cur])
+                    self.pad.addstr(new, 0, self.lines[new], self.hl)
                 self.cur = new
                 self.refresh()
 
@@ -620,14 +621,14 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
     opts, args= p.parse_args()
 
     # Just instanciate the right GUI to start up the application
-    # In orger, we try to instanciate the Tk, curses and raw
+    # In order, we try to instanciate the Tk, curses and raw
     # interface, falling to the next in case of unavailability or
     # initialization errors
-    #
+    #    
     select = opts.raw + opts.curses + opts.Tk
     for ui in ('Tk', 'curses', 'raw'):
         if (globals().has_key('%sGUI' % ui) and
-            getattr(opts, ui) or select==0 or ui=='raw'):
+            (getattr(opts, ui) or select==0 or ui=='raw')):
                 if globals()['%sGUI' % ui](): break
 
 # -----------------------------------------------------------------------------