Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moves Sync dialog outside of Unreal #2

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
32e0185
Fix import
kalisp Apr 12, 2024
c094b90
Removed development variables
kalisp Apr 12, 2024
bf81b6a
Added new hook to show Sync dialog
kalisp Apr 12, 2024
528abc5
:bug: fix call
antirotor Apr 29, 2024
847c9b9
Pass launch data to changes viewer
kalisp Apr 30, 2024
0b3abe4
Changed logging to debug
kalisp Apr 30, 2024
e7cf82f
Added debug logging
kalisp Apr 30, 2024
215b1e1
Merge remote-tracking branch 'origin/enhancement/AY-4970_Move-changes…
kalisp Apr 30, 2024
a838bc1
Reworked changes dialog
kalisp Apr 30, 2024
21f0b4c
Removed unnecessary import
kalisp May 23, 2024
6ccb75f
Fix ayon imports
kalisp May 27, 2024
49f31ce
Move p4 to runtime dependencies
kalisp May 27, 2024
c9e6f60
Move rest to separate folder
kalisp May 27, 2024
9f65610
Removed unneeded files
kalisp May 27, 2024
94d62a5
Changed imports
kalisp May 27, 2024
5f81f0c
Fix import
kalisp Jun 11, 2024
0e1c8db
Fix import
kalisp Jun 11, 2024
5f34974
Fix import
kalisp Jun 11, 2024
7416294
Fix import
kalisp Jun 11, 2024
7353434
Fix import
kalisp Jun 11, 2024
26fc1c3
Fix settings query
kalisp Jun 11, 2024
99c35db
Provide rudimentary notification about synchronization
kalisp Jun 12, 2024
b3c8545
Update rudimentary notification about synchronization
kalisp Jun 12, 2024
d0e3ea2
Fixes to names, imports for publish_commit
kalisp Jul 23, 2024
05a2e0a
Fix wrong import in publish_commit
kalisp Jul 23, 2024
41e1da2
Update docstring of validator for P4 commits
kalisp Jul 23, 2024
0255ec1
Added validator that workspace has P4 stream connected
kalisp Jul 23, 2024
a66a1bc
Fix imports of webserver
kalisp Jul 26, 2024
322742e
Tweak typo
kalisp Jul 29, 2024
c71f457
Renamed publish_commit to changelist_metadata
kalisp Jul 29, 2024
314fb65
Ranamend creator to changelist_metadata
kalisp Jul 31, 2024
50b1484
Revert back task_name to task
kalisp Jul 31, 2024
ad07f3e
:dog: small style fixes
antirotor Aug 7, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions client/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
[tool.poetry.dependencies]
python = "^3.9"

[ayon.runtimeDependencies]
p4python = "^2023.1.2454917"
61 changes: 0 additions & 61 deletions client/version_control/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,71 +2,10 @@
Package for interfacing with version control systems
"""

_compatible_dcc = True

import six

from .addon import VERSION_CONTROL_ADDON_DIR
from .addon import VersionControlAddon

if six.PY3:
# This is a clever hack to get python to import in a lazy (sensible) way
# whilst allowing static analysis to work correctly.
# Effectively this is forcing python to see these sub-packages without
# importing any packages until they are needed, this also helps
# avoid triggering potential dependency loops.
# The module level __getattr__ will handle lazy imports in this syntax:

# ```
# import version_control
# version_control.backends.perforce.sync
# ```

import importlib
import pathlib

# this is used instead of typing.TYPE_CHECKING as it
# avoids needing to import the typing module at all:
_typing = False
if _typing:
from typing import Any

from . import api
from . import backends
from . import hosts
from . import lib
from . import widgets
del _typing

def __getattr__(name):
# type: (str) -> Any
current_file = pathlib.Path(__file__)
current_directory = current_file.parent
for path in current_directory.iterdir():
if path.stem != name:
continue

try:
return importlib.import_module("{0}.{1}".format(__package__, name))
except ImportError as error:
if "No module named P4API" not in str(error):
raise

global _compatible_dcc
_compatible_dcc = False

raise AttributeError("{0} has no attribute named: {0}".format(__package__, name))

else:
raise RuntimeError("Version control is not supported on Python2")

__all__ = (
"api",
"backends",
"hosts",
"lib",
"widgets",
"VersionControlAddon",
"VERSION_CONTROL_ADDON_DIR",
"_compatible_dcc"
)
37 changes: 24 additions & 13 deletions client/version_control/addon.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
class VersionControlAddon(AYONAddon, ITrayService, IPluginPaths):
# _icon_name = "mdi.jira"
# _icon_scale = 1.3
webserver = None
active_version_control_system = None

# Properties:
@property
Expand All @@ -34,7 +36,7 @@ def initialize(self, settings):
assert self.name in settings, (
"{} not found in settings - make sure they are defined in the defaults".format(self.name)
)
vc_settings = settings[self.name] # type: dict[str, Any]
vc_settings = settings[self.name] # type: dict[str, Any]
enabled = vc_settings["enabled"] # type: bool
active_version_control_system = vc_settings["active_version_control_system"] # type: str
self.active_version_control_system = active_version_control_system
Expand All @@ -60,17 +62,16 @@ def get_connection_info(self, project_name, project_settings=None):
if workspace_dir:
workspace_dir = os.path.normpath(workspace_dir)

conn_info = {}
conn_info["host"] = version_settings["host_name"]
conn_info["port"] = version_settings["port"]
conn_info["username"] = local_setting["username"]
conn_info["password"] = local_setting["password"]
conn_info["workspace_dir"] = workspace_dir

return conn_info
return {
"host": version_settings["host_name"],
"port": version_settings["port"],
"username": local_setting["username"],
"password": local_setting["password"],
"workspace_dir": workspace_dir
}

def sync_to_latest(self, conn_info):
from version_control.backends.perforce.api.rest_stub import \
from version_control.rest.perforce.rest_stub import \
PerforceRestStub

PerforceRestStub.login(host=conn_info["host"],
Expand All @@ -82,7 +83,7 @@ def sync_to_latest(self, conn_info):
return

def sync_to_version(self, conn_info, change_id):
from version_control.backends.perforce.api.rest_stub import \
from version_control.rest.perforce.rest_stub import \
PerforceRestStub

PerforceRestStub.login(host=conn_info["host"],
Expand All @@ -96,15 +97,15 @@ def sync_to_version(self, conn_info, change_id):

def tray_exit(self):
if self.enabled and \
self.webserver and self.webserver.server_is_running():
self.webserver and self.webserver.server_is_running:
self.webserver.stop()

def tray_init(self):
return

def tray_start(self):
if self.enabled:
from .backends.perforce.communication_server import WebServer
from version_control.rest.communication_server import WebServer
self.webserver = WebServer()
self.webserver.start()

Expand All @@ -123,6 +124,16 @@ def get_publish_plugin_paths(self, host_name):
return [os.path.join(VERSION_CONTROL_ADDON_DIR,
"plugins", "publish")]

def get_launch_hook_paths(self, _app):
"""Implementation for applications launch hooks.

Returns:
(str): full absolute path to directory with hooks for the module
"""

return os.path.join(VERSION_CONTROL_ADDON_DIR, "launch_hooks",
self.active_version_control_system)


@click.group("version_control", help="Version Control module related commands.")
def cli_main():
Expand Down
Loading