OSDN Git Service

Enable to get dictionaries in the data store.
[fukui-no-namari/fukui-no-namari.git] / src / FukuiNoNamari / board_column.py
index becea8c..743d752 100644 (file)
@@ -67,10 +67,8 @@ class BaseTreeViewColumn(gtk.TreeViewColumn):
     def on_cell_data(self, column, cell, model, iter):
         self.updated_thread_highlight(column, cell, model, iter)
 
-        column_num = model.column_names.index(self.name)
-        value = model.get_value(iter, column_num)
-        if model.get_column_type(column_num) \
-               in (gobject.TYPE_INT, gobject.TYPE_DOUBLE):
+        value = model.get_dict(iter)[self.name]
+        if type(value) in (int, float):
             if value == 0:
                 cell.set_property("text", "")
             else:
@@ -81,10 +79,8 @@ class BaseTreeViewColumn(gtk.TreeViewColumn):
     def updated_thread_highlight(self, column, cell, model, iter):
 
         def is_updated_thread():
-            res = model.get_value(
-                iter, model.column_names.index("res"))
-            linecount = model.get_value(
-                iter, model.column_names.index("lineCount"))
+            res = model.get_dict(iter)["res"]
+            linecount = model.get_dict(iter)["lineCount"]
             return res != 0 and linecount != 0 and res > linecount
 
         if is_updated_thread():
@@ -149,8 +145,7 @@ class TreeViewColumn_LastModified(BaseTreeViewColumn):
     def on_cell_data(self, column, cell, model, iter):
         self.updated_thread_highlight(column, cell, model, iter)
 
-        lastmod = model.get_value(
-            iter, model.column_names.index("lastModified"))
+        lastmod = model.get_dict(iter)["lastModified"]
         if lastmod == 0:
             cell.set_property("text", "")
         else: