Exemple #1
0
    def get_right_wdg(my, view="layout"):
        search_type = my.get_right_search_type()
        search = Search(search_type)

        right_div = DivWdg()

        right_div.add_style("margin: 10px")

        title = DivWdg(css="maq_search_bar")
        title.add(search.get_search_type_obj().get_title())
        right_div.add(title)

        shot_filter = my.get_right_filter(search)
        if shot_filter:
            shot_filter.alter_search(search)
        filter_wdg = DivWdg(css="filter_box")
        if shot_filter:
            filter_wdg.add(shot_filter)

        right_div.add(filter_wdg)

        from tactic.ui.panel import TableLayoutWdg
        shots_table = TableLayoutWdg(table_id='table_right',
                                     search_type=search_type,
                                     view=view)
        #shots_table = TableWdg(my.get_right_search_type(), view)
        shots_table.set_sobjects(search.get_sobjects(), search)

        right_div.add(shots_table)

        return right_div
Exemple #2
0
    def get_display(my):

        widget = DivWdg()
        my.set_as_panel(widget, class_name='spt_view_panel spt_panel')

        # create a table widget and set the sobjects to it
        table_id = "main_body_table" 
        table = TableLayoutWdg(table_id=table_id, search_type="sthpw/notification_log", \
                view="table", inline_search=True, search_view='search') 

        search_type = "sthpw/notification_log"
        
        from tactic.ui.app import SearchWdg
        
        search_wdg = SearchWdg(search_type=search_type, view='search')

        
        widget.add(search_wdg)
        search = search_wdg.get_search()
        table.alter_search(search)
        sobjects = search.get_sobjects()
        table.set_sobjects(sobjects, search)
        widget.add(table)

        return widget
Exemple #3
0
    def get_display(self):
        # create the asset tab
        widget = DivWdg(css="spt_view_panel")
        self.set_as_panel(widget) 
        search_wdg = self.get_search_wdg()
        widget.add(search_wdg)
        widget.add(HtmlElement.br())
        search = search_wdg.get_search()

        
        # the filter for searching assets
        #div = DivWdg(css="filter_box")
        #snap_filter = SnapshotFilterWdg()
        #div.add(snap_filter)
        #widget.add(div)

        table_id = "main_body_table" 
        from tactic.ui.panel import TableLayoutWdg
        snap_table = TableLayoutWdg(table_id=table_id, search_type=Snapshot.SEARCH_TYPE, \
                view="log", inline_search=True)
        snap_table.alter_search(search)
        widget.add(snap_table)

        
        search.add_order_by("timestamp desc")
        sobjects = search.get_sobjects()
        #search.add_filter("login", Environment.get_login().get_login())
        #widget.set_search(search)
        snap_table.set_sobjects(sobjects, search)

        return widget
Exemple #4
0
    def get_left_wdg(my, view="layout"):

        search_type = my.get_left_search_type()
        search = Search(search_type)

        left_div = DivWdg()
        left_div.add_style("margin: 10px")

        title = DivWdg(css="maq_search_bar")
        title.add(search.get_search_type_obj().get_title())
        left_div.add(title)

        asset_filter = my.get_left_filter(search)
        if asset_filter:
            filter_box = DivWdg(asset_filter, css='filter_box')
            left_div.add(filter_box)
            asset_filter.alter_search(search)

        #assets_table = TableWdg(search_type, view)
        from tactic.ui.panel import TableLayoutWdg
        assets_table = TableLayoutWdg(table_id='table_left',
                                      search_type=search_type,
                                      view=view)
        assets_table.set_sobjects(search.get_sobjects(), search)

        left_div.add(assets_table)

        return left_div
    def get_right_wdg(my, view="layout"):
        search_type = my.get_right_search_type()
        search = Search(search_type)
        
        right_div = DivWdg()

        right_div.add_style("margin: 10px")

        title = DivWdg(css="maq_search_bar")
        title.add(search.get_search_type_obj().get_title())
        right_div.add(title)

        shot_filter = my.get_right_filter(search)
        if shot_filter:
            shot_filter.alter_search(search) 
        filter_wdg = DivWdg(css="filter_box")
        if shot_filter:
            filter_wdg.add(shot_filter)
       
        right_div.add(filter_wdg)

        from tactic.ui.panel import TableLayoutWdg
        shots_table = TableLayoutWdg(table_id='table_right', search_type=search_type, view=view)
        #shots_table = TableWdg(my.get_right_search_type(), view)
        shots_table.set_sobjects(search.get_sobjects(), search)

        right_div.add(shots_table)

        return right_div
    def get_left_wdg(my, view="layout"):

        search_type = my.get_left_search_type()
        search = Search(search_type)
        
        left_div = DivWdg()
        left_div.add_style("margin: 10px")

        title = DivWdg(css="maq_search_bar")
        title.add(search.get_search_type_obj().get_title())
        left_div.add(title)

        asset_filter = my.get_left_filter(search)
        if asset_filter:
            filter_box = DivWdg(asset_filter, css='filter_box')
            left_div.add(filter_box)
            asset_filter.alter_search(search)

        #assets_table = TableWdg(search_type, view)
        from tactic.ui.panel import TableLayoutWdg
        assets_table = TableLayoutWdg(table_id='table_left', search_type=search_type, view=view)
        assets_table.set_sobjects(search.get_sobjects(), search)
        
        left_div.add(assets_table)

        return left_div
Exemple #7
0
    def get_display(my):
        widget = DivWdg()

        my.set_as_panel(widget, class_name='spt_view_panel spt_panel')
 
        # create a table widget and set the sobjects to it
        table_id = "main_body_table" 
        filter = my.kwargs.get('filter')
        table = TableLayoutWdg(table_id=table_id, search_type="sthpw/timecard", \
                view="table", inline_search=True, filter=filter, search_view='search' ) 

       
        search_type = "sthpw/timecard"
        from tactic.ui.app import SearchWdg
        
        search_wdg = SearchWdg(search_type=search_type, view='search', filter=filter)
        
        widget.add(search_wdg)
        search = search_wdg.get_search()

        # FIX to current project timecard for now
        search.add_filter('project_code', Project.get_project_code())
        #search.add_project_filter()

        table.alter_search(search)
        print "SEA ", search.get_statement()
        sobjects = search.get_sobjects()
        print "SOB ", sobjects
        table.set_sobjects(sobjects, search)
        widget.add(table)
        #widget.add(SpecialDayWdg())
        return widget
Exemple #8
0
    def get_display(self):
        # create the asset tab
        widget = DivWdg(css="spt_view_panel")
        self.set_as_panel(widget)
        search_wdg = self.get_search_wdg()
        widget.add(search_wdg)
        widget.add(HtmlElement.br())
        search = search_wdg.get_search()

        # the filter for searching assets
        #div = DivWdg(css="filter_box")
        #snap_filter = SnapshotFilterWdg()
        #div.add(snap_filter)
        #widget.add(div)

        table_id = "main_body_table"
        from tactic.ui.panel import TableLayoutWdg
        snap_table = TableLayoutWdg(table_id=table_id, search_type=Snapshot.SEARCH_TYPE, \
                view="log", inline_search=True)
        snap_table.alter_search(search)
        widget.add(snap_table)

        search.add_order_by("timestamp desc")
        sobjects = search.get_sobjects()
        #search.add_filter("login", Environment.get_login().get_login())
        #widget.set_search(search)
        snap_table.set_sobjects(sobjects, search)

        return widget
Exemple #9
0
    def get_display(self):

        top = self.top
        self.set_as_panel(top)
        top.set_unique_id()
        top.add_style("min-width: 600px")
        top.add_style("max-height: 600px")
        top.add_style("overflow-y: auto")

        top.add_color("background", "background")
        top.add_color("color", "color")

        sobject = self.kwargs.get("sobject")
        if not sobject:
            search_key = self.kwargs.get("search_key")
            sobject = Search.get_by_search_key(search_key)
        else:
            search_key = sobject.get_search_key()

        context = self.kwargs.get("context")

        search = Search("sthpw/note")
        #search.add_relationship_filters(self.filtered_parents, type='hierarchy')
        search.add_parent_filter(sobject)
        search.add_order_by("process")
        search.add_order_by("context")
        search.add_order_by("timestamp desc")

        if context:
            search.add_filter("context", context)

        notes = search.get_sobjects()

        top.add_smart_style("spt_note", "padding", "15px")

        for i, note in enumerate(notes):

            note_div = DivWdg()
            top.add(note_div)
            note_div.add(self.get_note_wdg(note))

            if i % 2 == 0:
                note_div.add_color("background", "background", -3)

        top.add("<br/><hr/><br/>")

        from tactic.ui.panel import TableLayoutWdg
        table = TableLayoutWdg(
            search_type="sthpw/note",
            show_shelf=False,
            show_select=False,
            element_names=['login', 'timestamp', 'note', 'delete'])
        table.set_sobjects(notes)
        top.add(table)

        return top
    def get_table(my, sobject, snapshots):
        parent_key = SearchKey.get_by_sobject(sobject)
        table = TableLayoutWdg(table_id='snapshot_history_table',
                               search_type='sthpw/snapshot',
                               view='checkin_history',
                               show_search_limit=False,
                               show_gear=False,
                               show_insert=False,
                               parent_key=parent_key,
                               mode='simple')
        table.set_sobjects(snapshots)

        return table
        """
    def get_table(my, sobject, snapshots):
        parent_key = SearchKey.get_by_sobject(sobject)
        table = TableLayoutWdg(
            table_id="snapshot_history_table",
            search_type="sthpw/snapshot",
            view="checkin_history",
            show_search_limit=False,
            show_gear=False,
            show_insert=False,
            parent_key=parent_key,
            mode="simple",
        )
        table.set_sobjects(snapshots)

        return table
        """
Exemple #12
0
  def get_display(self):
      widget = DivWdg(css="spt_view_panel")
 
      search_wdg = self.get_search_wdg()
      widget.add(search_wdg)
      widget.add(HtmlElement.br())
      search = search_wdg.get_search()
     
      type = self.kwargs.get('type')
      view = self.kwargs.get('view')
      if not view:
          view = 'table'
      
      table_id = "main_body_table" 
      table = TableLayoutWdg(table_id=table_id, search_type=Submission.SEARCH_TYPE, \
              view=view, inline_search=True)
      table.alter_search(search)
     
      sobjs = search.get_sobjects(redo=True)
      table.set_sobjects(sobjs, search)
  
      widget.add(table)
  
      return widget
Exemple #13
0
    def get_display(self):
        widget = DivWdg(css="spt_view_panel")

        search_wdg = self.get_search_wdg()
        widget.add(search_wdg)
        widget.add(HtmlElement.br())
        search = search_wdg.get_search()

        type = self.kwargs.get('type')
        view = self.kwargs.get('view')
        if not view:
            view = 'table'

        table_id = "main_body_table"
        table = TableLayoutWdg(table_id=table_id, search_type=Submission.SEARCH_TYPE, \
                view=view, inline_search=True)
        table.alter_search(search)

        sobjs = search.get_sobjects(redo=True)
        table.set_sobjects(sobjs, search)

        widget.add(table)

        return widget
Exemple #14
0
    def get_display(my):
        top = DivWdg()

        sobject = my.get_sobject()
        if not sobject:
            return top
        process = my.kwargs.get("process")

        #from tactic.ui.table import TaskElementWdg
        #task_wdg = TaskElementWdg()
        #task_wdg.set_sobject(my.sobject)
        #top.add(task_wdg)

        search = Search('sthpw/task')
        search.add_parent_filter(sobject)
        search.add_filter("process", process)
        tasks = search.get_sobjects()

        tasks_div = DivWdg()
        top.add(tasks_div)
        #tasks_div.add_style("padding: 0px 0px 20px 0px")
        tasks_div.add_style("margin: 10px")
        tasks_div.set_box_shadow()

        title = DivWdg()
        title.add_gradient("background", "background3", 0, -10)
        title.add_color("color", "color3", -10)
        title.add_border()
        title.add_style("height: 20px")
        title.add_style("padding: 4px")
        title.add_style("font-weight: bold")
        title.add("All Tasks for process '%s':" % process)
        tasks_div.add(title)


        task_wdg = TableLayoutWdg(search_type="sthpw/task",view='single_process', show_row_select="false", show_insert="false", show_gear="false", show_search_limit="false", show_search=False, show_refresh="false", show_shelf="false")
        task_wdg.set_sobjects(tasks)
        tasks_div.add(task_wdg)


        #from tactic.ui.container import ResizableTableWdg
        #table = ResizableTableWdg()
        table = Table()
        top.add(table)
        table.add_style("width: 100%")
        table.add_row()


        td = table.add_cell()
        td.add_style("vertical-align: top")
        td.add_style("width: 50%")

        notes_div = DivWdg()
        td.add(notes_div)
        notes_div.set_box_shadow()
        notes_div.add_style("margin: 10px")

        title = DivWdg()
        notes_div.add(title)
        title.add_gradient("background", "background3", 0, -10)
        title.add_color("color", "color3", -10)
        title.add_border()
        title.add_style("height: 20px")
        title.add_style("padding: 4px")
        title.add_style("font-weight: bold")
        title.add("Notes:")


        from tactic.ui.widget.discussion_wdg import DiscussionWdg
        discussion_wdg = DiscussionWdg(search_key=sobject.get_search_key(), process=process, context_hidden=True, show_note_expand=True)
        notes_div.add(discussion_wdg)

        search = Search('sthpw/snapshot')
        search.add_parent_filter(sobject)
        search.add_filter("process", process)
        snapshots = search.get_sobjects()

        td = table.add_cell()
        td.add_style("vertical-align: top")
        td.add_style("width: 50%")
        td.add_style("padding: 0 0 0 0")

        snapshots_div = DivWdg()
        td.add(snapshots_div)
        snapshots_div.set_box_shadow()
        snapshots_div.add_style("margin: 10px")


        title = DivWdg()
        title.add_gradient("background", "background3", 0, -10)
        title.add_color("color", "color3", -10)
        title.add_border()
        title.add_style("height: 20px")
        title.add_style("padding: 4px")
        title.add_style("font-weight: bold")
        title.add("Snapshots:")
        snapshots_div.add(title)


        snapshot_wdg = TableLayoutWdg(search_type="sthpw/snapshot",view='table', mode='simple', show_row_select=False, width='100%', show_shelf="false")
        snapshot_wdg.set_sobjects(snapshots)
        snapshots_div.add(snapshot_wdg)



        return top
Exemple #15
0
    def get_display(self):

        widget = DivWdg()
        self.set_as_panel(
            widget,
            class_name='spt_view_panel spt_panel spt_app_asset_inst_panel')

        parent_search_type = self.search_type

        if self.show_search:
            # Have to limit this search to just its parent.. cuz if the target is prod/shot_instance
            # and its parent search is ShotFilterWdg, it's hard to isolate what shot has been selected
            search_bvr = {
                'type':
                'click_up',
                'cbjs_action':
                'spt.dg_table.search_cbk(evt, bvr)',
                'override_class_name':
                'tactic.ui.cgapp.AppAssetInstancePanelWdg',
                'override_target':
                "bvr.src_el.getParent('.spt_app_asset_inst_panel')"
            }

            search_wdg = SearchWdg(search_type=parent_search_type, view='search_shot_loader', parent_key='', filter=''\
            , display='block', custom_filter_view='', state=None, run_search_bvr=search_bvr)
            widget.add(HtmlElement.spacer_div(1, 10))
            widget.add(search_wdg)

            # if there is result, it could only be one shot
            search = search_wdg.get_search()
            shots = search.get_sobjects()

            if not self.shot and len(shots) == 1:
                self.shot = shots[0]

        # create the asset table
        table_id = "main_body_asset_instance_table"

        if not self.shot:
            return widget
        # get any parent shots
        parent_code = self.shot.get_value("parent_code")
        shot_code = self.shot.get_code()

        # add the search make sure set elements are not shown
        search = Search(self.instance_search_type)
        if parent_code != "":
            search.add_filters(self.shot.get_foreign_key(),
                               [shot_code, parent_code])
        else:
            search.add_filter(self.shot.get_foreign_key(), shot_code)

        search.add_where("\"type\" in ('set_item', 'asset')")
        search.add_order_by('asset_code')

        instances = search.get_sobjects()

        # if parent shot and current shot has the same instance, hide the
        # parent's one

        top_instances = []
        for instance in instances:
            if instance.get_value('type') != 'set_item':
                top_instances.append(instance)

        #instances = ShotInstance.filter_instances(instances, shot_code)
        top_instances = ShotInstance.filter_instances(top_instances, shot_code)
        # TODO: just add asset name to the ShotInstance table
        # get the original asset names

        aux_data = ShotInstance.get_aux_data(top_instances,
                                             self.asset_search_type)

        values = FilterData.get().get_values_by_index('view_action_option', 0)
        state = {}

        if not self.show_search:
            if values:
                state['process'] = values.get('load_%s_process' %
                                              parent_search_type)
            else:
                process_filter = ProcessFilterWdg(None, parent_search_type)
                state['process'] = process_filter.get_value()

        Container.put("global_state", state)

        from tactic.ui.cgapp import CGAppLoaderWdg
        cg_wdg = CGAppLoaderWdg(view='load',
                                search_type=self.instance_search_type)
        widget.add(cg_wdg)

        if not top_instances:
            widget.add('No Asset Instances in Shot.')
        else:
            asset_table = TableLayoutWdg(table_id = table_id, search_type=self.instance_search_type,\
                view="load", inline_search=False, aux_info = aux_data, mode='simple')

            #asset_table = ViewPanelWdg( search_type=search_type,  inline_search=False, \
            #        show_general_search=False, view='load', state=state, mode='simple')

            asset_table.set_sobjects(top_instances)
            widget.add(asset_table)

            shot_inst_names = [inst.get_code() for inst in instances]

            self.add_unassigned_instances(widget, shot_inst_names)
        return widget
Exemple #16
0
    def get_category_wdg2(self, paths, title=None, tags={}):

        if not paths:
            paths = []

        div = DivWdg()

        if not title:
            title = "Paths"
        div.add("%s (%s)<hr/>" % (title, len(paths)) )
        #if not paths:
        #    div.add("-- None --<br/>")

        table = Table()
        div.add(table)
        table.add_color("color", "color")

        base_dir = self.kwargs.get("base_dir")

        sobjects = []
        tags_keys = set()
        for path in paths:
            sobject = SearchType.create("sthpw/virtual")

            basename = os.path.basename(path)
            dirname = os.path.dirname(path)

            # FIXME: need session base
            reldir = dirname.replace("%s" % base_dir, "")
            reldir = dirname


            if not reldir:
                reldir = '&nbsp;'
            else:
                reldir.lstrip("/")
            if not basename:
                basename = '&nbsp;'

            sobject.set_value("folder", reldir)
            sobject.set_value("file_name", basename)
            sobjects.append(sobject)

            if tags:
                path_tags = tags.get(path)
                if path_tags:
                    for key, value in path_tags.get("sobject").items():
                        sobject.set_value(key, value)
                        tags_keys.add(key)

        from tactic.ui.panel import TableLayoutWdg
        element_names = ['path']
        element_names.extend( list(tags_keys) )
        #show_metadata = False
        #if not show_metadata:
        #    element_names.remove('metadata')


        config_xml = self.get_config_xml(list(tags_keys))

        layout = TableLayoutWdg(search_type='sthpw/virtual', view='report', config_xml=config_xml, element_names=element_names, mode='simple')
        # FIXME: just show first 200 results
        layout.set_sobjects(sobjects[:200])

        div.add(layout)

        return div
Exemple #17
0
    def get_category_wdg2(self, paths, title=None, tags={}):

        if not paths:
            paths = []

        div = DivWdg()

        if not title:
            title = "Paths"
        div.add("%s (%s)<hr/>" % (title, len(paths)))
        #if not paths:
        #    div.add("-- None --<br/>")

        table = Table()
        div.add(table)
        table.add_color("color", "color")

        base_dir = self.kwargs.get("base_dir")

        sobjects = []
        tags_keys = set()
        for path in paths:
            sobject = SearchType.create("sthpw/virtual")

            basename = os.path.basename(path)
            dirname = os.path.dirname(path)

            # FIXME: need session base
            reldir = dirname.replace("%s" % base_dir, "")
            reldir = dirname

            if not reldir:
                reldir = '&nbsp;'
            else:
                reldir.lstrip("/")
            if not basename:
                basename = '&nbsp;'

            sobject.set_value("folder", reldir)
            sobject.set_value("file_name", basename)
            sobjects.append(sobject)

            if tags:
                path_tags = tags.get(path)
                if path_tags:
                    for key, value in path_tags.get("sobject").items():
                        sobject.set_value(key, value)
                        tags_keys.add(key)

        from tactic.ui.panel import TableLayoutWdg
        element_names = ['path']
        element_names.extend(list(tags_keys))
        #show_metadata = False
        #if not show_metadata:
        #    element_names.remove('metadata')

        config_xml = self.get_config_xml(list(tags_keys))

        layout = TableLayoutWdg(search_type='sthpw/virtual',
                                view='report',
                                config_xml=config_xml,
                                element_names=element_names,
                                mode='simple')
        # FIXME: just show first 200 results
        layout.set_sobjects(sobjects[:200])

        div.add(layout)

        return div
Exemple #18
0
    def get_display(self):

        top = self.top
        self.set_as_panel(top)
        top.set_unique_id()
        top.add_style("min-width: 600px")
        top.add_style("max-height: 600px")
        top.add_style("overflow-y: auto")

        top.add_color("background", "background")
        top.add_color("color", "color")

        sobject = self.kwargs.get("sobject")
        if not sobject:
            search_key = self.kwargs.get("search_key")
            sobject = Search.get_by_search_key(search_key)
        else:
            search_key = sobject.get_search_key()


        context = self.kwargs.get("context")


        search = Search("sthpw/note") 
        #search.add_relationship_filters(self.filtered_parents, type='hierarchy')
        search.add_parent_filter(sobject)
        search.add_order_by("process")
        search.add_order_by("context")
        search.add_order_by("timestamp desc")

        if context:
            search.add_filter("context", context)

        notes = search.get_sobjects()



        top.add_smart_style("spt_note", "padding", "15px")

        for i, note in enumerate(notes):

            note_div = DivWdg()
            top.add( note_div )
            note_div.add( self.get_note_wdg(note) )

            if i % 2 == 0:
                note_div.add_color("background", "background", -3)

        top.add("<br/><hr/><br/>")

        from tactic.ui.panel import TableLayoutWdg
        table = TableLayoutWdg(
                search_type="sthpw/note",
                show_shelf=False,
                show_select=False,
                element_names=['login','timestamp','note','delete'])
        table.set_sobjects(notes)
        top.add(table)


        return top
Exemple #19
0
    def get_display(my):
        
        widget = DivWdg()
        my.set_as_panel(widget, class_name='spt_view_panel spt_panel spt_app_asset_inst_panel')
        
        parent_search_type= my.search_type
        
        if my.show_search:
            # Have to limit this search to just its parent.. cuz if the target is prod/shot_instance
            # and its parent search is ShotFilterWdg, it's hard to isolate what shot has been selected
            search_bvr = {
                'type':         'click_up',
                'cbjs_action':  'spt.dg_table.search_cbk(evt, bvr)',
                'override_class_name': 'tactic.ui.cgapp.AppAssetInstancePanelWdg',
                'override_target': "bvr.src_el.getParent('.spt_app_asset_inst_panel')"
            }

            search_wdg = SearchWdg(search_type=parent_search_type, view='search_shot_loader', parent_key='', filter=''\
            , display='block', custom_filter_view='', state=None, run_search_bvr=search_bvr)
            widget.add( HtmlElement.spacer_div(1,10) )
            widget.add(search_wdg)


            # if there is result, it could only be one shot
            search = search_wdg.get_search()
            shots = search.get_sobjects()
            
            if not my.shot and len(shots) == 1:
                my.shot= shots[0]

        # create the asset table
        table_id = "main_body_asset_instance_table" 
              
        if not my.shot:
            return widget
        # get any parent shots
        parent_code = my.shot.get_value("parent_code")
        shot_code = my.shot.get_code()

        # add the search make sure set elements are not shown
        search = Search(my.instance_search_type)
        if parent_code != "":
            search.add_filters(my.shot.get_foreign_key(), [shot_code,parent_code] )
        else:
            search.add_filter(my.shot.get_foreign_key(), shot_code )

        search.add_where("\"type\" in ('set_item', 'asset')")
        search.add_order_by('asset_code')
        
        instances = search.get_sobjects()

        # if parent shot and current shot has the same instance, hide the 
        # parent's one
        
        top_instances = []
        for instance in instances:
            if instance.get_value('type') != 'set_item':
                top_instances.append(instance)

        #instances = ShotInstance.filter_instances(instances, shot_code)
        top_instances = ShotInstance.filter_instances(top_instances, shot_code)
        # TODO: just add asset name to the ShotInstance table
        # get the original asset names

        aux_data = ShotInstance.get_aux_data(top_instances, my.asset_search_type)

        values = FilterData.get().get_values_by_index('view_action_option', 0)
        state = {}
        
        if not my.show_search:
            if values:
                state['process'] = values.get('load_%s_process'% parent_search_type)
            else:
                process_filter = ProcessFilterWdg(None, parent_search_type)
                state['process'] = process_filter.get_value()

        Container.put("global_state", state)
        
        from tactic.ui.cgapp import CGAppLoaderWdg
        cg_wdg = CGAppLoaderWdg(view='load', search_type=my.instance_search_type)
        widget.add(cg_wdg)

        if not top_instances:
            widget.add('No Asset Instances in Shot.')
        else:
            asset_table = TableLayoutWdg(table_id = table_id, search_type=my.instance_search_type,\
                view="load", inline_search=False, aux_info = aux_data, mode='simple')

            #asset_table = ViewPanelWdg( search_type=search_type,  inline_search=False, \
            #        show_general_search=False, view='load', state=state, mode='simple') 

            asset_table.set_sobjects(top_instances)
            widget.add(asset_table)

            shot_inst_names = [inst.get_code() for inst in instances]
            
            my.add_unassigned_instances(widget, shot_inst_names)
        return widget
Exemple #20
0
    def get_display(my):
        top = DivWdg()

        sobject = my.get_sobject()
        if not sobject:
            return top
        process = my.kwargs.get("process")

        #from tactic.ui.table import TaskElementWdg
        #task_wdg = TaskElementWdg()
        #task_wdg.set_sobject(my.sobject)
        #top.add(task_wdg)

        search = Search('sthpw/task')
        search.add_parent_filter(sobject)
        search.add_filter("process", process)
        tasks = search.get_sobjects()

        tasks_div = DivWdg()
        top.add(tasks_div)
        #tasks_div.add_style("padding: 0px 0px 20px 0px")
        tasks_div.add_style("margin: 10px")
        tasks_div.set_box_shadow()

        title = DivWdg()
        title.add_gradient("background", "background3", 0, -10)
        title.add_color("color", "color3", -10)
        title.add_border()
        title.add_style("height: 20px")
        title.add_style("padding: 4px")
        title.add_style("font-weight: bold")
        title.add("All Tasks for process '%s':" % process)
        tasks_div.add(title)

        task_wdg = TableLayoutWdg(search_type="sthpw/task",
                                  view='single_process',
                                  show_row_select="false",
                                  show_insert="false",
                                  show_gear="false",
                                  show_search_limit="false",
                                  show_search=False,
                                  show_refresh="false",
                                  show_shelf="false")
        task_wdg.set_sobjects(tasks)
        tasks_div.add(task_wdg)

        #from tactic.ui.container import ResizableTableWdg
        #table = ResizableTableWdg()
        table = Table()
        top.add(table)
        table.add_style("width: 100%")
        table.add_row()

        td = table.add_cell()
        td.add_style("vertical-align: top")
        td.add_style("width: 50%")

        notes_div = DivWdg()
        td.add(notes_div)
        notes_div.set_box_shadow()
        notes_div.add_style("margin: 10px")

        title = DivWdg()
        notes_div.add(title)
        title.add_gradient("background", "background3", 0, -10)
        title.add_color("color", "color3", -10)
        title.add_border()
        title.add_style("height: 20px")
        title.add_style("padding: 4px")
        title.add_style("font-weight: bold")
        title.add("Notes:")

        from tactic.ui.widget.discussion_wdg import DiscussionWdg
        discussion_wdg = DiscussionWdg(search_key=sobject.get_search_key(),
                                       process=process,
                                       context_hidden=True,
                                       show_note_expand=True)
        notes_div.add(discussion_wdg)

        search = Search('sthpw/snapshot')
        search.add_parent_filter(sobject)
        search.add_filter("process", process)
        snapshots = search.get_sobjects()

        td = table.add_cell()
        td.add_style("vertical-align: top")
        td.add_style("width: 50%")
        td.add_style("padding: 0 0 0 0")

        snapshots_div = DivWdg()
        td.add(snapshots_div)
        snapshots_div.set_box_shadow()
        snapshots_div.add_style("margin: 10px")

        title = DivWdg()
        title.add_gradient("background", "background3", 0, -10)
        title.add_color("color", "color3", -10)
        title.add_border()
        title.add_style("height: 20px")
        title.add_style("padding: 4px")
        title.add_style("font-weight: bold")
        title.add("Snapshots:")
        snapshots_div.add(title)

        snapshot_wdg = TableLayoutWdg(search_type="sthpw/snapshot",
                                      view='table',
                                      mode='simple',
                                      show_row_select=False,
                                      width='100%',
                                      show_shelf="false")
        snapshot_wdg.set_sobjects(snapshots)
        snapshots_div.add(snapshot_wdg)

        return top