def __init__(self, parent=None): super(EXPModuleDockWidget, self).__init__(parent) self.ui = Ui_Form() self.ui.setupUi(self) self.setValues("initial") QtCore.QObject.connect(self.ui.pushButton, QtCore.SIGNAL("clicked()"), self.showInput) QtCore.QObject.connect(self.ui.pushButton_2, QtCore.SIGNAL("clicked()"), self.addRow) QtCore.QObject.connect(self.ui.pushButton_3, QtCore.SIGNAL("clicked()"), self.loadConfig) QtCore.QObject.connect(self.ui.toolButton, QtCore.SIGNAL("clicked()"), self.loadConfig) #QtCore.QObject.connect(self.ui.lineEdit, QtCore.SIGNAL("returnPressed()"), self.showInput) self.Config = ConfigParser.ConfigParser()
class EXPModuleDockWidget(QtGui.QDockWidget): """Dock widget which is used to configure all UGM properties""" def __init__(self, parent=None): super(EXPModuleDockWidget, self).__init__(parent) self.ui = Ui_Form() self.ui.setupUi(self) self.setValues("initial") QtCore.QObject.connect(self.ui.pushButton, QtCore.SIGNAL("clicked()"), self.showInput) QtCore.QObject.connect(self.ui.pushButton_2, QtCore.SIGNAL("clicked()"), self.addRow) QtCore.QObject.connect(self.ui.pushButton_3, QtCore.SIGNAL("clicked()"), self.loadConfig) QtCore.QObject.connect(self.ui.toolButton, QtCore.SIGNAL("clicked()"), self.loadConfig) #QtCore.QObject.connect(self.ui.lineEdit, QtCore.SIGNAL("returnPressed()"), self.showInput) self.Config = ConfigParser.ConfigParser() #self.Config.read("/home/mrygacz/openbci/openbci/openbci/modules/exp/config.ini") #print self.Config.sections() def addRow(self): print "insert row" self.ui.tableWidget.insertRow(0) #self.ui.tableWidget.insertRow(1) #self.ui.tableWidget.insertRow(2) def showInput(self): print "show input: %s" % str(self.ui.textEdit.toPlainText()) print "table: %s" % str(self.ui.tableWidget.itemAt(0, 0).text()) def setValues(self, text): self.ui.textEdit.setPlainText(text) def loadConfig(self): """Loads config from file and rebuilds whole tree""" l_fileName = QtGui.QFileDialog().getOpenFileName( self, self.tr(u"Otwórz"), QtCore.QString(settings.module_abs_path()), "*") if l_fileName == "": return self.fileName = unicode(l_fileName) l_shortFileName = os.path.split(unicode(l_fileName))[1] self.setWindowTitle("test") print "filename: ", l_fileName #f = open(l_fileName) #print f.readlines() #Config = ConfigParser.ConfigParser() self.Config.read( "/home/mrygacz/openbci/openbci/openbci/modules/exp/config.ini") for section in self.Config.sections(): print section self.ui.textEdit.setPlainText(self.Config.get("Book", "title")) def saveConfigAs(self): """Saves config to specified file""" l_fileName = QtGui.QFileDialog().getSaveFileName( self, self.tr("Zapisz jako..."), QtCore.QString(), "Plik UGMa (*.ugm)") if l_fileName == "": return self.fileName = l_fileName self.saveConfig()
class EXPModuleDockWidget(QtGui.QDockWidget): """Dock widget which is used to configure all UGM properties""" def __init__(self, parent=None): super(EXPModuleDockWidget, self).__init__(parent) self.ui = Ui_Form() self.ui.setupUi(self) self.setValues("initial") QtCore.QObject.connect(self.ui.pushButton, QtCore.SIGNAL("clicked()"), self.showInput) QtCore.QObject.connect(self.ui.pushButton_2, QtCore.SIGNAL("clicked()"), self.addRow) QtCore.QObject.connect(self.ui.pushButton_3, QtCore.SIGNAL("clicked()"), self.loadConfig) QtCore.QObject.connect(self.ui.toolButton, QtCore.SIGNAL("clicked()"), self.loadConfig) #QtCore.QObject.connect(self.ui.lineEdit, QtCore.SIGNAL("returnPressed()"), self.showInput) self.Config = ConfigParser.ConfigParser() #self.Config.read("/home/mrygacz/openbci/openbci/openbci/modules/exp/config.ini") #print self.Config.sections() def addRow(self): print "insert row" self.ui.tableWidget.insertRow(0) #self.ui.tableWidget.insertRow(1) #self.ui.tableWidget.insertRow(2) def showInput(self): print "show input: %s" % str(self.ui.textEdit.toPlainText()) print "table: %s" % str(self.ui.tableWidget.itemAt(0,0).text()) def setValues(self, text): self.ui.textEdit.setPlainText(text) def loadConfig(self): """Loads config from file and rebuilds whole tree""" l_fileName = QtGui.QFileDialog().getOpenFileName(self, self.tr(u"Otwórz"), QtCore.QString(settings.module_abs_path()), "*") if l_fileName == "": return self.fileName = unicode(l_fileName) l_shortFileName = os.path.split(unicode(l_fileName))[1] self.setWindowTitle("test") print "filename: ", l_fileName #f = open(l_fileName) #print f.readlines() #Config = ConfigParser.ConfigParser() self.Config.read("/home/mrygacz/openbci/openbci/openbci/modules/exp/config.ini") for section in self.Config.sections(): print section self.ui.textEdit.setPlainText(self.Config.get("Book","title")) def saveConfigAs(self): """Saves config to specified file""" l_fileName = QtGui.QFileDialog().getSaveFileName(self, self.tr("Zapisz jako..."), QtCore.QString(), "Plik UGMa (*.ugm)") if l_fileName == "": return self.fileName = l_fileName self.saveConfig()