Changeset 1248

Show
Ignore:
Timestamp:
08/04/07 16:48:16 (6 years ago)
Author:
ggpolo
Message:

TLGraph stops its drawing timers now, if the widget is destroyed before completing drawings, before, the TLGraph daddy had to do this.

Location:
branch/ggpolo/umitInventory
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • branch/ggpolo/umitInventory/TLChangesTree.py

    r1246 r1248  
    120120        self.datagrabber.use_dict_cursor() 
    121121        for key in categories.keys(): 
     122            if not range_start or not range_end: 
     123                data[key] = { } 
     124                continue 
     125 
    122126            chgs = self.datagrabber.timerange_changes_data_generic(range_start, 
    123127                                                               range_end, key, 
  • branch/ggpolo/umitInventory/TLGraph.py

    r1231 r1248  
    148148         
    149149        gtk.Widget.__init__(self) 
     150 
     151        self.dontdraw = False 
    150152 
    151153        # connector 
     
    493495            self.connector.emit('selection-changed', self.selection) 
    494496         
    495          
     497        
     498    def get_cairo_context(self): 
     499        """ 
     500        Try to return a cairo context. 
     501        """ 
     502        try: 
     503            cr = self.window.cairo_create() 
     504            return cr 
     505 
     506        except cairo.Error: 
     507            # widget is being destroyed (probably) 
     508            self.dontdraw = True 
     509 
     510 
    496511    def _calculate_border_reserved(self): 
    497512        """ 
    498513        Calculate space needed to write labels. 
    499514        """ 
    500         cr = self.window.cairo_create() 
     515        #cr = self.window.cairo_create() 
     516        cr = self.get_cairo_context() 
     517 
     518        if not cr: 
     519            return 
     520 
    501521        if self.graph_label or self.descr_label: 
    502522            t = True and self.graph_label or self.descr_label 
     
    915935        This method handles graph animation effect. 
    916936        """ 
     937        if self.dontdraw: 
     938            # entered here but it was configured to not draw anything,  
     939            # stop timer then 
     940            return False 
     941 
    917942        # check if we completed a line segment 
    918943        if self.painting_piece == self.divisors: 
     
    930955                self.cur_point_indx = 0 
    931956 
    932         cr = self.window.cairo_create() 
     957        cr = self.get_cairo_context() 
     958        if not cr: 
     959            # stop timer, widget is being destroyed (probably) 
     960            return False 
    933961 
    934962        ret = self._draw_by_piece(cr) 
     
    936964        # check if we are done 
    937965        if not ret: 
    938             #print 'Animation completed.' 
    939966            self.startup_animation = False 
    940967            return False 
     
    14001427        Draws graph. 
    14011428        """ 
    1402         cr = self.window.cairo_create() 
     1429        if self.dontdraw: 
     1430            return 
     1431 
     1432        cr = self.get_cairo_context() 
    14031433        cr.rectangle(*event.area) 
    14041434        cr.clip() 
  • branch/ggpolo/umitInventory/Viewer.py

    r1246 r1248  
    740740        Do necessary cleanup before destroying window. 
    741741        """ 
    742         if self.timeline.graph.startup_animation: # drawing is going on 
    743             # stop timer 
    744             gobject.source_remove(self.timeline.graph.anim_timer) 
    745  
    746742        # remove tip timer if still running 
    747743        if self.tip_timer != -1: