migration is okay now if no ~/.gajim; also many other small fixes

This commit is contained in:
Nikos Kouremenos 2005-12-05 23:25:02 +00:00
parent acebad0196
commit 4f9404e8b2
3 changed files with 21 additions and 16 deletions

View File

@ -71,7 +71,7 @@ class Migration:
for filename in filenames: for filename in filenames:
# Don't take this file into account, this is dup info # Don't take this file into account, this is dup info
# notifications are also in contact log file # notifications are also in contact log file
if filename in ('notify.log', 'readme'): if filename in ('notify.log', 'README'):
continue continue
path_to_text_file = os.path.join(dirname, filename) path_to_text_file = os.path.join(dirname, filename)
if os.path.isdir(path_to_text_file): if os.path.isdir(path_to_text_file):
@ -203,11 +203,13 @@ class Migration:
self.con.commit() self.con.commit()
os.path.walk(PATH_TO_LOGS_BASE_DIR, self.visit, None) 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 Those files here are logs for Gajim up until 0.8.2
We now use an sqlite database called logs.db found in ~/.gajim We now use an sqlite database called logs.db found in %s
You can now safly remove your %s folder You can now safely remove your %s folder
Thank you''' % PATH_TO_LOGS_BASE_DIR 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 = open(os.path.join(PATH_TO_LOGS_BASE_DIR, 'README'), 'w')
f.write(s) f.write(s)
f.close() f.close()

View File

@ -1288,6 +1288,7 @@ class ProgressDialog:
self.textview_buffer.create_mark('end', end_iter, False) self.textview_buffer.create_mark('end', end_iter, False)
self.dialog.set_title(title_text) self.dialog.set_title(title_text)
self.dialog.set_default_size(450, 500)
self.dialog.show_all() self.dialog.show_all()
self.xml.signal_autoconnect(self) self.xml.signal_autoconnect(self)
@ -1321,3 +1322,4 @@ class ProgressDialog:
gobject.source_remove(self.update_progressbar_timeout_id) gobject.source_remove(self.update_progressbar_timeout_id)
gobject.source_remove(self.read_from_queue_id) gobject.source_remove(self.read_from_queue_id)
self.read_from_queue_and_update_textview() self.read_from_queue_and_update_textview()
self.progressbar.set_fraction(1)

View File

@ -1397,7 +1397,7 @@ class Interface:
def wait_migration(migration): def wait_migration(migration):
if not migration.DONE: if not migration.DONE:
return True return True # loop for ever
dialog.done(_('Logs have been successfully migrated to the database.')) dialog.done(_('Logs have been successfully migrated to the database.'))
dialog.dialog.run() dialog.dialog.run()
dialog.dialog.destroy() dialog.dialog.destroy()
@ -1463,15 +1463,16 @@ if __name__ == '__main__':
except: except:
pass pass
# Migrate old logs if user wants that # Migrate old logs if we have such olds logs
from common import logger from common import logger
LOG_DB_PATH = logger.LOG_DB_PATH LOG_DB_PATH = logger.LOG_DB_PATH
if not os.path.isfile(LOG_DB_PATH): if not os.path.exists(LOG_DB_PATH):
from common import migrate_logs_to_dot9_db
if os.path.isdir(migrate_logs_to_dot9_db.PATH_TO_LOGS_BASE_DIR):
import Queue import Queue
q = Queue.Queue(100) q = Queue.Queue(100)
from common import migrate_logs_to_dot9_db
m = migrate_logs_to_dot9_db.Migration() m = migrate_logs_to_dot9_db.Migration()
dialog = dialogs.ProgressDialog(_('Migrating logs...'), _('Please wait while logs are being migrated...'), q) dialog = dialogs.ProgressDialog(_('Migrating Logs...'), _('Please wait while logs are being migrated...'), q)
t = threading.Thread(target = m.migrate, args = (q,)) t = threading.Thread(target = m.migrate, args = (q,))
t.start() t.start()
gobject.timeout_add(500, wait_migration, m) gobject.timeout_add(500, wait_migration, m)