Public Access
crosshair and pan toolbar buttons are mutually exclusive
This commit is contained in:
1 parent
9d60eeabf6
commit
63da240504
2 files changed
+12
-2
No files matched your search
@@ -3014,6 +3014,9 @@ class MonitorWidgets:
|
||||
#self.matplot_toolbar.DeleteToolByPos(1)
|
||||
#self.matplot_toolbar.remove(self.matplot_toolbar.get_nth_item(3))
|
||||
self.matplot_toolbar.remove(self.matplot_toolbar.get_nth_item(6))
|
||||
# crosshair and Pan button are mutually exclusive
|
||||
self.matplot_pan_button = self.matplot_toolbar._gtk_ids['Pan']
|
||||
self.matplot_pan_button.connect( 'toggled', self.toggle_pan_button )
|
||||
# now let's add a button to the toolbar
|
||||
self.matplot_cursor_button = gtk.ToggleButton(label='')
|
||||
cursor_icon = GdkPixbuf.Pixbuf.new_from_xpm_data( crosshair_xpm )
|
||||
@@ -3662,6 +3665,11 @@ class MonitorWidgets:
|
||||
self._pan_start = None
|
||||
self._zoom_drag = None
|
||||
|
||||
def toggle_pan_button(self, button):
|
||||
"""Deactivate the crosshair button when the Pan mode is activated."""
|
||||
if button.get_active( ) and self.matplot_cursor_button.get_active( ):
|
||||
self.matplot_cursor_button.set_active( False )
|
||||
|
||||
def toggle_cursor(self, widget):
|
||||
"""Toggle matplotlib crosshair cursor"""
|
||||
if widget.get_active():
|
||||
@@ -3670,7 +3678,9 @@ class MonitorWidgets:
|
||||
self.matplot_cursor = CrosshairCursor(self.matplot_axes,
|
||||
color='red', linewidth=1)
|
||||
self.matplot_canvas.draw()
|
||||
# TODO: Deactivate the pane button
|
||||
# leave the Pan mode, the two buttons are mutually exclusive
|
||||
if self.matplot_pan_button.get_active( ):
|
||||
self.matplot_pan_button.set_active( False )
|
||||
|
||||
else:
|
||||
# Deactivate cursor
|
||||
|
||||
Reference in new issue
Block a user