1 Star 0 Fork 107

feiying/anaconda

forked from src-openEuler/anaconda 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
anaconda-fix-rnotes-display-in-low-screen-resolution.patch 2.18 KB
一键复制 编辑 原始数据 按行查看 历史
dogsheng 提交于 2019-12-25 15:41 . Package init
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()
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/OfeiyingO/anaconda.git
git@gitee.com:OfeiyingO/anaconda.git
OfeiyingO
anaconda
anaconda
master

搜索帮助