anaconda/anaconda-fix-rnotes-display-in-low-screen-resolution.patch
2019-12-25 15:41:33 +08:00

48 lines
2.2 KiB
Diff

diff -uNrp a/pyanaconda/ui/gui/hubs/progress.py b/pyanaconda/ui/gui/hubs/progress.py
--- a/pyanaconda/ui/gui/hubs/progress.py 2018-07-25 21:58:20.000000000 +0800
+++ b/pyanaconda/ui/gui/hubs/progress.py 2019-08-12 21:14:11.720000000 +0800
@@ -21,8 +21,9 @@ import gi
from pyanaconda.core.timer import Timer
gi.require_version("Gtk", "3.0")
+gi.require_version("GdkPixbuf", "2.0")
-from gi.repository import Gtk
+from gi.repository import Gtk, GdkPixbuf
import itertools
import os
@@ -251,6 +252,11 @@ class ProgressHub(Hub):
# An infinite list of the page numbers containing ransom notes images.
self._rnotesPages = itertools.cycle(range(rnotes_start,
self._progressNotebook.get_n_pages()))
+
+ #resize image when in low resolution
+ self._progressNotebook_width = -1
+ self._progressNotebook.connect('size_allocate', self.on_allocate, range(rnotes_start,
+ self._progressNotebook.get_n_pages()))
else:
# Add a blank page to the notebook and we'll just cycle to that
# over and over again.
@@ -295,6 +301,20 @@ class ProgressHub(Hub):
gtk_call_once(self._progressLabel.set_text, message)
+ def on_allocate(self, notebook, allocation, page_range):
+ request = notebook.get_size_request()
+ if allocation.width >= request.width or allocation.width >= self._progressNotebook_width and self._progressNotebook_width != -1:
+ return
+ self._progressNotebook_width = allocation.width
+ for i in page_range:
+ widget = notebook.get_nth_page(i)
+ image_allocation = widget.get_allocation()
+ pixbuf = widget.get_pixbuf()
+ if pixbuf.get_width() > image_allocation.width:
+ resize_height = image_allocation.width / pixbuf.get_width() * image_allocation.height
+ pixbuf = pixbuf.scale_simple(image_allocation.width, resize_height, GdkPixbuf.InterpType.BILINEAR)
+ widget.set_from_pixbuf(pixbuf)
+
@async_action_nowait
def _restart_spinner(self):
self._spinner.show()