From 6007b648986bc5889aa212b5c3007aa90602a244 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Sun, 3 Jan 2016 00:46:33 +0800 Subject: [PATCH] applets: add big_number --- artiq/applets/big_number.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100755 artiq/applets/big_number.py diff --git a/artiq/applets/big_number.py b/artiq/applets/big_number.py new file mode 100755 index 000000000..bb26f22ba --- /dev/null +++ b/artiq/applets/big_number.py @@ -0,0 +1,30 @@ +#!/usr/bin/env python3.5 + +from quamash import QtWidgets + +from artiq.applets.simple import SimpleApplet + + +class NumberWidget(QtWidgets.QLCDNumber): + def __init__(self, args): + QtWidgets.QLCDNumber.__init__(self) + self.setDigitCount(args.digit_count) + self.dataset_name = args.dataset + + def data_changed(self, data, mod): + try: + n = float(data[self.dataset_name][1]) + except (KeyError, ValueError, TypeError): + n = "---" + self.display(n) + + +def main(): + applet = SimpleApplet(NumberWidget) + applet.add_dataset("dataset", "dataset to show") + applet.argparser.add_argument("--digit-count", type=int, default=10, + help="total number of digits to show") + applet.run() + +if __name__ == "__main__": + main()