Skip to content

Commit ac48bfd

Browse files
authored
Prepared Version 0.2
1 parent 6a212af commit ac48bfd

25 files changed

+886
-200
lines changed

CHANGELOG.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
1-
# EmuGUI (insert version here)
1+
# EmuGUI v0.2
22

33
- Updated README.md so terminal commands are formatted like such
44
- Updated TESTED.md
55
- Added Doumentation info in README.md
6+
- Removed Reset button from the QEMU settings
7+
- Removed Browse button from the BIOS location part of VM creating/editing feature
8+
- Removed quotes from BIOS location addition line in starting VM
9+
- Added experimental sound card support
10+
- Added experimental Linux parameter support (kernel, intrid, cmd arguments)
11+
- Windows binaries now use Python 3.9.13 instead of Python 3.9.12
612

713
# EmuGUI v0.1
814

2.08 KB
Binary file not shown.
1.73 KB
Binary file not shown.
369 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
923 Bytes
Binary file not shown.

dialogExecution/editVirtualMachine.py

Lines changed: 115 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,15 @@
66
import platformSpecific.unixSpecific
77
import subprocess
88
from dialogExecution.vhdExistsDialog import VhdAlreadyExists
9+
from dialogExecution.vmExistsDialog import VmAlreadyExistsDialog
910

1011
class EditVirtualMachineDialog(QDialog, Ui_Dialog):
1112
def __init__(self, parent=None):
1213
super().__init__(parent)
1314
self.setupUi(self)
1415
self.connectSignalsSlots()
1516
self.vmSpecs = self.readTempVmFile()
17+
self.setWindowTitle(f"EmuGUI - Edit {self.vmSpecs[0]}")
1618

1719
if platform.system() == "Windows":
1820
tempVmDef = platformSpecific.windowsSpecific.windowsTempVmStarterFile()
@@ -34,6 +36,7 @@ def connectSignalsSlots(self):
3436
self.pushButton_19.clicked.connect(self.close)
3537
self.pushButton_21.clicked.connect(self.close)
3638
self.pushButton_23.clicked.connect(self.close)
39+
self.pushButton_26.clicked.connect(self.close)
3740

3841
self.pushButton_3.clicked.connect(self.archSystem)
3942

@@ -52,17 +55,23 @@ def connectSignalsSlots(self):
5255
self.pushButton_18.clicked.connect(self.vhdMenu)
5356

5457
self.pushButton_17.clicked.connect(self.extBios)
55-
self.pushButton_25.clicked.connect(self.extBios)
58+
self.pushButton_25.clicked.connect(self.vgaNetworkMenu)
5659

57-
self.pushButton_24.clicked.connect(self.win2kHacker)
60+
self.pushButton_24.clicked.connect(self.soundCard)
61+
self.pushButton_28.clicked.connect(self.extBios)
5862

59-
self.pushButton_22.clicked.connect(self.extBios)
63+
self.pushButton_22.clicked.connect(self.linuxVMSpecific)
64+
self.pushButton_27.clicked.connect(self.linuxVMSpecific)
65+
66+
self.pushButton.clicked.connect(self.linuxKernelBrowseLocation)
67+
68+
self.pushButton_32.clicked.connect(self.linuxInitridBrowseLocation)
6069

6170
self.pushButton_13.clicked.connect(self.vhdBrowseLocation)
6271

63-
self.pushButton_20.clicked.connect(self.finishCreation)
72+
self.pushButton_30.clicked.connect(self.win2kHacker)
6473

65-
self.pushButton.clicked.connect(self.biosBrowseLocation)
74+
self.pushButton_20.clicked.connect(self.finishCreation)
6675

6776
def machineCpuI386Amd64(self, machine, cpu):
6877
i = 0
@@ -190,20 +199,75 @@ def readTempVmFile(self):
190199

191200
self.lineEdit_2.setText(vmSpecs[11])
192201

202+
i = 0
203+
204+
while i < self.comboBox_12.count():
205+
if self.comboBox_12.itemText(i) == vmSpecs[12]:
206+
self.comboBox_12.setCurrentIndex(i)
207+
break
208+
209+
i += 1
210+
211+
self.lineEdit_4.setText(vmSpecs[13])
212+
self.lineEdit_5.setText(vmSpecs[14])
213+
self.lineEdit_7.setText(vmSpecs[15])
214+
193215
return vmSpecs
194216

195217
def archSystem(self):
196-
if self.comboBox.currentText() == "i386":
197-
self.stackedWidget.setCurrentIndex(1)
218+
if platform.system() == "Windows":
219+
connection = platformSpecific.windowsSpecific.setupWindowsBackend()
220+
221+
else:
222+
connection = platformSpecific.unixSpecific.setupUnixBackend()
198223

199-
elif self.comboBox.currentText() == "x86_64":
200-
self.stackedWidget.setCurrentIndex(1)
224+
cursor = connection.cursor()
225+
226+
check_vm_name = f"""
227+
SELECT name FROM virtualmachines
228+
WHERE name = "{self.lineEdit.text()}";
229+
"""
230+
231+
try:
232+
cursor.execute(check_vm_name)
233+
connection.commit()
234+
result = cursor.fetchall()
235+
236+
try:
237+
qemu_img_slot = str(result[0])
238+
239+
if self.lineEdit.text() != self.vmSpecs[0]:
240+
dialog2 = VmAlreadyExistsDialog(self)
241+
dialog2.exec()
242+
243+
else:
244+
if self.comboBox.currentText() == "i386":
245+
self.stackedWidget.setCurrentIndex(1)
246+
247+
elif self.comboBox.currentText() == "x86_64":
248+
self.stackedWidget.setCurrentIndex(1)
201249

202-
elif self.comboBox.currentText() == "ppc":
203-
self.stackedWidget.setCurrentIndex(2)
250+
elif self.comboBox.currentText() == "ppc":
251+
self.stackedWidget.setCurrentIndex(2)
204252

205-
elif self.comboBox.currentText() == "mips64el":
206-
self.stackedWidget.setCurrentIndex(3)
253+
elif self.comboBox.currentText() == "mips64el":
254+
self.stackedWidget.setCurrentIndex(3)
255+
256+
except:
257+
if self.comboBox.currentText() == "i386":
258+
self.stackedWidget.setCurrentIndex(1)
259+
260+
elif self.comboBox.currentText() == "x86_64":
261+
self.stackedWidget.setCurrentIndex(1)
262+
263+
elif self.comboBox.currentText() == "ppc":
264+
self.stackedWidget.setCurrentIndex(2)
265+
266+
elif self.comboBox.currentText() == "mips64el":
267+
self.stackedWidget.setCurrentIndex(3)
268+
269+
except sqlite3.Error as e:
270+
print(f"The SQLite module encountered an error: {e}.")
207271

208272
def vhdMenu(self):
209273
self.stackedWidget.setCurrentIndex(4)
@@ -232,14 +296,44 @@ def vgaNetworkMenu(self):
232296
def extBios(self):
233297
self.stackedWidget.setCurrentIndex(6)
234298

235-
def biosBrowseLocation(self):
236-
filename = QFileDialog.getExistingDirectory(parent=self, caption='Select the location of the desired external BIOS', dir='.')
299+
def soundCard(self):
300+
self.stackedWidget.setCurrentIndex(7)
301+
302+
def linuxVMSpecific(self):
303+
self.stackedWidget.setCurrentIndex(8)
304+
305+
def linuxKernelBrowseLocation(self):
306+
filename, filter = QFileDialog.getOpenFileName(parent=self, caption='Select Linux kernel', dir='.', filter='All files (*.*)')
237307

238308
if filename:
239-
self.lineEdit_3.setText(filename)
309+
self.lineEdit_4.setText(filename)
310+
311+
try:
312+
file = open(filename, "r")
313+
file.close()
314+
dialog = VhdAlreadyExists(self)
315+
dialog.exec()
316+
317+
except:
318+
pass
319+
320+
def linuxInitridBrowseLocation(self):
321+
filename, filter = QFileDialog.getOpenFileName(parent=self, caption='Select Linux initrid image', dir='.', filter='IMG files (*.img);;All files (*.*)')
322+
323+
if filename:
324+
self.lineEdit_5.setText(filename)
325+
326+
try:
327+
file = open(filename, "r")
328+
file.close()
329+
dialog = VhdAlreadyExists(self)
330+
dialog.exec()
331+
332+
except:
333+
pass
240334

241335
def win2kHacker(self):
242-
self.stackedWidget.setCurrentIndex(7)
336+
self.stackedWidget.setCurrentIndex(9)
243337

244338
def finishCreation(self):
245339
if platform.system() == "Windows":
@@ -340,7 +434,10 @@ def finishCreation(self):
340434

341435
insert_into_vm_database = f"""
342436
UPDATE virtualmachines
343-
SET name = "{self.lineEdit.text()}", architecture = "{self.comboBox.currentText()}", machine = "{machine}", cpu = "{cpu}", ram = {ram}, hda = "{vhd}", vga = "{self.comboBox_10.currentText()}", net = "{networkAdapter}", usbtablet = {usbtablet}, win2k = {win2k}, dirbios = "{ext_bios_dir}", additionalargs = "{add_args}"
437+
SET name = "{self.lineEdit.text()}", architecture = "{self.comboBox.currentText()}", machine = "{machine}", cpu = "{cpu}",
438+
ram = {ram}, hda = "{vhd}", vga = "{self.comboBox_10.currentText()}", net = "{networkAdapter}", usbtablet = {usbtablet},
439+
win2k = {win2k}, dirbios = "{ext_bios_dir}", additionalargs = "{add_args}", sound = "{self.comboBox_12.currentText()}",
440+
linuxkernel = "{self.lineEdit_4.text()}", linuxinitrid = "{self.lineEdit_5.text()}", linuxcmd = "{self.lineEdit_7.text()}"
344441
WHERE name = "{self.vmSpecs[0]}";
345442
"""
346443

dialogExecution/newVirtualMachine.py

Lines changed: 93 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,13 @@
66
import platformSpecific.unixSpecific
77
import subprocess
88
from dialogExecution.vhdExistsDialog import VhdAlreadyExists
9+
from dialogExecution.vmExistsDialog import VmAlreadyExistsDialog
910

1011
class NewVirtualMachineDialog(QDialog, Ui_Dialog):
1112
def __init__(self, parent=None):
1213
super().__init__(parent)
1314
self.setupUi(self)
15+
self.setWindowTitle("EmuGUI - Create new VM")
1416
self.connectSignalsSlots()
1517

1618
if platform.system() == "Windows":
@@ -33,6 +35,7 @@ def connectSignalsSlots(self):
3335
self.pushButton_19.clicked.connect(self.close)
3436
self.pushButton_21.clicked.connect(self.close)
3537
self.pushButton_23.clicked.connect(self.close)
38+
self.pushButton_26.clicked.connect(self.close)
3639

3740
self.pushButton_3.clicked.connect(self.archSystem)
3841

@@ -51,30 +54,63 @@ def connectSignalsSlots(self):
5154
self.pushButton_18.clicked.connect(self.vhdMenu)
5255

5356
self.pushButton_17.clicked.connect(self.extBios)
54-
self.pushButton_25.clicked.connect(self.extBios)
57+
self.pushButton_25.clicked.connect(self.vgaNetworkMenu)
5558

56-
self.pushButton_24.clicked.connect(self.win2kHacker)
59+
self.pushButton_24.clicked.connect(self.soundCard)
60+
self.pushButton_28.clicked.connect(self.extBios)
5761

58-
self.pushButton_22.clicked.connect(self.extBios)
62+
self.pushButton_22.clicked.connect(self.linuxVMSpecific)
63+
self.pushButton_27.clicked.connect(self.linuxVMSpecific)
64+
65+
self.pushButton.clicked.connect(self.linuxKernelBrowseLocation)
66+
67+
self.pushButton_32.clicked.connect(self.linuxInitridBrowseLocation)
5968

6069
self.pushButton_13.clicked.connect(self.vhdBrowseLocation)
6170

62-
self.pushButton_20.clicked.connect(self.finishCreation)
71+
self.pushButton_30.clicked.connect(self.win2kHacker)
6372

64-
self.pushButton.clicked.connect(self.biosBrowseLocation)
73+
self.pushButton_20.clicked.connect(self.finishCreation)
6574

6675
def archSystem(self):
67-
if self.comboBox.currentText() == "i386":
68-
self.stackedWidget.setCurrentIndex(1)
76+
if platform.system() == "Windows":
77+
connection = platformSpecific.windowsSpecific.setupWindowsBackend()
78+
79+
else:
80+
connection = platformSpecific.unixSpecific.setupUnixBackend()
81+
82+
cursor = connection.cursor()
83+
84+
check_vm_name = f"""
85+
SELECT name FROM virtualmachines
86+
WHERE name = "{self.lineEdit.text()}";
87+
"""
6988

70-
elif self.comboBox.currentText() == "x86_64":
71-
self.stackedWidget.setCurrentIndex(1)
89+
try:
90+
cursor.execute(check_vm_name)
91+
connection.commit()
92+
result = cursor.fetchall()
93+
94+
try:
95+
qemu_img_slot = str(result[0])
96+
dialog2 = VmAlreadyExistsDialog(self)
97+
dialog2.exec()
98+
99+
except:
100+
if self.comboBox.currentText() == "i386":
101+
self.stackedWidget.setCurrentIndex(1)
102+
103+
elif self.comboBox.currentText() == "x86_64":
104+
self.stackedWidget.setCurrentIndex(1)
72105

73-
elif self.comboBox.currentText() == "ppc":
74-
self.stackedWidget.setCurrentIndex(2)
106+
elif self.comboBox.currentText() == "ppc":
107+
self.stackedWidget.setCurrentIndex(2)
75108

76-
elif self.comboBox.currentText() == "mips64el":
77-
self.stackedWidget.setCurrentIndex(3)
109+
elif self.comboBox.currentText() == "mips64el":
110+
self.stackedWidget.setCurrentIndex(3)
111+
112+
except sqlite3.Error as e:
113+
print(f"The SQLite module encountered an error: {e}.")
78114

79115
def vhdMenu(self):
80116
self.stackedWidget.setCurrentIndex(4)
@@ -103,14 +139,44 @@ def vgaNetworkMenu(self):
103139
def extBios(self):
104140
self.stackedWidget.setCurrentIndex(6)
105141

106-
def biosBrowseLocation(self):
107-
filename = QFileDialog.getExistingDirectory(parent=self, caption='Select the location of the desired external BIOS', dir='.')
142+
def soundCard(self):
143+
self.stackedWidget.setCurrentIndex(7)
144+
145+
def linuxVMSpecific(self):
146+
self.stackedWidget.setCurrentIndex(8)
147+
148+
def linuxKernelBrowseLocation(self):
149+
filename, filter = QFileDialog.getOpenFileName(parent=self, caption='Select Linux kernel', dir='.', filter='All files (*.*)')
108150

109151
if filename:
110-
self.lineEdit_3.setText(filename)
152+
self.lineEdit_4.setText(filename)
153+
154+
try:
155+
file = open(filename, "r")
156+
file.close()
157+
dialog = VhdAlreadyExists(self)
158+
dialog.exec()
159+
160+
except:
161+
pass
162+
163+
def linuxInitridBrowseLocation(self):
164+
filename, filter = QFileDialog.getOpenFileName(parent=self, caption='Select Linux initrid image', dir='.', filter='IMG files (*.img);;All files (*.*)')
165+
166+
if filename:
167+
self.lineEdit_5.setText(filename)
168+
169+
try:
170+
file = open(filename, "r")
171+
file.close()
172+
dialog = VhdAlreadyExists(self)
173+
dialog.exec()
174+
175+
except:
176+
pass
111177

112178
def win2kHacker(self):
113-
self.stackedWidget.setCurrentIndex(7)
179+
self.stackedWidget.setCurrentIndex(9)
114180

115181
def finishCreation(self):
116182
if platform.system() == "Windows":
@@ -222,7 +288,11 @@ def finishCreation(self):
222288
usbtablet,
223289
win2k,
224290
dirbios,
225-
additionalargs
291+
additionalargs,
292+
sound,
293+
linuxkernel,
294+
linuxinitrid,
295+
linuxcmd
226296
) VALUES (
227297
"{self.lineEdit.text()}",
228298
"{self.comboBox.currentText()}",
@@ -235,7 +305,11 @@ def finishCreation(self):
235305
{usbtablet},
236306
{win2k},
237307
"{ext_bios_dir}",
238-
"{add_args}"
308+
"{add_args}",
309+
"{self.comboBox_12.currentText()}",
310+
"{self.lineEdit_4.text()}",
311+
"{self.lineEdit_5.text()}",
312+
"{self.lineEdit_7.text()}"
239313
);
240314
"""
241315

0 commit comments

Comments
 (0)