From f888af7b69a21f3a2d30e032b4a11afa69b2cc10 Mon Sep 17 00:00:00 2001 From: epage Date: Tue, 8 Dec 2009 01:10:11 +0000 Subject: [PATCH] Fixed a bug with fremantle and contexts plus logging device to file git-svn-id: file:///svnroot/ejpi/trunk@78 df6cc7de-23d0-4ae0-bb86-c17aa67b2a9d --- src/constants.py | 2 +- src/ejpi.py | 3 +++ src/ejpi_glade.py | 17 ++++++++++++----- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/constants.py b/src/constants.py index 76dff03..f432fb3 100644 --- a/src/constants.py +++ b/src/constants.py @@ -3,7 +3,7 @@ import os __pretty_app_name__ = "e**(j pi) + 1 = 0" __app_name__ = "ejpi" __version__ = "0.9.6" -__build__ = 7 +__build__ = 8 _data_path_ = os.path.join(os.path.expanduser("~"), ".ejpi") __app_magic__ = 0xdeadbeef _user_logpath_ = "%s/ejpi.log" % _data_path_ diff --git a/src/ejpi.py b/src/ejpi.py index 193a066..403cca1 100755 --- a/src/ejpi.py +++ b/src/ejpi.py @@ -21,6 +21,9 @@ except OSError, e: logging.basicConfig(level=logging.DEBUG, filename=constants._user_logpath_) _moduleLogger.info("ejpi %s-%s" % (constants.__version__, constants.__build__)) +_moduleLogger.info("OS: %s" % (os.uname()[0], )) +_moduleLogger.info("Kernel: %s (%s) for %s" % os.uname()[2:]) +_moduleLogger.info("Hostname: %s" % os.uname()[1]) ejpi_glade.run_calculator() diff --git a/src/ejpi_glade.py b/src/ejpi_glade.py index b8e0085..a31d4f7 100755 --- a/src/ejpi_glade.py +++ b/src/ejpi_glade.py @@ -227,10 +227,11 @@ class Calculator(object): except ImportError: osso = None self._osso = None + self._deviceState = None if osso is not None: self._osso = osso.Context(constants.__app_name__, constants.__version__, False) - device = osso.DeviceState(self._osso) - device.set_device_state_callback(self._on_device_state_change, 0) + self._deviceState = osso.DeviceState(self._osso) + self._deviceState.set_device_state_callback(self._on_device_state_change, 0) else: _moduleLogger.warning("No OSSO support") @@ -322,11 +323,17 @@ class Calculator(object): @gtk_toolbox.log_exception(_moduleLogger) def _on_close(self, *args, **kwds): - if self._osso is not None: - self._osso.close() - try: self.__save_history() + + try: + self._deviceState.close() + except AttributeError: + pass # Either None or close was removed (in Fremantle) + try: + self._osso.close() + except AttributeError: + pass # Either None or close was removed (in Fremantle) finally: gtk.main_quit() -- 1.7.9.5