diff options
author | Gonzalo Odiard <godiard@gmail.com> | 2013-12-24 16:19:02 (GMT) |
---|---|---|
committer | Gonzalo Odiard <godiard@gmail.com> | 2013-12-26 14:17:53 (GMT) |
commit | e7980a304f3a3bcefacd2070e8afe35b0025c2b5 (patch) | |
tree | 3946de001744b64ff1f814c7fafdc61d97d4df94 | |
parent | 11299f2ad659cdbb68de4c36cab2b3a9e64ef0c2 (diff) |
Replace use of print by logging
-rw-r--r-- | historietaactivity.py | 10 | ||||
-rw-r--r-- | persistencia.py | 13 | ||||
-rw-r--r-- | toolbar.py | 5 |
3 files changed, 8 insertions, 20 deletions
diff --git a/historietaactivity.py b/historietaactivity.py index b00b053..0d77573 100644 --- a/historietaactivity.py +++ b/historietaactivity.py @@ -39,7 +39,6 @@ class HistorietaActivity(activity.Activity): _EXPORT_FORMATS = [['image/png', _('Save as Image'), _('PNG'), ""]] def __init__(self, handle): - print "INICIALIZANDO FOTOTOON" activity.Activity.__init__(self, handle) self.set_title('FotoToon') @@ -156,7 +155,7 @@ class HistorietaActivity(activity.Activity): # quiero que al ingresar al titulo se des seleccione el globo seleccionado def on_title(self, widget, event): - print "Ingresando al titulo" + logging.debug('Editing the title') if self.page.get_active_box() is not None: box = self.page.get_active_box() self.page.set_active_box(None) @@ -164,7 +163,7 @@ class HistorietaActivity(activity.Activity): box.set_globo_activo(None) box.redraw() - print "Fin de Ingresando al titulo" + logging.debug('After edit the title') def write_file(self, file_path): # be sure all the changes are commited @@ -172,12 +171,10 @@ class HistorietaActivity(activity.Activity): if active_globe is not None: active_globe.set_selected(False) - print "write file path", file_path persistence = persistencia.Persistence() persistence.write(file_path, self.page) def read_file(self, file_path): - print "read file path", file_path persistence = persistencia.Persistence() persistence.read(file_path, self.page) @@ -486,7 +483,6 @@ class ComicBox(Gtk.EventBox): def __init__(self, page, image_file_name, posi, x=0, y=0, width=0, height=0): - print ('Cuadro INIT') Gtk.EventBox.__init__(self) self.img_x = x @@ -661,9 +657,7 @@ class ComicBox(Gtk.EventBox): if (not self.image_saved) and img_scaled: self.image_saved = True - # print instance_path image_file_name = 'image' + str(self.posi) + '.png' - print "Grabamos: " + image_file_name sav_img = ctx.get_target().create_similar( cairo.CONTENT_COLOR_ALPHA, self.img_w, self.img_h) ct2 = cairo.Context(sav_img) diff --git a/persistencia.py b/persistencia.py index 7e7f1d4..dfc269e 100644 --- a/persistencia.py +++ b/persistencia.py @@ -1,5 +1,6 @@ import os import json +import logging import globos from sugar3.activity import activity @@ -48,7 +49,7 @@ class Persistence: for globo in box.globos: globoData = {} globoData['title_globe'] = (globo == box.title_globe) - print 'Grabando', globo.globe_type + logging.debug('Saving %s', globo.globe_type) globoData['globe_type'] = globo.globe_type globoData['radio'] = globo.radio globoData['width'], globoData['height'] = \ @@ -75,8 +76,7 @@ class Persistence: boxData['globes'].append(globoData) pageData['boxs'].append(boxData) - # hago picle de pageData - print pageData + logging.debug('pageData %s', pageData) data_file_name = 'data.json' f = open(os.path.join(instance_path, data_file_name), 'w') @@ -85,7 +85,7 @@ class Persistence: finally: f.close() - print 'file_name', file_name + logging.debug('file_name %s', file_name) z = zipfile.ZipFile(file_name, 'w') z.write(os.path.join(instance_path, data_file_name).encode( @@ -105,7 +105,7 @@ class Persistence: for file_name in z.namelist(): if (file_name != './'): try: - print 'extrayendo', file_name + logging.debug('extracting %s', file_name) # la version de python en las xo no permite hacer # extract :( # z.extract(file_name,instance_path) @@ -114,7 +114,7 @@ class Persistence: fout.write(data) fout.close() except: - print 'Error extrayendo', file_name + logging.error('Error extracting %s', file_name) z.close() data_file_name = 'data.json' @@ -148,7 +148,6 @@ class Persistence: globo_direccion = globoData['direction'] tipo_globo = globoData['globe_type'] - print 'tipo_globo', tipo_globo globo = None if (tipo_globo == 'GLOBE'): globo = globos.Globo(box, x=globo_x, y=globo_y, @@ -179,20 +179,16 @@ class GlobesManager(): self.add_image() def girar(self, boton): - print "girando" #veo cual es el globo seleccionado y o giro box = self._page.get_active_box() if box.get_globo_activo() is not None: - print "globo activo", globe = box.get_globo_activo() if globe.girar(): box.redraw() def borrar(self, boton): - print "borrando" box = self._page.get_active_box() if box.get_globo_activo() is not None: - print "borrando globo" # Do no remove the title globe if box.get_globo_activo() == box.title_globe: return @@ -202,7 +198,6 @@ class GlobesManager(): box.redraw() else: # Borrar un box es mas complicado - print "borrando box" pos_box = self._page.boxs.index(box) if (len(self._page.boxs) > pos_box): for i in range(pos_box, len(self._page.boxs) - 1): |