minimized the changes
This commit is contained in:
3
grum/.vscode/settings.json
vendored
3
grum/.vscode/settings.json
vendored
@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"python.formatting.provider": "black"
|
|
||||||
}
|
|
@ -56,13 +56,14 @@ class MainWindow(QMainWindow):
|
|||||||
rst.server.register_function(self.new_plot)
|
rst.server.register_function(self.new_plot)
|
||||||
rst.server.register_function(self.append_data)
|
rst.server.register_function(self.append_data)
|
||||||
|
|
||||||
|
|
||||||
self.sig_make_new_plot.connect(self.on_make_new_plot)
|
self.sig_make_new_plot.connect(self.on_make_new_plot)
|
||||||
|
|
||||||
|
|
||||||
def keyPressEvent(self, event):
|
def keyPressEvent(self, event):
|
||||||
if event.key() == Qt.Key_F1:
|
if event.key() == Qt.Key_F1:
|
||||||
self.webdoc.show()
|
self.webdoc.show()
|
||||||
|
|
||||||
|
|
||||||
# Remote API calls
|
# Remote API calls
|
||||||
|
|
||||||
def new_plot(self, name, cfg):
|
def new_plot(self, name, cfg):
|
||||||
@ -83,6 +84,7 @@ class MainWindow(QMainWindow):
|
|||||||
else:
|
else:
|
||||||
item.set_alarm(True)
|
item.set_alarm(True)
|
||||||
|
|
||||||
|
|
||||||
# Signal callbacks
|
# Signal callbacks
|
||||||
|
|
||||||
def on_make_new_plot(self, *args, **kwargs):
|
def on_make_new_plot(self, *args, **kwargs):
|
||||||
@ -101,6 +103,7 @@ class MainWindow(QMainWindow):
|
|||||||
else:
|
else:
|
||||||
self.plot_multiple_items(selected)
|
self.plot_multiple_items(selected)
|
||||||
|
|
||||||
|
|
||||||
# Plumbing
|
# Plumbing
|
||||||
|
|
||||||
def plot_single_item(self, item):
|
def plot_single_item(self, item):
|
||||||
@ -109,17 +112,18 @@ class MainWindow(QMainWindow):
|
|||||||
self.activate_or_make_subwin(MDISubPlot, name, desc)
|
self.activate_or_make_subwin(MDISubPlot, name, desc)
|
||||||
|
|
||||||
def plot_multiple_items(self, items):
|
def plot_multiple_items(self, items):
|
||||||
# TODO: unset alarm status for all items?
|
#TODO: unset alarm status for all items?
|
||||||
pairs = ((i.key, i.value) for i in items)
|
pairs = ((i.key, i.value) for i in items)
|
||||||
names, descs = zip(*pairs)
|
names, descs = zip(*pairs)
|
||||||
name = " | ".join(names)
|
name = " | ".join(names)
|
||||||
self.activate_or_make_subwin(MDISubMultiPlot, name, descs)
|
self.activate_or_make_subwin(MDISubMultiPlot, name, descs)
|
||||||
|
|
||||||
# TODO: the following two could be methods to MDIArea?
|
|
||||||
|
#TODO: the following two could be methods to MDIArea?
|
||||||
|
|
||||||
def activate_or_make_subwin(self, MDISubType, name, *args, **kwargs):
|
def activate_or_make_subwin(self, MDISubType, name, *args, **kwargs):
|
||||||
sub = self.mdi.findSubWindow(name)
|
sub = self.mdi.findSubWindow(name)
|
||||||
if sub: # TODO check type? what to do for mismatches?
|
if sub: #TODO check type? what to do for mismatches?
|
||||||
self.mdi.setActiveSubWindow(sub)
|
self.mdi.setActiveSubWindow(sub)
|
||||||
else:
|
else:
|
||||||
self.make_subwin(MDISubType, name, *args, **kwargs)
|
self.make_subwin(MDISubType, name, *args, **kwargs)
|
||||||
@ -127,3 +131,6 @@ class MainWindow(QMainWindow):
|
|||||||
def make_subwin(self, MDISubType, name, *args, **kwargs):
|
def make_subwin(self, MDISubType, name, *args, **kwargs):
|
||||||
sub = MDISubType(name, *args, **kwargs)
|
sub = MDISubType(name, *args, **kwargs)
|
||||||
self.mdi.add(sub)
|
self.mdi.add(sub)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user