Skip to content

Commit

Permalink
Removed crash on lost icon
Browse files Browse the repository at this point in the history
  • Loading branch information
JRitmeester committed Aug 23, 2021
1 parent 5774738 commit 4d31376
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 0 additions & 2 deletions control.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,6 @@ def get_mapping(self):
if len(active_sessions_in_group) > 0:
session_dict[idx] = SessionGroup(group_idx=idx, sessions=active_sessions_in_group)

print(f"List found: {', '.join(target)}.")

if 'unmapped' in self.target_idxs.keys():
unmapped_idx = self.target_idxs['unmapped']
unmapped_sessions = [ses for ses in active_sessions.values() if ses not in mapped_sessions]
Expand Down
12 changes: 7 additions & 5 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,16 +70,18 @@ def except_hook(cls, exception, traceback):
app = QApplication(sys.argv)
w = QtWidgets.QWidget()

icon_dir = Path.cwd() / 'WaVeS/spec/icon.ico'
if icon_dir.is_file():
icon = QtGui.QIcon(str(icon_dir))
tray_icon = SystemTrayIcon(icon, w)
else:
icon_dir = Path.cwd() / 'WaVeS/spec/icon.ico' # For testing the compiled version in the dist folder
if not icon_dir.is_file():
icon_dir = Path.cwd() / 'icon.ico'
if not icon_dir.is_file():
QMessageBox.critical(None, "Icon not found", "Could not find the icon for the system tray. Please make sure "
"there is a file \"icon.ico\" in the same directory as the "
"executable.")
sys.exit(0)

icon = QtGui.QIcon(str(icon_dir))
tray_icon = SystemTrayIcon(icon, w)

# Create the stderr handler and point stderr to it
std_err_handler = StdErrHandler()
sys.stderr = std_err_handler
Expand Down

0 comments on commit 4d31376

Please sign in to comment.