Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PR: Add visual cue when selecting BRF period #347

Merged
merged 5 commits into from
Oct 7, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions gwhat/HydroCalc2.py
Original file line number Diff line number Diff line change
Expand Up @@ -1326,7 +1326,7 @@ def _draw_mouse_cursor(self, x, y):
self.vguide.set_xdata(x)
self.fig.axes[0].draw_artist(self.vguide)

# ----- Handlers: Mouse events
# ----- Mouse Event Handlers
def is_all_btn_raised(self):
"""
Return whether all of the tool buttons that can block the panning and
Expand Down Expand Up @@ -1386,12 +1386,11 @@ def on_mouse_move(self, event):
fig = self.fig
fig.canvas.restore_region(self.__figbckground)

# ---- Draw the cursor guide and the xy coordinates on the graph.

# Trace a red vertical guide (line) that folows the mouse marker :

# Draw the vertical cursor guide.
x, y = event.xdata, event.ydata
self._draw_mouse_cursor(x, y)

# Draw the xy coordinates on the graph.
if all((x, y)):
self.xycoord.set_visible(True)
if self.dformat == 0:
Expand All @@ -1403,7 +1402,6 @@ def on_mouse_move(self, event):
y, date[2], date[1], date[0]))
ax0.draw_artist(self.xycoord)
else:
self.vguide.set_visible(False)
self.xycoord.set_visible(False)

if self.rect_select_is_active and self.__mouse_btn_is_pressed:
Expand Down Expand Up @@ -1452,6 +1450,8 @@ def onrelease(self, event):
been clicked.
"""
self.__mouse_btn_is_pressed = False
self.vguide.set_color('black')

# Disconnect the pan and zoom callback before drawing the canvas again.
if self.pan_is_active:
self.toolbar.release_pan(event)
Expand Down Expand Up @@ -1542,6 +1542,9 @@ def onclick(self, event):
self.draw()
elif self.brf_eval_widget.is_brfperiod_selection_toggled():
self._selected_brfperiod[0] = event.xdata
self.vguide.set_color('red')
self.draw()
self.on_mouse_move(event)
elif self.rect_select_is_active:
self._rect_selection[0] = (event.xdata, event.ydata)
else:
Expand Down