Mercurial > hg > Feedworm
comparison MainWindow.py @ 91:e5d5fc34ff2e
convert feed list to a table view. TODO: proper resizing for columns
author | Dirk Olmes <dirk@xanthippe.ping.de> |
---|---|
date | Sun, 26 Dec 2010 08:35:36 +0100 |
parents | a1066e5a8f88 |
children | e030c6bd2d81 |
comparison
equal
deleted
inserted
replaced
90:a1066e5a8f88 | 91:e5d5fc34ff2e |
---|---|
1 | 1 |
2 from AddFeed import AddFeed | 2 from AddFeed import AddFeed |
3 from DisplayModel import DisplayModel | 3 from DisplayModel import DisplayModel |
4 from Feed import Feed | 4 from Feed import Feed |
5 from FeedEntry import FeedEntry | |
6 from FeedEntryItemDelegate import FeedEntryItemDelegate | 5 from FeedEntryItemDelegate import FeedEntryItemDelegate |
6 from FeedEntryTableModel import FeedEntryTableModel | |
7 from FeedSettings import FeedSettings | 7 from FeedSettings import FeedSettings |
8 from Preferences import Preferences | 8 from Preferences import Preferences |
9 from PreferencesDialog import PreferencesDialog | 9 from PreferencesDialog import PreferencesDialog |
10 from PyQt4.QtCore import QUrl | 10 from PyQt4.QtCore import QUrl |
11 from PyQt4.QtGui import QMainWindow | 11 from PyQt4.QtGui import QMainWindow |
32 self.ui.feedList.setModel(feedModel) | 32 self.ui.feedList.setModel(feedModel) |
33 self.ui.feedList.update() | 33 self.ui.feedList.update() |
34 | 34 |
35 def initFeedEntryList(self): | 35 def initFeedEntryList(self): |
36 self.ui.feedEntryList.setItemDelegate(FeedEntryItemDelegate()) | 36 self.ui.feedEntryList.setItemDelegate(FeedEntryItemDelegate()) |
37 self.ui.feedEntryList.setModel(FeedEntryTableModel([])) | |
38 | |
39 width = self.ui.feedEntryList.width() | |
40 print("width: " + str(width)) | |
41 firstColumnWidth = int(width * 0.8) | |
42 self.ui.feedEntryList.setColumnWidth(0, firstColumnWidth) | |
43 self.ui.feedEntryList.horizontalHeader().setStretchLastSection(True) | |
37 | 44 |
38 def feedSelected(self, index): | 45 def feedSelected(self, index): |
39 self.selectedFeed = self.allFeeds[index.row()] | 46 self.selectedFeed = self.allFeeds[index.row()] |
40 self.enableFeedRelatedWidgets() | 47 self.enableFeedRelatedWidgets() |
41 self.setupFeedEntries() | 48 self.setupFeedEntries() |
48 hideReadEntries = self.preferences.hideReadFeedEntries() | 55 hideReadEntries = self.preferences.hideReadFeedEntries() |
49 self.feedEntries = self.selectedFeed.entriesSortedByUpdateDate(hideReadEntries) | 56 self.feedEntries = self.selectedFeed.entriesSortedByUpdateDate(hideReadEntries) |
50 self.initFeedDisplayModel() | 57 self.initFeedDisplayModel() |
51 | 58 |
52 def initFeedDisplayModel(self): | 59 def initFeedDisplayModel(self): |
53 model = DisplayModel(self, self.feedEntries, FeedEntry.userPresentableString) | 60 model = FeedEntryTableModel(self.feedEntries) |
54 self.ui.feedEntryList.setModel(model) | 61 self.ui.feedEntryList.setModel(model) |
55 self.ui.feedEntryList.itemDelegate().entries = self.feedEntries | 62 self.ui.feedEntryList.itemDelegate().entries = self.feedEntries |
56 self.ui.feedEntryList.update() | 63 self.ui.feedEntryList.update() |
64 | |
57 visibleIndex = model.createIndex(0, 0) | 65 visibleIndex = model.createIndex(0, 0) |
58 self.ui.feedEntryList.scrollTo(visibleIndex) | 66 self.ui.feedEntryList.scrollTo(visibleIndex) |
59 | 67 |
60 def feedEntrySelected(self, index): | 68 def feedEntrySelected(self, index): |
61 self.ui.menuArticle.setEnabled(True) | 69 self.ui.menuArticle.setEnabled(True) |