forked from toolsforexperiments/instrumentserver
-
Notifications
You must be signed in to change notification settings - Fork 0
/
client.py
51 lines (34 loc) · 1.15 KB
/
client.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import os
import argparse
import logging
from instrumentserver import setupLogging, logger, QtWidgets
from instrumentserver.log import LogWidget
from instrumentserver.client import QtClient
from instrumentserver.client.application import InstrumentClientMainWindow
from instrumentserver.gui.instruments import ParameterManagerGui
setupLogging(addStreamHandler=True,
logFile=os.path.abspath('instrumentclient.log'))
log = logger()
log.setLevel(logging.DEBUG)
def setup_log(win: InstrumentClientMainWindow):
w = LogWidget()
win.addWidget(w, 'Log', visible=False)
def setup_pm(win: InstrumentClientMainWindow):
pm = win.client.create_instrument(
'instrumentserver.params.ParameterManager',
'pm',
)
w = ParameterManagerGui(pm)
win.addWidget(w, name="PM: "+pm.name)
def main():
app = QtWidgets.QApplication([])
cli = QtClient()
mainwindow = InstrumentClientMainWindow(cli)
setup_pm(mainwindow)
setup_log(mainwindow)
mainwindow.show()
return app.exec_()
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Client options')
args = parser.parse_args()
main()