added and use MDIArea.findSubWindow
This commit is contained in:
29
mainwin.py
29
mainwin.py
@ -44,30 +44,25 @@ class MainWindow(QMainWindow):
|
|||||||
def new_plot(self, name, cfg):
|
def new_plot(self, name, cfg):
|
||||||
desc = PlotDescription(**cfg)
|
desc = PlotDescription(**cfg)
|
||||||
self.lst.add(name, desc)
|
self.lst.add(name, desc)
|
||||||
for sub in self.mdi.subWindowList():
|
if not self.mdi.findSubWindow(name):
|
||||||
if sub.windowTitle() == name:
|
self.sig_make_new_plot.emit(name, desc)
|
||||||
return
|
|
||||||
self.sig_make_new_plot.emit(name, desc)
|
|
||||||
|
|
||||||
|
|
||||||
def append_data(self, name, point):
|
def append_data(self, name, point):
|
||||||
lst = self.lst
|
self.lst.append(name, point)
|
||||||
lst.append(name, point)
|
sub = self.mdi.findSubWindow(name)
|
||||||
for sub in self.mdi.subWindowList():
|
if sub:
|
||||||
if sub.windowTitle() == name:
|
desc = self.lst.data[name]
|
||||||
desc = lst.data[name]
|
sub.plot.setData(*desc.data)
|
||||||
sub.plot.setData(*desc.data)
|
|
||||||
|
|
||||||
|
|
||||||
def on_select_list_item(self, index):
|
def on_select_list_item(self, index):
|
||||||
name, desc = self.lst.get(index)
|
name, desc = self.lst.get(index)
|
||||||
|
sub = self.mdi.findSubWindow(name)
|
||||||
for sub in self.mdi.subWindowList():
|
if sub:
|
||||||
if sub.windowTitle() == name:
|
self.mdi.setActiveSubWindow(sub)
|
||||||
self.mdi.setActiveSubWindow(sub)
|
else:
|
||||||
return
|
self.on_make_new_plot(name, desc)
|
||||||
|
|
||||||
self.on_make_new_plot(name, desc)
|
|
||||||
|
|
||||||
|
|
||||||
def on_make_new_plot(self, *args, **kwargs):
|
def on_make_new_plot(self, *args, **kwargs):
|
||||||
|
Reference in New Issue
Block a user