GUI development
This commit is contained in:
@@ -94,7 +94,7 @@ def get_source_gui():
|
|||||||
|
|
||||||
def upload_gui():
|
def upload_gui():
|
||||||
from modules.uploader import upload
|
from modules.uploader import upload
|
||||||
upload(True, ui, login_ui)
|
upload(True, ui, login_ui, UiMainWindow)
|
||||||
|
|
||||||
|
|
||||||
# Run functions on startup
|
# Run functions on startup
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import json
|
|||||||
import modules.vars as horsy_vars
|
import modules.vars as horsy_vars
|
||||||
|
|
||||||
|
|
||||||
def get_auth(is_gui=False, login_ui=None):
|
def get_auth(is_gui=False, login_ui=None, Ui_LoginWindow=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)
|
||||||
|
|
||||||
@@ -24,17 +24,19 @@ def get_auth(is_gui=False, login_ui=None):
|
|||||||
print('[OK] Auth created')
|
print('[OK] Auth created')
|
||||||
return config['auth']
|
return config['auth']
|
||||||
else:
|
else:
|
||||||
login_ui.show()
|
Ui_LoginWindow.show()
|
||||||
login_ui.login_button.clicked.connect(lambda: get_auth(login_ui=login_ui))
|
login_ui.login_button.clicked.connect(lambda: get_gui_auth(login_ui=login_ui,
|
||||||
|
Ui_LoginWindow=Ui_LoginWindow))
|
||||||
|
|
||||||
|
|
||||||
def get_gui_auth(login_ui):
|
def get_gui_auth(login_ui, Ui_LoginWindow):
|
||||||
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)
|
||||||
if login_ui.email_box.text() != '' and login_ui.password_box.text() != '':
|
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()}
|
config['auth'] = {'email': login_ui.email_box.text(), 'password': login_ui.password_box.text()}
|
||||||
json.dump(config, f)
|
json.dump(config, f)
|
||||||
|
Ui_LoginWindow.close()
|
||||||
|
|
||||||
|
|
||||||
def del_auth():
|
def del_auth():
|
||||||
|
|||||||
@@ -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, login_ui=None):
|
def upload(is_gui=False, ui=None, login_ui=None, Ui_LoginWindow=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, login_ui=None):
|
|||||||
}
|
}
|
||||||
|
|
||||||
else:
|
else:
|
||||||
auth = get_auth(is_gui)
|
auth = get_auth(is_gui, login_ui, Ui_LoginWindow)
|
||||||
|
|
||||||
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:
|
||||||
|
|||||||
Reference in New Issue
Block a user