mirror of https://gitlab.com/pamhyr/pamhyr2
BC: Edit: Fix update plot.
parent
63d7541062
commit
f8355021e7
|
|
@ -35,7 +35,7 @@ class Plot(APlot):
|
|||
x, y,
|
||||
color='r', lw=1.,
|
||||
markersize=5, marker='+',
|
||||
picker=30
|
||||
picker=30,
|
||||
)
|
||||
|
||||
# Plot label
|
||||
|
|
@ -47,9 +47,10 @@ class Plot(APlot):
|
|||
table_headers[header[1]], color='black', fontsize=10
|
||||
)
|
||||
|
||||
self.canvas.axes.autoscale_view(True, True, True)
|
||||
self.canvas.figure.tight_layout()
|
||||
self.canvas.figure.canvas.draw_idle()
|
||||
self.toolbar.update()
|
||||
#self.toolbar.update()
|
||||
|
||||
self._init = True
|
||||
|
||||
|
|
@ -59,9 +60,12 @@ class Plot(APlot):
|
|||
self.draw()
|
||||
return
|
||||
|
||||
# if ind is not None:
|
||||
x = list(map(lambda v: v[0], self.data.data))
|
||||
y = list(map(lambda v: v[1], self.data.data))
|
||||
|
||||
# else:
|
||||
self._line.set_data(x, y)
|
||||
|
||||
self.canvas.axes.relim()
|
||||
self.canvas.axes.autoscale()
|
||||
self.canvas.figure.tight_layout()
|
||||
self.canvas.figure.canvas.draw_idle()
|
||||
|
|
|
|||
|
|
@ -95,6 +95,11 @@ class EditBoundaryConditionWindow(ASubMainWindow, ListedSubWindow):
|
|||
self.copy_sc.activated.connect(self.copy)
|
||||
self.paste_sc.activated.connect(self.paste)
|
||||
|
||||
self._table.dataChanged.connect(self.update)
|
||||
|
||||
def update(self):
|
||||
self.plot.update()
|
||||
|
||||
def index_selected_row(self):
|
||||
table = self.find(QTableView, "tableView")
|
||||
return table.selectionModel()\
|
||||
|
|
@ -121,33 +126,43 @@ class EditBoundaryConditionWindow(ASubMainWindow, ListedSubWindow):
|
|||
else:
|
||||
self._table.add(rows[0])
|
||||
|
||||
self.plot.update()
|
||||
|
||||
def delete(self):
|
||||
rows = self.index_selected_rows()
|
||||
if len(rows) == 0:
|
||||
return
|
||||
|
||||
self._table.delete(rows)
|
||||
self.plot.update()
|
||||
|
||||
def sort(self):
|
||||
self._table.sort(False)
|
||||
self.plot.update()
|
||||
|
||||
def move_up(self):
|
||||
row = self.index_selected_row()
|
||||
self._table.move_up(row)
|
||||
self.plot.update()
|
||||
|
||||
def move_down(self):
|
||||
row = self.index_selected_row()
|
||||
self._table.move_down(row)
|
||||
self.plot.update()
|
||||
|
||||
|
||||
def copy(self):
|
||||
print("TODO")
|
||||
self.plot.update()
|
||||
|
||||
def paste(self):
|
||||
print("TODO")
|
||||
self.plot.update()
|
||||
|
||||
def undo(self):
|
||||
self._table.undo()
|
||||
self.plot.update()
|
||||
|
||||
def redo(self):
|
||||
self._table.redo()
|
||||
self.plot.update()
|
||||
|
|
|
|||
Loading…
Reference in New Issue