Mercurial > hg > Feedworm
comparison MainWindow.py @ 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 | e5d5fc34ff2e |
children | 11036eabbc46 |
comparison
equal
deleted
inserted
replaced
92:7c6e500c1579 | 93:e030c6bd2d81 |
---|---|
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([])) | 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) | 38 self.ui.feedEntryList.horizontalHeader().setStretchLastSection(True) |
44 | 39 |
45 def feedSelected(self, index): | 40 def feedSelected(self, index): |
46 self.selectedFeed = self.allFeeds[index.row()] | 41 self.selectedFeed = self.allFeeds[index.row()] |
47 self.enableFeedRelatedWidgets() | 42 self.enableFeedRelatedWidgets() |
55 hideReadEntries = self.preferences.hideReadFeedEntries() | 50 hideReadEntries = self.preferences.hideReadFeedEntries() |
56 self.feedEntries = self.selectedFeed.entriesSortedByUpdateDate(hideReadEntries) | 51 self.feedEntries = self.selectedFeed.entriesSortedByUpdateDate(hideReadEntries) |
57 self.initFeedDisplayModel() | 52 self.initFeedDisplayModel() |
58 | 53 |
59 def initFeedDisplayModel(self): | 54 def initFeedDisplayModel(self): |
55 self.setupFeedTableModel() | |
56 self.ui.feedEntryList.update() | |
57 self.setupFeedTableHeaderWidths() | |
58 self.scrollFirstRowInFeedTableToVisible() | |
59 | |
60 def setupFeedTableModel(self): | |
60 model = FeedEntryTableModel(self.feedEntries) | 61 model = FeedEntryTableModel(self.feedEntries) |
61 self.ui.feedEntryList.setModel(model) | 62 self.ui.feedEntryList.setModel(model) |
62 self.ui.feedEntryList.itemDelegate().entries = self.feedEntries | 63 self.ui.feedEntryList.itemDelegate().entries = self.feedEntries |
63 self.ui.feedEntryList.update() | |
64 | 64 |
65 def setupFeedTableHeaderWidths(self): | |
66 width = self.ui.feedEntryList.width() | |
67 firstColumnWidth = int(width * 0.8) | |
68 self.ui.feedEntryList.setColumnWidth(0, firstColumnWidth) | |
69 | |
70 def scrollFirstRowInFeedTableToVisible(self): | |
71 model = self.ui.feedEntryList.model() | |
65 visibleIndex = model.createIndex(0, 0) | 72 visibleIndex = model.createIndex(0, 0) |
66 self.ui.feedEntryList.scrollTo(visibleIndex) | 73 self.ui.feedEntryList.scrollTo(visibleIndex) |
67 | 74 |
68 def feedEntrySelected(self, index): | 75 def feedEntrySelected(self, index): |
69 self.ui.menuArticle.setEnabled(True) | 76 self.ui.menuArticle.setEnabled(True) |