OSDN Git Service

Improve treeview performance.
authorAiwota Programmer <aiwotaprog@tetteke.tk>
Fri, 1 Sep 2006 20:57:12 +0000 (05:57 +0900)
committerAiwota Programmer <aiwotaprog@tetteke.tk>
Fri, 1 Sep 2006 20:57:12 +0000 (05:57 +0900)
src/FukuiNoNamari/board_window.py
src/FukuiNoNamari/threadlistmodel.py

index af0b6bb..dca86c4 100644 (file)
@@ -91,11 +91,18 @@ class WinWrap:
                 renderer, self.on_cell_data, column_name)
             self.treeviewcolumn[column_name].connect(
                 "clicked", self.on_column_clicked, column_name)
+            self.treeviewcolumn[column_name].set_sizing(
+                gtk.TREE_VIEW_COLUMN_FIXED)
+            self.treeviewcolumn[column_name].set_min_width(20)
+            self.treeviewcolumn[column_name].set_fixed_width(
+                ThreadListModel.column_width[i])
             self.treeview.append_column(self.treeviewcolumn[column_name])
 
         self.treeviewcolumn["lastModified"].set_cell_data_func(
             renderer, self.on_data_lastmodified)
 
+        self.treeview.set_fixed_height_mode(True)
+
         sigdic = {"on_board_window_destroy": self.on_board_window_destroy,
                   "on_quit_activate": self.on_quit_activate,
                   "on_refresh_activate": self.on_refresh_activate,
index 7bef1d1..5030155 100644 (file)
@@ -24,6 +24,7 @@ class ThreadListModel(gtk.GenericTreeModel):
     column_types = (str, int, str, int, int, int, int)
     column_names = ["id", "num", "title", "res", "lineCount",
                     "lastModified", "average"]
+    column_width = [0, 30, 330, 50, 50, 200, 50]
 
     def __init__(self, list=None, sort_column_name="num", sort_reverse=False,
                  filter_func=None):
@@ -61,7 +62,7 @@ class ThreadListModel(gtk.GenericTreeModel):
         self.original_list = newlist[:]
         self.refilter()
 
-    def set_filter_func(func):
+    def set_filter_func(self, func):
         self.filter_func = func
 
     def build_order_dict(self):