Ejemplo n.º 1
0
 def deleteItem( self, item ):
     if not self._editItem:
         return
     if QMessageBox.question(
         self,
         "Delete source type",
         "Are you sure you want to remove the source type " + self._editItem['name'] + '?', 
         QMessageBox.Yes | QMessageBox.No) != QMessageBox.Yes:
         return
     Database.execute('elc_DeleteSourceType',self._editItem['id'])
     ReaderType.reload()
     self._controller.updateSourceTypes()
Ejemplo n.º 2
0
 def saveItem( self ):
     if not self.checkIsValid():
         return False
     params = ReaderType.encodeParams( self._params.list())
     if self._editItem: 
         id = Database.executeScalar('elc_UpdateSourceType',
                          self._editItem['id'],
                          str(self.uName.text()),
                          str(self.uFileExtension.text()),
                          self.uCoordSys.selectedValue(),
                          str(self.uReaderClass.currentText()),
                          params)
     else:
         id = Database.executeScalar('elc_CreateSourceType',
                          str(self.uName.text()),
                          str(self.uFileExtension.text()),
                          self.uCoordSys.selectedValue(),
                          str(self.uReaderClass.currentText()),
                          params)
     self.clearItem()
     ReaderType.reload()
     self._controller.updateSourceTypes()
     self.uListView.selectId( id )
     return True
Ejemplo n.º 3
0
 def loadSourceTypes( self ):
     current = self.uSourceType.selectedValue()
     self.uSourceType.clear()
     for r in sorted(ReaderType.list(),key=lambda x: x['name']):
         self.uSourceType.addNameValue(r['name'],r['id'])
     self.uSourceType.selectValue(current)
Ejemplo n.º 4
0
 def loadList( self ):
     self.uListModel.setList( ReaderType.list())