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

Decouple File Action Logic From UI #41

Open
osstony opened this issue Feb 17, 2017 · 1 comment
Open

Decouple File Action Logic From UI #41

osstony opened this issue Feb 17, 2017 · 1 comment

Comments

@osstony
Copy link

osstony commented Feb 17, 2017

Hello!

Are there any plans to decouple the file action logic from the UI so that the actions could be called from other code paths?

My current use case is I am adding much deeper Perforce support and need to call the open and save actions from within hooks. In the future I am going to want to do this from other apps/frameworks.

I would love to have this so that all open, save, and new file logic would be available to call by the pipeline and located in one place as part of the tk-multi-workfiles2 app instance.

My apologies if this is already possible and I'm not seeing how by reading through the source.

@osstony
Copy link
Author

osstony commented Feb 21, 2017

I did find a way to do this for prototyping purposes but it is not clean:

 workfiles = self.parent.import_module("tk_multi_workfiles")
 file_item = workfiles.FileItem(key=None, is_work_file=True, work_path=file["path"])
 env = workfiles.WorkArea(context)
 workfiles.OpenWorkfileAction(file_item, {}, env).execute(None)

I had to add imports for these classes into the tk_multi_workfiles package __init__.py which is obviously not correct or ideal.

What I would love would be the ability to simply call a method on the tk-multi-workfiles2 app instance which would allow executing any registered action by name.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant