def __init__(self, parent): QDialog.__init__(self, parent) self.ui = Ui_manageFeeds() self.ui.setupUi(self) self.feedList = [] self.displayFeeds() self.parent = parent self.connect(self.ui.btnExit, SIGNAL('clicked()'), SLOT('close()')) self.connect(self.ui.btnRemove, SIGNAL('clicked()'), self.removeFeed) self.connect(self.ui.btnAdd, SIGNAL('clicked()'), self.addFeed)
class ManageFeedsDialog(QDialog): def __init__(self, parent): QDialog.__init__(self, parent) self.ui=Ui_manageFeeds() self.ui.setupUi(self) self.feedList = [] self.displayFeeds() self.parent = parent self.connect(self.ui.btnExit, SIGNAL('clicked()'), SLOT('close()')) self.connect(self.ui.btnRemove, SIGNAL('clicked()'), self.removeFeed) self.connect(self.ui.btnAdd, SIGNAL('clicked()'), self.addFeed) def displayFeeds(self): self.feedList = fm.listFeeds() feedTitles = [feed.title for feed in self.feedList] self.ui.feedList.clear() self.ui.feedList.addItems(feedTitles) def removeFeed(self): selectedItemIndex = self.ui.feedList.currentRow() selectedFeed = self.feedList[selectedItemIndex] classifier.removefromScoreTable(selectedFeed) fm.removeFeed(selectedFeed) #Set the refreshDisplay status to true. self.parent.parent.refreshDisplay = True self.displayFeeds() def addFeed(self): feedUrl = unicode(self.ui.urlLine.text()) #Run the addFeed function in a new thread so that the ui is responsive. thread = threading.Thread(target=self.parent.parent.addFeed, args=(feedUrl,)) thread.setDaemon(True) thread.start() thread.join() if self.parent.parent.refreshDisplay is True: itemList = fm.listNew() classifier.assignItemsToTopics(itemList) self.parent.parent.setNewItemScores() self.ui.urlLine.clear() self.displayFeeds()
def __init__(self, parent): QDialog.__init__(self, parent) self.ui=Ui_manageFeeds() self.ui.setupUi(self) self.feedList = [] self.displayFeeds() self.parent = parent self.connect(self.ui.btnExit, SIGNAL('clicked()'), SLOT('close()')) self.connect(self.ui.btnRemove, SIGNAL('clicked()'), self.removeFeed) self.connect(self.ui.btnAdd, SIGNAL('clicked()'), self.addFeed)