[hamster-applet] trying to be a bit smarter about font sizes
- From: Toms Baugis <tbaugis src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [hamster-applet] trying to be a bit smarter about font sizes
- Date: Wed, 7 Jul 2010 13:32:52 +0000 (UTC)
commit 20f12eb34599b22d3da7b8842a010469a6efdc81
Author: Toms Bauģis <toms baugis gmail com>
Date: Wed Jul 7 14:32:45 2010 +0100
trying to be a bit smarter about font sizes
src/hamster/widgets/facttree.py | 18 +++++++++---------
src/hamster/widgets/tags.py | 10 ++++++----
2 files changed, 15 insertions(+), 13 deletions(-)
---
diff --git a/src/hamster/widgets/facttree.py b/src/hamster/widgets/facttree.py
index e6fd13a..03377fc 100644
--- a/src/hamster/widgets/facttree.py
+++ b/src/hamster/widgets/facttree.py
@@ -326,25 +326,25 @@ class FactCellRenderer(gtk.GenericCellRenderer):
self.data = None
font = gtk.Style().font_desc
- default_size = font.get_size() / pango.SCALE
+ self.default_size = font.get_size() / pango.SCALE
self.labels = graphics.Sprite()
- self.date_label = graphics.Label(size = default_size)
+ self.date_label = graphics.Label(size = self.default_size)
- self.interval_label = graphics.Label(size = default_size)
+ self.interval_label = graphics.Label(size = self.default_size)
self.labels.add_child(self.interval_label)
- self.activity_label = graphics.Label(size = default_size)
+ self.activity_label = graphics.Label(size = self.default_size)
self.labels.add_child(self.activity_label)
- self.category_label = graphics.Label(size = default_size)
+ self.category_label = graphics.Label(size = self.default_size)
self.labels.add_child(self.category_label)
- self.description_label = graphics.Label(size = default_size)
+ self.description_label = graphics.Label(size = self.default_size)
self.labels.add_child(self.description_label)
- self.duration_label = graphics.Label(size=default_size)
+ self.duration_label = graphics.Label(size=self.default_size)
self.labels.add_child(self.duration_label)
default_font = gtk.Style().font_desc.to_string()
@@ -574,9 +574,9 @@ class FactCellRenderer(gtk.GenericCellRenderer):
def on_get_size(self, widget, cell_area):
if "id" not in self.data:
if self.data["first"]:
- return (0, 0, 0, 25)
+ return (0, 0, 0, (self.default_size + 10) * 1.5)
else:
- return (0, 0, 0, 40)
+ return (0, 0, 0, (self.default_size + 10) * 2)
context = gtk.gdk.CairoContext(cairo.Context(cairo.ImageSurface(cairo.FORMAT_A1, 0, 0)))
diff --git a/src/hamster/widgets/tags.py b/src/hamster/widgets/tags.py
index 8a7d09e..c36c36d 100644
--- a/src/hamster/widgets/tags.py
+++ b/src/hamster/widgets/tags.py
@@ -238,8 +238,6 @@ class TagBox(graphics.Scene):
self.selected_tags = []
self.layout = None
- self.font_size = 10 #override default font size
-
if self.interactive:
self.connect("on-mouse-over", self.on_mouse_over)
self.connect("on-mouse-out", self.on_mouse_out)
@@ -318,9 +316,13 @@ class Tag(graphics.Sprite):
graphics.Sprite.__init__(self, interactive = interactive)
self.text = text
- label = graphics.Label(text, size = 8, color = (30, 30, 30), y = 2)
- w, h = label.width + 18, label.height + 3
+ font = gtk.Style().font_desc
+ font_size = int(font.get_size() * 0.8 / pango.SCALE) # 80% of default
+
+ label = graphics.Label(text, size = font_size, color = (30, 30, 30), y = 2)
+
+ w, h = int((label.width + 8) * 1.3), label.height + 3
corner = h / 3
label.x = corner + 8
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]