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 ============================================
echo ========================================
echo IoT Firmware Loader - Build for Windows
echo MiraV3 Firmware Loader - Build for Windows
echo ========================================
echo.
@@ -27,7 +27,9 @@ pip install PyQt6 scapy requests pyinstaller --quiet
REM 4. Build .exe
echo [3/4] Building executable...
pyinstaller ^
--name "IoT_Firmware_Loader" ^
--name "MiraV3_Firmware_Loader" ^
--icon "icon.ico" ^
--add-data "icon.ico;." ^
--onefile ^
--windowed ^
--noconfirm ^
@@ -40,15 +42,16 @@ pyinstaller ^
--hidden-import "PyQt6.QtGui" ^
main.py
echo.
echo [4/4] Build complete!
echo.
if exist "dist\IoT_Firmware_Loader.exe" (
echo ✅ SUCCESS: dist\IoT_Firmware_Loader.exe
if exist "dist\MiraV3_Firmware_Loader.exe" (
echo ✅ SUCCESS: dist\MiraV3_Firmware_Loader.exe
echo.
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 Ban co the copy file .exe nay sang may khac va chay truc tiep.
) 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 os
import socket
import ipaddress
import platform
@@ -116,6 +117,15 @@ def get_default_network(ip):
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():
"""Collect machine info."""
hostname = socket.gethostname()
@@ -501,7 +511,8 @@ class App(QWidget):
def __init__(self):
super().__init__()
self.setWindowTitle("IoT Firmware Loader")
self.setWindowTitle("MiraV3 Firmware Loader")
self.setWindowIcon(QIcon(resource_path("icon.ico")))
self.firmware = None
self.all_devices = [] # all scan results (unfiltered)
self.devices = [] # currently displayed (filtered)
@@ -516,12 +527,12 @@ class App(QWidget):
layout.setContentsMargins(8, 6, 8, 6)
# ── Title ──
title = QLabel("IoT Firmware Loader (MiraV3)")
title = QLabel("MiraV3 Firmware Loader")
title.setObjectName("title")
title.setAlignment(Qt.AlignmentFlag.AlignCenter)
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.setStyleSheet(
"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"
# Activate virtual environment
if [ -d "venv" ]; then
source venv/bin/activate
else
if [ ! -d "venv" ]; then
echo "❌ Virtual environment not found. Creating..."
python3 -m venv venv
source venv/bin/activate
pip install PyQt6 scapy requests
fi
echo "🚀 Starting IoT Firmware Loader..."
source venv/bin/activate
pip install -r requirements.txt --quiet
echo "🚀 Starting MiraV3 Firmware Loader..."
python main.py