comparison MainWindow.py @ 39:0c2578196643

Disable the article menu by default, enable it when the first article is selected
author Dirk Olmes <dirk@xanthippe.ping.de>
date Fri, 14 May 2010 06:48:48 +0200
parents 22214d79ed41
children c858aab71e5b
comparison
equal deleted inserted replaced
38:11bac653edfd 39:0c2578196643
35 self.ui.feedEntryList.setModel(model) 35 self.ui.feedEntryList.setModel(model)
36 self.ui.feedEntryList.itemDelegate().entries = self.sortedEntries 36 self.ui.feedEntryList.itemDelegate().entries = self.sortedEntries
37 self.ui.feedEntryList.update() 37 self.ui.feedEntryList.update()
38 38
39 def feedEntrySelected(self, index): 39 def feedEntrySelected(self, index):
40 self.ui.menuArticle.setEnabled(True)
40 row = index.row() 41 row = index.row()
41 self.selectedEntry = self.sortedEntries[row] 42 self.selectedEntry = self.sortedEntries[row]
42 baseUrl = QUrl(self.selectedEntry.link) # TODO this is the wrong base url, figure out the correct one 43 baseUrl = QUrl(self.selectedEntry.link) # TODO this is the wrong base url, figure out the correct one
43 self.ui.webView.setHtml(self.selectedEntry.summary, baseUrl) 44 self.ui.webView.setHtml(self.selectedEntry.summary, baseUrl)
44 45
54 url = addFeed.getUrl() 55 url = addFeed.getUrl()
55 FeedUpdater.createNewFeed(url, self.session) 56 FeedUpdater.createNewFeed(url, self.session)
56 # TODO get status from feedUpdater and display in status area of the main window 57 # TODO get status from feedUpdater and display in status area of the main window
57 self.updateFeedList() 58 self.updateFeedList()
58 59
59 def openSelectedEntry(self): 60 def openSelectedEntryInBrowser(self):
60 # TODO make browser configurable 61 # TODO make browser configurable
61 browser = "/usr/local/bin/opera" 62 browser = "/usr/local/bin/opera"
62 subprocess.Popen([browser, self.selectedEntry.link]) 63 subprocess.Popen([browser, self.selectedEntry.link])
64
65 def openLinkFromSelectedEntry(self):
66 url = QUrl(self.selectedEntry.link)
67 self.ui.webView.load(url)
68 self.ui.webView.show()
63 69
64 class FeedEntryItemDelegate(QtGui.QStyledItemDelegate): 70 class FeedEntryItemDelegate(QtGui.QStyledItemDelegate):
65 def __init__(self): 71 def __init__(self):
66 QtGui.QStyledItemDelegate.__init__(self, None) 72 QtGui.QStyledItemDelegate.__init__(self, None)
67 73