From: <cl...@us...> - 2002-06-18 17:12:03
|
Update of /cvsroot/todo-manager/todo-manager In directory usw-pr-cvs1:/tmp/cvs-serv1343 Modified Files: Tag: dev-bronze objectlistbox.py Log Message: * Draw caching functions Suspend drawing while large changes are made to the list and re-enable it afterwards Index: objectlistbox.py =================================================================== RCS file: /cvsroot/todo-manager/todo-manager/Attic/objectlistbox.py,v retrieving revision 1.1.2.18 retrieving revision 1.1.2.19 diff -u -d -r1.1.2.18 -r1.1.2.19 --- objectlistbox.py 1 Jun 2002 23:25:54 -0000 1.1.2.18 +++ objectlistbox.py 18 Jun 2002 17:11:56 -0000 1.1.2.19 @@ -44,6 +44,7 @@ self.__foreground = kw["foreground"] self.__dragable = FALSE self.__moved_object = FALSE # So the list isn't updated unless it needs to be + self.__draw_cache = FALSE # If this is TRUE then the list won't auto-update self.__item_leftclick_command = None self.__item_leftdrag_command = None @@ -195,7 +196,8 @@ else: self.__objects[row][column] = obj - self.draw() + if not self.__draw_cache: + self.draw() def insert_object(self, row, column, function): if row == END: row = self.count() @@ -216,7 +218,8 @@ else: self.__objects[row][column] = obj - self.draw() + if not self.__draw_cache: + self.draw() def get_column_text(self, row, column): try: @@ -247,7 +250,8 @@ else: del self.__objects[index] - self.draw() + if not self.__draw_cache: + self.draw() def curselection(self): return self.__cursel @@ -270,6 +274,16 @@ def set_item_rightclick(self, command): self.__item_rightclick_command = command + + def start_draw_cache(self): + """Keep the list from updating automatically. + This is good to use when you have a large group of items to add to the list.""" + self.__draw_cache = TRUE + + def end_draw_cache(self): + """End the draw cache and update the list.""" + self.draw() + self.__draw_cache = FALSE def draw(self): # ...and the fun begins |