Added redirect_err() for easier debugging.
authorStefanos Harhalakis <v13@v13.gr>
Thu, 12 Aug 2010 13:18:36 +0000 (13:18 +0000)
committerStefanos Harhalakis <v13@v13.gr>
Thu, 12 Aug 2010 13:18:36 +0000 (13:18 +0000)
Work-around for dbus problems with portrait.py.
Version 0.8

sdist
setup.py
src/config.py
src/drlaunch_widget.py
src/portrait.py

diff --git a/sdist b/sdist
index bd94eb6..618b461 100755 (executable)
--- a/sdist
+++ b/sdist
@@ -9,9 +9,10 @@ for i in dist/drlaunch-*.tar.gz ; do
        ver=${ver%.tar.gz}
        if ! [ -d "../$ver" ] ; then
                echo "New version: $ver"
+#              cp ../drlaunch/dist/$t ..
                mkdir "../$ver"
                cp ../drlaunch/dist/$t ../$ver/$t
-               ln -s $t ../$ver/drlaunch_$ver.orig.tar.gz
+#              ln -s $t ../$ver/drlaunch_$ver.orig.tar.gz
        fi
 done
 
index 37bd9be..1240b68 100755 (executable)
--- a/setup.py
+++ b/setup.py
@@ -24,7 +24,7 @@ from distutils.core import setup
 
 setup(
     name='drlaunch',
-    version="0.7",
+    version="0.8",
     description="DrLaunch",
     author="Stefanos Harhalakis",
     author_email="v13@v13.gr",
index 5bc5f23..2ea4256 100755 (executable)
@@ -25,7 +25,7 @@ __version__ = "$Id: 0.py 2265 2010-02-21 19:16:26Z v13 $"
 import os
 import pickle
 
-version = "0.7"
+version = "0.8"
 
 try:
     from glib import get_user_config_dir
index 54ad48c..e5e27bf 100755 (executable)
@@ -27,6 +27,16 @@ from drlaunch import widget
 class DrlaunchPlugin(widget.DrlaunchPlugin):
     pass
 
+def redirect_err():
+    import sys
+    import time
+
+    print "Opening /tmp/drlaunch.log"
+    f=open('/tmp/drlaunch.log', 'at', buffering=1)
+    sys.stdout=f
+    sys.stderr=f
+    print "Log open:", time.ctime()
+
 hd_plugin_type = DrlaunchPlugin
 
 if __name__=="__main__":
index ea58c4b..4b2b457 100644 (file)
@@ -19,6 +19,7 @@
 
 import dbus
 import dbus.glib
+from dbus.mainloop.glib import DBusGMainLoop
 
 import hildon
 import osso
@@ -80,7 +81,23 @@ class FremantleRotation(object):
         self._osso_context = osso.Context(app_id, version, False)
         program = hildon.Program.get_instance()
         program.connect('notify::is-topmost', self._on_topmost_changed)
-        system_bus = dbus.Bus.get_system()
+
+       # Hack for dbus. See:
+       # https://garage.maemo.org/pipermail/pymaemo-developers/2010-April/001445.html
+       # https://garage.maemo.org/pipermail/pymaemo-developers/2010-April/001454.html
+       # https://garage.maemo.org/pipermail/pymaemo-developers/2010-April/thread.html
+       # https://bugs.maemo.org/show_bug.cgi?id=8611
+       #
+       # If we use dbus.Bus.get_system() or dbus.SystemBus() then the
+       # program fails whenever bluezwitch is installed. This could
+       # also happen whenever another widget is using System Bus (sure?).
+       # 
+        #V13 system_bus = dbus.Bus.get_system()
+       dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
+       busaddress='unix:path=/var/run/dbus/system_bus_socket'
+       system_bus=dbus.bus.BusConnection(busaddress)
+       self.system_bus=system_bus
+
         system_bus.add_signal_receiver(self._on_orientation_signal, \
                 signal_name='sig_device_orientation_ind', \
                 dbus_interface='com.nokia.mce.signal', \