Changeset 1107

Show
Ignore:
Timestamp:
12/14/06 05:43:13 (2 years ago)
Author:
arjanmol
Message:

converted (most) print statements to logging statements.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • gaphas/trunk/gaphas/canvas.py

    r1075 r1107  
    1111    pygtk.require('2.0') 
    1212 
     13import logging 
    1314from gaphas import tree 
    1415from gaphas import solver 
     
    348349                    item.pre_update(c) 
    349350                except Exception, e: 
    350                     print 'Error while updating item %s' % item 
    351                     import traceback 
    352                     traceback.print_exc() 
     351                    logging.error('Error while updating item %s', item, exc_info=e) 
    353352 
    354353            self.update_matrices() 
     
    371370                    item.update(c) 
    372371                except Exception, e: 
    373                     print 'Error while updating item %s' % item 
    374                     import traceback 
    375                     traceback.print_exc() 
     372                    logging.error('Error while updating item %s', item, exc_info=e) 
    376373 
    377374        finally: 
  • gaphas/trunk/gaphas/constraint.py

    r1045 r1107  
    2525__version__ = "$Revision$" 
    2626# $HeadURL$ 
     27 
     28import logging 
     29 
    2730 
    2831class Constraint(object): 
     
    222225                close_flag = False 
    223226            if n > ITERLIMIT: 
    224                 print "Failed to converge; exceeded iteration limit" 
     227                logging.warn("Failed to converge; exceeded iteration limit") 
    225228                break 
    226229            slope = (fx1 - fx0) / (x1 - x0) 
     
    229232                    break 
    230233                else: 
    231                     print 'Zero slope and not close enough to solution' 
     234                    logging.warn('Zero slope and not close enough to solution') 
    232235                    break 
    233236            x2 = x0 - fx0 / slope           # New 'x1' 
  • gaphas/trunk/gaphas/decorators.py

    r949 r1107  
    8787            elif not self.single: 
    8888                def async_wrapper(): 
    89                     if DEBUG_ASYNC: print 'async:', func, args, kwargs 
     89                    #if DEBUG_ASYNC: print 'async:', func, args, kwargs 
    9090                    func(*args, **kwargs) 
    9191                gobject.idle_add(async_wrapper, priority=self.priority) 
     
    9898                except AttributeError, e: 
    9999                    def async_wrapper(): 
    100                         if DEBUG_ASYNC: print 'async:', func, args, kwargs 
     100                        #if DEBUG_ASYNC: print 'async:', func, args, kwargs 
    101101                        try: 
    102102                            func(*args, **kwargs) 
  • gaphas/trunk/gaphas/tool.py

    r1092 r1107  
    5959                on_button_release 
    6060        """ 
    61         if DEBUG_TOOL: print 'on_button_press', context, event 
     61        #if DEBUG_TOOL: print 'on_button_press', context, event 
    6262 
    6363    def on_button_release(self, context, event): 
     
    6565        Not that double and tripple clicks'... 
    6666        """ 
    67         if DEBUG_TOOL: print 'on_button_release', context, event 
     67        #if DEBUG_TOOL: print 'on_button_release', context, event 
    6868        pass 
    6969 
     
    7272        on the View. 
    7373        """ 
    74         if DEBUG_TOOL: print 'on_double_click', context, event 
     74        #if DEBUG_TOOL: print 'on_double_click', context, event 
    7575        pass 
    7676 
     
    7979        on the View. 
    8080        """ 
    81         if DEBUG_TOOL: print 'on_triple_click', context, event 
     81        #if DEBUG_TOOL: print 'on_triple_click', context, event 
    8282        pass 
    8383 
     
    8585        """Mouse (pointer) is moved. 
    8686        """ 
    87         if DEBUG_TOOL: print 'on_motion_notify', context, event 
     87        #if DEBUG_TOOL: print 'on_motion_notify', context, event 
    8888        pass 
    8989 
     
    9191        """Keyboard key is pressed. 
    9292        """ 
    93         if DEBUG_TOOL: print 'on_key_press', context, event 
     93        #if DEBUG_TOOL: print 'on_key_press', context, event 
    9494        pass 
    9595 
     
    9797        """Keyboard key is released again (follows a key press normally). 
    9898        """ 
    99         if DEBUG_TOOL: print 'on_key_release', context, event 
     99        #if DEBUG_TOOL: print 'on_key_release', context, event 
    100100        pass 
    101101 
     
    159159    def grab(self, tool): 
    160160        if not self._grabbed_tool: 
    161             if DEBUG_TOOL_CHAIN: print 'Grab tool', tool 
     161            #if DEBUG_TOOL_CHAIN: print 'Grab tool', tool 
    162162            self._grabbed_tool = tool 
    163163 
    164164    def ungrab(self, tool): 
    165165        if self._grabbed_tool is tool: 
    166             if DEBUG_TOOL_CHAIN: print 'UNgrab tool', self._grabbed_tool 
     166            #if DEBUG_TOOL_CHAIN: print 'UNgrab tool', self._grabbed_tool 
    167167            self._grabbed_tool = None 
    168168 
     
    177177        else: 
    178178            for tool in self._tools: 
    179                 if DEBUG_TOOL_CHAIN: print 'tool', tool 
     179                #if DEBUG_TOOL_CHAIN: print 'tool', tool 
    180180                context.set_tool(tool) 
    181181                rt = getattr(tool, func)(context, event) 
     
    574574    def _on_key_press_event(self, widget, event, buffer): 
    575575        if event.keyval == gtk.keysyms.Return: 
    576             print 'Enter!' 
     576            #print 'Enter!' 
    577577            #widget.get_toplevel().destroy() 
    578578        elif event.keyval == gtk.keysyms.Escape: 
    579             print 'Escape!' 
     579            #print 'Escape!' 
    580580            widget.get_toplevel().destroy() 
    581581 
    582582    def _on_focus_out_event(self, widget, event, buffer): 
    583         print 'focus out!', buffer.get_text(buffer.get_start_iter(), buffer.get_end_iter()) 
     583        #print 'focus out!', buffer.get_text(buffer.get_start_iter(), buffer.get_end_iter()) 
    584584        widget.destroy() 
    585585 
  • gaphas/trunk/gaphas/util.py

    r1103 r1107  
    7878    #cr.move_to(x, y) 
    7979    for line in text.split('\n'): 
    80         print 'line', line 
     80        #print 'line', line 
    8181        x_bear, y_bear, w, h, x_adv, y_adv = cr.text_extents(line) 
    8282        cr.move_to(x, y)