All pastes #1063277 Raw Edit

Miscellany

public text v1 · immutable
#1063277 ·published 2008-07-05 21:47 UTC
rendered paste body
Index: ../tovid/libtovid/metagui/control.py
===================================================================
--- ../tovid/libtovid/metagui/control.py	(revision 2523)
+++ ../tovid/libtovid/metagui/control.py	(working copy)
@@ -672,6 +672,7 @@
                  help='',
                  **kwargs):
         Control.__init__(self, list, label, option, default, help, **kwargs)
+        self.lists = []
 
     def draw(self, master):
         """Draw control widgets in the given master."""
@@ -713,7 +714,7 @@
         Control.__init__(self, list, label, option, default, help, **kwargs)
         # dict of lists.  Current mapped list entries get saved to the dict
         # using current pullindex, updated when a 'connected' item is selected
-        self.lists = {}
+        self.lists = []
 
     def draw(self, master):
         """Draw control widgets in the given master."""
@@ -747,11 +748,9 @@
         """ set listbox contents to 'lists'at index of connected listbox.
         """
         connected_ind = self.connected.listbox.curindex
-        self.lists[connected_ind] = self.lists.get(connected_ind, '')
         
         self.variable.set(self.lists[connected_ind])
         self.listbox.activate(0)
-    
         if len(self.variable.get()) == 0:
             self.variable.append('') 
     def get_args(self):
@@ -840,6 +839,9 @@
         """Event handler to add files to the list"""
         files = askopenfilenames(parent=self, title='Add files', filetypes=self.filetypes)
         self.listbox.add(*files)
+        # add indicies to connected listbox's 'lists' list
+        for n in range(len(files)):
+            self.connected.lists.append([])
         for dest in self.copies:
             self.listbox.linked = dest.listbox
             dest.listbox.linked = self.listbox
@@ -856,6 +858,7 @@
         self.listbox.delete(selected)
         for control in self.copies:
             control.listbox.delete(selected)
+        self.connected.lists.pop(selected)
 
     def connect(self, connected):
         """a call from a connected widget that passes its name"""