develop #11
| @@ -115,7 +115,7 @@ class Plugin(PluginBase): | ||||
|         self._event_system.emit("get_current_state") | ||||
|         state = self._fm_state | ||||
|         for uri in state.uris: | ||||
|             self.trashman.restore(filename=uri.split("/")[-1], verbose = verbocity) | ||||
|             self.trashman.restore(filename = uri.split("/")[-1], verbose = verbocity) | ||||
|  | ||||
|     def empty_trash(self, widget = None, eve = None, verbocity = False): | ||||
|         self.trashman.empty(verbose = verbocity) | ||||
|   | ||||
| @@ -73,7 +73,8 @@ class FileActionSignalsMixin: | ||||
|         _store, tab_widget_label = self.get_store_and_label_from_notebook(notebook, f"{wid}|{tid}") | ||||
|  | ||||
|         tab.load_directory() | ||||
|         self.load_store(tab, store) | ||||
|         icon_grid.clear_and_set_new_store() | ||||
|         self.load_store(tab, icon_grid.get_store()) | ||||
|  | ||||
|         tab_widget_label.set_label(tab.get_end_of_path()) | ||||
|         state = self.get_current_state() | ||||
|   | ||||
| @@ -18,7 +18,6 @@ class GridMixin: | ||||
|     """docstring for GridMixin""" | ||||
|  | ||||
|     def load_store(self, tab, store, save_state = False, use_generator = False): | ||||
|         store.clear() | ||||
|         dir   = tab.get_current_directory() | ||||
|         files = tab.get_files() | ||||
|  | ||||
| @@ -116,3 +115,10 @@ class GridMixin: | ||||
|                 tab_label = notebook.get_tab_label(obj).get_children()[0] | ||||
|  | ||||
|         return store, tab_label | ||||
|  | ||||
|     def get_icon_grid_from_notebook(self, notebook, _name): | ||||
|         for obj in notebook.get_children(): | ||||
|             icon_grid = obj.get_children()[0] | ||||
|             name      = icon_grid.get_name() | ||||
|             if name == _name: | ||||
|                 return icon_grid | ||||
|   | ||||
| @@ -1,5 +1,6 @@ | ||||
| # Python imports | ||||
| import os | ||||
| import gc | ||||
|  | ||||
| # Lib imports | ||||
| import gi | ||||
| @@ -60,7 +61,7 @@ class TabMixin(GridMixin): | ||||
|         tid       = self.get_id_from_tab_box(tab_box) | ||||
|         scroll    = self.builder.get_object(f"{wid}|{tid}") | ||||
|         icon_grid = scroll.get_children()[0] | ||||
|         store     = icon_grid.get_model() | ||||
|         store     = icon_grid.get_store() | ||||
|         tab       = self.get_fm_window(wid).get_tab_by_id(tid) | ||||
|         watcher   = tab.get_dir_watcher() | ||||
|  | ||||
| @@ -83,6 +84,7 @@ class TabMixin(GridMixin): | ||||
|         del watcher | ||||
|         del tab | ||||
|  | ||||
|         gc.collect() | ||||
|         if not settings_manager.is_trace_debug(): | ||||
|             self.fm_controller.save_state() | ||||
|  | ||||
| @@ -199,7 +201,9 @@ class TabMixin(GridMixin): | ||||
|             if not tab.set_path(path): | ||||
|                 return | ||||
|  | ||||
|         self.update_tab(tab_label, tab, store, wid, tid) | ||||
|         icon_grid = self.get_icon_grid_from_notebook(notebook, f"{wid}|{tid}") | ||||
|         icon_grid.clear_and_set_new_store() | ||||
|         self.update_tab(tab_label, tab, icon_grid.get_store(), wid, tid) | ||||
|  | ||||
|         try: | ||||
|             widget.grab_focus_without_selecting() | ||||
|   | ||||
| @@ -108,10 +108,9 @@ class WindowMixin(TabMixin): | ||||
|                 self.execute_files() | ||||
|                 return | ||||
|  | ||||
|  | ||||
|             state      = self.get_current_state() | ||||
|             notebook   = self.builder.get_object(f"window_{state.wid}") | ||||
|             tab_label  = self.get_tab_label(notebook, icons_grid) | ||||
|             tab_label  = self.get_tab_label(notebook, state.icon_grid) | ||||
|  | ||||
|             fileName   = state.store[item][1] | ||||
|             dir        = state.tab.get_current_directory() | ||||
| @@ -119,7 +118,8 @@ class WindowMixin(TabMixin): | ||||
|  | ||||
|             if isdir(file): | ||||
|                 state.tab.set_path(file) | ||||
|                 self.update_tab(tab_label, state.tab, state.store, state.wid, state.tid) | ||||
|                 state.icon_grid.clear_and_set_new_store() | ||||
|                 self.update_tab(tab_label, state.tab, state.icon_grid.get_store(), state.wid, state.tid) | ||||
|             else: | ||||
|                 event_system.emit("open_files") | ||||
|         except WindowException as e: | ||||
|   | ||||
| @@ -20,7 +20,7 @@ class IconGridWidget(Gtk.IconView): | ||||
|     def __init__(self): | ||||
|         super(IconGridWidget, self).__init__() | ||||
|  | ||||
|         self._store = None | ||||
|         # self._store = None | ||||
|  | ||||
|         self._setup_styling() | ||||
|         self._setup_signals() | ||||
| @@ -62,8 +62,7 @@ class IconGridWidget(Gtk.IconView): | ||||
|         self.connect("drag-motion",          grid_on_drag_motion) | ||||
|  | ||||
|     def _load_widgets(self): | ||||
|         self._store = Gtk.ListStore(GdkPixbuf.Pixbuf or GdkPixbuf.PixbufAnimation or None, str or None) | ||||
|         self.set_model(self._store) | ||||
|         self.clear_and_set_new_store() | ||||
|  | ||||
|     def _set_up_dnd(self): | ||||
|         URI_TARGET_TYPE  = 80 | ||||
| @@ -75,4 +74,9 @@ class IconGridWidget(Gtk.IconView): | ||||
|  | ||||
|  | ||||
|     def get_store(self): | ||||
|         return self._store | ||||
|         return self.get_model() | ||||
|  | ||||
|     def clear_and_set_new_store(self): | ||||
|         self.set_model(None) | ||||
|         store = Gtk.ListStore(GdkPixbuf.Pixbuf or GdkPixbuf.PixbufAnimation or None, str or None) | ||||
|         self.set_model(store) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user