Skip to content

Commit 2711aee

Browse files
committed
Added restart dialog
1 parent e84c11f commit 2711aee

File tree

8 files changed

+169
-8
lines changed

8 files changed

+169
-8
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# EmuGUI v0.6.3
2+
3+
- Added a restart dialog for general settings
4+
15
# EmuGUI v0.6.2
26

37
- Floppy & CD code for Linux has been added, what I forgot with the 0.5 lineup.
Binary file not shown.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
from uiScripts.ui_SettingsRestart import Ui_Dialog
2+
from PySide6.QtWidgets import *
3+
from PySide6 import QtGui
4+
5+
class SettingsRequireEmuGUIReboot(QDialog, Ui_Dialog):
6+
def __init__(self, parent = None):
7+
super().__init__(parent)
8+
self.setupUi(self)
9+
self.setWindowTitle("EmuGUI Settings")
10+
11+
try:
12+
self.setWindowIcon(QtGui.QIcon("EmuGUI.png"))
13+
14+
except:
15+
pass
16+
17+
self.connectSignalsSlots()
18+
19+
def connectSignalsSlots(self):
20+
self.pushButton.clicked.connect(self.close)

main.py

Lines changed: 35 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
from dialogExecution.usbTabletDepreciation import UsbTabletDepreciated
1818
from dialogExecution.win81NearEOS import Win812012R2NearEOS
1919
from dialogExecution.vmTooNew import VmIsMadeWithTooYoungEmuGUI
20+
from dialogExecution.settingsRequireRestart import SettingsRequireEmuGUIReboot
2021
import translations.de
2122
import translations.uk
2223
import translations.en
@@ -31,16 +32,17 @@ def __init__(self, parent=None):
3132
self.connectSignalsSlots()
3233
self.timer = QTimer()
3334
self.timer.timeout.connect(self.updateVmList)
34-
self.label_8.setText("EmuGUI v0.6.2")
35+
self.label_8.setText("EmuGUI v0.6.3")
3536
self.setWindowTitle("EmuGUI")
37+
self.languageInUse = "system"
3638

3739
try:
3840
self.setWindowIcon(QtGui.QIcon("EmuGUI.png"))
3941

4042
except:
4143
pass
4244

43-
self.versionCode = 5016
45+
self.versionCode = 5017
4446

4547
if platform.system() == "Windows":
4648
self.connection = platformSpecific.windowsSpecific.setupWindowsBackend()
@@ -82,19 +84,29 @@ def connectSignalsSlots(self):
8284
def setLanguage(self, langmode):
8385
if langmode == "system" or langmode == None:
8486
languageToUse = locale.getlocale()[0]
87+
self.languageInUse = "system"
8588

8689
else:
8790
languageToUse = langmode
8891

8992
if languageToUse.startswith("de"):
9093
translations.de.translateMainDE(self)
9194

95+
if langmode != "system":
96+
self.languageInUse = "de"
97+
9298
elif languageToUse.startswith("uk"):
9399
translations.uk.translateMainUK(self)
94100

101+
if langmode != "system":
102+
self.languageInUse = "uk"
103+
95104
else:
96105
translations.en.translateMainEN(self)
97106

107+
if langmode != "system":
108+
self.languageInUse = "en"
109+
98110
def prepareDatabase(self, connection):
99111
# Some SQL statements to initialize EmuGUI
100112
create_settings_table = """
@@ -1446,10 +1458,12 @@ def applyGeneric(self):
14461458
cursor = connection.cursor()
14471459

14481460
if self.comboBox_4.currentText() == "System default":
1461+
langmode = "system"
1462+
14491463
try:
14501464
cursor.execute(language_system)
14511465
connection.commit()
1452-
langmode = "system"
1466+
14531467

14541468
if platform.system() == "Windows":
14551469
langfile = platformSpecific.windowsSpecific.windowsLanguageFile()
@@ -1478,11 +1492,15 @@ def applyGeneric(self):
14781492
except sqlite3.Error as e:
14791493
print(f"The SQLite module encountered an error: {e}.")
14801494

1495+
dialog = SettingsRequireEmuGUIReboot(self)
1496+
dialog.exec()
1497+
14811498
elif self.comboBox_4.currentText() == "English":
1499+
langmode = "en"
1500+
14821501
try:
14831502
cursor.execute(language_en)
14841503
connection.commit()
1485-
langmode = "en"
14861504

14871505
if platform.system() == "Windows":
14881506
langfile = platformSpecific.windowsSpecific.windowsLanguageFile()
@@ -1511,11 +1529,15 @@ def applyGeneric(self):
15111529
except sqlite3.Error as e:
15121530
print(f"The SQLite module encountered an error: {e}.")
15131531

1532+
dialog = SettingsRequireEmuGUIReboot(self)
1533+
dialog.exec()
1534+
15141535
elif self.comboBox_4.currentText() == "Deutsch":
1536+
langmode = "de"
1537+
15151538
try:
15161539
cursor.execute(language_de)
15171540
connection.commit()
1518-
langmode = "de"
15191541

15201542
if platform.system() == "Windows":
15211543
langfile = platformSpecific.windowsSpecific.windowsLanguageFile()
@@ -1544,11 +1566,15 @@ def applyGeneric(self):
15441566
except sqlite3.Error as e:
15451567
print(f"The SQLite module encountered an error: {e}.")
15461568

1569+
dialog = SettingsRequireEmuGUIReboot(self)
1570+
dialog.exec()
1571+
15471572
elif self.comboBox_4.currentText() == "Українська":
1573+
langmode = "uk"
1574+
15481575
try:
15491576
cursor.execute(language_uk)
15501577
connection.commit()
1551-
langmode = "uk"
15521578

15531579
if platform.system() == "Windows":
15541580
langfile = platformSpecific.windowsSpecific.windowsLanguageFile()
@@ -1577,6 +1603,9 @@ def applyGeneric(self):
15771603
except sqlite3.Error as e:
15781604
print(f"The SQLite module encountered an error: {e}.")
15791605

1606+
dialog = SettingsRequireEmuGUIReboot(self)
1607+
dialog.exec()
1608+
15801609
def checkForUpdatesManually(self):
15811610
manually = True
15821611
self.checkForUpdates(manually)

ui/SettingsRestart.ui

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<ui version="4.0">
3+
<class>Dialog</class>
4+
<widget class="QDialog" name="Dialog">
5+
<property name="geometry">
6+
<rect>
7+
<x>0</x>
8+
<y>0</y>
9+
<width>400</width>
10+
<height>300</height>
11+
</rect>
12+
</property>
13+
<property name="windowTitle">
14+
<string>Dialog</string>
15+
</property>
16+
<property name="locale">
17+
<locale language="English" country="UnitedStates"/>
18+
</property>
19+
<widget class="QWidget" name="verticalLayoutWidget">
20+
<property name="geometry">
21+
<rect>
22+
<x>10</x>
23+
<y>10</y>
24+
<width>381</width>
25+
<height>281</height>
26+
</rect>
27+
</property>
28+
<layout class="QVBoxLayout" name="verticalLayout">
29+
<item>
30+
<widget class="QLabel" name="label">
31+
<property name="text">
32+
<string>Sorry but you applied some settings that require a reboot. Please restart EmuGUI.
33+
Tut uns leid, aber Sie haben Einstellungen verändert, welche einen Neustart benötigen. Bitte starten Sie EmuGUI neu.</string>
34+
</property>
35+
<property name="wordWrap">
36+
<bool>true</bool>
37+
</property>
38+
</widget>
39+
</item>
40+
<item>
41+
<widget class="QPushButton" name="pushButton">
42+
<property name="text">
43+
<string>OK</string>
44+
</property>
45+
</widget>
46+
</item>
47+
</layout>
48+
</widget>
49+
</widget>
50+
<resources/>
51+
<connections/>
52+
</ui>
2.24 KB
Binary file not shown.

uiScripts/ui_SettingsRestart.py

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# -*- coding: utf-8 -*-
2+
3+
################################################################################
4+
## Form generated from reading UI file 'SettingsRestart.ui'
5+
##
6+
## Created by: Qt User Interface Compiler version 6.3.1
7+
##
8+
## WARNING! All changes made in this file will be lost when recompiling UI file!
9+
################################################################################
10+
11+
from PySide6.QtCore import (QCoreApplication, QDate, QDateTime, QLocale,
12+
QMetaObject, QObject, QPoint, QRect,
13+
QSize, QTime, QUrl, Qt)
14+
from PySide6.QtGui import (QBrush, QColor, QConicalGradient, QCursor,
15+
QFont, QFontDatabase, QGradient, QIcon,
16+
QImage, QKeySequence, QLinearGradient, QPainter,
17+
QPalette, QPixmap, QRadialGradient, QTransform)
18+
from PySide6.QtWidgets import (QApplication, QDialog, QLabel, QPushButton,
19+
QSizePolicy, QVBoxLayout, QWidget)
20+
21+
class Ui_Dialog(object):
22+
def setupUi(self, Dialog):
23+
if not Dialog.objectName():
24+
Dialog.setObjectName(u"Dialog")
25+
Dialog.resize(400, 300)
26+
Dialog.setLocale(QLocale(QLocale.English, QLocale.UnitedStates))
27+
self.verticalLayoutWidget = QWidget(Dialog)
28+
self.verticalLayoutWidget.setObjectName(u"verticalLayoutWidget")
29+
self.verticalLayoutWidget.setGeometry(QRect(10, 10, 381, 281))
30+
self.verticalLayout = QVBoxLayout(self.verticalLayoutWidget)
31+
self.verticalLayout.setObjectName(u"verticalLayout")
32+
self.verticalLayout.setContentsMargins(0, 0, 0, 0)
33+
self.label = QLabel(self.verticalLayoutWidget)
34+
self.label.setObjectName(u"label")
35+
self.label.setWordWrap(True)
36+
37+
self.verticalLayout.addWidget(self.label)
38+
39+
self.pushButton = QPushButton(self.verticalLayoutWidget)
40+
self.pushButton.setObjectName(u"pushButton")
41+
42+
self.verticalLayout.addWidget(self.pushButton)
43+
44+
45+
self.retranslateUi(Dialog)
46+
47+
QMetaObject.connectSlotsByName(Dialog)
48+
# setupUi
49+
50+
def retranslateUi(self, Dialog):
51+
Dialog.setWindowTitle(QCoreApplication.translate("Dialog", u"Dialog", None))
52+
self.label.setText(QCoreApplication.translate("Dialog", u"Sorry but you applied some settings that require a reboot. Please restart EmuGUI.\n"
53+
"Tut uns leid, aber Sie haben Einstellungen ver\u00e4ndert, welche einen Neustart ben\u00f6tigen. Bitte starten Sie EmuGUI neu.", None))
54+
self.pushButton.setText(QCoreApplication.translate("Dialog", u"OK", None))
55+
# retranslateUi
56+

update.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
stable = 5015
2-
pre_release = 5015
1+
stable = 5016
2+
pre_release = 5016

0 commit comments

Comments
 (0)