Skip to content

Commit b4f28a7

Browse files
author
User0
committed
Revert "Small update"
This reverts commit 3da54e4. Oh, F**K, pushed to the wrong repo
1 parent 3da54e4 commit b4f28a7

File tree

1 file changed

+24
-15
lines changed

1 file changed

+24
-15
lines changed

emugui.py

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,7 @@ def setLanguage(self, langmode):
410410

411411
if langmode != "system":
412412
self.languageInUse = "en"
413+
413414
def prepareDatabase(self, connection):
414415
# Some SQL statements to initialize EmuGUI
415416
create_settings_table = """
@@ -640,15 +641,13 @@ def prepareDatabase(self, connection):
640641
cursor = connection.cursor()
641642
logman = errors.logman.LogMan()
642643
logman.logFile = logman.setLogFile()
643-
def databaseUpdate(arg, msg):
644-
cursor.execute(arg)
645-
connection.commit()
646-
if msg:
647-
print(f"Action {msg} successfully committed to the database.")
644+
648645
# If they don't exist yet, the settings and VM tables are created.
649646

650647
try:
651-
databaseUpdate(create_settings_table, None)
648+
cursor.execute(create_settings_table)
649+
connection.commit()
650+
print("The settings table was created successfully.")
652651

653652
except sqlite3.Error as e:
654653
print(f"The SQLite module encountered an error: {e}.")
@@ -670,8 +669,9 @@ def databaseUpdate(arg, msg):
670669
dialog.exec()
671670

672671
try:
673-
databaseUpdate(create_vm_table, None)
674-
672+
cursor.execute(create_vm_table)
673+
connection.commit()
674+
print("The VM table was created successfully.")
675675

676676
except sqlite3.Error as e:
677677
print(f"The SQLite module encountered an error: {e}.")
@@ -693,15 +693,18 @@ def databaseUpdate(arg, msg):
693693
dialog.exec()
694694

695695
try:
696-
databaseUpdate(create_update_table, None)
696+
cursor.execute(create_update_table)
697+
connection.commit()
698+
print("The update table was created successfully.")
697699

698700
except sqlite3.Error as e:
699701
print(f"The SQLite module encountered an error: {e}.")
700702

701703
# Then, the tables will be checked for completeness.
702704

703705
try:
704-
databaseUpdate(select_qemu_img, None)
706+
cursor.execute(select_qemu_img)
707+
connection.commit()
705708
result = cursor.fetchall()
706709

707710
try:
@@ -710,7 +713,9 @@ def databaseUpdate(arg, msg):
710713
print("The query was executed successfully. The qemu-img slot already is in the database.")
711714

712715
except:
713-
databaseUpdate(insert_qemu_img, "create qemu-img slot")
716+
cursor.execute(insert_qemu_img)
717+
connection.commit()
718+
print("The query was executed successfully. The qemu-img slot has been created.")
714719

715720
except sqlite3.Error as e:
716721
print(f"The SQLite module encountered an error: {e}.")
@@ -743,7 +748,8 @@ def databaseUpdate(arg, msg):
743748
"""
744749

745750
try:
746-
databaseUpdate(sel_query, None)
751+
cursor.execute(sel_query)
752+
connection.commit()
747753
result = cursor.fetchall()
748754

749755
try:
@@ -752,7 +758,9 @@ def databaseUpdate(arg, msg):
752758
print(f"The query was executed successfully. The qemu-system-{architecture[0]} slot already is in the database.")
753759

754760
except:
755-
databaseUpdate(ins_query, f"create gemu-system-architecture[0] slot")
761+
cursor.execute(ins_query)
762+
connection.commit()
763+
print(f"The query was executed successfully. The qemu-system-{architecture[0]} slot has been created.")
756764

757765
except sqlite3.Error as e:
758766
print(f"The SQLite module encountered an error: {e}.")
@@ -774,7 +782,8 @@ def databaseUpdate(arg, msg):
774782
dialog.exec()
775783

776784
try:
777-
databaseUpdate(select_language, None)
785+
cursor.execute(select_language)
786+
connection.commit()
778787
result = cursor.fetchall()
779788

780789
# Language modes
@@ -3748,4 +3757,4 @@ def toGuilded(self):
37483757

37493758
win = Window()
37503759
win.show()
3751-
sys.exit(app.exec())
3760+
sys.exit(app.exec())

0 commit comments

Comments
 (0)