diff options
author | Gilles Dartiguelongue <eva@gentoo.org> | 2009-06-11 22:42:03 +0000 |
---|---|---|
committer | Gilles Dartiguelongue <eva@gentoo.org> | 2009-06-11 22:42:03 +0000 |
commit | 979778f42454eb4ded017133ef7ce2cfcaeb8eb9 (patch) | |
tree | 709853b6051acb89c23071f22b24e22a7a2ebf49 /gnome-extra/hamster-applet | |
parent | Remove old. (diff) | |
download | historical-979778f42454eb4ded017133ef7ce2cfcaeb8eb9.tar.gz historical-979778f42454eb4ded017133ef7ce2cfcaeb8eb9.tar.bz2 historical-979778f42454eb4ded017133ef7ce2cfcaeb8eb9.zip |
Use pango layout to draw text in place of cairo for graphs, closes: #273673.
Package-Manager: portage-2.2_rc33/cvs/Linux x86_64
Diffstat (limited to 'gnome-extra/hamster-applet')
-rw-r--r-- | gnome-extra/hamster-applet/ChangeLog | 10 | ||||
-rw-r--r-- | gnome-extra/hamster-applet/Manifest | 10 | ||||
-rw-r--r-- | gnome-extra/hamster-applet/files/hamster-applet-2.26.2-pango-layout.patch | 242 | ||||
-rw-r--r-- | gnome-extra/hamster-applet/hamster-applet-2.26.2-r1.ebuild | 67 |
4 files changed, 324 insertions, 5 deletions
diff --git a/gnome-extra/hamster-applet/ChangeLog b/gnome-extra/hamster-applet/ChangeLog index c14820a8916e..37e146bd90cc 100644 --- a/gnome-extra/hamster-applet/ChangeLog +++ b/gnome-extra/hamster-applet/ChangeLog @@ -1,6 +1,14 @@ # ChangeLog for gnome-extra/hamster-applet # Copyright 1999-2009 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/gnome-extra/hamster-applet/ChangeLog,v 1.12 2009/05/23 20:08:36 eva Exp $ +# $Header: /var/cvsroot/gentoo-x86/gnome-extra/hamster-applet/ChangeLog,v 1.13 2009/06/11 22:42:02 eva Exp $ + +*hamster-applet-2.26.2-r1 (12 Jun 2009) + + 12 Jun 2009; Gilles Dartiguelongue <eva@gentoo.org> + +hamster-applet-2.26.2-r1.ebuild, + +files/hamster-applet-2.26.2-pango-layout.patch: + Use pango layout to draw text in place of cairo for graphs, closes: + #273673. 23 May 2009; Gilles Dartiguelongue <eva@gentoo.org> hamster-applet-2.26.2.ebuild: diff --git a/gnome-extra/hamster-applet/Manifest b/gnome-extra/hamster-applet/Manifest index 920bc7a5f30e..a2b24c704047 100644 --- a/gnome-extra/hamster-applet/Manifest +++ b/gnome-extra/hamster-applet/Manifest @@ -3,18 +3,20 @@ Hash: SHA1 AUX hamster-applet-2.24.0-gnomevfs.patch 744 RMD160 ad2da96b98822ddf16c7f9bce53f260a20c8928b SHA1 dc13b7280a4dbc3eeb70bf68115b11a180bd7128 SHA256 0571434947b125da75a9a62cb159136a60334c5250c49dbb777a4267de0f8f55 AUX hamster-applet-2.24.0-python25.patch 1959 RMD160 302d2fd687d35462b23ce7becb8f3019f6656905 SHA1 9530e3aee51a3d8494e17af3de0f65098d18d60f SHA256 55b7fbb935da813fea51905c61a23a4fcdbae9581a7ea97b194e6981b7cb9a55 +AUX hamster-applet-2.26.2-pango-layout.patch 10015 RMD160 ab056ade8acef4aeb0e4dfef751cca3d06683639 SHA1 7dfef3c606af8bd67abc56210537912e2049b78b SHA256 9308fbff0f23986d67e486329f69d734f60c26dfaaacfe1a74287b167f8fbcc1 DIST hamster-applet-2.24.3.tar.bz2 401534 RMD160 4c9c1a52e81b961de3a37916fc49a5c84a23a861 SHA1 6425b707c622d6f5c8f3caed4c7fc91d50aa2641 SHA256 f59f0647eab59b852402aeca208fba49aeda515cfbae504309f94a7c59784b22 DIST hamster-applet-2.26.0.tar.bz2 421678 RMD160 9bfdee06c7122086c12ea2f2f692edcdecdffc89 SHA1 a5444ea5ff026ae2861909dbda0ade75639b27e0 SHA256 97930bdbf8ca3f3078709625430401ce6bff644dd3583e958f8ff9472fdd7d2d DIST hamster-applet-2.26.2.tar.bz2 426795 RMD160 22907772c65658dcbcb5eb658d4aa9b84d1ea2b3 SHA1 3caa0997ba2d0a63c418d84ce8ea7e16b1a188d0 SHA256 84ac01c066bd38f8ee5b002171b99365553f9688c557c6a5b229e16ae2adb4ec EBUILD hamster-applet-2.24.3.ebuild 1412 RMD160 cb244e3d4fb73bfce93b4ccb4d4efc20a2f8e30e SHA1 576b69fcbb49c59626ab5c7baa3f95cac1bb221d SHA256 ab35bf46509fc2d62622a7d8c76b1f1cbf002ffa76c234bbcbb627ceba76c381 EBUILD hamster-applet-2.26.0.ebuild 1445 RMD160 35cec7083981ec4b9f4e704b5160dcce9bb9c72a SHA1 54e20a75acc69272c04c5660ef402c7e92e2e9ef SHA256 a24bf4f1e850e0f4d6d9ef0586a4bc2791c99ace308dc18064d78ad124a5132b +EBUILD hamster-applet-2.26.2-r1.ebuild 1728 RMD160 5f26b589ad476583fade0353739acf9f6be6b971 SHA1 9eb440b08beab0994f24f6f21d1b9fb375d0be42 SHA256 f0904dc188bbcc4a8bd56e17a1199a9f43903dddb5dd425ebd1ec69d82a3df1f EBUILD hamster-applet-2.26.2.ebuild 1601 RMD160 0f66f983aa1958e3740a64cef4e10b1fa9b338e2 SHA1 d29670c4232694255489269bfac5783ff213ea7a SHA256 fa95f3c003c3a2f2ad395209e8cfdb1b7791199d479d4e72ff6a5a52783debb9 -MISC ChangeLog 2316 RMD160 9ae848cd8e6298c5343f25a52f2706473d0cc4c4 SHA1 f52c8a82ce5eddcbb5551e14f4244024221fb2f9 SHA256 5303f82e6709aed04744778d8cfb5cc4375451058956375e3e87b3ab47227032 +MISC ChangeLog 2580 RMD160 679814896455bfaee81a3796405156b409ea3b28 SHA1 eea74dcae933f48a8aeb45a4a95526eaa8187d56 SHA256 21fe8b7aa32553ae87557d374f9c66d0d31252e1df38a7c2a846ff20e0b90838 MISC metadata.xml 356 RMD160 6547f0bc2bc56bf2d45d562045db0430e5cc8c90 SHA1 cb8155da094785b94dfb43e2ae95f8061f4c26f4 SHA256 d1b867ff5d8db648194a023f5b919ebaf9ef8f5878c9c6f4883c36c72393f6c6 -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.11 (GNU/Linux) -iEYEARECAAYFAkoYV84ACgkQ1fmVwcYIWAbjYACfWsxw+U9NIHVWA0CMWjdz8rnJ -9LcAoKCBlm35bIddhP4YNCo6iiTtACPU -=euc3 +iEYEARECAAYFAkoxpGAACgkQ1fmVwcYIWAYyRQCgmJ6oERiMcDO2ihLtuewAgOlI +PckAoJvQydTeNlBxA4VSDdFXldV0fE5Y +=ipmn -----END PGP SIGNATURE----- diff --git a/gnome-extra/hamster-applet/files/hamster-applet-2.26.2-pango-layout.patch b/gnome-extra/hamster-applet/files/hamster-applet-2.26.2-pango-layout.patch new file mode 100644 index 000000000000..03a72c68254a --- /dev/null +++ b/gnome-extra/hamster-applet/files/hamster-applet-2.26.2-pango-layout.patch @@ -0,0 +1,242 @@ +From 47ca98014276fe73314abd10366f1e9b6c835650 Mon Sep 17 00:00:00 2001 +From: =?utf-8?q?Toms=20Bau=C4=A3is?= <toms.baugis@gmail.com> +Date: Thu, 11 Jun 2009 13:38:42 +0100 +Subject: [PATCH] use layout to set text instead of the cairo not suggested show_text. fixes bug 585420 + +--- + hamster/charting.py | 111 +++++++++++++++++++++++++++++++-------------------- + 1 files changed, 68 insertions(+), 43 deletions(-) + +diff --git a/hamster/charting.py b/hamster/charting.py +index 657fad6..49b4608 100644 +--- a/hamster/charting.py ++++ b/hamster/charting.py +@@ -53,7 +53,7 @@ Example: + + import gtk + import gobject +-import cairo ++import cairo, pango + import copy + import math + +@@ -139,13 +139,19 @@ class Chart(gtk.DrawingArea): + self.animation_timeout = 20 #in miliseconds + + self.current_frame = self.animation_frames +- self.freeze_animation = False ++ self.freeze_animation = False ++ self.layout = None #pango text layout + + def _expose(self, widget, event): # expose is when drawing's going on + context = widget.window.cairo_create() + context.rectangle(event.area.x, event.area.y, event.area.width, event.area.height) + context.clip() + ++ self.layout = context.create_layout() ++ default_font = pango.FontDescription(gtk.Style().font_desc.to_string()) ++ default_font.set_size(8 * pango.SCALE) ++ self.layout.set_font_description(default_font) ++ + if self.orient_vertical: + # for simple bars figure, when there is way too much data for bars + # and go to lines (yay!) +@@ -417,21 +423,27 @@ class Chart(gtk.DrawingArea): + + # scale labels + set_color_gdk(context, self.style.fg[gtk.STATE_NORMAL]); ++ self.layout.set_width(-1) ++ + for i in range(records): +- extent = context.text_extents(data[i]["label"]) #x, y, width, height +- context.move_to(graph_x + (step * i) + (step - extent[2]) / 2.0, +- graph_y + graph_height + 13) +- context.show_text(data[i]["label"]) ++ self.layout.set_text(data[i]["label"]) ++ label_w, label_h = self.layout.get_pixel_size() ++ context.move_to(graph_x + (step * i) + (step - label_w) / 2.0, ++ graph_y + graph_height + 2) ++ ++ self.layout.set_text(data[i]["label"]) ++ ++ context.show_layout(self.layout) + + # values for max min and average + max_label = "%d" % self.max + if self.there_are_floats: + max_label = "%.1f" % self.max + +- extent = context.text_extents(max_label) #x, y, width, height +- +- context.move_to(graph_x - extent[2] - 16, rect.y + 10) +- context.show_text(max_label) ++ self.layout.set_text(max_label) ++ label_w, label_h = self.layout.get_pixel_size() ++ context.move_to(graph_x - label_w - 16, rect.y) ++ context.show_layout(self.layout) + + + #flip the matrix vertically, so we do not have to think upside-down +@@ -474,40 +486,45 @@ class Chart(gtk.DrawingArea): + label = "%.1f" % data[i]["value"] + else: + label = "%d" % data[i]["value"] +- extent = context.text_extents(label) #x, y, width, height ++ ++ self.layout.set_text(label) ++ label_w, label_h = self.layout.get_pixel_size() + + bar_size = graph_height * data[i]["factor"] +- + if self.animate: + bar_size = bar_size * 0.8 + else: + bar_size = bar_size * 0.9 + +- vertical_offset = (step - extent[2]) / 2.0 ++ vertical_offset = (step - label_h) / 2.0 + +- if self.animate or bar_size - vertical_offset < extent[3]: +- graph_y = -bar_size - 3 ++ if self.animate or bar_size - vertical_offset < label_h: ++ graph_y = -bar_size - label_h + else: +- graph_y = -bar_size + extent[3] + vertical_offset ++ graph_y = - bar_size - label_h + vertical_offset + 3 + +- context.move_to(graph_x + (step * i) + (step - extent[2]) / 2.0, ++ context.move_to(graph_x + (step * i) + (step - label_w) / 2.0, + graph_y) +- context.show_text(label) ++ context.show_layout(self.layout) + + + def _ellipsize_text (self, context, text, width): + """try to constrain text into pixels by ellipsizing end + TODO - check if cairo maybe has ability to ellipsize automatically + """ +- extent = context.text_extents(text) #x, y, width, height +- if extent[2] <= width: ++ self.layout.set_text(text) ++ label_w, label_h = self.layout.get_pixel_size() ++ ++ if label_w <= width: + return text + + res = text + while res: + res = res[:-1] +- extent = context.text_extents(res + "…") #x, y, width, height +- if extent[2] <= width: ++ ++ self.layout.set_text(text + "…") ++ label_w, label_h = self.layout.get_pixel_size() ++ if label_w <= width: + return res + "…" + + return text # if can't fit - return what we have +@@ -523,8 +540,9 @@ class Chart(gtk.DrawingArea): + else: + max_extent = 0 + for i in range(records): +- extent = context.text_extents(data[i]["label"]) #x, y, width, height +- max_extent = max(max_extent, extent[2] + 8) ++ self.layout.set_text(data[i]["label"]) ++ label_w, label_h = self.layout.get_pixel_size() ++ max_extent = max(max_extent, label_w + 8) + + + #push graph to the right, so it doesn't overlap, and add little padding aswell +@@ -551,15 +569,18 @@ class Chart(gtk.DrawingArea): + ellipsize_label = lambda(text): 3 + + # now let's put scale labels and align them right +- set_color_gdk(context, self.style.fg[gtk.STATE_NORMAL]); ++ set_color_gdk(context, self.style.fg[gtk.STATE_NORMAL]) + for i in range(records): + label = data[i]["label"] + if self.legend_width: + label = self._ellipsize_text(context, label, max_extent - 8) +- extent = context.text_extents(label) #x, y, width, height ++ ++ self.layout.set_text(label) ++ label_w, label_h = self.layout.get_pixel_size() + +- context.move_to(rect.x + max_extent - extent[2] - 8, rect.y + (step * i) + (step + extent[3]) / 2) +- context.show_text(label) ++ context.move_to(rect.x + max_extent - label_w - 8, ++ rect.y + (step * i) + (step - label_h) / 2) ++ context.show_layout(self.layout) + + context.stroke() + +@@ -624,18 +645,21 @@ class Chart(gtk.DrawingArea): + label = "%.1f" % data[i]["value"] + else: + label = "%d" % data[i]["value"] +- extent = context.text_extents(label) #x, y, width, height ++ ++ self.layout.set_text(label) ++ label_w, label_h = self.layout.get_pixel_size() + + bar_size = max_size * data[i]["factor"] +- horizontal_offset = (step + extent[3]) / 2.0 - extent[3] ++ horizontal_offset = (step - label_h) / 2.0 + +- if bar_size - horizontal_offset < extent[2]: ++ if bar_size - horizontal_offset < label_w: + label_x = graph_x + bar_size + horizontal_offset + else: +- label_x = graph_x + bar_size - extent[2] - horizontal_offset ++ label_x = graph_x + bar_size - label_w - horizontal_offset + +- context.move_to(label_x, graph_y + (step * i) + (step + extent[3]) / 2.0) +- context.show_text(label) ++ context.move_to(label_x, ++ graph_y + (step * i) + (step - label_h) / 2.0) ++ context.show_layout(self.layout) + + else: + # values for max min and average +@@ -645,7 +669,8 @@ class Chart(gtk.DrawingArea): + else: + max_label = "%d" % self.max + +- context.show_text(max_label) ++ self.layout.set_text(max_label) ++ context.show_layout(self.layout) + + + def _area_chart(self, context): +@@ -717,20 +742,20 @@ class Chart(gtk.DrawingArea): + set_color_gdk(context, self.style.fg[gtk.STATE_NORMAL]); + for i in range(records): + if i % 5 == 0: +- context.move_to(graph_x + 5 + (step * i), graph_y + graph_height + 13) +- context.show_text(data[i]["label"]) ++ context.move_to(graph_x + 5 + (step * i), graph_y + graph_height + 3) ++ self.layout.set_text(data[i]["label"]) ++ context.show_layout(self.layout) + + # values for max min and average + if self.there_are_floats: + max_label = "%.1f" % self.max + else: + max_label = "%d" % self.max +- +- extent = context.text_extents(max_label) #x, y, width, height +- +- context.move_to(graph_x - extent[2] - 16, rect.y + 10) +- context.show_text(max_label) +- ++ ++ self.layout.set_text(max_label) ++ label_w, label_h = self.layout.get_pixel_size() ++ context.move_to(graph_x - label_w - 16, rect.y) ++ context.show_layout(self.layout) + + context.rectangle(graph_x, graph_y, graph_width, graph_height + 1) + context.clip() +-- +1.6.3.1 + diff --git a/gnome-extra/hamster-applet/hamster-applet-2.26.2-r1.ebuild b/gnome-extra/hamster-applet/hamster-applet-2.26.2-r1.ebuild new file mode 100644 index 000000000000..59a915a6128a --- /dev/null +++ b/gnome-extra/hamster-applet/hamster-applet-2.26.2-r1.ebuild @@ -0,0 +1,67 @@ +# Copyright 1999-2009 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/gnome-extra/hamster-applet/hamster-applet-2.26.2-r1.ebuild,v 1.1 2009/06/11 22:42:02 eva Exp $ + +EAPI="2" +GCONF_DEBUG="no" +SCROLLKEEPER_UPDATE="no" + +inherit eutils gnome2 python + +DESCRIPTION="Time tracking for the masses, in a GNOME applet" +HOMEPAGE="http://projecthamster.wordpress.com/" + +# license on homepage is out-of-date, was changed to GPL-2 on 2008-04-16 +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~amd64 ~x86" +IUSE="eds libnotify" + +RDEPEND=" + || ( >=dev-lang/python-2.5[sqlite] + ( dev-lang/python:2.4 + dev-python/pysqlite:2 ) ) + dev-python/gconf-python + dev-python/libgnome-python + dev-python/gnome-applets-python + dev-python/dbus-python + eds? ( dev-python/evolution-python ) + libnotify? ( dev-python/notify-python ) + >=dev-python/pygobject-2.14 + >=dev-python/pygtk-2.12 + >=x11-libs/gtk+-2.12 + x11-libs/libXScrnSaver" + +DEPEND="${RDEPEND} + x11-proto/scrnsaverproto + >=dev-util/intltool-0.40 + dev-util/pkgconfig + sys-devel/gettext" + +DOCS="AUTHORS ChangeLog NEWS README" + +src_prepare() { + gnome2_src_prepare + + # disable pyc compiling + mv py-compile py-compile.orig + ln -s $(type -P true) py-compile + + # Use pango layout instead of cairo for drawing text in graphs, bug #585420 + epatch "${FILESDIR}/${P}-pango-layout.patch" + + # Fix intltoolize broken file, see upstream #577133 + sed "s:'\^\$\$lang\$\$':\^\$\$lang\$\$:g" -i po/Makefile.in.in || die "sed failed" +} + +pkg_postinst() { + gnome2_pkg_postinst + + python_need_rebuild + python_mod_optimize $(python_get_sitedir)/hamster +} + +pkg_postrm() { + gnome2_pkg_postrm + python_mod_cleanup /usr/$(get_libdir)/python*/site-packages/hamster +} |