# HG changeset patch # User Dirk Olmes # Date 1407379617 -7200 # Node ID 9faa1f84e8c95edc169a04acbcc2759d53042540 # Parent f0b5bdce11892a582d81ac1beb29e349a1b7eb13 display the number of feeds and articles above the table diff -r f0b5bdce1189 -r 9faa1f84e8c9 MainWindow.py --- a/MainWindow.py Wed Jul 02 18:20:56 2014 +0200 +++ b/MainWindow.py Thu Aug 07 04:46:57 2014 +0200 @@ -27,7 +27,15 @@ feedModel = GenericListModel(self, allFeeds, 'title') self.ui.feedList.setModel(feedModel) self.ui.feedList.update() - + self.__updateFeedCountLabel(allFeeds) + + def __updateFeedCountLabel(self, feeds): + feedCount = len(feeds) + text = '%d feed' % feedCount + if feedCount > 1: + text = text + 's' + self.ui.feedCountLabel.setText(text) + def initFeedEntryTable(self): # setup the default row height. This must be called before a table model is set self.ui.feedEntryTable.verticalHeader().setDefaultSectionSize(20) @@ -57,13 +65,14 @@ self.ui.actionDeleteFeed.setEnabled(True) def setupFeedEntries(self): - self.setupFeedEntriesTableModel() + feedEntries = self.backend.entriesForSelectedFeed() + self.setupFeedEntriesTableModel(feedEntries) self.ui.feedEntryTable.update() self.setupFeedEntriesTableHeaderWidths() self.scrollFirstRowInFeedEntriesTableToVisible() + self.__updateFeedEntryCountLabel(feedEntries) - def setupFeedEntriesTableModel(self): - feedEntries = self.backend.entriesForSelectedFeed() + def setupFeedEntriesTableModel(self, feedEntries): model = self.ui.feedEntryTable.model() model.setDisplayedObjects(feedEntries) @@ -77,6 +86,13 @@ visibleIndex = model.createIndex(0, 0) self.ui.feedEntryTable.scrollTo(visibleIndex) + def __updateFeedEntryCountLabel(self, feedEntries): + count = len(feedEntries) + text = '%d Article' % count + if count > 1: + text = text + 's' + self.ui.feedEntryCountLabel.setText(text) + def feedEntrySelected(self, index): self.ui.webView.setZoomFactor(1.0) self.ui.menuArticle.setEnabled(True) diff -r f0b5bdce1189 -r 9faa1f84e8c9 Ui_MainWindow.ui --- a/Ui_MainWindow.ui Wed Jul 02 18:20:56 2014 +0200 +++ b/Ui_MainWindow.ui Thu Aug 07 04:46:57 2014 +0200 @@ -24,31 +24,79 @@ Qt::Horizontal - - - true - - - QListView::Fixed - + + + + + + + 8 + + + + + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + Qt::NoTextInteraction + + + + + + + true + + + QListView::Fixed + + + + Qt::Vertical - - - true - - - QAbstractItemView::SelectRows - - - false - - - false - + + + + + + + 8 + + + + + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + Qt::NoTextInteraction + + + + + + + true + + + QAbstractItemView::SelectRows + + + false + + + false + + + +