-
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmac.py
More file actions
52 lines (43 loc) · 2.07 KB
/
mac.py
File metadata and controls
52 lines (43 loc) · 2.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#Author-Thomas Axelsson
#Description-Lists all keyboard shortcuts
# This file is part of KeyboardShortcutsSimple, a Fusion 360 add-in for naming
# features directly after creation.
#
# Copyright (C) 2020 Thomas Axelsson
#
# KeyboardShortcutsSimple is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# KeyboardShortcutsSimple is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with KeyboardShortcutsSimple. If not, see <https://www.gnu.org/licenses/>.
# Platform-specific code
import pathlib
def fusion_key_to_keyboard_key(key_sequence):
# TODO
keys = key_sequence.split('+')
return key_sequence, keys[-1]
def find_options_file(app):
# Seems that Macs can have the files in different locations:
# https://forums.autodesk.com/t5/fusion-360-support/cannot-find-fuision360-documents-locally-in-macos/td-p/8324149
# * /Users/<username>/Library/Application Support/Autodesk
# * /Users/<username>/Library/Containers/com.autodesk.mas.fusion360/Data/Library/Application Support/Autodesk
# append: /Neutron Platform/Options/<user id>\<file.xml>
# Idea: If neededn, check where our add-in is running to determine which path to use.
autodesk_paths = [
pathlib.Path.home() / 'Library/Application Support/Autodesk',
pathlib.Path.home() / 'Library/Containers/com.autodesk.mas.fusion360/Data/Library/Application Support/Autodesk'
]
for autodesk_path in autodesk_paths:
if autodesk_path.exists():
break
else:
raise Exception("Could not find Autodesk directory")
options_path = autodesk_path / 'Neutron Platform' / 'Options' / app.userId / 'NGlobalOptions.xml'
return options_path