Mercurial > hg > Feedworm
changeset 93:e030c6bd2d81
when selecting a feed, set the title column width to 80% of the total width
author | Dirk Olmes <dirk@xanthippe.ping.de> |
---|---|
date | Mon, 27 Dec 2010 07:41:11 +0100 |
parents | 7c6e500c1579 |
children | a16c4e2b2c55 |
files | MainWindow.py |
diffstat | 1 files changed, 13 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/MainWindow.py Mon Dec 27 07:26:42 2010 +0100 +++ b/MainWindow.py Mon Dec 27 07:41:11 2010 +0100 @@ -35,11 +35,6 @@ 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): @@ -57,11 +52,23 @@ self.initFeedDisplayModel() def initFeedDisplayModel(self): + self.setupFeedTableModel() + self.ui.feedEntryList.update() + self.setupFeedTableHeaderWidths() + self.scrollFirstRowInFeedTableToVisible() + + def setupFeedTableModel(self): model = FeedEntryTableModel(self.feedEntries) self.ui.feedEntryList.setModel(model) self.ui.feedEntryList.itemDelegate().entries = self.feedEntries - self.ui.feedEntryList.update() + def setupFeedTableHeaderWidths(self): + width = self.ui.feedEntryList.width() + firstColumnWidth = int(width * 0.8) + self.ui.feedEntryList.setColumnWidth(0, firstColumnWidth) + + def scrollFirstRowInFeedTableToVisible(self): + model = self.ui.feedEntryList.model() visibleIndex = model.createIndex(0, 0) self.ui.feedEntryList.scrollTo(visibleIndex)