--- /dev/null
+oldschool (0.9.0-1) unstable; urgency=low
+
+ * Initial release
+
+ -- Richard Merren <richard@merren.net> Wed, 2 Jun 2010 08:30:49 -0500
+
--- /dev/null
+Source: oldschool
+Section: user/desktop
+Priority: extra
+Maintainer: Richard Merren <richard@merren.net>
+Build-Depends: debhelper (>= 5)
+Standards-Version: 3.7.2
+
+Package: oldschool
+Architecture: any
+Depends: python2.5, python-dbus, python2.5-qt4-core, python2.5-qt4-gui
+Description: Downgrade your N900 back to the 1990s.
+ Shows an old-school style green screen complete with working power and signal-level bars. Touch on QUIT to exit.
+XB-Maemo-Icon-26:
+ begin-base64 644 old_school_icon.png
+ iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c
+ 6QAAAAZiS0dEALgA7wBgNvgObwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0
+ SU1FB9oGARUIMlJuvT8AAAAZdEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJ
+ TVBXgQ4XAAAHF0lEQVRo3tVYO2sdRxg9396VrqQ4thw/CBIYhRgCqQxuVbpw
+ YzBu0hiUIq0dSOUuIl3a+A9YJE0CgYCbEFKmFaQIwYWTiBAJ2/ghWe+rnTkp
+ dh7fzO59yLYE3kLavfuY73nO+UbQ59gxTxemOmfvYcDxuLccL0QAAhCABCR5
+ kv6hPtf6OQFACIpeIWNrpUwtd+XU/cnOmaU2G/IvYN9s3Nnn+hckz3115+4g
+ +/Hl158Ha6ktp/bJG5Sa2DQhGk9IfUbCoocD7gGwKyc6M4tTnXOJI2Ua9Sc/
+ 7vH5DVAAIUgOdIA0MeTeGNJZTlh3CkZHoJyqHRVlvK3/iw3PFFKiKydwYLfn
+ 1s3DexvVP5dPlR/cbjiwWa1+27ObN4IpBIwxiRMiklwT1i3NxJBYQgQT472z
+ kmShUVBUOXF+ljKJyu5hy6zeWq/+wnT54e3gwHb1aGHHPr3ZwXj4ChEdEHHm
+ qHMAsDBqPUkKhG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s4jWxv5wjCvqGRV1G/qOdQbiTK7KR2REKSEJ
+ LFpJ3w81rvsjKQnlcJ/hzFMFVbY9gpV6QEiHCIzUAxpprF6VCkTDHKy2XOiZ
+ t0miwkyca7LTzU+4DKh65SHqyDOxxnpJ4JOZ2Mt1k2JxaYFwStDWASfCrkat
+ 32oUcvVG94Ik+RwCo2zM8bEnWpSEqLICmyNxcwDKJjhJobWkE3NktpMwIpGJ
+ oif9l9lE5inJhv0izT1pCvrN93pW9v8TMddnM2C0eYA557qODvTCpFyidkqR
+ ick8l25MMuHz+qy0NFoLuMFiNC8SGYLIhUkwcpUqtaM1eTH0HHPH9P5RKO9Y
+ j35/qs6AH/HatgyGZUBrGLWLpTWPZDt2GvV8+UiuotHcU21otXoiq5qNNmIf
+ hG2VQLhSRzVLPzW0SRzqqVahjeUUpra4UGThLBDyy4vPPPikXS9NVAiMysZc
+ 0tw+dPgvyF/KN4qyDzGDKifeRJOrkiguA5IoGXFREzUVBBRp6JeWgT3fHgmD
+ eDtkavKiFn6MtoRxU9Lnyzbgour39t9bd7Pad+T0u+xzn/k5G2uGs2ydAm/5
+ 8dY7UA66efX0vTe20M8vPj0aBwqUPYtq/FUXv3r63tD7R1c+Za/oFtNrwwx/
+ VSP8e0cV/W4xvVac7MwtjxL9wzpx1MYDwMnO3HJxfuzS/VHrd1QnjsN4ADg/
+ dul+MdudX5oszq68KSeOy/jJ4uzKbHd+qQCAixPXFw+DJP2cOC7jtc0FAMx2
+ 55cudK/cfR0njtP4C90rd2e780sNCfbnznff/Lv/663D1PlxYH1u/MdTN2+j
+ TUMCwOr+bwsP935a3LVP5w7jxHHU/MWJ64s+8n0d0I48Ofj92kuzcnnfrs/0
+ I7thRPY6JNUtptdOduaWz49dup8b7o//AeX1CxTZvb8IAAAAAElFTkSuQmCC
+ ====
--- /dev/null
+This package was debianized by Richard Merren <richard@merren.net> on
+Wed, 2 Jun 2010 08:30:49 -0500.
+
+It was downloaded from <fill in http/ftp site>
+
+Upstream Author: Richard Merren <richard@merren.net>
+
+Copyright: 2010 Richard Merren
+
+License:
+
+ This package is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This package is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this package; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+On Debian systems, the complete text of the GNU General
+Public License can be found in `/usr/share/common-licenses/GPL'.
+
+
+The Debian packaging is (C) 2010, Richard Merren <richard@merren.net> and
+is licensed under the GPL, see `/usr/share/common-licenses/GPL'.
+
--- /dev/null
+opt/oldschool/
+usr/share/applications/hildon/
+usr/share/icons/hicolor/48x48/hildon/
+usr/share/icons/hicolor/scalable/hildon/
--- /dev/null
+oldschool_0.9.0-1_i386.deb user/desktop extra
--- /dev/null
+Package: oldschool
+Version: 0.9.0-1
+Section: user/desktop
+Priority: extra
+Architecture: i386
+Depends: python2.5, python-dbus, python2.5-qt4-core, python2.5-qt4-gui
+Installed-Size: 108
+Maintainer: Richard Merren <richard@merren.net>
+Description: Downgrade your N900 back to the 1990s.
+ Shows an old-school style green screen complete with working power and signal-level bars. Touch on QUIT to exit.
+Maemo-Icon-26:
+ begin-base64 644 old_school_icon.png
+ iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c
+ 6QAAAAZiS0dEALgA7wBgNvgObwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0
+ SU1FB9oGARUIMlJuvT8AAAAZdEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJ
+ TVBXgQ4XAAAHF0lEQVRo3tVYO2sdRxg9396VrqQ4thw/CBIYhRgCqQxuVbpw
+ YzBu0hiUIq0dSOUuIl3a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wqUPYtq/FUXv3r63tD7R1c+Za/oFtNrwwx/
+ VSP8e0cV/W4xvVac7MwtjxL9wzpx1MYDwMnO3HJxfuzS/VHrd1QnjsN4ADg/
+ dul+MdudX5oszq68KSeOy/jJ4uzKbHd+qQCAixPXFw+DJP2cOC7jtc0FAMx2
+ 55cudK/cfR0njtP4C90rd2e780sNCfbnznff/Lv/663D1PlxYH1u/MdTN2+j
+ TUMCwOr+bwsP935a3LVP5w7jxHHU/MWJ64s+8n0d0I48Ofj92kuzcnnfrs/0
+ I7thRPY6JNUtptdOduaWz49dup8b7o//AeX1CxTZvb8IAAAAAElFTkSuQmCC
+ ====
--- /dev/null
+6c9d60d24cd43fa653711dd945b635fe usr/share/doc/oldschool/copyright
+793e028d76998a0c6699f74a9114fb62 usr/share/doc/oldschool/changelog.Debian.gz
+7802af5834765b65982026079c580c6e usr/share/icons/hicolor/48x48/hildon/old_school_icon.png
+7802af5834765b65982026079c580c6e usr/share/icons/hicolor/scalable/hildon/old_school_icon.png
+859cb5ab8a1822024f599d68cce259e9 usr/share/applications/hildon/oldschool.desktop
+695752da337235ac07b31ee6959052f1 opt/oldschool/old_school.py
+766460544b48e4386d55c936763a401e opt/oldschool/old_school_bg.jpg
+e54a53bfc36395a242b8a1df00b36a63 opt/oldschool/n900_levels.py
--- /dev/null
+#!/usr/bin/env python
+
+import dbus
+from PyQt4 import QtCore
+
+#Thanks to code from http://qt-mobility.blogspot.com/2010/03/getting-n900-battery-level-via-python-d.html
+
+class LevelReader(QtCore.QObject):
+ #Declare signals
+ battery_change = QtCore.pyqtSignal(int) #Fired when battery level changes
+ signal_change = QtCore.pyqtSignal(int) #Fired when signal level changes
+
+ #Class level variables
+ battery_level = -666 #initialize to invalid number
+ signal_level = -666 #initialize to invalid number
+ refresh_seconds = 5 #frequency of refresh
+ timer = QtCore.QTimer()
+ battery_dev_obj = None
+ phone_net_intf = None
+
+ def __init__(self):
+ QtCore.QObject.__init__(self)
+
+ #Need the system bus locally
+ bus = dbus.SystemBus()
+
+ #Set up battery dbus object interface as class-level variable
+ try:
+ hal_obj = bus.get_object('org.freedesktop.Hal','/org/freedesktop/Hal/Manager')
+ hal = dbus.Interface(hal_obj,'org.freedesktop.Hal.Manager')
+ uids = hal.FindDeviceByCapability('battery')
+ self.battery_dev_obj = bus.get_object('org.freedesktop.Hal', uids[0])
+ except dbus.DBusException:
+ print "ERROR: Unable to connect to battery charge dbus object"
+ self.battery_dev_obj = None
+ except Exception,e:
+ print "ERROR: Unknown exception connecting to DBus for battery charge: ", e
+ self.battery_dev_obj = None
+
+ #Set up signal level dbus interface as class-level variable
+ try:
+ phone_net_obj = bus.get_object('com.nokia.phone.net','/com/nokia/phone/net', introspect=False)
+ self.phone_net_intf = dbus.Interface(self.phone_net_obj,'Phone.Net')
+ except dbus.DBusException:
+ print "ERROR: Unable to connect to signal level dbus object"
+ self.phone_net_intf = None
+ except Exception,e:
+ print "ERROR: Unknown exception connecting to DBus for signal level: ", e
+ self.phone_net_intf = None
+
+ #bind my checks to the timer
+ QtCore.QObject.connect(self.timer, QtCore.SIGNAL("timeout()"), self, QtCore.SLOT("check_battery_change()"))
+ QtCore.QObject.connect(self.timer, QtCore.SIGNAL("timeout()"), self, QtCore.SLOT("check_signal_change()"))
+ self.timer.start(5 * self.refresh_seconds)
+
+ # Read the dbus values
+
+ def get_battery_percentage(self):
+ if self.battery_dev_obj==None:
+ return 0
+ try:
+ prop_value = self.battery_dev_obj.GetProperty('battery.charge_level.percentage')
+ int_value = int(prop_value)
+ return int_value
+ except dbus.DBusException:
+ return 0
+
+ def get_signal_percentage(self):
+ if self.phone_net_intf==None:
+ return 0
+ try:
+ dbus_return = self.phone_net_intf.get_signal_strength()
+ return int(dbus_return[0])
+ except dbus.DBusException:
+ return 0
+
+ #Declare my Qt Slots for binding with the timer
+
+ @QtCore.pyqtSlot()
+ def check_battery_change(self):
+ new_battery_level = self.get_battery_percentage()
+ if new_battery_level==self.battery_level:
+ return
+ self.battery_level = new_battery_level
+ self.battery_change.emit(new_battery_level)
+
+ @QtCore.pyqtSlot()
+ def check_signal_change(self):
+ new_signal_level = self.get_signal_percentage()
+ if new_signal_level==self.signal_level:
+ return
+ self.signal_level = new_signal_level
+ self.signal_change.emit(new_signal_level)
--- /dev/null
+#!/usr/bin/env python
+
+import sys
+from PyQt4 import QtGui, QtCore
+from n900_levels import LevelReader
+
+bar_width = 140
+bar_length = 35
+signal_bar_y = 430
+power_bar_y = 15
+
+quit_x_min = 700
+quit_x_max = 765
+quit_y_min = 160
+quit_y_max = 335
+
+bar_x_1 = 460
+bar_x_2 = 310
+bar_x_3 = 160
+bar_x_4 = 10
+
+class Bar(QtGui.QWidget):
+ def __init__(self, parent, x, y, fill_percent=100, mirror=False):
+ QtGui.QWidget.__init__(self, parent)
+ self.resize(bar_width, bar_length)
+ self.move(x, y)
+
+ label_y = 0
+ label_length = bar_length * fill_percent / 100
+ if (mirror):
+ label_y = bar_length - label_length
+
+ self.label = QtGui.QLabel(self)
+ self.label.resize(bar_width, label_length)
+ if label_y>0:
+ self.label.move(0, label_y)
+ self.label.setStyleSheet("background-color: black")
+
+
+class OldSchoolWidget(QtGui.QWidget):
+ power_bar = []
+ signal_bar = []
+ quit_pressed = QtCore.pyqtSignal()
+
+ def __init__(self, parent=None):
+ QtGui.QWidget.__init__(self, parent)
+ palette = QtGui.QPalette()
+ palette.setBrush(self.backgroundRole(), QtGui.QBrush(QtGui.QImage("old_school_bg.jpg")));
+ self.setPalette(palette)
+
+ self.power_bar.append(Bar(self, bar_x_1, power_bar_y, 25))
+ self.power_bar.append(Bar(self, bar_x_2, power_bar_y, 50))
+ self.power_bar.append(Bar(self, bar_x_3, power_bar_y, 75))
+ self.power_bar.append(Bar(self, bar_x_4, power_bar_y, 100))
+
+ self.signal_bar.append(Bar(self, bar_x_1, signal_bar_y, 25, True))
+ self.signal_bar.append(Bar(self, bar_x_2, signal_bar_y, 50, True))
+ self.signal_bar.append(Bar(self, bar_x_3, signal_bar_y, 75, True))
+ self.signal_bar.append(Bar(self, bar_x_4, signal_bar_y, 100, True))
+
+ def mousePressEvent(self, ev):
+ click_position = QtCore.QPoint(ev.pos())
+ x = click_position.x()
+ y = click_position.y()
+ if (x>=quit_x_min and x <=quit_x_max and y>=quit_y_min and y<=quit_y_max):
+ self.quit_pressed.emit()
+
+ def percent_to_bars(self, percent):
+ if percent<=20:
+ return 0
+ if percent <=40:
+ return 1
+ if percent <=60:
+ return 2
+ if percent <=80:
+ return 3
+ return 4
+
+ def set_signal(self, value):
+ for index in range(1, 4):
+ bar = self.signal_bar[index]
+ if value>index:
+ bar.show()
+ else:
+ bar.hide()
+
+ @QtCore.pyqtSlot(int)
+ def set_signal_percent(self, percentage):
+ bar_count = self.percent_to_bars(percentage)
+ self.set_signal(bar_count)
+
+ def set_power(self, value):
+ for index in range(1, 4):
+ bar = self.power_bar[index]
+ if value>index:
+ bar.show()
+ else:
+ bar.hide()
+
+ @QtCore.pyqtSlot(int)
+ def set_power_percent(self, percentage):
+ bar_count = self.percent_to_bars(percentage)
+ self.set_power(bar_count)
+
+def do_normal():
+ app = QtGui.QApplication(sys.argv)
+ old_school = OldSchoolWidget()
+ old_school.showFullScreen()
+ QtCore.QObject.connect(old_school, QtCore.SIGNAL('quit_pressed()'),QtGui.qApp, QtCore.SLOT('quit()'))
+ level_reader = LevelReader()
+ QtCore.QObject.connect(level_reader, QtCore.SIGNAL("battery_change(int)") , old_school, QtCore.SLOT("set_power_percent(int)"))
+ QtCore.QObject.connect(level_reader, QtCore.SIGNAL("signal_change(int)") , old_school, QtCore.SLOT("set_signal_percent(int)"))
+ level_reader.check_battery_change()
+ level_reader.check_signal_change()
+ sys.exit(app.exec_())
+
+def do_test_gui():
+ app = QtGui.QApplication(sys.argv)
+ old_school = OldSchoolWidget()
+ old_school.resize(800, 480)
+ old_school.show()
+ QtCore.QObject.connect(old_school, QtCore.SIGNAL('quit_pressed()'),QtGui.qApp, QtCore.SLOT('quit()'))
+ old_school.set_signal_percent(75)
+ old_school.set_power_percent(30)
+ sys.exit(app.exec_())
+
+if __name__ == "__main__":
+ args = sys.argv
+ if len(args)>1:
+ if args[1]=="test_gui":
+ do_test_gui()
+ quit()
+ do_normal()
+
--- /dev/null
+ [Desktop Entry]
+ Version=1.0.0
+ Encoding=UTF-8
+ Name=Old School
+ Comment=Downgrade your phone to the 1990s
+ Exec=/opt/oldschool/old_school.py
+ Icon=old_school_icon
+ X-Icon-path=/usr/share/icons
+ X-Window-Icon=old_school_icon
+ Type=Application
+ StartupWMClass=OldSchool
+
--- /dev/null
+This package was debianized by Richard Merren <richard@merren.net> on
+Wed, 2 Jun 2010 08:30:49 -0500.
+
+It was downloaded from <fill in http/ftp site>
+
+Upstream Author: Richard Merren <richard@merren.net>
+
+Copyright: 2010 Richard Merren
+
+License:
+
+ This package is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This package is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this package; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+On Debian systems, the complete text of the GNU General
+Public License can be found in `/usr/share/common-licenses/GPL'.
+
+
+The Debian packaging is (C) 2010, Richard Merren <richard@merren.net> and
+is licensed under the GPL, see `/usr/share/common-licenses/GPL'.
+
--- /dev/null
+#!/usr/bin/make -f
+# -*- makefile -*-
+# Sample debian/rules that uses debhelper.
+# This file was originally written by Joey Hess and Craig Small.
+# As a special exception, when this file is copied by dh-make into a
+# dh-make output file, you may use that output file without restriction.
+# This special exception was added by Craig Small in version 0.37 of dh-make.
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+
+
+
+CFLAGS = -Wall -g
+
+ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
+ CFLAGS += -O0
+else
+ CFLAGS += -O2
+endif
+
+configure: configure-stamp
+configure-stamp:
+ dh_testdir
+ # Add here commands to configure the package.
+
+ touch configure-stamp
+
+
+build: build-stamp
+
+build-stamp: configure-stamp
+ dh_testdir
+
+ # Add here commands to compile the package.
+ #$(MAKE)
+ #docbook-to-man debian/oldschool.sgml > oldschool.1
+
+ #touch $@
+ touch build-stamp
+
+clean:
+ dh_testdir
+ dh_testroot
+ rm -f build-stamp configure-stamp
+
+ # Add here commands to clean up after the build process.
+ #commented out by rbm
+ #-$(MAKE) clean
+
+ dh_clean
+
+install: build
+ dh_testdir
+ dh_testroot
+ dh_clean -k
+ dh_installdirs
+
+ # Add here commands to install the package into debian/oldschool.
+ #commented out by rbm
+ #$(MAKE) DESTDIR=$(CURDIR)/debian/oldschool install
+ mkdir -p "$(CURDIR)/debian/oldschool/"
+
+ mkdir -p "$(CURDIR)/debian/oldschool/opt/oldschool/"
+ cp -a "src/opt/oldschool/n900_levels.py" "$(CURDIR)/debian/oldschool/opt/oldschool/n900_levels.py"
+ mkdir -p "$(CURDIR)/debian/oldschool/opt/oldschool/"
+ cp -a "src/opt/oldschool/old_school.py" "$(CURDIR)/debian/oldschool/opt/oldschool/old_school.py"
+ mkdir -p "$(CURDIR)/debian/oldschool/opt/oldschool/"
+ cp -a "src/opt/oldschool/old_school_bg.jpg" "$(CURDIR)/debian/oldschool/opt/oldschool/old_school_bg.jpg"
+ mkdir -p "$(CURDIR)/debian/oldschool/usr/share/applications/hildon/"
+ cp -a "src/usr/share/applications/hildon/oldschool.desktop" "$(CURDIR)/debian/oldschool/usr/share/applications/hildon/oldschool.desktop"
+ mkdir -p "$(CURDIR)/debian/oldschool/usr/share/icons/hicolor/scalable/hildon/"
+ cp -a "src/usr/share/icons/hicolor/scalable/hildon/old_school_icon.png" "$(CURDIR)/debian/oldschool/usr/share/icons/hicolor/scalable/hildon/old_school_icon.png"
+ mkdir -p "$(CURDIR)/debian/oldschool/usr/share/icons/hicolor/48x48/hildon/"
+ cp -a "src/usr/share/icons/hicolor/48x48/hildon/old_school_icon.png" "$(CURDIR)/debian/oldschool/usr/share/icons/hicolor/48x48/hildon/old_school_icon.png"
+
+
+# Build architecture-independent files here.
+binary-indep: build install
+# We have nothing to do by default.
+
+# Build architecture-dependent files here.
+binary-arch: build install
+ dh_testdir
+ dh_testroot
+ dh_installchangelogs
+ dh_installdocs
+ dh_installexamples
+# dh_install
+# dh_installmenu
+# dh_installdebconf
+# dh_installlogrotate
+# dh_installemacsen
+# dh_installpam
+# dh_installmime
+# dh_python
+# dh_installinit
+# dh_installcron
+# dh_installinfo
+ dh_installman
+ dh_link
+ dh_strip
+ dh_compress
+ dh_fixperms
+# dh_perl
+# dh_makeshlibs
+ dh_installdeb
+ dh_shlibdeps
+ dh_gencontrol
+ dh_md5sums
+ dh_builddeb
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install configure
--- /dev/null
+#!/usr/bin/env python
+
+import dbus
+from PyQt4 import QtCore
+
+#Thanks to code from http://qt-mobility.blogspot.com/2010/03/getting-n900-battery-level-via-python-d.html
+
+class LevelReader(QtCore.QObject):
+ #Declare signals
+ battery_change = QtCore.pyqtSignal(int) #Fired when battery level changes
+ signal_change = QtCore.pyqtSignal(int) #Fired when signal level changes
+
+ #Class level variables
+ battery_level = -666 #initialize to invalid number
+ signal_level = -666 #initialize to invalid number
+ refresh_seconds = 5 #frequency of refresh
+ timer = QtCore.QTimer()
+ battery_dev_obj = None
+ phone_net_intf = None
+
+ def __init__(self):
+ QtCore.QObject.__init__(self)
+
+ #Need the system bus locally
+ bus = dbus.SystemBus()
+
+ #Set up battery dbus object interface as class-level variable
+ try:
+ hal_obj = bus.get_object('org.freedesktop.Hal','/org/freedesktop/Hal/Manager')
+ hal = dbus.Interface(hal_obj,'org.freedesktop.Hal.Manager')
+ uids = hal.FindDeviceByCapability('battery')
+ self.battery_dev_obj = bus.get_object('org.freedesktop.Hal', uids[0])
+ except dbus.DBusException:
+ print "ERROR: Unable to connect to battery charge dbus object"
+ self.battery_dev_obj = None
+ except Exception,e:
+ print "ERROR: Unknown exception connecting to DBus for battery charge: ", e
+ self.battery_dev_obj = None
+
+ #Set up signal level dbus interface as class-level variable
+ try:
+ phone_net_obj = bus.get_object('com.nokia.phone.net','/com/nokia/phone/net', introspect=False)
+ self.phone_net_intf = dbus.Interface(self.phone_net_obj,'Phone.Net')
+ except dbus.DBusException:
+ print "ERROR: Unable to connect to signal level dbus object"
+ self.phone_net_intf = None
+ except Exception,e:
+ print "ERROR: Unknown exception connecting to DBus for signal level: ", e
+ self.phone_net_intf = None
+
+ #bind my checks to the timer
+ QtCore.QObject.connect(self.timer, QtCore.SIGNAL("timeout()"), self, QtCore.SLOT("check_battery_change()"))
+ QtCore.QObject.connect(self.timer, QtCore.SIGNAL("timeout()"), self, QtCore.SLOT("check_signal_change()"))
+ self.timer.start(5 * self.refresh_seconds)
+
+ # Read the dbus values
+
+ def get_battery_percentage(self):
+ if self.battery_dev_obj==None:
+ return 0
+ try:
+ prop_value = self.battery_dev_obj.GetProperty('battery.charge_level.percentage')
+ int_value = int(prop_value)
+ return int_value
+ except dbus.DBusException:
+ return 0
+
+ def get_signal_percentage(self):
+ if self.phone_net_intf==None:
+ return 0
+ try:
+ dbus_return = self.phone_net_intf.get_signal_strength()
+ return int(dbus_return[0])
+ except dbus.DBusException:
+ return 0
+
+ #Declare my Qt Slots for binding with the timer
+
+ @QtCore.pyqtSlot()
+ def check_battery_change(self):
+ new_battery_level = self.get_battery_percentage()
+ if new_battery_level==self.battery_level:
+ return
+ self.battery_level = new_battery_level
+ self.battery_change.emit(new_battery_level)
+
+ @QtCore.pyqtSlot()
+ def check_signal_change(self):
+ new_signal_level = self.get_signal_percentage()
+ if new_signal_level==self.signal_level:
+ return
+ self.signal_level = new_signal_level
+ self.signal_change.emit(new_signal_level)
--- /dev/null
+#!/usr/bin/env python
+
+import sys
+from PyQt4 import QtGui, QtCore
+from n900_levels import LevelReader
+
+bar_width = 140
+bar_length = 35
+signal_bar_y = 430
+power_bar_y = 15
+
+quit_x_min = 700
+quit_x_max = 765
+quit_y_min = 160
+quit_y_max = 335
+
+bar_x_1 = 460
+bar_x_2 = 310
+bar_x_3 = 160
+bar_x_4 = 10
+
+class Bar(QtGui.QWidget):
+ def __init__(self, parent, x, y, fill_percent=100, mirror=False):
+ QtGui.QWidget.__init__(self, parent)
+ self.resize(bar_width, bar_length)
+ self.move(x, y)
+
+ label_y = 0
+ label_length = bar_length * fill_percent / 100
+ if (mirror):
+ label_y = bar_length - label_length
+
+ self.label = QtGui.QLabel(self)
+ self.label.resize(bar_width, label_length)
+ if label_y>0:
+ self.label.move(0, label_y)
+ self.label.setStyleSheet("background-color: black")
+
+
+class OldSchoolWidget(QtGui.QWidget):
+ power_bar = []
+ signal_bar = []
+ quit_pressed = QtCore.pyqtSignal()
+
+ def __init__(self, parent=None):
+ QtGui.QWidget.__init__(self, parent)
+ palette = QtGui.QPalette()
+ palette.setBrush(self.backgroundRole(), QtGui.QBrush(QtGui.QImage("old_school_bg.jpg")));
+ self.setPalette(palette)
+
+ self.power_bar.append(Bar(self, bar_x_1, power_bar_y, 25))
+ self.power_bar.append(Bar(self, bar_x_2, power_bar_y, 50))
+ self.power_bar.append(Bar(self, bar_x_3, power_bar_y, 75))
+ self.power_bar.append(Bar(self, bar_x_4, power_bar_y, 100))
+
+ self.signal_bar.append(Bar(self, bar_x_1, signal_bar_y, 25, True))
+ self.signal_bar.append(Bar(self, bar_x_2, signal_bar_y, 50, True))
+ self.signal_bar.append(Bar(self, bar_x_3, signal_bar_y, 75, True))
+ self.signal_bar.append(Bar(self, bar_x_4, signal_bar_y, 100, True))
+
+ def mousePressEvent(self, ev):
+ click_position = QtCore.QPoint(ev.pos())
+ x = click_position.x()
+ y = click_position.y()
+ if (x>=quit_x_min and x <=quit_x_max and y>=quit_y_min and y<=quit_y_max):
+ self.quit_pressed.emit()
+
+ def percent_to_bars(self, percent):
+ if percent<=20:
+ return 0
+ if percent <=40:
+ return 1
+ if percent <=60:
+ return 2
+ if percent <=80:
+ return 3
+ return 4
+
+ def set_signal(self, value):
+ for index in range(1, 4):
+ bar = self.signal_bar[index]
+ if value>index:
+ bar.show()
+ else:
+ bar.hide()
+
+ @QtCore.pyqtSlot(int)
+ def set_signal_percent(self, percentage):
+ bar_count = self.percent_to_bars(percentage)
+ self.set_signal(bar_count)
+
+ def set_power(self, value):
+ for index in range(1, 4):
+ bar = self.power_bar[index]
+ if value>index:
+ bar.show()
+ else:
+ bar.hide()
+
+ @QtCore.pyqtSlot(int)
+ def set_power_percent(self, percentage):
+ bar_count = self.percent_to_bars(percentage)
+ self.set_power(bar_count)
+
+def do_normal():
+ app = QtGui.QApplication(sys.argv)
+ old_school = OldSchoolWidget()
+ old_school.showFullScreen()
+ QtCore.QObject.connect(old_school, QtCore.SIGNAL('quit_pressed()'),QtGui.qApp, QtCore.SLOT('quit()'))
+ level_reader = LevelReader()
+ QtCore.QObject.connect(level_reader, QtCore.SIGNAL("battery_change(int)") , old_school, QtCore.SLOT("set_power_percent(int)"))
+ QtCore.QObject.connect(level_reader, QtCore.SIGNAL("signal_change(int)") , old_school, QtCore.SLOT("set_signal_percent(int)"))
+ level_reader.check_battery_change()
+ level_reader.check_signal_change()
+ sys.exit(app.exec_())
+
+def do_test_gui():
+ app = QtGui.QApplication(sys.argv)
+ old_school = OldSchoolWidget()
+ old_school.resize(800, 480)
+ old_school.show()
+ QtCore.QObject.connect(old_school, QtCore.SIGNAL('quit_pressed()'),QtGui.qApp, QtCore.SLOT('quit()'))
+ old_school.set_signal_percent(75)
+ old_school.set_power_percent(30)
+ sys.exit(app.exec_())
+
+if __name__ == "__main__":
+ args = sys.argv
+ if len(args)>1:
+ if args[1]=="test_gui":
+ do_test_gui()
+ quit()
+ do_normal()
+
--- /dev/null
+ [Desktop Entry]
+ Version=1.0.0
+ Encoding=UTF-8
+ Name=Old School
+ Comment=Downgrade your phone to the 1990s
+ Exec=/opt/oldschool/old_school.py
+ Icon=old_school_icon
+ X-Icon-path=/usr/share/icons
+ X-Window-Icon=old_school_icon
+ Type=Application
+ StartupWMClass=OldSchool
+