print "end"
time_end = time.time()
print time_end - time_start
+
+ def on_thread_idx_updated(self, thread, idx_dic):
+ if not thread or not idx_dic:
+ return
+
+ model = self.treeview.get_model()
+ if model:
+ idx_dic["id"] = thread
+ try:
+ idx_dic["lastModified"] = misc.httpdate_to_secs(
+ idx_dic["lastModified"])
+ except ValueError:
+ idx_dic["lastModified"] = 0
+ model.modify_row(idx_dic)
"lastModified": lastmod, "etag": etag}
idxfile.save_idx(self.bbs, self.board, self.thread, idx_dic)
+ windowlist.thread_idx_updated(
+ self.bbs, self.board, self.thread, idx_dic)
+
def update(self, widget=None):
line_count = datfile.get_dat_line_count(
self.bbs, self.board, self.thread)
self.do_filter()
self.do_sort(self.sort_column_name, self.sort_reverse)
+ def modify_row(self, dict):
+ id = dict["id"]
+ if id in self.order_dict:
+ index = self.order_dict[id]
+ target_dict = self.list[index]
+ for name in self.column_names:
+ if name in dict:
+ target_dict[name] = dict[name]
+ self.row_changed(index, self.get_iter(index))
+
def refilter(self):
before_size = len(self.list)
self.do_filter()
import pygtk
pygtk.require('2.0')
import gtk
+import gobject
# key: /bbs/board/thread value: toplevel window widget
_windows = {}
def on_all_window_destroy():
gtk.main_quit()
+
+def thread_idx_updated(bbs, board, thread, idx_dic):
+ if not bbs or not board or not thread:
+ raise ValueError, "parameter must not be empty"
+
+ gobject.idle_add(on_thread_idx_updated, bbs, board, thread, idx_dic)
+
+def on_thread_idx_updated(bbs, board, thread, idx_dic):
+ key = "/" + bbs + "/" + board
+ winwrap = get_window(key)
+ if winwrap:
+ winwrap.on_thread_idx_updated(thread, idx_dic)