AAAAAAAAAAAAAAA
This commit is contained in:
parent
66bdb310a6
commit
dae929607f
|
|
@ -21,7 +21,7 @@ class Postgres:
|
||||||
self.get_schema()
|
self.get_schema()
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return f'PostgreSQL Server: {self.db_ip}:{self.db_port} as {self.db_username} on database {self.db_name}'
|
return f'PostgreSQL'
|
||||||
|
|
||||||
def get_schema(self) -> dict:
|
def get_schema(self) -> dict:
|
||||||
fetch = self.fetchall("SELECT table_name FROM information_schema.tables WHERE table_schema = 'public';")
|
fetch = self.fetchall("SELECT table_name FROM information_schema.tables WHERE table_schema = 'public';")
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ class Ui_MainWindow(object):
|
||||||
self.outputTableLabel.setGeometry(QtCore.QRect(20, 250, 49, 16))
|
self.outputTableLabel.setGeometry(QtCore.QRect(20, 250, 49, 16))
|
||||||
self.outputTableLabel.setObjectName("outputTableLabel")
|
self.outputTableLabel.setObjectName("outputTableLabel")
|
||||||
self.shellInput = QtWidgets.QTextEdit(self.centralwidget)
|
self.shellInput = QtWidgets.QTextEdit(self.centralwidget)
|
||||||
self.shellInput.setGeometry(QtCore.QRect(410, 80, 375, 111))
|
self.shellInput.setGeometry(QtCore.QRect(410, 80, 371, 111))
|
||||||
self.shellInput.setObjectName("shellInput")
|
self.shellInput.setObjectName("shellInput")
|
||||||
self.statementOutput = QtWidgets.QTextEdit(self.centralwidget)
|
self.statementOutput = QtWidgets.QTextEdit(self.centralwidget)
|
||||||
self.statementOutput.setEnabled(True)
|
self.statementOutput.setEnabled(True)
|
||||||
|
|
@ -81,7 +81,14 @@ class Ui_MainWindow(object):
|
||||||
self.menubar.addAction(self.menuSettings.menuAction())
|
self.menubar.addAction(self.menuSettings.menuAction())
|
||||||
|
|
||||||
self.retranslateUi(MainWindow)
|
self.retranslateUi(MainWindow)
|
||||||
|
self.textInput.returnPressed.connect(self.convertButton.click) # type: ignore
|
||||||
QtCore.QMetaObject.connectSlotsByName(MainWindow)
|
QtCore.QMetaObject.connectSlotsByName(MainWindow)
|
||||||
|
MainWindow.setTabOrder(self.textInput, self.convertButton)
|
||||||
|
MainWindow.setTabOrder(self.convertButton, self.pasteButton)
|
||||||
|
MainWindow.setTabOrder(self.pasteButton, self.shellInput)
|
||||||
|
MainWindow.setTabOrder(self.shellInput, self.executeButton)
|
||||||
|
MainWindow.setTabOrder(self.executeButton, self.outputTable)
|
||||||
|
MainWindow.setTabOrder(self.outputTable, self.statementOutput)
|
||||||
|
|
||||||
def retranslateUi(self, MainWindow):
|
def retranslateUi(self, MainWindow):
|
||||||
_translate = QtCore.QCoreApplication.translate
|
_translate = QtCore.QCoreApplication.translate
|
||||||
|
|
|
||||||
|
|
@ -143,7 +143,7 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>410</x>
|
<x>410</x>
|
||||||
<y>80</y>
|
<y>80</y>
|
||||||
<width>375</width>
|
<width>371</width>
|
||||||
<height>111</height>
|
<height>111</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
|
@ -214,6 +214,32 @@ p, li { white-space: pre-wrap; }
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
</widget>
|
</widget>
|
||||||
|
<tabstops>
|
||||||
|
<tabstop>textInput</tabstop>
|
||||||
|
<tabstop>convertButton</tabstop>
|
||||||
|
<tabstop>pasteButton</tabstop>
|
||||||
|
<tabstop>shellInput</tabstop>
|
||||||
|
<tabstop>executeButton</tabstop>
|
||||||
|
<tabstop>outputTable</tabstop>
|
||||||
|
<tabstop>statementOutput</tabstop>
|
||||||
|
</tabstops>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections>
|
||||||
|
<connection>
|
||||||
|
<sender>textInput</sender>
|
||||||
|
<signal>returnPressed()</signal>
|
||||||
|
<receiver>convertButton</receiver>
|
||||||
|
<slot>click()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>262</x>
|
||||||
|
<y>69</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>724</x>
|
||||||
|
<y>67</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
</connections>
|
||||||
</ui>
|
</ui>
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,7 @@ class Ui_ApiKey(object):
|
||||||
self.outputLabel.setObjectName("outputLabel")
|
self.outputLabel.setObjectName("outputLabel")
|
||||||
|
|
||||||
self.retranslateUi(ApiKey)
|
self.retranslateUi(ApiKey)
|
||||||
|
self.apikeyInput.returnPressed.connect(self.testButton.click) # type: ignore
|
||||||
QtCore.QMetaObject.connectSlotsByName(ApiKey)
|
QtCore.QMetaObject.connectSlotsByName(ApiKey)
|
||||||
|
|
||||||
def retranslateUi(self, ApiKey):
|
def retranslateUi(self, ApiKey):
|
||||||
|
|
|
||||||
|
|
@ -77,5 +77,22 @@
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections>
|
||||||
|
<connection>
|
||||||
|
<sender>apikeyInput</sender>
|
||||||
|
<signal>returnPressed()</signal>
|
||||||
|
<receiver>testButton</receiver>
|
||||||
|
<slot>click()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>153</x>
|
||||||
|
<y>27</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>91</x>
|
||||||
|
<y>53</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
</connections>
|
||||||
</ui>
|
</ui>
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,19 @@ class Ui_Connection(object):
|
||||||
self.dbtypeCombo.setObjectName("dbtypeCombo")
|
self.dbtypeCombo.setObjectName("dbtypeCombo")
|
||||||
|
|
||||||
self.retranslateUi(Connection)
|
self.retranslateUi(Connection)
|
||||||
|
self.ipInput.returnPressed.connect(self.portInput.setFocus) # type: ignore
|
||||||
|
self.portInput.returnPressed.connect(self.usernameInput.setFocus) # type: ignore
|
||||||
|
self.usernameInput.returnPressed.connect(self.passwordInput.setFocus) # type: ignore
|
||||||
|
self.passwordInput.returnPressed.connect(self.databaseInput.setFocus) # type: ignore
|
||||||
|
self.databaseInput.returnPressed.connect(self.testButton.click) # type: ignore
|
||||||
QtCore.QMetaObject.connectSlotsByName(Connection)
|
QtCore.QMetaObject.connectSlotsByName(Connection)
|
||||||
|
Connection.setTabOrder(self.dbtypeCombo, self.ipInput)
|
||||||
|
Connection.setTabOrder(self.ipInput, self.portInput)
|
||||||
|
Connection.setTabOrder(self.portInput, self.usernameInput)
|
||||||
|
Connection.setTabOrder(self.usernameInput, self.passwordInput)
|
||||||
|
Connection.setTabOrder(self.passwordInput, self.databaseInput)
|
||||||
|
Connection.setTabOrder(self.databaseInput, self.testButton)
|
||||||
|
Connection.setTabOrder(self.testButton, self.saveButton)
|
||||||
|
|
||||||
def retranslateUi(self, Connection):
|
def retranslateUi(self, Connection):
|
||||||
_translate = QtCore.QCoreApplication.translate
|
_translate = QtCore.QCoreApplication.translate
|
||||||
|
|
|
||||||
|
|
@ -209,6 +209,97 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
|
<tabstops>
|
||||||
|
<tabstop>dbtypeCombo</tabstop>
|
||||||
|
<tabstop>ipInput</tabstop>
|
||||||
|
<tabstop>portInput</tabstop>
|
||||||
|
<tabstop>usernameInput</tabstop>
|
||||||
|
<tabstop>passwordInput</tabstop>
|
||||||
|
<tabstop>databaseInput</tabstop>
|
||||||
|
<tabstop>testButton</tabstop>
|
||||||
|
<tabstop>saveButton</tabstop>
|
||||||
|
</tabstops>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections>
|
||||||
|
<connection>
|
||||||
|
<sender>ipInput</sender>
|
||||||
|
<signal>returnPressed()</signal>
|
||||||
|
<receiver>portInput</receiver>
|
||||||
|
<slot>setFocus()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>167</x>
|
||||||
|
<y>43</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>167</x>
|
||||||
|
<y>87</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>portInput</sender>
|
||||||
|
<signal>returnPressed()</signal>
|
||||||
|
<receiver>usernameInput</receiver>
|
||||||
|
<slot>setFocus()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>200</x>
|
||||||
|
<y>83</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>205</x>
|
||||||
|
<y>111</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>usernameInput</sender>
|
||||||
|
<signal>returnPressed()</signal>
|
||||||
|
<receiver>passwordInput</receiver>
|
||||||
|
<slot>setFocus()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>140</x>
|
||||||
|
<y>117</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>138</x>
|
||||||
|
<y>137</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>passwordInput</sender>
|
||||||
|
<signal>returnPressed()</signal>
|
||||||
|
<receiver>databaseInput</receiver>
|
||||||
|
<slot>setFocus()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>187</x>
|
||||||
|
<y>143</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>184</x>
|
||||||
|
<y>167</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>databaseInput</sender>
|
||||||
|
<signal>returnPressed()</signal>
|
||||||
|
<receiver>testButton</receiver>
|
||||||
|
<slot>click()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>157</x>
|
||||||
|
<y>173</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>84</x>
|
||||||
|
<y>205</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
</connections>
|
||||||
</ui>
|
</ui>
|
||||||
|
|
|
||||||
134
gui/main.py
134
gui/main.py
|
|
@ -3,7 +3,7 @@ import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from PyQt5.QtCore import QObject, QThread, pyqtSignal
|
from PyQt5.QtCore import QObject, QThread, pyqtSignal
|
||||||
from PyQt5.QtWidgets import QApplication, QMainWindow, QDialog
|
from PyQt5.QtWidgets import QApplication, QMainWindow, QDialog, QTableWidgetItem, QTableWidget
|
||||||
|
|
||||||
import modules.aisql as aisql
|
import modules.aisql as aisql
|
||||||
|
|
||||||
|
|
@ -98,6 +98,7 @@ class Worker(QObject):
|
||||||
test = False
|
test = False
|
||||||
db = None
|
db = None
|
||||||
tableschema = []
|
tableschema = []
|
||||||
|
result = ""
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
|
|
@ -121,24 +122,40 @@ class Worker(QObject):
|
||||||
def connect_db_worker(self):
|
def connect_db_worker(self):
|
||||||
self.db, self.tableschema = connect_db()
|
self.db, self.tableschema = connect_db()
|
||||||
|
|
||||||
|
|
||||||
def testing(self):
|
|
||||||
self.connect_db_worker()
|
|
||||||
print('test')
|
|
||||||
self.finished.emit()
|
|
||||||
|
|
||||||
# TODO: Add a translation Worker and a SQL Worker
|
|
||||||
def translate(self, text):
|
def translate(self, text):
|
||||||
print("Translating...")
|
# Load Config
|
||||||
|
self.connect_db_worker()
|
||||||
|
dbtype, dbip, dbport, dbuser, dbpassword, dbname, apikey = load_config()
|
||||||
|
ai = aisql.AI(apikey)
|
||||||
|
self.result = ai.humantosql(text, str(self.db), self.tableschema)
|
||||||
self.finished.emit()
|
self.finished.emit()
|
||||||
|
|
||||||
def run_sql(self, sql):
|
def run_sql(self, sql):
|
||||||
print("Running SQL...")
|
print("Running SQL...")
|
||||||
|
db, tableschema = connect_db()
|
||||||
|
ai = aisql.AI(api_key=load_config()[6])
|
||||||
|
choice = ai.decide(sql)
|
||||||
|
|
||||||
|
print(choice)
|
||||||
|
|
||||||
|
if "fetchall".casefold() in choice.casefold():
|
||||||
|
self.result = db.fetchall(sql)
|
||||||
|
elif "fetchone".casefold() in choice.casefold():
|
||||||
|
self.result = db.fetchone(sql)
|
||||||
|
elif "execute".casefold() in choice.casefold():
|
||||||
|
self.result = db.execute(sql)
|
||||||
|
else:
|
||||||
|
print("error")
|
||||||
|
|
||||||
|
print(self.result)
|
||||||
self.finished.emit()
|
self.finished.emit()
|
||||||
|
|
||||||
class MainWindow(QMainWindow):
|
class MainWindow(QMainWindow):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
|
self.setupUi()
|
||||||
|
|
||||||
|
def setupUi(self):
|
||||||
self.ui = Ui_MainWindow()
|
self.ui = Ui_MainWindow()
|
||||||
self.ui.setupUi(self)
|
self.ui.setupUi(self)
|
||||||
self.tableschema = []
|
self.tableschema = []
|
||||||
|
|
@ -153,13 +170,19 @@ class MainWindow(QMainWindow):
|
||||||
self.ui.actionConnect_API_Key.triggered.connect(self.open_apikey)
|
self.ui.actionConnect_API_Key.triggered.connect(self.open_apikey)
|
||||||
|
|
||||||
# Pressed Convert Button
|
# Pressed Convert Button
|
||||||
self.ui.convertButton.clicked.connect(self.on_convert_button_clicked)
|
# FIXME: UI still freezes when clicked, QThreads not working properly
|
||||||
|
self.ui.convertButton.clicked.connect(self.convert)
|
||||||
|
|
||||||
# Pressed Paste Button
|
# Pressed Paste Button
|
||||||
self.ui.pasteButton.clicked.connect(self.on_paste_button_clicked)
|
self.ui.pasteButton.clicked.connect(self.on_paste_button_clicked)
|
||||||
|
|
||||||
|
# TODO: Functioning Execute Button
|
||||||
# Pressed Execute Button
|
# Pressed Execute Button
|
||||||
self.ui.executeButton.clicked.connect(self.on_execute_button_clicked)
|
self.ui.executeButton.clicked.connect(self.execute)
|
||||||
|
|
||||||
|
self.ui.outputTable.setColumnCount(2)
|
||||||
|
self.ui.outputTable.setHorizontalHeaderLabels(["Column", "Value"])
|
||||||
|
|
||||||
|
|
||||||
def try_to_connect(self):
|
def try_to_connect(self):
|
||||||
# TODO: Rewrite to use a Worker
|
# TODO: Rewrite to use a Worker
|
||||||
|
|
@ -179,71 +202,59 @@ class MainWindow(QMainWindow):
|
||||||
self.apikey_window = ApiKeyWindow(self)
|
self.apikey_window = ApiKeyWindow(self)
|
||||||
self.apikey_window.show()
|
self.apikey_window.show()
|
||||||
|
|
||||||
def on_execute_button_clicked(self):
|
# TODO: Make this work
|
||||||
|
def execute(self):
|
||||||
self.ui.outputLabel.setText("Executing...")
|
self.ui.outputLabel.setText("Executing...")
|
||||||
self.ui.outputLabel.show()
|
self.ui.outputLabel.show()
|
||||||
self.ui.executeButton.setEnabled(False)
|
self.ui.executeButton.setEnabled(False)
|
||||||
|
|
||||||
sql = self.ui.shellInput.toPlainText()
|
|
||||||
|
|
||||||
self.thread = QThread()
|
|
||||||
self.worker = Worker()
|
self.worker = Worker()
|
||||||
|
self.thread = QThread()
|
||||||
self.worker.moveToThread(self.thread)
|
self.worker.moveToThread(self.thread)
|
||||||
|
|
||||||
self.thread.started.connect(self.worker.testing)
|
self.worker.finished.connect(self.thread.quit)
|
||||||
self.worker.finished.connect(self.execute_finish)
|
self.worker.finished.connect(self.worker.deleteLater)
|
||||||
|
self.thread.finished.connect(self.thread.deleteLater)
|
||||||
|
|
||||||
|
self.thread.started.connect(lambda: self.worker.run_sql(self.ui.shellInput.toPlainText()))
|
||||||
|
self.worker.finished.connect(self.execute_finished)
|
||||||
|
|
||||||
self.thread.start()
|
self.thread.start()
|
||||||
|
|
||||||
def execute_finish(self):
|
def execute_finished(self):
|
||||||
|
self.data = self.worker.result
|
||||||
self.ui.outputLabel.setText("Finished!")
|
self.ui.outputLabel.setText("Finished!")
|
||||||
self.ui.outputLabel.show()
|
self.ui.outputLabel.show()
|
||||||
self.ui.executeButton.setEnabled(True)
|
self.ui.executeButton.setEnabled(True)
|
||||||
print("finished")
|
|
||||||
|
|
||||||
self.worker.deleteLater()
|
|
||||||
self.thread.deleteLater()
|
|
||||||
print("deleted")
|
|
||||||
|
|
||||||
def on_convert_button_clicked(self):
|
|
||||||
|
def convert(self):
|
||||||
self.ui.outputLabel.setText("Converting...")
|
self.ui.outputLabel.setText("Converting...")
|
||||||
self.ui.outputLabel.show()
|
self.ui.outputLabel.show()
|
||||||
self.ui.convertButton.setEnabled(False)
|
self.ui.convertButton.setEnabled(False)
|
||||||
|
|
||||||
# def start_db_test_thread(self):
|
self.worker = Worker()
|
||||||
# self.ui.returnLabel.setText("Testing...")
|
self.thread = QThread()
|
||||||
# self.ui.returnLabel.setStyleSheet("color: black;")
|
self.worker.moveToThread(self.thread)
|
||||||
# self.ui.testButton.setEnabled(False)
|
|
||||||
#
|
self.worker.finished.connect(self.thread.quit)
|
||||||
# dbtype = self.ui.dbtypeCombo.currentIndex()
|
self.worker.finished.connect(self.worker.deleteLater)
|
||||||
# ip = self.ui.ipInput.text()
|
self.thread.finished.connect(self.thread.deleteLater)
|
||||||
# port = self.ui.portInput.text()
|
|
||||||
# user = self.ui.usernameInput.text()
|
self.thread.started.connect(lambda: self.worker.translate(self.ui.textInput.text()))
|
||||||
# password = self.ui.passwordInput.text()
|
self.worker.finished.connect(self.convert_finished)
|
||||||
# database = self.ui.databaseInput.text()
|
|
||||||
#
|
self.thread.start()
|
||||||
# self.thread = QThread()
|
|
||||||
# self.worker = Worker()
|
def convert_finished(self):
|
||||||
# self.worker.moveToThread(self.thread)
|
self.ui.statementOutput.setText(self.worker.result)
|
||||||
#
|
self.ui.outputLabel.setText("Finished!")
|
||||||
# self.thread.started.connect(
|
self.ui.outputLabel.show()
|
||||||
# lambda: self.worker.test_db_connection(dbtype, ip, port, user, password, database))
|
self.ui.convertButton.setEnabled(True)
|
||||||
# self.worker.finished.connect(self.thread.quit)
|
|
||||||
# self.thread.finished.connect(self.thread_complete)
|
# TODO: Convert Function Threading
|
||||||
#
|
# FIXME: Still freezing UI even with threading
|
||||||
# self.thread.start()
|
|
||||||
#
|
|
||||||
# def thread_complete(self):
|
|
||||||
# if self.worker.test:
|
|
||||||
# self.ui.returnLabel.setText("Connection Success!")
|
|
||||||
# self.ui.returnLabel.setStyleSheet("color: green;")
|
|
||||||
# else:
|
|
||||||
# self.ui.returnLabel.setText("Connection Failed!")
|
|
||||||
# self.ui.returnLabel.setStyleSheet("color: red;")
|
|
||||||
#
|
|
||||||
# self.ui.testButton.setEnabled(True)
|
|
||||||
# self.worker.deleteLater()
|
|
||||||
# self.thread.deleteLater()
|
|
||||||
|
|
||||||
|
|
||||||
### Connection Window ###
|
### Connection Window ###
|
||||||
|
|
@ -252,10 +263,9 @@ class ConnectionWindow(QDialog):
|
||||||
super().__init__(parent)
|
super().__init__(parent)
|
||||||
self.ui = ConnectionForm()
|
self.ui = ConnectionForm()
|
||||||
self.ui.setupUi(self)
|
self.ui.setupUi(self)
|
||||||
self.ui.saveButton.setEnabled(False)
|
|
||||||
self.ui.testButton.setEnabled(False)
|
|
||||||
self.ui.returnLabel.setText("")
|
self.ui.returnLabel.setText("")
|
||||||
|
|
||||||
|
|
||||||
# Load DB Config from file
|
# Load DB Config from file
|
||||||
with open(os.path.join(configfolder, configfile), "r") as f:
|
with open(os.path.join(configfolder, configfile), "r") as f:
|
||||||
self.config = json.load(f)
|
self.config = json.load(f)
|
||||||
|
|
@ -274,6 +284,12 @@ class ConnectionWindow(QDialog):
|
||||||
self.ui.passwordInput.setText(self.dbpass)
|
self.ui.passwordInput.setText(self.dbpass)
|
||||||
self.ui.databaseInput.setText(self.dbname)
|
self.ui.databaseInput.setText(self.dbname)
|
||||||
|
|
||||||
|
if (self.ui.ipInput or self.ui.portInput or self.ui.databaseInput) == "":
|
||||||
|
self.ui.saveButton.setEnabled(False)
|
||||||
|
self.ui.testButton.setEnabled(False)
|
||||||
|
else:
|
||||||
|
self.ui.saveButton.setEnabled(True)
|
||||||
|
self.ui.testButton.setEnabled(True)
|
||||||
# Unlock Buttons if ip, port and database is not empty
|
# Unlock Buttons if ip, port and database is not empty
|
||||||
|
|
||||||
self.ui.ipInput.textChanged.connect(self.on_text_changed)
|
self.ui.ipInput.textChanged.connect(self.on_text_changed)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user