def __init__(self, parent=None): QWidget.__init__(self, parent) self.parent = parent self.ui = Ui_feedIO() self.ui.setupUi(self) self.raise_() self.newFont = QFont() self.newFont.setWeight(75) self.unreadFont = QFont() self.unreadFont.setWeight(75) self.readFont = QFont() self.readFont.setWeight(50) self.readColor = QColor("#666666") self.unreadColor = QColor("#444444") self.newColor = QColor("#070788") self.feedList = [] self.itemList = [] self.topicList = [] self.readList = [] self.currentItem = None self.currentTopic = classifier.getTopic("General") self.updated = True self.displayTopics() self.displayFeeds() self.displayItems() self.ui.listOld.setFocus() self.ui.comboFeed.setCurrentIndex(len(self.feedList)) # Twitter authentication details. # self.twitterAuthenticated = False # self.twitterAuthKey = '' # self.twitterAuthSecret = '' self.connect(self.ui.comboFeed, SIGNAL("currentIndexChanged(int)"), self.displayItems) self.connect(self.ui.comboTopic, SIGNAL("currentIndexChanged(int)"), self.displayItems) self.connect(self.ui.listUnread, SIGNAL("currentItemChanged(QTreeWidgetItem *,QTreeWidgetItem *)"), self.setCurrentFromUnread) self.connect(self.ui.listUnread, SIGNAL("itemDoubleClicked(QTreeWidgetItem *,int)"), self.on_actionReadItLater_activated) self.connect(self.ui.listOld, SIGNAL("itemDoubleClicked(QTreeWidgetItem *,int)"), self.on_actionReadItLater_activated) self.connect(self.ui.listOld, SIGNAL("currentItemChanged(QTreeWidgetItem *,QTreeWidgetItem *)"), self.setCurrentFromOld) self.connect(self.ui.actionVisitPage, SIGNAL("activated()"), self.visitPage) self.connect(self.ui.actionFetchAllFeeds, SIGNAL("activated()"), parent.fetchAllFeeds) self.connect(self.ui.actionReCalculateScores, SIGNAL("activated()"), self.reCalculateAllScores) self.connect(self.ui.actionFetchFeed, SIGNAL("activated()"), self.fetchFeed) self.connect(self.ui.actionUpVote, SIGNAL("activated()"), self.upVoteArticle) self.connect(self.ui.actionDownVote, SIGNAL("activated()"), self.downVoteArticle) self.connect(self.ui.actionUnread, SIGNAL("activated()"), self.markAsUnread) # self.connect(self, SIGNAL('triggered()'), self.closeEvent) self.connect(self.ui.btnUp, SIGNAL('clicked()'), self.upVoteArticle) self.connect(self.ui.btnDown, SIGNAL('clicked()'), self.downVoteArticle)
def displayTopics(self): """ function to display the current topics list in the combo box. """ self.topicList = classifier.listTopics() self.topicList.remove(classifier.getTopic("General")) topicTitles = [topic.title for topic in self.topicList] self.ui.topicListCombo.clear() self.ui.topicListCombo.addItems(topicTitles)
def displayTopics(self): self.topicList = classifier.listTopics() self.topicList.remove(classifier.getTopic("General")) topicTitles = [topic.title for topic in self.topicList] self.ui.topicList.clear() self.ui.topicList.addItems(topicTitles)