2
import urllib, os, time, datetime
4
from gi.repository import Gtk, GObject
5
from gi.repository import AppIndicator3 as appindicator
6
from helpers import FitBit
10
os.system("xdg-open http://www.fitbit.com")
13
steps = FitBit.fetch(None)
16
ind.set_label("%i steps" % steps.steps, "100 steps")
17
lst.get_child().set_text("Last updated: %s" % time.strftime("%H:%M"))
20
if __name__ == "__main__":
21
# icon is expected to be in the same directory as the script.
22
iconPath = '/usr/share/icons/hicolor/32x32/apps/fitbit.png'
24
ind = appindicator.Indicator.new("fitbit-steps-indicator", iconPath,
25
appindicator.IndicatorCategory.APPLICATION_STATUS)
26
ind.set_status(appindicator.IndicatorStatus.ACTIVE)
27
ind.set_label("unknown steps", "100 steps")
30
opn = Gtk.MenuItem("Open Fitbit")
32
lst = Gtk.MenuItem("Last updated: ?????")
35
opn.connect("activate", openit)
39
GObject.timeout_add_seconds(300, update)