[billreminder] Chart widget creates a dynamic image in PNG format now.
- From: Og B. Maciel <ogmaciel src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [billreminder] Chart widget creates a dynamic image in PNG format now.
- Date: Tue, 24 Nov 2009 19:40:39 +0000 (UTC)
commit dbbcdc23bdc33e7fb6ebb89c9b86a766c59260fe
Author: Og B. Maciel <ogmaciel gnome org>
Date: Tue Nov 24 14:40:23 2009 -0500
Chart widget creates a dynamic image in PNG format now.
src/gui/widgets/chartwidget.py | 16 +++++++++++++---
1 files changed, 13 insertions(+), 3 deletions(-)
---
diff --git a/src/gui/widgets/chartwidget.py b/src/gui/widgets/chartwidget.py
index dcb306c..1257253 100644
--- a/src/gui/widgets/chartwidget.py
+++ b/src/gui/widgets/chartwidget.py
@@ -6,6 +6,7 @@ import gtk
import sys
import cairo
+import StringIO
from pycha import bar
class ChartWidget(gtk.HBox):
@@ -71,7 +72,16 @@ class ChartWidget(gtk.HBox):
chart.render()
#TODO: the widget's Image object should take a dynamically created image object
- surface.write_to_png('foobar.png')
+ buf = StringIO.StringIO()
+ surface.write_to_png(buf)
+
+ # Move pointer to start of buffer
+ buf.seek(0)
+ loader = gtk.gdk.PixbufLoader()
+ loader.write(buf.getvalue())
+ loader.close()
+
+ self.chart.set_from_pixbuf(loader.get_pixbuf())
class BasicWindow:
@@ -98,8 +108,8 @@ class BasicWindow:
self.window.add(place)
self.window.show_all()
- #data = [(None, 150.0), (u'House', 132.55000000000001)]
- #self.chart.plot(data)
+ data = (('None', 150.0), (u'House', 132.55))
+ self.chart.plot(data)
def main():
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]