make clear and append logic non-bogus; move FIXME to the right place;TODO fix fime

This commit is contained in:
Nikos Kouremenos 2006-04-09 11:02:43 +00:00
parent c92f151f32
commit 73bdf4900d
1 changed files with 11 additions and 11 deletions

View File

@ -197,10 +197,8 @@ class HistoryManager:
paths_len = len(list_of_paths) paths_len = len(list_of_paths)
if paths_len == 0: # nothing is selected if paths_len == 0: # nothing is selected
return return
elif paths_len == 1:
do_clear = True self.logs_liststore.clear() # clear the store
else:
do_clear = False
self.welcome_label.hide() self.welcome_label.hide()
self.search_results_scrolledwindow.hide() self.search_results_scrolledwindow.hide()
@ -210,12 +208,12 @@ class HistoryManager:
for path in list_of_paths: # make them treerowrefs (it's needed) for path in list_of_paths: # make them treerowrefs (it's needed)
list_of_rowrefs.append(gtk.TreeRowReference(liststore, path)) list_of_rowrefs.append(gtk.TreeRowReference(liststore, path))
for rowref in list_of_rowrefs: for rowref in list_of_rowrefs: # FILL THE STORE, for all rows selected
path = rowref.get_path() path = rowref.get_path()
if path is None: if path is None:
continue continue
jid = liststore[path][0] # jid jid = liststore[path][0] # jid
self._fill_logs_listview(jid, do_clear) self._fill_logs_listview(jid)
def _get_jid_id(self, jid): def _get_jid_id(self, jid):
'''jids table has jid and jid_id '''jids table has jid and jid_id
@ -258,11 +256,9 @@ class HistoryManager:
else: else:
return False return False
def _fill_logs_listview(self, jid, do_clear = True): def _fill_logs_listview(self, jid):
'''fill the listview with all messages that user sent to or '''fill the listview with all messages that user sent to or
received from JID''' received from JID'''
if do_clear:
self.logs_liststore.clear() # clear the store
# no need to lower jid in this context as jid is already lowered # no need to lower jid in this context as jid is already lowered
# as we use those jids from db # as we use those jids from db
jid_id = self._get_jid_id(jid) jid_id = self._get_jid_id(jid)
@ -391,7 +387,7 @@ class HistoryManager:
paths_len = len(list_of_paths) paths_len = len(list_of_paths)
if paths_len == 0: # nothing is selected if paths_len == 0: # nothing is selected
return return
list_of_rowrefs = [] list_of_rowrefs = []
for path in list_of_paths: # make them treerowrefs (it's needed) for path in list_of_paths: # make them treerowrefs (it's needed)
list_of_rowrefs.append(gtk.TreeRowReference(liststore, path)) list_of_rowrefs.append(gtk.TreeRowReference(liststore, path))
@ -406,8 +402,11 @@ class HistoryManager:
WHERE jid_id = ? WHERE jid_id = ?
ORDER BY time ORDER BY time
''', (jid_id,)) ''', (jid_id,))
# FIXME: we may have two contacts selected to export. fix that
# AT THIS TIME FIRST EXECUTE IS LOST! WTH!!!!!
results = self.cur.fetchall() results = self.cur.fetchall()
#print results[0]
file_ = open(path_to_file, 'w') file_ = open(path_to_file, 'w')
for row in results: for row in results:
# in store: time, kind, message, contact_name FROM logs # in store: time, kind, message, contact_name FROM logs
@ -422,6 +421,7 @@ class HistoryManager:
elif kind == constants.KIND_GC_MSG: elif kind == constants.KIND_GC_MSG:
who = nickname who = nickname
else: # status or gc_status. do not save else: # status or gc_status. do not save
#print kind
continue continue
try: try: