def order_popup(self): orderGroupBox = QGroupBox("Order Database Table By Feature") tablename = QComboBox() tablename.addItems(db.getTables()) feature = QComboBox() feature.addItems([ 'id', 'row', 'col', 'coord1x', 'coord1y', 'coord2x', 'coord2y', 'coord3x', 'coord3y', 'coord4x', 'coord4y', 'centx', 'centy' ]) order = QComboBox() order.addItems(['asc', 'desc']) layout = QFormLayout() layout.addRow(QLabel("Table"), tablename) layout.addRow(QLabel("Feature"), feature) layout.addRow(QLabel("Order"), order) orderGroupBox.setLayout(layout) orderButtonBox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel) mainOrderLayout = QVBoxLayout() central_widget = QWidget() central_widget.setLayout(mainOrderLayout) mainOrderLayout.addWidget(orderGroupBox) mainOrderLayout.addWidget(orderButtonBox) self.setCentralWidget(central_widget) self.show() orderButtonBox.accepted.connect(lambda: self.displayTable( db.orderTable(tablename.currentText(), feature.currentText(), order.currentText()))) orderButtonBox.rejected.connect(self.close)
def search_popup(self): orderGroupBox = QGroupBox("View Range") tablename = QComboBox() tablename.addItems(db.getTables()) min_id = QLineEdit() min_id.setText('0') max_id = QLineEdit() layout = QFormLayout() layout.addRow(QLabel("Table"), tablename) layout.addRow(QLabel("Min ID"), min_id) layout.addRow(QLabel("Max ID"), max_id) orderGroupBox.setLayout(layout) orderButtonBox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel) mainOrderLayout = QVBoxLayout() central_widget = QWidget() central_widget.setLayout(mainOrderLayout) mainOrderLayout.addWidget(orderGroupBox) mainOrderLayout.addWidget(orderButtonBox) self.setCentralWidget(central_widget) self.show() orderButtonBox.accepted.connect(lambda: self.displayTable( db.searchTable(tablename.currentText(), min_id.text(), max_id.text( )))) orderButtonBox.rejected.connect(self.close) return
def addEntry_popup(self): orderGroupBox = QGroupBox("Add An Entry") tablename = QComboBox() tablename.addItems(db.getTables()) hid = QLineEdit() row = QLineEdit() col = QLineEdit() coord1x = QLineEdit() coord1y = QLineEdit() coord2x = QLineEdit() coord2y = QLineEdit() coord3x = QLineEdit() coord3y = QLineEdit() coord4x = QLineEdit() coord4y = QLineEdit() centx = QLineEdit() centy = QLineEdit() layout = QFormLayout() layout.addRow(QLabel("Table"), tablename) layout.addRow(QLabel("ID"), hid) layout.addRow(QLabel("row"), row) layout.addRow(QLabel("col"), col) layout.addRow(QLabel("coord1x"), coord1x) layout.addRow(QLabel("coord1y"), coord1y) layout.addRow(QLabel("coord2x"), coord2x) layout.addRow(QLabel("coord2y"), coord2y) layout.addRow(QLabel("coord3x"), coord3x) layout.addRow(QLabel("coord3y"), coord3y) layout.addRow(QLabel("coord4x"), coord4x) layout.addRow(QLabel("coord4y"), coord4y) layout.addRow(QLabel("centx"), centx) layout.addRow(QLabel("centy"), centy) orderGroupBox.setLayout(layout) orderButtonBox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel) mainOrderLayout = QVBoxLayout() central_widget = QWidget() central_widget.setLayout(mainOrderLayout) mainOrderLayout.addWidget(orderGroupBox) mainOrderLayout.addWidget(orderButtonBox) self.setCentralWidget(central_widget) self.show() orderButtonBox.accepted.connect( lambda: db.addEntry(tablename.currentText(), hid.text(), row.text( ), col.text(), coord1x.text(), coord1y.text(), coord2x.text( ), coord2y.text(), coord3x.text(), coord3y.text(), coord4x.text(), coord4y.text(), centx.text(), centy.text())) orderButtonBox.accepted.connect(self.close) orderButtonBox.rejected.connect(self.close)
def export_popup(self): exportGroupBox = QGroupBox("Export table to GeoJSON") tablename = QComboBox() tablename.addItems(db.getTables()) layout = QFormLayout() layout.addRow(QLabel("Export"), tablename) exportGroupBox.setLayout(layout) exportButtonBox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel) mainExportLayout = QVBoxLayout() central_widget = QWidget() central_widget.setLayout(mainExportLayout) mainExportLayout.addWidget(exportGroupBox) mainExportLayout.addWidget(exportButtonBox) self.setCentralWidget(central_widget) self.show() exportButtonBox.accepted.connect( lambda: db.exportTable(tablename.currentText())) exportButtonBox.accepted.connect(self.close) exportButtonBox.rejected.connect(self.close)
def populateTable_popup(self): populateGroupBox = QGroupBox("Populate Table") tablename = QComboBox() tablename.addItems(db.getTables()) layout = QFormLayout() layout.addRow(QLabel("Populate"), tablename) populateGroupBox.setLayout(layout) populateButtonBox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel) mainPopulateLayout = QVBoxLayout() central_widget = QWidget() central_widget.setLayout(mainPopulateLayout) mainPopulateLayout.addWidget(populateGroupBox) mainPopulateLayout.addWidget(populateButtonBox) self.setCentralWidget(central_widget) self.show() populateButtonBox.accepted.connect( lambda: db.populateTable(tablename.currentText(), container)) populateButtonBox.accepted.connect(self.close) populateButtonBox.rejected.connect(self.close)
def deleteEntry_popup(self): orderGroupBox = QGroupBox("Headstone To Delete") tablename = QComboBox() tablename.addItems(db.getTables()) hid = QComboBox() hid.addItems(db.getIDs(tablename.currentText())) layout = QFormLayout() layout.addRow(QLabel("Table"), tablename) layout.addRow(QLabel("ID"), hid) orderGroupBox.setLayout(layout) orderButtonBox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel) mainOrderLayout = QVBoxLayout() central_widget = QWidget() central_widget.setLayout(mainOrderLayout) mainOrderLayout.addWidget(orderGroupBox) mainOrderLayout.addWidget(orderButtonBox) self.setCentralWidget(central_widget) self.show() orderButtonBox.accepted.connect( lambda: db.deleteEntry(tablename.currentText(), hid.currentText())) orderButtonBox.accepted.connect(self.close) orderButtonBox.rejected.connect(self.close)