OSDN Git Service

Fix the signal of thread index update to board.
authorAiwota Programmer <aiwotaprog@tetteke.tk>
Wed, 23 Aug 2006 11:52:00 +0000 (20:52 +0900)
committerAiwota Programmer <aiwotaprog@tetteke.tk>
Wed, 23 Aug 2006 11:52:00 +0000 (20:52 +0900)
src/Hage1/board_window.py
src/Hage1/thread_window.py
src/Hage1/windowlist.py

index 25d18f0..0d5b8fa 100644 (file)
@@ -27,6 +27,7 @@ import board_data
 import thread_window
 import misc
 from threadlistmodel import ThreadListModel
+from BbsType import bbs_type_judge_uri
 
 import windowlist
 
@@ -51,7 +52,6 @@ def open_board(uri):
 class WinWrap:
 
     def __init__(self, uri):
-        from BbsType import bbs_type_judge_uri
 
         self.bbs_type = bbs_type_judge_uri.get_type(uri)
         self.bbs = self.bbs_type.bbs_type
@@ -258,10 +258,18 @@ class WinWrap:
         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:
+    def on_thread_idx_updated(self, thread_uri, idx_dic):
+        if not thread_uri or not idx_dic:
             return
 
+        # nothing to do if thread_uri does not belong to this board.
+        bbs_type = bbs_type_judge_uri.get_type(thread_uri)
+        if bbs_type.bbs_type != self.bbs \
+           or bbs_type.board != self.board or not bbs_type.is_thread():
+            return
+
+        thread = bbs_type.thread
+
         model = self.treeview.get_model()
         if model:
             idx_dic["id"] = thread
index 9004035..4af62ae 100644 (file)
@@ -153,7 +153,7 @@ class WinWrap:
             idxfile.save_idx(self.bbs, self.board, self.thread, idx_dic)
 
             windowlist.thread_idx_updated(
-                self.bbs, self.board, self.thread, idx_dic)
+                self.bbs_type.get_thread_uri(), idx_dic)
 
     def update(self, widget=None):
         line_count = datfile.get_dat_line_count(
index fe18027..8ae272a 100644 (file)
@@ -19,6 +19,7 @@ import pygtk
 pygtk.require('2.0')
 import gtk
 import gobject
+from BbsType import bbs_type_judge_uri
 
 # key: /bbs/board/thread value: toplevel window widget
 _windows = {}
@@ -54,14 +55,14 @@ def on_window_destroy(widget, key):
 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:
+def thread_idx_updated(thread_uri, idx_dic):
+    if not thread_uri or not idx_dic:
         raise ValueError, "parameter must not be empty"
 
-    gobject.idle_add(on_thread_idx_updated, bbs, board, thread, idx_dic)
+    gobject.idle_add(on_thread_idx_updated, thread_uri, idx_dic)
 
-def on_thread_idx_updated(bbs, board, thread, idx_dic):
-    key = "/" + bbs + "/" + board
-    winwrap = get_window(key)
+def on_thread_idx_updated(thread_uri, idx_dic):
+    bbs_type = bbs_type_judge_uri.get_type(thread_uri)
+    winwrap = get_window(bbs_type.get_uri_base())
     if winwrap:
-        winwrap.on_thread_idx_updated(thread, idx_dic)
+        winwrap.on_thread_idx_updated(thread_uri, idx_dic)