TACTIC Open Source
Adding custom right click menu - Printable Version

+- TACTIC Open Source (http://forum.southpawtech.com)
+-- Forum: TACTIC Open Source (http://forum.southpawtech.com/forumdisplay.php?fid=3)
+--- Forum: TACTIC Discussion (http://forum.southpawtech.com/forumdisplay.php?fid=4)
+--- Thread: Adding custom right click menu (/showthread.php?tid=80)



Adding custom right click menu - rigatron - 03-07-2020

[attachment=43]

Hi how do i add custom menu when i right click on a task or a shot . and set permissions for it for show level, user level.
like i want to add client delivery trigger to this.

there is a similar feature in shotgun
https://support.shotgunsoftware.com/hc/en-us/articles/219031318-Creating-custom-Action-Menu-Items#custom_http_url


RE: Adding custom right click menu - remkonoteboom - 03-09-2020

Unfortunately, at the moment, that specifically can't be customized (it is hard coded in the source code). Normally, this is done by adding a custom column to the table. The column can either be a button to do the action you want or you could add a custom layout view which means you could put pretty much any UI you want there, including a drop down with a list of extra actions.


RE: Adding custom right click menu - rigatron - 03-09-2020

Yes think even a button would work, I could run a python script when clicked.

Thanks.


RE: Adding custom right click menu - rigatron - 03-11-2020

so i created a button using the column manager, I set the widget to button and in the script path i have given a simple print statements, it works fine when i do it as a trigger but not when i add it to a button.

[attachment=44]

when i use the trigger i get the proper output that is 
running python code
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
shot_001
Approved

but when i use the button i keep getting

request_id:  140373749917440 - #0000082
timestamp:  2020-03-11 21:27:49
user:  admin
simple method:  <function query at 0x7fab7ad325d0>
ticket:  bc1c06debc4d82611bddb7f4e75b1495
('config/custom_script', {  'filters': [['code', 'CUSTOM_SCRIPT00016']]})
Duration: 0.016 seconds (request_id: 140373749917440 - #0000082)
Memory: 111868 KB
Increment: 0 KB


or does the button only support java script?

And one more this.. can we add a pop up , like a validation to check and show a warning if the status is not approved.


RE: Adding custom right click menu - rigatron - 03-13-2020

hey remko, I got it figured out.. you can skip this. thanks


RE: Adding custom right click menu - remkonoteboom - 03-13-2020

No problem. Just to further on this: javascript has full access to the API. This allows you to combine server side interaction with what occurs in the client side.

var server = TACTIC.get()
server.update(search_key, {...})

That is a simple example for single updates. We try to use promises whenever we can, which the api supports with any function prepended with "p_":

var server = TACTIC.get()
server.p_execute_cmd( cmd_class, kwargs)
.then( function(ret_val) {
... do some javascript
} )
catch( function(e) {
... handle some errors
} )

This will make asynchronous calls to the server and also catch and handle errors properly. Many of the API functions have promise equivalents.


RE: Adding custom right click menu - rigatron - 03-13-2020

sounds cool, just starting to dig into all this.. thanks a lot for the help. Never did anything with javascript, so think this would be a good reason to start it.