Collapse None entries for Argument.count == -1 in the GUI
authorW. Trevor King <wking@drexel.edu>
Tue, 10 Aug 2010 15:09:00 +0000 (11:09 -0400)
committerW. Trevor King <wking@drexel.edu>
Tue, 10 Aug 2010 15:09:00 +0000 (11:09 -0400)
hooke/ui/gui/__init__.py

index 6d17a7ce07e8be43155e23507cc22cffcc1a2022..1c646f4396cc82429da7eb82cc55a601902b18f8 100644 (file)
@@ -338,6 +338,12 @@ class HookeFrame (wx.Frame):
                     assert keys == range(count), keys
                     args[arg.name] = [args[arg.name][i]
                                       for i in range(count)]
+                if arg.count == -1:
+                    while (len(args[arg.name]) > 0
+                           and args[arg.name][-1] == None):
+                        args[arg.name].pop()
+                    if len(args[arg.name]) == 0:
+                        args[arg.name] = arg.default
         self.log.debug('executing %s with %s' % (command.name, args))
         self.inqueue.put(CommandMessage(command, args))
         results = []