Exemplo n.º 1
0
    def get(cls, texture_code, parent_code, project_code=None, is_multi=False):
        if not project_code:
            project_code = Project.get_project_code()
        search = Search(cls.SEARCH_TYPE, project_code)

        #search.set_show_retired(True)

        if texture_code:
            search.add_filter('code', texture_code)

        # backward compatible with using shot code
        if isinstance(parent_code, basestring):
            from pyasm.prod.biz import Shot
            parent = Shot.get_by_code(parent_code)
        else:
            parent = parent_code
        if not parent:
            if is_multi:
                return []
            else:
                return None

        search.add_filter('search_type', parent.get_search_type())
        search.add_filter('search_id', parent.get_id())
        parent_key = SearchKey.get_by_sobject(parent)

        search_type = search.get_search_type()
        key = "%s|%s|%s" % (search_type, texture_code, parent_key)
        sobj = cls.get_by_search(search, key, is_multi=is_multi)

        return sobj
Exemplo n.º 2
0
    def get_summary_wdg(self):
        widget = Widget()

        nav = DivWdg(css="filter_box")
        search_columns = Shot.get_search_columns()


        search_filter = SearchFilterWdg(name="shot_search", columns=search_columns)
        nav.add(search_filter)

        status_select = FilterSelectWdg("status_select", label='Status:', css='med')
        status_select.add_empty_option("-- Any Status --")
        status_select.set_option("setting", "shot_status")
        status_value = status_select.get_value()
        nav.add(status_select)

        filter = SequenceFilterWdg()
        nav.add(filter)

        widget.add(nav)

        search = Search("prod/shot")
        search_filter.alter_search(search)
        filter.alter_search(search)
        if status_value:
            search.add_filter("status", status_value)
        
        table = TableWdg("prod/shot", "summary")
        table.set_search_limit(10)
        table.set_search(search)
        widget.add(table)

        return widget
Exemplo n.º 3
0
    def prod_render(my,dirs):
        search_type = my.sobject.get_value("search_type")
        search_id = my.sobject.get_value("search_id")

        ref_sobject = Search.get_by_search_key("%s|%s" % (search_type,search_id))
        # get shot and episode code
        shot_code = ref_sobject.get_value("code")
        shot = Shot.get_by_code(shot_code)
        episode_code = ''
        if shot:
            episode_code = shot.get_value("episode_code")

        name = ''
        if ref_sobject.has_value('name'):
            name = ref_sobject.get_value("name")

        # build the path
        dirs = my.get_default(dirs)
        dirs.append(episode_code)
        dirs.append(shot_code)
        if name:
            dirs.append(name)

        version = my.sobject.get_value("version")
        dirs.append("%04d" % version)

        return dirs
Exemplo n.º 4
0
    def init(my):

        # my.text = FilterTextWdg("shot_search", label='Search: ', \
        #        css='med', has_persistence=True)
        search_columns = Shot.get_search_columns()
        my.text = SearchFilterWdg("shot_search", columns=search_columns, has_persistence=True)
        my.add(my.text)
Exemplo n.º 5
0
    def get(cls, texture_code, parent_code, project_code=None, is_multi=False):
        if not project_code:
            project_code = Project.get_project_code()
        search = Search( cls.SEARCH_TYPE, project_code )
        
        #search.set_show_retired(True)
        
        if texture_code:
            search.add_filter('code', texture_code)
        
        # backward compatible with using shot code
        if isinstance(parent_code, basestring):
            from pyasm.prod.biz import Shot
            parent = Shot.get_by_code(parent_code)
        else:
            parent = parent_code
        if not parent:
            if is_multi:
                return []
            else:
                return None

        search.add_filter('search_type',  parent.get_search_type())
        search.add_filter('search_id',  parent.get_id())
        parent_key = SearchKey.get_by_sobject(parent)
        
        search_type = search.get_search_type()
        key = "%s|%s|%s" % (search_type, texture_code, parent_key)
        sobj = cls.get_by_search(search, key, is_multi=is_multi)
       
        return sobj
Exemplo n.º 6
0
    def get_summary_wdg(self):
        widget = Widget()

        nav = DivWdg(css="filter_box")
        search_columns = Shot.get_search_columns()

        search_filter = SearchFilterWdg(name="shot_search",
                                        columns=search_columns)
        nav.add(search_filter)

        status_select = FilterSelectWdg("status_select",
                                        label='Status:',
                                        css='med')
        status_select.add_empty_option("-- Any Status --")
        status_select.set_option("setting", "shot_status")
        status_value = status_select.get_value()
        nav.add(status_select)

        filter = SequenceFilterWdg()
        nav.add(filter)

        widget.add(nav)

        search = Search("prod/shot")
        search_filter.alter_search(search)
        filter.alter_search(search)
        if status_value:
            search.add_filter("status", status_value)

        table = TableWdg("prod/shot", "summary")
        table.set_search_limit(10)
        table.set_search(search)
        widget.add(table)

        return widget
Exemplo n.º 7
0
    def prod_render(my, dirs):
        search_type = my.sobject.get_value("search_type")
        search_id = my.sobject.get_value("search_id")

        ref_sobject = Search.get_by_search_key("%s|%s" %
                                               (search_type, search_id))
        # get shot and episode code
        shot_code = ref_sobject.get_value("code")
        shot = Shot.get_by_code(shot_code)
        episode_code = ''
        if shot:
            episode_code = shot.get_value("episode_code")

        name = ''
        if ref_sobject.has_value('name'):
            name = ref_sobject.get_value("name")

        # build the path
        dirs = my.get_default(dirs)
        dirs.append(episode_code)
        dirs.append(shot_code)
        if name:
            dirs.append(name)

        version = my.sobject.get_value("version")
        dirs.append("%04d" % version)

        return dirs
Exemplo n.º 8
0
    def init(my):

        #my.text = FilterTextWdg("shot_search", label='Search: ', \
        #        css='med', has_persistence=True)
        search_columns = Shot.get_search_columns()
        my.text = SearchFilterWdg("shot_search", columns=search_columns,\
                 has_persistence=True)
        my.add(my.text)
Exemplo n.º 9
0
    def get_shot_list_wdg(self):

        widget = Widget()
        help = HelpItemWdg(
            'Shot List',
            'The Shot List tab allows you to insert new shots, define frame range, amd set differernt statuses for your shot. It also provides a button for media submission.'
        )
        widget.add(help)
        nav = DivWdg(css='filter_box')

        search_columns = Shot.get_search_columns()
        search_filter = SearchFilterWdg(name="shot_search",
                                        columns=search_columns)
        nav.add(search_filter)

        seq_filter = SequenceFilterWdg()
        nav.add(seq_filter)

        status_select = FilterSelectWdg("status_select", label='Status: ')
        status_select.add_empty_option("-- Any Status --")
        status_select.set_option("setting", "shot_status")
        status_value = status_select.get_value()
        nav.add(status_select)

        pipeline_filter = PipelineFilterWdg()
        pipeline_filter.set_search_type('prod/shot')
        nav.add(pipeline_filter)

        scan_status_select = FilterSelectWdg("scan_status_select",
                                             label='Scan Status: ')
        scan_status_select.add_empty_option("-- Any Scan Status --")
        scan_status_select.set_option("setting", "shot_scan_status")
        scan_status_value = scan_status_select.get_value()
        nav.add(scan_status_select)

        widget.add(nav)

        order = Sequence.get_order()

        search = Search("prod/shot")
        search.add_enum_order_by('sequence_code', order)
        search.add_order_by('code')

        seq_filter.alter_search(search)
        pipeline_filter.alter_search(search)
        if status_value:
            search.add_filter("status", status_value)

        if scan_status_value:
            search.add_filter("scan_status", scan_status_value)

        widget.set_search(search)
        table = TableWdg("prod/shot", "manage")
        widget.add(table)

        return widget
Exemplo n.º 10
0
 def execute(self):
     self.add_description('Add shots in bulk')
     # add from shot 00001 to 00050 if they do not exist already
     count = 0
     for x in xrange(1, 51):
         shot_code = '%s_%0.3d'%(self.seq_code, x)
         shot = Shot.get_by_code(shot_code)
         if not shot:
             print "[%s] to be created." %shot_code
             shot = Shot.create(shot_code, 'Shot %s' %shot_code)
             shot.set_value('sequence_code', self.seq_code)
             # assuming this is one of the values in project settings
             # shot_status
             shot.set_value('status', 'online')
             # this is the default
             shot.set_value('pipeline_code','shot')
             shot.commit()
             count += 1
         else:
             print "[%s] already exists." %shot_code
     print "%d shot(s) created." %count
Exemplo n.º 11
0
    def get_shot_list_wdg(self):

        widget = Widget()
        help = HelpItemWdg('Shot List', 'The Shot List tab allows you to insert new shots, define frame range, amd set differernt statuses for your shot. It also provides a button for media submission.')
        widget.add(help)
        nav = DivWdg(css='filter_box')

        search_columns = Shot.get_search_columns()
        search_filter = SearchFilterWdg(name="shot_search", columns=search_columns)
        nav.add(search_filter)

        seq_filter = SequenceFilterWdg()
        nav.add(seq_filter)

        status_select = FilterSelectWdg("status_select", label='Status: ')
        status_select.add_empty_option("-- Any Status --")
        status_select.set_option("setting", "shot_status")
        status_value = status_select.get_value()
        nav.add(status_select)

        pipeline_filter = PipelineFilterWdg()
        pipeline_filter.set_search_type('prod/shot')
        nav.add(pipeline_filter)

        scan_status_select = FilterSelectWdg("scan_status_select", label='Scan Status: ')
        scan_status_select.add_empty_option("-- Any Scan Status --")
        scan_status_select.set_option("setting", "shot_scan_status")
        scan_status_value = scan_status_select.get_value()
        nav.add(scan_status_select)

        widget.add(nav)
       
        order = Sequence.get_order()

        search = Search("prod/shot")
        search.add_enum_order_by('sequence_code', order)
        search.add_order_by('code')

        seq_filter.alter_search(search)
        pipeline_filter.alter_search(search)
        if status_value:
            search.add_filter("status", status_value)
        
        if scan_status_value:
            search.add_filter("scan_status",  scan_status_value)

        widget.set_search(search)
        table = TableWdg("prod/shot", "manage")
        widget.add(table)

        return widget
Exemplo n.º 12
0
 def get_task_manager_wdg(self):
     manager = TaskManagerWdg()
     manager.set_search_type("prod/shot")
     manager.set_process_filter_name("shot_process_filter")
     filter = SpanWdg()
     filter.add( SequenceFilterWdg() )
     search_columns = Shot.get_search_columns()
     search_filter = SearchFilterWdg(name="shot_search",columns=search_columns)
     filter.add(search_filter)
     '''
     search_hint = HintWdg('You can enter any of %s of a shot.' % search_columns)  	 	 
     filter.add(search_hint) 
     '''
     manager.set_sobject_filter( filter )
     return manager
Exemplo n.º 13
0
 def get_task_manager_wdg(self):
     manager = TaskManagerWdg()
     manager.set_search_type("prod/shot")
     manager.set_process_filter_name("shot_process_filter")
     filter = SpanWdg()
     filter.add(SequenceFilterWdg())
     search_columns = Shot.get_search_columns()
     search_filter = SearchFilterWdg(name="shot_search",
                                     columns=search_columns)
     filter.add(search_filter)
     '''
     search_hint = HintWdg('You can enter any of %s of a shot.' % search_columns)  	 	 
     filter.add(search_hint) 
     '''
     manager.set_sobject_filter(filter)
     return manager
Exemplo n.º 14
0
    def get_sobject_by_filename(my, filename):
        '''extract the code from the filename'''
        naming = Naming.get_by_search_type('prod/shot_audio')
        if not naming:  
            return None

        shot_code = NamingUtil.extract_sobject_code(naming, filename, 'shot_code')
        # verify the code
        from pyasm.prod.biz import Shot
        shot = Shot.get_by_code(shot_code)
        if not shot:
            return None

        from pyasm.prod.biz import ShotAudio
        audio = ShotAudio.get_by_shot_code(shot_code)
        
        if not audio:
            audio = ShotAudio.create(shot_code)

        return audio
Exemplo n.º 15
0
    def get_sobject_by_filename(my, filename):
        '''extract the code from the filename'''
        naming = Naming.get_by_search_type('prod/shot_audio')
        if not naming:
            return None

        shot_code = NamingUtil.extract_sobject_code(naming, filename,
                                                    'shot_code')
        # verify the code
        from pyasm.prod.biz import Shot
        shot = Shot.get_by_code(shot_code)
        if not shot:
            return None

        from pyasm.prod.biz import ShotAudio
        audio = ShotAudio.get_by_shot_code(shot_code)

        if not audio:
            audio = ShotAudio.create(shot_code)

        return audio