parameters: (self)
docstring: Given a directory path and search type, it will displays snapshots that
          have files in that directory related to that search type. 
          If single asset mode is specified, it will display sobjects of the single asset sType.
          
          Given snapshot codes, it will display related single assets or filter those snapshots based
          on parent search type.
docstring_summary: Given a directory path and search type, it will displays snapshots that
          have files in that directory related to that search type. 
          If single asset mode is specified, it will display sobjects of the single asset sType.
          
          Given snapshot codes, it will display related single assets or filter those snapshots based
          on parent search type.
docstring_tokens: Given a directory path and search type it will displays snapshots that have files in that directory related to that search type . If single asset mode is specified it will display sobjects of the single asset sType . Given snapshot codes it will display related single assets or filter those snapshots based on parent search type .
function: def get_display(self):
  
          '''Given a directory path and search type, it will displays snapshots that
          have files in that directory related to that search type. 
          If single asset mode is specified, it will display sobjects of the single asset sType.
          
          Given snapshot codes, it will display related single assets or filter those snapshots based
          on parent search type.'''
          
          top = self.top
          self.set_as_panel(top)
          top.add_class("spt_browser_detail_top")
   
          inner = DivWdg()
          top.add(inner)
  
          # The determination of search types important for IngestUploadWdg and ViewPanelWdg.
          # Also, if parent_mode is single_file, then clicking 
          # a file or directory will display information
          # related to the single file search type.
          parent_mode = self.kwargs.get("parent_mode")
          parent_key = self.kwargs.get("parent_key")
          if parent_mode == "single_file":
              parent_type = self.kwargs.get("search_type")
  
              search_type = parent_type
          else:
              parent_type = self.kwargs.get("search_type")
              search_type = "sthpw/snapshot"
  
          parent_type = SearchType.build_search_type(parent_type)
          search_type = SearchType.build_search_type(search_type)
          
          # Input data - snapshots or a absolute directory path
          snapshot_codes = self.kwargs.get("snapshot_codes")
          
          dirname = self.kwargs.get("dirname")
          asset_dir = Environment.get_asset_dir()
          if dirname.startswith(asset_dir):
              reldir = Common.relative_dir(asset_dir, dirname)
              if reldir == ".":
                  reldir = ""
          else:
              reldir = dirname
          
          # If user has selected list of snapshots in directory
          # display these. 
          # TODO: Use of snapshot codes involves the unfinished  select API 
          if snapshot_codes:
              search = Search("sthpw/snapshot")
              search.add_filters("code", snapshot_codes)
          else:
              # FIXME: Note, that this widget shows all files in the
              # entire tree rooted at relative_dir. User may only want to
              # see files within relative_dir.
              if parent_mode == "single_file":
                  # Get search from widget settings
                  key = "repo_browser:%s" % parent_type
                  parent_search_str = WidgetSettings.get_value_by_key(key)
                  if parent_search_str:
                      parent_search = Search(parent_type)
                      parent_search.select.loads(parent_search_str)
                  else:
                      parent_search = Search(parent_type)
                  # In single file mode, the parent sObjects are displayed, and filter
                  # is based on these sObjects relative_dir column.
                  parent_search.add_op("begin")
                  parent_search.add_filter("relative_dir", "%s" % reldir)
                  parent_search.add_filter("relative_dir", "%s/%%" % reldir, op='like')
                  parent_search.add_op("or")
                  search = parent_search
              else:
                  file_search = RepoBrowserSearchWrapper.get_file_search(reldir, [parent_type], [])
                  search = Search(search_type)
                  search.add_relationship_search_filter(file_search)
  
          # File system edit
          self.file_system_edit = self.kwargs.get("file_system_edit") 
          if self.file_system_edit == "true":
              self.file_system_edit = True
  
          # Display the path of the directory
          path_div = DivWdg()
          inner.add(path_div)
          path_div.add("<b>Path:</b> %s" % reldir)
          path_div.add_color("color", "color")
          path_div.add_color("background", "background")
          path_div.add_style("padding: 15px")
          path_div.add_class("spt_browser_relative_dir")
          path_div.add_attr("spt_relative_dir", reldir)
  
  
          """
          shelf_wdg = DivWdg()
          inner.add(shelf_wdg)
  
          # Ingest into parent key or search type
          # TODO: Add on complete script which updates UI
          button = ActionButtonWdg(title="Ingest")
          shelf_wdg.add(button)
          shelf_wdg.add_style("margin: 0px 20px")
          button.add_behavior( {
              'type': 'click_up',
              'path': path,
              'search_key': parent_key,
              'search_type': parent_type,
              'cbjs_action': '''
              var class_name = 'tactic.ui.tools.IngestUploadWdg';
              var kwargs = {
                  search_key: bvr.search_key,
                  search_type: bvr.search_type,
                  base_dir: bvr.path,
              }
              spt.panel.load_popup("Ingest Files", class_name, kwargs);
              '''
          } )
          """
  
          # Display directory content
          
          # Layout
          '''
          search_type_obj = SearchType.get(search_type)
          layout_mode = search_type_obj.get_value("default_layout", no_exception=True)
          if layout_mode == '':
              layout_mode = 'default'
  
          if layout_mode == 'default' or layout_mode == 'browser':
              # if browser default is browser, then like we don't want to see
              # a browser again.
              layout_mode = 'tile'
          '''
          layout_mode = "tile"
          
          element_names = None
          if layout_mode == "checkin":
              element_names = ['preview','code','name','general_checkin','file_list', 'history','description','notes']
         
          # Show file details when clicking on tile
          expand_mode = "custom"
          detail_script = r'''
              var top = bvr.src_el.getParent(".spt_repo_browser_top");
              var content = top.getElement(".spt_repo_browser_content");
              
              var row = bvr.src_el.getParent(".spt_table_row");
              var search_key = row.getProperty("spt_search_key");
              
              var class_name = "tactic.ui.tools.RepoBrowserContentWdg";
              
              var parent_mode = '%s';
              var kwargs = {
                  search_key: search_key,
                  parent_mode: parent_mode
              };
              spt.panel.load(content, class_name, kwargs);
          ''' % parent_mode
         
          # Disable context menu and drag if system editing is off
          if self.file_system_edit == True:
              show_context_menu = True
              allow_drag = True
          else:
              show_context_menu = False
              #FIXME: Allow drag is not working
              allow_drag = False
  
          # FIXME: This kwarg does not take effect
          upload_mode = False
          
          expression = self.kwargs.get("expression")
  
          from tactic.ui.panel import ViewPanelWdg
          layout = ViewPanelWdg(
              search_type=search_type,
              search=search,
              element_names=element_names,
              show_shelf=False,
              show_search_limit=False,
              layout=layout_mode,
              expression=expression,
              scale='100',
              show_scale=True,
              width='100%',
              expand_mode=expand_mode,
              script=detail_script,
              upload_mode=upload_mode,
              show_context_menu=show_context_menu,
              allow_drag=allow_drag,
              no_results_msg="Alter search criteria or ingest files to this directory."
          )
          inner.add(layout)
      
          # TODO: Lock on drag of tile
          """ 
          inner.add_relay_behavior( {
              'type': 'mouseup',
              'bvr_match_class': 'spt_tile_top',
              'cbjs_action':'''console.log("hi");'''
          } )
          """
  
          is_refresh = self.kwargs.get("is_refresh")
          if is_refresh:
              return inner
          else:
              return top
function_tokens: def get_display ( self ) : top = self . top self . set_as_panel ( top ) top . add_class ( "spt_browser_detail_top" ) inner = DivWdg ( ) top . add ( inner ) # The determination of search types important for IngestUploadWdg and ViewPanelWdg. # Also, if parent_mode is single_file, then clicking  # a file or directory will display information # related to the single file search type. parent_mode = self . kwargs . get ( "parent_mode" ) parent_key = self . kwargs . get ( "parent_key" ) if parent_mode == "single_file" : parent_type = self . kwargs . get ( "search_type" ) search_type = parent_type else : parent_type = self . kwargs . get ( "search_type" ) search_type = "sthpw/snapshot" parent_type = SearchType . build_search_type ( parent_type ) search_type = SearchType . build_search_type ( search_type ) # Input data - snapshots or a absolute directory path snapshot_codes = self . kwargs . get ( "snapshot_codes" ) dirname = self . kwargs . get ( "dirname" ) asset_dir = Environment . get_asset_dir ( ) if dirname . startswith ( asset_dir ) : reldir = Common . relative_dir ( asset_dir , dirname ) if reldir == "." : reldir = "" else : reldir = dirname # If user has selected list of snapshots in directory # display these.  # TODO: Use of snapshot codes involves the unfinished  select API  if snapshot_codes : search = Search ( "sthpw/snapshot" ) search . add_filters ( "code" , snapshot_codes ) else : # FIXME: Note, that this widget shows all files in the # entire tree rooted at relative_dir. User may only want to # see files within relative_dir. if parent_mode == "single_file" : # Get search from widget settings key = "repo_browser:%s" % parent_type parent_search_str = WidgetSettings . get_value_by_key ( key ) if parent_search_str : parent_search = Search ( parent_type ) parent_search . select . loads ( parent_search_str ) else : parent_search = Search ( parent_type ) # In single file mode, the parent sObjects are displayed, and filter # is based on these sObjects relative_dir column. parent_search . add_op ( "begin" ) parent_search . add_filter ( "relative_dir" , "%s" % reldir ) parent_search . add_filter ( "relative_dir" , "%s/%%" % reldir , op = 'like' ) parent_search . add_op ( "or" ) search = parent_search else : file_search = RepoBrowserSearchWrapper . get_file_search ( reldir , [ parent_type ] , [ ] ) search = Search ( search_type ) search . add_relationship_search_filter ( file_search ) # File system edit self . file_system_edit = self . kwargs . get ( "file_system_edit" ) if self . file_system_edit == "true" : self . file_system_edit = True # Display the path of the directory path_div = DivWdg ( ) inner . add ( path_div ) path_div . add ( "<b>Path:</b> %s" % reldir ) path_div . add_color ( "color" , "color" ) path_div . add_color ( "background" , "background" ) path_div . add_style ( "padding: 15px" ) path_div . add_class ( "spt_browser_relative_dir" ) path_div . add_attr ( "spt_relative_dir" , reldir ) """
          shelf_wdg = DivWdg()
          inner.add(shelf_wdg)
  
          # Ingest into parent key or search type
          # TODO: Add on complete script which updates UI
          button = ActionButtonWdg(title="Ingest")
          shelf_wdg.add(button)
          shelf_wdg.add_style("margin: 0px 20px")
          button.add_behavior( {
              'type': 'click_up',
              'path': path,
              'search_key': parent_key,
              'search_type': parent_type,
              'cbjs_action': '''
              var class_name = 'tactic.ui.tools.IngestUploadWdg';
              var kwargs = {
                  search_key: bvr.search_key,
                  search_type: bvr.search_type,
                  base_dir: bvr.path,
              }
              spt.panel.load_popup("Ingest Files", class_name, kwargs);
              '''
          } )
          """ # Display directory content # Layout '''
          search_type_obj = SearchType.get(search_type)
          layout_mode = search_type_obj.get_value("default_layout", no_exception=True)
          if layout_mode == '':
              layout_mode = 'default'
  
          if layout_mode == 'default' or layout_mode == 'browser':
              # if browser default is browser, then like we don't want to see
              # a browser again.
              layout_mode = 'tile'
          ''' layout_mode = "tile" element_names = None if layout_mode == "checkin" : element_names = [ 'preview' , 'code' , 'name' , 'general_checkin' , 'file_list' , 'history' , 'description' , 'notes' ] # Show file details when clicking on tile expand_mode = "custom" detail_script = r'''
              var top = bvr.src_el.getParent(".spt_repo_browser_top");
              var content = top.getElement(".spt_repo_browser_content");
              
              var row = bvr.src_el.getParent(".spt_table_row");
              var search_key = row.getProperty("spt_search_key");
              
              var class_name = "tactic.ui.tools.RepoBrowserContentWdg";
              
              var parent_mode = '%s';
              var kwargs = {
                  search_key: search_key,
                  parent_mode: parent_mode
              };
              spt.panel.load(content, class_name, kwargs);
          ''' % parent_mode # Disable context menu and drag if system editing is off if self . file_system_edit == True : show_context_menu = True allow_drag = True else : show_context_menu = False #FIXME: Allow drag is not working allow_drag = False # FIXME: This kwarg does not take effect upload_mode = False expression = self . kwargs . get ( "expression" ) from tactic . ui . panel import ViewPanelWdg layout = ViewPanelWdg ( search_type = search_type , search = search , element_names = element_names , show_shelf = False , show_search_limit = False , layout = layout_mode , expression = expression , scale = '100' , show_scale = True , width = '100%' , expand_mode = expand_mode , script = detail_script , upload_mode = upload_mode , show_context_menu = show_context_menu , allow_drag = allow_drag , no_results_msg = "Alter search criteria or ingest files to this directory." ) inner . add ( layout ) # TODO: Lock on drag of tile """ 
          inner.add_relay_behavior( {
              'type': 'mouseup',
              'bvr_match_class': 'spt_tile_top',
              'cbjs_action':'''console.log("hi");'''
          } )
          """ is_refresh = self . kwargs . get ( "is_refresh" ) if is_refresh : return inner else : return top