Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/OficinaActivity.py
diff options
context:
space:
mode:
authorAlexandre Antonino Gonçalves Martinazzo <alexandremartinazzo@gmail.com>2007-07-27 19:34:50 (GMT)
committer Alexandre Antonino Gonçalves Martinazzo <alexandremartinazzo@gmail.com>2007-07-27 19:34:50 (GMT)
commit05e9648640120a7523aee558bd730fb938ac381d (patch)
tree82ab81e88e3a31b53d79195ac9ee34c43b33728c /OficinaActivity.py
parent900971006bd6748cd1250ba5bf44617eec2e9455 (diff)
Colors now are choosen from a ColorButton
Diffstat (limited to 'OficinaActivity.py')
-rw-r--r--OficinaActivity.py39
1 files changed, 22 insertions, 17 deletions
diff --git a/OficinaActivity.py b/OficinaActivity.py
index b308b04..a75810b 100644
--- a/OficinaActivity.py
+++ b/OficinaActivity.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
"""
-Desenho.py
+OficinaActivity.py
Create Oficina Activity
@@ -63,9 +63,7 @@ from sugar.activity import activity
#from Oficina import Oficina
from toolbox import Toolbox
from Area import Area
-
-# DRAW_WIDTH = 1195
-# DRAW_HEIGHT = 800
+import logging
class OficinaActivity(activity.Activity):
def __init__(self, handle):
@@ -77,6 +75,8 @@ class OficinaActivity(activity.Activity):
"""
activity.Activity.__init__(self, handle)
+
+ logging.debug('Starting Paint activity (Oficina)')
os.chdir(activity.get_bundle_path())
#print activity.get_bundle_path()
@@ -90,17 +90,17 @@ class OficinaActivity(activity.Activity):
sw = gtk.ScrolledWindow()
sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
- self._fixed = gtk.Fixed()
- self._area = Area(self)
+ 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 = 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
+ #FIXME: use a textview instead of an Entry
#self._textview = gtk.TextView()
self._textview = gtk.Entry()
self._area.tool = 2
@@ -123,14 +123,17 @@ class OficinaActivity(activity.Activity):
'''Read file from Sugar Journal.
self --
- file_path --
+ file_path --
'''
- print 'read file...'
- print file_path
+ logging.debug('reading file')
+ logging.debug(file_path)
+
#self._area.d.limpatudo()
#self._area.d.clear()
self._area.d.loadImage(file_path, self._area)
+
+ # Does this work?
self._area.undo_times = 1
self._area.redo_times = 0
@@ -138,13 +141,15 @@ class OficinaActivity(activity.Activity):
def write_file(self, file_path):
'''Save file on Sugar Journal.
- self --
- file_path --
+ self --
+ file_path --
'''
- print file_path
+ logging.debug('writting file')
+ logging.debug(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', {})
+ pixbuf.save(file_path, 'png', {})