Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- # -*- coding: utf-8 -*-
- '''
- * Copyright 2010 Georgios Migdos <cyberpython@gmail.com>
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- *
- '''
- import sys
- import time
- import threading
- import tempfile
- import os
- import webbrowser
- from xml.dom.minidom import parse
- import urllib2
- import socket
- import pygtk
- pygtk.require('2.0')
- import gtk
- from gtk import gdk
- import gobject
- import pango
- import cairo
- import webkit
- class feedRetriever:
- def __init__(self, configuration):
- self.feeds = []
- self.rssItems = {}
- self.configuration = configuration
- def addFeed(self, feedTitle, feedUrl):
- feed = (feedTitle, feedUrl)
- self.feeds.append(feed)
- def setFeed(self, feedTitle, feedUrl):
- self.feeds = []
- if(feed!=None):
- feed = (feedTitle, feedUrl)
- self.feeds.append(feed)
- def setFeed(self, feed):
- self.feeds = []
- if(feed!=None):
- self.feeds.append(feed)
- def getRssItems(self):
- return self.rssItems
- def update(self):
- error = False
- self.rssItems = {}
- for feed in self.feeds:
- try:
- feedUrl = feed[1]
- feedTitle = feed[0]
- socket.setdefaulttimeout(5)
- feedXML = urllib2.urlopen(feedUrl)
- self.parseXML(feedTitle, feedXML)
- feedXML.close()
- except urllib2.URLError:
- error = True
- break
- if(error):
- print "Error retrieving RSS feed: ", feedUrl
- return self.getErrorMessage(feedUrl)
- return self.getContent()
- def parseXML(self, feedTitle, rssXML):
- dom = parse(rssXML)
- for item in dom.getElementsByTagName('item'):
- title = ""
- description = ""
- link = ""
- for rssTitle in item.getElementsByTagName('title'):
- if(len(rssTitle.childNodes)>0):
- title = rssTitle.childNodes[0].nodeValue
- for rssDescription in item.getElementsByTagName('description'):
- if(len(rssDescription.childNodes)>0):
- description = rssDescription.childNodes[0].nodeValue
- for rssLink in item.getElementsByTagName('link'):
- if(len(rssLink.childNodes)>0):
- link = rssLink.childNodes[0].nodeValue
- rssItem = (title, description, link)
- try:
- items = self.rssItems[feedTitle]
- items.append(rssItem)
- except KeyError:
- self.rssItems[feedTitle] = []
- self.rssItems[feedTitle].append(rssItem)
- def getErrorMessage(self, feedUrl):
- data = '''<html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
- <title>RssWidget</title>
- <style type="text/css">
- body{
- background-color: '''+self.configuration.getBackgroundColor()+''';
- color: '''+self.configuration.getTextColor()+''';
- font-size: 10px;
- }
- </style>
- </head>
- <body>
- <span style="'''+self.configuration.getTextColor()+'''; font-weight: bold;">''' + feedUrl + ''':</span><br>
- An error occured while loading the feed contents...
- </body>
- </html>'''
- return data
- def getContent(self):
- data = '''<html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
- <title>RssWidget</title>
- <style type="text/css">
- body{
- background-color: '''+self.configuration.getBackgroundColor()+''';
- color: '''+self.configuration.getTextColor()+''';
- font-size: 10px;
- }
- a{
- color: '''+self.configuration.getTextColor()+''';
- font-size: 10px;
- text-decoration: underline;
- }
- a:hover{
- color: '''+self.configuration.getTextHoverColor()+''';
- }
- a.heading{
- color: '''+self.configuration.getTextColor()+''';
- font-size: 10px;
- text-decoration: underline;
- font-weight: bold;
- }
- a.heading:hover{
- color: '''+self.configuration.getTextHoverColor()+''';
- }
- li{
- padding-top: 5px;
- }
- div.main_container{
- position:absolute;
- top: 40px;
- bottom: 5px;
- left: 5px;
- right: 5px;
- overflow-y: auto;
- overflow-x: hidden;
- }
- div.rss_content{
- width: 90%;
- font-size: 10px;
- }
- h2{
- text-decoration: none;
- font-weight: bold;
- font-size: 12px;
- }
- </style>
- </head>
- <body>
- <div class="main_container">
- <div class="rss_content">\n'''
- items = self.getRssItems()
- for feedTitle,rssItems in items.iteritems():
- data = data + "<h2 style='position:fixed; top: 10px; left: 10px;'> "+feedTitle+"</h2>\n<ul>"
- for item in rssItems:
- data = data + "\t\t\t<li>\n\t\t\t\t<a class='heading' href='"+ item[2] +"'> "+ item[0] +"</a>\n\t\t\t\t" + item[1] + "\n\t\t\t</li>\n"
- data = data + "</ul>"
- data = data + '''\t\t</div>
- </div>
- </body>
- </html>'''
- return data
- class Updater(threading.Thread):
- def __init__(self, app, interval):
- self.interval = interval
- self.counter = self.interval
- self.app = app
- self.halt = False
- threading.Thread.__init__(self)
- def run(self):
- self.halt = False
- while(not self.halt):
- while(self.counter>0):
- if(self.halt):
- break;
- time.sleep(1)
- self.counter = self.counter - 1
- if(self.halt):
- break;
- self.app.updateContent()
- self.counter = self.interval;
- def stop(self):
- self.halt = True
- def reset(self):
- self.counter = 0
- def setInterval(self, interval):
- self.interval = interval
- class RssWidget:
- def __init__(self):
- self.configuration = ConfigOptions()
- self.configuration.loadFromFile()
- self.window_width = self.configuration.getWindowWidth()
- self.window_height = self.configuration.getWindowHeight()
- self.window_left = self.configuration.getWindowLeft()
- self.window_top = self.configuration.getWindowTop()
- self.background_color = HTMLColorToRGB(self.configuration.getBackgroundColor())
- self.background_opacity = self.configuration.getBackgroundOpacity()
- self.label_text_color = self.configuration.getTextColor()
- self.label_text_hover_color = self.configuration.getTextHoverColor()
- self.update_interval = self.configuration.getUpdateInterval()
- self.border_size = 20
- self.vgap = 5
- self.label_width = 50
- self.label_height = 25
- self.renderer_height = self.window_height - 2 * self.border_size - self.vgap - self.label_height
- self.tmp_file = tempfile.mkstemp()[1]
- self.updater = Updater(self, self.update_interval)
- self.createWindow()
- self.createOptionsWindow()
- self.updater.reset()
- self.updater.start()
- def createWindow(self):
- self.win = gtk.Window()
- screen = self.win.get_screen();
- self.win.set_title('RSS-Thingy')
- self.win.set_default_size(self.window_width, self.window_height) #Window Size
- self.win.move(self.window_left,self.window_top) #Start position
- self.win.stick() #All desktops
- self.win.set_keep_below(True) #Keep the window below the others
- self.win.set_decorated(False) #No Decoration
- self.win.set_skip_taskbar_hint(True)
- self.win.set_skip_pager_hint(True)
- self.win.connect('delete-event', gtk.main_quit)
- self.win.set_app_paintable(True)
- self.win.connect('expose-event', self.expose)
- self.win.set_colormap(screen.get_rgba_colormap()) #Set Alpha Screen
- self.fixed = gtk.Fixed();
- self.win.add(self.fixed);
- self.cursorHand = gtk.gdk.Cursor(gtk.gdk.HAND2)
- self.retriever = feedRetriever(self.configuration)
- self.createRendererWidget()
- self.createOptionsLabel()
- self.createCloseLabel()
- self.createRefreshLabel()
- self.createFeedSelectionLabel()
- self.win.show_all()
- def createOptionsWindow(self):
- builder = gtk.Builder()
- builder.add_from_string(glade_xml_string)
- self.options_window = builder.get_object("window1")
- self.options_window.set_position(gtk.WIN_POS_CENTER)
- self.options_window.stick()
- self.options_window.connect('delete_event', self.on_options_window_close)
- self.options_add_feed_button = builder.get_object("button1")
- self.options_add_feed_button.connect("clicked", self.on_options_window_add_feed_clicked)
- self.options_remove_feed_button = builder.get_object("button2")
- self.options_remove_feed_button.connect("clicked", self.on_options_window_remove_feed_clicked)
- self.options_ok_button = builder.get_object("button3")
- self.options_ok_button.connect("clicked", self.on_options_window_ok_clicked)
- self.options_cancel_button = builder.get_object("button4")
- self.options_cancel_button.connect("clicked", self.on_options_window_cancel_clicked)
- self.options_adj1 = builder.get_object("adjustment1")
- self.options_adj2 = builder.get_object("adjustment2")
- self.options_adj3 = builder.get_object("adjustment3")
- self.options_adj4 = builder.get_object("adjustment4")
- self.options_adj5 = builder.get_object("adjustment5")
- self.options_adj6 = builder.get_object("adjustment6")
- self.options_clrb1 = builder.get_object("colorbutton1")
- self.options_clrb2 = builder.get_object("colorbutton2")
- self.options_clrb3 = builder.get_object("colorbutton3")
- self.options_treeview1 = builder.get_object("treeview1")
- self.createOptionsFeedsListView()
- def updateOptionsValues(self):
- x, y = self.win.get_position()
- self.configuration.setWindowLeft(x)
- self.configuration.setWindowTop(y)
- self.options_adj1.set_value(self.configuration.getWindowWidth())
- self.options_adj2.set_value(self.configuration.getWindowHeight())
- self.options_adj3.set_value(self.configuration.getWindowLeft())
- self.options_adj4.set_value(self.configuration.getWindowTop())
- self.options_adj5.set_value(int(self.configuration.getBackgroundOpacity()*100))
- self.options_adj6.set_value(self.configuration.getUpdateInterval())
- self.options_clrb1.set_color(gtk.gdk.Color(self.configuration.getBackgroundColor()))
- self.options_clrb2.set_color(gtk.gdk.Color(self.configuration.getTextColor()))
- self.options_clrb3.set_color(gtk.gdk.Color(self.configuration.getTextHoverColor()))
- self.updateOptionsFeedsListView()
- def updateConfigurationValues(self):
- self.configuration.setWindowWidth(int(self.options_adj1.get_value()))
- self.configuration.setWindowHeight(int(self.options_adj2.get_value()))
- self.configuration.setWindowLeft(int(self.options_adj3.get_value()))
- self.configuration.setWindowTop(int(self.options_adj4.get_value()))
- self.configuration.setBackgroundOpacity( self.options_adj5.get_value() / 100.0)
- self.configuration.setUpdateInterval(int(self.options_adj6.get_value()))
- cl1 = self.options_clrb1.get_color()
- cl2 = self.options_clrb2.get_color()
- cl3 = self.options_clrb3.get_color()
- clr1 = RGBToHTMLColor( (cl1.red, cl1.green, cl1.blue) )
- clr2 = RGBToHTMLColor( (cl2.red, cl2.green, cl2.blue) )
- clr3 = RGBToHTMLColor( (cl3.red, cl3.green, cl3.blue) )
- self.configuration.setBackgroundColor(clr1)
- self.configuration.setTextColor(clr2)
- self.configuration.setTextHoverColor(clr3)
- def applyConfiguration(self):
- self.window_width = self.configuration.getWindowWidth()
- self.window_height = self.configuration.getWindowHeight()
- self.window_left = self.configuration.getWindowLeft()
- self.window_top = self.configuration.getWindowTop()
- self.background_color = HTMLColorToRGB(self.configuration.getBackgroundColor())
- self.background_opacity = self.configuration.getBackgroundOpacity()
- self.label_text_color = self.configuration.getTextColor()
- self.label_text_hover_color = self.configuration.getTextHoverColor()
- self.update_interval = self.configuration.getUpdateInterval()
- self.renderer_height = self.window_height - 2 * self.border_size - self.vgap - self.label_height
- self.win.move(self.configuration.getWindowLeft(), self.configuration.getWindowTop())
- self.resize(self.configuration.getWindowWidth(), self.configuration.getWindowHeight())
- self.optionsLabel.set_markup("<span font_weight='bold' color='"+self.label_text_color+"'>Options</span>")
- self.closeLabel.set_markup("<span font_weight='bold' color='"+self.label_text_color+"'>Close</span>")
- self.refreshLabel.set_markup("<span font_weight='bold' color='"+self.label_text_color+"'>Refresh</span>")
- self.feedSelectionLabel.set_markup("<span font_weight='bold' color='"+self.label_text_color+"'>Select feed</span>")
- if(self.updater!=None):
- self.updater.setInterval(self.configuration.getUpdateInterval())
- self.updater.reset()
- def resize(self, w, h):
- self.win.resize(w, h)
- width = self.window_width - 2 * self.border_size
- height = self.window_height - 2 * self.border_size - self.vgap - self.label_height
- self.renderer.set_size_request(width,height)
- self.fixed.move(self.renderer, self.border_size, self.border_size)
- width = self.label_width
- height = self.label_height
- self.options_eventBox.set_size_request(width,self.label_height)
- self.fixed.move(self.options_eventBox, self.border_size, self.border_size+self.renderer_height+self.vgap)
- self.close_eventBox.set_size_request(width,self.label_height)
- self.fixed.move(self.close_eventBox, self.window_width - self.border_size - width, self.border_size+self.renderer_height+self.vgap)
- width = 100
- self.refresh_eventBox.set_size_request(width,self.label_height)
- self.fixed.move(self.refresh_eventBox, (self.window_width - 2*self.border_size) / 2 - 25, self.border_size+self.renderer_height+self.vgap)
- width = 80
- self.feed_eventBox.set_size_request(width,self.label_height)
- self.fixed.move(self.feed_eventBox, self.window_width - self.border_size - width, 0)
- def quit(self):
- gtk.main_quit()
- if(self.updater!=None):
- self.updater.stop()
- os.remove(self.tmp_file)
- x, y = self.win.get_position()
- self.configuration.setWindowLeft(x)
- self.configuration.setWindowTop(y)
- self.configuration.saveToFile()
- def hideOptionsWindow(self):
- self.options_window.hide_all()
- def showOptionsWindow(self):
- self.updateOptionsValues()
- self.options_window.show_all()
- def createOptionsLabel(self):
- width = self.label_width
- height = self.label_height
- self.options_eventBox = gtk.EventBox()
- self.options_eventBox.set_size_request(width,self.label_height)
- self.options_eventBox.set_visible_window(False)
- self.fixed.put(self.options_eventBox, self.border_size, self.border_size+self.renderer_height+self.vgap)
- self.optionsLabel = gtk.Label()
- self.optionsLabel.set_justify(gtk.JUSTIFY_LEFT)
- self.optionsLabel.set_markup("<span font_weight='bold' color='"+self.label_text_color+"'>Options</span>")
- self.options_eventBox.connect("enter-notify-event", self.mouse_enter, self.optionsLabel, "Options")
- self.options_eventBox.connect("leave-notify-event", self.mouse_leave, self.optionsLabel, "Options")
- self.options_eventBox.connect("button-press-event", self.on_options_label_clicked)
- self.options_eventBox.add(self.optionsLabel)
- def createCloseLabel(self):
- width = self.label_width
- height = self.label_height
- self.close_eventBox = gtk.EventBox()
- self.close_eventBox.set_size_request(width,self.label_height)
- self.close_eventBox.set_visible_window(False)
- self.fixed.put(self.close_eventBox, self.window_width - self.border_size - width, self.border_size+self.renderer_height+self.vgap)
- self.closeLabel = gtk.Label()
- self.closeLabel.set_markup("<span font_weight='bold' color='"+self.label_text_color+"'>Close</span>")
- self.closeLabel.set_justify(gtk.JUSTIFY_RIGHT)
- self.close_eventBox.connect("enter-notify-event", self.mouse_enter, self.closeLabel, "Close")
- self.close_eventBox.connect("leave-notify-event", self.mouse_leave, self.closeLabel, "Close")
- self.close_eventBox.connect("button-press-event", self.on_close_label_clicked)
- self.close_eventBox.add(self.closeLabel)
- def createRefreshLabel(self):
- width = 100
- height = self.label_height
- self.refresh_eventBox = gtk.EventBox()
- self.refresh_eventBox.set_size_request(width,self.label_height)
- self.refresh_eventBox.set_visible_window(False)
- self.fixed.put(self.refresh_eventBox, (self.window_width - 2*self.border_size) / 2 - 25, self.border_size+self.renderer_height+self.vgap)
- self.refreshLabel = gtk.Label()
- self.refreshLabel.set_markup("<span font_weight='bold' color='"+self.label_text_color+"'>Refresh</span>")
- self.refreshLabel.set_justify(gtk.JUSTIFY_CENTER)
- self.refresh_eventBox.connect("enter-notify-event", self.mouse_enter, self.refreshLabel, "Refresh")
- self.refresh_eventBox.connect("leave-notify-event", self.mouse_leave, self.refreshLabel, "Refresh")
- self.refresh_eventBox.connect("button-press-event", self.on_refresh_label_clicked)
- self.refresh_eventBox.add(self.refreshLabel)
- def createFeedSelectionLabel(self):
- width = 80
- height = self.label_height
- self.feed_eventBox = gtk.EventBox()
- self.feed_eventBox.set_size_request(width,self.label_height)
- self.feed_eventBox.set_visible_window(False)
- self.fixed.put(self.feed_eventBox, self.window_width - self.border_size - width, 0)
- self.feedSelectionLabel = gtk.Label()
- self.feedSelectionLabel.set_markup("<span font_weight='bold' color='"+self.label_text_color+"'>Select feed</span>")
- self.feedSelectionLabel.set_justify(gtk.JUSTIFY_RIGHT)
- self.feed_eventBox.connect("enter-notify-event", self.mouse_enter, self.feedSelectionLabel, "Select feed")
- self.feed_eventBox.connect("leave-notify-event", self.mouse_leave, self.feedSelectionLabel, "Select feed")
- self.feed_eventBox.connect("button-press-event", self.on_select_label_clicked)
- self.feed_eventBox.add(self.feedSelectionLabel)
- def createFeedsPopupMenu(self, event):
- menu = gtk.Menu()
- feeds = self.configuration.getFeeds()
- for feed in feeds:
- menu_item = gtk.MenuItem(feed[0])
- menu_item.connect("button-press-event", self.on_popupmenu_item_clicked, feed)
- menu.append(menu_item)
- menu_item.show()
- menu.popup(None, None, None, event.button, event.time)
- def createRendererWidget(self):
- width = self.window_width - 2 * self.border_size
- height = self.renderer_height
- self.renderer = webkit.WebView()
- self.renderer.connect("navigation-requested", self._navigation_requested_cb)
- self.renderer.set_size_request(width,height)
- self.fixed.put(self.renderer, self.border_size, self.border_size)
- data = '''<html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
- <title>RssWidget</title>
- <style type="text/css">
- body{
- background-color: '''+self.configuration.getBackgroundColor()+''';
- text-decoration: none;
- color: '''+self.configuration.getTextColor()+''';
- font-size: 10px;
- }
- </style>
- </head>
- <body>'''
- feed = self.configuration.getCurrentFeed()
- if(feed!=None):
- data = data + "\t\t<span style='"+self.configuration.getTextColor()+"; font-size: 12px; font-weight: bold;'>" + self.configuration.getCurrentFeed()[0] + ":</span><br>\n\t\t\tLoading feed contents...\n"
- else:
- data = data + "Click on "Options" to add new RSS feeds and on "Select feed" to select the one to be displayed."
- data = data + "\t</body>\n</html>"
- self.renderer.load_html_string(data.encode('utf-8'), 'file:///')
- def _navigation_requested_cb(self, view, frame, networkRequest):
- # get uri from request object
- uri=networkRequest.get_uri()
- if(uri.startswith("file://")):
- return 0 #use default handler
- elif(uri.startswith('http://') or uri.startswith('https://')):
- webbrowser.open_new(uri)
- return 1
- else:
- return 1
- def updateContent(self):
- rssFeed = self.configuration.getCurrentFeed()
- if(rssFeed!=None):
- self.retriever.setFeed(rssFeed);
- data = self.retriever.update()
- f = open(self.tmp_file, "w")
- f.write(data.encode('utf-8'))
- f.close()
- self.renderer.open("file://"+self.tmp_file)
- def createOptionsFeedsListView(self):
- self.liststore = self.createModel()
- self.options_treeview1.set_model(self.liststore)
- self.createColumns(self.options_treeview1)
- def createModel(self):
- store = gtk.ListStore(str, str)
- return store
- def createColumns(self, treeView):
- rendererText = gtk.CellRendererText()
- column = gtk.TreeViewColumn("Feed Name", rendererText, text=0)
- column.set_sort_column_id(0)
- treeView.append_column(column)
- rendererText = gtk.CellRendererText()
- column = gtk.TreeViewColumn("URL", rendererText, text=1)
- column.set_sort_column_id(1)
- treeView.append_column(column)
- def updateOptionsFeedsListView(self):
- self.liststore.clear()
- for feed in self.configuration.getFeeds():
- self.liststore.append(feed)
- def addRssFeed(self):
- result = self.showAddFeedDialog()
- response = result[0]
- feed = (result[1], result[2])
- if(response == gtk.RESPONSE_OK):
- self.configuration.addFeed(feed)
- self.updateOptionsFeedsListView()
- def removeSelectedFeed(self):
- '''selectedItemIter = self.getSelectedListviewItemIter(self.options_treeview1)
- if(selectedItemIter!=None):
- self.liststore.remove(selectedItemIter)
- self.configuration.addFeed(feed)'''
- selection = self.options_treeview1.get_selection()
- if (selection !=None):
- model, iter = selection.get_selected()
- if iter!=None:
- index = model.get_path(iter)[0]
- self.configuration.removeFeed(index)
- self.updateOptionsFeedsListView()
- def getSelectedListviewItemIter(self, listview):
- treeSelection = listview.get_selection()
- treeIter = treeSelection.get_selected()[1]
- return treeIter
- def showAddFeedDialog(self):
- dialog = gtk.MessageDialog(
- self.options_window,
- gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
- gtk.MESSAGE_QUESTION,
- gtk.BUTTONS_OK_CANCEL,
- None)
- dialog.set_markup('\n<b>Please enter the following RSS feed properties:</b>')
- feed_title_entry = gtk.Entry()
- feed_title_entry.set_text("RSS feed name")
- hbox1 = gtk.HBox()
- hbox1.pack_start(gtk.Label("Name:"))
- hbox1.pack_end(feed_title_entry)
- feed_url_entry = gtk.Entry()
- feed_url_entry.set_text("RSS feed url")
- hbox2 = gtk.HBox()
- hbox2.pack_start(gtk.Label("URL:"))
- hbox2.pack_end(feed_url_entry)
- dialog.vbox.pack_start(hbox1)
- dialog.vbox.pack_start(hbox2)
- dialog.show_all()
- response = dialog.run()
- feed_name = feed_title_entry.get_text()
- feed_url = feed_url_entry.get_text()
- dialog.destroy()
- return (response, feed_name, feed_url)
- def on_options_window_close(self, widget, event):
- self.hideOptionsWindow()
- return True
- def on_popupmenu_item_clicked(self, widget, event, feed):
- self.configuration.setCurrentFeed(feed)
- if(self.updater!=None):
- self.updater.reset()
- def mouse_enter(self, widget, event, label, text):
- label.set_markup("<span font_weight='bold' color='"+self.label_text_hover_color+"'>"+text+"</span>")
- widget.window.set_cursor(self.cursorHand)
- def mouse_leave(self, widget, event, label, text):
- label.set_markup("<span font_weight='bold' color='"+self.label_text_color+"'>"+text+"</span>")
- widget.window.set_cursor(None)
- def on_close_label_clicked(self, widget, event):
- self.quit()
- def on_refresh_label_clicked(self, widget, event):
- if(self.updater!=None):
- self.updater.reset()
- def on_options_label_clicked(self, widget, event):
- self.showOptionsWindow()
- def on_select_label_clicked(self, widget, event):
- self.createFeedsPopupMenu(event)
- def on_options_window_ok_clicked(self, widget):
- self.hideOptionsWindow()
- self.updateConfigurationValues()
- self.applyConfiguration()
- def on_options_window_cancel_clicked(self, widget):
- self.hideOptionsWindow()
- def on_options_window_add_feed_clicked(self, widget):
- self.addRssFeed()
- def on_options_window_remove_feed_clicked(self, widget):
- self.removeSelectedFeed()
- def expose(self, widget, event):
- (width, height) = widget.get_size() #Get window size
- cr = widget.window.cairo_create() #Get a cairo context
- cr.set_source_rgba(1.0, 1.0, 1.0, 0.0) #Make the window transparent
- cr.set_operator(cairo.OPERATOR_SOURCE) #Make the window transparent
- cr.paint() #Make the window transparent
- cr.set_operator(cairo.OPERATOR_OVER);
- self.draw_background(cr,width,height)
- return False
- def draw_background(self,cr,w,h):
- x = 0
- y = 0
- r = 15
- cr.set_operator(cairo.OPERATOR_SOURCE);
- cr.set_source_rgba (self.background_color[0], self.background_color[1], self.background_color[2], self.background_opacity); # Background opacity
- cr.move_to ( x+r,y ) # Move to A
- cr.line_to ( x+w-r,y ) # Straight line to B
- cr.curve_to ( x+w-r,y,x+w,y,x+w,y+r ) # Curve to C
- cr.line_to ( x+w,y+h-r ) # Move to D
- cr.curve_to ( x+w,y+h-r,x+w,y+h,x+w-r,y+h ) # Curve to E
- cr.line_to ( x+r,y+h ) # Line to F
- cr.curve_to ( x+r,y+h,x,y+h,x,y+h-r ) # Curve to G
- cr.line_to ( x,y+r ) # Line to H
- cr.curve_to ( x,y+r,x,y,x+r,y) # Curve to G
- cr.fill ( )
- def main(self):
- gtk.main()
- return True
- class ConfigOptions:
- def __init__(self):
- self.checkForConfigDir()
- self.configFile = os.path.join(self.configPath, "config.xml")
- self.window_width = 640
- self.window_height = 400
- self.window_left = 100
- self.window_top = 100
- self.background_color = "#000000"
- self.background_opacity = 0.75
- self.text_color = "#FFFFFF"
- self.text_hover_color = "#DEFE00"
- self.update_interval = 300
- self.current_feed = None
- self.feeds=[]
- def checkForConfigDir(self):
- tmp_path = os.path.join('~', '.config', 'rssWidget')
- self.configPath = os.path.expanduser(tmp_path)
- if(not os.path.exists(self.configPath)):
- os.makedirs(self.configPath)
- print "Created dir: "+self.configPath
- def getWindowWidth(self):
- return self.window_width
- def setWindowWidth(self, width):
- self.window_width = width
- def getWindowHeight(self):
- return self.window_height
- def setWindowHeight(self, height):
- self.window_height = height
- def getWindowLeft(self):
- return self.window_left
- def setWindowLeft(self, left):
- self.window_left = left
- def getWindowTop(self):
- return self.window_top
- def setWindowTop(self, top):
- self.window_top = top
- def getBackgroundColor(self):
- return self.background_color
- def setBackgroundColor(self, bg):
- self.background_color = bg
- def getBackgroundOpacity(self):
- return self.background_opacity
- def setBackgroundOpacity(self, opacity):
- self.background_opacity = opacity
- def getTextColor(self):
- return self.text_color
- def setTextColor(self, color):
- self.text_color = color
- def getTextHoverColor(self):
- return self.text_hover_color
- def setTextHoverColor(self, color):
- self.text_hover_color = color
- def getUpdateInterval(self):
- return self.update_interval
- def setUpdateInterval(self, interval):
- self.update_interval = interval
- def getCurrentFeed(self):
- return self.current_feed
- def setCurrentFeed(self, feed):
- self.current_feed = feed
- def getFeeds(self):
- return self.feeds
- def addFeed(self, feed):
- self.feeds.append(feed)
- def removeFeed(self, index):
- self.feeds.pop(index)
- def saveToFile(self):
- self.checkForConfigDir()
- data = "<configuration>\n"
- data = data + "\t<window-width>" + str(self.window_width) + "</window-width>\n"
- data = data + "\t" + "<window-height>" + str(self.window_height) + "</window-height>" + "\n"
- data = data + "\t" + "<window-left>" + str(self.window_left) + "</window-left>" + "\n"
- data = data + "\t" + "<window-top>" + str(self.window_top) + "</window-top>" + "\n"
- data = data + "\t" + "<background-color>" + self.background_color + "</background-color>" + "\n"
- data = data + "\t" + "<background-opacity>" + str(self.background_opacity) + "</background-opacity>" + "\n"
- data = data + "\t" + "<text-color>" + self.text_color + "</text-color>" + "\n"
- data = data + "\t" + "<text-hover-color>" + self.text_hover_color + "</text-hover-color>" + "\n"
- data = data + "\t" + "<update-interval>" + str(self.update_interval) + "</update-interval>" + "\n"
- if(self.current_feed!=None):
- data = data + "\t" + "<current-feed>" + "\n"
- data = data + "\t\t" + "<title>" + self.current_feed[0] + "</title>" + "\n"
- data = data + "\t\t" + "<url>" + self.current_feed[1] + "</url>" + "\n"
- data = data + "\t" + "</current-feed>" + "\n"
- for feed in self.feeds:
- data = data + "\t" + "<feed>" + "\n"
- data = data + "\t\t" + "<title>" + feed[0] + "</title>" + "\n"
- data = data + "\t\t" + "<url>" + feed[1] + "</url>" + "\n"
- data = data + "\t" + "</feed>" + "\n"
- data = data + "</configuration>\n"
- f = open(self.configFile, 'w')
- f.write(data.encode('utf-8'))
- f.close()
- def loadFromFile(self):
- if (os.path.exists(self.configFile)):
- f = open(self.configFile, 'r')
- dom = parse(f)
- f.close()
- for item in dom.getElementsByTagName('window-width'):
- if(len(item.childNodes)>0):
- self.window_width = int(item.childNodes[0].nodeValue)
- #print "window-width : ", self.window_width
- for item in dom.getElementsByTagName('window-height'):
- if(len(item.childNodes)>0):
- self.window_height = int(item.childNodes[0].nodeValue)
- #print "window-height : ", self.window_height
- for item in dom.getElementsByTagName('window-left'):
- if(len(item.childNodes)>0):
- self.window_left = int(item.childNodes[0].nodeValue)
- #print "window-left : ", self.window_left
- for item in dom.getElementsByTagName('window-top'):
- if(len(item.childNodes)>0):
- self.window_top = int(item.childNodes[0].nodeValue)
- #print "window-top : ", self.window_top
- for item in dom.getElementsByTagName('background-color'):
- if(len(item.childNodes)>0):
- self.background_color = item.childNodes[0].nodeValue
- #print "background-color : ", self.background_color
- for item in dom.getElementsByTagName('background-opacity'):
- if(len(item.childNodes)>0):
- self.background_opacity = float(item.childNodes[0].nodeValue)
- #print "background-opacity : ", self.background_opacity
- for item in dom.getElementsByTagName('text-color'):
- if(len(item.childNodes)>0):
- self.text_color = item.childNodes[0].nodeValue
- #print "text-color : ", self.text_color
- for item in dom.getElementsByTagName('text-hover-color'):
- if(len(item.childNodes)>0):
- self.text_hover_color = item.childNodes[0].nodeValue
- #print "text-hover-color : ", self.text_hover_color
- for item in dom.getElementsByTagName('update-interval'):
- if(len(item.childNodes)>0):
- self.update_interval = int(item.childNodes[0].nodeValue)
- #print "update-interval : ", self.update_interval
- for item in dom.getElementsByTagName('current-feed'):
- title = ""
- url = ""
- for rssTitle in item.getElementsByTagName('title'):
- if(len(rssTitle.childNodes)>0):
- title = rssTitle.childNodes[0].nodeValue
- for rssUrl in item.getElementsByTagName('url'):
- if(len(rssUrl.childNodes)>0):
- url = rssUrl.childNodes[0].nodeValue
- self.current_feed = (title, url)
- #print "current-feed: ", self.current_feed
- for item in dom.getElementsByTagName('feed'):
- title = ""
- url = ""
- for rssTitle in item.getElementsByTagName('title'):
- if(len(rssTitle.childNodes)>0):
- title = rssTitle.childNodes[0].nodeValue
- for rssUrl in item.getElementsByTagName('url'):
- if(len(rssUrl.childNodes)>0):
- url = rssUrl.childNodes[0].nodeValue
- feedItem = (title, url)
- self.feeds.append(feedItem)
- #print "feeds: ", self.feeds
- def HTMLColorToRGB(colorstring):
- colorstring = colorstring.strip()
- if colorstring[0] == '#':
- colorstring = colorstring[1:]
- if len(colorstring) != 6:
- raise ValueError, "#" + colorstring + "is not in #RRGGBB format"
- r, g, b = colorstring[:2], colorstring[2:4], colorstring[4:]
- r, g, b = [int(n, 16) for n in (r, g, b)]
- return (r, g, b)
- def RGBToHTMLColor(rgb_tuple):
- r = hex(rgb_tuple[0]*255 / 65535)[2:]
- g = hex(rgb_tuple[1]*255 / 65535)[2:]
- b = hex(rgb_tuple[2]*255 / 65535)[2:]
- if(len(r)==1): r = '0'+r
- if(len(g)==1): g = '0'+g
- if(len(b)==1): b = '0'+b
- hexcolor = '#' + r + g + b
- return hexcolor
- def setProcessName(processName):
- #The following has been "borrowed" from exaile :)
- if sys.platform == 'linux2':
- # Set process name. Only works on Linux >= 2.1.57.
- try:
- import ctypes
- libc = ctypes.CDLL('libc.so.6')
- libc.prctl(15, processName, 0, 0, 0)
- except:
- try:
- import dl
- libc = dl.open('/lib/libc.so.6')
- libc.call('prctl', 15, (processName+'\0'), 0, 0, 0) # 15 is PR_SET_NAME
- except:
- pass
- glade_xml_string = '''<?xml version="1.0"?>
- <interface>
- <requires lib="gtk+" version="2.16"/>
- <!-- interface-naming-policy project-wide -->
- <object class="GtkWindow" id="window1">
- <property name="width_request">500</property>
- <property name="height_request">500</property>
- <property name="default_width">500</property>
- <property name="default_height">500</property>
- <child>
- <object class="GtkHBox" id="hbox1">
- <property name="visible">True</property>
- <child>
- <object class="GtkVBox" id="vbox1">
- <property name="visible">True</property>
- <property name="orientation">vertical</property>
- <child>
- <object class="GtkHBox" id="hbox2">
- <property name="visible">True</property>
- <child>
- <object class="GtkLabel" id="label1">
- <property name="visible">True</property>
- <property name="label" translatable="yes"><b>WIndow size:</b></property>
- <property name="use_markup">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkHBox" id="hbox7">
- <property name="visible">True</property>
- <child>
- <object class="GtkHBox" id="hbox11">
- <property name="visible">True</property>
- <child>
- <object class="GtkLabel" id="label6">
- <property name="visible">True</property>
- <property name="label" translatable="yes">width : </property>
- <property name="use_markup">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkSpinButton" id="spinbutton1">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="invisible_char">●</property>
- <property name="adjustment">adjustment1</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label7">
- <property name="visible">True</property>
- <property name="label" translatable="yes"> pixels </property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="position">2</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label8">
- <property name="visible">True</property>
- <property name="label" translatable="yes">height : </property>
- <property name="use_markup">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="position">3</property>
- </packing>
- </child>
- <child>
- <object class="GtkSpinButton" id="spinbutton2">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="invisible_char">●</property>
- <property name="adjustment">adjustment2</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="position">4</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label9">
- <property name="visible">True</property>
- <property name="label" translatable="yes"> pixels</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="position">5</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="padding">10</property>
- <property name="position">0</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkHBox" id="hbox3">
- <property name="visible">True</property>
- <child>
- <object class="GtkLabel" id="label2">
- <property name="visible">True</property>
- <property name="label" translatable="yes"><b>WIndow position:</b></property>
- <property name="use_markup">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="position">2</property>
- </packing>
- </child>
- <child>
- <object class="GtkHBox" id="hbox8">
- <property name="visible">True</property>
- <child>
- <object class="GtkHBox" id="hbox12">
- <property name="visible">True</property>
- <child>
- <object class="GtkLabel" id="label10">
- <property name="visible">True</property>
- <property name="label" translatable="yes">left : </property>
- <property name="use_markup">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkSpinButton" id="spinbutton3">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="invisible_char">●</property>
- <property name="adjustment">adjustment3</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label11">
- <property name="visible">True</property>
- <property name="label" translatable="yes"> pixels </property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="position">2</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label12">
- <property name="visible">True</property>
- <property name="label" translatable="yes">top : </property>
- <property name="use_markup">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="position">3</property>
- </packing>
- </child>
- <child>
- <object class="GtkSpinButton" id="spinbutton4">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="invisible_char">●</property>
- <property name="adjustment">adjustment4</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="position">4</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label13">
- <property name="visible">True</property>
- <property name="label" translatable="yes"> pixels</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="position">5</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="padding">10</property>
- <property name="position">0</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="position">3</property>
- </packing>
- </child>
- <child>
- <object class="GtkHBox" id="hbox4">
- <property name="visible">True</property>
- <child>
- <object class="GtkLabel" id="label3">
- <property name="visible">True</property>
- <property name="label" translatable="yes"><b>WIndow background:</b></property>
- <property name="use_markup">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="position">4</property>
- </packing>
- </child>
- <child>
- <object class="GtkHBox" id="hbox9">
- <property name="visible">True</property>
- <child>
- <object class="GtkHBox" id="hbox10">
- <property name="visible">True</property>
- <child>
- <object class="GtkLabel" id="label14">
- <property name="visible">True</property>
- <property name="label" translatable="yes">background color : </property>
- <property name="use_markup">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkColorButton" id="colorbutton1">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="color">#000000000000</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label15">
- <property name="visible">True</property>
- <property name="label" translatable="yes"> </property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="position">2</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label16">
- <property name="visible">True</property>
- <property name="label" translatable="yes">opacity : </property>
- <property name="use_markup">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="position">3</property>
- </packing>
- </child>
- <child>
- <object class="GtkSpinButton" id="spinbutton6">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="invisible_char">●</property>
- <property name="adjustment">adjustment5</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="position">4</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label17">
- <property name="visible">True</property>
- <property name="label" translatable="yes"> %</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="position">5</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="padding">10</property>
- <property name="position">0</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="position">5</property>
- </packing>
- </child>
- <child>
- <object class="GtkHBox" id="hbox5">
- <property name="visible">True</property>
- <child>
- <object class="GtkLabel" id="label4">
- <property name="visible">True</property>
- <property name="label" translatable="yes"><b>Text properties:</b></property>
- <property name="use_markup">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="position">6</property>
- </packing>
- </child>
- <child>
- <object class="GtkHBox" id="hbox13">
- <property name="visible">True</property>
- <child>
- <object class="GtkHBox" id="hbox14">
- <property name="visible">True</property>
- <child>
- <object class="GtkLabel" id="label18">
- <property name="visible">True</property>
- <property name="label" translatable="yes">text color : </property>
- <property name="use_markup">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkColorButton" id="colorbutton2">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="color">#000000000000</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label19">
- <property name="visible">True</property>
- <property name="label" translatable="yes"> </property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="position">2</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label21">
- <property name="visible">True</property>
- <property name="label" translatable="yes"> </property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="position">3</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label20">
- <property name="visible">True</property>
- <property name="label" translatable="yes">links color : </property>
- <property name="use_markup">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="position">4</property>
- </packing>
- </child>
- <child>
- <object class="GtkColorButton" id="colorbutton3">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="color">#000000000000</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="position">5</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="padding">10</property>
- <property name="position">0</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="position">7</property>
- </packing>
- </child>
- <child>
- <object class="GtkHBox" id="hbox16">
- <property name="visible">True</property>
- <child>
- <object class="GtkLabel" id="label22">
- <property name="visible">True</property>
- <property name="label" translatable="yes"><b>Update every: </b></property>
- <property name="use_markup">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="position">8</property>
- </packing>
- </child>
- <child>
- <object class="GtkHBox" id="hbox17">
- <property name="visible">True</property>
- <child>
- <object class="GtkHBox" id="hbox18">
- <property name="visible">True</property>
- <child>
- <object class="GtkSpinButton" id="spinbutton5">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="invisible_char">●</property>
- <property name="adjustment">adjustment6</property>
- </object>
- <packing>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label23">
- <property name="visible">True</property>
- <property name="label" translatable="yes"> seconds</property>
- </object>
- <packing>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="padding">10</property>
- <property name="position">0</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="position">9</property>
- </packing>
- </child>
- <child>
- <object class="GtkHBox" id="hbox6">
- <property name="visible">True</property>
- <child>
- <object class="GtkLabel" id="label5">
- <property name="visible">True</property>
- <property name="label" translatable="yes"><b>RSS Feeds:</b></property>
- <property name="use_markup">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="position">10</property>
- </packing>
- </child>
- <child>
- <object class="GtkHBox" id="hbox15">
- <property name="visible">True</property>
- <child>
- <object class="GtkVBox" id="vbox2">
- <property name="visible">True</property>
- <property name="orientation">vertical</property>
- <child>
- <object class="GtkScrolledWindow" id="scrolledwindow1">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="hscrollbar_policy">automatic</property>
- <property name="vscrollbar_policy">automatic</property>
- <property name="shadow_type">in</property>
- <child>
- <object class="GtkTreeView" id="treeview1">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkHButtonBox" id="hbuttonbox1">
- <property name="visible">True</property>
- <property name="layout_style">start</property>
- <child>
- <object class="GtkButton" id="button1">
- <property name="label">gtk-add</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="use_stock">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="button2">
- <property name="label">gtk-remove</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="use_stock">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="padding">10</property>
- <property name="position">0</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="position">11</property>
- </packing>
- </child>
- <child>
- <object class="GtkHButtonBox" id="hbuttonbox2">
- <property name="visible">True</property>
- <property name="layout_style">end</property>
- <child>
- <object class="GtkButton" id="button4">
- <property name="label">gtk-cancel</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="use_stock">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="button3">
- <property name="label">gtk-ok</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="use_stock">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="position">12</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="padding">5</property>
- <property name="position">0</property>
- </packing>
- </child>
- </object>
- </child>
- </object>
- <object class="GtkAdjustment" id="adjustment1">
- <property name="value">640</property>
- <property name="lower">100</property>
- <property name="upper">10000</property>
- <property name="step_increment">10</property>
- <property name="page_increment">100</property>
- </object>
- <object class="GtkAdjustment" id="adjustment2">
- <property name="value">400</property>
- <property name="lower">100</property>
- <property name="upper">10000</property>
- <property name="step_increment">10</property>
- <property name="page_increment">100</property>
- </object>
- <object class="GtkAdjustment" id="adjustment3">
- <property name="value">100</property>
- <property name="upper">10000</property>
- <property name="step_increment">1</property>
- <property name="page_increment">10</property>
- </object>
- <object class="GtkAdjustment" id="adjustment4">
- <property name="value">100</property>
- <property name="upper">10000</property>
- <property name="step_increment">1</property>
- <property name="page_increment">10</property>
- </object>
- <object class="GtkAdjustment" id="adjustment5">
- <property name="value">75</property>
- <property name="upper">100</property>
- <property name="step_increment">1</property>
- <property name="page_increment">10</property>
- </object>
- <object class="GtkAdjustment" id="adjustment6">
- <property name="upper">3600</property>
- <property name="lower">10</property>
- <property name="value">120</property>
- <property name="step_increment">1</property>
- <property name="page_increment">60</property>
- </object>
- </interface>'''
- setProcessName('rsswidget')
- if __name__ == '__main__':
- gtk.gdk.threads_init()
- rss_thingy = RssWidget()
- rss_thingy.main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement