import gobject
import board_data
-import thread_window
+import uri_opener
import misc
from threadlistmodel import ThreadListModel
from BbsType import bbs_type_judge_uri
"..", "data")
GLADE_FILENAME = "board_window.glade"
-def open_board(uri):
+def open_board(uri, update=False):
if not uri:
raise ValueError, "parameter must not be empty"
if winwrap:
# already opened
winwrap.window.present()
- pass
+ if update:
+ winwrap.load(update)
else:
- win_wrap = WinWrap(uri)
- session.window_created(uri, win_wrap)
+ winwrap = WinWrap(uri)
+ session.window_created(uri, winwrap)
+ winwrap.load(update)
class WinWrap:
"on_popup_menu_open_activate": self.on_open_thread}
self.widget_tree.signal_autoconnect(sigdic)
- t = board_data.LoadLocal(self.bbs, self.board, self.update_datastore)
- t.start()
-
def updated_thread_highlight(self, column, cell, model, iter):
def is_updated_thread():
iter, ThreadListModel.column_names.index("title"))
print thread + ':"' + title + '"', "activated"
+ res = model.get_value(iter, ThreadListModel.column_names.index("res"))
+ lineCount = model.get_value(
+ iter, ThreadListModel.column_names.index("lineCount"))
+
+ update = res > lineCount
+
bbs_type_for_thread = self.bbs_type.clone_with_thread(thread)
- thread_window.open_thread(bbs_type_for_thread.get_thread_uri())
+ uri_opener.open_uri(bbs_type_for_thread.get_thread_uri(), update)
def on_treeview_button_press_event(self, widget, event):
if event.button == 3:
except ValueError:
idx_dic["lastModified"] = 0
model.modify_row(idx_dic)
+
+ def load(self, update=False):
+ sbj_path = misc.get_board_subjecttxt_path(
+ self.bbs_type.bbs_type, self.bbs_type.board)
+ sbj_exists = os.path.exists(sbj_path)
+
+ if update or not sbj_exists:
+ t = board_data.GetRemote(
+ self.bbs, self.board, self.bbs_type.get_subject_txt_uri(),
+ self.update_datastore)
+ t.start()
+ else:
+ t = board_data.LoadLocal(
+ self.bbs, self.board, self.update_datastore)
+ t.start()