Skip to content

Commit da516d7

Browse files
Merged in cbillington/runmanager/splash (pull request labscript-suite#27)
Splash screen
2 parents 509a57b + e98e98d commit da516d7

File tree

1 file changed

+23
-7
lines changed

1 file changed

+23
-7
lines changed

__main__.py

+23-7
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,18 @@
2323
import errno
2424
import labscript_utils.excepthook
2525

26+
try:
27+
from labscript_utils import check_version
28+
except ImportError:
29+
raise ImportError('Require labscript_utils > 2.1.0')
30+
31+
check_version('labscript_utils', '2.10.0', '3')
32+
# Splash screen
33+
from labscript_utils.splash import Splash
34+
splash = Splash(os.path.join(os.path.dirname(__file__), 'runmanager.svg'))
35+
splash.show()
36+
37+
splash.update_text('importing standard library modules')
2638
import time
2739
import contextlib
2840
import subprocess
@@ -31,6 +43,7 @@
3143
import ast
3244
import pprint
3345

46+
splash.update_text('importing matplotlib')
3447
# Evaluation of globals happens in a thread with the pylab module imported.
3548
# Although we don't care about plotting, importing pylab makes Qt calls. We
3649
# can't have that from a non main thread, so we'll just disable matplotlib's
@@ -42,14 +55,13 @@
4255
# Quit on ctrl-c
4356
signal.signal(signal.SIGINT, signal.SIG_DFL)
4457

45-
try:
46-
from labscript_utils import check_version
47-
except ImportError:
48-
raise ImportError('Require labscript_utils > 2.1.0')
49-
50-
check_version('labscript_utils', '2', '3')
58+
splash.update_text('importing Qt')
5159
check_version('qtutils', '2.0.0', '3.0.0')
60+
61+
splash.update_text('importing zprocess')
5262
check_version('zprocess', '1.1.5', '3.0')
63+
64+
splash.update_text('importing pandas')
5365
check_version('pandas', '0.13', '2')
5466

5567
from qtutils.qt import QtCore, QtGui, QtWidgets
@@ -58,6 +70,7 @@
5870
import zprocess.locking
5971
from zmq import ZMQError
6072

73+
splash.update_text('importing labscript suite modules')
6174
from labscript_utils.labconfig import LabConfig, config_prefix
6275
from labscript_utils.setup_logging import setup_logging
6376
import labscript_utils.shared_drive as shared_drive
@@ -1237,7 +1250,7 @@ class RunManager(object):
12371250
GROUPS_DUMMY_ROW_TEXT = '<Click to add group>'
12381251

12391252
def __init__(self):
1240-
1253+
splash.update_text('loading graphical interface')
12411254
loader = UiLoader()
12421255
loader.registerCustomWidget(FingerTabWidget)
12431256
loader.registerCustomWidget(TreeView)
@@ -1316,6 +1329,7 @@ def __init__(self):
13161329
self.compile_queue_thread.daemon = True
13171330
self.compile_queue_thread.start()
13181331

1332+
splash.update_text('starting compiler subprocess')
13191333
# Start the compiler subprocess:
13201334
self.to_child, self.from_child, self.child = zprocess.subprocess_with_queues(
13211335
'batch_compiler.py', self.output_box.port)
@@ -1353,6 +1367,7 @@ def load_the_config_file():
13531367
# so that the GUI pops up faster in the meantime
13541368
self.ui.firstPaint.connect(lambda: QtCore.QTimer.singleShot(50, load_the_config_file))
13551369

1370+
splash.update_text('done')
13561371
self.ui.show()
13571372

13581373
def setup_config(self):
@@ -3384,4 +3399,5 @@ def send_to_runviewer(self, run_file):
33843399
qapplication = QtWidgets.QApplication(sys.argv)
33853400
qapplication.setAttribute(QtCore.Qt.AA_DontShowIconsInMenus, False)
33863401
app = RunManager()
3402+
splash.hide()
33873403
sys.exit(qapplication.exec_())

0 commit comments

Comments
 (0)