Delegates are used for FK display. NOTE: CORE DUMP ON EXIT
[ipypbx] / src / ipypbx / main.py
index 7d25b49..9c8ebfe 100644 (file)
@@ -57,6 +57,8 @@ def setupDb(prefix=PREFIX, dbname=DB_NAME):
             query = QtSql.QSqlQuery()
             for query_string in sql_queries[:-1]:
                 query.exec_(query_string)
+
+        return created
     else:
         # Something went horribly wrong.
         QtGui.QMessageBox.warning(
@@ -75,7 +77,7 @@ if __name__ == '__main__':
         QtGui.QApplication.installTranslator(translator)
 
     # Initialize main window.
-    setupDb()
+    created = setupDb()
     main = QtGui.QMainWindow()
     views = ui.Ui_MainWindow()
     views.setupUi(main)
@@ -96,6 +98,7 @@ if __name__ == '__main__':
     # Get first row index.
     first_row_id, ok = connection_model.data(
         connection_index.sibling(0, 0)).toInt()
+    
     if ok:
         # We have to explicitly emit row selection signal since previous state
         # was unselected.
@@ -104,5 +107,7 @@ if __name__ == '__main__':
             QtCore.SIGNAL('currentRowChanged(QModelIndex, QModelIndex)'),
             connection_index, connection_index)
 
+    if created:
+        main.controllers['connection'].add()
     sys.exit(app.exec_())