mirror of
https://github.com/lutris/lutris
synced 2024-09-05 23:46:21 +00:00
Move get_scale_factor() call a little for thread-safety
This is GTK method, so it's not safe to call this off of the main thread. This fix looks ugly, but I've got a PR to rework this code for more PNG support that will improve this. This will do until that gets merged, I think.
This commit is contained in:
parent
e201a5a638
commit
f7af4b58c9
|
@ -698,13 +698,14 @@ class GameDialogCommon(SavableModelessDialog, DialogInstallUIDelegate):
|
|||
response = dialog.run()
|
||||
if response == Gtk.ResponseType.ACCEPT:
|
||||
image_path = dialog.get_filename()
|
||||
AsyncCall(self.save_custom_media, self.image_refreshed_cb, image_type, image_path)
|
||||
scale_factor = self.get_scale_factor() # get this here for thread-safety
|
||||
AsyncCall(self.save_custom_media, self.image_refreshed_cb, image_type, image_path, scale_factor)
|
||||
dialog.destroy()
|
||||
|
||||
def on_custom_image_reset_clicked(self, _widget, image_type):
|
||||
AsyncCall(self.refresh_image, self.image_refreshed_cb, image_type)
|
||||
|
||||
def save_custom_media(self, image_type, image_path):
|
||||
def save_custom_media(self, image_type, image_path, scale_factor):
|
||||
slug = self.slug or self.game.slug
|
||||
service_media = self.service_medias[image_type]
|
||||
self.game.custom_images.add(image_type)
|
||||
|
@ -718,7 +719,6 @@ class GameDialogCommon(SavableModelessDialog, DialogInstallUIDelegate):
|
|||
# If we must transcode the image, we'll scale the image up based on
|
||||
# the UI scale factor, to try to avoid blurriness. Of course this won't
|
||||
# work if the user changes the scaling later, but what can you do.
|
||||
scale_factor = self.get_scale_factor()
|
||||
width, height = service_media.custom_media_storage_size
|
||||
width = width * scale_factor
|
||||
height = height * scale_factor
|
||||
|
|
Loading…
Reference in a new issue