Skip to content

Commit

Permalink
updater.py updates
Browse files Browse the repository at this point in the history
  • Loading branch information
KorryKatti committed Mar 13, 2024
1 parent 71ce021 commit 108f99e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
4 changes: 3 additions & 1 deletion index.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,16 @@ def create_labels():
app.resizable(True, True)
app.title("Thunder 🗲")

# Define the callback function for the optionmenu
# Define the callback function for the optionmenu
def optionmenu_callback(choice):
print("Optionmenu dropdown clicked:", choice)
if choice == "Quit":
quit(app)
elif choice == "Home":
create_labels()
elif choice == "Client Update":
app.destroy() # Close the current window
subprocess.Popen(["python", "updater.py"]) # Run updater.py


# Callback Function for Libmenu
Expand Down
15 changes: 14 additions & 1 deletion updater.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,21 @@ def main():
# Display "Done" message
print("Done")

# Change directory to the current directory
os.chdir(os.path.dirname(__file__))

# Create and activate a virtual environment
subprocess.run(["python", "-m", "venv", "myenv"])
if os.name == 'posix': # Unix-like OS (Linux/Mac)
subprocess.run(["source", "myenv/bin/activate"])
elif os.name == 'nt': # Windows
subprocess.run(["myenv\\Scripts\\activate.bat"])

# Install requirements.txt
subprocess.run(["pip", "install", "-r", "requirements.txt"])

# Launch index.py
subprocess.run(["python", "index.py"])

if __name__ == "__main__":
main()
main()

0 comments on commit 108f99e

Please sign in to comment.