Move Windows icon into share, and make get_resource_path work in Windows

This commit is contained in:
Micah Lee 2020-02-20 13:41:56 -08:00
parent f0428c775b
commit 583f8de8ff
No known key found for this signature in database
GPG key ID: 403C2657CD994F73
6 changed files with 15 additions and 7 deletions

View file

@ -250,17 +250,25 @@ class Common(object):
)
else:
if platform.system() == "Darwin":
# macOS
prefix = os.path.join(
os.path.dirname(os.path.dirname(sys.executable)), "Resources/share"
)
elif platform.system() == "Linux":
prefix = os.path.join(sys.prefix, "share", "dangerzone")
else:
# Linux
prefix = os.path.join(sys.prefix, "share/dangerzone")
# Windows
prefix = os.path.join(os.path.dirname(sys.executable), "share")
resource_path = os.path.join(prefix, filename)
return resource_path
def get_window_icon(self):
if platform.system() == "Windows":
path = self.get_resource_path("dangerzone.ico")
else:
path = self.get_resource_path("logo.png")
return QtGui.QIcon(path)
def open_find_viewer(self, filename):
if self.settings.get("open_app") in self.pdf_viewers:
if platform.system() == "Darwin":

View file

@ -51,7 +51,7 @@ class DockerInstaller(QtWidgets.QDialog):
self.common = common
self.setWindowTitle("dangerzone")
self.setWindowIcon(QtGui.QIcon(self.common.get_resource_path("logo.png")))
self.setWindowIcon(self.common.get_window_icon())
label = QtWidgets.QLabel()
if platform.system() == "Darwin":

View file

@ -13,7 +13,7 @@ class MainWindow(QtWidgets.QMainWindow):
self.common = common
self.setWindowTitle("dangerzone")
self.setWindowIcon(QtGui.QIcon(self.common.get_resource_path("logo.png")))
self.setWindowIcon(self.common.get_window_icon())
self.setMinimumWidth(600)
self.setMinimumHeight(400)

View file

@ -24,7 +24,7 @@ else:
datas = [("../../share", "share")]
if p == "Windows":
icon = os.path.join(root, "install", "windows", "dangerzone.ico")
icon = os.path.join(root, "share", "dangerzone.ico")
else:
icon = None

View file

@ -6,7 +6,7 @@
<Package Id="*" Keywords="Installer" Description="Dangerzone $(var.ProductVersion) Installer" Manufacturer="First Look Media" InstallerVersion="100" Languages="1033" Compressed="yes" SummaryCodepage="1252" />
<Media Id="1" Cabinet="product.cab" EmbedCab="yes" />
<Icon Id="ProductIcon" SourceFile="..\..\install\windows\dangerzone.ico"/>
<Icon Id="ProductIcon" SourceFile="..\..\share\dangerzone.ico"/>
<Property Id="ARPPRODUCTICON" Value="ProductIcon"/>
<Property Id="ARPHELPLINK" Value="https://github.com/firstlookmedia/dangerzone"/>
<Property Id="ARPURLINFOABOUT" Value="https://tech.firstlook.media"/>

View file

Before

Width:  |  Height:  |  Size: 66 KiB

After

Width:  |  Height:  |  Size: 66 KiB