Skip to content

Commit 45f37cb

Browse files
committed
Add support for filepicker GUI dialogs
1 parent 9d11fa4 commit 45f37cb

File tree

3 files changed

+51
-5
lines changed

3 files changed

+51
-5
lines changed

docs/changelogs/v0-13-4.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ This update includes the following features / fixes / changes:
66

77
- Updated BaseSystem for macOS Tahoe developer beta 8
88
- Changed method of setting CPU topology on new boot scripts and XML conversions ([#163](https://github.com/Coopydood/ultimate-macOS-KVM/issues/163)) (@citkane)
9+
- Selecting an existing HDD or BaseSystem now uses a filepicker GUI dialog
10+
- Default virtual memory is now 8GB for macOS 15 and later
911
- Fixed syntax errors in GPU passthrough script (#192) (@Fedeton)
1012
- Fixed screenshots
1113
- Added internal-only debug tools menu

resources/baseDomain

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@
187187
<qemu:arg value="-cpu"/>
188188
<qemu:arg value="$USR_CPU_MODEL,kvm=on,vendor=GenuineIntel,+invtsc,vmware-cpuid-freq=on,$USR_CPU_ARGS"/>
189189
<qemu:arg value="-smp"/>
190-
<qemu:arg value="threads=$USR_CPU_THREADS,$USR_CPU_CORES,sockets=1"/>
190+
<qemu:arg value="threads=$USR_CPU_THREADS,cores=$USR_CPU_CORES,sockets=1"/>
191191
<qemu:arg value="-global"/>
192192
<qemu:arg value="nec-usb-xhci.msi=off"/>
193193

scripts/autopilot.py

Lines changed: 48 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@
2828
import random
2929
import uuid
3030
import platform
31+
from tkinter import Tk
32+
from tkinter.filedialog import askopenfilename
33+
3134
sys.path.append('./resources/python')
3235
from cpydColours import color
3336
try:
@@ -37,6 +40,7 @@
3740
global FEATURE_LEVEL
3841
global repoDir
3942
global nrsDir
43+
global newGenDialogs
4044

4145
script = "autopilot.py"
4246
scriptName = "AutoPilot"
@@ -50,6 +54,7 @@
5054
parser.add_argument("--disable-blob-check", dest="disableBlobCheck", help="Bypasses checking of blob integrity",action="store_true")
5155
parser.add_argument("--disable-progress", dest="disableProgress", help="Disable progress bar UI displays",action="store_true")
5256
parser.add_argument("--disable-percentage", dest="disablePercentage", help="Disable progress bar percentages and data labels",action="store_true")
57+
parser.add_argument("--disable-new-dialogs", dest="disableDialogs", help="Disable the GUI file picker dialogs",action="store_true")
5358
parser.add_argument("--skip-summary", dest="skipSummary", help="Starts the AutoPilot flow immediately after questioning",action="store_true")
5459
parser.add_argument("--skip-notices", dest="skipNotices", help="Don't download and load notices",action="store_true")
5560
parser.add_argument("--no-auto-download", dest="customDownload", help="Asks the user what to download during run",action="store_true")
@@ -117,6 +122,11 @@
117122
else:
118123
enablePercentage = True
119124

125+
if args.disableDialogs == True:
126+
newGenDialogs = 0
127+
else:
128+
newGenDialogs = 1
129+
120130
version = open(repoDir+"/.version")
121131
version = version.read()
122132

@@ -421,6 +431,7 @@ def autopilot():
421431
global USR_TARGET_OS_NAME
422432
global FEATURE_LEVEL
423433
global USR_CREATE_XML
434+
global newGenDialogs
424435
global startTime
425436

426437
USR_CPU_SOCKS = 1
@@ -1010,6 +1021,7 @@ def stage13():
10101021
def stage12():
10111022
global customValue
10121023
global currentStage
1024+
global newGenDialogs
10131025
global USR_BOOT_FILE
10141026
defaultValue = "BaseSystem.img"
10151027
currentStage = 12
@@ -1068,11 +1080,28 @@ def stage12():
10681080

10691081

10701082
if customValue == 1:
1083+
1084+
1085+
10711086
cpydLog("info",str("Custom value requested, setting up"))
10721087
# print(color.BOLD+color.PURPLE+"\n FORMAT:"+color.YELLOW+""+color.END+color.BOLD,"<file>"+color.YELLOW+".img"+color.END+"\n Enter a custom value.\n \n ")
1073-
print(color.BOLD+color.PURPLE+"\n FORMAT:",color.YELLOW+""+color.END+color.BOLD+"<file>"+color.YELLOW+".img"+color.END+"\n Enter the full path to a bootable macOS Recovery image file.\n It will be automatically copied into the root repo directory, or you\n can place it there now and type \"BaseSystem.img\" without a path.\n You",color.UNDERLINE+color.BOLD+"must"+color.END,"include any text in"+color.YELLOW,"yellow"+color.END+".\n\n "+color.BOLD+"TIP:"+color.END,"You can drag and drop a file onto this window.\n \n ")
10741088
cpydLog("wait",("Waiting for user input"))
1075-
customInput = str(input(color.BOLD+"Value> "+color.END))
1089+
1090+
if newGenDialogs == 1:
1091+
print(color.BOLD+color.PURPLE+"\n Using filesystem dialog..."+"\n "+color.END)
1092+
cpydLog("info",str("New gen dialogs enabled, using GUI filepicker"))
1093+
Tk().withdraw()
1094+
customInput = askopenfilename()
1095+
if len(customInput) < 3:
1096+
cpydLog("error",str("Never received a response from the GUI dialog! Did we break? Falling back!"))
1097+
customValue = 0
1098+
stage12()
1099+
else:
1100+
cpydLog("ok",str("Successfully got response from GUI dialog"))
1101+
else:
1102+
print(color.BOLD+color.PURPLE+"\n FORMAT:",color.YELLOW+""+color.END+color.BOLD+"<file>"+color.YELLOW+".img"+color.END+"\n Enter the full path to a bootable macOS Recovery image file.\n It will be automatically copied into the root repo directory, or you\n can place it there now and type \"BaseSystem.img\" without a path.\n You",color.UNDERLINE+color.BOLD+"must"+color.END,"include any text in"+color.YELLOW,"yellow"+color.END+".\n\n "+color.BOLD+"TIP:"+color.END,"You can drag and drop a file onto this window.\n \n ")
1103+
1104+
customInput = str(input(color.BOLD+"Value> "+color.END))
10761105
cpydLog("ok",("User input received"))
10771106

10781107
USR_BOOT_FILE = customInput
@@ -1544,6 +1573,7 @@ def stage8():
15441573
global USR_HDD_ISPHYSICAL
15451574
global customValue
15461575
global currentStage
1576+
global newGenDialogs
15471577
currentStage = 8
15481578

15491579
global stageHooks
@@ -1625,9 +1655,21 @@ def stage8():
16251655
elif customValue == 2:
16261656
cpydLog("info",str("Custom value requested, setting up"))
16271657
# print(color.BOLD+color.PURPLE+"\n FORMAT:"+color.YELLOW+""+color.END+color.BOLD,"<>"+color.YELLOW+""+color.END+"\n Enter a custom value.\n \n ")
1628-
print(color.BOLD+color.PURPLE+"\n FORMAT:",color.YELLOW+""+color.END+color.BOLD+"<full path to HDD file>"+color.END+"\n Drag the *.qcow2 file onto this window (or type the path) and hit ENTER.\n"+color.END+"\n ")
16291658
cpydLog("wait",("Waiting for user input"))
1630-
customInput = str(input(color.BOLD+"File> "+color.END))
1659+
if newGenDialogs == 1:
1660+
print(color.BOLD+color.PURPLE+"\n Using filesystem dialog..."+"\n "+color.END)
1661+
cpydLog("info",str("New gen dialogs enabled, using GUI filepicker"))
1662+
Tk().withdraw()
1663+
customInput = askopenfilename()
1664+
if len(customInput) < 3:
1665+
cpydLog("error",str("Never received a response from the GUI dialog! Did we break? Falling back!"))
1666+
customValue = 0
1667+
stage8()
1668+
else:
1669+
cpydLog("ok",str("Successfully got response from GUI dialog"))
1670+
else:
1671+
print(color.BOLD+color.PURPLE+"\n FORMAT:",color.YELLOW+""+color.END+color.BOLD+"<full path to HDD file>"+color.END+"\n Drag the *.qcow2 file onto this window (or type the path) and hit ENTER.\n"+color.END+"\n ")
1672+
customInput = str(input(color.BOLD+"File> "+color.END))
16311673
cpydLog("ok",("User input received"))
16321674
USR_HDD_PATH = customInput
16331675
USR_HDD_PATH = USR_HDD_PATH.replace("'","")
@@ -1743,6 +1785,8 @@ def stage7():
17431785
currentStage = 7
17441786
defaultValue = "4G"
17451787

1788+
if USR_TARGET_OS >= 15 and USR_TARGET_OS < 99: defaultValue = "8G"
1789+
17461790
global stageHooks
17471791
global activeNotice
17481792
global notices

0 commit comments

Comments
 (0)