Mercurial > hg > Feedworm
diff 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 |
line wrap: on
line diff
--- a/MainWindow.py Fri Dec 24 05:06:21 2010 +0100 +++ b/MainWindow.py Sun Dec 26 08:35:36 2010 +0100 @@ -2,8 +2,8 @@ from AddFeed import AddFeed from DisplayModel import DisplayModel from Feed import Feed -from FeedEntry import FeedEntry from FeedEntryItemDelegate import FeedEntryItemDelegate +from FeedEntryTableModel import FeedEntryTableModel from FeedSettings import FeedSettings from Preferences import Preferences from PreferencesDialog import PreferencesDialog @@ -34,6 +34,13 @@ def initFeedEntryList(self): self.ui.feedEntryList.setItemDelegate(FeedEntryItemDelegate()) + self.ui.feedEntryList.setModel(FeedEntryTableModel([])) + + width = self.ui.feedEntryList.width() + print("width: " + str(width)) + firstColumnWidth = int(width * 0.8) + self.ui.feedEntryList.setColumnWidth(0, firstColumnWidth) + self.ui.feedEntryList.horizontalHeader().setStretchLastSection(True) def feedSelected(self, index): self.selectedFeed = self.allFeeds[index.row()] @@ -50,10 +57,11 @@ self.initFeedDisplayModel() def initFeedDisplayModel(self): - model = DisplayModel(self, self.feedEntries, FeedEntry.userPresentableString) + model = FeedEntryTableModel(self.feedEntries) self.ui.feedEntryList.setModel(model) self.ui.feedEntryList.itemDelegate().entries = self.feedEntries self.ui.feedEntryList.update() + visibleIndex = model.createIndex(0, 0) self.ui.feedEntryList.scrollTo(visibleIndex)