Mercurial > hg > Feedworm
comparison MainWindow.py @ 151:bca9341dc67f
move the selected feed into the backend - sqlalchemy backend works, couchdb backend currently broken
author | Dirk Olmes <dirk@xanthippe.ping.de> |
---|---|
date | Sat, 27 Aug 2011 07:07:50 +0200 |
parents | babe14449162 |
children | a1c0459e1eeb |
comparison
equal
deleted
inserted
replaced
150:babe14449162 | 151:bca9341dc67f |
---|---|
23 self.ui.setupUi(self) | 23 self.ui.setupUi(self) |
24 self.updateFeedList() | 24 self.updateFeedList() |
25 self.initFeedEntryList() | 25 self.initFeedEntryList() |
26 | 26 |
27 def updateFeedList(self): | 27 def updateFeedList(self): |
28 self.allFeeds = self.backend.getFeeds() | 28 allFeeds = self.backend.getFeeds() |
29 feedModel = DisplayModel(self, self.allFeeds, "title") | 29 feedModel = DisplayModel(self, allFeeds, "title") |
30 self.ui.feedList.setModel(feedModel) | 30 self.ui.feedList.setModel(feedModel) |
31 self.ui.feedList.update() | 31 self.ui.feedList.update() |
32 | 32 |
33 def initFeedEntryList(self): | 33 def initFeedEntryList(self): |
34 # setup the default row height. This must be called before a table model is set | 34 # setup the default row height. This must be called before a table model is set |
37 self.ui.feedEntryList.setItemDelegate(FeedEntryItemDelegate()) | 37 self.ui.feedEntryList.setItemDelegate(FeedEntryItemDelegate()) |
38 self.ui.feedEntryList.setModel(FeedEntryTableModel([])) | 38 self.ui.feedEntryList.setModel(FeedEntryTableModel([])) |
39 self.ui.feedEntryList.horizontalHeader().setStretchLastSection(True) | 39 self.ui.feedEntryList.horizontalHeader().setStretchLastSection(True) |
40 | 40 |
41 def feedSelected(self, index): | 41 def feedSelected(self, index): |
42 self.selectedFeed = self.allFeeds[index.row()] | 42 self.backend.selectFeed(index.row()) |
43 self.enableFeedRelatedWidgets() | 43 self.enableFeedRelatedWidgets() |
44 self.setupFeedEntries() | 44 self.setupFeedEntries() |
45 | 45 |
46 def enableFeedRelatedWidgets(self): | 46 def enableFeedRelatedWidgets(self): |
47 self.ui.actionFeedSettings.setEnabled(True) | 47 self.ui.actionFeedSettings.setEnabled(True) |
48 self.ui.actionMarkFeedRead.setEnabled(True) | 48 self.ui.actionMarkFeedRead.setEnabled(True) |
49 self.ui.actionDeleteFeed.setEnabled(True) | 49 self.ui.actionDeleteFeed.setEnabled(True) |
50 | 50 |
51 def setupFeedEntries(self): | 51 def setupFeedEntries(self): |
52 # TODO move the access to preferences into the backend | |
52 hideReadEntries = self.preferences.hideReadFeedEntries() | 53 hideReadEntries = self.preferences.hideReadFeedEntries() |
53 self.feedEntries = self.backend.entriesForFeed(self.selectedFeed, hideReadEntries) | 54 self.feedEntries = self.backend.entriesForSelectedFeed(hideReadEntries) |
54 self.initFeedDisplayModel() | 55 self.initFeedDisplayModel() |
55 | 56 |
56 def initFeedDisplayModel(self): | 57 def initFeedDisplayModel(self): |
57 self.setupFeedTableModel() | 58 self.setupFeedTableModel() |
58 self.ui.feedEntryList.update() | 59 self.ui.feedEntryList.update() |
118 def toggleReadOnSelectedEntry(self): | 119 def toggleReadOnSelectedEntry(self): |
119 self.backend.toggleRead(self.selectedEntry) | 120 self.backend.toggleRead(self.selectedEntry) |
120 self.ui.feedEntryList.doItemsLayout() | 121 self.ui.feedEntryList.doItemsLayout() |
121 | 122 |
122 def markSelectedFeedRead(self): | 123 def markSelectedFeedRead(self): |
123 self.backend.markAllEntriesRead(self.selectedFeed) | 124 self.backend.markSelectedFeedAsRead() |
124 self.ui.feedEntryList.doItemsLayout() | 125 self.ui.feedEntryList.doItemsLayout() |
125 | 126 |
126 def markSelectedEntriesRead(self): | 127 def markSelectedEntriesRead(self): |
127 entriesToBeMarked = [] | 128 entriesToBeMarked = [] |
128 selectedIndexes = self.ui.feedEntryList.selectedIndexes() | 129 selectedIndexes = self.ui.feedEntryList.selectedIndexes() |
149 else: | 150 else: |
150 self.updateFeedList() | 151 self.updateFeedList() |
151 | 152 |
152 def deleteFeed(self): | 153 def deleteFeed(self): |
153 try: | 154 try: |
154 self.backend.deleteFeed(self.selectedFeed) | 155 self.backend.deleteSelectedFeed() |
155 self.updateFeedList() | 156 self.updateFeedList() |
156 except Exception as exception: | 157 except Exception as exception: |
157 message = "Error while deleting feed: " + str(exception) | 158 message = "Error while deleting feed: " + str(exception) |
158 self._updateStatusBar(message) | 159 self._updateStatusBar(message) |
159 | 160 |
160 def showPreferences(self): | 161 def showPreferences(self): |
161 preferences = PreferencesDialog(self.backend) | 162 preferences = PreferencesDialog(self.backend) |
162 preferences.exec_() | 163 preferences.exec_() |
163 | 164 |
164 def showFeedSettings(self): | 165 def showFeedSettings(self): |
165 feedSettings = FeedSettings(self.selectedFeed, self.backend) | 166 feedSettings = FeedSettings(self.backend) |
166 feedSettings.exec_() | 167 feedSettings.exec_() |
167 | 168 |
168 def _updateStatusBar(self, message): | 169 def _updateStatusBar(self, message): |
169 self.ui.statusbar.showMessage(message, STATUS_MESSAGE_DISPLAY_MILLIS) | 170 self.ui.statusbar.showMessage(message, STATUS_MESSAGE_DISPLAY_MILLIS) |
170 | 171 |