# HG changeset patch # User Dirk Olmes # Date 1293432071 -3600 # Node ID e030c6bd2d8194159616a5c30c65634d3960e02b # Parent 7c6e500c157985cad8f668a79e2dc04b631cb56e when selecting a feed, set the title column width to 80% of the total width diff -r 7c6e500c1579 -r e030c6bd2d81 MainWindow.py --- 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)