Example #1
0
    def get_display(self):
        sobject = self.get_current_sobject()

        snapshots = []
        if isinstance(sobject, Layer):
            # for layer renders, we try to get all render sobjects
            renders = Render.get_all_by_sobject(sobject)
            if renders:
                snapshots = Snapshot.get_by_sobjects(renders, is_current=True)
        else:  # for object that has direct snapshots like plates
            snapshot = Snapshot.get_current_by_sobject(sobject)
            if snapshot:
                snapshots.append(snapshot)

        if not snapshots:
            return "<i>- no files -</i>"

        div = DivWdg()

        for snapshot in snapshots:
            file_types = snapshot.get_all_file_types()
            table = Table(css='embed')

            for file_type in file_types:
                table.add_row()

                table.add_cell(self.get_open_wdg(snapshot, file_type))
                dir = snapshot.get_client_lib_dir(file_type=file_type)

                table.add_cell("%s: <i>%s</i>" % (file_type, dir))

            div.add(table)
        return div
Example #2
0
    def get_display(self):
        sobject = self.get_current_sobject()

        snapshots = []
        if isinstance(sobject, Layer):
            # for layer renders, we try to get all render sobjects
            renders = Render.get_all_by_sobject(sobject)
            if renders:
                snapshots = Snapshot.get_by_sobjects(renders, is_current=True)
        else: # for object that has direct snapshots like plates
            snapshot = Snapshot.get_current_by_sobject(sobject)
            if snapshot:
                snapshots.append(snapshot)

        if not snapshots:
            return "<i>- no files -</i>"

        div = DivWdg()

        for snapshot in snapshots:
            file_types = snapshot.get_all_file_types()
            table = Table(css='embed')

            for file_type in file_types:
                table.add_row()
                
                table.add_cell( self.get_open_wdg(snapshot, file_type) )
                dir = snapshot.get_client_lib_dir(file_type=file_type)
                
                
                table.add_cell( "%s: <i>%s</i>" % (file_type, dir) )
         

            div.add(table)
        return div
Example #3
0
    def checkin_render(my):

        render_dir = my.render_context.get_render_dir()
        # check the expected images
   
        org_pat, final_pat = my.render_context.get_render_file_naming()
        #TODO: move frame range into render context

        filenames = os.listdir(render_dir)
        pat = re.compile(org_pat)

        # attach the sobject and snapshot to the render
        snapshot = my.render_context.get_snapshot()
        sobject = my.render_context.get_sobject()

        # for auto-increment, use -1 for version number
        file_range = my.render_context.get_frame_range()
        
        render = Render.create(sobject, snapshot, '<session/>', \
            file_range.get_key(), -1)
        my.description += "Flash render [%s] in %s\n" \
            %(sobject.get_description(), my.render_context.get_name())
        my.sobject = sobject
        
        # checkin the render
        file_format = my.render_context.get_file_format()
        if file_format =='png':
           my._check_in_png( snapshot, sobject, render, pat, final_pat, render_dir, filenames)
        elif file_format =='swf':
           my._check_in_swf( snapshot, sobject, render, pat, final_pat, render_dir, filenames) 
Example #4
0
    def checkin_render(my):

        render_dir = my.render_context.get_render_dir()
        # check the expected images

        org_pat, final_pat = my.render_context.get_render_file_naming()
        #TODO: move frame range into render context

        filenames = os.listdir(render_dir)
        pat = re.compile(org_pat)

        # attach the sobject and snapshot to the render
        snapshot = my.render_context.get_snapshot()
        sobject = my.render_context.get_sobject()

        # for auto-increment, use -1 for version number
        file_range = my.render_context.get_frame_range()

        render = Render.create(sobject, snapshot, '<session/>', \
            file_range.get_key(), -1)
        my.description += "Flash render [%s] in %s\n" \
            %(sobject.get_description(), my.render_context.get_name())
        my.sobject = sobject

        # checkin the render
        file_format = my.render_context.get_file_format()
        if file_format == 'png':
            my._check_in_png(snapshot, sobject, render, pat, final_pat,
                             render_dir, filenames)
        elif file_format == 'swf':
            my._check_in_swf(snapshot, sobject, render, pat, final_pat,
                             render_dir, filenames)
Example #5
0
    def get_display(self):
        sobject = self.get_current_sobject()


        # this is a comp object ... need to find the shot
        if not isinstance(sobject, Shot) :
            shot = sobject.get_parent("prod/shot")
        else:
            shot = sobject

        # now get all of the layers
        layers = shot.get_all_children("prod/layer")
        div = DivWdg()
    
        #div.set_style('width: 100px; overflow": auto')
        table = Table(css='embed')

        table.add_row()
        table.add_cell( shot.get_code() )

        render = Render.get_last(shot)
        if not render:
            table.add_cell("<i>No renders</i>")
        else:
            render = Snapshot.get_current_by_sobject(render)
            table.add_cell( self.get_open_wdg(render) )
            dir = render.get_web_dir()
            table.add_cell( "<i>%s</i>" % dir )


        for layer in layers:
            table.add_row()
            table.add_cell( layer.get_value("name") )

            render = Render.get_last(layer)
            if render:
                render = Snapshot.get_current_by_sobject(render)
            if not render:
                table.add_cell("<i>No renders</i>")
            else:
                table.add_cell( self.get_open_wdg(render) )
                dir = render.get_client_lib_dir()
                table.add_cell( "<i>%s</i>" % dir )


        div.add(table)
        return div
Example #6
0
    def get_display(self):
        sobject = self.get_current_sobject()

        # this is a comp object ... need to find the shot
        if not isinstance(sobject, Shot):
            shot = sobject.get_parent("prod/shot")
        else:
            shot = sobject

        # now get all of the layers
        layers = shot.get_all_children("prod/layer")
        div = DivWdg()

        #div.set_style('width: 100px; overflow": auto')
        table = Table(css='embed')

        table.add_row()
        table.add_cell(shot.get_code())

        render = Render.get_last(shot)
        if not render:
            table.add_cell("<i>No renders</i>")
        else:
            render = Snapshot.get_current_by_sobject(render)
            table.add_cell(self.get_open_wdg(render))
            dir = render.get_web_dir()
            table.add_cell("<i>%s</i>" % dir)

        for layer in layers:
            table.add_row()
            table.add_cell(layer.get_value("name"))

            render = Render.get_last(layer)
            if render:
                render = Snapshot.get_current_by_sobject(render)
            if not render:
                table.add_cell("<i>No renders</i>")
            else:
                table.add_cell(self.get_open_wdg(render))
                dir = render.get_client_lib_dir()
                table.add_cell("<i>%s</i>" % dir)

        div.add(table)
        return div
Example #7
0
    def get_display(my):

        web = WebContainer.get_web()
        search_key = web.get_form_value("search_key")

        widget = Widget()

        sobject = Search.get_by_search_key(search_key)

        table = TableWdg( sobject.get_search_type(), "render" )
        table.set_sobject(sobject)
        widget.add(table)



        # get all of the snapshots with a context render
        sobject_snapshot = Snapshot.get_latest_by_sobject(sobject,"render")
        if sobject_snapshot:
            search_type = sobject.get_search_type()
            search_id = sobject.get_value('search_id')
            
            render_snapshots = Snapshot.get_by_search_type(search_type,search_id,"render")

            table = TableWdg("sthpw/snapshot")
            table.set_sobjects(render_snapshots)
            widget.add(table)



        widget.add(HtmlElement.h3("Rendered Frames"))
        if sobject_snapshot:
            widget.add("Render version: v%0.3d" % sobject_snapshot.get_value("version") )

        # get latest snapshot of the render
        renders = Render.get_all_by_sobject(sobject)
        if not renders:
            widget.add("<h4>No renders found</h4>")
            return widget

        render = renders[0]
        snapshot = Snapshot.get_latest_by_sobject(render,"render")
        if snapshot == None:
            widget.add("<h4>No snapshots found</h4>")
            return widget


        # get the images
        web_dir = snapshot.get_web_dir()
        lib_dir = snapshot.get_lib_dir()

        xml = snapshot.get_xml_value("snapshot")
        file_nodes = xml.get_nodes("snapshot/file")
        file_name = icon_file_name = ''
        frame_range = icon_frame_range = None
        
        for file_node in file_nodes: 
            if Xml.get_attribute(file_node, 'type') == 'main':
                file_name, frame_range = my._get_frame_info(file_node, sobject)
            if Xml.get_attribute(file_node, 'type') == 'icon':
                icon_file_name, icon_frame_range = my._get_frame_info(file_node, sobject)
            
        file_names = [file_name]
        icon_file_names = [icon_file_name]        

        if "##" in file_name:
            file_names = FileGroup.expand_paths(file_name, frame_range)
        if "##" in icon_file_name:
            icon_file_names = FileGroup.expand_paths(icon_file_name, \
                icon_frame_range)    
        
        div = DivWdg()
        for k in range(len(file_names)):
            file_name = file_names[k]

            # ignore frames that don't exist
            lib_path = "%s/%s" % (lib_dir, file_name)
            if not os.path.exists(lib_path):
                continue
           
            try:
                icon_file_name = icon_file_names[k]
            except IndexError:
                icon_file_name = file_names[k]
                
            file_path = "%s/%s" % (web_dir, file_name)
            icon_file_path = "%s/%s" % (web_dir, icon_file_name)
            
            img = HtmlElement.img(icon_file_path)
            img.set_attr("width", "60")
            img.add_event("onmouseover","hint_bubble.show(event,'Ctrl + Click to open in new window')")

            href = HtmlElement.href(img, file_path)
            div.add(href)

        widget.add(div)

        widget.add( "<h3>Render History</h3>" )
        widget.add( my.get_render_history(renders) )

        return widget
Example #8
0
    def get_display(my):

        web = WebContainer.get_web()
        search_key = web.get_form_value("search_key")

        widget = Widget()

        sobject = Search.get_by_search_key(search_key)

        table = TableWdg(sobject.get_search_type(), "render")
        table.set_sobject(sobject)
        widget.add(table)

        # get all of the snapshots with a context render
        sobject_snapshot = Snapshot.get_latest_by_sobject(sobject, "render")
        if sobject_snapshot:
            search_type = sobject.get_search_type()
            search_id = sobject.get_value('search_id')

            render_snapshots = Snapshot.get_by_search_type(
                search_type, search_id, "render")

            table = TableWdg("sthpw/snapshot")
            table.set_sobjects(render_snapshots)
            widget.add(table)

        widget.add(HtmlElement.h3("Rendered Frames"))
        if sobject_snapshot:
            widget.add("Render version: v%0.3d" %
                       sobject_snapshot.get_value("version"))

        # get latest snapshot of the render
        renders = Render.get_all_by_sobject(sobject)
        if not renders:
            widget.add("<h4>No renders found</h4>")
            return widget

        render = renders[0]
        snapshot = Snapshot.get_latest_by_sobject(render, "render")
        if snapshot == None:
            widget.add("<h4>No snapshots found</h4>")
            return widget

        # get the images
        web_dir = snapshot.get_web_dir()
        lib_dir = snapshot.get_lib_dir()

        xml = snapshot.get_xml_value("snapshot")
        file_nodes = xml.get_nodes("snapshot/file")
        file_name = icon_file_name = ''
        frame_range = icon_frame_range = None

        for file_node in file_nodes:
            if Xml.get_attribute(file_node, 'type') == 'main':
                file_name, frame_range = my._get_frame_info(file_node, sobject)
            if Xml.get_attribute(file_node, 'type') == 'icon':
                icon_file_name, icon_frame_range = my._get_frame_info(
                    file_node, sobject)

        file_names = [file_name]
        icon_file_names = [icon_file_name]

        if "##" in file_name:
            file_names = FileGroup.expand_paths(file_name, frame_range)
        if "##" in icon_file_name:
            icon_file_names = FileGroup.expand_paths(icon_file_name, \
                icon_frame_range)

        div = DivWdg()
        for k in range(len(file_names)):
            file_name = file_names[k]

            # ignore frames that don't exist
            lib_path = "%s/%s" % (lib_dir, file_name)
            if not os.path.exists(lib_path):
                continue

            try:
                icon_file_name = icon_file_names[k]
            except IndexError:
                icon_file_name = file_names[k]

            file_path = "%s/%s" % (web_dir, file_name)
            icon_file_path = "%s/%s" % (web_dir, icon_file_name)

            img = HtmlElement.img(icon_file_path)
            img.set_attr("width", "60")
            img.add_event(
                "onmouseover",
                "hint_bubble.show(event,'Ctrl + Click to open in new window')")

            href = HtmlElement.href(img, file_path)
            div.add(href)

        widget.add(div)

        widget.add("<h3>Render History</h3>")
        widget.add(my.get_render_history(renders))

        return widget