(self)
return menu
menu_item = MenuItem(type='action', label='Copy')
        menu_item.add_behavior( {
            'cbjs_action': '''
            var activator = spt.smenu.get_activator(bvr);
            var code = activator.getAttribute("spt_pipeline");
            var search_type = 'sthpw/pipeline';
            var kwargs = {
                'search_type': search_type,
                //'code': code,
                'view': 'pipeline_edit_tool',
                'edit_event': bvr.save_event,
                'title': "Save changes to Workflow (" + code + ")",
                'default': {
                    'name': '',
                    'code': '',
                }
            };
            //var class_name = 'tactic.ui.toosls.PipelineCopyCmd';
            var class_name = 'tactic.ui.panel.EditWdg';
            spt.panel.load_popup("Copy Workflow", class_name, kwargs);
            '''
        } )
        menu.add(menu_item)
menu_item = MenuItem(type='action', label='Copy')
        menu_item.add_behavior( {
            'cbjs_action': '''
            var activator = spt.smenu.get_activator(bvr);
            var code = activator.getAttribute("spt_pipeline");
            var search_type = 'sthpw/pipeline';
            var kwargs = {
                'search_type': search_type,
                //'code': code,
                'view': 'pipeline_edit_tool',
                'edit_event': bvr.save_event,
                'title': "Save changes to Workflow (" + code + ")",
                'default': {
                    'name': '',
                    'code': '',
                }
            };
            //var class_name = 'tactic.ui.toosls.PipelineCopyCmd';
            var class_name = 'tactic.ui.panel.EditWdg';
            spt.panel.load_popup("Copy Workflow", class_name, kwargs);
            '''
        } )
        menu.add(menu_item)
menu_item = MenuItem ( type = action label = Copy ) menu_item . add_behavior ( { cbjs_action : var activator = spt . smenu . get_activator ( bvr ) ; var code = activator . getAttribute ( spt_pipeline ) ; var search_type = sthpw / pipeline ; var kwargs = { search_type : search_type // code : code view : pipeline_edit_tool edit_event : bvr . save_event title : Save changes to Workflow ( + code + ) default : { name : code : } } ; // var class_name = tactic . ui . toosls . PipelineCopyCmd ; var class_name = tactic . ui . panel . EditWdg ; spt . panel . load_popup ( Copy Workflow class_name kwargs ) ; } ) menu . add ( menu_item )
def get_pipeline_context_menu(self):

        menu = Menu(width=180)
        menu.set_allow_icons(False)
        menu.set_setup_cbfn( 'spt.smenu_ctx.setup_cbk' )


        menu_item = MenuItem(type='title', label='Actions')
        menu.add(menu_item)


        menu_item = MenuItem(type='action', label='Edit Data')
        menu_item.add_behavior( {
            'save_event': self.save_event,
            'cbjs_action': '''
            var activator = spt.smenu.get_activator(bvr);
            var code = activator.getAttribute("spt_pipeline");
            var search_type = 'sthpw/pipeline';
            var kwargs = {
                'search_type': search_type,
                'code': code,
                'view': 'pipeline_edit_tool',
                'edit_event': bvr.save_event,
                'title': "Save changes to Workflow (" + code + ")"
            };
            var class_name = 'tactic.ui.panel.EditWdg';
            spt.panel.load_popup("Edit Workflow Details", class_name, kwargs);
            '''
        } )
        menu.add(menu_item)

        """
        menu_item = MenuItem(type='action', label='Copy')
        menu_item.add_behavior( {
            'cbjs_action': '''
            var activator = spt.smenu.get_activator(bvr);
            var code = activator.getAttribute("spt_pipeline");
            var search_type = 'sthpw/pipeline';
            var kwargs = {
                'search_type': search_type,
                //'code': code,
                'view': 'pipeline_edit_tool',
                'edit_event': bvr.save_event,
                'title': "Save changes to Workflow (" + code + ")",
                'default': {
                    'name': '',
                    'code': '',
                }
            };
            //var class_name = 'tactic.ui.toosls.PipelineCopyCmd';
            var class_name = 'tactic.ui.panel.EditWdg';
            spt.panel.load_popup("Copy Workflow", class_name, kwargs);
            '''
        } )
        menu.add(menu_item)
        """


        menu_item = MenuItem(type='separator')
        menu.add(menu_item)


        menu_item = MenuItem(type='action', label='Delete')
        menu_item.add_behavior( {
            'cbjs_action': '''
            var activator = spt.smenu.get_activator(bvr);
            var top = activator.getParent(".spt_pipeline_tool_top");
            var code = activator.getAttribute("spt_pipeline");

            var server = TacticServerStub.get();
            var pipeline = server.get_by_code("sthpw/pipeline", code);
            var name = pipeline.name;
            if (!name) {
                name = pipeline.code;
            }

            var ok = function() {
                server.delete_sobject(pipeline);
                spt.panel.refresh(top);

            }

            spt.confirm("Confirm to delete workflow ["+name+"]", ok);
            '''
        } )
        menu.add(menu_item)




        return menu
def get_pipeline_context_menu ( self ) : menu = Menu ( width = 180 ) menu . set_allow_icons ( False ) menu . set_setup_cbfn ( 'spt.smenu_ctx.setup_cbk' ) menu_item = MenuItem ( type = 'title' , label = 'Actions' ) menu . add ( menu_item ) menu_item = MenuItem ( type = 'action' , label = 'Edit Data' ) menu_item . add_behavior ( { 'save_event' : self . save_event , 'cbjs_action' : '''
            var activator = spt.smenu.get_activator(bvr);
            var code = activator.getAttribute("spt_pipeline");
            var search_type = 'sthpw/pipeline';
            var kwargs = {
                'search_type': search_type,
                'code': code,
                'view': 'pipeline_edit_tool',
                'edit_event': bvr.save_event,
                'title': "Save changes to Workflow (" + code + ")"
            };
            var class_name = 'tactic.ui.panel.EditWdg';
            spt.panel.load_popup("Edit Workflow Details", class_name, kwargs);
            ''' } ) menu . add ( menu_item ) menu_item = MenuItem ( type = 'separator' ) menu . add ( menu_item ) menu_item = MenuItem ( type = 'action' , label = 'Delete' ) menu_item . add_behavior ( { 'cbjs_action' : '''
            var activator = spt.smenu.get_activator(bvr);
            var top = activator.getParent(".spt_pipeline_tool_top");
            var code = activator.getAttribute("spt_pipeline");

            var server = TacticServerStub.get();
            var pipeline = server.get_by_code("sthpw/pipeline", code);
            var name = pipeline.name;
            if (!name) {
                name = pipeline.code;
            }

            var ok = function() {
                server.delete_sobject(pipeline);
                spt.panel.refresh(top);

            }

            spt.confirm("Confirm to delete workflow ["+name+"]", ok);
            ''' } ) menu . add ( menu_item ) return menu