예제 #1
0
 def install_icon(self, icon, icon_path):
     """Install the icon."""
     png_bytes = get_pngbytes(icon)
     if png_bytes:
         icon = ElectronApplication.get_real_path(icon.original)
         self.set_icon(icon, icon_path, png_bytes, True)
     else:
         Logger.error("PNG file was not found.")
예제 #2
0
 def install_icon(self, icon, icon_path):
     """Install the icon."""
     png_bytes = get_pngbytes(icon)
     if png_bytes:
         icon = ElectronApplication.get_real_path(icon.original)
         self.set_icon(icon, icon_path, png_bytes, True)
     else:
         Logger.error("PNG file was not found.")
예제 #3
0
    def install_icon(self, icon, icon_path):
        """Install the icon."""
        icon.icon_size = App.icon_size()

        png_bytes = get_pngbytes(icon)

        if png_bytes:
            # Read a target file
            asar = AsarFile(path.join(str(icon_path), self.binary))
            target = B64ElectronApplication.get_real_path(self.file)
            file_content = asar.read_file(target).decode()
            # Create new base64 binary file
            base64_icon = b64encode(App.svg().to_bin(icon.theme, icon.icon_size, icon.icon_size))
            # Build new icon
            new_icon = "data:image/png;base64," + base64_icon.decode()
            # Replace the original icon with newly built one
            file_content = file_content.replace(icon.original, new_icon)
            bytes = file_content.encode()
            self.set_icon(target, icon_path, bytes, True)
        else:
            Logger.error("Icon file was not found.")
예제 #4
0
파일: pak.py 프로젝트: zrapic/Hardcode-Tray
 def install_icon(self, icon, icon_path):
     """Install the new icon."""
     png_bytes = get_pngbytes(icon)
     self.set_icon(icon, icon_path, png_bytes, True)
예제 #5
0
 def install_icon(self, icon, icon_path):
     """Install the new icon."""
     png_bytes = get_pngbytes(icon)
     self.set_icon(icon, icon_path, png_bytes, True)