additional threaded thumbnailing update
This commit is contained in:
parent
f14058634c
commit
188aadfa84
@ -35,29 +35,31 @@ class WidgetMixin:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@threaded
|
||||||
def load_store(self, view, store, save_state=True):
|
def load_store(self, view, store, save_state=True):
|
||||||
store.clear()
|
store.clear()
|
||||||
files = view.get_files()
|
|
||||||
dir = view.get_current_directory()
|
dir = view.get_current_directory()
|
||||||
for file in files:
|
files = view.get_files()
|
||||||
|
for i, file in enumerate(files):
|
||||||
|
icon = Gtk.Image.new_from_file(view.DEFAULT_ICON).get_pixbuf()
|
||||||
|
store.append([icon, file[0]])
|
||||||
try:
|
try:
|
||||||
self.create_icon(view, store, dir, file[0])
|
self.create_icon(i, view, store, dir, file[0])
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
if save_state:
|
if save_state:
|
||||||
self.window_controller.save_state()
|
self.window_controller.save_state()
|
||||||
|
|
||||||
|
|
||||||
@threaded
|
@threaded
|
||||||
def create_icon(self, view, store, dir, file):
|
def create_icon(self, i, view, store, dir, file):
|
||||||
icon = view.create_icon(dir, file).get_pixbuf()
|
GLib.idle_add(self.update_store, (i, view, store, dir, file,))
|
||||||
data = [icon, file]
|
|
||||||
GLib.idle_add(self.update_store, (store, data,))
|
|
||||||
|
|
||||||
def update_store(self, item):
|
def update_store(self, item):
|
||||||
store, data = item
|
i, view, store, dir, file = item
|
||||||
store.append(data)
|
icon = view.create_icon(dir, file).get_pixbuf()
|
||||||
|
itr = store.get_iter(i)
|
||||||
|
store.set_value(itr, 0, icon)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user