Hello Michiel,
If both machines use Windows OS, then you can transfer the shortcuts as a part of system registry - all the contents of the following registry location: "HKEY_CURRENT_USER\Software\Agisoft\Metashape Pro\main\shortcuts".
Otherwise the following functions can be used to export/import shortcuts to text file:
import Metashape
from PySide2.QtCore import QSettings
def export_shortcuts():
path = Metashape.app.getSaveFileName("Specify file for shortcuts export:", filter = "*.txt" )
if not path:
print("Wrong path, script aborted")
return 0
file = open(path, "wt")
settings = QSettings()
settings.beginGroup("main/shortcuts")
shortcut_keys = settings.allKeys()
shortcuts = {}
for key in shortcut_keys:
shortcuts[key] = settings.value(key)
for key in shortcuts.keys():
if shortcuts[key]:
file.write("{:s}\t{:s}\n".format(key, shortcuts[key]))
file.close()
print("Shortcuts saved to " + path)
return 1
def import_shortcuts():
path = Metashape.app.getOpenFileName("Specify file for shortcuts import:", filter = "*.txt" )
if not path:
print("Wrong path, script aborted")
return 0
settings = QSettings()
settings.beginGroup("main/shortcuts")
file = open(path, "rt")
lines = file.readlines()
shortcuts = {}
for line in lines:
if len(line) < 3:
continue
shortcut_key, value = line.strip().split("\t",1)
shortcuts[shortcut_key] = value
settings.setValue(shortcut_key, value)
settings.endGroup()
settings.sync()
file.close()
print("Shortcuts loaded from " + path)
return 1
Note that after import operation Metashape window should be closed and then re-opened to apply the changes.