Skip to content

Commit

Permalink
Prepare "disabled" icons for when isEnabled starts working. Explanati…
Browse files Browse the repository at this point in the history
…on message when user presses icon.
  • Loading branch information
thomasa88 committed Aug 15, 2020
1 parent b2e85ab commit d32d538
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 0 deletions.
6 changes: 6 additions & 0 deletions AnyShortcut.py
Original file line number Diff line number Diff line change
Expand Up @@ -506,10 506,16 @@ def run(context):
f'{NAME} (v{manifest_["version"]})',
'Open the menu to add keyboard shortcuts to commands.',
'./resources/anyshortcut')
events_manager_.add_handler(about_cmd_def.commandCreated,
callback=lambda args: ui_.messageBox(
'This icon should not be clickable, but it is, due to a Fusion bug.\n\n'
'Click on the drop down menu to access the controls'))
about_control = panel_.controls.addCommand(about_cmd_def)
about_control.isPromoted = True
about_control.isPromotedByDefault = True
about_control.isVisible = False
# isEnabled does not work in the current version of Fusion 360 (2020-08-15):
# https://forums.autodesk.com/t5/fusion-360-api-and-scripts/how-to-disable-my-command-button-on-the-toolbar/td-p/9538998
about_cmd_def.controlDefinition.isEnabled = False

def stop(context):
Expand Down
1 change: 1 addition & 0 deletions resources/anyshortcut/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 1 @@
!*-disabled.png
Binary file added resources/anyshortcut/16x16-disabled.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/anyshortcut/32x32-disabled.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions resources/anyshortcut/copy_normal_to_disabled.sh
Original file line number Diff line number Diff line change
@@ -0,0 1,4 @@
#!/bin/bash

cp 16x16.png 16x16-disabled.png
cp 32x32.png 32x32-disabled.png

0 comments on commit d32d538

Please sign in to comment.