updating icon generation logic
This commit is contained in:
parent
681a71d0b1
commit
cc6071249e
@ -90,20 +90,24 @@ class Grid:
|
|||||||
|
|
||||||
|
|
||||||
def generateGridIcons(self, dir, files):
|
def generateGridIcons(self, dir, files):
|
||||||
for i, file in enumerate(files):
|
# NOTE: We insure all indecies exist before calling threads that update
|
||||||
|
# icon positions. In addition, adding the name allows us to see
|
||||||
|
# the "file" during long or heavy number of icon updates.
|
||||||
|
for file in files:
|
||||||
self.store.append([None, file])
|
self.store.append([None, file])
|
||||||
self.create_icon(i, dir, file)
|
|
||||||
|
|
||||||
|
# Now we update as fast as possible the icons.
|
||||||
|
for i, file in enumerate(files):
|
||||||
|
self.create_icon(i, dir, file)
|
||||||
|
|
||||||
@threaded
|
@threaded
|
||||||
def create_icon(self, i, dir, file):
|
def create_icon(self, i, dir, file):
|
||||||
icon = self.iconFactory.create_icon(dir, file)
|
icon = self.iconFactory.create_icon(dir, file)
|
||||||
fpath = f"{dir}/{file}"
|
GLib.idle_add(self.update_store, *(i, icon, dir, file,))
|
||||||
GLib.idle_add(self.update_store, (i, icon, fpath,))
|
|
||||||
|
|
||||||
def update_store(self, item):
|
def update_store(self, i, icon, dir, file):
|
||||||
i, icon, fpath = item
|
fpath = f"{dir}/{file}"
|
||||||
itr = self.store.get_iter(i)
|
itr = self.store.get_iter(i)
|
||||||
|
|
||||||
if not icon:
|
if not icon:
|
||||||
icon = self.get_system_thumbnail(fpath, self.iconFactory.SYS_ICON_WH[0])
|
icon = self.get_system_thumbnail(fpath, self.iconFactory.SYS_ICON_WH[0])
|
||||||
|
Loading…
Reference in New Issue
Block a user