Example #1
0
    def init_cgi(my):
        web = WebContainer.get_web()
        snapshot_code = web.get_form_value("snapshot_code")
        namespace = web.get_form_value("namespace")

        snapshot = Snapshot.get_by_code(snapshot_code)
        session = SessionContents.get(asset_mode=True)

        my.set_info(snapshot, session, namespace)
Example #2
0
    def init_cgi(my):
        web = WebContainer.get_web()
        snapshot_code = web.get_form_value("snapshot_code")
        namespace = web.get_form_value("namespace")

        snapshot = Snapshot.get_by_code(snapshot_code)
        session = SessionContents.get(asset_mode=True)

        my.set_info(snapshot, session, namespace)
Example #3
0
    def add_unassigned_instances(my, widget, shot_inst_names):
        ''' add the unassigned instances into a SwapDisplayWdg '''
        info = []
        session = SessionContents.get()
        if not session:
            return ""

        tactic_nodes = session.get_instance_names(is_tactic_node=True)
        non_tactic_nodes = session.get_node_names(is_tactic_node=False)

        """
        title = HtmlElement.b('Unassigned instances')
        widget.add(title)

                  # this is just a filler for now, can be any sobjects
        snapshots = []
        for tactic_node in tactic_nodes:
            if tactic_node not in shot_inst_names:
                session_version = session.get_version(tactic_node) 
                session_snap = session.get_snapshot(tactic_node)
                if session_snap:
                    snapshots.append(session_snap)
                    info.append({'session_version': session_version, 'instance':\
                    tactic_node})

        div = DivWdg(id="unassigned_table")

        SwapDisplayWdg.create_swap_title( title, swap, div) 
        table = TableWdg('sthpw/snapshot', 'session_items')
        table.set_show_property(False)
        table.set_aux_data(info)
        table.set_sobjects(snapshots)
        div.add(table)
        widget.add(div)
        widget.add(HtmlElement.br())

        """
        # Add other non-tactic nodes
        swap2 = SwapDisplayWdg.get_triangle_wdg()
  
        title2 = HtmlElement.b('Other Nodes')
        div2 = DivWdg(id="other_node_div")
        
        widget.add(swap2)
        widget.add(title2)

        SwapDisplayWdg.create_swap_title( title2, swap2, div2) 
        hidden_table = Table(css='table')
        div2.add(hidden_table)
        hidden_table.set_max_width()
        for node in non_tactic_nodes:
            hidden_table.add_row()
            hidden_table.add_cell(node)
            hidden_table.add_blank_cell()

        widget.add(div2)
Example #4
0
    def add_unassigned_instances(self, widget, shot_inst_names):
        ''' add the unassigned instances into a SwapDisplayWdg '''
        info = []
        session = SessionContents.get()
        if not session:
            return ""

        tactic_nodes = session.get_instance_names(is_tactic_node=True)
        non_tactic_nodes = session.get_node_names(is_tactic_node=False)
        """
        title = HtmlElement.b('Unassigned instances')
        widget.add(title)

                  # this is just a filler for now, can be any sobjects
        snapshots = []
        for tactic_node in tactic_nodes:
            if tactic_node not in shot_inst_names:
                session_version = session.get_version(tactic_node) 
                session_snap = session.get_snapshot(tactic_node)
                if session_snap:
                    snapshots.append(session_snap)
                    info.append({'session_version': session_version, 'instance':\
                    tactic_node})

        div = DivWdg(id="unassigned_table")

        SwapDisplayWdg.create_swap_title( title, swap, div) 
        table = TableWdg('sthpw/snapshot', 'session_items')
        table.set_show_property(False)
        table.set_aux_data(info)
        table.set_sobjects(snapshots)
        div.add(table)
        widget.add(div)
        widget.add(HtmlElement.br())

        """
        # Add other non-tactic nodes
        swap2 = SwapDisplayWdg.get_triangle_wdg()

        title2 = HtmlElement.b('Other Nodes')
        div2 = DivWdg(id="other_node_div")

        widget.add(swap2)
        widget.add(title2)

        SwapDisplayWdg.create_swap_title(title2, swap2, div2)
        hidden_table = Table(css='table')
        div2.add(hidden_table)
        hidden_table.set_max_width()
        for node in non_tactic_nodes:
            hidden_table.add_row()
            hidden_table.add_cell(node)
            hidden_table.add_blank_cell()

        widget.add(div2)
Example #5
0
    def alter_search(self, search):
        print "Introspect alter_search"

        # see if any of the filters have a class handler defined
        from tactic.ui.filter import FilterData
        filter_data = FilterData.get_from_cgi()
        values = filter_data.get_values_by_index("introspect", 0)

        do_search = values.get('search')
        if not do_search:
            return
            



        #search.add_filter("code", "chr002")
        session = SessionContents.get()

        node_names = session.get_node_names()

        snapshot_codes = session.get_snapshot_codes()
        snapshot_search = Search("sthpw/snapshot")
        snapshot_search.add_filters("code", snapshot_codes)
        snapshots = snapshot_search.get_sobjects()

        state_search_type = self.kwargs.get("search_type")


        # get ids
        ids = []
        for snapshot in snapshots:
            search_type = snapshot.get_value("search_type")
            if state_search_type:
                search_type_obj = SearchType.get(search_type)
                key = search_type_obj.get_base_key()
                print "compare: ", key, state_search_type
                if key != state_search_type:
                    continue

            id = snapshot.get_value("search_id")
            ids.append(id)

        print "ids: ", ids
        if ids:
            search.add_filters("id", ids)
Example #6
0
    def alter_search(self, search):
        print "Introspect alter_search"

        # see if any of the filters have a class handler defined
        from tactic.ui.filter import FilterData
        filter_data = FilterData.get_from_cgi()
        values = filter_data.get_values_by_index("introspect", 0)

        do_search = values.get('search')
        if not do_search:
            return

        #search.add_filter("code", "chr002")
        session = SessionContents.get()

        node_names = session.get_node_names()

        snapshot_codes = session.get_snapshot_codes()
        snapshot_search = Search("sthpw/snapshot")
        snapshot_search.add_filters("code", snapshot_codes)
        snapshots = snapshot_search.get_sobjects()

        state_search_type = self.kwargs.get("search_type")

        # get ids
        ids = []
        for snapshot in snapshots:
            search_type = snapshot.get_value("search_type")
            if state_search_type:
                search_type_obj = SearchType.get(search_type)
                key = search_type_obj.get_base_key()
                print "compare: ", key, state_search_type
                if key != state_search_type:
                    continue

            id = snapshot.get_value("search_id")
            ids.append(id)

        print "ids: ", ids
        if ids:
            search.add_filters("id", ids)
    def get_display(my):

        my.search_type = my.kwargs.get('search_type')
        my.texture_search_type = my.kwargs.get('texture_search_type')
        assert my.search_type

        app_name = WebContainer.get_web().get_selected_app()
        # add an outside box

        top = DivWdg(css='spt_view_panel')
        #div = DivWdg(css="maq_search_bar")
        div = DivWdg()
        div.add_color("background", "background2", -15)
        my.set_as_panel(top)

        top.add(div)
        div.add_style("margin: 5px")

        div.add_style("padding: 10px")

        div.add_style("font-style: bold")

        process_div = DivWdg()
        process_div.add_style("padding-left: 10px")
        div.add(process_div)
        process_div.add(my.get_process_wdg(my.search_type))
        process_div.add(my.get_context_filter_wdg())
        process_div.add(HtmlElement.br(clear="all"))

        div.add(HtmlElement.br())
        checkin_options = DivWdg(css='spt_ui_options')
        checkin_options.add_style("padding: 10px")

        swap = SwapDisplayWdg()
        #swap.set_off()
        title = SpanWdg("Check in Options")
        SwapDisplayWdg.create_swap_title(title,
                                         swap,
                                         checkin_options,
                                         is_open=False)
        div.add(swap)
        div.add(title)

        checkin_options.add(my.get_file_type_wdg())
        checkin_options.add(my.get_snapshot_type_wdg())
        checkin_options.add(HtmlElement.br(1))
        checkin_options.add(my.get_export_method_wdg())
        checkin_options.add(my.get_checkin_as_wdg())

        #my.add( my.get_render_icon_wdg() )

        # For different export methods
        checkin_options.add(my.get_currency_wdg())

        checkin_options.add(my.get_reference_option())
        checkin_options.add(my.get_auto_version_wdg())
        checkin_options.add(my.get_texture_option(app=app_name))
        checkin_options.add(my.get_handoff_wdg())

        if not my.context_select.get_value(for_display=True):
            my.add(DivWdg('A context must be selected.', css='warning'))
            return

        div.add(checkin_options)

        top.add(my.get_introspect_wdg())
        top.add(HtmlElement.br(2))

        # create the interface
        table = Table()
        table.set_max_width()
        #table.set_class("table")
        table.add_color('background', 'background2')
        #table.add_style('line-height','3.0em')
        #table.add_row(css='smaller')
        tr = table.add_row(css='smaller')
        tr.add_style('height', '3.5em')
        table.add_header(" ")
        table.add_header(" ")
        th = table.add_header("Instance")
        th.add_style('text-align: left')
        table.add_header(my.get_checkin())
        table.add_header("Sandbox")
        tr.add_color('background', 'background2', -15)

        # get session and handle case where there is no session
        my.session = SessionContents.get()
        if my.session == None:
            instance_names = []
            asset_codes = []
            node_names = []
        else:
            instance_names = my.session.get_instance_names()
            asset_codes = my.session.get_asset_codes()
            node_names = my.session.get_node_names()

        # get all of the possible assets based on the asset codes
        search = Search(my.search_type)
        search.add_filters("code", asset_codes)
        assets = search.get_sobjects()
        assets_dict = SObject.get_dict(assets, ["code"])

        if my.session:
            my.add("Current Project: <b>%s</b>" % my.session.get_project_dir())
        else:
            my.add("Current Project: Please press 'Introspect'")

        count = 0
        for i in range(0, len(node_names)):
            node_name = node_names[i]
            if not my.session.is_tactic_node(node_name) and \
                not my.session.get_node_type(node_name) in ['transform','objectSet']:
                continue
            instance_name = instance_names[i]

            # backwards compatible:
            try:
                asset_code = asset_codes[i]
            except IndexError, e:
                asset_code = instance_name

            # skip if this is a reference
            if my.list_references == False and \
                    my.session.is_reference(node_name):
                continue

            table.add_row()

            # check that this asset exists
            asset = assets_dict.get(asset_code)
            if not asset:
                continue

            # list items if it is a set
            if asset.get_value('asset_type',
                               no_exception=True) in ["set", "section"]:
                my.current_sobject = asset
                my.handle_set(table, instance_name, asset, instance_names)
                count += 1
            # if this asset is in the database, then allow it to checked in
            if asset:
                if my.session.get_snapshot_code(instance_name,
                                                snapshot_type='set'):
                    continue

                # hack remember this
                my.current_sobject = asset
                my.handle_instance(table, instance_name, asset, node_name)

            else:
                table.add_blank_cell()
                table.add_cell(instance_name)

            count += 1
Example #8
0
    def get_display(my):


        my.search_type = my.kwargs.get('search_type')
        my.texture_search_type = my.kwargs.get('texture_search_type')
        assert my.search_type

        app_name = WebContainer.get_web().get_selected_app()
        # add an outside box


        top = DivWdg(css='spt_view_panel')
        #div = DivWdg(css="maq_search_bar")
        div = DivWdg()
        div.add_color("background", "background2", -15)
        my.set_as_panel(top)

        top.add(div)
        div.add_style("margin: 5px")

        div.add_style("padding: 10px")
        
        div.add_style("font-style: bold")



        process_div = DivWdg()
        process_div.add_style("padding-left: 10px")
        div.add(process_div)
        process_div.add( my.get_process_wdg(my.search_type))
        process_div.add( my.get_context_filter_wdg() )
        process_div.add(HtmlElement.br(clear="all")) 


        div.add( HtmlElement.br() )
        checkin_options = DivWdg(css='spt_ui_options')
        checkin_options.add_style("padding: 10px")

        swap = SwapDisplayWdg()
        #swap.set_off()
        title = SpanWdg("Check in Options")
        SwapDisplayWdg.create_swap_title(title, swap, checkin_options, is_open=False)
        div.add(swap)
        div.add(title)


        checkin_options.add( my.get_file_type_wdg() )
        checkin_options.add( my.get_snapshot_type_wdg() )
        checkin_options.add(HtmlElement.br(1)) 
        checkin_options.add( my.get_export_method_wdg() )
        checkin_options.add( my.get_checkin_as_wdg() )

        #my.add( my.get_render_icon_wdg() )

        # For different export methods
        checkin_options.add( my.get_currency_wdg() )

        checkin_options.add( my.get_reference_option())
        checkin_options.add( my.get_auto_version_wdg())
        checkin_options.add( my.get_texture_option(app=app_name))
        checkin_options.add( my.get_handoff_wdg())
       
        if not my.context_select.get_value(for_display=True):
            my.add(DivWdg('A context must be selected.', css='warning'))
            return

        div.add(checkin_options)
      
        
        top.add( my.get_introspect_wdg() )
        top.add(HtmlElement.br(2))
        
        # create the interface
        table = Table()
        table.set_max_width()
        #table.set_class("table")
        table.add_color('background','background2') 
        #table.add_style('line-height','3.0em')
        #table.add_row(css='smaller')
        tr = table.add_row(css='smaller')
        tr.add_style('height', '3.5em')
        table.add_header("&nbsp;")
        table.add_header("&nbsp;")
        th = table.add_header("Instance")
        th.add_style('text-align: left')
        table.add_header(my.get_checkin())
        table.add_header("Sandbox")
        tr.add_color('background','background2', -15)
        

        # get session and handle case where there is no session
        my.session = SessionContents.get()
        if my.session == None:
            instance_names = []
            asset_codes = []
            node_names = []
        else:
            instance_names = my.session.get_instance_names()
            asset_codes = my.session.get_asset_codes()
            node_names = my.session.get_node_names()

        # get all of the possible assets based on the asset codes
        search = Search(my.search_type)
        search.add_filters("code", asset_codes)
        assets = search.get_sobjects()
        assets_dict = SObject.get_dict(assets, ["code"])

        if my.session:
            my.add("Current Project: <b>%s</b>" % my.session.get_project_dir() )
        else:
            my.add("Current Project: Please press 'Introspect'")


        count = 0
        for i in range(0, len(node_names) ):
            node_name = node_names[i]
            if not my.session.is_tactic_node(node_name) and \
                not my.session.get_node_type(node_name) in ['transform','objectSet']:
                    continue
            instance_name = instance_names[i]

            # backwards compatible:
            try:
                asset_code = asset_codes[i]
            except IndexError, e:
                asset_code = instance_name

            # skip if this is a reference
            if my.list_references == False and \
                    my.session.is_reference(node_name):
                continue

            table.add_row()


            # check that this asset exists
            asset = assets_dict.get(asset_code)
            if not asset:
                continue
           
            # list items if it is a set
            if asset.get_value('asset_type', no_exception=True) in ["set", "section"]:
                my.current_sobject = asset
                my.handle_set( table, instance_name, asset, instance_names)
                count +=1
            # if this asset is in the database, then allow it to checked in
            if asset:
                if my.session.get_snapshot_code(instance_name, snapshot_type='set'):
                    continue

                # hack remember this
                my.current_sobject = asset
                my.handle_instance(table, instance_name, asset, node_name)

            else:
                table.add_blank_cell()
                table.add_cell(instance_name)


            count += 1
Example #9
0
    def get_display(self):

        self.is_refresh = self.kwargs.get('is_refresh') =='true'
      
        if not self.is_refresh:
            top = DivWdg(css='spt_view_panel')
            self.set_as_panel(top)
        else:
            top = Widget() 

        div = DivWdg(css="filter_box")
        div.add("<b>Current Session</b>")
        top.add(div)

        # the button which initiates the introspection
        button = IntrospectWdg()
        #button.add_style("float", "right")
        top.add(button)

        top.add("<br clear='all'/>")


        session = SessionContents.get()
        if not session:
            widget.add("<h3>No contents in session</h3>")
            return widget

        table = Table()
        table.add_class("table")
        table.add_style("width: 100%")
        table.add_row()
        table.add_header("&nbsp;")
        table.add_header("Type")
        table.add_header("Asset")
        table.add_header("Node Name")
        table.add_header("Node Type")
        table.add_header("Reference")
        table.add_header("Session")
        table.add_header("Latest")

        node_names = session.get_node_names()
        for node_name in node_names:
            table.add_row()


            # snapshot_code
            snapshot_code = session.get_snapshot_code(node_name, "shot")
            if not snapshot_code:
                snapshot_code = session.get_snapshot_code(node_name, "anim")
            if not snapshot_code:
                snapshot_code = session.get_snapshot_code(node_name, "asset")

            snapshot = Snapshot.get_by_code(snapshot_code)
            sobject = None

            if snapshot:

                sobject = snapshot.get_sobject()
                base = sobject.get_search_type_obj().get_base_search_type()

                thumb = ThumbWdg()
                thumb.set_icon_size(60)

                # FIXME: make this more automatic
                if base == "prod/shot_instance":
                    thumb_sobj = sobject.get_parent("prod/asset")
                    thumb.set_sobject(thumb_sobj)
                else:
                    thumb.set_sobject(sobject)

                table.add_cell(thumb)

                title = sobject.get_search_type_obj().get_title()
                table.add_cell( title )

                # TODO: this should be more automatic!
                if base == "prod/shot_instance":
                    asset_code = sobject.get_value("asset_code")
                    shot_code = sobject.get_value("shot_code")
                    name = sobject.get_value("name")
                    table.add_cell("%s: %s in %s" % (name,asset_code,shot_code))
                else:
                    code = sobject.get_code()
                    name = sobject.get_name()
                    if code == name:
                        table.add_cell( "%s" % (code) )
                    else:
                        table.add_cell( "%s - %s" % (code, name) )

            else:
                table.add_cell("<i>No snapshot</i>")
                table.add_cell("---")
                table.add_cell("---")
                

            # display the node name
            table.add_cell(node_name)

            # display node type
            table.add_cell( session.get_node_type(node_name) )


            # display if it is a reference
            is_reference = session.is_reference(node_name)
            if is_reference:
                table.add_cell( "Yes" )
            else:
                table.add_cell( "No" )


            if snapshot:
                # add the snapshot info
                context = snapshot.get_value("context")
                version = snapshot.get_value("version")
                table.add_cell( "%s v%0.2d" % (context, version))
            else:
                table.add_cell("---")

            table.add_cell( self.get_version_wdg(session,snapshot,node_name) )

        top.add(table)
        return top       
Example #10
0
    def get_display(my):

        my.is_refresh = my.kwargs.get('is_refresh') =='true'
      
        if not my.is_refresh:
            top = DivWdg(css='spt_view_panel')
            my.set_as_panel(top)
        else:
            top = Widget() 

        div = DivWdg(css="filter_box")
        div.add("<b>Current Session</b>")
        top.add(div)

        # the button which initiates the introspection
        button = IntrospectWdg()
        #button.add_style("float", "right")
        top.add(button)

        top.add("<br clear='all'/>")


        session = SessionContents.get()
        if not session:
            widget.add("<h3>No contents in session</h3>")
            return widget

        table = Table()
        table.add_class("table")
        table.add_style("width: 100%")
        table.add_row()
        table.add_header("&nbsp;")
        table.add_header("Type")
        table.add_header("Asset")
        table.add_header("Node Name")
        table.add_header("Node Type")
        table.add_header("Reference")
        table.add_header("Session")
        table.add_header("Latest")

        node_names = session.get_node_names()
        for node_name in node_names:
            table.add_row()


            # snapshot_code
            snapshot_code = session.get_snapshot_code(node_name, "shot")
            if not snapshot_code:
                snapshot_code = session.get_snapshot_code(node_name, "anim")
            if not snapshot_code:
                snapshot_code = session.get_snapshot_code(node_name, "asset")

            snapshot = Snapshot.get_by_code(snapshot_code)
            sobject = None

            if snapshot:

                sobject = snapshot.get_sobject()
                base = sobject.get_search_type_obj().get_base_search_type()

                thumb = ThumbWdg()
                thumb.set_icon_size(60)

                # FIXME: make this more automatic
                if base == "prod/shot_instance":
                    thumb_sobj = sobject.get_parent("prod/asset")
                    thumb.set_sobject(thumb_sobj)
                else:
                    thumb.set_sobject(sobject)

                table.add_cell(thumb)

                title = sobject.get_search_type_obj().get_title()
                table.add_cell( title )

                # TODO: this should be more automatic!
                if base == "prod/shot_instance":
                    asset_code = sobject.get_value("asset_code")
                    shot_code = sobject.get_value("shot_code")
                    name = sobject.get_value("name")
                    table.add_cell("%s: %s in %s" % (name,asset_code,shot_code))
                else:
                    code = sobject.get_code()
                    name = sobject.get_name()
                    if code == name:
                        table.add_cell( "%s" % (code) )
                    else:
                        table.add_cell( "%s - %s" % (code, name) )

            else:
                table.add_cell("<i>No snapshot</i>")
                table.add_cell("---")
                table.add_cell("---")
                

            # display the node name
            table.add_cell(node_name)

            # display node type
            table.add_cell( session.get_node_type(node_name) )


            # display if it is a reference
            is_reference = session.is_reference(node_name)
            if is_reference:
                table.add_cell( "Yes" )
            else:
                table.add_cell( "No" )


            if snapshot:
                # add the snapshot info
                context = snapshot.get_value("context")
                version = snapshot.get_value("version")
                table.add_cell( "%s v%0.2d" % (context, version))
            else:
                table.add_cell("---")

            table.add_cell( my.get_version_wdg(session,snapshot,node_name) )

        top.add(table)
        return top       
Example #11
0
 def preprocess(my):
     # get the session, by default asset_mode = False, but we set it to True
     my.session = SessionContents.get(asset_mode=True)
Example #12
0
 def preprocess(my):
     # get the session, by default asset_mode = False, but we set it to True
     my.session = SessionContents.get(asset_mode=True)