Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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...
commit 72355e5054000c222b7069a23b864cb7067dfb11 1 parent 81328c2
Elliot Wolk authored

Showing 2 changed files with 17 additions and 4 deletions. Show diff stats Hide diff stats

  1. +7 1 src/gui.py
  2. +10 3 src/tpbattstat.py
8 src/gui.py
@@ -24,7 +24,13 @@
24 24 from prefs import SCHEMA_DIR
25 25 import gtk
26 26 import gtk.gdk
27   -import gnomeapplet
  27 +
  28 +try:
  29 + import gnomeapplet
  30 + gnomeappletOk = True
  31 +except ImportError:
  32 + gnomeappletOk = False
  33 +
28 34
29 35 IMAGE_DIR = '/usr/share/pixmaps/tpbattstat-applet/svg'
30 36 IMAGE_HEIGHT = 24
13 src/tpbattstat.py
@@ -30,7 +30,11 @@
30 30 import sys
31 31 import gtk
32 32 import gobject
33   -import gnomeapplet
  33 +try:
  34 + import gnomeapplet
  35 + gnomeappletOk = True
  36 +except ImportError:
  37 + gnomeappletOk = False
34 38 import time
35 39 import socket
36 40
@@ -119,7 +123,10 @@ def main():
119 123 showAndExit(window)
120 124
121 125 elif arg == "-p" or arg == "--prefs" or arg == "prefs":
122   - applet = gnomeapplet.Applet()
  126 + if gnomeappletOk:
  127 + applet = gnomeapplet.Applet()
  128 + else:
  129 + applet = None
123 130 prefsDialog = TPBattStatApplet(applet).getGui().getPreferencesDialog()
124 131 showAndExit(prefsDialog)
125 132
@@ -132,7 +139,7 @@ def main():
132 139 gtk.main()
133 140 sys.exit()
134 141
135   - else:
  142 + elif gnomeappletOk:
136 143 gnomeapplet.bonobo_factory(
137 144 "OAFIID:TPBattStatApplet_Factory",
138 145 gnomeapplet.Applet.__gtype__,

0 comments on commit 72355e5

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