Skip to content

Commit

Permalink
Merge pull request #3 from nfa-vfxim/gilles
Browse files Browse the repository at this point in the history
Fixed icons not working on Windows
  • Loading branch information
gillesvink authored Aug 15, 2021
2 parents 93d4265 + 4025392 commit 9cea288
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions python/tk_nuke/menu_generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,7 @@ def create_menu(self, add_commands=True):

# Get icon if specified - default to sgtk icon if not specified.
icon = cmd.properties.get("icon", self._shotgun_logo)
icon = icon.replace(os.sep, '/')
command_context = cmd.properties.get("context")

# If the app recorded a context that it wants the command to be associated
Expand Down Expand Up @@ -578,6 +579,8 @@ def create_menu(self, add_commands=True):
if cmd.type == "node":
# Get icon if specified - default to sgtk icon if not specified.
icon = cmd.properties.get("icon", self._shotgun_logo)
# Fix for Windows slashes
icon = icon.replace(os.sep, '/')
command_context = cmd.properties.get("context")

# If the app recorded a context that it wants the command to be associated
Expand Down Expand Up @@ -886,6 +889,7 @@ def add_command_to_menu(self, menu, enabled=True, icon=None):
command.
"""
icon = icon or self.properties.get("icon")
icon = icon.replace(os.sep, '/')
action = menu.addAction(self.name)
action.setEnabled(enabled)
if icon:
Expand Down Expand Up @@ -990,6 +994,8 @@ def add_command_to_pane_menu(self, menu):
:param menu: The menu object to add the new item to.
"""
icon = self.properties.get("icon")
# Fix for Windows slashes
icon = icon.replace(os.sep, '/')
menu.addCommand(self.name, self._original_callback, icon=icon)

def add_command_to_menu(self, menu, enabled=True, icon=None, hotkey=None):
Expand All @@ -1003,6 +1009,8 @@ def add_command_to_menu(self, menu, enabled=True, icon=None, hotkey=None):
for the menu command.
"""
icon = icon or self.properties.get("icon")
# Fix for Windows slashes
icon = icon.replace(os.sep, '/')
hotkey = hotkey or self.properties.get("hotkey")

# Now wrap the command callback in a wrapper (see above)
Expand Down

0 comments on commit 9cea288

Please sign in to comment.