diff options
author | Gonzalo Odiard <godiard@gmail.com> | 2014-07-08 15:23:13 (GMT) |
---|---|---|
committer | Gonzalo Odiard <godiard@gmail.com> | 2014-07-08 15:23:13 (GMT) |
commit | 21335bb47e44dc34df74ba3b0e7c60068d048c00 (patch) | |
tree | 3754aafdc913a3881a43f97efdd6ff438d2afc2b | |
parent | 0c3f1aab84a7650db538aff60330f3ceeaccac89 (diff) |
Grahic improvements on budgetscreen.py
-rw-r--r-- | budgetscreen.py | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/budgetscreen.py b/budgetscreen.py index baaec00..37cd4a3 100644 --- a/budgetscreen.py +++ b/budgetscreen.py @@ -24,6 +24,8 @@ from gi.repository import Gtk from gi.repository import Gdk from gi.repository import GObject +from sugar3.graphics import style + # Set up localization. locale.setlocale(locale.LC_ALL, '') @@ -49,7 +51,8 @@ class BudgetScreen(Gtk.VBox): scroll = Gtk.ScrolledWindow() scroll.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC) scroll.add_with_viewport(self.budgetbox) - + scroll.modify_bg(Gtk.StateType.NORMAL, + style.COLOR_WHITE.get_gdk_color()) self.pack_start(scroll, True, True, 0) def build(self): @@ -164,9 +167,9 @@ class BudgetScreen(Gtk.VBox): cr.fill() # Draw outline. - cr.set_source_rgb(0, 0, 0) + cr.set_source_rgb(0.95, 0.95, 0.95) cr.rectangle(0, 0, bounds.width, bounds.height) - cr.stroke() + cr.fill() # Draw arrow and cost. total = self.category_total[category] @@ -186,11 +189,11 @@ class BudgetScreen(Gtk.VBox): ratio = total / budget - cr.move_to(5, 5) - cr.line_to(ratio * (bounds.width - 30), 5) + cr.move_to(0, 0) + cr.line_to(ratio * (bounds.width - 30), 0) cr.line_to(ratio * (bounds.width - 5), bounds.height / 2) - cr.line_to(ratio * (bounds.width - 30), bounds.height - 5) - cr.line_to(5, bounds.height - 5) + cr.line_to(ratio * (bounds.width - 30), bounds.height) + cr.line_to(0, bounds.height) cr.close_path() if ratio > 1.0: @@ -199,18 +202,12 @@ class BudgetScreen(Gtk.VBox): cr.set_source_rgb(0.9, 0.9, 0.6) else: cr.set_source_rgb(0.6, 1.0, 0.6) - cr.fill_preserve() - - cr.set_source_rgb(0.5, 0.5, 0.5) - cr.stroke() + cr.fill() text = locale.currency(total) - cr.set_source_rgb(0, 0, 0) - cr.set_font_size(20) x_bearing, y_bearing, width, height = cr.text_extents(text)[:4] - cr.move_to(20, (bounds.height - height) / 2 - y_bearing) cr.show_text(text) |