reworked the cursor
Build Debian Packages / build (bookworm, debian12) (push) Failing after 8m24s
Build Debian Packages / build (bullseye, debian11) (push) Failing after 5m55s
Build Debian Packages / build (trixie, debian13) (push) Failing after 8m59s

This commit is contained in:
2026-03-26 15:02:59 +01:00
parent 0e1a3eaa92
commit f0ed633f34
2 changed files with 131 additions and 124 deletions
+29 -9
View File
@@ -2287,6 +2287,23 @@ class MonitorWidgets:
# add matplotlib toolbar (display_table, 2nd row)
self.matplot_toolbar = matplotlib.backends.backend_gtk3.NavigationToolbar2GTK3( self.matplot_canvas )
# remove subplots:
#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))
# now let's add a button to the toolbar
button = gtk.ToggleButton(label='')
try:
image = gtk.Image.new_from_file("/usr/share/icons/breeze/actions/24/crosshairs-symbolic.svg")
button.set_image(image)
except:
pass
button.set_tooltip_text('Enable Crosshairs')
button.show()
button.connect('toggled', self.toggle_cursor)
toolitem = gtk.ToolItem()
toolitem.add(button)
self.matplot_toolbar.insert(toolitem, 5)
# Make cursor position text bigger and bold - access message label directly
try:
@@ -2314,6 +2331,12 @@ class MonitorWidgets:
# enable display scaling
self.display_x_scaling_combobox.set_active( 0 )
self.display_y_scaling_combobox.set_active( 0 )
for i in ("lin", "log10"):
self.display_x_scaling_combobox.append_text(i)
self.display_y_scaling_combobox.append_text(i)
self.display_x_scaling_combobox.append_text("ppm")
self.display_x_scaling_combobox.set_active(0)
self.display_y_scaling_combobox.set_active(0)
self.display_x_scaling_combobox.set_sensitive( True )
self.display_y_scaling_combobox.set_sensitive( True )
@@ -2720,19 +2743,16 @@ class MonitorWidgets:
def toggle_cursor(self, widget):
"""Toggle matplotlib crosshair cursor"""
from matplotlib.widgets import Cursor
if widget.get_active():
if hasattr(self, 'matplot_cursor') and self.matplot_cursor is not None:
self.matplot_cursor.disconnect_events()
self.matplot_cursor = Cursor(self.matplot_axes, useblit=False, color='red', linewidth=1)
self.matplot_cursor = matplotlib.widgets.Cursor(self.matplot_axes, useblit=False, color='red', linewidth=1)
else:
if hasattr(self, 'matplot_cursor') and self.matplot_cursor is not None:
self.matplot_cursor.disconnect_events()
self.matplot_cursor = None
if hasattr(self, 'matplot_cursor'):
self.matplot_cursor = None
self.matplot_canvas.draw_idle()
def on_canvas_button_press(self, widget, event):
"""Handle button press events on matplotlib canvas"""
if event.button == 3: # Right click
self.show_canvas_context_menu(event)
return True
@@ -2752,7 +2772,6 @@ class MonitorWidgets:
toggle_cursor.connect("toggled", self.toggle_cursor)
menu.append(toggle_cursor)
# Copy as PNG
item_copy_png = gtk.MenuItem(label="Copy as PNG")
item_copy_png.connect("activate", self.copy_canvas_as_png)
@@ -2843,9 +2862,10 @@ class MonitorWidgets:
"""
self.display_x_scaling_combobox.set_sensitive( True )
self.display_y_scaling_combobox.set_sensitive( True )
x_scale = self.display_x_scaling_combobox.get_active_text()
y_scale = self.display_y_scaling_combobox.get_active_text()
print(x_scale)
if x_scale == "lin":
self.matplot_axes.set_xscale("linear")
elif x_scale == "log10":
+2 -15
View File
@@ -1044,7 +1044,7 @@ Public License instead of this License.
<object class="GtkLabel" id="label65">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">Source </property>
<property name="label" translatable="yes">Source:</property>
</object>
<packing>
<property name="expand">False</property>
@@ -1053,7 +1053,7 @@ Public License instead of this License.
</packing>
</child>
<child>
<object class="GtkComboBoxText" id="display_source_combobox">
<object class="GtkComboBox" id="display_source_combobox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="add-tearoffs">True</property>
@@ -1075,12 +1075,6 @@ Public License instead of this License.
<property name="can-focus">False</property>
<property name="focus-on-click">False</property>
<signal name="changed" handler="on_display_y_scaling_combobox_changed" swapped="no"/>
<child>
<object class="GtkCellRendererText" id="renderer1"/>
<attributes>
<attribute name="text">0</attribute>
</attributes>
</child>
</object>
<packing>
<property name="left-attach">1</property>
@@ -1114,12 +1108,6 @@ Public License instead of this License.
<property name="can-focus">False</property>
<property name="focus-on-click">False</property>
<signal name="changed" handler="on_display_x_scaling_combobox_changed" swapped="no"/>
<child>
<object class="GtkCellRendererText" id="renderer2"/>
<attributes>
<attribute name="text">0</attribute>
</attributes>
</child>
</object>
<packing>
<property name="left-attach">1</property>
@@ -1931,7 +1919,6 @@ Public License instead of this License.
</packing>
</child>
<child>
<object class="GtkComboBoxText" id="CompLibs">
<property name="visible">True</property>
<property name="model">model3</property>