1
"""
2
Script to launch pyrpl from the command line.
3

4
Type python -m pyrpl [config_file_name] to create
5
a Pyrpl instance with the config file
6
"config_file_name"
7
"""
8 0
import sys
9 0
try:
10 0
    from pyrpl import Pyrpl, APP
11 0
except:
12 0
    from . import Pyrpl, APP
13

14 0
if __name__ == '__main__':
15 0
    if len(sys.argv) > 3:
16 0
        print("usage: python run_pyrpl.py [[config]=config_file_name] "
17
              "[source=config_file_template] [hostname=hostname/ip]")
18 0
    kwargs = dict()
19 0
    for i, arg in enumerate(sys.argv):
20 0
        print (i, arg)
21 0
        if i == 0:
22 0
            continue
23 0
        try:
24 0
            k, v = arg.split('=', 1)
25 0
        except ValueError:
26 0
            k, v = arg, ""
27 0
        if v == "":
28 0
            if i == 1:
29 0
                kwargs["config"] = k
30
        else:
31 0
            kwargs[k] = v
32
    #APP = QtWidgets.QApplication.instance()
33
    #if APP is None:
34
    #    APP = QtWidgets.QApplication(sys.argv)
35

36 0
    print("Calling Pyrpl(**%s)"%str(kwargs))
37 0
    PYRPL = Pyrpl(**kwargs)
38 0
    APP.exec_()

Read our documentation on viewing source code .

Loading