Пример #1
0
Файл: ui.py Проект: Lanka/feedIO
class ManageTopicsDialog(QDialog):
    def __init__(self, parent):
        QDialog.__init__(self, parent)
        self.ui=Ui_manageTopics()
        self.ui.setupUi(self)
        self.topicList = []
        self.displayTopics()

        self.connect(self.ui.btnExit, SIGNAL('clicked()'), SLOT('close()'))
        self.connect(self.ui.btnRemove, SIGNAL('clicked()'), self.removeTopic)
        self.connect(self.ui.btnAdd, SIGNAL('clicked()'), self.addTopic)


    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)


    def removeTopic(self):
        selectedItemIndex = self.ui.topicList.currentRow()
        selectedTopic = self.topicList[selectedItemIndex]
        classifier.removeTopic(selectedTopic)
        self.displayTopics()


    def addTopic(self):
        topic = unicode(self.ui.topicLine.text())
        classifier.addTopic(topic)
        self.ui.topicLine.clear()
        self.displayTopics()
Пример #2
0
    def __init__(self, parent):
        QDialog.__init__(self, parent)
        self.ui = Ui_manageTopics()
        self.ui.setupUi(self)
        self.topicList = []
        self.displayTopics()

        self.parent = parent

        self.connect(self.ui.btnExit, SIGNAL('clicked()'), SLOT('close()'))
        self.connect(self.ui.btnRemove, SIGNAL('clicked()'), self.removeTopic)
        self.connect(self.ui.btnAdd, SIGNAL('clicked()'), self.addTopic)
Пример #3
0
Файл: ui.py Проект: Lanka/feedIO
    def __init__(self, parent):
        QDialog.__init__(self, parent)
        self.ui=Ui_manageTopics()
        self.ui.setupUi(self)
        self.topicList = []
        self.displayTopics()

        self.connect(self.ui.btnExit, SIGNAL('clicked()'), SLOT('close()'))
        self.connect(self.ui.btnRemove, SIGNAL('clicked()'), self.removeTopic)
        self.connect(self.ui.btnAdd, SIGNAL('clicked()'), self.addTopic)
Пример #4
0
class ManageTopicsDialog(QDialog):
    def __init__(self, parent):
        QDialog.__init__(self, parent)
        self.ui=Ui_manageTopics()
        self.ui.setupUi(self)
        self.topicList = []
        self.displayTopics()

        self.parent = parent

        self.connect(self.ui.btnExit, SIGNAL('clicked()'), SLOT('close()'))
        self.connect(self.ui.btnRemove, SIGNAL('clicked()'), self.removeTopic)
        self.connect(self.ui.btnAdd, SIGNAL('clicked()'), self.addTopic)


    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)


    def removeTopic(self):
        selectedItemIndex = self.ui.topicList.currentRow()
        selectedTopic = self.topicList[selectedItemIndex]
        classifier.removeTopic(selectedTopic)

        #Set the refreshDisplay status to true.
        self.parent.parent.refreshDisplay = True

        self.displayTopics()


    def addTopic(self):
        topic = unicode(self.ui.topicLine.text())
        classifier.addTopic(topic)
        self.ui.topicLine.clear()

        #Set the refreshDisplay status to true.
        self.parent.parent.refreshDisplay = True

        self.displayTopics()