Skip to content

event_monitor: Fix saving to file

Pressing the "Save button" in the event monitor didn't work.

Traceback:

Traceback (most recent call last):
  File "/home/michi/temp/accerciser/share/accerciser/plugins/event_monitor.py", line 477, in _onSave
    save_dialog = gtk.FileChooserDialog(
                  ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/gi/overrides/__init__.py", line 319, in new_init
    return super_init_func(self, **new_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/gi/overrides/Gtk.py", line 569, in __init__
    self.add_buttons(*add_buttons)
  File "/usr/lib/python3/dist-packages/gi/overrides/Gtk.py", line 603, in add_buttons
    self.add_button(text, response)
TypeError: Must be string, not ButtonsType

Fix this. While at it, switch to GtkFileChooserNative here as well, as

commit 990adc2f8c44659d2ebfd90185a92cf2c9b72e7f
Author: Michael Weghorn <m.weghorn@posteo.de>
Date:   Fri Dec 22 11:37:22 2023 +0100

    validate: Switch to GtkfileChooserNative

did for the AT-SPI validator plugin.

Also add the mandatory missing param for the gtk_text_buffer_get_text call, since this otherwise fails like this:

Traceback (most recent call last):
  File "/home/michi/temp/accerciser/share/accerciser/plugins/event_monitor.py", line 488, in _onSave
    self.monitor_buffer.get_text(self.monitor_buffer.get_start_iter(),
TypeError: Gtk.TextBuffer.get_text() takes exactly 4 arguments (3 given)
Traceback (most recent call last):
  File "/home/michi/temp/accerciser/share/accerciser/plugins/event_monitor.py", line 488, in _onSave
    self.monitor_buffer.get_text(self.monitor_buffer.get_start_iter(),
TypeError: Gtk.TextBuffer.get_text() takes exactly 4 arguments (3 given)

[1] https://docs.gtk.org/gtk3/method.TextBuffer.get_text.html

Merge request reports