Skip to content

Commit

Permalink
Spawn separate threads for thumbnailing
Browse files Browse the repository at this point in the history
  • Loading branch information
kra-mo committed Dec 22, 2023
1 parent e529ac7 commit 6d18a6b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
17 changes: 14 additions & 3 deletions hyperplane/item.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,13 @@ def bind(self) -> None:
)
!= Gio.FilesystemPreviewType.NEVER
):
generate_thumbnail(self.gfile, self.content_type, self.__thumbnail_cb)
GLib.Thread.new(
None,
generate_thumbnail,
self.gfile,
self.content_type,
self.__thumbnail_cb,
)
else:
self.__thumbnail_cb()

Expand Down Expand Up @@ -264,8 +270,13 @@ def next_files_cb(
# Maybe this is the proper way?
child_gfile = gfile.get_child(file_info.get_name())

generate_thumbnail(
child_gfile, content_type, self.__dir_thumbnail_cb, picture
GLib.Thread.new(
None,
generate_thumbnail,
child_gfile,
content_type,
self.__dir_thumbnail_cb,
picture,
)

# TODO: Could be oprimized if I called next_files with 3 the first time
Expand Down
2 changes: 1 addition & 1 deletion hyperplane/path_bar.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"""The path bar in a HypWindow."""
from typing import Optional

from gi.repository import Gdk, GLib, Gtk
from gi.repository import GLib, Gtk

from hyperplane import shared
from hyperplane.path_segment import HypPathSegment
Expand Down

0 comments on commit 6d18a6b

Please sign in to comment.