Mercurial > hg > Feedworm
changeset 241:e0e7459556bc
use Qt to open the selected article in the system browser
author | Dirk Olmes <dirk@xanthippe.ping.de> |
---|---|
date | Tue, 28 Apr 2015 02:50:57 +0200 |
parents | 1b98925facf6 |
children | 03e3ebb1d52f |
files | MainWindow.py |
diffstat | 1 files changed, 9 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/MainWindow.py Tue Apr 28 02:23:44 2015 +0200 +++ b/MainWindow.py Tue Apr 28 02:50:57 2015 +0200 @@ -7,7 +7,7 @@ from FeedSettings import FeedSettings from PreferencesDialog import PreferencesDialog from PyQt4.QtCore import QUrl -from PyQt4.QtGui import QApplication, QMainWindow, QWidget +from PyQt4.QtGui import QApplication, QDesktopServices, QMainWindow, QWidget from Ui_MainWindow import Ui_MainWindow STATUS_MESSAGE_DISPLAY_MILLIS = 20000 @@ -28,14 +28,14 @@ self.ui.feedList.setModel(feedModel) self.ui.feedList.update() self.__updateFeedCountLabel(allFeeds) - + def __updateFeedCountLabel(self, feeds): feedCount = len(feeds) text = '%d feed' % feedCount if feedCount > 1: text = text + 's' self.ui.feedCountLabel.setText(text) - + def initFeedEntryTable(self): # setup the default row height. This must be called before a table model is set self.ui.feedEntryTable.verticalHeader().setDefaultSectionSize(20) @@ -48,7 +48,7 @@ def __buildFeedEntryTableModel(self): model = GenericTableModel(self, []) titleDisplay = lambda feedEntry: feedEntry.title - model.defineColumn('Title', titleDisplay) + model.defineColumn('Title', titleDisplay) dateDisplay = lambda feedEntry: feedEntry.updated.strftime('%d.%m.%Y') model.defineColumn('Date', dateDisplay) return model @@ -92,7 +92,7 @@ if count > 1: text = text + 's' self.ui.feedEntryCountLabel.setText(text) - + def feedEntrySelected(self, index): self.ui.webView.setZoomFactor(1.0) self.ui.menuArticle.setEnabled(True) @@ -131,12 +131,11 @@ self.ui.webView.show() def openSelectedEntryInBrowser(self): - feedEntry = self.backend.selectedFeedEntry - message = "Open %s in external browser" % (feedEntry.title) + article = self.backend.selectedFeedEntry + message = "Open %s in external browser" % (article.title) self._updateStatusBar(message) - # TODO: make browser configurable - browser = "/usr/bin/chromium" - subprocess.Popen([browser, feedEntry.link]) + url = QUrl(article.link) + QDesktopServices.openUrl(url) def toggleReadOnSelectedEntry(self): self.backend.toggleSelectedFeedEntryRead()