Пример #1
0
 def start(self):
     self.set_border_width(self.border_width)
     
     try:
         self.news_icon = GdkPixbuf.Pixbuf.new_from_file(join('img', self.NEWS_ICON))
     except:
         self.news_icon = GdkPixbuf.Pixbuf.new_from_file(join(file_path, 'img', self.NEWS_ICON))
     
     self.news_icon = self.news_icon.scale_simple(32, 32, GdkPixbuf.InterpType.BILINEAR)
     
     self.news_image = Gtk.Image()
     self.news_image.set_from_pixbuf(self.news_icon)
     
     self.label = Gtk.Label()
     self.label.set_justify(Gtk.Justification.LEFT) 
     self.label.set_markup('<span color="{0}">{1}</span>'.format('#ffffff', 'Novedades'))
     self.label.set_selectable(False)
     self.label.set_margin_bottom(15)
             
     from freestation.widgets.BrowserView import BrowserView
     self.browser_view_widget = BrowserView(None)
     self.browser_view_widget.load('http://youdomain.com/news.php')
     
     self.hbox = Gtk.Box(orientation = Gtk.Orientation.HORIZONTAL, spacing = 0)
     self.hbox.pack_start(self.news_image, expand = False, fill = False, padding = 0)
     self.hbox.pack_start(self.label, expand = False, fill = False, padding = 0)
     
     self.pack_start(self.hbox, expand = False, fill = False, padding = 5)
     self.pack_start(self.browser_view_widget, expand = False, fill = False, padding = 0)
Пример #2
0
class NewsInfo(Gtk.Box):
    __gtype_name__ = 'NewsInfo'
    __name__       = 'NewsInfo'
    
    DEFAULT_BORDER_WIDTH = 25
    DEFAULT_WIDTH  = 200
    DEFAULT_HEIGHT = 200
    DEFAULT_BACKGROUND = '#acacac'
    NEWS_ICON = 'news_icon.png'
    
    def __init__(self, data = None):
        Gtk.Box.__init__(self, orientation = Gtk.Orientation.VERTICAL, spacing = 0)
        
        self.border_width = self.DEFAULT_BORDER_WIDTH
        self.width  = self.DEFAULT_WIDTH
        self.height = self.DEFAULT_HEIGHT
        self.background = self.DEFAULT_BACKGROUND
    
    def set_properties(self, properties):
        #print properties
        
        for (key, value) in properties:
            if key == 'position':
                self.position = value
            elif key == 'width':
                self.width = value
            elif key == 'height':
                self.height = value
            elif key == 'border_width':
                self.border_width = value
            elif key == 'data':
                self.data = value
                
    def start(self):
        self.set_border_width(self.border_width)
        
        try:
            self.news_icon = GdkPixbuf.Pixbuf.new_from_file(join('img', self.NEWS_ICON))
        except:
            self.news_icon = GdkPixbuf.Pixbuf.new_from_file(join(file_path, 'img', self.NEWS_ICON))
        
        self.news_icon = self.news_icon.scale_simple(32, 32, GdkPixbuf.InterpType.BILINEAR)
        
        self.news_image = Gtk.Image()
        self.news_image.set_from_pixbuf(self.news_icon)
        
        self.label = Gtk.Label()
        self.label.set_justify(Gtk.Justification.LEFT) 
        self.label.set_markup('<span color="{0}">{1}</span>'.format('#ffffff', 'Novedades'))
        self.label.set_selectable(False)
        self.label.set_margin_bottom(15)
                
        from freestation.widgets.BrowserView import BrowserView
        self.browser_view_widget = BrowserView(None)
        self.browser_view_widget.load('http://youdomain.com/news.php')
        
        self.hbox = Gtk.Box(orientation = Gtk.Orientation.HORIZONTAL, spacing = 0)
        self.hbox.pack_start(self.news_image, expand = False, fill = False, padding = 0)
        self.hbox.pack_start(self.label, expand = False, fill = False, padding = 0)
        
        self.pack_start(self.hbox, expand = False, fill = False, padding = 5)
        self.pack_start(self.browser_view_widget, expand = False, fill = False, padding = 0)