Skip to content

Commit 0724824

Browse files
committed
Add keyboard layout support
1 parent 5de4abd commit 0724824

File tree

8 files changed

+58
-10
lines changed

8 files changed

+58
-10
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
# EmuGUI v0.9.0.5301_dev (based on v0.9.0.5300_dev)
2+
3+
## Changes compared to v0.8.0.5206
4+
5+
- The old feature list has been updated beforehand.
6+
- Also, the update file will now be created in your user directory (instead of in the root).
7+
- The database now supports the keyboard layout selection, which hasn't been implemented as of yet.
8+
- Also, this is the first release which is hosted on GitLab as well as Codeberg is not accessable in Belarus.
9+
110
# EmuGUI v0.9.0.5300_dev (based on v0.8.0.5206)
211

312
## Changes compared to v0.8.0.5206
27 Bytes
Binary file not shown.
42 Bytes
Binary file not shown.
30 Bytes
Binary file not shown.

dialogExecution/editVMNew.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -702,7 +702,8 @@ def finishCreation(self):
702702
win2k = {win2k}, dirbios = "{ext_bios_dir}", additionalargs = "{add_args}", sound = "{self.comboBox_10.currentText()}",
703703
linuxkernel = "{self.lineEdit_5.text()}", linuxinitrid = "{self.lineEdit_6.text()}", linuxcmd = "{self.lineEdit_7.text()}",
704704
mousetype = "{self.comboBox_5.currentText()}", cores = {self.spinBox_6.value()}, filebios = "{self.lineEdit_4.text()}",
705-
keyboardtype = "{self.comboBox_6.currentText()}", usbsupport = {usb_support}, usbcontroller = "{self.comboBox_9.currentText()}"
705+
keyboardtype = "{self.comboBox_6.currentText()}", usbsupport = {usb_support}, usbcontroller = "{self.comboBox_9.currentText()}",
706+
kbdtype = "en-us"
706707
WHERE name = "{self.vmSpecs[0]}";
707708
"""
708709

dialogExecution/newVirtualMachine.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,8 @@ def finishCreation(self):
537537
filebios,
538538
keyboardtype,
539539
usbsupport,
540-
usbcontroller
540+
usbcontroller,
541+
kbdtype
541542
) VALUES (
542543
"{self.lineEdit.text()}",
543544
"{self.comboBox.currentText()}",
@@ -560,7 +561,8 @@ def finishCreation(self):
560561
"{self.lineEdit_8.text()}",
561562
"{self.comboBox_16.currentText()}",
562563
{usb_support},
563-
"{self.comboBox_17.currentText()}"
564+
"{self.comboBox_17.currentText()}",
565+
"en-us"
564566
);
565567
"""
566568

dialogExecution/startVirtualMachine.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -299,10 +299,10 @@ def start_virtual_machine(self):
299299
qemu_to_execute = result[0][0]
300300

301301
if platform.system() == "Windows":
302-
qemu_cmd = f"{qemu_to_execute} -m {self.vmSpecs[4]} -rtc base=\"{dateTimeForVM}\",clock=vm -smp {self.vmSpecs[17]}"
302+
qemu_cmd = f"{qemu_to_execute} -m {self.vmSpecs[4]} -rtc base=\"{dateTimeForVM}\",clock=vm -smp {self.vmSpecs[17]} -k {self.vmSpecs[21]}"
303303

304304
else:
305-
qemu_cmd = f"{qemu_to_execute} -m {self.vmSpecs[4]} -rtc base={dateTimeForVM},clock=vm -smp {self.vmSpecs[17]}"
305+
qemu_cmd = f"{qemu_to_execute} -m {self.vmSpecs[4]} -rtc base={dateTimeForVM},clock=vm -smp {self.vmSpecs[17]} -k {self.vmSpecs[21]}"
306306

307307
if self.vmSpecs[5] != "NULL":
308308
if magic.from_file(self.vmSpecs[5]) == "block special":

main.py

Lines changed: 41 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def __init__(self, parent=None):
4242
self.connectSignalsSlots()
4343
self.timer = QTimer()
4444
self.timer.timeout.connect(self.updateVmList)
45-
self.label_8.setText("EmuGUI v0.9.0.5300")
45+
self.label_8.setText("EmuGUI v0.9.0.5301_dev (pre-release, not for production)")
4646
self.setWindowTitle("EmuGUI")
4747
self.languageInUse = "system"
4848

@@ -52,7 +52,7 @@ def __init__(self, parent=None):
5252
except:
5353
pass
5454

55-
self.versionCode = 5300
55+
self.versionCode = 5301
5656

5757
if platform.system() == "Windows":
5858
self.connection = platformSpecific.windowsSpecific.setupWindowsBackend()
@@ -176,7 +176,8 @@ def prepareDatabase(self, connection):
176176
filebios TEXT DEFAULT "" NOT NULL,
177177
keyboardtype TEXT NOT NULL,
178178
usbsupport INT DEFAULT 0 NOT NULL,
179-
usbcontroller TEXT DEFAULT "pci-ohci" NOT NULL
179+
usbcontroller TEXT DEFAULT "pci-ohci" NOT NULL,
180+
kbdtype TEXT DEFAULT "en-us" NOT NULL
180181
);
181182
"""
182183

@@ -212,6 +213,11 @@ def prepareDatabase(self, connection):
212213
SELECT usbcontroller FROM virtualmachines;
213214
"""
214215

216+
# The v0.9 feature set
217+
select09ColumnsVM = """
218+
SELECT kbdtype FROM virtualmachines;
219+
"""
220+
215221
insertSoundColVM = """
216222
ALTER TABLE virtualmachines
217223
ADD COLUMN sound TEXT DEFAULT "none" NOT NULL;
@@ -262,6 +268,11 @@ def prepareDatabase(self, connection):
262268
ADD COLUMN usbcontroller TEXT DEFAULT "pci-ohci" NOT NULL;
263269
"""
264270

271+
insertKbdLayoutVM = """
272+
ALTER TABLE virtualmachines
273+
ADD COLUMN kbdtype TEXT DEFAULT "en-us" NOT NULL;
274+
"""
275+
265276
insert_qemu_img = """
266277
INSERT INTO settings (
267278
name
@@ -1092,6 +1103,27 @@ def prepareDatabase(self, connection):
10921103
except sqlite3.Error as e:
10931104
print(f"The SQLite module encountered an error: {e}.")
10941105

1106+
try:
1107+
cursor.execute(select09ColumnsVM)
1108+
connection.commit()
1109+
result = cursor.fetchall()
1110+
1111+
try:
1112+
qemu_img_slot = str(result[0])
1113+
print("The query was executed successfully. The v0.5 feature columns already are in the VM table.")
1114+
1115+
except:
1116+
pass
1117+
1118+
except sqlite3.Error as e:
1119+
try:
1120+
cursor.execute(insertKbdLayoutVM)
1121+
connection.commit()
1122+
print("The queries were executed successfully. The missing features have been added to the database.")
1123+
1124+
except sqlite3.Error as e:
1125+
print(f"The SQLite module encountered an error: {e}.")
1126+
10951127
try:
10961128
cursor.execute(debug_db_settings)
10971129
connection.commit()
@@ -1158,7 +1190,7 @@ def startVM(self):
11581190

11591191
get_vm_to_start = f"""
11601192
SELECT architecture, machine, cpu, ram, hda, vga, net, usbtablet, win2k, dirbios, additionalargs, sound, linuxkernel,
1161-
linuxinitrid, linuxcmd, mousetype, cores, filebios, keyboardtype, usbsupport, usbcontroller FROM virtualmachines
1193+
linuxinitrid, linuxcmd, mousetype, cores, filebios, keyboardtype, usbsupport, usbcontroller, kbdtype FROM virtualmachines
11621194
WHERE name = '{selectedVM}'
11631195
"""
11641196

@@ -1190,6 +1222,7 @@ def startVM(self):
11901222
kbd_type = result[0][18]
11911223
usb_support = result[0][19]
11921224
usb_controller = result[0][20]
1225+
kbd_layout = result[0][21]
11931226

11941227
except sqlite3.Error as e:
11951228
print(f"The SQLite module encountered an error: {e}.")
@@ -1223,6 +1256,7 @@ def startVM(self):
12231256
tempVmDefFile.write(kbd_type + "\n")
12241257
tempVmDefFile.write(str(usb_support) + "\n")
12251258
tempVmDefFile.write(usb_controller + "\n")
1259+
tempVmDefFile.write(kbd_layout + "\n")
12261260

12271261
if usbtablet_wanted == 1:
12281262
dialog3 = UsbTabletDepreciated(self)
@@ -1324,7 +1358,7 @@ def editVM(self):
13241358

13251359
get_vm_to_start = f"""
13261360
SELECT architecture, machine, cpu, ram, hda, vga, net, usbtablet, win2k, dirbios, additionalargs, sound, linuxkernel,
1327-
linuxinitrid, linuxcmd, mousetype, cores, filebios, keyboardtype, usbsupport, usbcontroller FROM virtualmachines
1361+
linuxinitrid, linuxcmd, mousetype, cores, filebios, keyboardtype, usbsupport, usbcontroller, kbdtype FROM virtualmachines
13281362
WHERE name = '{selectedVM}'
13291363
"""
13301364

@@ -1356,6 +1390,7 @@ def editVM(self):
13561390
kbd_type = result[0][18]
13571391
usb_support = result[0][19]
13581392
usb_controller = result[0][20]
1393+
kbd_layout = result[0][21]
13591394

13601395
except sqlite3.Error as e:
13611396
print(f"The SQLite module encountered an error: {e}.")
@@ -1389,6 +1424,7 @@ def editVM(self):
13891424
tempVmDefFile.write(kbd_type + "\n")
13901425
tempVmDefFile.write(str(usb_support) + "\n")
13911426
tempVmDefFile.write(usb_controller + "\n")
1427+
tempVmDefFile.write(kbd_layout + "\n")
13921428

13931429
i = 0
13941430

0 commit comments

Comments
 (0)