OSDN Git Service

Add the participation of thread window in the program quit counter of windowlist
[fukui-no-namari/fukui-no-namari.git] / src / Hage1 / thread_window.py
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: