예제 #1
0
 def __init__(self, parent=None):
     super(MyMainWindow, self).__init__(parent)
     self.ui = Ui_MainWindow()
     self.ui.setupUi(self)
     self.now_is_insert_row = False
     self.connect(self.ui.delRowButton, QtCore.SIGNAL("clicked()"), self.pushButtondelete)
     self.connect(self.ui.AddRowBeforeButton, QtCore.SIGNAL("clicked()"), self.pushButtonaddbefore)
     self.connect(self.ui.AddButtonAfterButton, QtCore.SIGNAL("clicked()"), self.pushButtonaddafter)
     self.connect(self.ui.SavenExitButton, QtCore.SIGNAL("clicked()"), self.pushButtonsavenexit)
     self.connect(self.ui.ClosewoSaveButton, QtCore.SIGNAL("clicked()"), self.pushButtonexitwosave)
     self.ui.tableWidget.connect(self.ui.tableWidget, QtCore.SIGNAL("cellChanged(int, int)"),self.CellDataSave)
예제 #2
0
class MyMainWindow(QtGui.QMainWindow):
    def __init__(self, parent=None):
        super(MyMainWindow, self).__init__(parent)
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)
        self.now_is_insert_row = False
        self.connect(self.ui.delRowButton, QtCore.SIGNAL("clicked()"), self.pushButtondelete)
        self.connect(self.ui.AddRowBeforeButton, QtCore.SIGNAL("clicked()"), self.pushButtonaddbefore)
        self.connect(self.ui.AddButtonAfterButton, QtCore.SIGNAL("clicked()"), self.pushButtonaddafter)
        self.connect(self.ui.SavenExitButton, QtCore.SIGNAL("clicked()"), self.pushButtonsavenexit)
        self.connect(self.ui.ClosewoSaveButton, QtCore.SIGNAL("clicked()"), self.pushButtonexitwosave)
        self.ui.tableWidget.connect(self.ui.tableWidget, QtCore.SIGNAL("cellChanged(int, int)"),self.CellDataSave)

    def CellDataSave(self,row,column):
        if self.now_is_insert_row == False:
            #print "Data changed in row=",row," column=",column
            item = self.ui.tableWidget.item(row,column)
            #print item.text()
            #Найдем строку в данных
            record = self.dsodata.Buffer.ItemAt(row)
            #print "Record.value=",record.value
            if self.dsodata.ini_data[column][dso_tools.readini_fld_type] == "ftstring" :
                record.value[column]=item.text()
            elif self.dsodata.ini_data[column][dso_tools.readini_fld_type] == "ftfloat":
                val = 0.0
                try:
                    val = string.atof(item.text())
                except ValueError, TypeError:
                    pass
                record.value[column]=val
                item.setText(str(val))
            elif self.dsodata.ini_data[column][dso_tools.readini_fld_type] == "ftinteger":
                val = 0
                try:
                    val = string.atoi(item.text())
                except ValueError, TypeError:
                    pass
                record.value[column]=val
                item.setText(str(val))