mirror of https://gitlab.com/pamhyr/pamhyr2
pep8
parent
59fc80a10b
commit
7d4091eb24
|
|
@ -68,11 +68,14 @@ class PlotKPZ(PamhyrPlot):
|
|||
return
|
||||
|
||||
modifiers = QApplication.keyboardModifiers()
|
||||
if modifiers not in [Qt.ControlModifier, Qt.NoModifier, Qt.ShiftModifier]:
|
||||
if modifiers not in [Qt.ControlModifier,
|
||||
Qt.NoModifier,
|
||||
Qt.ShiftModifier]:
|
||||
return
|
||||
|
||||
ind, point = self._closest_kp(event)
|
||||
if self.parent._table is not None:
|
||||
if self.parent._table is None:
|
||||
return
|
||||
self.parent._table.blockSignals(True)
|
||||
if modifiers == Qt.ControlModifier:
|
||||
rows = list(
|
||||
|
|
@ -102,7 +105,6 @@ class PlotKPZ(PamhyrPlot):
|
|||
self.parent.select_row_profile_slider(ind)
|
||||
self.parent._table.blockSignals(False)
|
||||
|
||||
#self.update()
|
||||
return
|
||||
|
||||
def _closest_kp(self, event):
|
||||
|
|
@ -124,13 +126,19 @@ class PlotKPZ(PamhyrPlot):
|
|||
return closest
|
||||
|
||||
def _select_in_table(self, ind):
|
||||
if self._table is not None:
|
||||
if self._table is None:
|
||||
return
|
||||
|
||||
self._table.setFocus()
|
||||
selection = self._table.selectionModel()
|
||||
index = QItemSelection()
|
||||
if len(ind) > 0:
|
||||
|
||||
if len(ind) == 0:
|
||||
return
|
||||
|
||||
for i in ind:
|
||||
index.append(QItemSelectionRange(self._table.model().index(i, 0)))
|
||||
|
||||
selection.select(
|
||||
index,
|
||||
QItemSelectionModel.Rows |
|
||||
|
|
|
|||
|
|
@ -64,11 +64,14 @@ class PlotXY(PamhyrPlot):
|
|||
return
|
||||
|
||||
modifiers = QApplication.keyboardModifiers()
|
||||
if modifiers not in [Qt.ControlModifier, Qt.NoModifier, Qt.ShiftModifier]:
|
||||
if modifiers not in [Qt.ControlModifier,
|
||||
Qt.NoModifier,
|
||||
Qt.ShiftModifier]:
|
||||
return
|
||||
|
||||
ind, point = self._closest_section(event)
|
||||
if self._table is not None:
|
||||
if self._table is None:
|
||||
return
|
||||
self._table.blockSignals(True)
|
||||
if modifiers == Qt.ControlModifier:
|
||||
rows = list(
|
||||
|
|
@ -98,7 +101,6 @@ class PlotXY(PamhyrPlot):
|
|||
self.parent.select_row_profile_slider(ind)
|
||||
self._table.blockSignals(False)
|
||||
|
||||
#self.update()
|
||||
return
|
||||
|
||||
def _closest_section(self, event):
|
||||
|
|
@ -127,11 +129,13 @@ class PlotXY(PamhyrPlot):
|
|||
return closest
|
||||
|
||||
def _select_in_table(self, ind):
|
||||
if self._table is not None:
|
||||
if self._table is None:
|
||||
return
|
||||
self._table.setFocus()
|
||||
selection = self._table.selectionModel()
|
||||
index = QItemSelection()
|
||||
if len(ind) > 0:
|
||||
if len(ind) == 0:
|
||||
return
|
||||
for i in ind:
|
||||
index.append(QItemSelectionRange(self._table.model().index(i, 0)))
|
||||
selection.select(
|
||||
|
|
@ -184,10 +188,12 @@ class PlotXY(PamhyrPlot):
|
|||
self.line_xy.append(np.column_stack(xy))
|
||||
|
||||
self._colors, self._style = self.color_hightlight()
|
||||
self.line_xy_collection = collections.LineCollection(self.line_xy,
|
||||
self.line_xy_collection = collections.LineCollection(
|
||||
self.line_xy,
|
||||
colors=self._colors,
|
||||
linestyle=self._style,
|
||||
picker=10)
|
||||
picker=10
|
||||
)
|
||||
self.canvas.axes.add_collection(self.line_xy_collection)
|
||||
|
||||
def color_hightlight(self):
|
||||
|
|
|
|||
|
|
@ -72,17 +72,20 @@ class Plot(PamhyrPlot):
|
|||
# wet_preimeter, water_width)
|
||||
)
|
||||
self._onpickevent = None
|
||||
self._rect_select = RectangleSelector(ax=self.canvas.axes,
|
||||
self._rect_select = RectangleSelector(
|
||||
ax=self.canvas.axes,
|
||||
onselect=self.rect_select_callback,
|
||||
useblit=True,
|
||||
button=[1], # don't use middle nor right button
|
||||
minspanx=2.0,
|
||||
minspany=2.0,
|
||||
spancoords='pixels',
|
||||
interactive=False)
|
||||
interactive=False
|
||||
)
|
||||
|
||||
def onrelease(self, event):
|
||||
# we need to do that to prevent conflicst between onpick and rect_select_callback
|
||||
# we need to do that to prevent conflicst
|
||||
# between onpick and rect_select_callback
|
||||
modifiers = QApplication.keyboardModifiers()
|
||||
points, hyd = self.highlight
|
||||
if self._onpickevent is not None:
|
||||
|
|
@ -102,7 +105,10 @@ class Plot(PamhyrPlot):
|
|||
if len(rows) > 0:
|
||||
i1 = min(rows[0], rows[-1], ind)
|
||||
i2 = max(rows[0], rows[-1], ind)
|
||||
p = [[self.data.points[i].x,self.data.points[i].y] for i in range(i1, i2)]
|
||||
p = [
|
||||
[self.data.points[i].x, self.data.points[i].y]
|
||||
for i in range(i1, i2)
|
||||
]
|
||||
else:
|
||||
i1 = ind
|
||||
i2 = ind
|
||||
|
|
@ -122,7 +128,9 @@ class Plot(PamhyrPlot):
|
|||
return
|
||||
|
||||
modifiers = QApplication.keyboardModifiers()
|
||||
if modifiers not in [Qt.ControlModifier, Qt.NoModifier, Qt.ShiftModifier]:
|
||||
if modifiers not in [Qt.ControlModifier,
|
||||
Qt.NoModifier,
|
||||
Qt.ShiftModifier]:
|
||||
return
|
||||
|
||||
self._onpickevent = event
|
||||
|
|
@ -178,7 +186,9 @@ class Plot(PamhyrPlot):
|
|||
index = QItemSelection()
|
||||
if len(ind) > 0:
|
||||
for i in ind:
|
||||
index.append(QItemSelectionRange(self._table.model().index(i, 0)))
|
||||
index.append(QItemSelectionRange(
|
||||
self._table.model().index(i, 0))
|
||||
)
|
||||
selection.select(
|
||||
index,
|
||||
QItemSelectionModel.Rows |
|
||||
|
|
@ -248,7 +258,6 @@ class Plot(PamhyrPlot):
|
|||
return
|
||||
modifiers = QApplication.keyboardModifiers()
|
||||
|
||||
|
||||
x1, y1 = eclick.xdata, eclick.ydata
|
||||
x2, y2 = erelease.xdata, erelease.ydata
|
||||
|
||||
|
|
@ -276,12 +285,12 @@ class Plot(PamhyrPlot):
|
|||
listp = []
|
||||
station = self.data._get_station(self.data.points)
|
||||
for i, p in enumerate(self.data.points):
|
||||
if (min(x1,x2)<station[i]<max(x1,x2) and min(y1,y2)<p.z<max(y1,y2)):
|
||||
if (min(x1, x2) < station[i] < max(x1, x2)
|
||||
and min(y1, y2) < p.z < max(y1, y2)):
|
||||
listi.append(i)
|
||||
listp.append((station[i], p.z))
|
||||
return listi, listp
|
||||
|
||||
|
||||
def _compute_hydraulics(self, z):
|
||||
profile = self.data
|
||||
|
||||
|
|
|
|||
|
|
@ -181,7 +181,9 @@ class PlotKPC(PamhyrPlot):
|
|||
return
|
||||
|
||||
modifiers = QApplication.keyboardModifiers()
|
||||
if modifiers not in [Qt.ControlModifier, Qt.NoModifier, Qt.ShiftModifier]:
|
||||
if modifiers not in [Qt.ControlModifier,
|
||||
Qt.NoModifier,
|
||||
Qt.ShiftModifier]:
|
||||
return
|
||||
|
||||
closest = self._closest_profile(event)
|
||||
|
|
|
|||
|
|
@ -75,7 +75,6 @@ class PlotXY(PamhyrPlot):
|
|||
if event.mouseevent.button.value == 3:
|
||||
table.setData(index[4], kp[closest[0]])
|
||||
|
||||
#self.update()
|
||||
return
|
||||
|
||||
def _closest_section(self, event):
|
||||
|
|
@ -129,10 +128,12 @@ class PlotXY(PamhyrPlot):
|
|||
self.line_xy.append(np.column_stack(xy))
|
||||
|
||||
self._colors, self._style = self.color_hightlight()
|
||||
self.line_xy_collection = collections.LineCollection(self.line_xy,
|
||||
self.line_xy_collection = collections.LineCollection(
|
||||
self.line_xy,
|
||||
colors=self._colors,
|
||||
linestyle=self._style,
|
||||
picker=10)
|
||||
picker=10
|
||||
)
|
||||
self.canvas.axes.add_collection(self.line_xy_collection)
|
||||
|
||||
def color_hightlight(self):
|
||||
|
|
|
|||
|
|
@ -297,9 +297,3 @@ class LateralContributionWindow(PamhyrWindow):
|
|||
parent=self
|
||||
)
|
||||
win.show()
|
||||
|
||||
#@pyqtSlot()
|
||||
def onChange(self,i): #changed!
|
||||
QtGui.QMessageBox.information(self,
|
||||
"Tab Index Changed!",
|
||||
"Current Tab Index: %d" % i ) #changed!
|
||||
|
|
|
|||
Loading…
Reference in New Issue