Add fallback handling for missing icon files
Add graceful fallback behavior when icon image files (refresh.png, settings.png, MSMD32.png) are not found. The application now uses Unicode symbols (⟳, ⚙) as button text alternatives, preventing crashes when running without bundled assets. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -6,7 +6,17 @@
|
|||||||
"Bash(pip install:*)",
|
"Bash(pip install:*)",
|
||||||
"Bash(python:*)",
|
"Bash(python:*)",
|
||||||
"Bash(git init:*)",
|
"Bash(git init:*)",
|
||||||
"Bash(git add:*)"
|
"Bash(git add:*)",
|
||||||
|
"Bash(cat:*)",
|
||||||
|
"Bash(git commit:*)",
|
||||||
|
"Bash(git push:*)",
|
||||||
|
"Bash(ls:*)",
|
||||||
|
"Bash(git tag:*)",
|
||||||
|
"Bash(pyinstaller:*)",
|
||||||
|
"Bash(open:*)",
|
||||||
|
"Bash(osascript:*)",
|
||||||
|
"Bash(killall:*)",
|
||||||
|
"Bash(git fetch:*)"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -175,14 +175,22 @@ class App(QWidget):
|
|||||||
self.portRefreshButton = QPushButton(self)
|
self.portRefreshButton = QPushButton(self)
|
||||||
self.portRefreshButton.setToolTip('Press to detect port of connected base station')
|
self.portRefreshButton.setToolTip('Press to detect port of connected base station')
|
||||||
self.portRefreshButton.clicked.connect(self.refreshPorts)
|
self.portRefreshButton.clicked.connect(self.refreshPorts)
|
||||||
|
if os.path.exists('refresh.png'):
|
||||||
self.portRefreshButton.setIcon(QIcon('refresh.png'))
|
self.portRefreshButton.setIcon(QIcon('refresh.png'))
|
||||||
self.portRefreshButton.setFixedWidth(24)
|
self.portRefreshButton.setFixedWidth(24)
|
||||||
|
else:
|
||||||
|
self.portRefreshButton.setText('⟳')
|
||||||
|
self.portRefreshButton.setFixedWidth(30)
|
||||||
|
|
||||||
self.settingsButton = QPushButton()
|
self.settingsButton = QPushButton()
|
||||||
self.settingsButton.setToolTip('Open the Settings Dialog')
|
self.settingsButton.setToolTip('Open the Settings Dialog')
|
||||||
|
self.settingsButton.clicked.connect(self.openSettings)
|
||||||
|
if os.path.exists('settings.png'):
|
||||||
self.settingsButton.setIcon(QIcon('settings.png'))
|
self.settingsButton.setIcon(QIcon('settings.png'))
|
||||||
self.settingsButton.setMaximumWidth(24)
|
self.settingsButton.setMaximumWidth(24)
|
||||||
self.settingsButton.clicked.connect(self.openSettings)
|
else:
|
||||||
|
self.settingsButton.setText('⚙')
|
||||||
|
self.settingsButton.setMaximumWidth(30)
|
||||||
|
|
||||||
self.connected = False
|
self.connected = False
|
||||||
self.refreshPorts()
|
self.refreshPorts()
|
||||||
@@ -269,6 +277,7 @@ class App(QWidget):
|
|||||||
self.setLayout(self.stackedLayout)
|
self.setLayout(self.stackedLayout)
|
||||||
self.setWindowTitle(self.title)
|
self.setWindowTitle(self.title)
|
||||||
self.setGeometry(self.left, self.top, self.width, self.height)
|
self.setGeometry(self.left, self.top, self.width, self.height)
|
||||||
|
if os.path.exists('MSMD32.png'):
|
||||||
self.setWindowIcon(QIcon('MSMD32.png'))
|
self.setWindowIcon(QIcon('MSMD32.png'))
|
||||||
self.cleanupEvent.connect(self.cleanupStuff)
|
self.cleanupEvent.connect(self.cleanupStuff)
|
||||||
self.show()
|
self.show()
|
||||||
|
|||||||
@@ -25,6 +25,8 @@ class Settings(QWidget):
|
|||||||
self.__UserAbort = True
|
self.__UserAbort = True
|
||||||
|
|
||||||
#-----Widget Settings-----
|
#-----Widget Settings-----
|
||||||
|
import os
|
||||||
|
if os.path.exists('MSMD32.png'):
|
||||||
self.setWindowIcon(QIcon('MSMD32.png'))
|
self.setWindowIcon(QIcon('MSMD32.png'))
|
||||||
self.setWindowTitle('MSMD Settings')
|
self.setWindowTitle('MSMD Settings')
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user