Added reminder

This commit is contained in:
BarsTiger
2022-03-21 09:37:41 +02:00
parent abff3a543e
commit d9792a4272
3 changed files with 25 additions and 40 deletions

View File

@@ -44,7 +44,7 @@ if __name__ == "__main__":
# ---------------- Launching GUI ---------------- # ---------------- Launching GUI ----------------
import OfficialProjects.LAUNCHERFILES.KOTIKOTlauncherMain as kkui import OfficialProjects.LAUNCHERFILES.KOTIKOTlauncherMain as kkui
import OfficialProjects.LAUNCHERFILES.KOTIKOTlauncherSettings as kkset import OfficialProjects.LAUNCHERFILES.KOTIKOTlauncherSettings as kkset
import OfficialProjects.LAUNCHERFILES.KOTIKOTlauncherReminder as kkrem from OfficialProjects.LAUNCHERFILES.KOTIKOTlauncherReminder import popup
app = kkui.QtWidgets.QApplication(sys.argv) app = kkui.QtWidgets.QApplication(sys.argv)
KOTIKOTlauncher = kkui.QtWidgets.QMainWindow() KOTIKOTlauncher = kkui.QtWidgets.QMainWindow()
@@ -57,17 +57,13 @@ KOTIKOTsettings = kkset.QtWidgets.QMainWindow()
uiset = kkset.Ui_Form() uiset = kkset.Ui_Form()
uiset.setupUi(KOTIKOTsettings) uiset.setupUi(KOTIKOTsettings)
KOTIKOTreminder = kkrem.QtWidgets.QMainWindow()
uirem = kkrem.Ui_Form()
uirem.setupUi(KOTIKOTreminder)
# ---------------- Launching programs ---------------- # ---------------- Launching programs ----------------
def openSettings(): def openSettings():
KOTIKOTsettings.show() KOTIKOTsettings.show()
def download_app(app): def downloadApp(app):
for url in app['urls']: for url in app['urls']:
print('Downloading ' + url) print('Downloading ' + url)
urllib.request.urlretrieve(url, offprojects + app['dir'] + "/" + url.split("/")[-1]) urllib.request.urlretrieve(url, offprojects + app['dir'] + "/" + url.split("/")[-1])
@@ -83,7 +79,7 @@ def launchApp():
if not os.path.exists(directory): if not os.path.exists(directory):
os.mkdir(directory) os.mkdir(directory)
download_app(app) downloadApp(app)
else: else:
try: try:
@@ -95,14 +91,19 @@ def launchApp():
print('Current app version is ' + str(v) + ' and new version is ' print('Current app version is ' + str(v) + ' and new version is '
+ requests.get('/'.join(app['urls'][0].split('/')[:-1]) + '/v').text) + requests.get('/'.join(app['urls'][0].split('/')[:-1]) + '/v').text)
print('Updating...') print('Updating...')
download_app(app) downloadApp(app)
urllib.request.urlretrieve('/'.join(app['urls'][0].split('/')[:-1]) + '/v', urllib.request.urlretrieve('/'.join(app['urls'][0].split('/')[:-1]) + '/v',
offprojects + app['dir'] + "/v") offprojects + app['dir'] + "/v")
display_name = name.replace('\n', '') display_name = name.replace('\n', '')
print(f"---------------- {display_name} ----------------") print(f"---------------- {display_name} ----------------")
try:
subprocess.Popen(str(sys.executable + " " if app['runtime'] == "python" else "") + app['run'], cwd=directory, subprocess.Popen(str(sys.executable + " " if app['runtime'] == "python" else "") + app['run'], cwd=directory,
shell=True, close_fds=True) shell=True, close_fds=True)
except:
popup('Could not launch ' + display_name + ', please try again', 'Error')
if not app['window']:
popup('This app opened in terminal')
# ---------------- Checking buttons ---------------- # ---------------- Checking buttons ----------------

View File

@@ -1,31 +1,15 @@
from PyQt5 import QtCore, QtGui, QtWidgets import ctypes
class Ui_Form(object): def popup(text, title="KOTIKOT_launcher", style=0):
def setupUi(self, Form): """
Form.setObjectName("Form") Styles:
Form.resize(436, 98) 0 : OK
self.label = QtWidgets.QLabel(Form) 1 : OK | Cancel
self.label.setGeometry(QtCore.QRect(10, 10, 411, 81)) 2 : Abort | Retry | Ignore
font = QtGui.QFont() 3 : Yes | No | Cancel
font.setPointSize(20) 4 : Yes | No
self.label.setFont(font) 5 : Retry | Cancel
self.label.setObjectName("label") 6 : Cancel | Try Again | Continue
"""
self.retranslateUi(Form) return ctypes.windll.user32.MessageBoxW(0, text, title, style)
QtCore.QMetaObject.connectSlotsByName(Form)
def retranslateUi(self, Form):
_translate = QtCore.QCoreApplication.translate
Form.setWindowTitle(_translate("Form", "ALWAYS CHECK TERMINAL"))
self.label.setText(_translate("Form", "This app opened in terminal"))
if __name__ == "__main__":
import sys
app = QtWidgets.QApplication(sys.argv)
Form = QtWidgets.QWidget()
ui = Ui_Form()
ui.setupUi(Form)
Form.show()
sys.exit(app.exec_())

View File

@@ -1 +1 @@
2 3