22import sys
33import paramiko
44from stat import S_ISREG
5+
6+ def resource_path (relative_path ):
7+ """ Get absolute path to resource, works for dev and for PyInstaller """
8+ try :
9+ # PyInstaller creates a temp folder and stores path in _MEIPASS
10+ base_path = sys ._MEIPASS
11+ except Exception :
12+ base_path = os .path .abspath ("." )
13+
14+ return os .path .join (base_path , relative_path )
15+
516from PyQt6 .QtWidgets import (QApplication , QMainWindow , QWidget , QVBoxLayout , QHBoxLayout ,
617 QPushButton , QTextEdit , QLabel , QCheckBox , QFileDialog ,
718 QFrame , QDialog , QLineEdit , QFormLayout , QProgressBar )
819from PyQt6 .QtCore import QThread , pyqtSignal , Qt , QPropertyAnimation , QEasingCurve , QSettings , QSize , QTimer
9- from PyQt6 .QtGui import QFont , QPixmap , QFontDatabase , QColor
20+ from PyQt6 .QtGui import QFont , QPixmap , QFontDatabase , QColor , QIcon
1021
1122# --- Mac Cocoa Fix ---
1223# This line prevents the "could not find cocoa" error by forcing the plugin path
@@ -284,11 +295,12 @@ def update_status_ui(self, connected, usage, raw):
284295
285296 def init_fonts (self ):
286297 # Assumes fonts are in the same folder as the script
287- QFontDatabase .addApplicationFont ("OpenSans-Regular.ttf" )
288- QFontDatabase .addApplicationFont ("Norwester.otf" )
298+ QFontDatabase .addApplicationFont (resource_path ( "OpenSans-Regular.ttf" ) )
299+ QFontDatabase .addApplicationFont (resource_path ( "Norwester.otf" ) )
289300
290301 def setup_ui (self ):
291302 self .setWindowTitle ("619 Log Tool" )
303+ self .setWindowIcon (QIcon (resource_path ("1024hat.png" )))
292304 self .setMinimumSize (900 , 500 )
293305
294306 central = QWidget ()
@@ -309,8 +321,9 @@ def setup_ui(self):
309321 logo_container .setSpacing (5 )
310322
311323 self .logo = QLabel ()
312- if os .path .exists ("3840Wide.png" ):
313- self .logo .setPixmap (QPixmap ("3840Wide.png" ).scaled (150 , 80 , Qt .AspectRatioMode .KeepAspectRatio , Qt .TransformationMode .SmoothTransformation ))
324+ logo_img_path = resource_path ("3840Wide.png" )
325+ if os .path .exists (logo_img_path ):
326+ self .logo .setPixmap (QPixmap (logo_img_path ).scaled (150 , 80 , Qt .AspectRatioMode .KeepAspectRatio , Qt .TransformationMode .SmoothTransformation ))
314327 else :
315328 self .logo .setText ("🛡️" )
316329 self .logo .setStyleSheet ("font-size: 40px;" )
0 commit comments