mirror of https://gitlab.com/pamhyr/pamhyr2
work on ctrl+click
parent
8cd9ec939b
commit
fe57890da4
|
|
@ -81,7 +81,11 @@ class PlotKPZ(PamhyrPlot):
|
|||
(i.row() for i in self.parent.tableView.selectedIndexes())
|
||||
)
|
||||
)
|
||||
self._select_in_table(rows+[ind])
|
||||
if ind in rows:
|
||||
rows.remove(ind)
|
||||
self._select_in_table(rows)
|
||||
else:
|
||||
self._select_in_table(rows+[ind])
|
||||
elif modifiers == Qt.ShiftModifier:
|
||||
rows = list(
|
||||
set(
|
||||
|
|
@ -99,7 +103,7 @@ class PlotKPZ(PamhyrPlot):
|
|||
self.parent.select_row_profile_slider(ind)
|
||||
self.parent._table.blockSignals(False)
|
||||
|
||||
self.update()
|
||||
#self.update()
|
||||
return
|
||||
|
||||
def _closest_kp(self, event):
|
||||
|
|
@ -122,7 +126,6 @@ class PlotKPZ(PamhyrPlot):
|
|||
|
||||
def _select_in_table(self, ind):
|
||||
if self._table is not None:
|
||||
self._table.blockSignals(True)
|
||||
self._table.setFocus()
|
||||
selection = self._table.selectionModel()
|
||||
index = QItemSelection()
|
||||
|
|
@ -138,11 +141,9 @@ class PlotKPZ(PamhyrPlot):
|
|||
|
||||
if len(ind) > 0:
|
||||
self._table.scrollTo(self._table.model().index(ind[-1], 0))
|
||||
self._table.blockSignals(False)
|
||||
|
||||
def _select_range_in_table(self, ind1, ind2):
|
||||
if self._table is not None:
|
||||
self._table.blockSignals(True)
|
||||
self._table.setFocus()
|
||||
selection = self._table.selectionModel()
|
||||
index = QItemSelection(self._table.model().index(ind1, 0),
|
||||
|
|
@ -154,7 +155,6 @@ class PlotKPZ(PamhyrPlot):
|
|||
QItemSelectionModel.Select
|
||||
)
|
||||
self._table.scrollTo(self._table.model().index(ind2, 0))
|
||||
self._table.blockSignals(False)
|
||||
|
||||
@timer
|
||||
def draw(self):
|
||||
|
|
|
|||
|
|
@ -69,7 +69,6 @@ class PlotXY(PamhyrPlot):
|
|||
return
|
||||
|
||||
ind, point = self._closest_section(event)
|
||||
print(ind)
|
||||
if self._table is not None:
|
||||
self._table.blockSignals(True)
|
||||
if modifiers == Qt.ControlModifier:
|
||||
|
|
@ -78,7 +77,11 @@ class PlotXY(PamhyrPlot):
|
|||
(i.row() for i in self.parent.tableView.selectedIndexes())
|
||||
)
|
||||
)
|
||||
self._select_in_table(rows+[ind])
|
||||
if ind in rows:
|
||||
rows.remove(ind)
|
||||
self._select_in_table(rows)
|
||||
else:
|
||||
self._select_in_table(rows+[ind])
|
||||
elif modifiers == Qt.ShiftModifier:
|
||||
rows = list(
|
||||
set(
|
||||
|
|
@ -126,7 +129,6 @@ class PlotXY(PamhyrPlot):
|
|||
|
||||
def _select_in_table(self, ind):
|
||||
if self._table is not None:
|
||||
self._table.blockSignals(True)
|
||||
self._table.setFocus()
|
||||
selection = self._table.selectionModel()
|
||||
index = QItemSelection()
|
||||
|
|
@ -142,11 +144,9 @@ class PlotXY(PamhyrPlot):
|
|||
|
||||
if len(ind) > 0:
|
||||
self._table.scrollTo(self._table.model().index(ind[-1], 0))
|
||||
self._table.blockSignals(False)
|
||||
|
||||
def _select_range_in_table(self, ind1, ind2):
|
||||
if self._table is not None:
|
||||
self._table.blockSignals(True)
|
||||
self._table.setFocus()
|
||||
selection = self._table.selectionModel()
|
||||
index = QItemSelection(self._table.model().index(ind1, 0),
|
||||
|
|
@ -158,7 +158,6 @@ class PlotXY(PamhyrPlot):
|
|||
QItemSelectionModel.Select
|
||||
)
|
||||
self._table.scrollTo(self._table.model().index(ind2, 0))
|
||||
self._table.blockSignals(False)
|
||||
|
||||
@timer
|
||||
def draw(self):
|
||||
|
|
|
|||
|
|
@ -70,6 +70,7 @@ class Plot(PamhyrPlot):
|
|||
None # Hydrolic values (z, wet_area,
|
||||
# wet_preimeter, water_width)
|
||||
)
|
||||
self.events = []
|
||||
|
||||
def onpick(self, event):
|
||||
if event.mouseevent.inaxes != self.canvas.axes:
|
||||
|
|
@ -87,8 +88,14 @@ class Plot(PamhyrPlot):
|
|||
|
||||
if modifiers == Qt.ControlModifier:
|
||||
rows = self._parent.index_selected_rows()
|
||||
self.highlight = (points+[point], hyd)
|
||||
self._select_in_table(rows+[ind])
|
||||
if ind in rows:
|
||||
rows.remove(ind)
|
||||
del(points[ind])
|
||||
self.highlight = (points, hyd)
|
||||
self._select_in_table(rows)
|
||||
else:
|
||||
self.highlight = (points+[point], hyd)
|
||||
self._select_in_table(rows+[ind])
|
||||
elif modifiers == Qt.ShiftModifier:
|
||||
rows = self._parent.index_selected_rows()
|
||||
if len(rows)>0:
|
||||
|
|
@ -114,10 +121,6 @@ class Plot(PamhyrPlot):
|
|||
if event.button.value == 1:
|
||||
return
|
||||
|
||||
#modifiers = QApplication.keyboardModifiers()
|
||||
#if modifiers not in [Qt.ShiftModifier]:
|
||||
#return
|
||||
|
||||
points, _ = self.highlight
|
||||
|
||||
z = self._get_z_from_click(event)
|
||||
|
|
@ -240,8 +243,15 @@ class Plot(PamhyrPlot):
|
|||
|
||||
if modifiers == Qt.ControlModifier:
|
||||
rows = self._parent.index_selected_rows()
|
||||
self.highlight = (points+points2, hyd)
|
||||
self._select_in_table(rows+inds)
|
||||
if all(i in rows for i in inds):
|
||||
for ind in sorted(inds, reverse=True):
|
||||
rows.remove(ind)
|
||||
del(points[ind])
|
||||
self.highlight = (points, hyd)
|
||||
self._select_in_table(rows)
|
||||
else:
|
||||
self.highlight = (points+points2, hyd)
|
||||
self._select_in_table(rows+inds)
|
||||
else:
|
||||
self.highlight = (points2, hyd)
|
||||
self._select_in_table(inds)
|
||||
|
|
|
|||
Loading…
Reference in New Issue