From 4f9404e8b29b04a7c93459776f15a069ac0a2405 Mon Sep 17 00:00:00 2001 From: Nikos Kouremenos Date: Mon, 5 Dec 2005 23:25:02 +0000 Subject: [PATCH] migration is okay now if no ~/.gajim; also many other small fixes --- src/common/migrate_logs_to_dot9_db.py | 12 +++++++----- src/dialogs.py | 2 ++ src/gajim.py | 23 ++++++++++++----------- 3 files changed, 21 insertions(+), 16 deletions(-) diff --git a/src/common/migrate_logs_to_dot9_db.py b/src/common/migrate_logs_to_dot9_db.py index d9a491db9..942abc382 100755 --- a/src/common/migrate_logs_to_dot9_db.py +++ b/src/common/migrate_logs_to_dot9_db.py @@ -71,7 +71,7 @@ class Migration: for filename in filenames: # Don't take this file into account, this is dup info # notifications are also in contact log file - if filename in ('notify.log', 'readme'): + if filename in ('notify.log', 'README'): continue path_to_text_file = os.path.join(dirname, filename) if os.path.isdir(path_to_text_file): @@ -203,11 +203,13 @@ class Migration: self.con.commit() os.path.walk(PATH_TO_LOGS_BASE_DIR, self.visit, None) - s = '''We do not use plain-text files anymore, because they do not scale. + s = ''' + +We do not use plain-text files anymore, because they do not meet our needs. Those files here are logs for Gajim up until 0.8.2 -We now use an sqlite database called logs.db found in ~/.gajim -You can now safly remove your %s folder -Thank you''' % PATH_TO_LOGS_BASE_DIR +We now use an sqlite database called logs.db found in %s +You can now safely remove your %s folder +Thank you''' % (os.path.dirname(PATH_TO_LOGS_BASE_DIR), PATH_TO_LOGS_BASE_DIR) f = open(os.path.join(PATH_TO_LOGS_BASE_DIR, 'README'), 'w') f.write(s) f.close() diff --git a/src/dialogs.py b/src/dialogs.py index 70cc650af..7a5c39f6c 100644 --- a/src/dialogs.py +++ b/src/dialogs.py @@ -1288,6 +1288,7 @@ class ProgressDialog: self.textview_buffer.create_mark('end', end_iter, False) self.dialog.set_title(title_text) + self.dialog.set_default_size(450, 500) self.dialog.show_all() self.xml.signal_autoconnect(self) @@ -1321,3 +1322,4 @@ class ProgressDialog: gobject.source_remove(self.update_progressbar_timeout_id) gobject.source_remove(self.read_from_queue_id) self.read_from_queue_and_update_textview() + self.progressbar.set_fraction(1) diff --git a/src/gajim.py b/src/gajim.py index 990fc8235..85aff5019 100755 --- a/src/gajim.py +++ b/src/gajim.py @@ -1397,7 +1397,7 @@ class Interface: def wait_migration(migration): if not migration.DONE: - return True + return True # loop for ever dialog.done(_('Logs have been successfully migrated to the database.')) dialog.dialog.run() dialog.dialog.destroy() @@ -1463,19 +1463,20 @@ if __name__ == '__main__': except: pass - # Migrate old logs if user wants that + # Migrate old logs if we have such olds logs from common import logger LOG_DB_PATH = logger.LOG_DB_PATH - if not os.path.isfile(LOG_DB_PATH): - import Queue - q = Queue.Queue(100) + if not os.path.exists(LOG_DB_PATH): from common import migrate_logs_to_dot9_db - m = migrate_logs_to_dot9_db.Migration() - dialog = dialogs.ProgressDialog(_('Migrating logs...'), _('Please wait while logs are being migrated...'), q) - t = threading.Thread(target = m.migrate, args = (q,)) - t.start() - gobject.timeout_add(500, wait_migration, m) - gtk.main() + if os.path.isdir(migrate_logs_to_dot9_db.PATH_TO_LOGS_BASE_DIR): + import Queue + q = Queue.Queue(100) + m = migrate_logs_to_dot9_db.Migration() + dialog = dialogs.ProgressDialog(_('Migrating Logs...'), _('Please wait while logs are being migrated...'), q) + t = threading.Thread(target = m.migrate, args = (q,)) + t.start() + gobject.timeout_add(500, wait_migration, m) + gtk.main() check_paths.check_and_possibly_create_paths() Interface()