diff --git a/gui/apikey.py b/gui/apikey.py deleted file mode 100644 index 928bbfd..0000000 --- a/gui/apikey.py +++ /dev/null @@ -1,43 +0,0 @@ -# -*- coding: utf-8 -*- - -# Form implementation generated from reading ui file 'apikey.ui' -# -# Created by: PyQt5 UI code generator 5.15.9 -# -# WARNING: Any manual changes made to this file will be lost when pyuic5 is -# run again. Do not edit this file unless you know what you are doing. - - -from PyQt5 import QtCore, QtGui, QtWidgets - - -class Ui_Form(object): - def setupUi(self, Form): - Form.setObjectName("Form") - Form.resize(265, 91) - self.label = QtWidgets.QLabel(Form) - self.label.setGeometry(QtCore.QRect(20, 10, 91, 16)) - self.label.setObjectName("label") - self.lineEdit = QtWidgets.QLineEdit(Form) - self.lineEdit.setGeometry(QtCore.QRect(110, 10, 141, 21)) - self.lineEdit.setObjectName("lineEdit") - self.pushButton = QtWidgets.QPushButton(Form) - self.pushButton.setGeometry(QtCore.QRect(14, 40, 111, 24)) - self.pushButton.setObjectName("pushButton") - self.pushButton_2 = QtWidgets.QPushButton(Form) - self.pushButton_2.setGeometry(QtCore.QRect(134, 40, 121, 24)) - self.pushButton_2.setObjectName("pushButton_2") - self.label_2 = QtWidgets.QLabel(Form) - self.label_2.setGeometry(QtCore.QRect(20, 70, 231, 16)) - self.label_2.setObjectName("label_2") - - self.retranslateUi(Form) - QtCore.QMetaObject.connectSlotsByName(Form) - - def retranslateUi(self, Form): - _translate = QtCore.QCoreApplication.translate - Form.setWindowTitle(_translate("Form", "Form")) - self.label.setText(_translate("Form", "OpenAI API-Key")) - self.pushButton.setText(_translate("Form", "Test Key")) - self.pushButton_2.setText(_translate("Form", "Save")) - self.label_2.setText(_translate("Form", "Key working...")) diff --git a/gui/connection.py b/gui/connection.py deleted file mode 100644 index 83c6358..0000000 --- a/gui/connection.py +++ /dev/null @@ -1,77 +0,0 @@ -# -*- coding: utf-8 -*- - -# Form implementation generated from reading ui file '.\connection.ui' -# -# Created by: PyQt5 UI code generator 5.15.9 -# -# WARNING: Any manual changes made to this file will be lost when pyuic5 is -# run again. Do not edit this file unless you know what you are doing. - - -from PyQt5 import QtCore, QtGui, QtWidgets - - -class Ui_Form(object): - def setupUi(self, Form): - Form.setObjectName("Form") - Form.resize(249, 217) - self.label = QtWidgets.QLabel(Form) - self.label.setGeometry(QtCore.QRect(20, 10, 101, 16)) - self.label.setObjectName("label") - self.label_2 = QtWidgets.QLabel(Form) - self.label_2.setGeometry(QtCore.QRect(20, 40, 49, 16)) - self.label_2.setObjectName("label_2") - self.label_3 = QtWidgets.QLabel(Form) - self.label_3.setGeometry(QtCore.QRect(20, 70, 61, 16)) - self.label_3.setObjectName("label_3") - self.label_4 = QtWidgets.QLabel(Form) - self.label_4.setGeometry(QtCore.QRect(20, 100, 81, 16)) - self.label_4.setObjectName("label_4") - self.label_5 = QtWidgets.QLabel(Form) - self.label_5.setGeometry(QtCore.QRect(20, 130, 61, 16)) - self.label_5.setObjectName("label_5") - self.IP = QtWidgets.QLineEdit(Form) - self.IP.setGeometry(QtCore.QRect(100, 10, 131, 21)) - self.IP.setText("") - self.IP.setObjectName("IP") - self.port = QtWidgets.QLineEdit(Form) - self.port.setGeometry(QtCore.QRect(100, 40, 131, 21)) - self.port.setText("") - self.port.setObjectName("port") - self.username = QtWidgets.QLineEdit(Form) - self.username.setGeometry(QtCore.QRect(100, 70, 131, 21)) - self.username.setText("") - self.username.setObjectName("username") - self.password = QtWidgets.QLineEdit(Form) - self.password.setGeometry(QtCore.QRect(100, 100, 131, 21)) - self.password.setInputMethodHints(QtCore.Qt.ImhHiddenText|QtCore.Qt.ImhSensitiveData) - self.password.setObjectName("password") - self.database = QtWidgets.QLineEdit(Form) - self.database.setGeometry(QtCore.QRect(100, 130, 131, 21)) - self.database.setObjectName("database") - self.TestConnection = QtWidgets.QPushButton(Form) - self.TestConnection.setEnabled(False) - self.TestConnection.setGeometry(QtCore.QRect(14, 160, 101, 24)) - self.TestConnection.setObjectName("TestConnection") - self.saveButton = QtWidgets.QPushButton(Form) - self.saveButton.setEnabled(False) - self.saveButton.setGeometry(QtCore.QRect(130, 160, 101, 24)) - self.saveButton.setObjectName("saveButton") - self.returnLabel = QtWidgets.QLabel(Form) - self.returnLabel.setGeometry(QtCore.QRect(20, 190, 211, 16)) - self.returnLabel.setObjectName("returnLabel") - - self.retranslateUi(Form) - QtCore.QMetaObject.connectSlotsByName(Form) - - def retranslateUi(self, Form): - _translate = QtCore.QCoreApplication.translate - Form.setWindowTitle(_translate("Form", "Form")) - self.label.setText(_translate("Form", "IP")) - self.label_2.setText(_translate("Form", "Port")) - self.label_3.setText(_translate("Form", "Username")) - self.label_4.setText(_translate("Form", "Password")) - self.label_5.setText(_translate("Form", "Database")) - self.TestConnection.setText(_translate("Form", "Test Connection")) - self.saveButton.setText(_translate("Form", "Save")) - self.returnLabel.setText(_translate("Form", "Connection ... / Saved...")) diff --git a/gui/connectionui.py b/gui/connectionui.py deleted file mode 100644 index 758fd81..0000000 --- a/gui/connectionui.py +++ /dev/null @@ -1,6 +0,0 @@ -from PyQt5 import QtCore, QtGui, QtWidgets - -class UiConnect(QtWidgets): - def __init__(self): - self.setupUi(self) - diff --git a/gui/mainWindow.py b/gui/gui/Window.py similarity index 70% rename from gui/mainWindow.py rename to gui/gui/Window.py index f28e204..6544eb7 100644 --- a/gui/mainWindow.py +++ b/gui/gui/Window.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Form implementation generated from reading ui file '.\Window.ui' +# Form implementation generated from reading ui file 'Window.ui' # # Created by: PyQt5 UI code generator 5.15.9 # @@ -14,11 +14,11 @@ from PyQt5 import QtCore, QtGui, QtWidgets class Ui_MainWindow(object): def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") - MainWindow.resize(800, 600) + MainWindow.resize(796, 591) self.centralwidget = QtWidgets.QWidget(MainWindow) self.centralwidget.setObjectName("centralwidget") self.textInput = QtWidgets.QLineEdit(self.centralwidget) - self.textInput.setGeometry(QtCore.QRect(20, 30, 661, 21)) + self.textInput.setGeometry(QtCore.QRect(20, 30, 650, 21)) self.textInput.setObjectName("textInput") self.textLabel = QtWidgets.QLabel(self.centralwidget) self.textLabel.setGeometry(QtCore.QRect(20, 10, 71, 16)) @@ -26,38 +26,39 @@ class Ui_MainWindow(object): self.statementLabel = QtWidgets.QLabel(self.centralwidget) self.statementLabel.setGeometry(QtCore.QRect(20, 60, 121, 16)) self.statementLabel.setObjectName("statementLabel") - self.statementInput = QtWidgets.QLineEdit(self.centralwidget) - self.statementInput.setGeometry(QtCore.QRect(20, 80, 661, 21)) - self.statementInput.setObjectName("statementInput") self.convertButton = QtWidgets.QPushButton(self.centralwidget) - self.convertButton.setGeometry(QtCore.QRect(690, 30, 91, 24)) + self.convertButton.setGeometry(QtCore.QRect(680, 30, 100, 24)) self.convertButton.setObjectName("convertButton") - self.shellInput = QtWidgets.QLineEdit(self.centralwidget) - self.shellInput.setGeometry(QtCore.QRect(20, 150, 661, 21)) - self.shellInput.setObjectName("shellInput") self.shellLabel = QtWidgets.QLabel(self.centralwidget) - self.shellLabel.setGeometry(QtCore.QRect(20, 130, 101, 16)) + self.shellLabel.setGeometry(QtCore.QRect(410, 60, 91, 20)) self.shellLabel.setObjectName("shellLabel") self.executeButton = QtWidgets.QPushButton(self.centralwidget) - self.executeButton.setGeometry(QtCore.QRect(690, 150, 91, 24)) + self.executeButton.setGeometry(QtCore.QRect(680, 200, 100, 24)) self.executeButton.setObjectName("executeButton") self.pasteButton = QtWidgets.QPushButton(self.centralwidget) - self.pasteButton.setGeometry(QtCore.QRect(690, 80, 91, 24)) + self.pasteButton.setGeometry(QtCore.QRect(300, 200, 100, 24)) self.pasteButton.setObjectName("pasteButton") self.outputLabel = QtWidgets.QLabel(self.centralwidget) - self.outputLabel.setGeometry(QtCore.QRect(20, 180, 661, 16)) + self.outputLabel.setGeometry(QtCore.QRect(20, 230, 761, 16)) self.outputLabel.setObjectName("outputLabel") self.outputTable = QtWidgets.QTableWidget(self.centralwidget) - self.outputTable.setGeometry(QtCore.QRect(20, 240, 761, 311)) + self.outputTable.setGeometry(QtCore.QRect(20, 270, 761, 281)) self.outputTable.setObjectName("outputTable") self.outputTable.setColumnCount(0) self.outputTable.setRowCount(0) self.outputTableLabel = QtWidgets.QLabel(self.centralwidget) - self.outputTableLabel.setGeometry(QtCore.QRect(20, 220, 49, 16)) + self.outputTableLabel.setGeometry(QtCore.QRect(20, 250, 49, 16)) self.outputTableLabel.setObjectName("outputTableLabel") + self.shellInput = QtWidgets.QTextEdit(self.centralwidget) + self.shellInput.setGeometry(QtCore.QRect(410, 80, 375, 111)) + self.shellInput.setObjectName("shellInput") + self.statementOutput = QtWidgets.QTextEdit(self.centralwidget) + self.statementOutput.setEnabled(True) + self.statementOutput.setGeometry(QtCore.QRect(20, 80, 375, 111)) + self.statementOutput.setObjectName("statementOutput") MainWindow.setCentralWidget(self.centralwidget) self.menubar = QtWidgets.QMenuBar(MainWindow) - self.menubar.setGeometry(QtCore.QRect(0, 0, 800, 22)) + self.menubar.setGeometry(QtCore.QRect(0, 0, 796, 26)) self.menubar.setObjectName("menubar") self.menuSettings = QtWidgets.QMenu(self.menubar) self.menuSettings.setObjectName("menuSettings") @@ -88,8 +89,13 @@ class Ui_MainWindow(object): self.shellLabel.setText(_translate("MainWindow", "SQL Shell")) self.executeButton.setText(_translate("MainWindow", "Execute")) self.pasteButton.setText(_translate("MainWindow", "Paste to Shell")) - self.outputLabel.setText(_translate("MainWindow", "oputputLabel")) + self.outputLabel.setText(_translate("MainWindow", "outputLabel")) self.outputTableLabel.setText(_translate("MainWindow", "Output")) + self.statementOutput.setHtml(_translate("MainWindow", "\n" +"\n" +"


")) self.menuSettings.setTitle(_translate("MainWindow", "Settings")) self.actionConnect_DB.setText(_translate("MainWindow", "Connect DB")) self.actionConnect_API_Key.setText(_translate("MainWindow", "Connect API Key")) diff --git a/gui/Window.ui b/gui/gui/Window.ui similarity index 73% rename from gui/Window.ui rename to gui/gui/Window.ui index 07c04a5..982e399 100644 --- a/gui/Window.ui +++ b/gui/gui/Window.ui @@ -6,8 +6,8 @@ 0 0 - 800 - 600 + 796 + 591 @@ -19,7 +19,7 @@ 20 30 - 661 + 650 21 @@ -50,22 +50,12 @@ SQL Statement: - - - - 20 - 80 - 661 - 21 - - - - 690 + 680 30 - 91 + 100 24 @@ -73,21 +63,11 @@ Convert to SQL - - - - 20 - 150 - 661 - 21 - - - - 20 - 126 + 410 + 60 91 20 @@ -99,9 +79,9 @@ - 690 - 150 - 91 + 680 + 200 + 100 24 @@ -112,9 +92,9 @@ - 690 - 80 - 91 + 300 + 200 + 100 24 @@ -126,8 +106,8 @@ 20 - 180 - 661 + 230 + 761 16 @@ -139,9 +119,9 @@ 20 - 240 + 270 761 - 311 + 281 @@ -149,7 +129,7 @@ 20 - 220 + 250 49 16 @@ -158,14 +138,44 @@ Output + + + + 410 + 80 + 375 + 111 + + + + + + true + + + + 20 + 80 + 375 + 111 + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:7.8pt; font-weight:400; font-style:normal;"> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p></body></html> + + 0 0 - 800 - 22 + 796 + 26 diff --git a/gui/gui/apikey.py b/gui/gui/apikey.py new file mode 100644 index 0000000..3ec31f0 --- /dev/null +++ b/gui/gui/apikey.py @@ -0,0 +1,43 @@ +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file 'apikey.ui' +# +# Created by: PyQt5 UI code generator 5.15.9 +# +# WARNING: Any manual changes made to this file will be lost when pyuic5 is +# run again. Do not edit this file unless you know what you are doing. + + +from PyQt5 import QtCore, QtGui, QtWidgets + + +class Ui_ApiKey(object): + def setupUi(self, ApiKey): + ApiKey.setObjectName("ApiKey") + ApiKey.resize(276, 98) + self.label = QtWidgets.QLabel(ApiKey) + self.label.setGeometry(QtCore.QRect(20, 10, 91, 16)) + self.label.setObjectName("label") + self.apikeyInput = QtWidgets.QLineEdit(ApiKey) + self.apikeyInput.setGeometry(QtCore.QRect(120, 10, 141, 21)) + self.apikeyInput.setObjectName("apikeyInput") + self.testButton = QtWidgets.QPushButton(ApiKey) + self.testButton.setGeometry(QtCore.QRect(14, 40, 111, 24)) + self.testButton.setObjectName("testButton") + self.saveButton = QtWidgets.QPushButton(ApiKey) + self.saveButton.setGeometry(QtCore.QRect(140, 40, 121, 24)) + self.saveButton.setObjectName("saveButton") + self.outputLabel = QtWidgets.QLabel(ApiKey) + self.outputLabel.setGeometry(QtCore.QRect(20, 70, 231, 16)) + self.outputLabel.setObjectName("outputLabel") + + self.retranslateUi(ApiKey) + QtCore.QMetaObject.connectSlotsByName(ApiKey) + + def retranslateUi(self, ApiKey): + _translate = QtCore.QCoreApplication.translate + ApiKey.setWindowTitle(_translate("ApiKey", "Form")) + self.label.setText(_translate("ApiKey", "OpenAI API-Key")) + self.testButton.setText(_translate("ApiKey", "Test Key")) + self.saveButton.setText(_translate("ApiKey", "Save")) + self.outputLabel.setText(_translate("ApiKey", "Key working...")) diff --git a/gui/apikey.ui b/gui/gui/apikey.ui similarity index 80% rename from gui/apikey.ui rename to gui/gui/apikey.ui index 3fe0831..177deb5 100644 --- a/gui/apikey.ui +++ b/gui/gui/apikey.ui @@ -1,13 +1,13 @@ - Form - + ApiKey + 0 0 - 265 - 91 + 276 + 98 @@ -26,17 +26,17 @@ OpenAI API-Key - + - 110 + 120 10 141 21 - + 14 @@ -49,10 +49,10 @@ Test Key - + - 134 + 140 40 121 24 @@ -62,7 +62,7 @@ Save - + 20 diff --git a/gui/gui/connection.py b/gui/gui/connection.py new file mode 100644 index 0000000..fecd934 --- /dev/null +++ b/gui/gui/connection.py @@ -0,0 +1,86 @@ +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file 'connection.ui' +# +# Created by: PyQt5 UI code generator 5.15.9 +# +# WARNING: Any manual changes made to this file will be lost when pyuic5 is +# run again. Do not edit this file unless you know what you are doing. + + +from PyQt5 import QtCore, QtGui, QtWidgets + + +class Ui_Connection(object): + def setupUi(self, Connection): + Connection.setObjectName("Connection") + Connection.resize(249, 252) + self.label = QtWidgets.QLabel(Connection) + self.label.setGeometry(QtCore.QRect(20, 10, 101, 16)) + self.label.setObjectName("label") + self.label_2 = QtWidgets.QLabel(Connection) + self.label_2.setGeometry(QtCore.QRect(20, 70, 49, 16)) + self.label_2.setObjectName("label_2") + self.label_3 = QtWidgets.QLabel(Connection) + self.label_3.setGeometry(QtCore.QRect(20, 100, 61, 16)) + self.label_3.setObjectName("label_3") + self.label_4 = QtWidgets.QLabel(Connection) + self.label_4.setGeometry(QtCore.QRect(20, 130, 81, 16)) + self.label_4.setObjectName("label_4") + self.label_5 = QtWidgets.QLabel(Connection) + self.label_5.setGeometry(QtCore.QRect(20, 160, 61, 16)) + self.label_5.setObjectName("label_5") + self.portInput = QtWidgets.QLineEdit(Connection) + self.portInput.setGeometry(QtCore.QRect(100, 70, 131, 21)) + self.portInput.setText("") + self.portInput.setObjectName("portInput") + self.usernameInput = QtWidgets.QLineEdit(Connection) + self.usernameInput.setGeometry(QtCore.QRect(100, 100, 131, 21)) + self.usernameInput.setText("") + self.usernameInput.setObjectName("usernameInput") + self.passwordInput = QtWidgets.QLineEdit(Connection) + self.passwordInput.setGeometry(QtCore.QRect(100, 130, 131, 21)) + self.passwordInput.setInputMethodHints(QtCore.Qt.ImhHiddenText|QtCore.Qt.ImhSensitiveData) + self.passwordInput.setObjectName("passwordInput") + self.databaseInput = QtWidgets.QLineEdit(Connection) + self.databaseInput.setGeometry(QtCore.QRect(100, 160, 131, 21)) + self.databaseInput.setObjectName("databaseInput") + self.testButton = QtWidgets.QPushButton(Connection) + self.testButton.setEnabled(False) + self.testButton.setGeometry(QtCore.QRect(14, 190, 101, 24)) + self.testButton.setObjectName("testButton") + self.saveButton = QtWidgets.QPushButton(Connection) + self.saveButton.setEnabled(False) + self.saveButton.setGeometry(QtCore.QRect(130, 190, 101, 24)) + self.saveButton.setObjectName("saveButton") + self.returnLabel = QtWidgets.QLabel(Connection) + self.returnLabel.setGeometry(QtCore.QRect(20, 220, 211, 16)) + self.returnLabel.setObjectName("returnLabel") + self.label_6 = QtWidgets.QLabel(Connection) + self.label_6.setGeometry(QtCore.QRect(20, 40, 101, 16)) + self.label_6.setObjectName("label_6") + self.ipInput = QtWidgets.QLineEdit(Connection) + self.ipInput.setGeometry(QtCore.QRect(100, 40, 131, 21)) + self.ipInput.setText("") + self.ipInput.setObjectName("ipInput") + self.dbtypeCombo = QtWidgets.QComboBox(Connection) + self.dbtypeCombo.setGeometry(QtCore.QRect(100, 10, 131, 22)) + self.dbtypeCombo.setObjectName("dbtypeCombo") + self.dbtypeCombo.addItem("") + + self.retranslateUi(Connection) + QtCore.QMetaObject.connectSlotsByName(Connection) + + def retranslateUi(self, Connection): + _translate = QtCore.QCoreApplication.translate + Connection.setWindowTitle(_translate("Connection", "Form")) + self.label.setText(_translate("Connection", "Database")) + self.label_2.setText(_translate("Connection", "Port")) + self.label_3.setText(_translate("Connection", "Username")) + self.label_4.setText(_translate("Connection", "Password")) + self.label_5.setText(_translate("Connection", "Database")) + self.testButton.setText(_translate("Connection", "Test Connection")) + self.saveButton.setText(_translate("Connection", "Save")) + self.returnLabel.setText(_translate("Connection", "Connection ... / Saved...")) + self.label_6.setText(_translate("Connection", "IP")) + self.dbtypeCombo.setItemText(0, _translate("Connection", "PostgrSQL")) diff --git a/gui/connection.ui b/gui/gui/connection.ui similarity index 78% rename from gui/connection.ui rename to gui/gui/connection.ui index 8d32d5e..03b9ca3 100644 --- a/gui/connection.ui +++ b/gui/gui/connection.ui @@ -1,13 +1,13 @@ - Form - + Connection + 0 0 249 - 217 + 252 @@ -23,14 +23,14 @@ - IP + Database 20 - 40 + 70 49 16 @@ -43,7 +43,7 @@ 20 - 70 + 100 61 16 @@ -56,7 +56,7 @@ 20 - 100 + 130 81 16 @@ -69,7 +69,7 @@ 20 - 130 + 160 61 16 @@ -78,33 +78,7 @@ Database - - - - 100 - 10 - 131 - 21 - - - - - - - - - - 100 - 40 - 131 - 21 - - - - - - - + 100 @@ -117,7 +91,7 @@ - + 100 @@ -126,11 +100,11 @@ 21 - - Qt::ImhHiddenText|Qt::ImhSensitiveData + + - + 100 @@ -139,15 +113,28 @@ 21 + + Qt::ImhHiddenText|Qt::ImhSensitiveData + - + + + + 100 + 160 + 131 + 21 + + + + false 14 - 160 + 190 101 24 @@ -163,7 +150,7 @@ 130 - 160 + 190 101 24 @@ -176,7 +163,7 @@ 20 - 190 + 220 211 16 @@ -185,24 +172,48 @@ Connection ... / Saved... + + + + 20 + 40 + 101 + 16 + + + + IP + + + + + + 100 + 40 + 131 + 21 + + + + + + + + + + 100 + 10 + 131 + 22 + + + + + PostgrSQL + + + - - - IP - textChanged(QString) - saveButton - customSlot() - - - 171 - 25 - - - 199 - 170 - - - - + diff --git a/gui/gui/convert.py b/gui/gui/convert.py new file mode 100644 index 0000000..4ce55d6 --- /dev/null +++ b/gui/gui/convert.py @@ -0,0 +1,23 @@ +import os +import subprocess + + +def convert(): + # get a list of all .ui files in the current directory + ui_files = [f for f in os.listdir('.') if f.endswith('.ui')] + + # loop over each .ui file and convert it to a .py file + for ui_filename in ui_files: + # construct the name of the output .py file + py_filename = os.path.splitext(ui_filename)[0] + '.py' + + # run the pyuic5 command to convert the .ui file to a .py file + cmd = f'pyuic5 {ui_filename} -o {py_filename}' + subprocess.call(cmd, shell=True) + + # print a message to indicate that the conversion is complete + print(f'{ui_filename} converted to {py_filename}') + + +if __name__ == '__main__': + convert()