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 ) if( APPLE )
# setup bundle # setup bundle
set( EESCHEMA_RESOURCES eeschema.icns eeschema_doc.icns ) set( EESCHEMA_RESOURCES eeschema.icns eeschema_doc.icns libedit.icns libedit_doc.icns )
set_source_files_properties( "${CMAKE_CURRENT_SOURCE_DIR}/eeschema.icns" PROPERTIES set_source_files_properties(
MACOSX_PACKAGE_LOCATION Resources "${CMAKE_CURRENT_SOURCE_DIR}/eeschema.icns"
) "${CMAKE_CURRENT_SOURCE_DIR}/eeschema_doc.icns"
set_source_files_properties( "${CMAKE_CURRENT_SOURCE_DIR}/eeschema_doc.icns" PROPERTIES "${CMAKE_CURRENT_SOURCE_DIR}/libedit.icns"
MACOSX_PACKAGE_LOCATION Resources "${CMAKE_CURRENT_SOURCE_DIR}/libedit_doc.icns"
PROPERTIES MACOSX_PACKAGE_LOCATION Resources
) )
set( MACOSX_BUNDLE_ICON_FILE eeschema.icns ) set( MACOSX_BUNDLE_ICON_FILE eeschema.icns )
set( MACOSX_BUNDLE_GUI_IDENTIFIER org.kicad.kicad ) 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 ) if( APPLE )
# setup bundle # setup bundle
set( PCBNEW_RESOURCES pcbnew.icns pcbnew_doc.icns ) set( PCBNEW_RESOURCES pcbnew.icns pcbnew_doc.icns fpedit.icns fpedit_doc.icns )
set_source_files_properties( "${CMAKE_CURRENT_SOURCE_DIR}/pcbnew.icns" PROPERTIES set_source_files_properties(
MACOSX_PACKAGE_LOCATION Resources "${CMAKE_CURRENT_SOURCE_DIR}/pcbnew.icns"
) "${CMAKE_CURRENT_SOURCE_DIR}/pcbnew_doc.icns"
set_source_files_properties( "${CMAKE_CURRENT_SOURCE_DIR}/pcbnew_doc.icns" PROPERTIES "${CMAKE_CURRENT_SOURCE_DIR}/fpedit.icns"
MACOSX_PACKAGE_LOCATION Resources "${CMAKE_CURRENT_SOURCE_DIR}/fpedit_doc.icns"
PROPERTIES MACOSX_PACKAGE_LOCATION Resources
) )
set( MACOSX_BUNDLE_ICON_FILE pcbnew.icns ) set( MACOSX_BUNDLE_ICON_FILE pcbnew.icns )
set( MACOSX_BUNDLE_GUI_IDENTIFIER org.kicad.kicad ) 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>CFBundleTypeName</key> <string>KiCad schematic document</string>
<key>LSHandlerRank</key> <string>Owner</string> <key>LSHandlerRank</key> <string>Owner</string>
</dict> </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> </array>
<key>CFBundleDevelopmentRegion</key> <string>English</string> <key>CFBundleDevelopmentRegion</key> <string>English</string>
<key>CFBundleExecutable</key> <string>eeschema</string> <key>CFBundleExecutable</key> <string>eeschema</string>
<key>CFBundleGetInfoString</key> <string></string> <key>CFBundleGetInfoString</key> <string></string>
<key>CFBundleIconFile</key> <string>eeschema.icns</string> <key>CFBundleIconFile</key> <string>eeschema.icns</string>
<key>CFBundleIdentifier</key> <string>org.kicad.eeschema</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>CFBundleLongVersionString</key> <string>@KICAD_VERSION_FULL@</string>
<key>CFBundleName</key> <string>Schematic Editor</string> <key>CFBundleName</key> <string>Schematic Editor</string>
<key>CFBundlePackageType</key> <string>APPL</string> <key>CFBundlePackageType</key> <string>APPL</string>

View File

@ -11,16 +11,25 @@
<string>pro</string> <string>pro</string>
<string>kicad_pro</string> <string>kicad_pro</string>
</array> </array>
<key>CFBundleTypeName</key> <string>kicad project files</string> <key>CFBundleTypeName</key> <string>KiCad project file</string>
<key>LSHandlerRank</key> <string>Owner</string> <key>LSHandlerRank</key> <string>Owner</string>
</dict> </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> </array>
<key>CFBundleDevelopmentRegion</key> <string>English</string> <key>CFBundleDevelopmentRegion</key> <string>English</string>
<key>CFBundleExecutable</key> <string>kicad</string> <key>CFBundleExecutable</key> <string>kicad</string>
<key>CFBundleGetInfoString</key> <string></string> <key>CFBundleGetInfoString</key> <string></string>
<key>CFBundleIconFile</key> <string>kicad.icns</string> <key>CFBundleIconFile</key> <string>kicad.icns</string>
<key>CFBundleIdentifier</key> <string>org.kicad.kicad</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>CFBundleLongVersionString</key> <string>@KICAD_VERSION_FULL@</string>
<key>CFBundleName</key> <string>KiCad</string> <key>CFBundleName</key> <string>KiCad</string>
<key>CFBundlePackageType</key> <string>APPL</string> <key>CFBundlePackageType</key> <string>APPL</string>

View File

@ -13,16 +13,35 @@
<string>brd</string> <string>brd</string>
</array> </array>
<key>CFBundleTypeName</key> <string>pcbnew board</string> <key>CFBundleTypeName</key> <string>KiCad PCB document</string>
<key>LSHandlerRank</key> <string>Owner</string> <key>LSHandlerRank</key> <string>Owner</string>
</dict> </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> </array>
<key>CFBundleExecutable</key> <string>pcbnew</string> <key>CFBundleExecutable</key> <string>pcbnew</string>
<key>CFBundleGetInfoString</key> <string></string> <key>CFBundleGetInfoString</key> <string></string>
<key>CFBundleIconFile</key> <string>pcbnew.icns</string> <key>CFBundleIconFile</key> <string>pcbnew.icns</string>
<key>CFBundleIdentifier</key> <string>org.kicad.pcbnew</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>CFBundleLongVersionString</key> <string>@KICAD_VERSION_FULL@</string>
<key>CFBundleName</key> <string>PCB Editor</string> <key>CFBundleName</key> <string>PCB Editor</string>
<key>CFBundlePackageType</key> <string>APPL</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. # This script regenerates the .icns files for MacOS application packaging.
# You need to be running on MacOS to use it (for iconutil) # You need to be running on MacOS to use it (for iconutil)
# You also need imagemagick + rsvg installed, with something like: # You also need rsvg-convert installed, with something like:
# brew install imagemagick --with-librsvg # brew install librsvg
import os import os
from shutil import copy, rmtree from shutil import copy, rmtree
from subprocess import call from subprocess import call
ICON_SOURCES = "../../resources/bitmaps_png/sources/" ICON_SOURCES = "../../resources/bitmaps_png/sources/light/"
# (sourcename, (dest1, dest2, ...), output_dir)
ICONS = [ ICONS = [
("bitmap2component", ("bitmap2component",), "../../bitmap2component"), # ("bitmap2component", ("bitmap2component",), "../../bitmap2component"),
("cvpcb", ("cvpcb", "cvpcb_doc"), "../../cvpcb"), # ("cvpcb", ("cvpcb", "cvpcb_doc"), "../../cvpcb"),
("eeschema", ("eeschema", "eeschema_doc"), "../../eeschema"), # ("eeschema", ("eeschema", "eeschema_doc"), "../../eeschema"),
("libedit", ("eeschema", "eeschema_doc"), "../../eeschema"), ("libedit", ("libedit", "libedit_doc"), "../../eeschema"),
("gerbview", ("gerbview", "gerbview_doc"), "../../gerbview"), # ("gerbview", ("gerbview", "gerbview_doc"), "../../gerbview"),
("kicad", ("kicad", "kicad_doc"), "../../kicad"), # ("kicad", ("kicad", "kicad_doc"), "../../kicad"),
("pagelayout_editor", ("pl_editor", "pl_editor_doc"), "../../pagelayout_editor"), # ("pagelayout_editor", ("pagelayout_editor", "pagelayout_editor_doc"), "../../pagelayout_editor"),
("pcbcalculator", ("pcb_calculator",), "../../pcb_calculator"), # ("pcbcalculator", ("pcb_calculator",), "../../pcb_calculator"),
("pcbnew", ("pcbnew", "pcbnew_doc"), "../../pcbnew") # ("pcbnew", ("pcbnew", "pcbnew_doc"), "../../pcbnew"),
("modedit", ("fpedit", "fpedit_doc"), "../../pcbnew")
] ]
SIZES = [ SIZES = [
("!16x16", ("16x16",)), ("16", ("16x16",)),
("!32x32", ("16x16@2x", "32x32")), ("32", ("16x16@2x", "32x32")),
("!64x64", ("32x32@2x",)), ("64", ("32x32@2x",)),
("!128x128", ("128x128",)), ("128", ("128x128",)),
("!256x256", ("128x128@2x", "256x256")), ("256", ("128x128@2x", "256x256")),
("!512x512", ("256x256@2x", "512x512")), ("512", ("256x256@2x", "512x512")),
("!1024x1024", ("512x512@2x",)) ("1024", ("512x512@2x",))
] ]
if __name__ == '__main__': if __name__ == '__main__':
@ -39,13 +41,16 @@ if __name__ == '__main__':
src = ICON_SOURCES + "icon_" + src + ".svg" src = ICON_SOURCES + "icon_" + src + ".svg"
iconset = dest[0] + ".iconset" iconset = dest[0] + ".iconset"
os.mkdir(iconset) os.mkdir(iconset)
for size, outputs in SIZES: for size, outputs in SIZES:
dest_path = os.path.join(iconset, "icon_" + outputs[0] + ".png") dest_path = os.path.join(iconset, "icon_" + outputs[0] + ".png")
print size, src, dest_path convert_size = "!{}x{}".format(size, size)
call(["convert", "-background", "none", "-density", "5000", print(size, convert_size, src, dest_path)
"-resize", 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:]: for duplicate in outputs[1:]:
dupe_path = os.path.join(iconset, "icon_" + duplicate + ".png") dupe_path = os.path.join(iconset, "icon_" + duplicate + ".png")
copy(dest_path, dupe_path) copy(dest_path, dupe_path)