Ejemplo n.º 1
0
    def __init__(self, *args, **kwargs):
        super(ResultsView, self).__init__(*args, **kwargs)

        self.__query = ''
        
        ## model columns are
        ## 0 = SearchResult
        ## 1 = icon
        ## 2 = title + detail markup
        ## 3 = heading
        ## 4 = sort key, 0 for a heading, 1 for a non-heading
        
        self.__store = gtk.TreeStore(object, object, str, str, int, str)
        
        self.__view = gtk.TreeView(self.__store)
        self.__view.set_headers_visible(False)
        
        self.__tm = ThemeManager.getInstance()
        
        self.__icon_size = 24
        self.__view.insert_column_with_data_func(-1, '',
                                                 ThemedPixbufRenderer(),
                                                 self.__render_icon)
        column = gtk.TreeViewColumn('Result')
        
        renderer = ThemedTextRenderer()
        renderer.set_property('ellipsize', pango.ELLIPSIZE_END)
        column.pack_start(renderer)
        #column.set_attributes(renderer, markup=2)
        column.set_cell_data_func(renderer, self.__cell_data_method)
        
        self.__view.append_column(column)

        ## BROWSE means don't let user select nothing (as with SINGLE)
        self.__view.get_selection().set_mode(gtk.SELECTION_BROWSE)
        self.__view.get_selection().connect('changed', self.__on_selection_changed)
        self.__view.connect('row-activated', self.__on_row_activated)

        self.__added_headings = set()

        self.__last_selected_path = None
Ejemplo n.º 2
0
    def __init__(self, bus_name):
        dbus.service.Object.__init__(self, bus_name, '/bigboard/panel')
          
        _logger.info("constructing")
                
        self.__popped_out = False
        self.__shell = None
        
        gconf_client = gconf.client_get_default()
        self._dw = Sidebar(GCONF_PREFIX + 'visible')
        gconf_client.notify_add(GCONF_PREFIX + 'orientation', self.__sync_orient)        
        self.__sync_orient()            

        self.__keybinding = gconf_client.get_string('/apps/bigboard/focus_key')
        if self.__keybinding:
            bigboard.keybinder.tomboy_keybinder_bind(self.__keybinding, self.__on_focus)
    
        self.__autohide_id = 0
        
        self._exchanges = {} ## metainfo.srcurl to Exchange

        self._canvas = canvas = hippo.Canvas()
        self._dw.get_content().add(self._canvas)
        cwin = self._dw
        self.__compositing = gtk.gdk.display_get_default().supports_composite()
        _logger.debug("compositing: %s", self.__compositing)
#            screen = cwin.get_screen()
#            rgba = screen.get_rgba_colormap()
#            cwin.set_colormap(rgba)
#            cwin.set_app_paintable(True)
#            def fitty_opacity(w, e):
#                ctx = w.window.cairo_create()
#                ctx.set_source_pixmap(canvas.window, canvas.allocation.x, canvas.allocation.y)
#                region = gtk.gdk.region_rectangle(canvas.allocation)
#                region.intersect(gtk.gdk.region_rectangle(e.area))
#                print >>sys.stderr, "e: %s" % (region,)            
#                ctx.region(region)
#                ctx.clip()
#            
#                ctx.set_operator(cairo.OPERATOR_OVER)
#                ctx.paint_with_alpha(0.5)
#            cwin.connect_after('expose-event', fitty_opacity)
#            cwin.realize()
#            cwin.window.set_composited(True)
        
        self._main_box = hippo.CanvasBox(border_right=1, border_color=0x999999FF, padding_bottom=4)
        self._canvas.set_root(self._main_box)
     
        self._header_box = Header()
        self._header_box.connect("button-press-event", self.__on_header_buttonpress)             

        self.__unpopout_button = Button(label='Hide', label_ypadding=-2)
        self.__unpopout_button.set_property('yalign', hippo.ALIGNMENT_CENTER)
        self.__unpopout_button.connect("activated", lambda button: self.__do_unpopout())
        self._header_box.append(self.__unpopout_button, hippo.PACK_END)
     
        self._title = ThemedText(text="My Desktop", font="Bold 14px", xalign=hippo.ALIGNMENT_START, padding_left=8)
     
        self._header_box.append(self._title, hippo.PACK_EXPAND)
        
        self._size_button = None
        
        self._main_box.append(self._header_box)
        
        self._stocks_box = hippo.CanvasBox(spacing=4)
        
        self._main_box.append(self._stocks_box)
        
        self.__theme_mgr = ThemeManager.getInstance()
        self.__theme_mgr.connect('theme-changed', self.__sync_theme)
        self.__sync_theme()    
  
        gconf_client.notify_add(GCONF_PREFIX + 'expand', self._sync_size)
        self._sync_size()
        
        try:
            self.__screensaver_proxy = dbus.SessionBus().get_object('org.gnome.ScreenSaver', '/org/gnome/ScreenSaver')
            self.__screensaver_proxy.connect_to_signal('SessionIdleChanged',
                                                       self.__on_session_idle_changed)
        except dbus.DBusException, e:
            _logger.warn("Couldn't find screensaver")
            pass
Ejemplo n.º 3
0
 def __init__(self, *args, **kwargs):
     gtk.CellRendererPixbuf.__init__(self, *args, **kwargs)
     self.__tm = ThemeManager.getInstance()
     self.__themed = False