diff options
author | Alan Aguiar <alanjas@hotmail.com> | 2013-05-24 20:24:39 (GMT) |
---|---|---|
committer | Alan Aguiar <alanjas@hotmail.com> | 2013-05-24 20:24:39 (GMT) |
commit | d97d9466307da8533f61b0bd6c3239b6d1b2c177 (patch) | |
tree | 6c656b4192b58326dd813bfb7413dbe6c06ecca3 | |
parent | a44ab7623d604d39e3d46ddad1e19bd39d5073de (diff) |
classic update to work in sugar
-rwxr-xr-x | timeline.py | 29 | ||||
-rw-r--r-- | timelinelib/config/arguments.py | 14 |
2 files changed, 30 insertions, 13 deletions
diff --git a/timeline.py b/timeline.py index 4ab9f79..ccd7aa4 100755 --- a/timeline.py +++ b/timeline.py @@ -22,10 +22,9 @@ import locale import os import platform import sys +import ConfigParser +from sugar.activity.activity import Activity -if platform.system() != "Windows": - import wxversion - wxversion.ensureMinimal('2.8') # Make sure that we can import timelinelib sys.path.insert(0, os.path.dirname(__file__)) @@ -48,9 +47,25 @@ if platform.system() == "Windows": language, encoding = locale.getdefaultlocale() os.environ['LANG'] = language -gettext.install(APPLICATION_NAME.lower(), LOCALE_DIR, unicode=True) +class TimeLine(Activity): -application_arguments = ApplicationArguments() -application_arguments.parse_from(sys.argv[1:]) + def __init__(self, handle): + Activity.__init__(self, handle) + + iniciar_actividad() + +def iniciar_actividad(): + + file_activity_info = ConfigParser.ConfigParser() + activity_info_path = os.path.abspath('./activity/activity.info') + file_activity_info.read(activity_info_path) + bundle_id = file_activity_info.get('Activity', 'bundle_id') + path = os.path.abspath('locale') + + gettext.install(bundle_id, path, unicode=True) + + application_arguments = ApplicationArguments() + application_arguments.parse_from() + + start_wx_application(application_arguments) -start_wx_application(application_arguments) diff --git a/timelinelib/config/arguments.py b/timelinelib/config/arguments.py index 674af8b..4dd8fc9 100644 --- a/timelinelib/config/arguments.py +++ b/timelinelib/config/arguments.py @@ -35,16 +35,18 @@ class ApplicationArguments(object): "-c", "--config-file", dest="config_file_path", default=None, help="Path to config file") - def parse_from(self, arguments): - (self.options, self.arguments) = self.option_parser.parse_args(arguments) + def parse_from(self): + #(self.options, self.arguments) = self.option_parser.parse_args(arguments) + self.options = "{'config_file_path': None}" + self.arguments = [] def get_files(self): return self.arguments def get_config_file_path(self): - if self.options.config_file_path: - return self.options.config_file_path - else: - return os.path.join( + #if self.options.config_file_path: + # return self.options.config_file_path + #else: + return os.path.join( wx.StandardPaths.Get().GetUserConfigDir(), ".thetimelineproj.cfg") |