Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJorge Saldivar <jsaldivar@paraguayeduca.org>2011-02-22 20:40:30 (GMT)
committer Jorge Saldivar <jsaldivar@paraguayeduca.org>2011-02-22 20:40:30 (GMT)
commit21bcdbf1750a891bf34b8331574e762b3b49ba5d (patch)
treed8cdaf370929e3fcf083b893516a9ff45593031f
parent436cb7f7297c19748b89fcb620b8e11c6b5a803b (diff)
Take off debug comments
-rw-r--r--labyrinthactivity.py3
-rw-r--r--src/MMapArea.py23
-rw-r--r--src/TextThought.py148
3 files changed, 53 insertions, 121 deletions
diff --git a/labyrinthactivity.py b/labyrinthactivity.py
index d655d95..1155c0c 100644
--- a/labyrinthactivity.py
+++ b/labyrinthactivity.py
@@ -282,8 +282,7 @@ class TextAttributesToolbar(gtk.Toolbar):
elif x.type == pango.ATTR_UNDERLINE and \
x.value == pango.UNDERLINE_SINGLE:
attributes["underline"] = False
- elif x.type == pango.ATTR_FONT_DESC:
- logging.debug("La fuente es: %s", x.desc)
+ elif x.type == pango.ATTR_FONT_DESC:
attributes["font"] = x.desc
if it.next() == False:
break
diff --git a/src/MMapArea.py b/src/MMapArea.py
index a56525d..838175a 100644
--- a/src/MMapArea.py
+++ b/src/MMapArea.py
@@ -333,27 +333,17 @@ class MMapArea (gtk.DrawingArea):
self.invalidate ()
def key_press (self, widget, event):
- logging.debug("Se presiono una tecla")
# Support for canvas panning keys ('hand' on XO, 'cmd' on Macs)
if event.hardware_keycode == 133 or event.hardware_keycode == 134:
self.translate = True
- logging.debug("Evento: %s", str(event))
- logging.debug("do_filter %s", str(self.do_filter))
- #valor_retorno = self.im_context.filter_keypress (event)
- #logging.debug("filter_keypress me retorna %s", str(valor_retorno))
- if not self.do_filter or not self.im_context.filter_keypress (event):
- logging.debug("Antes de preguntar si tengo focus")
+ if not self.do_filter or not self.im_context.filter_keypress (event):
if self.focus:
if self.focus.creating or \
- not self.focus.process_key_press (event, self.mode):
- logging.debug("Me voy a global_key_handler, dento de self.focus")
+ not self.focus.process_key_press (event, self.mode):
return self.global_key_handler (event)
- logging.debug("Retorno True dentro de self.focus")
return True
if len(self.selected) != 1 or not self.selected[0].process_key_press (event, self.mode):
- logging.debug("Me voy a global_key_handler")
return self.global_key_handler (event)
- logging.debug("Termine la funcion y me voy")
return True
def key_release (self, widget, event):
@@ -491,9 +481,9 @@ class MMapArea (gtk.DrawingArea):
self.im_context.disconnect (self.retrieve_handler)
self.commit_handler = None
if thought:
- try:
- logging.debug("Conectando con commit_text")
- self.commit_handler = self.im_context.connect ("commit", thought.commit_text, self.mode, self.font_combo_box, self.font_sizes_combo_box)
+ try:
+ self.commit_handler = self.im_context.connect ("commit", thought.commit_text, self.mode, self.font_combo_box, \
+ self.font_sizes_combo_box)
self.delete_handler = self.im_context.connect ("delete-surrounding", thought.delete_surroundings, self.mode)
self.preedit_changed_handler = self.im_context.connect ("preedit-changed", thought.preedit_changed, self.mode)
self.preedit_end_handler = self.im_context.connect ("preedit-end", thought.preedit_end, self.mode)
@@ -504,8 +494,7 @@ class MMapArea (gtk.DrawingArea):
except AttributeError:
self.do_filter = False
else:
- self.do_filter = False
- logging.debug("Estoy saliendo de hookup_im_context con do_filter=%s", str(self.do_filter))
+ self.do_filter = False
def unselect_all (self):
self.hookup_im_context ()
diff --git a/src/TextThought.py b/src/TextThought.py
index 30bf007..1fef255 100644
--- a/src/TextThought.py
+++ b/src/TextThought.py
@@ -71,8 +71,7 @@ class TextThought (ResizableThought):
self.all_okay = True
- def index_from_bindex (self, bindex):
- logging.debug("Metodo: index_from_bindex")
+ def index_from_bindex (self, bindex):
if bindex == 0:
return 0
index = 0
@@ -81,7 +80,6 @@ class TextThought (ResizableThought):
return index
def bindex_from_index (self, index):
- logging.debug("Metodo: bindex_from_index")
if index == 0:
return 0
bind = 0
@@ -96,7 +94,6 @@ class TextThought (ResizableThought):
return bind
def attrs_changed (self):
- logging.debug("Metodo: attrs_changed")
bold = False
italics = False
underline = False
@@ -202,8 +199,7 @@ class TextThought (ResizableThought):
self.emit("update-attrs", bold, italics, underline, pango_font)
return show_text
- def recalc_text_edges (self):
- logging.debug("Metodo: recalc_text_edges")
+ def recalc_text_edges (self):
if (not hasattr(self, "layout")):
return
del self.layout
@@ -250,14 +246,12 @@ class TextThought (ResizableThought):
self.ul = (self.lr[0] - margin[0] - margin[2] - text_w, tmp1)
"""
- def recalc_edges (self):
- logging.debug("Metodo: recalc_edges")
+ def recalc_edges (self):
self.lr = (self.ul[0]+self.width, self.ul[1]+self.height)
if not self.creating:
self.recalc_text_edges()
- def commit_text (self, context, string, mode, font_combo_box, font_sizes_combo_box):
- logging.debug("Metodo: commit_text")
+ def commit_text (self, context, string, mode, font_combo_box, font_sizes_combo_box):
font_name = font_combo_box.get_active_text()
font_size = font_sizes_combo_box.get_active_text()
self.set_font(font_name, font_size)
@@ -266,10 +260,7 @@ class TextThought (ResizableThought):
self.emit ("title_changed", self.text)
self.emit ("update_view")
- def add_text (self, string):
- logging.debug("Metodo: add_text")
- logging.debug("Index s: %s, e: %s", str(self.index), str(self.end_index))
- logging.debug("Texto: %s", str(self.text))
+ def add_text (self, string):
if self.index > self.end_index:
left = self.text[:self.end_index]
right = self.text[self.index:]
@@ -285,14 +276,12 @@ class TextThought (ResizableThought):
bleft = self.bytes[:self.b_f_i (self.index)]
bright = self.bytes[self.b_f_i (self.end_index):]
change = self.index - self.end_index + len(string)
- else:
- logging.debug("Son iguales")
+ else:
left = self.text[:self.index]
right = self.text[self.index:]
bleft = self.bytes[:self.b_f_i(self.index)]
bright = self.bytes[self.b_f_i(self.index):]
- change = len(string)
- logging.debug("L: %s, R: %s, BL: %s, BR: %s", str(left), str(right), str(bleft), str(bright))
+ change = len(string)
it = self.attributes.get_iterator()
changes= []
@@ -340,12 +329,9 @@ class TextThought (ResizableThought):
self.index += len (string)
self.bytes = bleft + str(len(string)) + bright
self.bindex = self.b_f_i (self.index)
- self.end_index = self.index
- logging.debug("String : %s", str(string))
- logging.debug("Index Again s: %s, e: %s, bi:%s", str(self.index), str(self.end_index), str(self.bindex))
+ self.end_index = self.index
- def draw (self, context):
- logging.debug("Metodo: draw")
+ def draw (self, context):
self.recalc_edges ()
ResizableThought.draw(self, context)
if self.creating:
@@ -378,8 +364,7 @@ class TextThought (ResizableThought):
context.set_source_rgb (0,0,0)
context.stroke ()
- def process_key_press (self, event, mode):
- logging.debug("Metodo: process_key_press")
+ def process_key_press (self, event, mode):
modifiers = gtk.accelerator_get_default_mod_mask ()
shift = event.state & modifiers == gtk.gdk.SHIFT_MASK
handled = True
@@ -425,8 +410,7 @@ class TextThought (ResizableThought):
else:
handled = False
- if clear_attrs:
- logging.debug("ACABO DE BORRAR LA LISTA DE ATRIBUTOS Y REMPLACE POR UNA LISTA VACIA")
+ if clear_attrs:
del self.current_attrs
self.current_attrs = []
@@ -438,8 +422,7 @@ class TextThought (ResizableThought):
return handled
- def undo_text_action (self, action, mode):
- logging.debug("Metodo: undo_text_action")
+ def undo_text_action (self, action, mode):
self.undo.block ()
if action.undo_type == UndoManager.DELETE_LETTER or action.undo_type == UndoManager.DELETE_WORD:
real_mode = not mode
@@ -469,8 +452,7 @@ class TextThought (ResizableThought):
self.emit ("grab_focus", False)
self.undo.unblock ()
- def delete_char (self):
- logging.debug("Metodo: delete_char")
+ def delete_char (self):
if self.index == self.end_index == len (self.text):
return
if self.index > self.end_index:
@@ -546,8 +528,7 @@ class TextThought (ResizableThought):
self.bytes = bleft+bright
self.end_index = self.index
- def backspace_char (self):
- logging.debug("Metodo: backspace_char")
+ def backspace_char (self):
if self.index == self.end_index == 0:
return
if self.index > self.end_index:
@@ -628,8 +609,7 @@ class TextThought (ResizableThought):
if self.index < 0:
self.index = 0
- def move_index_back (self, mod):
- logging.debug("Metodo: move_index_back")
+ def move_index_back (self, mod):
if self.index <= 0:
self.index = 0
return
@@ -637,8 +617,7 @@ class TextThought (ResizableThought):
if not mod:
self.end_index = self.index
- def move_index_forward (self, mod):
- logging.debug("Metodo: move_index_forward")
+ def move_index_forward (self, mod):
if self.index >= len(self.text):
self.index = len(self.text)
return
@@ -646,8 +625,7 @@ class TextThought (ResizableThought):
if not mod:
self.end_index = self.index
- def move_index_up (self, mod):
- logging.debug("Metodo: move_index_up")
+ def move_index_up (self, mod):
tmp = self.text.decode ()
lines = tmp.splitlines ()
if len (lines) == 1:
@@ -681,8 +659,7 @@ class TextThought (ResizableThought):
if not mod:
self.end_index = self.index
- def move_index_down (self, mod):
- logging.debug("Metodo: move_index_down")
+ def move_index_down (self, mod):
tmp = self.text.decode ()
lines = tmp.splitlines ()
if len (lines) == 1:
@@ -706,8 +683,7 @@ class TextThought (ResizableThought):
if not mod:
self.end_index = self.index
- def move_index_horizontal(self, mod, home=False):
- logging.debug("Metodo: move_index_horizontal")
+ def move_index_horizontal(self, mod, home=False):
lines = self.text.splitlines ()
loc = 0
line = 0
@@ -722,8 +698,7 @@ class TextThought (ResizableThought):
return
line += 1
- def process_button_down (self, event, coords):
- logging.debug("Metodo: process_button_down")
+ def process_button_down (self, event, coords):
if ResizableThought.process_button_down(self, event, coords):
return True
@@ -761,16 +736,13 @@ class TextThought (ResizableThought):
self.paste_text (clip)
del self.current_attrs
- self.current_attrs = []
- logging.debug("ACABO DE BORRAR LA LISTA DE ARGUMENTOS Y REMPLACE POR UNA LISTA VACIA")
- logging.debug("Index %s, End Index %s", str(self.index), str(self.end_index))
+ self.current_attrs = []
self.recalc_edges()
self.emit ("update_view")
self.selection_changed()
- def process_button_release (self, event, transformed):
- logging.debug("Metodo: process_button_release")
+ def process_button_release (self, event, transformed):
if self.orig_size:
if self.creating:
orig_size = self.width >= MIN_SIZE or self.height >= MIN_SIZE
@@ -785,13 +757,11 @@ class TextThought (ResizableThought):
self.double_click = False
return ResizableThought.process_button_release(self, event, transformed)
- def selection_changed (self):
- logging.debug("Metodo: selection_changed")
+ def selection_changed (self):
(start, end) = (min(self.index, self.end_index), max(self.index, self.end_index))
self.emit ("text_selection_changed", start, end, self.text[start:end])
- def handle_motion (self, event, transformed):
- logging.debug("Metodo: handle_motion")
+ def handle_motion (self, event, transformed):
if ResizableThought.handle_motion(self, event, transformed):
self.recalc_edges()
return True
@@ -814,8 +784,7 @@ class TextThought (ResizableThought):
return False
- def export (self, context, move_x, move_y):
- logging.debug("Metodo: export")
+ def export (self, context, move_x, move_y):
utils.export_thought_outline (context, self.ul, self.lr, self.background_color, self.am_selected, self.am_primary, utils.STYLE_NORMAL,
(move_x, move_y))
@@ -898,8 +867,7 @@ class TextThought (ResizableThought):
if not it.next():
break
- def rebuild_byte_table (self):
- logging.debug("Metodo: rebuild_byte_table")
+ def rebuild_byte_table (self):
# Build the Byte table
del self.bytes
self.bytes = ''
@@ -1000,8 +968,7 @@ class TextThought (ResizableThought):
self.bindex = self.bindex_from_index (self.index)
self.emit ("update_view")
- def delete_surroundings(self, imcontext, offset, n_chars, mode):
- logging.debug("Metodo: delete_surroundings")
+ def delete_surroundings(self, imcontext, offset, n_chars, mode):
# TODO: Add in Attr stuff
orig = len(self.text)
left = self.text[:offset]
@@ -1070,16 +1037,14 @@ class TextThought (ResizableThought):
self.bindex = self.bindex_from_index (self.index)
self.emit ("update_view")
- def preedit_changed (self, imcontext, mode):
- logging.debug("Metodo: preedit_changed")
+ def preedit_changed (self, imcontext, mode):
self.preedit = imcontext.get_preedit_string ()
if self.preedit[0] == '':
self.preedit = None
self.recalc_edges ()
self.emit ("update_view")
- def retrieve_surroundings (self, imcontext, mode):
- logging.debug("Metodo: retrieve_surroundings")
+ def retrieve_surroundings (self, imcontext, mode):
imcontext.set_surrounding (self.text, -1, self.bindex)
return True
@@ -1107,8 +1072,7 @@ class TextThought (ResizableThought):
self.emit("update_view")
self.undo.unblock()
- def create_attribute(self, attribute, start, end):
- logging.debug("Metodo: create_attribute, atributo %s para lo indice: %s,%s", str(attribute), str(start), str(end))
+ def create_attribute(self, attribute, start, end):
if attribute == 'bold':
return pango.AttrWeight(pango.WEIGHT_BOLD, start, end)
elif attribute == 'italic':
@@ -1116,8 +1080,7 @@ class TextThought (ResizableThought):
elif attribute == 'underline':
return pango.AttrUnderline(pango.UNDERLINE_SINGLE, start, end)
- def set_attribute(self, active, attribute):
- logging.debug("Metodo: set_attribute")
+ def set_attribute(self, active, attribute):
if not self.editing:
return
@@ -1186,18 +1149,15 @@ class TextThought (ResizableThought):
old_attrs,
self.attributes.copy()))
else:
- if index == end_index:
- logging.debug("Los indices son iguales")
+ if index == end_index:
attr = self.create_attribute(attribute, index, end_index)
self.undo.add_undo(UndoManager.UndoAction(self, UNDO_ADD_ATTR,
self.undo_attr_cb,
attr))
self.current_attrs.append(attr)
#self.attributes.insert(attr)
- else:
- logging.debug("Los indices no son iguales")
- attr = self.create_attribute(attribute, init, end)
- logging.debug("Cree el atributo: %s para los indices (%s,%s)", str(attribute), str(init), str(end))
+ else:
+ attr = self.create_attribute(attribute, init, end)
old_attrs = self.attributes.copy()
self.attributes.change(attr)
self.undo.add_undo(UndoManager.UndoAction(self, UNDO_ADD_ATTR_SELECTION,
@@ -1206,46 +1166,33 @@ class TextThought (ResizableThought):
self.attributes.copy()))
self.recalc_edges()
- def set_bold (self, active):
- logging.debug("Metodo: set_bold")
+ def set_bold (self, active):
self.set_attribute(active, 'bold')
- def set_italics (self, active):
- logging.debug("Metodo: set_italics")
+ def set_italics (self, active):
self.set_attribute(active, 'italic')
- def set_underline (self, active):
- logging.debug("Metodo: set_underline")
+ def set_underline (self, active):
self.set_attribute(active, 'underline')
- def set_font (self, font_name, font_size):
- logging.debug("Metodo: set_font")
-
+ def set_font (self, font_name, font_size):
if not self.editing:
return
+
start = min(self.index, self.end_index)
end = max(self.index, self.end_index)
-
- #logging.debug("Index s: %s, e: %s", str(self.index), str(self.end_index))
- logging.debug("Fuente %s", str(font_name))
-
- pango_font = pango.FontDescription(font_name+" "+font_size)
-
- logging.debug("Fuente dp del FontDescription: %s", pango_font.to_string())
+
+ pango_font = pango.FontDescription(font_name+" "+font_size)
attr = pango.AttrFontDesc (pango_font, start, end)
-
- logging.debug("Info Fuente desc: %s, si: %s, ei: %s", str(attr.desc), str(attr.start_index), str(attr.end_index))
if start == end:
self.undo.add_undo(UndoManager.UndoAction(self, UNDO_ADD_ATTR,
self.undo_attr_cb,
attr))
- try:
- logging.debug("Voy a usar un metodo que no existe para este tipo de objeto, veremos que sale!")
+ try:
self.current_attrs.change(attr)
- except AttributeError:
- logging.debug("Como evidentemente el metodo no existia, voy a usar append")
+ except AttributeError:
self.current_attrs.append(attr)
else:
old_attrs = self.attributes.copy()
@@ -1256,22 +1203,19 @@ class TextThought (ResizableThought):
self.attributes.copy()))
self.recalc_edges()
- def inside(self, inside):
- logging.debug("Metodo: inside")
+ def inside(self, inside):
if self.editing:
self.emit ("change_mouse_cursor", gtk.gdk.XTERM)
else:
ResizableThought.inside(self, inside)
- def enter(self):
- logging.debug("Metodo: enter")
+ def enter(self):
if self.editing:
return
self.orig_text = self.text
self.editing = True
- def leave(self):
- logging.debug("Metodo: leave")
+ def leave(self):
if not self.editing:
return
ResizableThought.leave(self)