[hamster-applet] Move standalone out of hamster module



commit 732a6aadfe4927a0e1ed61b21e1b6afd4475dfd0
Author: Patryk Zawadzki <patrys pld-linux org>
Date:   Wed Dec 30 15:17:06 2009 +0100

    Move standalone out of hamster module
    
    This allows us to 'import hamster' without altering Python's path and
    allows proper relative imports inside the hamster module.
    
    As a bonus closing the standalone window now terminates the application.

 data/hamster.ui                        |    1 +
 hamster/stuff.py                       |    2 +-
 hamster/widgets/tags.py                |    4 ++--
 hamster/standalone.py => standalone.py |   15 +++++++--------
 4 files changed, 11 insertions(+), 11 deletions(-)
---
diff --git a/data/hamster.ui b/data/hamster.ui
index 2805338..ebd8eda 100644
--- a/data/hamster.ui
+++ b/data/hamster.ui
@@ -8,6 +8,7 @@
     <property name="window_position">center</property>
     <property name="default_width">700</property>
     <property name="default_height">500</property>
+    <signal name="destroy" handler="gtk_main_quit"/>
     <child>
       <object class="GtkVBox" id="vbox1">
         <property name="visible">True</property>
diff --git a/hamster/stuff.py b/hamster/stuff.py
index f2e1f22..5c8f673 100644
--- a/hamster/stuff.py
+++ b/hamster/stuff.py
@@ -72,7 +72,7 @@ def duration_minutes(duration):
 
 
 def load_ui_file(name):
-    from configuration import runtime
+    from .configuration import runtime
     ui = gtk.Builder()
     ui.add_from_file(os.path.join(runtime.data_dir, name))
     return ui 
diff --git a/hamster/widgets/tags.py b/hamster/widgets/tags.py
index a7cdb6c..5df9a5f 100644
--- a/hamster/widgets/tags.py
+++ b/hamster/widgets/tags.py
@@ -21,9 +21,9 @@ import gtk, gobject
 import pango, cairo
 from math import pi
 
-from .hamster import graphics
+from .. import graphics
 
-from .hamster.configuration import runtime
+from ..configuration import runtime
 
 class TagsEntry(gtk.Entry):
     __gsignals__ = {
diff --git a/hamster/standalone.py b/standalone.py
similarity index 95%
rename from hamster/standalone.py
rename to standalone.py
index 4efe90e..6265298 100755
--- a/hamster/standalone.py
+++ b/standalone.py
@@ -26,18 +26,19 @@ pygtk.require("2.0")
 import gtk
 #gtk.gdk.threads_init()
 
-from configuration import GconfStore, runtime
-import widgets, stuff
+from hamster.configuration import GconfStore, runtime
+from hamster import widgets, stuff
 
 import gobject
 
-import graphics
+from hamster import graphics
 import pango, cairo
 
 class MainWindow(object):
     def __init__(self):
         self._gui = stuff.load_ui_file("hamster.ui")
         self.window = self._gui.get_object('main-window')
+	self.gtk_main_quit = gtk.main_quit
 
         #TODO - replace with the tree background color (can't get it atm!)
         self.get_widget("todays_activities_ebox").modify_bg(gtk.STATE_NORMAL,
@@ -71,7 +72,7 @@ class MainWindow(object):
         
 
     def magic(self, button, uri):
-        print uri, button
+        logging.debug('%s, %s' % (uri, button))
         
 
     def set_last_activity(self):
@@ -176,12 +177,12 @@ class MainWindow(object):
         runtime.storage.touch_fact(runtime.storage.get_last_activity())
 
     def after_activity_update(self, widget, stuff):
-        print "activity updated"
+        logging.debug("activity updated")
         self.set_last_activity()
         self.load_today()
 
     def after_fact_update(self, widget, stuff):
-        print "fact updated"
+        logging.debug("fact updated")
         self.set_last_activity()
         self.load_today()
 
@@ -190,8 +191,6 @@ class MainWindow(object):
         
     def get_widget(self, name):
         return self._gui.get_object(name)
-        
-    
 
 if __name__ == "__main__":
     gtk.window_set_default_icon_name("hamster-applet")



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]