From ba551c4a96217d6d1ab42a66eccfe40807dcaee1 Mon Sep 17 00:00:00 2001
From: Pieter de Groot
Date: Sat, 21 Feb 2009 09:56:34 +0100
Subject: [PATCH] Adding qt.version()
---
VERSION | 1 +
source/qt.py | 15 +++++++++++++++
2 files changed, 16 insertions(+)
create mode 100644 VERSION
diff --git a/VERSION b/VERSION
new file mode 100644
index 00000000..ca2892a8
--- /dev/null
+++ b/VERSION
@@ -0,0 +1 @@
+git-snapshot
diff --git a/source/qt.py b/source/qt.py
index 745c44ca..f757cb7b 100644
--- a/source/qt.py
+++ b/source/qt.py
@@ -1,5 +1,6 @@
# Global namespace
+import os
from qtflow import get_flowcontrol
from instruments import get_instruments
import config as _config
@@ -24,3 +25,17 @@
from plot_engines.qtgnuplot import Plot2D, Plot3D
plots = Plot.get_named_list()
+
+def version():
+ version_file = os.path.join(config['qtlabdir'], 'VERSION')
+ try:
+ f = file(version_file,'r')
+ str = f.readline()
+ str = str.rstrip('\n\r')
+ f.close()
+ except:
+ str = 'NO VERSION FILE'
+
+ return str
+
+