update build .exe

This commit is contained in:
2026-03-07 07:25:33 +07:00
parent 8630a80810
commit 7af3024a25
6 changed files with 27 additions and 14 deletions

BIN
2023-11-03.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

View File

@@ -5,7 +5,7 @@ REM Tao file .exe khong can cai Python
REM ============================================ REM ============================================
echo ======================================== echo ========================================
echo IoT Firmware Loader - Build for Windows echo MiraV3 Firmware Loader - Build for Windows
echo ======================================== echo ========================================
echo. echo.
@@ -27,7 +27,9 @@ pip install PyQt6 scapy requests pyinstaller --quiet
REM 4. Build .exe REM 4. Build .exe
echo [3/4] Building executable... echo [3/4] Building executable...
pyinstaller ^ pyinstaller ^
--name "IoT_Firmware_Loader" ^ --name "MiraV3_Firmware_Loader" ^
--icon "icon.ico" ^
--add-data "icon.ico;." ^
--onefile ^ --onefile ^
--windowed ^ --windowed ^
--noconfirm ^ --noconfirm ^
@@ -40,15 +42,16 @@ pyinstaller ^
--hidden-import "PyQt6.QtGui" ^ --hidden-import "PyQt6.QtGui" ^
main.py main.py
echo. echo.
echo [4/4] Build complete! echo [4/4] Build complete!
echo. echo.
if exist "dist\IoT_Firmware_Loader.exe" ( if exist "dist\MiraV3_Firmware_Loader.exe" (
echo ✅ SUCCESS: dist\IoT_Firmware_Loader.exe echo ✅ SUCCESS: dist\MiraV3_Firmware_Loader.exe
echo. echo.
echo File size: echo File size:
for %%A in ("dist\IoT_Firmware_Loader.exe") do echo %%~zA bytes for %%A in ("dist\MiraV3_Firmware_Loader.exe") do echo %%~zA bytes
echo. echo.
echo Ban co the copy file .exe nay sang may khac va chay truc tiep. echo Ban co the copy file .exe nay sang may khac va chay truc tiep.
) else ( ) else (

BIN
icon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

17
main.py
View File

@@ -1,4 +1,5 @@
import sys import sys
import os
import socket import socket
import ipaddress import ipaddress
import platform import platform
@@ -116,6 +117,15 @@ def get_default_network(ip):
return "192.168.1.0/24" return "192.168.1.0/24"
def resource_path(relative_path):
""" Get absolute path to resource, works for dev and for PyInstaller """
try:
base_path = sys._MEIPASS
except Exception:
base_path = os.path.abspath(".")
return os.path.join(base_path, relative_path)
def get_machine_info(): def get_machine_info():
"""Collect machine info.""" """Collect machine info."""
hostname = socket.gethostname() hostname = socket.gethostname()
@@ -501,7 +511,8 @@ class App(QWidget):
def __init__(self): def __init__(self):
super().__init__() super().__init__()
self.setWindowTitle("IoT Firmware Loader") self.setWindowTitle("MiraV3 Firmware Loader")
self.setWindowIcon(QIcon(resource_path("icon.ico")))
self.firmware = None self.firmware = None
self.all_devices = [] # all scan results (unfiltered) self.all_devices = [] # all scan results (unfiltered)
self.devices = [] # currently displayed (filtered) self.devices = [] # currently displayed (filtered)
@@ -516,12 +527,12 @@ class App(QWidget):
layout.setContentsMargins(8, 6, 8, 6) layout.setContentsMargins(8, 6, 8, 6)
# ── Title ── # ── Title ──
title = QLabel("IoT Firmware Loader (MiraV3)") title = QLabel("MiraV3 Firmware Loader")
title.setObjectName("title") title.setObjectName("title")
title.setAlignment(Qt.AlignmentFlag.AlignCenter) title.setAlignment(Qt.AlignmentFlag.AlignCenter)
layout.addWidget(title) layout.addWidget(title)
copyright_label = QLabel(f"© {datetime.datetime.now().year} Smatec — R&D Software") copyright_label = QLabel(f"© {datetime.datetime.now().year} Smatec — R&D Software Team. v1.0.0")
copyright_label.setAlignment(Qt.AlignmentFlag.AlignCenter) copyright_label.setAlignment(Qt.AlignmentFlag.AlignCenter)
copyright_label.setStyleSheet( copyright_label.setStyleSheet(
"color: #9399b2; font-size: 11px; font-weight: 500; font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto;" "color: #9399b2; font-size: 11px; font-weight: 500; font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto;"

11
run.sh Normal file → Executable file
View File

@@ -5,14 +5,13 @@ SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
cd "$SCRIPT_DIR" cd "$SCRIPT_DIR"
# Activate virtual environment # Activate virtual environment
if [ -d "venv" ]; then if [ ! -d "venv" ]; then
source venv/bin/activate
else
echo "❌ Virtual environment not found. Creating..." echo "❌ Virtual environment not found. Creating..."
python3 -m venv venv python3 -m venv venv
source venv/bin/activate
pip install PyQt6 scapy requests
fi fi
echo "🚀 Starting IoT Firmware Loader..." source venv/bin/activate
pip install -r requirements.txt --quiet
echo "🚀 Starting MiraV3 Firmware Loader..."
python main.py python main.py