minimized the changes

This commit is contained in:
2023-01-24 14:57:40 +01:00
parent 9d2680ba73
commit f1ddfb831a
2 changed files with 11 additions and 7 deletions

View File

@ -1,3 +0,0 @@
{
"python.formatting.provider": "black"
}

View File

@ -56,13 +56,14 @@ class MainWindow(QMainWindow):
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)
def keyPressEvent(self, event):
if event.key() == Qt.Key_F1:
self.webdoc.show()
# Remote API calls
def new_plot(self, name, cfg):
@ -83,6 +84,7 @@ class MainWindow(QMainWindow):
else:
item.set_alarm(True)
# Signal callbacks
def on_make_new_plot(self, *args, **kwargs):
@ -101,6 +103,7 @@ class MainWindow(QMainWindow):
else:
self.plot_multiple_items(selected)
# Plumbing
def plot_single_item(self, item):
@ -109,17 +112,18 @@ class MainWindow(QMainWindow):
self.activate_or_make_subwin(MDISubPlot, name, desc)
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)
names, descs = zip(*pairs)
name = " | ".join(names)
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):
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)
else:
self.make_subwin(MDISubType, name, *args, **kwargs)
@ -127,3 +131,6 @@ class MainWindow(QMainWindow):
def make_subwin(self, MDISubType, name, *args, **kwargs):
sub = MDISubType(name, *args, **kwargs)
self.mdi.add(sub)