macOS: add a few more known file types

Fixes https://gitlab.com/kicad/code/kicad/-/issues/14206
This commit is contained in:
Jon Evans 2023-11-16 12:10:50 -05:00
parent 18833ad271
commit 6cb046a4eb
10 changed files with 85 additions and 40 deletions

View File

@ -489,12 +489,13 @@ set_source_files_properties( dialogs/dialog_user_defined_signals.cpp
if( APPLE )
# setup bundle
set( EESCHEMA_RESOURCES eeschema.icns eeschema_doc.icns )
set_source_files_properties( "${CMAKE_CURRENT_SOURCE_DIR}/eeschema.icns" PROPERTIES
MACOSX_PACKAGE_LOCATION Resources
)
set_source_files_properties( "${CMAKE_CURRENT_SOURCE_DIR}/eeschema_doc.icns" PROPERTIES
MACOSX_PACKAGE_LOCATION Resources
set( EESCHEMA_RESOURCES eeschema.icns eeschema_doc.icns libedit.icns libedit_doc.icns )
set_source_files_properties(
"${CMAKE_CURRENT_SOURCE_DIR}/eeschema.icns"
"${CMAKE_CURRENT_SOURCE_DIR}/eeschema_doc.icns"
"${CMAKE_CURRENT_SOURCE_DIR}/libedit.icns"
"${CMAKE_CURRENT_SOURCE_DIR}/libedit_doc.icns"
PROPERTIES MACOSX_PACKAGE_LOCATION Resources
)
set( MACOSX_BUNDLE_ICON_FILE eeschema.icns )
set( MACOSX_BUNDLE_GUI_IDENTIFIER org.kicad.kicad )

BIN
eeschema/libedit.icns Normal file

Binary file not shown.

BIN
eeschema/libedit_doc.icns Normal file

Binary file not shown.

View File

@ -578,12 +578,13 @@ set_source_files_properties( dialogs/panel_setup_rules.cpp
if( APPLE )
# setup bundle
set( PCBNEW_RESOURCES pcbnew.icns pcbnew_doc.icns )
set_source_files_properties( "${CMAKE_CURRENT_SOURCE_DIR}/pcbnew.icns" PROPERTIES
MACOSX_PACKAGE_LOCATION Resources
)
set_source_files_properties( "${CMAKE_CURRENT_SOURCE_DIR}/pcbnew_doc.icns" PROPERTIES
MACOSX_PACKAGE_LOCATION Resources
set( PCBNEW_RESOURCES pcbnew.icns pcbnew_doc.icns fpedit.icns fpedit_doc.icns )
set_source_files_properties(
"${CMAKE_CURRENT_SOURCE_DIR}/pcbnew.icns"
"${CMAKE_CURRENT_SOURCE_DIR}/pcbnew_doc.icns"
"${CMAKE_CURRENT_SOURCE_DIR}/fpedit.icns"
"${CMAKE_CURRENT_SOURCE_DIR}/fpedit_doc.icns"
PROPERTIES MACOSX_PACKAGE_LOCATION Resources
)
set( MACOSX_BUNDLE_ICON_FILE pcbnew.icns )
set( MACOSX_BUNDLE_GUI_IDENTIFIER org.kicad.kicad )

BIN
pcbnew/fpedit.icns Normal file

Binary file not shown.

BIN
pcbnew/fpedit_doc.icns Normal file

Binary file not shown.

View File

@ -15,13 +15,23 @@
<key>CFBundleTypeName</key> <string>KiCad schematic document</string>
<key>LSHandlerRank</key> <string>Owner</string>
</dict>
<dict>
<key>CFBundleTypeRole</key> <string>None</string>
<key>CFBundleTypeExtensions</key>
<array>
<string>kicad_sym</string>
</array>
<key>CFBundleTypeIconFile</key> <string>libedit_doc.icns</string>
<key>CFBundleTypeName</key> <string>KiCad symbol library</string>
<key>LSHandlerRank</key> <string>None</string>
</dict>
</array>
<key>CFBundleDevelopmentRegion</key> <string>English</string>
<key>CFBundleExecutable</key> <string>eeschema</string>
<key>CFBundleGetInfoString</key> <string></string>
<key>CFBundleIconFile</key> <string>eeschema.icns</string>
<key>CFBundleIdentifier</key> <string>org.kicad.eeschema</string>
<key>CFBundleInfoDictionaryVersion</key> <string>6.0</string>
<key>CFBundleInfoDictionaryVersion</key> <string>7.0</string>
<key>CFBundleLongVersionString</key> <string>@KICAD_VERSION_FULL@</string>
<key>CFBundleName</key> <string>Schematic Editor</string>
<key>CFBundlePackageType</key> <string>APPL</string>

View File

@ -11,16 +11,25 @@
<string>pro</string>
<string>kicad_pro</string>
</array>
<key>CFBundleTypeName</key> <string>kicad project files</string>
<key>CFBundleTypeName</key> <string>KiCad project file</string>
<key>LSHandlerRank</key> <string>Owner</string>
</dict>
<dict>
<key>CFBundleTypeRole</key> <string>None</string>
<key>CFBundleTypeExtensions</key>
<array>
<string>kicad_mod</string>
</array>
<key>CFBundleTypeName</key> <string>KiCad project local settings</string>
<key>LSHandlerRank</key> <string>None</string>
</dict>
</array>
<key>CFBundleDevelopmentRegion</key> <string>English</string>
<key>CFBundleExecutable</key> <string>kicad</string>
<key>CFBundleGetInfoString</key> <string></string>
<key>CFBundleIconFile</key> <string>kicad.icns</string>
<key>CFBundleIdentifier</key> <string>org.kicad.kicad</string>
<key>CFBundleInfoDictionaryVersion</key> <string>6.0</string>
<key>CFBundleInfoDictionaryVersion</key> <string>7.0</string>
<key>CFBundleLongVersionString</key> <string>@KICAD_VERSION_FULL@</string>
<key>CFBundleName</key> <string>KiCad</string>
<key>CFBundlePackageType</key> <string>APPL</string>

View File

@ -13,16 +13,35 @@
<string>brd</string>
</array>
<key>CFBundleTypeName</key> <string>pcbnew board</string>
<key>CFBundleTypeName</key> <string>KiCad PCB document</string>
<key>LSHandlerRank</key> <string>Owner</string>
</dict>
<dict>
<key>CFBundleTypeRole</key> <string>None</string>
<key>CFBundleTypeExtensions</key>
<array>
<string>kicad_mod</string>
</array>
<key>CFBundleTypeIconFile</key> <string>fpedit_doc.icns</string>
<key>CFBundleTypeName</key> <string>KiCad footprint</string>
<key>LSHandlerRank</key> <string>None</string>
</dict>
<dict>
<key>CFBundleTypeRole</key> <string>None</string>
<key>CFBundleTypeExtensions</key>
<array>
<string>kicad_dru</string>
</array>
<key>CFBundleTypeName</key> <string>KiCad custom design rules</string>
<key>LSHandlerRank</key> <string>None</string>
</dict>
</array>
<key>CFBundleExecutable</key> <string>pcbnew</string>
<key>CFBundleGetInfoString</key> <string></string>
<key>CFBundleIconFile</key> <string>pcbnew.icns</string>
<key>CFBundleIdentifier</key> <string>org.kicad.pcbnew</string>
<key>CFBundleInfoDictionaryVersion</key> <string>6.0</string>
<key>CFBundleInfoDictionaryVersion</key> <string>7.0</string>
<key>CFBundleLongVersionString</key> <string>@KICAD_VERSION_FULL@</string>
<key>CFBundleName</key> <string>PCB Editor</string>
<key>CFBundlePackageType</key> <string>APPL</string>

51
tools/build/mk_macos_icons.py Normal file → Executable file
View File

@ -1,36 +1,38 @@
#!/usr/bin/env python
#!/usr/bin/env python3
# This script regenerates the .icns files for MacOS application packaging.
# You need to be running on MacOS to use it (for iconutil)
# You also need imagemagick + rsvg installed, with something like:
# brew install imagemagick --with-librsvg
# You also need rsvg-convert installed, with something like:
# brew install librsvg
import os
from shutil import copy, rmtree
from subprocess import call
ICON_SOURCES = "../../resources/bitmaps_png/sources/"
ICON_SOURCES = "../../resources/bitmaps_png/sources/light/"
# (sourcename, (dest1, dest2, ...), output_dir)
ICONS = [
("bitmap2component", ("bitmap2component",), "../../bitmap2component"),
("cvpcb", ("cvpcb", "cvpcb_doc"), "../../cvpcb"),
("eeschema", ("eeschema", "eeschema_doc"), "../../eeschema"),
("libedit", ("eeschema", "eeschema_doc"), "../../eeschema"),
("gerbview", ("gerbview", "gerbview_doc"), "../../gerbview"),
("kicad", ("kicad", "kicad_doc"), "../../kicad"),
("pagelayout_editor", ("pl_editor", "pl_editor_doc"), "../../pagelayout_editor"),
("pcbcalculator", ("pcb_calculator",), "../../pcb_calculator"),
("pcbnew", ("pcbnew", "pcbnew_doc"), "../../pcbnew")
# ("bitmap2component", ("bitmap2component",), "../../bitmap2component"),
# ("cvpcb", ("cvpcb", "cvpcb_doc"), "../../cvpcb"),
# ("eeschema", ("eeschema", "eeschema_doc"), "../../eeschema"),
("libedit", ("libedit", "libedit_doc"), "../../eeschema"),
# ("gerbview", ("gerbview", "gerbview_doc"), "../../gerbview"),
# ("kicad", ("kicad", "kicad_doc"), "../../kicad"),
# ("pagelayout_editor", ("pagelayout_editor", "pagelayout_editor_doc"), "../../pagelayout_editor"),
# ("pcbcalculator", ("pcb_calculator",), "../../pcb_calculator"),
# ("pcbnew", ("pcbnew", "pcbnew_doc"), "../../pcbnew"),
("modedit", ("fpedit", "fpedit_doc"), "../../pcbnew")
]
SIZES = [
("!16x16", ("16x16",)),
("!32x32", ("16x16@2x", "32x32")),
("!64x64", ("32x32@2x",)),
("!128x128", ("128x128",)),
("!256x256", ("128x128@2x", "256x256")),
("!512x512", ("256x256@2x", "512x512")),
("!1024x1024", ("512x512@2x",))
("16", ("16x16",)),
("32", ("16x16@2x", "32x32")),
("64", ("32x32@2x",)),
("128", ("128x128",)),
("256", ("128x128@2x", "256x256")),
("512", ("256x256@2x", "512x512")),
("1024", ("512x512@2x",))
]
if __name__ == '__main__':
@ -39,13 +41,16 @@ if __name__ == '__main__':
src = ICON_SOURCES + "icon_" + src + ".svg"
iconset = dest[0] + ".iconset"
os.mkdir(iconset)
for size, outputs in SIZES:
dest_path = os.path.join(iconset, "icon_" + outputs[0] + ".png")
print size, src, dest_path
call(["convert", "-background", "none", "-density", "5000",
"-resize", size, src, dest_path])
convert_size = "!{}x{}".format(size, size)
print(size, convert_size, src, dest_path)
call(["rsvg-convert", "--background-color=transparent", "--dpi-x=5000", "--dpi-y=5000",
"--width={}".format(size), "--height={}".format(size), "--output={}".format(dest_path),
src])
for duplicate in outputs[1:]:
dupe_path = os.path.join(iconset, "icon_" + duplicate + ".png")
copy(dest_path, dupe_path)