Skip to content

Commit d8c6cb5

Browse files
committed
Removing some features from updater
1 parent 613439a commit d8c6cb5

File tree

4 files changed

+7
-163
lines changed

4 files changed

+7
-163
lines changed

main.py

Lines changed: 5 additions & 140 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
from dialogExecution.editVirtualMachine import EditVirtualMachineDialog
1515
from dialogExecution.noUpdateAvailable import NoUpdateAvailable
1616
from dialogExecution.updateAvailable import UpdateAvailable
17-
import datetime
1817
import requests
1918

2019
class Window(QMainWindow, Ui_MainWindow):
@@ -25,9 +24,9 @@ def __init__(self, parent=None):
2524
self.connectSignalsSlots()
2625
self.timer = QTimer()
2726
self.timer.timeout.connect(self.updateVmList)
28-
self.label_8.setText("EmuGUI v0.5.0.1 (Pre-release)")
27+
self.label_8.setText("EmuGUI v0.5.0.2 (Pre-release)")
2928
self.setWindowTitle("EmuGUI")
30-
self.versionCode = 5001
29+
self.versionCode = 5002
3130

3231
if platform.system() == "Windows":
3332
self.connection = platformSpecific.windowsSpecific.setupWindowsBackend()
@@ -232,9 +231,6 @@ def prepareDatabase(self, connection):
232231

233232
# For the frequency, it's as follows:
234233
# boot = Everytime I run this program
235-
# daily = Every day
236-
# weekly = Every week
237-
# monthly = Every month
238234
# never = Never
239235
insert_update_freq = """
240236
INSERT INTO updater (
@@ -244,18 +240,6 @@ def prepareDatabase(self, connection):
244240
);
245241
"""
246242

247-
# For the appointment, it's as follows:
248-
# boot = Do it as soon as it starts, no matter what
249-
# A specific date, e.g. 2022-07-09
250-
# never = Never update automatically
251-
insert_next_update = """
252-
INSERT INTO updater (
253-
name, value
254-
) VALUES (
255-
"updateappointment", "boot"
256-
);
257-
"""
258-
259243
# stable and pre-release are available
260244
insert_update_channel = """
261245
INSERT INTO updater (
@@ -314,11 +298,6 @@ def prepareDatabase(self, connection):
314298
WHERE name = "updatefreq";
315299
"""
316300

317-
select_next_update = """
318-
SELECT name, value FROM updater
319-
WHERE name = "updateappointment";
320-
"""
321-
322301
select_update_channel = """
323302
SELECT name, value FROM updater
324303
WHERE name = "updatechannel";
@@ -514,21 +493,14 @@ def prepareDatabase(self, connection):
514493

515494
try:
516495
qemu_img_slot = str(result[0])
496+
print(result)
517497

518498
if result[0][1] == "boot":
519499
self.comboBox_2.setCurrentIndex(0)
520-
521-
elif result[0][1] == "daily":
522-
self.comboBox_2.setCurrentIndex(1)
523-
524-
elif result[0][1] == "weekly":
525-
self.comboBox_2.setCurrentIndex(2)
526-
527-
elif result[0][1] == "monthly":
528-
self.comboBox_2.setCurrentIndex(3)
500+
self.checkForUpdates(False)
529501

530502
elif result[0][1] == "never":
531-
self.comboBox_2.setCurrentIndex(4)
503+
self.comboBox_2.setCurrentIndex(1)
532504

533505
print("The query was executed successfully. The update mirror slot already is in the database.")
534506

@@ -540,31 +512,6 @@ def prepareDatabase(self, connection):
540512
except sqlite3.Error as e:
541513
print(f"The SQLite module encountered an error: {e}.")
542514

543-
try:
544-
cursor.execute(select_next_update)
545-
connection.commit()
546-
result = cursor.fetchall()
547-
548-
try:
549-
qemu_img_slot = str(result[0])
550-
551-
if result[0][1] == "boot":
552-
pass
553-
554-
else:
555-
date_splitter = str(result[0][1]).split("-")
556-
print(date_splitter)
557-
558-
print("The query was executed successfully. The update mirror slot already is in the database.")
559-
560-
except:
561-
cursor.execute(insert_next_update)
562-
connection.commit()
563-
print("The query was executed successfully. The update mirror slot has been created.")
564-
565-
except sqlite3.Error as e:
566-
print(f"The SQLite module encountered an error: {e}.")
567-
568515
try:
569516
cursor.execute(select_update_channel)
570517
connection.commit()
@@ -1093,15 +1040,6 @@ def applyChangesUpdate(self):
10931040
if self.comboBox_2.currentText() == "Everytime I run this program":
10941041
updateNotifyFreq = "boot"
10951042

1096-
elif self.comboBox_2.currentText() == "Every day":
1097-
updateNotifyFreq = "daily"
1098-
1099-
elif self.comboBox_2.currentText() == "Every week":
1100-
updateNotifyFreq = "weekly"
1101-
1102-
elif self.comboBox_2.currentText() == "Every month":
1103-
updateNotifyFreq = "monthly"
1104-
11051043
elif self.comboBox_2.currentText() == "Never":
11061044
updateNotifyFreq = "never"
11071045

@@ -1125,71 +1063,6 @@ def applyChangesUpdate(self):
11251063
WHERE name = 'updatechannel';
11261064
"""
11271065

1128-
today = datetime.date.today()
1129-
today_format = datetime.datetime.strptime(str(today), "%Y-%m-%d")
1130-
1131-
if updateNotifyFreq == "boot":
1132-
next_update_day = f"""
1133-
UPDATE updater
1134-
SET value = 'boot'
1135-
WHERE name = 'updateappointment';
1136-
"""
1137-
1138-
elif updateNotifyFreq == "daily" or updateNotifyFreq == "weekly" or updateNotifyFreq == "monthly":
1139-
if updateNotifyFreq == "daily":
1140-
next_update_notify_day = today_format + datetime.timedelta(days=1)
1141-
1142-
next_update_notify_day_only = datetime.date(
1143-
day=next_update_notify_day.day,
1144-
month=next_update_notify_day.month,
1145-
year=next_update_notify_day.year
1146-
)
1147-
1148-
print(next_update_notify_day_only)
1149-
1150-
next_update_day = f"""
1151-
UPDATE updater
1152-
SET value = '{next_update_notify_day_only}'
1153-
WHERE name = 'updateappointment';
1154-
"""
1155-
1156-
elif updateNotifyFreq == "weekly":
1157-
next_update_notify_day = today_format + datetime.timedelta(weeks=1)
1158-
1159-
next_update_notify_day_only = datetime.date(
1160-
day=next_update_notify_day.day,
1161-
month=next_update_notify_day.month,
1162-
year=next_update_notify_day.year
1163-
)
1164-
1165-
next_update_day = f"""
1166-
UPDATE updater
1167-
SET value = '{next_update_notify_day_only}'
1168-
WHERE name = 'updateappointment';
1169-
"""
1170-
1171-
elif updateNotifyFreq == "monthly":
1172-
next_update_notify_day = today_format + datetime.timedelta(weeks=4)
1173-
1174-
next_update_notify_day_only = datetime.date(
1175-
day=next_update_notify_day.day,
1176-
month=next_update_notify_day.month,
1177-
year=next_update_notify_day.year
1178-
)
1179-
1180-
next_update_day = f"""
1181-
UPDATE updater
1182-
SET value = '{next_update_notify_day_only}'
1183-
WHERE name = 'updateappointment';
1184-
"""
1185-
1186-
else:
1187-
next_update_day = f"""
1188-
UPDATE updater
1189-
SET value = 'never'
1190-
WHERE name = 'updateappointment';
1191-
"""
1192-
11931066
connection = self.connection
11941067
cursor = connection.cursor()
11951068

@@ -1217,14 +1090,6 @@ def applyChangesUpdate(self):
12171090
except sqlite3.Error as e:
12181091
print(f"The SQLite module encountered an error: {e}.")
12191092

1220-
try:
1221-
cursor.execute(next_update_day)
1222-
connection.commit()
1223-
print("The query was executed successfully.")
1224-
1225-
except sqlite3.Error as e:
1226-
print(f"The SQLite module encountered an error: {e}.")
1227-
12281093
def checkForUpdatesManually(self):
12291094
manually = True
12301095
self.checkForUpdates(manually)

ui/Main.ui

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -290,21 +290,6 @@
290290
<string>Everytime I run this program</string>
291291
</property>
292292
</item>
293-
<item>
294-
<property name="text">
295-
<string>Every day</string>
296-
</property>
297-
</item>
298-
<item>
299-
<property name="text">
300-
<string>Every week</string>
301-
</property>
302-
</item>
303-
<item>
304-
<property name="text">
305-
<string>Every month</string>
306-
</property>
307-
</item>
308293
<item>
309294
<property name="text">
310295
<string>Never</string>
-171 Bytes
Binary file not shown.

uiScripts/ui_Main.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# -*- coding: utf-8 -*-
22

33
################################################################################
4-
## Form generated from reading UI file 'MainXNiQKG.ui'
4+
## Form generated from reading UI file 'MainVuYROm.ui'
55
##
66
## Created by: Qt User Interface Compiler version 6.1.0
77
##
@@ -217,9 +217,6 @@ def setupUi(self, MainWindow):
217217
self.comboBox_2 = QComboBox(self.gridLayoutWidget_5)
218218
self.comboBox_2.addItem("")
219219
self.comboBox_2.addItem("")
220-
self.comboBox_2.addItem("")
221-
self.comboBox_2.addItem("")
222-
self.comboBox_2.addItem("")
223220
self.comboBox_2.setObjectName(u"comboBox_2")
224221

225222
self.gridLayout_6.addWidget(self.comboBox_2, 1, 1, 1, 1)
@@ -335,10 +332,7 @@ def retranslateUi(self, MainWindow):
335332
self.comboBox.setItemText(1, QCoreApplication.translate("MainWindow", u"Codeberg", None))
336333

337334
self.comboBox_2.setItemText(0, QCoreApplication.translate("MainWindow", u"Everytime I run this program", None))
338-
self.comboBox_2.setItemText(1, QCoreApplication.translate("MainWindow", u"Every day", None))
339-
self.comboBox_2.setItemText(2, QCoreApplication.translate("MainWindow", u"Every week", None))
340-
self.comboBox_2.setItemText(3, QCoreApplication.translate("MainWindow", u"Every month", None))
341-
self.comboBox_2.setItemText(4, QCoreApplication.translate("MainWindow", u"Never", None))
335+
self.comboBox_2.setItemText(1, QCoreApplication.translate("MainWindow", u"Never", None))
342336

343337
self.label_13.setText(QCoreApplication.translate("MainWindow", u"Update notify frequency", None))
344338
self.pushButton_14.setText(QCoreApplication.translate("MainWindow", u"Apply", None))

0 commit comments

Comments
 (0)