Fixing translate plugin; attempted dispose call

This commit is contained in:
itdominator 2024-03-11 22:28:42 -05:00
parent d65ea8dec8
commit 02c31719d1
2 changed files with 8 additions and 4 deletions

View File

@ -184,11 +184,11 @@ class Plugin(PluginBase):
response = requests.post(self.vqd_link, headers=self.vqd_headers, data=self.vqd_data, timeout=2) response = requests.post(self.vqd_link, headers=self.vqd_headers, data=self.vqd_data, timeout=2)
if response.status_code == 200: if response.status_code == 200:
data = response.content data = response.content
vqd_start_index = data.index(b"vqd='") + 5 vqd_start_index = data.index(b"vqd=\"") + 5
vqd_end_index = data.index(b"'", vqd_start_index) vqd_end_index = data.index(b"\"", vqd_start_index)
self._vqd_attrib = data[vqd_start_index:vqd_end_index].decode("utf-8") self._vqd_attrib = data[vqd_start_index:vqd_end_index].decode("utf-8")
print(f"Translation VQD: {self._vqd_attrib}") print(f"Translation VQD: {self._vqd_attrib}")
else: else:
msg = f"Could not get VQS attribute... Response Code: {response.status_code}" 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)

View File

@ -75,7 +75,11 @@ class IconGridWidget(Gtk.IconView):
return self.get_model() return self.get_model()
def clear_and_set_new_store(self): def clear_and_set_new_store(self):
store = self.get_model()
if store:
store.run_dispose()
self.set_model(None) self.set_model(None)
store = Gtk.ListStore(GdkPixbuf.Pixbuf or GdkPixbuf.PixbufAnimation or None, str or None) store = Gtk.ListStore(GdkPixbuf.Pixbuf or GdkPixbuf.PixbufAnimation or None, str or None)
# store = Gtk.ListStore(Gtk.DirectoryList) # store = Gtk.ListStore(Gtk.DirectoryList)
self.set_model(store) self.set_model(store)