OSDN Git Service

Add the participation of thread window in the program quit counter of windowlist
authorAiwota Programmer <aiwotaprog@tetteke.tk>
Mon, 21 Aug 2006 03:27:57 +0000 (12:27 +0900)
committerAiwota Programmer <aiwotaprog@tetteke.tk>
Mon, 21 Aug 2006 03:27:57 +0000 (12:27 +0900)
src/Hage1/board_window.py
src/Hage1/thread_window.py

index 3ae5be4..a6ff35c 100644 (file)
@@ -194,7 +194,7 @@ class WinWrap:
             iter, ThreadListModel.column_names.index("title"))
         print thread + ':"' + title + '"', "activated"
 
-        thread_window.WinWrap(self.bbs, self.board, thread)
+        thread_window.open_thread(self.bbs, self.board, thread)
 
     def on_treeview_button_press_event(self, widget, event):
         if event.button == 3:
index 39ddc85..759224b 100644 (file)
@@ -29,11 +29,26 @@ import misc
 import datfile
 import barehtmlparser
 import idxfile
+import windowlist
 
 GLADE_DIR = os.path.join(os.path.dirname(os.path.realpath(__file__)),
                          "..", "data")
 GLADE_FILENAME = "thread_window.glade"
 
+def open_thread(bbs, board, thread):
+    if not bbs or not board or not thread:
+        raise ValueError, "parameter must not be empty"
+
+    key = "/" + bbs + "/" + board + "/" + thread
+    window = windowlist.get_window(key)
+    if window:
+        # already opened
+        window.present()
+        pass
+    else:
+        win_wrap = WinWrap(bbs, board, thread)
+        windowlist.window_created(key, win_wrap.window)
+
 
 class WinWrap: