Skip to content
Browse files

wrapped gnomepanel import in try/except so that you can use dzen output.

prefs still dont work without it, but thats alright
  • Loading branch information...
1 parent 81328c2 commit 72355e5054000c222b7069a23b864cb7067dfb11 @teleshoes committed Jan 3, 2012
Showing with 17 additions and 4 deletions.
  1. +7 −1 src/gui.py
  2. +10 −3 src/tpbattstat.py
View
8 src/gui.py
@@ -24,7 +24,13 @@
from prefs import SCHEMA_DIR
import gtk
import gtk.gdk
-import gnomeapplet
+
+try:
+ import gnomeapplet
+ gnomeappletOk = True
+except ImportError:
+ gnomeappletOk = False
+
IMAGE_DIR = '/usr/share/pixmaps/tpbattstat-applet/svg'
IMAGE_HEIGHT = 24
View
13 src/tpbattstat.py
@@ -30,7 +30,11 @@
import sys
import gtk
import gobject
-import gnomeapplet
+try:
+ import gnomeapplet
+ gnomeappletOk = True
+except ImportError:
+ gnomeappletOk = False
import time
import socket
@@ -119,7 +123,10 @@ def main():
showAndExit(window)
elif arg == "-p" or arg == "--prefs" or arg == "prefs":
- applet = gnomeapplet.Applet()
+ if gnomeappletOk:
+ applet = gnomeapplet.Applet()
+ else:
+ applet = None
prefsDialog = TPBattStatApplet(applet).getGui().getPreferencesDialog()
showAndExit(prefsDialog)
@@ -132,7 +139,7 @@ def main():
gtk.main()
sys.exit()
- else:
+ elif gnomeappletOk:
gnomeapplet.bonobo_factory(
"OAFIID:TPBattStatApplet_Factory",
gnomeapplet.Applet.__gtype__,

0 comments on commit 72355e5

Please sign in to comment.
Something went wrong with that request. Please try again.