parameters: (self)
return_statement: return div
docstring: if not is_admin:
              div = DivWdg()
              div.add_style("width: 300px")
              div.add_style("padding: 6px")
              div.add_style("text-align: center")
              div.add_style("margin: 2px auto")
              div.add_color("background", "background3")
              div.add_border()
              div.add("Only admin can create python scripts")
docstring_summary: if not is_admin:
              div = DivWdg()
              div.add_style("width: 300px")
              div.add_style("padding: 6px")
              div.add_style("text-align: center")
              div.add_style("margin: 2px auto")
              div.add_color("background", "background3")
              div.add_border()
              div.add("Only admin can create python scripts")
docstring_tokens: if not is_admin : div = DivWdg () div . add_style ( width : 300px ) div . add_style ( padding : 6px ) div . add_style ( text - align : center ) div . add_style ( margin : 2px auto ) div . add_color ( background background3 ) div . add_border () div . add ( Only admin can create python scripts )
function: def get_display(self):
          
       
          is_admin = Environment.get_security().is_admin()
          """
          if not is_admin:
              div = DivWdg()
              div.add_style("width: 300px")
              div.add_style("padding: 6px")
              div.add_style("text-align: center")
              div.add_style("margin: 2px auto")
              div.add_color("background", "background3")
              div.add_border()
              div.add("Only admin can create python scripts")
          """
  
          web = WebContainer.get_web()
          div = DivWdg()
          div.add_class("spt_python_script_trigger_top")
          trigger = self.kwargs.get("trigger")
  
          event = None
          trigger_code = ''
          if not trigger:
              search_key = self.kwargs.get("search_key")
              # event from web takes precedence
              event = web.get_form_value('event')
              if not event:
                  event = self.kwargs.get("event")
  
              if search_key and search_key !='null':
                  trigger = Search.get_by_search_key(search_key)
  
          language = ''
          if trigger:
              trigger_code = trigger.get_code()
              # event could be switched by the user before saving
              # only get it from the trigger sobj as a last resort
              if not event:
                  event = trigger.get_value("event")
              script_path = self.kwargs.get("script_path")
              if not script_path:
                  script_path = trigger.get_value("script_path", no_exception=True)
              script_sobj = None
              if script_path:
                  script_sobj = CustomScript.get_by_path(script_path)
              if not script_sobj:
                  script = ''
              else:
                  script = script_sobj.get_value("script")
                  language = script_sobj.get_value("language")
  
  
  
          else:
              script_path = ''
              script_sobj = None
              script = ''
  
  
          self.add_script_wdg(div, script_path, is_admin, trigger_code, language)
  
          edit_button = ActionButtonWdg(title="Script Editor", tip="Open Script Editor", color="secondary")
          edit_button.add_style("float: right")
          edit_button.add_style("padding: 5px 0px")
          div.add(edit_button)
          edit_button.add_behavior( {
              'type': 'click_up',
              'cbjs_action': '''
              var class_name = 'tactic.ui.app.ScriptEditorWdg'
              spt.panel.load_popup("TACTIC Script Editor", class_name);
              '''
          } )
  
          div.add(HtmlElement.br(2))
  
        
  
          return div
function_tokens: def get_display ( self ) : is_admin = Environment . get_security ( ) . is_admin ( ) web = WebContainer . get_web ( ) div = DivWdg ( ) div . add_class ( "spt_python_script_trigger_top" ) trigger = self . kwargs . get ( "trigger" ) event = None trigger_code = '' if not trigger : search_key = self . kwargs . get ( "search_key" ) # event from web takes precedence event = web . get_form_value ( 'event' ) if not event : event = self . kwargs . get ( "event" ) if search_key and search_key != 'null' : trigger = Search . get_by_search_key ( search_key ) language = '' if trigger : trigger_code = trigger . get_code ( ) # event could be switched by the user before saving # only get it from the trigger sobj as a last resort if not event : event = trigger . get_value ( "event" ) script_path = self . kwargs . get ( "script_path" ) if not script_path : script_path = trigger . get_value ( "script_path" , no_exception = True ) script_sobj = None if script_path : script_sobj = CustomScript . get_by_path ( script_path ) if not script_sobj : script = '' else : script = script_sobj . get_value ( "script" ) language = script_sobj . get_value ( "language" ) else : script_path = '' script_sobj = None script = '' self . add_script_wdg ( div , script_path , is_admin , trigger_code , language ) edit_button = ActionButtonWdg ( title = "Script Editor" , tip = "Open Script Editor" , color = "secondary" ) edit_button . add_style ( "float: right" ) edit_button . add_style ( "padding: 5px 0px" ) div . add ( edit_button ) edit_button . add_behavior ( { 'type' : 'click_up' , 'cbjs_action' : '''
              var class_name = 'tactic.ui.app.ScriptEditorWdg'
              spt.panel.load_popup("TACTIC Script Editor", class_name);
              ''' } ) div . add ( HtmlElement . br ( 2 ) ) return div