Add application icon support for GUI and compiled executables
Added platform-specific icon support for both the running application and compiled executables: New files: - create_icons.py: Script to convert PNG to platform-specific formats - Generates .ico for Windows (16, 32, 48, 256px sizes) - Generates .iconset for macOS (ready for iconutil conversion) - LocalTranscription.png: Source icon image - LocalTranscription.ico: Windows icon file (multi-size) - LocalTranscription.iconset/: macOS icon set (needs iconutil on macOS) GUI changes: - main.py: Set application-wide icon for taskbar/dock - main_window_qt.py: Set window icon for GUI window Build configuration: - local-transcription.spec: Use platform-specific icons in PyInstaller - Windows builds use LocalTranscription.ico - macOS builds use LocalTranscription.icns (when generated) To generate macOS .icns file on macOS: iconutil -c icns LocalTranscription.iconset 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
BIN
LocalTranscription.ico
Normal file
|
After Width: | Height: | Size: 23 KiB |
BIN
LocalTranscription.iconset/icon_128x128.png
Normal file
|
After Width: | Height: | Size: 8.4 KiB |
BIN
LocalTranscription.iconset/icon_128x128@2x.png
Normal file
|
After Width: | Height: | Size: 18 KiB |
BIN
LocalTranscription.iconset/icon_16x16.png
Normal file
|
After Width: | Height: | Size: 647 B |
BIN
LocalTranscription.iconset/icon_16x16@2x.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
LocalTranscription.iconset/icon_256x256.png
Normal file
|
After Width: | Height: | Size: 18 KiB |
BIN
LocalTranscription.iconset/icon_256x256@2x.png
Normal file
|
After Width: | Height: | Size: 38 KiB |
BIN
LocalTranscription.iconset/icon_32x32.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
LocalTranscription.iconset/icon_32x32@2x.png
Normal file
|
After Width: | Height: | Size: 3.7 KiB |
BIN
LocalTranscription.iconset/icon_512x512.png
Normal file
|
After Width: | Height: | Size: 38 KiB |
BIN
LocalTranscription.iconset/icon_512x512@2x.png
Normal file
|
After Width: | Height: | Size: 47 KiB |
BIN
LocalTranscription.png
Normal file
|
After Width: | Height: | Size: 48 KiB |
89
create_icons.py
Normal file
@@ -0,0 +1,89 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
"""
|
||||||
|
Create platform-specific icon files from LocalTranscription.png
|
||||||
|
Generates .ico (Windows) and .icns (macOS) from the PNG source.
|
||||||
|
"""
|
||||||
|
|
||||||
|
from PIL import Image
|
||||||
|
import sys
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
def create_ico(png_path, ico_path):
|
||||||
|
"""Create Windows ICO file from PNG."""
|
||||||
|
img = Image.open(png_path)
|
||||||
|
|
||||||
|
# ICO files typically contain multiple sizes
|
||||||
|
# Windows uses 16, 32, 48, 256 pixel sizes
|
||||||
|
sizes = [(16, 16), (32, 32), (48, 48), (256, 256)]
|
||||||
|
|
||||||
|
# Create list of resized images
|
||||||
|
icons = []
|
||||||
|
for size in sizes:
|
||||||
|
resized = img.resize(size, Image.Resampling.LANCZOS)
|
||||||
|
icons.append(resized)
|
||||||
|
|
||||||
|
# Save as ICO
|
||||||
|
img.save(ico_path, format='ICO', sizes=sizes)
|
||||||
|
print(f"✓ Created {ico_path}")
|
||||||
|
|
||||||
|
def create_iconset_for_icns(png_path, iconset_dir):
|
||||||
|
"""Create .iconset directory with all required sizes for macOS ICNS."""
|
||||||
|
img = Image.open(png_path)
|
||||||
|
|
||||||
|
# macOS requires these specific sizes and naming
|
||||||
|
sizes = {
|
||||||
|
'icon_16x16.png': (16, 16),
|
||||||
|
'icon_16x16@2x.png': (32, 32),
|
||||||
|
'icon_32x32.png': (32, 32),
|
||||||
|
'icon_32x32@2x.png': (64, 64),
|
||||||
|
'icon_128x128.png': (128, 128),
|
||||||
|
'icon_128x128@2x.png': (256, 256),
|
||||||
|
'icon_256x256.png': (256, 256),
|
||||||
|
'icon_256x256@2x.png': (512, 512),
|
||||||
|
'icon_512x512.png': (512, 512),
|
||||||
|
'icon_512x512@2x.png': (1024, 1024),
|
||||||
|
}
|
||||||
|
|
||||||
|
iconset_dir.mkdir(exist_ok=True)
|
||||||
|
|
||||||
|
for filename, size in sizes.items():
|
||||||
|
resized = img.resize(size, Image.Resampling.LANCZOS)
|
||||||
|
output_path = iconset_dir / filename
|
||||||
|
resized.save(output_path, format='PNG')
|
||||||
|
|
||||||
|
print(f"✓ Created iconset directory: {iconset_dir}")
|
||||||
|
print(" To create ICNS on macOS, run:")
|
||||||
|
print(f" iconutil -c icns {iconset_dir}")
|
||||||
|
|
||||||
|
def main():
|
||||||
|
"""Main function to create all icon files."""
|
||||||
|
script_dir = Path(__file__).parent
|
||||||
|
png_path = script_dir / "LocalTranscription.png"
|
||||||
|
|
||||||
|
if not png_path.exists():
|
||||||
|
print(f"✗ Error: {png_path} not found!")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
print("Creating platform-specific icons from LocalTranscription.png...")
|
||||||
|
print("=" * 60)
|
||||||
|
|
||||||
|
# Create Windows ICO
|
||||||
|
ico_path = script_dir / "LocalTranscription.ico"
|
||||||
|
create_ico(png_path, ico_path)
|
||||||
|
|
||||||
|
# Create macOS iconset (need iconutil on macOS to convert to ICNS)
|
||||||
|
iconset_dir = script_dir / "LocalTranscription.iconset"
|
||||||
|
create_iconset_for_icns(png_path, iconset_dir)
|
||||||
|
|
||||||
|
print("=" * 60)
|
||||||
|
print("✓ Icon creation complete!")
|
||||||
|
print()
|
||||||
|
print("Files created:")
|
||||||
|
print(f" - {ico_path} (Windows)")
|
||||||
|
print(f" - {iconset_dir}/ (macOS - needs iconutil)")
|
||||||
|
print()
|
||||||
|
print("Note: On macOS, run this to create .icns:")
|
||||||
|
print(f" iconutil -c icns {iconset_dir}")
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
@@ -100,6 +100,12 @@ class MainWindow(QMainWindow):
|
|||||||
self.setWindowTitle("Local Transcription")
|
self.setWindowTitle("Local Transcription")
|
||||||
self.resize(900, 700)
|
self.resize(900, 700)
|
||||||
|
|
||||||
|
# Set application icon
|
||||||
|
icon_path = Path(__file__).parent.parent / "LocalTranscription.png"
|
||||||
|
if icon_path.exists():
|
||||||
|
from PySide6.QtGui import QIcon
|
||||||
|
self.setWindowIcon(QIcon(str(icon_path)))
|
||||||
|
|
||||||
# Update splash
|
# Update splash
|
||||||
self._update_splash("Creating user interface...")
|
self._update_splash("Creating user interface...")
|
||||||
|
|
||||||
|
|||||||
@@ -157,7 +157,7 @@ exe = EXE(
|
|||||||
target_arch=None,
|
target_arch=None,
|
||||||
codesign_identity=None,
|
codesign_identity=None,
|
||||||
entitlements_file=None,
|
entitlements_file=None,
|
||||||
icon=None, # Add icon file path here if you have one
|
icon='LocalTranscription.ico' if is_windows else 'LocalTranscription.icns', # Platform-specific icon
|
||||||
)
|
)
|
||||||
|
|
||||||
coll = COLLECT(
|
coll = COLLECT(
|
||||||
|
|||||||
6
main.py
@@ -74,6 +74,12 @@ def main():
|
|||||||
app.setApplicationName("Local Transcription")
|
app.setApplicationName("Local Transcription")
|
||||||
app.setOrganizationName("LocalTranscription")
|
app.setOrganizationName("LocalTranscription")
|
||||||
|
|
||||||
|
# Set application icon
|
||||||
|
icon_path = project_root / "LocalTranscription.png"
|
||||||
|
if icon_path.exists():
|
||||||
|
from PySide6.QtGui import QIcon
|
||||||
|
app.setWindowIcon(QIcon(str(icon_path)))
|
||||||
|
|
||||||
# Create and show splash screen
|
# Create and show splash screen
|
||||||
splash = create_splash_screen()
|
splash = create_splash_screen()
|
||||||
splash.show()
|
splash.show()
|
||||||
|
|||||||