예제 #1
0
 def openDB(self):
     fname = unicode(QFileDialog.getOpenFileName(self, 'open file',
                                                 os.getcwd()))
     if os.path.exists(fname):
         self.fname = fname
         self.db = database(self.fname)
         self.statusbar.showMessage('Aperto DB: '+self.fname)
         self.populate()
     elif fname != '': QMessageBox.warning(self, 'Warning',
                               'Il file indicato non esiste:\n\n'+fname,
                               QMessageBox.Ok)
예제 #2
0
 def newDB(self):
     fname = unicode(QFileDialog.getSaveFileName(self, 'save file',
                                                 os.getcwd()))
     if fname:
         self.fname = fname+'.rubr'
         self.db = database(self.fname)
         columns = {
         1:'id integer primary key autoincrement',
         2:'name varchar(30)',
         3:'phone int'}
         self.db.newTable('elenco', columns)
         self.db.commit()
         self.statusbar.showMessage('Aperto DB: '+self.fname)
         self.populate()