From 5e1927f7c5c65dc4a18da86a5661635130d4ed6b Mon Sep 17 00:00:00 2001 From: Michael Date: Thu, 14 Nov 2024 11:13:15 +0200 Subject: [PATCH] UPD --- Install.bat | 2 +- Install.sh | 2 +- config.ini => TechicalFiles/config.ini | 3 +- .../ngrok_manager.py | 0 .../requirements.txt | Bin .../translations.json | 0 ui.py => TechicalFiles/ui.py | 16 ++--- Update.bat | 2 +- Update.sh | 2 +- Venv.bat | 64 ++++++++++++++++++ Venv.sh | 61 +++++++++++++++++ main.py | 4 +- 12 files changed, 140 insertions(+), 16 deletions(-) rename config.ini => TechicalFiles/config.ini (80%) rename ngrok_manager.py => TechicalFiles/ngrok_manager.py (100%) rename requirements.txt => TechicalFiles/requirements.txt (100%) rename translations.json => TechicalFiles/translations.json (100%) rename ui.py => TechicalFiles/ui.py (96%) create mode 100644 Venv.bat create mode 100644 Venv.sh diff --git a/Install.bat b/Install.bat index be6734e..29996ff 100644 --- a/Install.bat +++ b/Install.bat @@ -5,7 +5,7 @@ python -m venv venv call venv\Scripts\activate python -m pip install --upgrade pip setuptools pip install wheel -pip install -r requirements.txt +pip install -r TechicalFiles/requirements.txt timeout /t 2 /nobreak >nul cls diff --git a/Install.sh b/Install.sh index 5bb4dd0..f5bbc95 100644 --- a/Install.sh +++ b/Install.sh @@ -5,7 +5,7 @@ python -m venv venv source venv/bin/activate python -m pip install --upgrade pip setuptools pip install wheel -pip install -r requirements.txt +pip install -r TechicalFiles/requirements.txt sleep 2 clear diff --git a/config.ini b/TechicalFiles/config.ini similarity index 80% rename from config.ini rename to TechicalFiles/config.ini index 18d422f..996ec4f 100644 --- a/config.ini +++ b/TechicalFiles/config.ini @@ -2,5 +2,4 @@ language = en ngrok_token = theme = dark -region = eu - +region = eu \ No newline at end of file diff --git a/ngrok_manager.py b/TechicalFiles/ngrok_manager.py similarity index 100% rename from ngrok_manager.py rename to TechicalFiles/ngrok_manager.py diff --git a/requirements.txt b/TechicalFiles/requirements.txt similarity index 100% rename from requirements.txt rename to TechicalFiles/requirements.txt diff --git a/translations.json b/TechicalFiles/translations.json similarity index 100% rename from translations.json rename to TechicalFiles/translations.json diff --git a/ui.py b/TechicalFiles/ui.py similarity index 96% rename from ui.py rename to TechicalFiles/ui.py index 97b54ef..4e906ce 100644 --- a/ui.py +++ b/TechicalFiles/ui.py @@ -1,12 +1,12 @@ import tkinter as tk from tkinter import messagebox, simpledialog, filedialog, ttk -from ngrok_manager import NgrokManager +from TechicalFiles.ngrok_manager import NgrokManager import json import webbrowser from configparser import ConfigParser import subprocess -with open("translations.json", "r", encoding="utf-8") as f: +with open("TechicalFiles/translations.json", "r", encoding="utf-8") as f: translations = json.load(f) manager = None @@ -18,7 +18,7 @@ def __init__(self, root): self.root.title("NgrokManager") self.config = ConfigParser() - self.config.read('config.ini') + self.config.read('TechicalFiles/config.ini') self.language = self.config.get('general', 'language', fallback='en') self.theme = self.config.get('general', 'theme', fallback='dark') @@ -141,7 +141,7 @@ def open_web_inspection(self): def change_region(self, event=None): self.region = self.region_var.get() self.config.set('general', 'region', self.region) - with open('config.ini', 'w') as configfile: + with open('TechicalFiles/config.ini', 'w') as configfile: self.config.write(configfile) def create_tunnel(self): @@ -149,11 +149,11 @@ def create_tunnel(self): region = self.region_var.get() self.config.set('general', 'ngrok_token', token) - with open('config.ini', 'w') as configfile: + with open('TechicalFiles/config.ini', 'w') as configfile: self.config.write(configfile) self.config.set('general', 'region', region) - with open('config.ini', 'w') as configfile: + with open('TechicalFiles/config.ini', 'w') as configfile: self.config.write(configfile) global manager @@ -214,7 +214,7 @@ def open_tunnel_url(self, event): def change_language(self, event=None): self.language = self.language_var.get() self.config.set('general', 'language', self.language) - with open('config.ini', 'w') as configfile: + with open('TechicalFiles/config.ini', 'w') as configfile: self.config.write(configfile) self.t = translations.get(self.language, translations["en"]) @@ -223,7 +223,7 @@ def change_language(self, event=None): def change_theme(self, event=None): self.theme = self.theme_var.get() self.config.set('general', 'theme', self.theme) - with open('config.ini', 'w') as configfile: + with open('TechicalFiles/config.ini', 'w') as configfile: self.config.write(configfile) bg_color = "#2e2e2e" if self.theme == "dark" else "#ffffff" diff --git a/Update.bat b/Update.bat index 28ad433..030f168 100644 --- a/Update.bat +++ b/Update.bat @@ -9,7 +9,7 @@ call venv\Scripts\activate echo Updating Application... python -m pip install --upgrade pip setuptools pip install wheel -pip install -r requirements.txt +pip install -r TechicalFiles/requirements.txt timeout /t 2 /nobreak >nul cls diff --git a/Update.sh b/Update.sh index 2af39f1..1298da6 100644 --- a/Update.sh +++ b/Update.sh @@ -9,7 +9,7 @@ python -m venv venv source venv/bin/activate python -m pip install --upgrade pip setuptools pip install wheel -pip install -r requirements.txt +pip install -r TechicalFiles/requirements.txt sleep 2 clear diff --git a/Venv.bat b/Venv.bat new file mode 100644 index 0000000..3b4f6c3 --- /dev/null +++ b/Venv.bat @@ -0,0 +1,64 @@ +@echo off +chcp 65001 > NUL + +call venv\Scripts\activate + +echo Virtual environment activated +echo. +echo Available options: +echo 1. Install package +echo 2. Uninstall package +echo 3. Upgrade package +echo 4. List installed packages +echo 5. Show package details +echo 6. Check dependencies +echo 7. Debug information +echo 8. Exit +echo. + +:menu +set /p choice="Enter your choice (1-8): " + +if "%choice%"=="1" ( + set /p package="Enter package name to install: " + pip install %package% + goto menu +) +if "%choice%"=="2" ( + set /p package="Enter package name to uninstall: " + pip uninstall %package% + goto menu +) +if "%choice%"=="3" ( + set /p package="Enter package name to upgrade: " + pip install --upgrade %package% + goto menu +) +if "%choice%"=="4" ( + pip list + echo. + goto menu +) +if "%choice%"=="5" ( + set /p package="Enter package name to show details: " + pip show %package% + echo. + goto menu +) +if "%choice%"=="6" ( + pip check + echo. + goto menu +) +if "%choice%"=="7" ( + pip debug --verbose + echo. + goto menu +) +if "%choice%"=="8" ( + deactivate + exit +) + +echo Invalid choice. Please try again. +goto menu \ No newline at end of file diff --git a/Venv.sh b/Venv.sh new file mode 100644 index 0000000..0daacf6 --- /dev/null +++ b/Venv.sh @@ -0,0 +1,61 @@ +#!/bin/bash + +source venv/bin/activate + +echo "Virtual environment activated" +echo + +while true; do + echo "Available options:" + echo "1. Install package" + echo "2. Uninstall package" + echo "3. Upgrade package" + echo "4. List installed packages" + echo "5. Show package details" + echo "6. Check dependencies" + echo "7. Debug information" + echo "8. Exit" + echo + + read -p "Enter your choice (1-8): " choice + + case $choice in + 1) + read -p "Enter package name to install: " package + pip install $package + ;; + 2) + read -p "Enter package name to uninstall: " package + pip uninstall $package + ;; + 3) + read -p "Enter package name to upgrade: " package + pip install --upgrade $package + ;; + 4) + pip list + echo + ;; + 5) + read -p "Enter package name to show details: " package + pip show $package + echo + ;; + 6) + pip check + echo + ;; + 7) + pip debug --verbose + echo + ;; + 8) + deactivate + exit 0 + ;; + *) + echo "Invalid choice. Please try again." + ;; + esac + echo +done \ No newline at end of file diff --git a/main.py b/main.py index 1d35caf..0f57e1c 100644 --- a/main.py +++ b/main.py @@ -1,9 +1,9 @@ import tkinter as tk from configparser import ConfigParser -from ui import NgrokApp +from TechicalFiles.ui import NgrokApp config = ConfigParser() -config.read('config.ini') +config.read('TechicalFiles/config.ini') language = config.get('general', 'language', fallback='en')