OSDN Git Service

New column oldRes.
authorAiwota Programmer <aiwotaprog@tetteke.tk>
Thu, 28 Sep 2006 17:20:46 +0000 (02:20 +0900)
committerAiwota Programmer <aiwotaprog@tetteke.tk>
Sat, 30 Sep 2006 09:46:07 +0000 (18:46 +0900)
src/FukuiNoNamari/board_data.py
src/FukuiNoNamari/board_window.py
src/FukuiNoNamari/threadlistmodel.py

index d921f06..79c3117 100644 (file)
@@ -86,7 +86,7 @@ class BoardData:
         else:
             datalist[id] = {"id": id, "num": num, "title": title,
                             "res": res, "lineCount": BOARD_DATA_INVALID_VALUE,
-                            "lastModified": 0, "average": average}
+                            "lastModified": 0, "average": average, "oldRes": 0}
 
     def merge_local_subjecttxt(self, datalist):
         try:
@@ -113,6 +113,7 @@ class BoardData:
         dic["num"] = 0
         dic["res"] = 0
         dic["average"] = 0
+        dic["oldRes"] = 0
         return dic
 
     def _progressing(self, iterable):
index e5dae3f..81dce48 100644 (file)
@@ -179,6 +179,11 @@ class WinWrap(winwrapbase.WinWrapBase, board_data.BoardData):
             key_iter = dictdict.iterkeys()
             value_iter = dictdict.itervalues()
             iterable = itertools.imap(set_id, key_iter, value_iter)
+
+            # remove not in subject.txt and not cache.
+            iterable = itertools.ifilter(
+                lambda dic: dic["num"] > 0 or dic["lineCount"] > 0, iterable)
+
             return [item_dict for item_dict in iterable]
 
         def load_local():
@@ -202,6 +207,7 @@ class WinWrap(winwrapbase.WinWrapBase, board_data.BoardData):
         def deep_copy():
             def init_some(dic):
                 dic["num"] = 0
+                dic["oldRes"] = dic["res"]
                 dic["res"] = 0
                 dic["average"] = 0
                 return dic
@@ -210,9 +216,6 @@ class WinWrap(winwrapbase.WinWrapBase, board_data.BoardData):
             if model:
                 iterable = model.original_list
 
-                # unmerge subject.txt
-                iterable = itertools.ifilter(
-                    lambda dic: dic["lineCount"] > 0, iterable)
                 iterable = itertools.imap(lambda dic: dic.copy(), iterable)
                 iterable = itertools.imap(init_some, iterable)
 
index f0f2ba4..5febf68 100644 (file)
@@ -22,10 +22,9 @@ import itertools
 
 
 class ThreadListModel(gtk.GenericTreeModel):
-    column_types = (str, int, str, int, int, int, float)
+    column_types = (str, int, str, int, int, int, float, int)
     column_names = ["id", "num", "title", "res", "lineCount",
-                    "lastModified", "average"]
-    column_width = [0, 30, 330, 50, 50, 200, 50]
+                    "lastModified", "average", "oldRes"]
 
     def __init__(self):
         gtk.GenericTreeModel.__init__(self)