Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/OficinaActivity.py
diff options
context:
space:
mode:
authorManusheel <manusheel@localhost.localdomain>2007-07-18 20:04:08 (GMT)
committer Manusheel <manusheel@localhost.localdomain>2007-07-18 20:04:08 (GMT)
commit9c0b7121410f4d013d2cc67e5b7490c593abdb74 (patch)
treeafea4805a043a93aed56d7999bdf93a16b9c2553 /OficinaActivity.py
parent56264eb6a6e1ddef6148b78de6b52afd9e1bb745 (diff)
New SVG Icon, name of project changed to paint and bugs fixed
Diffstat (limited to 'OficinaActivity.py')
-rw-r--r--OficinaActivity.py94
1 files changed, 94 insertions, 0 deletions
diff --git a/OficinaActivity.py b/OficinaActivity.py
new file mode 100644
index 0000000..add4fca
--- /dev/null
+++ b/OficinaActivity.py
@@ -0,0 +1,94 @@
+import os
+from gettext import gettext as _
+
+import gtk
+
+from sugar.activity import activity
+
+#from Oficina import Oficina
+from toolbox import Toolbox
+from Area import Area
+from Cursors import Cursors
+
+# DRAW_WIDTH = 1195
+# DRAW_HEIGHT = 800
+
+class OficinaActivity(activity.Activity):
+ def __init__(self, handle):
+ """Initialize the OficinaActivity object.
+
+ Keyword arguments:
+ self --
+ handle --
+
+ """
+ activity.Activity.__init__(self, handle)
+
+ os.chdir(activity.get_bundle_path())
+ #print activity.get_bundle_path()
+
+ toolbox = Toolbox(self)
+ self.set_toolbox(toolbox)
+ toolbox.show()
+
+
+ # addind a textview widget
+ sw = gtk.ScrolledWindow()
+ sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
+
+ self._fixed = gtk.Fixed()
+ self._area = Area(self)
+ color = gtk.gdk.color_parse("white")
+ self._fixed.modify_bg(gtk.STATE_NORMAL, color)
+
+ self.bg = gtk.Image()
+ self.bg.set_from_file('./icons/bg.svg')
+ self._fixed.put(self.bg, 200, 100)
+ self.bg.show()
+
+ #FIXME: use a textview instead of a Entry
+ #self._textview = gtk.TextView()
+ self._textview = gtk.Entry()
+ self._area.tool = 2
+ self._fixed.put(self._area, 200 , 100)
+
+ sw.add_with_viewport(self._fixed)
+ self._area.show()
+ self._fixed.show()
+
+
+ self._fixed.put(self._textview, 0, 0)
+ self._textview.hide()
+ sw.show()
+
+ # setting scrolledwindow as activity canvas...
+ self.set_canvas(sw)
+
+
+ def read_file(self, file_path):
+ '''Read file from Sugar Journal.
+
+ self --
+ file_path --
+
+ '''
+ print 'read file...'
+ print file_path
+ #self._area.d.limpatudo()
+ #self._area.d.clear()
+ self._area.d.loadImage(file_path)
+
+
+ def write_file(self, file_path):
+ '''Save file on Sugar Journal.
+
+ self --
+ file_path --
+
+ '''
+ print file_path
+ width, height = self._area.window.get_size()
+ pixbuf = gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB, False, 8, width, height)
+ pixbuf.get_from_drawable(self._area.pixmap, gtk.gdk.colormap_get_system(), 0, 0, 0, 0, -1, -1)
+ pixbuf.save(file_path, 'png', {})
+