You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
932 B
Python
32 lines
932 B
Python
4 years ago
|
from PyQt5 import QtWidgets
|
||
|
|
||
|
from ArtNet.gui.dialogs.db_connection_dialog.db_connection_dialog import Ui_DBConnection
|
||
|
|
||
|
|
||
|
class DBDialog(QtWidgets.QDialog):
|
||
|
|
||
|
def __init__(self, parent=None):
|
||
|
super().__init__(parent)
|
||
|
self.ui = Ui_DBConnection()
|
||
|
self.ui.setupUi(self)
|
||
|
self.data = {}
|
||
|
|
||
|
self.ui.buttonBox.accepted.connect(self.getConnectionDetails)
|
||
|
|
||
|
def getConnectionDetails(self):
|
||
|
self.data = dict()
|
||
|
|
||
|
self.data["host"] = self.ui.host_line_edit.text()
|
||
|
self.data["port"] = self.ui.port_line_edit.text()
|
||
|
self.data["database"] = self.ui.database_line_edit.text()
|
||
|
self.data["user"] = self.ui.user_line_edit.text()
|
||
|
self.data["password"] = self.ui.password_line_edit.text()
|
||
|
|
||
|
self.accept()
|
||
|
|
||
|
def exec_(self) -> dict:
|
||
|
if super(DBDialog, self).exec_() == QtWidgets.QDialog.Rejected:
|
||
|
return None
|
||
|
return self.data
|
||
|
|