Пример #1
0
    def get_seq_wdg(self):

        widget = Widget()
        help = HelpItemWdg(
            'Sequences tab',
            'The Sequences tab lets you create sequences which can be used to relate to shots. Each shot has a sequence code attribute which you can assign to.'
        )
        widget.add(help)
        div = DivWdg(css='filter_box')
        search_columns = Sequence.get_search_columns()
        search_filter = SearchFilterWdg(name="sequence_search",
                                        columns=search_columns)
        div.add(SpanWdg(search_filter, css='med'))
        search = Search("prod/sequence")
        search_filter.alter_search(search)

        widget.add(div)
        view = 'table'
        if ProdSetting.get_value_by_key(
                'shot_hierarchy') == 'episode_sequence':
            view = 'table_episode'
        table = TableWdg("prod/sequence", view)
        table.set_search(search)
        widget.add(table)

        return widget
Пример #2
0
    def get_display(my):

        # just refresh the whole thing 
        widget = DivWdg()
        
        outer_widget = DivWdg(css='spt_view_panel')
        search_div = DivWdg()
        search_bvr = {
            'type':         'click_up',
            'cbjs_action':  'spt.dg_table.search_cbk(evt, bvr)',
            'override_class_name': 'tactic.ui.cgapp.AppShotPanelWdg',
            'override_target': 'bvr.src_el.getParent(".spt_app_shot_panel")',
            'extra_args': {'instance_search_type': my.instance_search_type,
                        'asset_search_type': my.asset_search_type}
            #'panel_id':     'main_body_search'
            
        }

        # WARNING: this is made just for main search box and  won't be compatible with the simple search wdg
        search_wdg = SearchWdg(search_type=my.search_type, custom_search_view='search_shot_loader', parent_key='', filter=''\
            , display='block', custom_filter_view='', state=None, run_search_bvr=search_bvr)

        #from tactic.ui.app.simple_search_wdg import SimpleSearchWdg
        #search_wdg = SimpleSearchWdg(search_type=my.search_type, search_view=my.simple_search_view, state=None, run_search_bvr=search_bvr)
        search_div.add( HtmlElement.spacer_div(1,10) )
        search_div.add(search_wdg)

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

        # avoid getting a shot when no shot is selected
        if not my.shot_code and len(shots) == 1:
            my.shot_code = shots[0].get_code()
        
        outer_widget.add(search_div)

        my.set_as_panel(outer_widget, class_name='spt_panel spt_view_panel spt_app_shot_panel')
        #show_shot_panel = False
        #if show_shot_panel:
        panel = ViewPanelWdg( search_type=my.search_type, \
                 inline_search=True, show_search='false', show_refresh='false', view=my.view, \
                run_search_bvr=search_bvr, simple_search_view=my.simple_search_view)
        panel.set_sobjects(shots)

        widget.add(panel)
         
        show_instances_in_shot = ProdSetting.get_value_by_key("show_instances_in_shot_panel")
        if show_instances_in_shot != "false":

            widget.add(HtmlElement.h3("Asset Instances in Shot [%s]" %my.shot_code))
            widget.add(HtmlElement.br(2))
            asset_inst_panel = AppAssetInstancePanelWdg(search_type=my.search_type, instance_search_type=my.instance_search_type, asset_search_type=my.asset_search_type, shot_code=my.shot_code, show_search='false')
            widget.add(asset_inst_panel)
        outer_widget.add(widget)
        return outer_widget
Пример #3
0
    def get_reg_hours():
        # FIXME: this shold be in pyasm.biz, not pyasm.prod.biz
        from pyasm.prod.biz import ProdSetting
        reg_hours = ProdSetting.get_value_by_key("reg_hours")
        if not reg_hours:
            # auto create if it does not exist
            ProdSetting.create('reg_hours', '10',  'sequence', \
                description='regular work hours', search_type='sthpw/project')

        return reg_hours
Пример #4
0
    def get_reg_hours():
        # FIXME: this shold be in pyasm.biz, not pyasm.prod.biz
        from pyasm.prod.biz import ProdSetting
        reg_hours = ProdSetting.get_value_by_key("reg_hours")
        if not reg_hours:
            # auto create if it does not exist
            ProdSetting.create('reg_hours', '10',  'sequence', \
                description='regular work hours', search_type='sthpw/project')

        return reg_hours
Пример #5
0
    def get_context_wdg(my, search_type):
        '''drop down which selects which context to checkin'''
        # add a filter
        # use a regular SelectWdg with submit instead of FilterSelectWdg
        filter_div = FloatDivWdg("Context / subcontext:")
        select = SelectWdg("publish_context")
        labels, values = my.get_context_data(search_type, my.process)
        select.set_option("values", "|".join(values))
        select.set_option("labels", "|".join(labels))
        select.append_option('publish','publish')
        select.add_style("font-size: 0.8em")
        select.add_style("margin: 0px 3px")

        # explicitly set the value
        current = select.get_value()
        if current in values:
            context = current
        elif values:
            context = values[0]
        else:
            context = ""
 
        web = WebContainer.get_web()
        web.set_form_value("publish_context", context)

        select.set_value( context )

        # set it to a instance variable
        my.context_select = select

        filter_div.add(select)

        # if specified, add a sub_context
        base_search_type = SearchType(search_type).get_base_key()
        settings = ProdSetting.get_value_by_key("%s/sub_context" % context,\
                base_search_type)
        filter_div.add( "/ ")
        sub_context = None
        if settings:
            sub_context = SelectWdg("publish_sub_context")
            sub_context.set_option("values", settings)
            sub_context.set_submit_onchange()
            sub_context.add_empty_option("<- Select ->")
        else:
            # provide a text field
            sub_context = TextWdg("publish_sub_context")
            sub_context.set_attr('size','10') 
        sub_context.set_persistence()
        filter_div.add( sub_context )
        my.sub_context_select = sub_context
        #filter_div.add_style('padding-right','10px')

        return filter_div
Пример #6
0
    def __init__(my, **kwargs):
        my.frames = kwargs.get("frames")
        my.fps = kwargs.get("fps")
        if not my.fps:
            from pyasm.prod.biz import ProdSetting
            my.fps = ProdSetting.get_value_by_key("fps")
        if not my.fps:
            my.fps = 24

        if not my.frames:
            timecode = kwargs.get("timecode")
            my.frames = my.calculate_frames(timecode, my.fps)
Пример #7
0
    def get_context_wdg(self, search_type):
        '''drop down which selects which context to checkin'''
        # add a filter
        # use a regular SelectWdg with submit instead of FilterSelectWdg
        filter_div = FloatDivWdg("Context / subcontext:")
        select = SelectWdg("publish_context")
        labels, values = self.get_context_data(search_type, self.process)
        select.set_option("values", "|".join(values))
        select.set_option("labels", "|".join(labels))
        select.append_option('publish','publish')
        select.add_style("font-size: 0.8em")
        select.add_style("margin: 0px 3px")

        # explicitly set the value
        current = select.get_value()
        if current in values:
            context = current
        elif values:
            context = values[0]
        else:
            context = ""
 
        web = WebContainer.get_web()
        web.set_form_value("publish_context", context)

        select.set_value( context )

        # set it to a instance variable
        self.context_select = select

        filter_div.add(select)

        # if specified, add a sub_context
        base_search_type = SearchType(search_type).get_base_key()
        settings = ProdSetting.get_value_by_key("%s/sub_context" % context,\
                base_search_type)
        filter_div.add( "/ ")
        sub_context = None
        if settings:
            sub_context = SelectWdg("publish_sub_context")
            sub_context.set_option("values", settings)
            sub_context.set_submit_onchange()
            sub_context.add_empty_option("<- Select ->")
        else:
            # provide a text field
            sub_context = TextWdg("publish_sub_context")
            sub_context.set_attr('size','10') 
        sub_context.set_persistence()
        filter_div.add( sub_context )
        self.sub_context_select = sub_context
        #filter_div.add_style('padding-right','10px')

        return filter_div
Пример #8
0
    def convert_to_time(self, frames):
        fps = ProdSetting.get_value_by_key("fps")
        if not fps:
            fps = 24
        else:
            fps = int(fps)

        minutes = frames / (60*fps)
	frames = frames - (minutes*60*fps)
        seconds = frames / fps
        extra = frames % fps

        time = "%0.2dm:%0.2ds.%0.2d" % (minutes, seconds, extra)
        return time
Пример #9
0
    def convert_to_time(my, frames):
        fps = ProdSetting.get_value_by_key("fps")
        if not fps:
            fps = 24
        else:
            fps = int(fps)

        minutes = frames / (60 * fps)
        frames = frames - (minutes * 60 * fps)
        seconds = frames / fps
        extra = frames % fps

        time = "%0.2dm:%0.2ds.%0.2d" % (minutes, seconds, extra)
        return time
Пример #10
0
    def get_web_file_size(my):
        from pyasm.prod.biz import ProdSetting
        web_file_size = ProdSetting.get_value_by_key('web_file_size')
        thumb_size = (640, 480)
        if web_file_size:
            parts = re.split('[\Wx]+', web_file_size)

            thumb_size = (640, 480)
            if len(parts) == 2:
                try:
                    thumb_size = (int(parts[0]), int(parts[1]))
                except ValueError:
                    thumb_size = (640, 480)

        return thumb_size
Пример #11
0
    def get_web_file_size(my):
        from pyasm.prod.biz import ProdSetting
        web_file_size = ProdSetting.get_value_by_key('web_file_size')
        thumb_size = (640, 480)
        if web_file_size:
            parts = re.split('[\Wx]+', web_file_size)
            
            thumb_size = (640, 480)
            if len(parts) == 2:
                try:
                    thumb_size = (int(parts[0]), int(parts[1]))
                except ValueError:
                    thumb_size = (640, 480)

        return thumb_size
Пример #12
0
 def handle_tab(self, tab):
     tab.add(self.get_shot_list_wdg, _("Shot List") )
     tab.add(self.get_summary_wdg, _("Summary") )
     tab.add(self.get_milestone_wdg, _("Milestones") )
     tab.add(MultiPlannerWdg, _("Planners") )
     tab.add(self.get_task_manager_wdg, _("Tasks") )
     #tab.add(ShotParentWdg, "Shot Parenting") )
     tab.add(self.get_artist_wdg, _("Artist (Shots)") )
     tab.add(self.get_supe_wdg, _("Supe (Shots)") )
     tab.add(self.get_layer_wdg, _("Layers") )
     tab.add(self.get_comp_wdg, _("Composites") )
     tab.add(self.get_render_log_wdg, _("Render Log") )
     tab.add(self.get_seq_wdg, _("Sequences") )
     if ProdSetting.get_value_by_key('shot_hierarchy') == 'episode_sequence':
         tab.add(self.get_episode_wdg, _("Episodes") )
     tab.add(self.get_notes_wdg, _("Notes") )
Пример #13
0
 def handle_tab(self, tab):
     tab.add(self.get_shot_list_wdg, _("Shot List"))
     tab.add(self.get_summary_wdg, _("Summary"))
     tab.add(self.get_milestone_wdg, _("Milestones"))
     tab.add(MultiPlannerWdg, _("Planners"))
     tab.add(self.get_task_manager_wdg, _("Tasks"))
     #tab.add(ShotParentWdg, "Shot Parenting") )
     tab.add(self.get_artist_wdg, _("Artist (Shots)"))
     tab.add(self.get_supe_wdg, _("Supe (Shots)"))
     tab.add(self.get_layer_wdg, _("Layers"))
     tab.add(self.get_comp_wdg, _("Composites"))
     tab.add(self.get_render_log_wdg, _("Render Log"))
     tab.add(self.get_seq_wdg, _("Sequences"))
     if ProdSetting.get_value_by_key(
             'shot_hierarchy') == 'episode_sequence':
         tab.add(self.get_episode_wdg, _("Episodes"))
     tab.add(self.get_notes_wdg, _("Notes"))
Пример #14
0
    def __init__(my, **kwargs):
        my.frames = kwargs.get("frames")
        my.frames = float(my.frames)

        my.fps = kwargs.get("fps")
        if not my.fps:
            from pyasm.prod.biz import ProdSetting
            my.fps = ProdSetting.get_value_by_key("fps")
            my.fps = int(my.fps)
        if not my.fps:
            my.fps = 24

        if not my.frames:
            timecode = kwargs.get("timecode")
            my.frames = my.calculate_frames(timecode, my.fps)

        # handle cases where frames has a decimal: ie: 400.4
        my.frames = int(float(my.frames))
Пример #15
0
    def __init__(self, **kwargs):
        self.frames = kwargs.get("frames")
        self.frames = float(self.frames)

        self.fps = kwargs.get("fps")
        if not self.fps:
            from pyasm.prod.biz import ProdSetting
            self.fps = ProdSetting.get_value_by_key("fps")
            self.fps = int(self.fps)
        if not self.fps:
            self.fps = 24

        if not self.frames:
            timecode = kwargs.get("timecode")
            self.frames = self.calculate_frames(timecode, self.fps)

        # handle cases where frames has a decimal: ie: 400.4
        self.frames = int(float(self.frames))
Пример #16
0
    def __init__(my, **kwargs):
        my.frames = kwargs.get("frames")
        my.frames = float(my.frames)

        my.fps = kwargs.get("fps")
        if not my.fps:
            from pyasm.prod.biz import ProdSetting
            my.fps = ProdSetting.get_value_by_key("fps")
            my.fps = int(my.fps)
        if not my.fps:
            my.fps = 24

        if not my.frames:
            timecode = kwargs.get("timecode")
            my.frames = my.calculate_frames(timecode, my.fps)

        # handle cases where frames has a decimal: ie: 400.4
        my.frames = int(float(my.frames))
Пример #17
0
def show_platform_connection():
    """
    A short convenience function to check Tactic's Project Settings for a value called
    show_platform_connection_on_hot_today, which tells the hot list whether or not to display Client-Platform
    connections as part of Edel's tasks.

    show_platform_connection_on_hot_today should be a string value set to either 'True' or 'False' (sadly Tactic
    does not support Boolean values for ProdSettings)

    :return: Boolean
    """

    # Cast the value to str, just in case it returns None
    show_platform_connection_string = str(ProdSetting.get_value_by_key('show_platform_connection_on_hot_today'))

    if show_platform_connection_string.lower() == 'true':
        return True
    else:
        return False
Пример #18
0
    def get_sobject_base(my, dirs):
        # add <project_code>/<table>
        search_type_obj = my.sobject.get_search_type_obj()


        project_code = my.sobject.get_project().get_code()
        dirs.append( project_code )
        #db_name = search_type_obj.get_database()
        #dirs.append( db_name )

        from pyasm.prod.biz import ProdSetting
        if project_code not in ["admin", 'sthpw']:
            icon_separation = ProdSetting.get_value_by_key("use_icon_separation")           
            if not icon_separation:
                # put in a default
                icon_separation = "false"
                ProdSetting.create('use_icon_separation', icon_separation, 'string',\
                    description='Determines whether icons are in complete separate directories')
               
            if icon_separation == 'true':
                if my.snapshot and my.snapshot.get_value("context") == "icon":
                    dirs.append("icon")
                elif my.get_file_type() == "icon":
                    dirs.append("icon")


        #process = my.snapshot.get_value("process")
        #search_type = my.snapshot.get_value("search_type")

        # add a concept of branching
        #    from pyasm.web import WidgetSettings
        #    branch = WidgetSettings.get_value_by_key("current_branch")
        #    #WidgetSettings.set_value_by_key("current_branch", branch)
        #    if branch:
        #        #dirs.append( "perforce" )
        #        dirs.append( branch )

        table = search_type_obj.get_table()
        dirs.append( table )

        return dirs
Пример #19
0
    def get_sobject_base(my, dirs):
        # add <project_code>/<table>
        search_type_obj = my.sobject.get_search_type_obj()


        project_code = my.sobject.get_project().get_code()
        dirs.append( project_code )
        #db_name = search_type_obj.get_database()
        #dirs.append( db_name )

        from pyasm.prod.biz import ProdSetting
        if project_code not in ["admin", 'sthpw']:
            icon_separation = ProdSetting.get_value_by_key("use_icon_separation")           
            if not icon_separation:
                # put in a default
                icon_separation = "false"
                ProdSetting.create('use_icon_separation', icon_separation, 'string',\
                    description='Determines whether icons are in complete separate directories')
               
            if icon_separation == 'true':
                if my.snapshot and my.snapshot.get_value("context") == "icon":
                    dirs.append("icon")
                elif my.get_file_type() == "icon":
                    dirs.append("icon")


        #process = my.snapshot.get_value("process")
        #search_type = my.snapshot.get_value("search_type")

        # add a concept of branching
        #    from pyasm.web import WidgetSettings
        #    branch = WidgetSettings.get_value_by_key("current_branch")
        #    #WidgetSettings.set_value_by_key("current_branch", branch)
        #    if branch:
        #        #dirs.append( "perforce" )
        #        dirs.append( branch )

        table = search_type_obj.get_table()
        dirs.append( table )

        return dirs
Пример #20
0
 def get_display(my):   
     from pyasm.prod.biz import ProdSetting
     my.code = str(my.kwargs.get('code'))
     my.sk = str(my.kwargs.get('sk'))
     my.movement_code = str(my.kwargs.get('movement_code'))
     my.source_contexts = ProdSetting.get_value_by_key('source_contexts').split('|')
     ms = MovementScripts(movement_code=my.movement_code)
     table = Table()
     table.add_attr('class','movement_twog_easy_checkin')
     table.add_attr('width','100%s' % '%')
     table.add_row()
     title_bar = table.add_cell('<b><u>Checkin New File</u></b>')
     title_bar.add_attr('align','center')
     title_bar.add_attr('colspan','4')
     title_bar.add_style('font-size: 110%ss' % '%')
     processes_sel = SelectWdg('source_process_select')
     for ctx in my.source_contexts:
         processes_sel.append_option(ctx,ctx)
     table.add_row()
     mini0 = Table()
     mini0.add_row()
     mini0.add_cell('Checkin Context: ')
     mini0.add_cell(processes_sel)
     table.add_cell(mini0)
     mini1 = Table()
     mini1.add_row()
     file_holder = mini1.add_cell(' ')
     file_holder.add_attr('width','100%s' % '%')
     file_holder.add_attr('align','center')
     file_holder.add_attr('class','file_holder')
     button = mini1.add_cell('<input type="button" value="Browse"/>')
     button.add_attr('align','right')
     button.add_style('cursor: pointer;')
     button.add_behavior(ms.get_easy_checkin_browse_behavior())
     big_button = mini1.add_cell('<input type="button" value="Check In" class="easy_checkin_commit" disabled/>')
     big_button.add_style('cursor: pointer;')
     big_button.add_behavior(ms.get_easy_checkin_commit_behavior(my.sk))
     table.add_cell(mini1)
     return table
Пример #21
0
    def get_seq_wdg(self):
        
        
        widget = Widget()
        help = HelpItemWdg('Sequences tab', 'The Sequences tab lets you create sequences which can be used to relate to shots. Each shot has a sequence code attribute which you can assign to.')
        widget.add(help)
        div = DivWdg(css='filter_box')
        search_columns = Sequence.get_search_columns()
        search_filter = SearchFilterWdg(name="sequence_search", columns=search_columns) 
        div.add(SpanWdg(search_filter, css='med'))
        search = Search("prod/sequence")
        search_filter.alter_search(search)

        
        widget.add(div)
        view = 'table'
        if ProdSetting.get_value_by_key('shot_hierarchy') == 'episode_sequence':
            view ='table_episode'
        table = TableWdg("prod/sequence", view)
        table.set_search(search)
        widget.add(table)

        return widget
Пример #22
0
    def _get_display(self):
        login = WebContainer.get_login()
        login_name = login.get_login()

        web = WebContainer.get_web()
        context = web.get_site_context_url()

        div = HtmlElement.div()
        div.set_style("top: 0px; margin: 1.6em 0 2em 0; height: 4em")

        project = Project.get()
        if not self.title:
            self.title = project.get_value('title')

        title_data = HtmlElement.h4(self.title)

        link_width = '400'
        if web.get_app_name() != 'Browser':
            link_width = '240'
            title_data.add_class('app')

        control = DivWdg()
        control.set_style(
            "position: absolute; float: right; top: 1px; right: 2px")

        help_menu = HelpMenuWdg()
        control.add(FloatDivWdg(help_menu, width=30))

        div.add(help_menu.get_panel())

        span = SpanWdg('[%s]' % project.get_code(), css='med hand')
        span.add_style("float: left")
        script = "Common.follow_click(event, '%s', 10, 0); set_display_on('%s');"\
                "Common.overlay_setup('mouseup',function(){%s})"\
            %(ProjectSwitchWdg.WDG_ID, ProjectSwitchWdg.WDG_ID, \
             ProjectSwitchWdg.get_off_script())
        span.add_event('onclick', script)
        control.add(span)
        div.add(ProjectSwitchWdg())

        root = web.get_site_root()

        #span = SpanWdg(HtmlElement.href(ref='/%s' % root, data='[home]'), css='med')
        #span.add_style("float: left")
        #control.add(span)

        span = SpanWdg(HtmlElement.href(ref='/doc/',
                                        data='[docs]',
                                        target='_blank'),
                       css='med')
        span.add_style("float: left")
        control.add(span)

        from pyasm.prod.biz import ProdSetting
        project_docs = ProdSetting.get_value_by_key("project_docs_url")
        if project_docs:
            project_code = Project.get_project_code()
            span = SpanWdg(HtmlElement.href(ref=project_docs,
                                            data='[%s-docs]' % project_code,
                                            target='_blank'),
                           css='med')
            span.add_style("float: left")
            control.add(span)

        app_name = web.get_app_name()
        if app_name != 'Browser':
            span = SpanWdg(HtmlElement.href(ref='%s/%s'\
                %(context.to_string(), app_name), data='[app]'), css='med')
            span.add_style("float: left")

            control.add(span)

        import urllib
        params = web.request.params
        edited_params = {}
        for name, value in params.items():
            if name in ['marshalled', 'password', 'login']:
                continue
            if type(value) == types.ListType:
                if len(value) == 1:
                    value = value[0]

            if isinstance(value, cgi.FieldStorage):
                continue

            if not value:
                continue
            edited_params[name] = value

        query_string = urllib.urlencode(edited_params, doseq=True)
        site_url = web.get_site_context_url().to_string()
        url = "%s?%s" % (site_url, query_string)

        span = SpanWdg()
        span.add_style("float: left")
        link = HtmlElement.href(ref=url, data='[link]')
        span.add(link)
        control.add(span)

        span = SpanWdg("user: "******"float: right")
        clipboard_div.add(clipboard)
        div.add(clipboard_div)

        skin = WebContainer.get_web().get_skin()
        if skin == "classic":
            title_div = DivWdg()

            title_div.add_style('width', '800px')

            link = HtmlElement.href(data=title_data,
                                    ref='%s/' % context.to_string())
            link_div = FloatDivWdg(link, width=link_width, css='left_content')
            title_div.add(link_div)

            if not web.is_IE():
                trail_div = self.get_trail()
                title_div.add(trail_div)
            title_div.add(HtmlElement.br())
            div.add(title_div)

        else:
            self.add_logo(div, skin)

        return div
Пример #23
0
        # data structure to store my.info
        my.info = {}
        # get the file objects if they have not already been cached
        if not my.file_objects:
            file_objects = {}
            snapshot_file_objects = File.get_by_snapshot(snapshot)
            
            for file_object in snapshot_file_objects:
                file_objects[file_object.get_code()] = file_object
        else:
            file_objects = my.file_objects

        protocol = my.get_option("protocol")
        if not protocol:
            from pyasm.prod.biz import ProdSetting
            protocol = ProdSetting.get_value_by_key('thumbnail_protocol')

        # go through the nodes and try to find appropriate paths
        my.info = ThumbWdg.get_file_info(xml, file_objects, sobject, snapshot, my.show_versionless, protocol=protocol) 
        # find the link that will be used when clicking on the icon
        link_path = ThumbWdg.get_link_path(my.info, image_link_order=my.image_link_order)

        if link_path == None:
            
            # check for ref snapshot
            snapshots = snapshot.get_all_ref_snapshots()
            snapshot_file_objects = []
            if snapshots:
                snapshot = snapshots[0]
                # change the sobject value here also, affects the Thumb id below
                sobject = snapshot.get_sobject()
Пример #24
0
    def _process_image(my, file_name):

        base, ext = os.path.splitext(file_name)

        # get all of the extensions
        exts = File.get_extensions(file_name)
        frame = 0
        if len(exts) == 2:
            try:
                frame = int(exts[0])
                base = base.replace(".%s" % exts[0], '' )
            except ValueError:
                frame = 0

        if frame:
            icon_file_name = "%s_icon.%s.png" % (base, exts[0])
            web_file_name = "%s_web.%s.jpg" % (base, exts[0])
        else:
            icon_file_name = "%s_icon.png" % base
            web_file_name = "%s_web.jpg" % base

        tmp_icon_path = "%s/%s" % (my.tmp_dir, icon_file_name)

        tmp_web_path = "%s/%s" % (my.tmp_dir, web_file_name)

        # create the web image
        try:
            if my.texture_mode:
                my._resize_texture(my.file_path, tmp_web_path, 0.5)
                my.web_path = tmp_web_path

                # create the icon
                thumb_size = (120,100)
                my._resize_image(tmp_web_path, tmp_icon_path, thumb_size)

                my.icon_path = tmp_icon_path
            elif my.icon_mode: # just icon, no web
                # create the icon only
                thumb_size = (120,100)
                my._resize_image(my.file_path, tmp_icon_path, thumb_size)
                my.icon_path = tmp_icon_path


            else:
                from pyasm.prod.biz import ProdSetting
                web_file_size = ProdSetting.get_value_by_key('web_file_size')
                thumb_size = (640, 480)
                if web_file_size:
                    parts = re.split('[\Wx]+', web_file_size)
                    
                    thumb_size = (640, 480)
                    if len(parts) == 2:
                        try:
                            thumb_size = (int(parts[0]), int(parts[1]))
                        except ValueError:
                            thumb_size = (640, 480)
                
                my._resize_image(my.file_path, tmp_web_path, thumb_size)

                my.web_path = tmp_web_path

                # create the icon
                thumb_size = (120,100)
                my._resize_image(tmp_web_path, tmp_icon_path, thumb_size)

                my.icon_path = tmp_icon_path

            # check icon file size, reset to none if it is empty
            # TODO: use finally in Python 2.5
            if my.web_path:
                web_path_size = os.stat(my.web_path)[stat.ST_SIZE]
                if not web_path_size:
                    my.web_path = None
            if my.icon_path:
                icon_path_size = os.stat(my.icon_path)[stat.ST_SIZE]
                if not icon_path_size:
                    my.icon_path = None
        except IOError, e:
            Environment.add_warning("Could not process file", \
                "%s - %s" % (my.file_path, e.__str__()))
            my.web_path = None
            my.icon_path = None
Пример #25
0
    def get_display(self):

        # just refresh the whole thing
        widget = DivWdg()

        outer_widget = DivWdg(css='spt_view_panel')
        search_div = DivWdg()
        search_bvr = {
            'type': 'click_up',
            'cbjs_action': 'spt.dg_table.search_cbk(evt, bvr)',
            'override_class_name': 'tactic.ui.cgapp.AppShotPanelWdg',
            'override_target': 'bvr.src_el.getParent(".spt_app_shot_panel")',
            'extra_args': {
                'instance_search_type': self.instance_search_type,
                'asset_search_type': self.asset_search_type
            }
            #'panel_id':     'main_body_search'
        }

        # WARNING: this is made just for main search box and  won't be compatible with the simple search wdg
        search_wdg = SearchWdg(search_type=self.search_type, custom_search_view='search_shot_loader', parent_key='', filter=''\
            , display='block', custom_filter_view='', state=None, run_search_bvr=search_bvr)

        #from tactic.ui.app.simple_search_wdg import SimpleSearchWdg
        #search_wdg = SimpleSearchWdg(search_type=self.search_type, search_view=self.simple_search_view, state=None, run_search_bvr=search_bvr)
        search_div.add(HtmlElement.spacer_div(1, 10))
        search_div.add(search_wdg)

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

        # avoid getting a shot when no shot is selected
        if not self.shot_code and len(shots) == 1:
            self.shot_code = shots[0].get_code()

        outer_widget.add(search_div)

        self.set_as_panel(
            outer_widget,
            class_name='spt_panel spt_view_panel spt_app_shot_panel')
        #show_shot_panel = False
        #if show_shot_panel:
        panel = ViewPanelWdg( search_type=self.search_type, \
                 inline_search=True, show_search='false', show_refresh='false', view=self.view, \
                run_search_bvr=search_bvr, simple_search_view=self.simple_search_view)
        panel.set_sobjects(shots)

        widget.add(panel)

        show_instances_in_shot = ProdSetting.get_value_by_key(
            "show_instances_in_shot_panel")
        if show_instances_in_shot != "false":

            widget.add(
                HtmlElement.h3("Asset Instances in Shot [%s]" %
                               self.shot_code))
            widget.add(HtmlElement.br(2))
            asset_inst_panel = AppAssetInstancePanelWdg(
                search_type=self.search_type,
                instance_search_type=self.instance_search_type,
                asset_search_type=self.asset_search_type,
                shot_code=self.shot_code,
                show_search='false')
            widget.add(asset_inst_panel)
        outer_widget.add(widget)
        return outer_widget
Пример #26
0
    def _get_display(my):
        login = WebContainer.get_login()
        login_name = login.get_login()

        web = WebContainer.get_web()
        context = web.get_site_context_url()
 
        div = HtmlElement.div()
        div.set_style("top: 0px; margin: 1.6em 0 2em 0; height: 4em")
        
        
        project = Project.get()
        if not my.title:
            my.title = project.get_value('title')

        title_data = HtmlElement.h4(my.title)
        
        link_width = '400'
        if web.get_app_name() != 'Browser':
            link_width = '240'
            title_data.add_class('app')



        control = DivWdg()
        control.set_style("position: absolute; float: right; top: 1px; right: 2px")

        help_menu = HelpMenuWdg()
        control.add(FloatDivWdg(help_menu, width=30))

        div.add(help_menu.get_panel())
        
        
        span = SpanWdg('[%s]' %project.get_code(), css='med hand')
        span.add_style("float: left")
        script = "Common.follow_click(event, '%s', 10, 0); set_display_on('%s');"\
                "Common.overlay_setup('mouseup',function(){%s})"\
            %(ProjectSwitchWdg.WDG_ID, ProjectSwitchWdg.WDG_ID, \
             ProjectSwitchWdg.get_off_script())
        span.add_event('onclick', script)
        control.add(span)
        div.add(ProjectSwitchWdg())
        
        root = web.get_site_root()
        
        #span = SpanWdg(HtmlElement.href(ref='/%s' % root, data='[home]'), css='med')
        #span.add_style("float: left")
        #control.add(span)

        span = SpanWdg(HtmlElement.href(ref='/doc/', data='[docs]', target='_blank'), css='med')
        span.add_style("float: left")
        control.add(span)


        from pyasm.prod.biz import ProdSetting
        project_docs = ProdSetting.get_value_by_key("project_docs_url")
        if project_docs:
            project_code = Project.get_project_code()
            span = SpanWdg(HtmlElement.href(ref=project_docs, data='[%s-docs]' % project_code, target='_blank'), css='med')
            span.add_style("float: left")
            control.add(span)

        app_name = web.get_app_name()
        if app_name != 'Browser':
            span = SpanWdg(HtmlElement.href(ref='%s/%s'\
                %(context.to_string(), app_name), data='[app]'), css='med')
            span.add_style("float: left")
        
            control.add(span)



        import urllib
        params = web.request.params
        edited_params = {}
        for name, value in params.items():
            if name in ['marshalled', 'password', 'login']:
                continue
            if type(value) == types.ListType:
                if len(value) == 1:
                    value = value[0]

            if isinstance(value, cgi.FieldStorage):
                continue

            if not value:
                continue
            edited_params[name] = value
                
        query_string = urllib.urlencode(edited_params, doseq=True)
        site_url = web.get_site_context_url().to_string()
        url = "%s?%s" % (site_url, query_string)

        span = SpanWdg()
        span.add_style("float: left")
        link = HtmlElement.href(ref=url, data='[link]')
        span.add(link)
        control.add(span)




        span = SpanWdg("user: "******"float: right")
        clipboard_div.add(clipboard)
        div.add(clipboard_div)

        skin = WebContainer.get_web().get_skin()
        if skin == "classic":
            title_div = DivWdg()
            
            title_div.add_style('width', '800px')

            link = HtmlElement.href(data=title_data, ref='%s/' %context.to_string())
            link_div = FloatDivWdg(link, width=link_width, css='left_content')
            title_div.add(link_div)

            if not web.is_IE():
                trail_div = my.get_trail()
                title_div.add(trail_div)
            title_div.add(HtmlElement.br())
            div.add(title_div)


        else:
            my.add_logo(div, skin) 


        return div
Пример #27
0
    def add_default_ending(my, parts, auto_version=True, is_sequence=True):

        context = my.snapshot.get_value("context")
        filename = my.file_object.get_full_file_name()

        # make sure that the version in the file name does not yet exist
        version = my.get_version_from_file_name(filename)
        if not auto_version and version:

            # if the file version is not the same as the snapshot version
            # then check to see if the snapshot already exists
            if version != my.snapshot.get_value("version"):
                existing_snap = Snapshot.get_by_version(my.snapshot.get_value("search_type"),\
                    my.snapshot.get_value("search_id"), context, version)
                if existing_snap:
                    raise TacticException('A snapshot with context "%s" and version "%s" already exists.' % (context, version) )


            my.snapshot.set_value("version", version)
            my.snapshot.commit()
        else:
            version = my.snapshot.get_value("version")


        if version == 0:
            version = "CURRENT"
        elif version == -1:
            version = "LATEST"
        else:

            if version == "":
                version = 1


            # pad the version by by the global setting
            padding = Config.get_value("checkin", "version_padding")
            if not padding:
                padding = 3
            else:
                padding = int(padding)
            expr = "v%%0.%sd" % padding
            version = expr % version

        revision = my.snapshot.get_value("revision", no_exception=True)
        if revision:
            revision = "r%0.2d" % revision

        ext = my.get_ext()

        # by default publish is not put into the file name
        if context != "publish":
            parts.append(context.replace("/", "_"))


        # add the server location
        #value = ProdSetting.get_value_by_key("naming/add_server")
        server = Config.get_value("install", "server")
        if server:
            parts.append(server)


        if my.is_tactic_repo():
            parts.append(version)
            if revision:
                parts.append(revision)

        from pyasm.prod.biz import ProdSetting
        value = ProdSetting.get_value_by_key("naming/add_initials")
        if value == "false":
            project = Project.get()
            initials = Project.get().get_initials()
            parts.append(initials)

        filename = "_".join(parts)
        if is_sequence:
            filename = "%s.####.%s" % (filename, ext)
        elif ext: # dir don't need extension
            filename = "%s%s" % (filename, ext)

        return filename
Пример #28
0
        img.add_class("spt_image")

        # TODO: make this a preference
        img.add_style("background: #ccc")

        if type(icon_size) == types.StringType and icon_size.endswith("%"):
	    img.add_style("%s: 100%%" % my.aspect)
        else:
	    img.add_style("%s: %spx" % (my.aspect, icon_size) )


        detail = my.get_option("detail")
        protocol = my.get_option("protocol")
        if not protocol:
            from pyasm.prod.biz import ProdSetting
            protocol = ProdSetting.get_value_by_key('thumbnail_protocol')

        if detail == "false":
            if my.has_img_link:

                if protocol =='file':
                    dir_naming = DirNaming()
                    client_base_dir = dir_naming.get_base_dir('client_repo')
                    web_base_dir = Config.get_value("checkin", "web_base_dir")

                    link_path = re.sub('^%s'%web_base_dir,'', link_path)
                    link_path = '%s%s' %(client_base_dir[0], link_path)
                    href = DivWdg(img)
                    href.add_attr('title', 'Click to open via file system')
                    href.add_behavior({'type':'click' ,
                        'cbjs_action': "spt.Applet.get().open_explorer('%s')" %link_path})
Пример #29
0
    def add_default_ending(my, parts, auto_version=True, is_sequence=True):

        context = my.snapshot.get_value("context")
        filename = my.file_object.get_full_file_name()

        # make sure that the version in the file name does not yet exist
        version = my.get_version_from_file_name(filename)
        if not auto_version and version:

            # if the file version is not the same as the snapshot version
            # then check to see if the snapshot already exists
            if version != my.snapshot.get_value("version"):
                existing_snap = Snapshot.get_by_version(my.snapshot.get_value("search_type"),\
                    my.snapshot.get_value("search_id"), context, version)
                if existing_snap:
                    raise TacticException(
                        'A snapshot with context "%s" and version "%s" already exists.'
                        % (context, version))

            my.snapshot.set_value("version", version)
            my.snapshot.commit()
        else:
            version = my.snapshot.get_value("version")

        if version == 0:
            version = "CURRENT"
        elif version == -1:
            version = "LATEST"
        else:

            if version == "":
                version = 1

            # pad the version by by the global setting
            padding = Config.get_value("checkin", "version_padding")
            if not padding:
                padding = 3
            else:
                padding = int(padding)
            expr = "v%%0.%sd" % padding
            version = expr % version

        revision = my.snapshot.get_value("revision", no_exception=True)
        if revision:
            revision = "r%0.2d" % revision

        ext = my.get_ext()

        # by default publish is not put into the file name
        if context != "publish":
            parts.append(context.replace("/", "_"))

        # add the server location
        #value = ProdSetting.get_value_by_key("naming/add_server")
        server = Config.get_value("install", "server")
        if server:
            parts.append(server)

        if my.is_tactic_repo():
            parts.append(version)
            if revision:
                parts.append(revision)

        from pyasm.prod.biz import ProdSetting
        value = ProdSetting.get_value_by_key("naming/add_initials")
        if value == "false":
            project = Project.get()
            initials = Project.get().get_initials()
            parts.append(initials)

        filename = "_".join(parts)
        if is_sequence:
            filename = "%s.####.%s" % (filename, ext)
        elif ext:  # dir don't need extension
            filename = "%s%s" % (filename, ext)

        return filename
Пример #30
0
 def get_custom_setting(my, key):
     from pyasm.biz import ProdSetting
     value = ProdSetting.get_value_by_key(key)
     return value
Пример #31
0
 def get_custom_setting(my, key):
     from pyasm.biz import ProdSetting
     value = ProdSetting.get_value_by_key(key)
     return value