[hamster-applet] allow running hamster uninstall, unconfigured
- From: Toms Baugis <tbaugis src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [hamster-applet] allow running hamster uninstall, unconfigured
- Date: Tue, 25 May 2010 22:55:23 +0000 (UTC)
commit 52d0d62ed87926a7fc5a9b852307f6210338ec84
Author: Toms Bauģis <toms baugis gmail com>
Date: Tue May 25 23:28:18 2010 +0100
allow running hamster uninstall, unconfigured
src/hamster/about.py | 4 +-
src/hamster/configuration.py | 59 ++++++++++++++++++++++--------------------
2 files changed, 33 insertions(+), 30 deletions(-)
---
diff --git a/src/hamster/about.py b/src/hamster/about.py
index e477994..a027e88 100644
--- a/src/hamster/about.py
+++ b/src/hamster/about.py
@@ -19,7 +19,7 @@
from os.path import join
-from defs import VERSION
+from configuration import runtime
import gtk
def on_email(about, mail):
@@ -38,7 +38,7 @@ class About(object):
infos = {
"program-name" : _("Time Tracker"),
"name" : _("Time Tracker"), #this should be deprecated in gtk 2.10
- "version" : VERSION,
+ "version" : runtime.version,
"comments" : _("Project Hamster â?? track your time"),
"copyright" : _(u"Copyright © 2007â??2010 Toms BauÄ£is and others"),
"website" : "http://projecthamster.wordpress.com/",
diff --git a/src/hamster/configuration.py b/src/hamster/configuration.py
index e79a64b..c30daa3 100644
--- a/src/hamster/configuration.py
+++ b/src/hamster/configuration.py
@@ -26,7 +26,6 @@ import gconf
import gettext
import os
from os.path import exists, dirname, realpath
-import defs
from client import Storage
from xdg.BaseDirectory import xdg_data_home
import logging
@@ -55,33 +54,37 @@ class RuntimeStore(Singleton):
def __init__(self):
- gettext.install("hamster-applet", unicode = True)
-
- # Makefile.in shouldn't be in the final install
- module_dir = dirname(realpath(__file__))
- if exists(os.path.join(module_dir, "Makefile")):
- self.data_dir = os.path.join(module_dir, '..', '..', 'data')
- else:
- self.data_dir = os.path.join(defs.DATA_DIR, "hamster-applet")
-
- self.storage = Storage()
-
- # figure out the correct database file
- old_db_file = os.path.expanduser("~/.gnome2/hamster-applet/hamster.db")
- new_db_file = os.path.join(xdg_data_home, "hamster-applet", "hamster.db")
-
- # move database to ~/.local/share/hamster-applet
- if os.path.exists(old_db_file):
- db_path, _ = os.path.split(os.path.realpath(new_db_file))
- if not os.path.exists(db_path):
- try:
- os.makedirs(db_path, 0744)
- except Exception, msg:
- logging.error("could not create user dir (%s): %s" % (db_path, msg))
- if os.path.exists(new_db_file):
- logging.info("Have two database %s and %s" % (new_db_file, old_db_file))
- else:
- os.rename(old_db_file, new_db_file)
+ gettext.install("hamster-applet", unicode = True)
+
+ # Makefile.in shouldn't be in the final install
+ try:
+ import defs
+ self.data_dir = os.path.join(defs.DATA_DIR, "hamster-applet")
+ self.version = defs.VERSION
+ except:
+ module_dir = dirname(realpath(__file__))
+ self.data_dir = os.path.join(module_dir, '..', '..', 'data')
+ self.version = "uninstalled"
+
+
+ self.storage = Storage()
+
+ # figure out the correct database file
+ old_db_file = os.path.expanduser("~/.gnome2/hamster-applet/hamster.db")
+ new_db_file = os.path.join(xdg_data_home, "hamster-applet", "hamster.db")
+
+ # move database to ~/.local/share/hamster-applet
+ if os.path.exists(old_db_file):
+ db_path, _ = os.path.split(os.path.realpath(new_db_file))
+ if not os.path.exists(db_path):
+ try:
+ os.makedirs(db_path, 0744)
+ except Exception, msg:
+ logging.error("could not create user dir (%s): %s" % (db_path, msg))
+ if os.path.exists(new_db_file):
+ logging.info("Have two database %s and %s" % (new_db_file, old_db_file))
+ else:
+ os.rename(old_db_file, new_db_file)
@property
def art_dir(self):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]