Skip to content

Commit

Permalink
split classes again
Browse files Browse the repository at this point in the history
  • Loading branch information
Stunkymonkey committed Jan 14, 2025
1 parent 3969186 commit 543013a
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions nautilus_open_any_terminal/nautilus_open_any_terminal.py
Original file line number Diff line number Diff line change
Expand Up @@ -418,15 +418,16 @@ def get_widget(self, uri, window):
self._window = window


# Add the appropriate interface based on API version
# Define the class normally and add the interface dynamically based on the API version.
if API_VERSION in ("3.0", "2.0"):
OpenAnyTerminalShortcutProvider = type(
"OpenAnyTerminalShortcutProvider", (OpenAnyTerminalShortcutProvider, FileManager.LocationWidgetProvider), {}
)
class OpenAnyTerminalShortcutProviderV2(OpenAnyTerminalShortcutProvider, FileManager.LocationWidgetProvider):
pass
elif API_VERSION == "4.0":
OpenAnyTerminalShortcutProvider = type(
"OpenAnyTerminalShortcutProvider", (OpenAnyTerminalShortcutProvider, FileManager.MenuProvider), {}
)
class OpenAnyTerminalShortcutProviderV4(OpenAnyTerminalShortcutProvider, FileManager.MenuProvider):
pass

# Use the appropriate class
OpenAnyTerminalShortcutProvider = OpenAnyTerminalShortcutProviderV4 if API_VERSION == "4.0" else OpenAnyTerminalShortcutProviderV2


class OpenAnyTerminalExtension(GObject.GObject, FileManager.MenuProvider):
Expand Down

0 comments on commit 543013a

Please sign in to comment.