From 02c31719d1fa3877164a09ca6ea3327de748c55d Mon Sep 17 00:00:00 2001 From: itdominator <1itdominator@gmail.com> Date: Mon, 11 Mar 2024 22:28:42 -0500 Subject: [PATCH] Fixing translate plugin; attempted dispose call --- plugins/translate/plugin.py | 6 +++--- src/solarfm/core/widgets/icon_grid_widget.py | 6 +++++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/plugins/translate/plugin.py b/plugins/translate/plugin.py index aca4062..d55d0d5 100644 --- a/plugins/translate/plugin.py +++ b/plugins/translate/plugin.py @@ -184,11 +184,11 @@ class Plugin(PluginBase): response = requests.post(self.vqd_link, headers=self.vqd_headers, data=self.vqd_data, timeout=2) if response.status_code == 200: data = response.content - vqd_start_index = data.index(b"vqd='") + 5 - vqd_end_index = data.index(b"'", vqd_start_index) + vqd_start_index = data.index(b"vqd=\"") + 5 + vqd_end_index = data.index(b"\"", vqd_start_index) self._vqd_attrib = data[vqd_start_index:vqd_end_index].decode("utf-8") print(f"Translation VQD: {self._vqd_attrib}") else: msg = f"Could not get VQS attribute... Response Code: {response.status_code}" - self._translate_to_buffer.set_text(msg) + self._translate_to_buffer.set_text(msg) \ No newline at end of file diff --git a/src/solarfm/core/widgets/icon_grid_widget.py b/src/solarfm/core/widgets/icon_grid_widget.py index 2d25921..2326912 100644 --- a/src/solarfm/core/widgets/icon_grid_widget.py +++ b/src/solarfm/core/widgets/icon_grid_widget.py @@ -75,7 +75,11 @@ class IconGridWidget(Gtk.IconView): return self.get_model() def clear_and_set_new_store(self): + store = self.get_model() + if store: + store.run_dispose() + self.set_model(None) store = Gtk.ListStore(GdkPixbuf.Pixbuf or GdkPixbuf.PixbufAnimation or None, str or None) # store = Gtk.ListStore(Gtk.DirectoryList) - self.set_model(store) \ No newline at end of file + self.set_model(store)