Skip to content

Commit f472fe0

Browse files
authored
v1.1.0
Changelog for v1.1.0: Fixed Syntax Errors: Corrected the usage of if conditions (= replaced with ==) and added colons. Improved Input Handling: Ensured proper user input handling (e.g., case insensitivity). Code Structure: Removed duplicated logic by modularizing repeated code into functions. Error Handling: Added checks to guide the user if something goes wrong. PEP 8 Compliance: Enhanced readability and followed Python coding standards.
1 parent f927435 commit f472fe0

1 file changed

Lines changed: 36 additions & 34 deletions

File tree

main.py

Lines changed: 36 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,52 @@
11
import time
22
import pyautogui
33

4-
print("Welcome to the PYI installer", "\u00A9", " 2024 26gbush")
5-
print("")
6-
print("The PYI installer uses 'pip' to install apps, and therefore is an EXTENSION of pip")
7-
print("pyautogui is needed to install apps")
8-
print("")
9-
pyautoinstalled = input("do you have pyautogui installed Y/N")
10-
if pyautoinstalled = Y
4+
def install_package():
5+
"""Function to handle package installation via pyautogui."""
116
while True:
127
print("")
13-
ml = input("PYI INSTALLER: ")
14-
pyautogui.hotkey('win' , 'r')
8+
ml = input("PYI INSTALLER: ").strip()
9+
pyautogui.hotkey('win', 'r')
1510
pyautogui.typewrite('powershell')
1611
pyautogui.press('enter')
1712
time.sleep(2)
18-
pyautogui.press('enter')
19-
pyautogui.typewrite('pip install ' +ml)
20-
13+
pyautogui.typewrite('pip install ' + ml)
2114
pyautogui.press('enter')
2215
time.sleep(2)
23-
pyautogui.typewrite('press enter to exit powershell')
16+
pyautogui.typewrite('echo Press enter to exit PowerShell')
2417
pyautogui.press('enter')
2518
pyautogui.typewrite('exit')
26-
print("")
27-
print("If the installation did not work, check if you misspelled it.")
28-
else
29-
print("to install pyautogui press the Windows Key and r to open run (apart of Windows that will run what you type in)")
30-
print("then type in powershell: pip install pyatuogui")
31-
doneinstall = input("type Y to run the PYI installer")
32-
if doneinstall = Y
33-
while True:
34-
print("")
35-
ml = input("PYI INSTALLER: ")
36-
pyautogui.hotkey('win' , 'r')
37-
pyautogui.typewrite('powershell')
38-
pyautogui.press('enter')
39-
time.sleep(2)
40-
pyautogui.press('enter')
41-
pyautogui.typewrite('pip install ' +ml)
42-
43-
pyautogui.press('enter')
44-
time.sleep(2)
45-
pyautogui.typewrite('press enter to exit powershell')
4619
pyautogui.press('enter')
47-
pyautogui.typewrite('exit')
4820
print("")
4921
print("If the installation did not work, check if you misspelled it.")
22+
23+
def install_pyautogui_instructions():
24+
"""Guide user to install pyautogui if not installed."""
25+
print("To install pyautogui:")
26+
print("1. Press the Windows Key + R to open Run.")
27+
print("2. Type 'powershell' and press Enter.")
28+
print("3. In PowerShell, run: pip install pyautogui")
29+
done_install = input("Once installed, type Y to run the PYI installer: ").strip().upper()
30+
if done_install == "Y":
31+
install_package()
32+
33+
def main():
34+
"""Main function for the PYI installer."""
35+
print("Welcome to the PYI Installer", "\u00A9", "2024 26gbush")
36+
print("")
37+
print("The PYI installer uses 'pip' to install apps and is an EXTENSION of pip.")
38+
print("pyautogui is needed to install apps.")
39+
print("")
40+
41+
pyautoinstalled = input("Do you have pyautogui installed (Y/N)? ").strip().upper()
5042

43+
if pyautoinstalled == "Y":
44+
install_package()
45+
elif pyautoinstalled == "N":
46+
install_pyautogui_instructions()
47+
else:
48+
print("Invalid input. Please restart the installer and type 'Y' or 'N'.")
49+
50+
if __name__ == "__main__":
51+
main()
52+

0 commit comments

Comments
 (0)