added offline mode (does not start the RPC server)
This commit is contained in:
11
grum/cli.py
11
grum/cli.py
@ -25,13 +25,14 @@ def handle_clargs():
|
||||
DESC = "grum - GUI for Remote Unified Monitoring"
|
||||
parser = argparse.ArgumentParser(description=DESC, formatter_class=argparse.ArgumentDefaultsHelpFormatter)
|
||||
|
||||
parser.add_argument("-H", "--host", default="localhost", help="Server host name")
|
||||
parser.add_argument("-P", "--port", default=8000, type=int, help="Server port number")
|
||||
parser.add_argument("-H", "--host", default="localhost", help="RPC server host name")
|
||||
parser.add_argument("-P", "--port", default=8000, type=int, help="RPC server port number")
|
||||
parser.add_argument("-o", "--offline", action="store_true", help="offline mode (do not run RPC server)")
|
||||
|
||||
parser.add_argument("-w", "--window-mode", default="multi", choices=MDIWindowMode.values(), type=unambiguous_window_mode, help="Set the initial window mode")
|
||||
parser.add_argument("-w", "--window-mode", default="multi", choices=MDIWindowMode.values(), type=unambiguous_window_mode, help="set the initial window mode")
|
||||
|
||||
parser.add_argument("-e", "--examples", dest="add_examples", action="store_true", help="Add example data")
|
||||
parser.add_argument("--no-theme", action="store_true", help="Disable theming")
|
||||
parser.add_argument("-e", "--examples", dest="add_examples", action="store_true", help="add example data")
|
||||
parser.add_argument("--no-theme", action="store_true", help="disable theming")
|
||||
|
||||
return parser.parse_args().__dict__
|
||||
|
||||
|
@ -18,8 +18,12 @@ class MainWindow(QMainWindow):
|
||||
|
||||
sig_make_new_plot = pyqtSignal(str, PlotDescription)
|
||||
|
||||
def __init__(self, *args, title="grum", host="localhost", port=8000, add_examples=False, window_mode=MDIWindowMode.MULTI, **kwargs):
|
||||
def __init__(self, *args, title="grum", host="localhost", port=8000, offline=False, add_examples=False, window_mode=MDIWindowMode.MULTI, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
if offline:
|
||||
title = f"{title} (offline)"
|
||||
|
||||
self.setWindowTitle(title)
|
||||
self.setWindowIcon(assets.icon())
|
||||
|
||||
@ -62,10 +66,11 @@ class MainWindow(QMainWindow):
|
||||
|
||||
self.setCentralWidget(splitter)
|
||||
|
||||
self.rst = rst = RPCServerThread(host, port, doc_title_suffix=title)
|
||||
rst.start()
|
||||
rst.server.register_function(self.new_plot)
|
||||
rst.server.register_function(self.append_data)
|
||||
if not offline:
|
||||
self.rst = rst = RPCServerThread(host, port, doc_title_suffix=title)
|
||||
rst.start()
|
||||
rst.server.register_function(self.new_plot)
|
||||
rst.server.register_function(self.append_data)
|
||||
|
||||
self.sig_make_new_plot.connect(self.on_make_new_plot)
|
||||
|
||||
|
Reference in New Issue
Block a user