OSDN Git Service

Average column is changed to float.
authorAiwota Programmer <aiwotaprog@tetteke.tk>
Tue, 5 Sep 2006 05:04:54 +0000 (14:04 +0900)
committerAiwota Programmer <aiwotaprog@tetteke.tk>
Tue, 5 Sep 2006 05:04:54 +0000 (14:04 +0900)
src/FukuiNoNamari/board_data.py
src/FukuiNoNamari/board_window.py
src/FukuiNoNamari/threadlistmodel.py

index b38b5c8..227c72a 100644 (file)
@@ -55,7 +55,7 @@ class BoardData:
                 if dur == 0:
                     average = 999999
                 else:
-                    average = (res * 60 * 60 * 24 / dur)
+                    average = round(res * 60 * 60 * 24.0 / dur, 2)
 
         if id in datalist:
             item = datalist[id]
index 1c3875b..f1132bf 100644 (file)
@@ -167,7 +167,8 @@ class WinWrap(winwrapbase.WinWrapBase, board_data.BoardData):
         self.updated_thread_highlight(column, cell, model, iter)
         column_num = ThreadListModel.column_names.index(column_name)
         value = model.get_value(iter, column_num)
-        if model.get_column_type(column_num) == gobject.TYPE_INT:
+        if model.get_column_type(column_num) \
+           in (gobject.TYPE_INT, gobject.TYPE_DOUBLE):
             if value == 0:
                 cell.set_property("text", "")
             else:
index 9840ee9..8a3e354 100644 (file)
@@ -21,7 +21,7 @@ import gtk
 
 
 class ThreadListModel(gtk.GenericTreeModel):
-    column_types = (str, int, str, int, int, int, int)
+    column_types = (str, int, str, int, int, int, float)
     column_names = ["id", "num", "title", "res", "lineCount",
                     "lastModified", "average"]
     column_width = [0, 30, 330, 50, 50, 200, 50]
@@ -98,7 +98,12 @@ class ThreadListModel(gtk.GenericTreeModel):
                 return 1
             elif v2 == 0:
                 return -1
-        return v1 - v2
+        if v1 > v2:
+            return 1
+        elif v1 < v2:
+            return -1
+        else:
+            return 0
 
     def get_sort(self):
         return self.sort_column_name, self.sort_reverse