Skip to content

Commit d46829d

Browse files
committed
Fixed icon not showing up in the taskbar.
Now explicitly setting an application icon instead of relying on the exe to provide it.
1 parent 03693d1 commit d46829d

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

TardisDiff.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
import sys
22
from PyQt5 import QtWidgets, QtCore, QtGui
3+
import ctypes
34

45

56
class TardisDiff(QtWidgets.QMainWindow):
67

78
def __init__(self):
89
super(TardisDiff, self).__init__()
910
self.diff = 0
10-
1111
self.clipboard = QtWidgets.QApplication.clipboard()
1212
QtWidgets.QShortcut(QtGui.QKeySequence("Ctrl+Shift+C"), self,
1313
self.setClipboard)
14+
# Google for a fancy tardis icon until I've made one
15+
self.setWindowIcon(QtGui.QIcon('tardis.ico'))
1416
self.initUI()
1517

1618
def initUI(self):
@@ -95,4 +97,15 @@ def main():
9597

9698

9799
if __name__ == '__main__':
100+
myappid = 'net.xerael.tardisdiff'
101+
if sys.platform == "win32":
102+
"""
103+
This is for collapsing on the task bar on windows 7/8 and using
104+
the application icon on the task bar instead of the python icon
105+
if running using a python executable.
106+
107+
See:
108+
http://stackoverflow.com/questions/1551605/how-to-set-applications-taskbar-icon-in-windows-7
109+
"""
110+
ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID(myappid)
98111
main()

setup.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
# Dependencies are automatically detected, but it might need
55
# fine tuning.
66
copyfiles = [
7-
('C:\Python34\Lib\site-packages\PyQt5\libEGL.dll', 'libEGL.dll')]
7+
('C:\Python34\Lib\site-packages\PyQt5\libEGL.dll', 'libEGL.dll'),
8+
'tardis.ico' # Google for a fancy tardis icon until I've made one
9+
]
810
buildOptions = dict(packages=[], excludes=[], include_files=copyfiles)
911

1012
# GUI applications require a different base on Windows (the default is for a
@@ -19,7 +21,7 @@
1921
base=base,
2022
shortcutName="TardisDiff",
2123
shortcutDir="DesktopFolder",
22-
#icon="tardis.ico" Google for a fancy tardis icon until I've made one.
24+
icon="tardis.ico" # Google for a fancy tardis icon until I've made one
2325
)
2426
]
2527

0 commit comments

Comments
 (0)