naming and some comments
This commit is contained in:
@ -23,7 +23,7 @@ class MainWindow(QMainWindow):
|
||||
self.lst = lst = DictList()
|
||||
lst.update(exampledata)
|
||||
lst.setAlternatingRowColors(True)
|
||||
lst.itemDoubleClicked.connect(self.on_select_list_item)
|
||||
lst.itemDoubleClicked.connect(self.on_dclick_list_item)
|
||||
|
||||
lst_menu = lst.lst.menu
|
||||
lst_menu.addSeparator()
|
||||
@ -53,6 +53,8 @@ class MainWindow(QMainWindow):
|
||||
self.sig_make_new_plot.connect(self.on_make_new_plot)
|
||||
|
||||
|
||||
# Remote API calls
|
||||
|
||||
def new_plot(self, name, cfg):
|
||||
desc = PlotDescription(name, **cfg)
|
||||
self.lst.set(name, desc)
|
||||
@ -60,7 +62,6 @@ class MainWindow(QMainWindow):
|
||||
if not self.mdi.findSubWindow(name):
|
||||
self.sig_make_new_plot.emit(name, desc)
|
||||
|
||||
|
||||
def append_data(self, name, point):
|
||||
item = self.lst.get(name)
|
||||
desc = item.value
|
||||
@ -73,7 +74,12 @@ class MainWindow(QMainWindow):
|
||||
item.set_alarm(True)
|
||||
|
||||
|
||||
def on_select_list_item(self, item):
|
||||
# Signal callbacks
|
||||
|
||||
def on_make_new_plot(self, *args, **kwargs):
|
||||
self.make_subwin(MDISubPlot, *args, **kwargs)
|
||||
|
||||
def on_dclick_list_item(self, item):
|
||||
self.plot_single_item(item)
|
||||
|
||||
def on_plot_selected(self):
|
||||
@ -87,6 +93,8 @@ class MainWindow(QMainWindow):
|
||||
self.plot_multiple_items(selected)
|
||||
|
||||
|
||||
# Plumbing
|
||||
|
||||
def plot_single_item(self, item):
|
||||
item.set_alarm(False)
|
||||
name, desc = item.key, item.value
|
||||
@ -100,6 +108,8 @@ class MainWindow(QMainWindow):
|
||||
self.activate_or_make_subwin(MDISubMultiPlot, name, descs)
|
||||
|
||||
|
||||
#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?
|
||||
@ -112,8 +122,4 @@ class MainWindow(QMainWindow):
|
||||
self.mdi.add(sub)
|
||||
|
||||
|
||||
def on_make_new_plot(self, *args, **kwargs):
|
||||
self.make_subwin(MDISubPlot, *args, **kwargs)
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user