much simpler two-step logic
This commit is contained in:
23
mainwin.py
23
mainwin.py
@ -35,31 +35,26 @@ class MainWindow(QMainWindow):
|
||||
|
||||
rst = RPCServerThread("localhost", 8000)
|
||||
rst.start()
|
||||
rst.server.register_function(self.append)
|
||||
rst.server.register_function(self.new_plot)
|
||||
rst.server.register_function(self.append_data)
|
||||
|
||||
self.sig_make_new_plot.connect(self.make_new_plot)
|
||||
|
||||
|
||||
def append(self, name, xy):
|
||||
pd = PlotDescription(title=name)
|
||||
x, y, pd.xlabel, pd.ylabel = xy
|
||||
def new_plot(self, name, cfg):
|
||||
pd = PlotDescription(**cfg)
|
||||
self.lst.add(name, pd)
|
||||
self.sig_make_new_plot.emit(name, pd)
|
||||
|
||||
|
||||
def append_data(self, name, xy):
|
||||
lst = self.lst
|
||||
show_it = (name not in lst.data)
|
||||
|
||||
if show_it:
|
||||
lst.add(name, pd)
|
||||
|
||||
lst.append(name, (x, y))
|
||||
lst.append(name, xy)
|
||||
for sub in self.mdi.subWindowList():
|
||||
if sub.windowTitle() == name:
|
||||
pd = lst.data[name]
|
||||
sub.plot.setData(pd.xs, pd.ys)
|
||||
|
||||
if show_it:
|
||||
pd = lst.data[name]
|
||||
self.sig_make_new_plot.emit(name, pd)
|
||||
|
||||
|
||||
def on_select_list_item(self, index):
|
||||
key, value = self.lst.get(index)
|
||||
|
Reference in New Issue
Block a user