Changeset 3054

Show
Ignore:
Timestamp:
06/29/08 09:24:27 (5 years ago)
Author:
luis
Message:

Added tooltip with timeout

Location:
branch/PreferencesWindow/umitPreferences
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • branch/PreferencesWindow/umitPreferences/PreviewWindow.py

    r3053 r3054  
    2323import gobject 
    2424import cairo 
     25import pango 
    2526 
    2627 
     
    4142- Hide ToolBar 
    4243- Hide ListPorts 
    43 - Hide Nmap Results 
     441- Hide Nmap Results 
    4445 
    4546""" 
     
    5354        """ Constructor of Preview Widget """ 
    5455        gtk.EventBox.__init__(self) 
    55          
    56         self.box = gtk.VBox() 
    57         self.add(self.box) 
     56        self.__text_color = True  
     57        
    5858         
    5959         
     
    7070        y = alloc.y 
    7171        height = alloc.height 
     72        height = height-height/10 
    7273        width = alloc.width 
    7374         
     
    140141         
    141142        # Up Horizontal line 
    142         cr.move_to(w_tmp, h_tmp_up-height/25) 
     143        cr.move_to(w_tmp+width/30, h_tmp_up-height/25) 
    143144        cr.line_to(w_tmp+width/7, h_tmp_up-height/25) 
    144145         
    145          
    146          
    147146        cr.stroke() 
     147        self.draw_text(cr,w_tmp, h_tmp_down, width, height) 
     148 
     149         
     150         
     151         
     152         
     153    def change_color(self, cr, w, h): 
     154        try: 
     155            cr.rectangle(0, h-h/30, w, h) 
     156            cr.set_source_rgba(0.8,0.8,0.8,0.8) 
     157            cr.fill() 
     158            cr.move_to(0, h-h/30) 
     159            self.__text_color = not self.__text_color 
     160            if (self.__text_color): 
     161                cr.set_source_rgb(0,0.3,1) 
     162            else: 
     163                cr.set_source_rgb(1,1.0,1) 
     164            self._layout.context_changed() 
     165            cr.update_layout(self._layout)     
     166            cr.show_layout(self._layout) 
     167            return True 
     168        except cairo.Error, e: 
     169            return False 
     170            print e 
     171            pass 
     172         
     173         
     174                 
     175         
     176    def draw_text(self, cr, w_tmp, h_tmp_down, width, height): 
     177        ############# Text ################## 
     178        print "draw text" 
     179         
     180        cr.set_source_rgba(0,0.3,1,0.5) 
     181         
     182         
     183        cr.move_to(w_tmp+width/30, h_tmp_down+height/30) 
     184        self._layout = self.create_pango_layout('General') 
     185        self._layout.set_font_description(pango.FontDescription(\ 
     186            "Sans Serif 16")) 
     187        cr.update_layout(self._layout)     
     188        cr.show_layout(self._layout) 
     189        gobject.timeout_add(300, self.change_color, cr, width, height) 
     190         
     191        self.change_color(cr, width, height) 
    148192         
    149193    def press_toolbar(self): 
     
    152196        """ 
    153197 
    154      
     198        # Get sizes and allocate 
     199        alloc = self.allocation  
     200        x = alloc.x 
     201        y = alloc.y 
     202        height = alloc.height 
     203        width = alloc.width 
     204            
    155205    def press_nmap_results(self): 
    156206        """ 
    157207        Verify if nmap results was pressed 
    158208        """ 
    159          
    160          
    161      
     209        # Get sizes and allocate 
     210        alloc = self.allocation  
     211        x = alloc.x 
     212        y = alloc.y 
     213        height = alloc.height 
     214        width = alloc.width 
     215        
     216        
    162217    def do_button_press_event(self, event): 
    163218        print "press" 
  • branch/PreferencesWindow/umitPreferences/TabsWidget.py

    r3048 r3054  
    140140 
    141141 
     142#### Should be replace IconView implementation #### 
     143""" 
     144 
     145TabWidget is a widget similar like tabs of firefox 
     146 
     147Depends: cairo 
     148 
     149""" 
     150class TabWidget(gtk.EventBox): 
     151    def __init__(self): 
     152        pass 
     153     
     154 
     155         
     156         
     157