GUI development
This commit is contained in:
@@ -15,6 +15,10 @@ ui = gui.Ui_MainWindow()
|
|||||||
ui.setupUi(MainWindow)
|
ui.setupUi(MainWindow)
|
||||||
MainWindow.show()
|
MainWindow.show()
|
||||||
|
|
||||||
|
UiMainWindow = QtWidgets.QMainWindow()
|
||||||
|
login_ui = gui.Ui_LoginWindow()
|
||||||
|
login_ui.setupUi(UiMainWindow)
|
||||||
|
|
||||||
|
|
||||||
# Functions
|
# Functions
|
||||||
def refresh_gui():
|
def refresh_gui():
|
||||||
@@ -90,7 +94,8 @@ def get_source_gui():
|
|||||||
|
|
||||||
def upload_gui():
|
def upload_gui():
|
||||||
from modules.uploader import upload
|
from modules.uploader import upload
|
||||||
upload(True, ui)
|
upload(True, ui, login_ui)
|
||||||
|
|
||||||
|
|
||||||
# Run functions on startup
|
# Run functions on startup
|
||||||
installed_apps()
|
installed_apps()
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import json
|
|||||||
import modules.vars as horsy_vars
|
import modules.vars as horsy_vars
|
||||||
|
|
||||||
|
|
||||||
def get_auth():
|
def get_auth(is_gui=False, login_ui=None):
|
||||||
with open(horsy_vars.horsypath + 'config.cfg') as f:
|
with open(horsy_vars.horsypath + 'config.cfg') as f:
|
||||||
config = json.load(f)
|
config = json.load(f)
|
||||||
|
|
||||||
@@ -12,16 +12,29 @@ def get_auth():
|
|||||||
else:
|
else:
|
||||||
raise Exception('No auth found')
|
raise Exception('No auth found')
|
||||||
except:
|
except:
|
||||||
print('[!] No auth found, please login first')
|
if not is_gui:
|
||||||
print('email')
|
print('[!] No auth found, please login first')
|
||||||
email = input('> ')
|
print('email')
|
||||||
print('password')
|
email = input('> ')
|
||||||
password = input('> ')
|
print('password')
|
||||||
config['auth'] = {'email': email, 'password': password}
|
password = input('> ')
|
||||||
|
config['auth'] = {'email': email, 'password': password}
|
||||||
|
with open(horsy_vars.horsypath + 'config.cfg', 'w') as f:
|
||||||
|
json.dump(config, f)
|
||||||
|
print('[OK] Auth created')
|
||||||
|
return config['auth']
|
||||||
|
else:
|
||||||
|
login_ui.show()
|
||||||
|
login_ui.login_button.clicked.connect(lambda: get_auth(login_ui=login_ui))
|
||||||
|
|
||||||
|
|
||||||
|
def get_gui_auth(login_ui):
|
||||||
|
with open(horsy_vars.horsypath + 'config.cfg') as f:
|
||||||
|
config = json.load(f)
|
||||||
|
if login_ui.email_box.text() != '' and login_ui.password_box.text() != '':
|
||||||
with open(horsy_vars.horsypath + 'config.cfg', 'w') as f:
|
with open(horsy_vars.horsypath + 'config.cfg', 'w') as f:
|
||||||
|
config['auth'] = {'email': login_ui.email_box.text(), 'password': login_ui.password_box.text()}
|
||||||
json.dump(config, f)
|
json.dump(config, f)
|
||||||
print('[OK] Auth created')
|
|
||||||
return config['auth']
|
|
||||||
|
|
||||||
|
|
||||||
def del_auth():
|
def del_auth():
|
||||||
|
|||||||
@@ -676,6 +676,77 @@ class Ui_MainWindow(object):
|
|||||||
self.horsy_text_lefttop.setText(_translate("MainWindow", "horsy"))
|
self.horsy_text_lefttop.setText(_translate("MainWindow", "horsy"))
|
||||||
|
|
||||||
|
|
||||||
|
class Ui_LoginWindow(object):
|
||||||
|
def setupUi(self, MainWindow):
|
||||||
|
MainWindow.setObjectName("MainWindow")
|
||||||
|
MainWindow.resize(292, 200)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(MainWindow.sizePolicy().hasHeightForWidth())
|
||||||
|
MainWindow.setSizePolicy(sizePolicy)
|
||||||
|
MainWindow.setMinimumSize(QtCore.QSize(292, 200))
|
||||||
|
MainWindow.setMaximumSize(QtCore.QSize(292, 200))
|
||||||
|
MainWindow.setFocusPolicy(QtCore.Qt.NoFocus)
|
||||||
|
MainWindow.setContextMenuPolicy(QtCore.Qt.NoContextMenu)
|
||||||
|
MainWindow.setWindowOpacity(0.98)
|
||||||
|
MainWindow.setStyleSheet("QWidget{\n"
|
||||||
|
" background-color: rgb(30, 30, 30);\n"
|
||||||
|
"}\n"
|
||||||
|
"")
|
||||||
|
MainWindow.setDockOptions(QtWidgets.QMainWindow.AllowTabbedDocks | QtWidgets.QMainWindow.AnimatedDocks)
|
||||||
|
self.centralwidget = QtWidgets.QWidget(MainWindow)
|
||||||
|
self.centralwidget.setObjectName("centralwidget")
|
||||||
|
self.login_button = QtWidgets.QPushButton(self.centralwidget)
|
||||||
|
self.login_button.setEnabled(True)
|
||||||
|
self.login_button.setGeometry(QtCore.QRect(70, 140, 151, 50))
|
||||||
|
self.login_button.setMinimumSize(QtCore.QSize(0, 50))
|
||||||
|
self.login_button.setStyleSheet("QPushButton {\n"
|
||||||
|
" color: rgb(204, 204, 204);\n"
|
||||||
|
" border-width: 1px;\n"
|
||||||
|
" border-radius:6px;\n"
|
||||||
|
" border-style: solid;\n"
|
||||||
|
" background-color: rgb(28, 30, 33);\n"
|
||||||
|
" border-color: rgb(66, 143, 225);\n"
|
||||||
|
"}\n"
|
||||||
|
"QPushButton:hover{\n"
|
||||||
|
" border-width: 2px;\n"
|
||||||
|
"}\n"
|
||||||
|
"QPushButton:pressed{\n"
|
||||||
|
" background-color: rgb(50, 60, 63);\n"
|
||||||
|
"}\n"
|
||||||
|
"QPushButton:disabled{\n"
|
||||||
|
" border-width: 0px;\n"
|
||||||
|
" background-color: rgb(92, 99, 109);\n"
|
||||||
|
"}")
|
||||||
|
self.login_button.setObjectName("login_button")
|
||||||
|
self.email_box = QtWidgets.QLineEdit(self.centralwidget)
|
||||||
|
self.email_box.setGeometry(QtCore.QRect(20, 20, 251, 51))
|
||||||
|
self.email_box.setStyleSheet("background-color: rgb(74, 76, 83);\n"
|
||||||
|
"border-radius: 5px; \n"
|
||||||
|
"color: rgb(242, 242, 242);")
|
||||||
|
self.email_box.setObjectName("email_box")
|
||||||
|
self.password_box = QtWidgets.QLineEdit(self.centralwidget)
|
||||||
|
self.password_box.setGeometry(QtCore.QRect(20, 80, 251, 51))
|
||||||
|
self.password_box.setStyleSheet("background-color: rgb(74, 76, 83);\n"
|
||||||
|
"border-radius: 5px; \n"
|
||||||
|
"color: rgb(242, 242, 242);")
|
||||||
|
self.password_box.setInputMask("")
|
||||||
|
self.password_box.setEchoMode(QtWidgets.QLineEdit.PasswordEchoOnEdit)
|
||||||
|
self.password_box.setObjectName("password_box")
|
||||||
|
MainWindow.setCentralWidget(self.centralwidget)
|
||||||
|
|
||||||
|
self.retranslateUi(MainWindow)
|
||||||
|
QtCore.QMetaObject.connectSlotsByName(MainWindow)
|
||||||
|
|
||||||
|
def retranslateUi(self, MainWindow):
|
||||||
|
_translate = QtCore.QCoreApplication.translate
|
||||||
|
MainWindow.setWindowTitle(_translate("MainWindow", "Log in"))
|
||||||
|
self.login_button.setText(_translate("MainWindow", "Log in"))
|
||||||
|
self.email_box.setPlaceholderText(_translate("MainWindow", "email"))
|
||||||
|
self.password_box.setPlaceholderText(_translate("MainWindow", "Password"))
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ def urlmatch(s):
|
|||||||
return re.match("^https?://.*.(?:zip|exe)$", s) is not None
|
return re.match("^https?://.*.(?:zip|exe)$", s) is not None
|
||||||
|
|
||||||
|
|
||||||
def upload(is_gui=False, ui=None):
|
def upload(is_gui=False, ui=None, login_ui=None):
|
||||||
if not is_gui:
|
if not is_gui:
|
||||||
print('Welcome to the uploader')
|
print('Welcome to the uploader')
|
||||||
print('Before starting, please make sure you have done your project and [blink]uploaded[/] it to any hosting '
|
print('Before starting, please make sure you have done your project and [blink]uploaded[/] it to any hosting '
|
||||||
@@ -93,7 +93,7 @@ def upload(is_gui=False, ui=None):
|
|||||||
}
|
}
|
||||||
|
|
||||||
else:
|
else:
|
||||||
auth = get_auth()
|
auth = get_auth(is_gui)
|
||||||
|
|
||||||
project_name = ui.packagename_box.text()
|
project_name = ui.packagename_box.text()
|
||||||
if not matches(project_name) or len(project_name) > 64 or len(project_name) < 3:
|
if not matches(project_name) or len(project_name) > 64 or len(project_name) < 3:
|
||||||
|
|||||||
92
uis/horsy_login.py
Normal file
92
uis/horsy_login.py
Normal file
@@ -0,0 +1,92 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Form implementation generated from reading ui file 'D:\RAZNOE\prgrming\horsy\Source\client\uis\horsy_login.ui'
|
||||||
|
#
|
||||||
|
# Created by: PyQt5 UI code generator 5.15.6
|
||||||
|
#
|
||||||
|
# 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_MainWindow(object):
|
||||||
|
def setupUi(self, MainWindow):
|
||||||
|
MainWindow.setObjectName("MainWindow")
|
||||||
|
MainWindow.resize(292, 200)
|
||||||
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
|
||||||
|
sizePolicy.setHorizontalStretch(0)
|
||||||
|
sizePolicy.setVerticalStretch(0)
|
||||||
|
sizePolicy.setHeightForWidth(MainWindow.sizePolicy().hasHeightForWidth())
|
||||||
|
MainWindow.setSizePolicy(sizePolicy)
|
||||||
|
MainWindow.setMinimumSize(QtCore.QSize(292, 200))
|
||||||
|
MainWindow.setMaximumSize(QtCore.QSize(292, 200))
|
||||||
|
MainWindow.setFocusPolicy(QtCore.Qt.NoFocus)
|
||||||
|
MainWindow.setContextMenuPolicy(QtCore.Qt.NoContextMenu)
|
||||||
|
MainWindow.setWindowOpacity(0.98)
|
||||||
|
MainWindow.setStyleSheet("QWidget{\n"
|
||||||
|
" background-color: rgb(30, 30, 30);\n"
|
||||||
|
"}\n"
|
||||||
|
"")
|
||||||
|
MainWindow.setDockOptions(QtWidgets.QMainWindow.AllowTabbedDocks|QtWidgets.QMainWindow.AnimatedDocks)
|
||||||
|
self.centralwidget = QtWidgets.QWidget(MainWindow)
|
||||||
|
self.centralwidget.setObjectName("centralwidget")
|
||||||
|
self.login_button = QtWidgets.QPushButton(self.centralwidget)
|
||||||
|
self.login_button.setEnabled(True)
|
||||||
|
self.login_button.setGeometry(QtCore.QRect(70, 140, 151, 50))
|
||||||
|
self.login_button.setMinimumSize(QtCore.QSize(0, 50))
|
||||||
|
self.login_button.setStyleSheet("QPushButton {\n"
|
||||||
|
" color: rgb(204, 204, 204);\n"
|
||||||
|
" border-width: 1px;\n"
|
||||||
|
" border-radius:6px;\n"
|
||||||
|
" border-style: solid;\n"
|
||||||
|
" background-color: rgb(28, 30, 33);\n"
|
||||||
|
" border-color: rgb(66, 143, 225);\n"
|
||||||
|
"}\n"
|
||||||
|
"QPushButton:hover{\n"
|
||||||
|
" border-width: 2px;\n"
|
||||||
|
"}\n"
|
||||||
|
"QPushButton:pressed{\n"
|
||||||
|
" background-color: rgb(50, 60, 63);\n"
|
||||||
|
"}\n"
|
||||||
|
"QPushButton:disabled{\n"
|
||||||
|
" border-width: 0px;\n"
|
||||||
|
" background-color: rgb(92, 99, 109);\n"
|
||||||
|
"}")
|
||||||
|
self.login_button.setObjectName("login_button")
|
||||||
|
self.email_box = QtWidgets.QLineEdit(self.centralwidget)
|
||||||
|
self.email_box.setGeometry(QtCore.QRect(20, 20, 251, 51))
|
||||||
|
self.email_box.setStyleSheet("background-color: rgb(74, 76, 83);\n"
|
||||||
|
"border-radius: 5px; \n"
|
||||||
|
"color: rgb(242, 242, 242);")
|
||||||
|
self.email_box.setObjectName("email_box")
|
||||||
|
self.password_box = QtWidgets.QLineEdit(self.centralwidget)
|
||||||
|
self.password_box.setGeometry(QtCore.QRect(20, 80, 251, 51))
|
||||||
|
self.password_box.setStyleSheet("background-color: rgb(74, 76, 83);\n"
|
||||||
|
"border-radius: 5px; \n"
|
||||||
|
"color: rgb(242, 242, 242);")
|
||||||
|
self.password_box.setInputMask("")
|
||||||
|
self.password_box.setEchoMode(QtWidgets.QLineEdit.PasswordEchoOnEdit)
|
||||||
|
self.password_box.setObjectName("password_box")
|
||||||
|
MainWindow.setCentralWidget(self.centralwidget)
|
||||||
|
|
||||||
|
self.retranslateUi(MainWindow)
|
||||||
|
QtCore.QMetaObject.connectSlotsByName(MainWindow)
|
||||||
|
|
||||||
|
def retranslateUi(self, MainWindow):
|
||||||
|
_translate = QtCore.QCoreApplication.translate
|
||||||
|
MainWindow.setWindowTitle(_translate("MainWindow", "Log in"))
|
||||||
|
self.login_button.setText(_translate("MainWindow", "Log in"))
|
||||||
|
self.email_box.setPlaceholderText(_translate("MainWindow", "email"))
|
||||||
|
self.password_box.setPlaceholderText(_translate("MainWindow", "Password"))
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
import sys
|
||||||
|
app = QtWidgets.QApplication(sys.argv)
|
||||||
|
MainWindow = QtWidgets.QMainWindow()
|
||||||
|
ui = Ui_MainWindow()
|
||||||
|
ui.setupUi(MainWindow)
|
||||||
|
MainWindow.show()
|
||||||
|
sys.exit(app.exec_())
|
||||||
141
uis/horsy_login.ui
Normal file
141
uis/horsy_login.ui
Normal file
@@ -0,0 +1,141 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>MainWindow</class>
|
||||||
|
<widget class="QMainWindow" name="MainWindow">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>292</width>
|
||||||
|
<height>200</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>292</width>
|
||||||
|
<height>200</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>292</width>
|
||||||
|
<height>200</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="focusPolicy">
|
||||||
|
<enum>Qt::NoFocus</enum>
|
||||||
|
</property>
|
||||||
|
<property name="contextMenuPolicy">
|
||||||
|
<enum>Qt::NoContextMenu</enum>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Log in</string>
|
||||||
|
</property>
|
||||||
|
<property name="windowOpacity">
|
||||||
|
<double>0.980000000000000</double>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">QWidget{
|
||||||
|
background-color: rgb(30, 30, 30);
|
||||||
|
}
|
||||||
|
</string>
|
||||||
|
</property>
|
||||||
|
<property name="dockOptions">
|
||||||
|
<set>QMainWindow::AllowTabbedDocks|QMainWindow::AnimatedDocks</set>
|
||||||
|
</property>
|
||||||
|
<widget class="QWidget" name="centralwidget">
|
||||||
|
<widget class="QPushButton" name="login_button">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>70</x>
|
||||||
|
<y>140</y>
|
||||||
|
<width>151</width>
|
||||||
|
<height>50</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>50</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">QPushButton {
|
||||||
|
color: rgb(204, 204, 204);
|
||||||
|
border-width: 1px;
|
||||||
|
border-radius:6px;
|
||||||
|
border-style: solid;
|
||||||
|
background-color: rgb(28, 30, 33);
|
||||||
|
border-color: rgb(66, 143, 225);
|
||||||
|
}
|
||||||
|
QPushButton:hover{
|
||||||
|
border-width: 2px;
|
||||||
|
}
|
||||||
|
QPushButton:pressed{
|
||||||
|
background-color: rgb(50, 60, 63);
|
||||||
|
}
|
||||||
|
QPushButton:disabled{
|
||||||
|
border-width: 0px;
|
||||||
|
background-color: rgb(92, 99, 109);
|
||||||
|
}</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Log in</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLineEdit" name="email_box">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>20</x>
|
||||||
|
<y>20</y>
|
||||||
|
<width>251</width>
|
||||||
|
<height>51</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">background-color: rgb(74, 76, 83);
|
||||||
|
border-radius: 5px;
|
||||||
|
color: rgb(242, 242, 242);</string>
|
||||||
|
</property>
|
||||||
|
<property name="placeholderText">
|
||||||
|
<string>email</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLineEdit" name="password_box">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>20</x>
|
||||||
|
<y>80</y>
|
||||||
|
<width>251</width>
|
||||||
|
<height>51</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">background-color: rgb(74, 76, 83);
|
||||||
|
border-radius: 5px;
|
||||||
|
color: rgb(242, 242, 242);</string>
|
||||||
|
</property>
|
||||||
|
<property name="inputMask">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="echoMode">
|
||||||
|
<enum>QLineEdit::PasswordEchoOnEdit</enum>
|
||||||
|
</property>
|
||||||
|
<property name="placeholderText">
|
||||||
|
<string>Password</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
||||||
Reference in New Issue
Block a user