From: Andy Spencer Date: Sat, 1 Feb 2014 22:50:58 +0000 (+0000) Subject: Add template UI X-Git-Url: http://pileus.org/git/?p=~andy%2Fcsm213a-hw;a=commitdiff_plain;h=2cd0c0e6b9c2f65254909c807199d61ba63a1667 Add template UI --- diff --git a/.gitignore b/.gitignore index 83fd702..4b4699f 100644 --- a/.gitignore +++ b/.gitignore @@ -3,5 +3,8 @@ *.elf *.lib *.o +*.pyc +*.swp *~ +__pycache__ config.mk diff --git a/vis/config.py b/vis/config.py new file mode 100644 index 0000000..652ad64 --- /dev/null +++ b/vis/config.py @@ -0,0 +1,3 @@ +class Config: + def __init__(self): + pass diff --git a/vis/main.py b/vis/main.py new file mode 100755 index 0000000..605bc30 --- /dev/null +++ b/vis/main.py @@ -0,0 +1,20 @@ +#!/usr/bin/env python + +from config import Config +from xively import Xively +from serial import Serial +from visual import Visual + +class Main: + def __init__(self): + self.config = Config(); + self.xively = Xively(); + self.serial = Serial(); + self.visual = Visual(); + + def main(self): + self.visual.run() + +if __name__ == "__main__": + main = Main() + main.main() diff --git a/vis/makefile b/vis/makefile new file mode 100644 index 0000000..9f2eec9 --- /dev/null +++ b/vis/makefile @@ -0,0 +1,5 @@ +run: + ./main.py + +clean: + rm -rf *.pyc __pycache__ diff --git a/vis/readme.txt b/vis/readme.txt new file mode 100644 index 0000000..d95dc8d --- /dev/null +++ b/vis/readme.txt @@ -0,0 +1,5 @@ +Main - Topleve main program +Visual - gtk visualizations of sensor data +Config - Saved configuration interface +Serial - Serial communication with mbed +Xively - interface to Xively diff --git a/vis/serial.py b/vis/serial.py new file mode 100644 index 0000000..e1de341 --- /dev/null +++ b/vis/serial.py @@ -0,0 +1,3 @@ +class Serial: + def __init__(self): + pass diff --git a/vis/visual.py b/vis/visual.py new file mode 100644 index 0000000..0d3550e --- /dev/null +++ b/vis/visual.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python + +import pygtk +import gtk + +class Visual: + def __init__(self): + self.builder = gtk.Builder() + self.builder.add_from_file('visual.ui') + self.builder.connect_signals(self) + self.window = self.builder.get_object("window") + self.settings = self.builder.get_object("settings") + + # Signal handlers + def on_hide(self, win, *args): + self.settings.hide() + return True + + def on_show(self, act): + self.settings.show() + return True + + def on_connect(self, win): + print "Unimplemented: on_connect" + return True + + def on_enable(self, _): + print "Unimplemented: on_enable" + return True + + def on_rate(self, _): + print "Unimplemented: on_rate" + return True + + def on_key(self, win, ev): + if ev.string == 'q': + gtk.main_quit(); + + def on_destroy(self, win): + gtk.main_quit() + + # Methods + def run(self): + self.window.show() + gtk.main() diff --git a/vis/visual.ui b/vis/visual.ui new file mode 100644 index 0000000..0ac54bf --- /dev/null +++ b/vis/visual.ui @@ -0,0 +1,978 @@ + + + + + + 100 + 1 + 1 + 10 + + + 100 + 1 + 1 + 10 + + + 100 + 1 + 1 + 10 + + + 100 + 1 + 1 + 10 + + + + Serial + gtk-connect + + + + Settings + gtk-preferences + + + + Xively + gtk-connect + + + + False + 5 + True + True + dialog + window + + + + + True + False + 2 + + + True + False + end + + + Close + True + True + True + + + + False + False + 0 + + + + + False + True + 0 + + + + + True + False + 0 + none + + + True + False + 12 + + + True + False + 3 + 2 + 20 + + + True + False + 0 + Username + + + GTK_FILL + GTK_FILL + + + + + True + False + 0 + Password + + + 1 + 2 + GTK_FILL + GTK_FILL + + + + + True + False + 0 + API Key + + + 2 + 3 + GTK_FILL + GTK_FILL + + + + + True + True + ● + False + False + True + True + + + 1 + 2 + GTK_FILL + + + + + True + True + ● + True + False + False + True + True + + + 1 + 2 + 1 + 2 + GTK_FILL + + + + + True + True + ● + True + False + False + True + True + + + 1 + 2 + 2 + 3 + GTK_FILL + + + + + + + + + True + False + Xively Settings + + + + + + + + True + True + 1 + + + + + + close + + + + 100 + 1 + 1 + 10 + + + False + + + + + True + False + + + True + False + both + + + serial_con + True + False + True + + + False + True + + + + + xively_con + True + False + True + + + False + True + + + + + True + False + + + False + True + + + + + setting_act + True + False + settings + True + + + False + True + + + + + False + True + 0 + + + + + True + True + True + + + True + False + 6 + 2 + 20 + + + Acceorometer + True + True + False + True + + + + 1 + 2 + GTK_FILL + GTK_FILL + + + + + Magnometer + True + True + False + True + + + + 2 + 3 + GTK_FILL + GTK_FILL + + + + + Analog to Digital + True + True + False + True + + + + 5 + 6 + GTK_FILL + GTK_FILL + + + + + Tounch Sensor + True + True + False + True + + + + 3 + 4 + GTK_FILL + GTK_FILL + + + + + Light Sensor + True + True + False + True + + + + 4 + 5 + GTK_FILL + GTK_FILL + + + + + True + False + Sensor + + + + + + GTK_FILL + GTK_FILL + + + + + True + False + Collection Rate + + + + + + 1 + 2 + GTK_FILL + + + + + True + True + ● + False + False + True + True + a2d_adj + True + + + + 1 + 2 + 5 + 6 + GTK_FILL + + + + + True + True + ● + False + False + True + True + accel_adj + True + + + 1 + 2 + 1 + 2 + GTK_FILL + + + + + True + True + ● + False + False + True + True + mag_adj + True + + + + 1 + 2 + 2 + 3 + GTK_FILL + + + + + True + True + ● + False + False + True + True + touch_adj + True + + + + 1 + 2 + 3 + 4 + GTK_FILL + + + + + True + True + ● + False + False + True + True + light_adj + True + + + + 1 + 2 + 4 + 5 + GTK_FILL + + + + + + + True + False + 1 + Controls + + + False + + + + + True + False + 6 + 2 + 20 + 5 + + + True + False + Sensor + + + + + + GTK_FILL + GTK_FILL + + + + + True + False + Current Value + + + + + + 1 + 2 + GTK_FILL + + + + + True + False + + + True + False + 0 + X: 0.0 + + + True + True + 0 + + + + + True + False + 0 + Y: 0.0 + + + True + True + 1 + + + + + True + False + 0 + Z: 0.0 + + + True + True + 2 + + + + + 1 + 2 + 1 + 2 + GTK_FILL + + + + + True + False + + + True + False + 0 + X: 0.0 + + + True + True + 0 + + + + + True + False + 0 + Y: 0.0 + + + True + True + 1 + + + + + True + False + 0 + Z: 0.0 + + + True + True + 2 + + + + + 1 + 2 + 2 + 3 + GTK_FILL + + + + + True + False + True + + + True + False + 0 + 0.0 + + + True + True + 0 + + + + + True + False + 0 + 0.0 + + + True + True + 1 + + + + + True + False + 0 + 0.0 + + + True + True + 2 + + + + + True + False + 0 + 0.0 + + + True + True + 3 + + + + + True + False + 0 + 0.0 + + + True + True + 4 + + + + + True + False + 0 + 0.0 + + + True + True + 5 + + + + + 1 + 2 + 5 + 6 + GTK_FILL + + + + + True + False + 0 + 0.0 + + + 1 + 2 + 3 + 4 + GTK_FILL + + + + + True + False + 0 + 0.0 + + + 1 + 2 + 4 + 5 + GTK_FILL + + + + + True + False + 0 + Accelerometer + + + 1 + 2 + GTK_FILL + GTK_FILL + + + + + True + False + 0 + Magnometer + + + 2 + 3 + GTK_FILL + GTK_FILL + + + + + True + False + 0 + Touch Sensor + + + 3 + 4 + GTK_FILL + GTK_FILL + + + + + True + False + 0 + Light Sensor + + + 4 + 5 + GTK_FILL + GTK_FILL + + + + + True + False + 0 + Analog to Digital + + + 5 + 6 + GTK_FILL + GTK_FILL + + + + + 1 + + + + + True + False + Data + + + 1 + False + + + + + True + False + Plots + + + 2 + + + + + True + False + Plots + + + 2 + False + + + + + True + True + automatic + automatic + + + True + True + + + + + 3 + + + + + True + False + Serial + + + 3 + False + + + + + True + True + 1 + + + + + True + False + + + True + False + gtk-no + + + False + True + 0 + + + + + True + False + 2 + + + True + True + 1 + + + + + False + True + 2 + + + + + + diff --git a/vis/xively.py b/vis/xively.py new file mode 100644 index 0000000..15e536c --- /dev/null +++ b/vis/xively.py @@ -0,0 +1,3 @@ +class Xively: + def __init__(self): + pass