def get_display(self):
        div_wdg = DivWdg()

        current_code_div = DivWdg()
        component_code = self.file_flow_sobject.get('component_code')

        component_sobject = get_sobject_by_code('twog/component',
                                                component_code)
        current_code_div.add('Current Component set to {0} ({1})'.format(
            component_sobject.get('name'), component_code))

        order_sobject = get_order_sobject_from_component_sobject(
            component_sobject)
        component_sobjects_for_order = get_component_sobjects_from_order_code(
            order_sobject.get_code())

        component_select_wdg = SelectWdg()
        component_select_wdg.set_id('component_select')
        component_select_wdg.add_style('width: 165px;')
        component_select_wdg.add_empty_option()

        for component in component_sobjects_for_order:
            component_select_wdg.append_option(component.get('name'),
                                               component.get_code())

        div_wdg.add(current_code_div)
        div_wdg.add(component_select_wdg)

        return div_wdg
Пример #2
0
    def get_file_type_wdg(my):
        '''drop down which selects which file type to export to'''
        # add a filter
        div = DivWdg()

        filter_div = FloatDivWdg(HtmlElement.b("File Type:"), width="15em")
        div.add(filter_div)

        select = SelectWdg()
        select.set_name("file_type")
        select.set_id("file_type")

        app = WebContainer.get_web().get_selected_app()

        if app == 'Maya':
            select.set_option("values", "mayaAscii|mayaBinary|obj|collada")
            select.set_option("labels", "Maya Ascii (.ma)|Maya Binary (.mb)|Wavefront .obj|Collada (.dae)")
        elif app == 'Houdini':
            select.set_option("values", "otl")
            select.set_option("labels", "Houdini Digital Asset(.otl)")
        elif app == 'XSI':
            select.set_option("values", "emdl|dotXSI|obj")
            select.set_option("labels", "3D Model (.emdl)|SoftImage dotXSI (.xsi)|Wavefront .obj")
        else:
            select.set_option("values", "mayaAscii|mayaBinary|obj|collada")
            select.set_option("labels", "Maya Ascii (.ma)|Maya Binary (.mb)|Wavefront .obj|Collada (.dae)")

        select.add_style("font-size: 0.8em")
        select.add_style("margin-top: 5px")
        select.add_style("margin-right: 10px")
        select.set_persistence()
        
        div.add(select)
        return div
Пример #3
0
    def get_language_select_wdg(self, name, width=100):
        """
        Get a select widget that chooses from the languages saved in the database.

        :param name: String, set as the name and ID for the select widget. Should correspond to a column on the MetaData
                     sobject
        :param width: int, the desired width of the widget in pixels
        :return: SelectWdg
        """
        select_wdg = SelectWdg(name)
        select_wdg.set_id(name)
        select_wdg.add_style('width', '{0}px'.format(width))
        select_wdg.add_empty_option()

        language_search = Search('twog/language')
        languages = language_search.get_sobjects()

        for language in languages:
            select_wdg.append_option(language.get_value('name'),
                                     language.get_code())

        if hasattr(self, name):
            select_wdg.set_value(getattr(self, name))

        return select_wdg
Пример #4
0
def get_task_status_select_wdg(task_sobject):
    """
    Given a sthpw/task sobject, return a SelectWdg with all its potential status options. This is done by looking up
    what those options are through the parent Pipeline.

    :param task_sobject: sthpw/task sobject
    :return: SelectWdg
    """

    task_status_select = SelectWdg('task_status_select')
    task_status_select.set_id('task_status_select')
    task_status_select.add_style('width: 165px;')
    task_status_select.add_empty_option()

    task_pipe_code = task_sobject.get_value('pipeline_code')

    # if the current task has no pipeline, then search for
    # any task pipeline
    if not task_pipe_code:
        # just use the default
        task_pipe_code = 'task'

    pipeline = Pipeline.get_by_code(task_pipe_code)
    if not pipeline:
        pipeline = Pipeline.get_by_code('task')

    for status in pipeline.get_process_names():
        task_status_select.append_option(status, status)

    if task_sobject.get('status'):
        task_status_select.set_value(task_sobject.get('status'))

    return task_status_select
Пример #5
0
def get_task_status_select_wdg(task_sobject):
    """
    Given a sthpw/task sobject, return a SelectWdg with all its potential status options. This is done by looking up
    what those options are through the parent Pipeline.

    :param task_sobject: sthpw/task sobject
    :return: SelectWdg
    """

    task_status_select = SelectWdg('task_status_select')
    task_status_select.set_id('task_status_select')
    task_status_select.add_style('width: 165px;')
    task_status_select.add_empty_option()

    task_pipe_code = task_sobject.get_value('pipeline_code')

    # if the current task has no pipeline, then search for
    # any task pipeline
    if not task_pipe_code:
        # just use the default
        task_pipe_code = 'task'

    pipeline = Pipeline.get_by_code(task_pipe_code)
    if not pipeline:
        pipeline = Pipeline.get_by_code('task')

    for status in pipeline.get_process_names():
        task_status_select.append_option(status, status)

    if task_sobject.get('status'):
        task_status_select.set_value(task_sobject.get('status'))

    return task_status_select
    def get_display(self):
        div_wdg = DivWdg()

        current_code_div = DivWdg()
        component_code = self.file_flow_sobject.get('component_code')

        component_sobject = get_sobject_by_code('twog/component', component_code)
        current_code_div.add('Current Component set to {0} ({1})'.format(component_sobject.get('name'),
                                                                         component_code))

        order_sobject = get_order_sobject_from_component_sobject(component_sobject)
        component_sobjects_for_order = get_component_sobjects_from_order_code(order_sobject.get_code())

        component_select_wdg = SelectWdg()
        component_select_wdg.set_id('component_select')
        component_select_wdg.add_style('width: 165px;')
        component_select_wdg.add_empty_option()

        for component in component_sobjects_for_order:
            component_select_wdg.append_option(component.get('name'), component.get_code())

        div_wdg.add(current_code_div)
        div_wdg.add(component_select_wdg)

        return div_wdg
Пример #7
0
    def get_frame_rate_section(self):
        section_span = SpanWdg()

        section_span.add('Frame Rate: ')

        frame_rate_select = SelectWdg('frame_rate_select')
        frame_rate_select.set_id('frame_rate_code')
        frame_rate_select.add_style('width', '153px')
        frame_rate_select.add_style('display', 'inline-block')
        frame_rate_select.add_empty_option()

        frame_rate_search = Search('twog/frame_rate')
        frame_rates = frame_rate_search.get_sobjects()

        for frame_rate in frame_rates:
            frame_rate_select.append_option(frame_rate.get_value('name'), frame_rate.get_code())

        try:
            frame_rate_select.set_value(self.frame_rate_code)
        except AttributeError:
            pass

        section_span.add(frame_rate_select)

        return section_span
def get_file_in_package_status_select():
    task_status_select = SelectWdg('file_status_select')
    task_status_select.set_id('file_status_select')
    task_status_select.add_style('width: 165px;')
    task_status_select.add_empty_option()

    pipeline = Pipeline.get_by_code('twog_Delivery')

    for status in pipeline.get_process_names():
        task_status_select.append_option(status, status)

    return task_status_select
def get_season_select_wdg(width=300):
    season_select_wdg = SelectWdg('season_code')
    season_select_wdg.set_id('season_code')
    season_select_wdg.add_style('width', '{0}px'.format(width))

    season_search = Search('twog/season')
    seasons = season_search.get_sobjects()

    for season in seasons:
        season_select_wdg.append_option(season.get_value('name'), season.get_code())

    return season_select_wdg
Пример #10
0
def get_season_select_wdg(width=300):
    season_select_wdg = SelectWdg('season_code')
    season_select_wdg.set_id('season_code')
    season_select_wdg.add_style('width', '{0}px'.format(width))

    season_search = Search('twog/season')
    seasons = season_search.get_sobjects()

    for season in seasons:
        season_select_wdg.append_option(season.get_value('name'),
                                        season.get_code())

    return season_select_wdg
Пример #11
0
    def get_bay_select(self):
        bay_sel = SelectWdg('bay_select')
        bay_sel.set_id('bay')
        bay_sel.add_style('width', '135px')
        bay_sel.add_empty_option()

        for i in range(1, 13):
            bay_sel.append_option('Bay %s' % i, 'Bay %s' % i)

        if self.prequal_eval_sobject:
            bay_sel.set_value(self.prequal_eval_sobject.get_value('bay'))

        return bay_sel
def get_title_select_wdg(width=300):
    title_select_wdg = SelectWdg('title_code')
    title_select_wdg.set_id('title_code')
    title_select_wdg.add_style('width', '{0}px'.format(width))
    title_select_wdg.add_empty_option()

    title_search = Search('twog/title')
    titles = title_search.get_sobjects()

    for title in titles:
        title_select_wdg.append_option(title.get_value('name'), title.get_code())

    return title_select_wdg
Пример #13
0
    def get_style_select(self):
        style_sel = SelectWdg('style_select')
        style_sel.set_id('style')
        style_sel.add_style('width: 135px;')
        style_sel.add_empty_option()

        for style in ('Technical', 'Spot QC', 'Mastering'):
            style_sel.append_option(style, style)

        if self.prequal_eval_sobject:
            style_sel.set_value(self.prequal_eval_sobject.get_value('style'))

        return style_sel
Пример #14
0
def get_title_select_wdg(width=300):
    title_select_wdg = SelectWdg('title_code')
    title_select_wdg.set_id('title_code')
    title_select_wdg.add_style('width', '{0}px'.format(width))
    title_select_wdg.add_empty_option()

    title_search = Search('twog/title')
    titles = title_search.get_sobjects()

    for title in titles:
        title_select_wdg.append_option(title.get_value('name'),
                                       title.get_code())

    return title_select_wdg
Пример #15
0
    def get_status_select(self):
        status_sel = SelectWdg('status_select')
        status_sel.set_id('status')
        status_sel.add_style('width', '135px')
        status_sel.add_empty_option()

        statuses = ('Approved', 'In Progress', 'Rejected')

        for status in statuses:
            status_sel.append_option(status, status)

        if hasattr(self, 'status'):
            status_sel.set_value(self.status)

        return status_sel
    def get_select_wdg(name, options, saved_value=None):
        select_wdg = SelectWdg(name)
        select_wdg.set_id(name)
        select_wdg.add_empty_option()

        for option_set in options:
            label = option_set[0]
            value = option_set[1]

            select_wdg.append_option(label, value)

        if saved_value:
            select_wdg.set_value(saved_value)

        return select_wdg
Пример #17
0
def get_instructions_select_wdg():
    """
    Get a Select Widget with all the instructions options

    :return: SelectWdg
    """

    instructions_search = Search('twog/instructions')

    instructions_select_wdg = SelectWdg('instructions_select')
    instructions_select_wdg.set_id('instructions_select')
    instructions_select_wdg.add_empty_option()
    instructions_select_wdg.set_search_for_options(instructions_search, 'code', 'name')

    return instructions_select_wdg
Пример #18
0
    def get_format_select_wdg(self):
        format_sel = SelectWdg('format_select')
        format_sel.set_id('format')
        format_sel.add_style('width', '153px')
        format_sel.add_style('display', 'inline-block')
        format_sel.add_empty_option()

        for file_format in ('Electronic/File', 'File - ProRes', 'File - MXF', 'File - MPEG', 'File - WAV', 'DBC', 'D5',
                            'HDCAM SR', 'NTSC', 'PAL'):
            format_sel.append_option(file_format, file_format)

        if self.prequal_eval_sobject:
            format_sel.set_value(self.prequal_eval_sobject.get_value('format'))

        return format_sel
    def get_description_select_wdg(name, value=None):
        select_wdg = SelectWdg(name)
        select_wdg.set_id(name)
        select_wdg.add_empty_option()

        description_search = Search('twog/prequal_line_description')
        descriptions = description_search.get_sobjects()

        for description in descriptions:
            select_wdg.append_option(description.get_value('name'), description.get_code())

        if value:
            select_wdg.set_value(value)

        return select_wdg
Пример #20
0
    def get_style_select(self):
        style_sel = SelectWdg('style_select')
        style_sel.set_id('style')
        style_sel.add_style('width: 135px;')
        style_sel.add_empty_option()

        for style in ('Technical', 'Spot QC', 'Mastering'):
            style_sel.append_option(style, style)

        try:
            style_sel.set_value(self.style_sel)
        except AttributeError:
            pass

        return style_sel
Пример #21
0
    def get_status_select(self):
        status_sel = SelectWdg('status_select')
        status_sel.set_id('status')
        status_sel.add_style('width', '135px')
        status_sel.add_empty_option()

        statuses = ('Approved', 'Condition', 'Rejected')

        for status in statuses:
            status_sel.append_option(status, status)

        if self.prequal_eval_sobject:
            status_sel.set_value(self.prequal_eval_sobject.get_value('status'))

        return status_sel
Пример #22
0
    def get_bay_select(self):
        bay_sel = SelectWdg('bay_select')
        bay_sel.set_id('bay')
        bay_sel.add_style('width', '135px')
        bay_sel.add_empty_option()

        for i in range(1, 13):
            bay_sel.append_option('Bay %s' % i, 'Bay %s' % i)

        try:
            bay_sel.set_value(self.bay)
        except AttributeError:
            pass

        return bay_sel
def get_language_select_wdg():
    language_select_wdg = SelectWdg('language_code')
    language_select_wdg.set_id('language_code')
    language_select_wdg.add_style('display', 'inline-block')
    language_select_wdg.add_empty_option()

    language_search = Search('twog/language')
    languages = language_search.get_sobjects()

    languages = sorted(languages, key=lambda x: x.get_value('name'))

    for language in languages:
        language_select_wdg.append_option(language.get_value('name'), language.get_code())

    return language_select_wdg
    def get_type_select_wdg(self, name, width=80):
        """
        :name: String, set as the name and ID for the select widget. Should correspond to a column on the MetaData
               sobject
        :width: int, the desired width of the widget in pixels
        :return: SelectWdg
        """

        select_wdg = SelectWdg(name)
        select_wdg.set_id(name)
        select_wdg.add_style('width', '{0}px'.format(width))
        select_wdg.add_empty_option()

        types = (
            ('(5.1) L', '5_1_l'),
            ('(5.1) R', '5_1_r'),
            ('(5.1) C', '5_1_c'),
            ('(5.1) Lfe', '5_1_lfe'),
            ('(5.1) Ls', '5_1_ls'),
            ('(5.1) Rs', '5_1_rs'),
            ('(7.1) L', '7_1_l'),
            ('(7.1) R', '7_1_r'),
            ('(7.1) C', '7_1_c'),
            ('(7.1) Lfe', '7_1_lfe'),
            ('(7.1) Ls', '7_1_ls'),
            ('(7.1) Rs', '7_1_rs'),
            ('(7.1) SBL', '7_1_sbl'),
            ('(7.1) SBR', '7_1_sbr'),
            ('(Stereo) Lt', 'stereo_lt'),
            ('(Stereo) Rt', 'stereo_rt'),
            ('(Stereo) Lt, Rt', 'stereo_lt_rt'),
            ('(Stereo) L', 'stereo_l'),
            ('(Stereo) R', 'stereo_r'),
            ('(Stereo) L, R', 'stereo_l_r'),
            ('Mono', 'mono')
        )

        for audio_type in types:
            type_label = audio_type[0]
            type_value = audio_type[1]

            select_wdg.append_option(type_label, type_value)

        # If the report was loaded from a save, and if the value is set, load it in the widget
        if hasattr(self, name):
            select_wdg.set_value(getattr(self, name))

        return select_wdg
Пример #25
0
    def get_machine_select(self):
        machine_sel = SelectWdg('machine_select')
        machine_sel.set_id('machine_code')
        machine_sel.add_style('width', '135px')
        machine_sel.add_empty_option()

        machine_search = Search('twog/machine')
        machines = machine_search.get_sobjects()

        for machine in machines:
            machine_sel.append_option(machine.get_value('name'), machine.get_code())

        if self.prequal_eval_sobject:
            machine_sel.set_value(self.prequal_eval_sobject.get_value('machine_code'))

        return machine_sel
Пример #26
0
def get_language_select_wdg():
    language_select_wdg = SelectWdg('language_code')
    language_select_wdg.set_id('language_code')
    language_select_wdg.add_style('display', 'inline-block')
    language_select_wdg.add_empty_option()

    language_search = Search('twog/language')
    languages = language_search.get_sobjects()

    languages = sorted(languages, key=lambda x: x.get_value('name'))

    for language in languages:
        language_select_wdg.append_option(language.get_value('name'),
                                          language.get_code())

    return language_select_wdg
Пример #27
0
    def get_client_select(self):
        client_sel = SelectWdg('client_select')
        client_sel.set_id('client_code')
        client_sel.add_style('width', '135px')
        client_sel.add_empty_option()

        client_search = Search('twog/client')
        clients = client_search.get_sobjects()

        for client in clients:
            client_sel.append_option(client.get_value('name'), client.get_code())

        if hasattr(self, 'client_code'):
            client_sel.set_value(self.client_code)

        return client_sel
def get_instructions_select_wdg(division_code, platform_code):
    """
    Get a Select Widget with all the package instructions options

    :return: SelectWdg
    """

    package_instructions_search = Search('twog/package_instructions')
    package_instructions_search.add_filter('division_code', division_code)
    package_instructions_search.add_filter('platform_code', platform_code)

    instructions_select_wdg = SelectWdg('package_instructions_select')
    instructions_select_wdg.set_id('package_instructions_select')
    instructions_select_wdg.add_empty_option()
    instructions_select_wdg.set_search_for_options(package_instructions_search, 'code', 'name')

    return instructions_select_wdg
Пример #29
0
    def get_video_aspect_ratio_select_wdg(self):
        video_aspect_ratio_sel = SelectWdg('video_aspect_ratio_select')
        video_aspect_ratio_sel.set_id('video_aspect_ratio')
        video_aspect_ratio_sel.add_style('width', '300px')
        video_aspect_ratio_sel.add_style('display', 'inline-block')
        video_aspect_ratio_sel.add_empty_option()

        video_aspect_ratios_search = Search('twog/aspect_ratio')
        video_aspect_ratios = video_aspect_ratios_search.get_sobjects()

        for video_aspect_ratio in video_aspect_ratios:
            video_aspect_ratio_sel.append_option(video_aspect_ratio.get('name'), video_aspect_ratio.get('name'))

        if hasattr(self, 'video_aspect_ratio'):
            video_aspect_ratio_sel.set_value(self.video_aspect_ratio)

        return video_aspect_ratio_sel
Пример #30
0
    def get_format_select_wdg(self):
        format_sel = SelectWdg('format_select')
        format_sel.set_id('format')
        format_sel.add_style('width', '153px')
        format_sel.add_style('display', 'inline-block')
        format_sel.add_empty_option()

        for file_format in ('Electronic/File', 'File - ProRes', 'File - MXF', 'File - MPEG', 'File - WAV', 'DBC', 'D5',
                            'HDCAM SR', 'NTSC', 'PAL'):
            format_sel.append_option(file_format, file_format)

        try:
            format_sel.set_value(self.format_data)
        except AttributeError:
            pass

        return format_sel
def get_pipeline_select_wdg(pipeline_code, search_type):
    pipeline_sel = SelectWdg('pipeline_select')
    pipeline_sel.set_id('pipeline_select')
    pipeline_sel.add_style('width', '135px')
    pipeline_sel.add_empty_option()

    pipeline_search = Search('sthpw/pipeline')
    pipeline_search.add_filter('search_type', search_type)
    pipelines = pipeline_search.get_sobjects()

    for pipeline in pipelines:
        pipeline_sel.append_option(pipeline.get_value('name'), pipeline.get_code())

    if pipeline_code:
        pipeline_sel.set_value(pipeline_code)

    return pipeline_sel
Пример #32
0
def get_file_select_wdg_from_file_list(files, width=400):
    """
    Given a list of file sobjects, return a SelectWdg using the file paths and codes

    :param files: List of file sobjects
    :param width: Width of the SelectWdg
    :return: SelectWdg
    """
    file_select_wdg = SelectWdg('file_select')
    file_select_wdg.set_id('file_select')
    file_select_wdg.add_style('width', '{0}px'.format(width))
    file_select_wdg.add_empty_option()

    for file_sobject in files:
        file_select_wdg.append_option(file_sobject.get('file_path'), file_sobject.get_code())

    return file_select_wdg
Пример #33
0
    def get_client_select(self):
        client_sel = SelectWdg('client_select')
        client_sel.set_id('client_code')
        client_sel.add_style('width', '135px')
        client_sel.add_empty_option()

        client_search = Search('twog/client')
        clients = client_search.get_sobjects()

        for client in clients:
            client_sel.append_option(client.get_value('name'), client.get_code())

        try:
            client_sel.set_value(self.prequal_eval_sobject.get('client_code'))
        except AttributeError:
            pass

        return client_sel
Пример #34
0
def get_pipeline_select_wdg(pipeline_code, search_type):
    pipeline_sel = SelectWdg('pipeline_select')
    pipeline_sel.set_id('pipeline_select')
    pipeline_sel.add_style('width', '135px')
    pipeline_sel.add_empty_option()

    pipeline_search = Search('sthpw/pipeline')
    pipeline_search.add_filter('search_type', search_type)
    pipelines = pipeline_search.get_sobjects()

    for pipeline in pipelines:
        pipeline_sel.append_option(pipeline.get_value('name'),
                                   pipeline.get_code())

    if pipeline_code:
        pipeline_sel.set_value(pipeline_code)

    return pipeline_sel
Пример #35
0
def get_file_select_wdg_from_file_list(files, width=400):
    """
    Given a list of file sobjects, return a SelectWdg using the file paths and codes

    :param files: List of file sobjects
    :param width: Width of the SelectWdg
    :return: SelectWdg
    """
    file_select_wdg = SelectWdg('file_select')
    file_select_wdg.set_id('file_select')
    file_select_wdg.add_style('width', '{0}px'.format(width))
    file_select_wdg.add_empty_option()

    for file_sobject in files:
        file_select_wdg.append_option(file_sobject.get('file_path'),
                                      file_sobject.get_code())

    return file_select_wdg
Пример #36
0
    def get_machine_select(self):
        machine_sel = SelectWdg('machine_select')
        machine_sel.set_id('machine_code')
        machine_sel.add_style('width', '135px')
        machine_sel.add_empty_option()

        machine_search = Search('twog/machine')
        machines = machine_search.get_sobjects()

        for machine in machines:
            machine_sel.append_option(machine.get_value('name'), machine.get_code())

        try:
            machine_sel.set_value(self.machine_code)
        except AttributeError:
            pass

        return machine_sel
Пример #37
0
    def get_select_wdg(name, options, is_checked, saved_value=None):
        select_wdg = SelectWdg(name)
        select_wdg.set_id(name)
        select_wdg.add_empty_option()

        for option_set in options:
            label = option_set[0]
            value = option_set[1]

            select_wdg.append_option(label, value)

        if not is_checked:
            select_wdg.add_style('font-weight', 'bold')

        if saved_value:
            select_wdg.set_value(saved_value)

        return select_wdg
Пример #38
0
def get_instructions_select_wdg(division_code, platform_code):
    """
    Get a Select Widget with all the package instructions options

    :return: SelectWdg
    """

    package_instructions_search = Search('twog/package_instructions')
    package_instructions_search.add_filter('division_code', division_code)
    package_instructions_search.add_filter('platform_code', platform_code)

    instructions_select_wdg = SelectWdg('package_instructions_select')
    instructions_select_wdg.set_id('package_instructions_select')
    instructions_select_wdg.add_empty_option()
    instructions_select_wdg.set_search_for_options(package_instructions_search,
                                                   'code', 'name')

    return instructions_select_wdg
Пример #39
0
    def get_language_select(self):
        language_select = SelectWdg('language_select')
        language_select.set_id('language_code')
        language_select.add_style('width', '300px')
        language_select.add_style('display', 'inline-block')
        language_select.add_empty_option()

        language_search = Search('twog/language')
        languages = language_search.get_sobjects()

        languages = sorted(languages, key=lambda x: x.get_value('name'))

        for language in languages:
            language_select.append_option(language.get_value('name'), language.get_code())

        if hasattr(self, 'language_code'):
            language_select.set_value(self.language_code)

        return language_select
Пример #40
0
    def get_label_select_wdg(self):
        label_select_wdg = SelectWdg('label')
        label_select_wdg.set_id('label')
        label_select_wdg.add_style('width', '300px')
        label_select_wdg.add_style('display', 'inline-block')
        label_select_wdg.add_empty_option()

        label_options = ('Good', 'Fair', 'Poor')

        for label in label_options:
            label_select_wdg.append_option(label, label)

        if hasattr(self, 'label'):
            # Double check that 'label' is within the given options (sometimes it isn't for some reason which causes
            # an error)
            if self.label in label_options:
                label_select_wdg.set_value(self.label)

        return label_select_wdg
Пример #41
0
    def get_file_type_wdg(my):
        '''drop down which selects which file type to export to'''
        # add a filter
        div = DivWdg()

        filter_div = FloatDivWdg(HtmlElement.b("File Type:"), width="15em")
        div.add(filter_div)

        select = SelectWdg()
        select.set_name("file_type")
        select.set_id("file_type")

        app = WebContainer.get_web().get_selected_app()

        if app == 'Maya':
            select.set_option("values", "mayaAscii|mayaBinary|obj|collada")
            select.set_option(
                "labels",
                "Maya Ascii (.ma)|Maya Binary (.mb)|Wavefront .obj|Collada (.dae)"
            )
        elif app == 'Houdini':
            select.set_option("values", "otl")
            select.set_option("labels", "Houdini Digital Asset(.otl)")
        elif app == 'XSI':
            select.set_option("values", "emdl|dotXSI|obj")
            select.set_option(
                "labels",
                "3D Model (.emdl)|SoftImage dotXSI (.xsi)|Wavefront .obj")
        else:
            select.set_option("values", "mayaAscii|mayaBinary|obj|collada")
            select.set_option(
                "labels",
                "Maya Ascii (.ma)|Maya Binary (.mb)|Wavefront .obj|Collada (.dae)"
            )

        select.add_style("font-size: 0.8em")
        select.add_style("margin-top: 5px")
        select.add_style("margin-right: 10px")
        select.set_persistence()

        div.add(select)
        return div
Пример #42
0
    def get_video_aspect_ratio_select_wdg(self):
        video_aspect_ratio_sel = SelectWdg('video_aspect_ratio_select')
        video_aspect_ratio_sel.set_id('video_aspect_ratio')
        video_aspect_ratio_sel.add_style('width', '300px')
        video_aspect_ratio_sel.add_style('display', 'inline-block')
        video_aspect_ratio_sel.add_empty_option()

        for video_aspect_ratio in ('16x9 1.33', '16x9 1.33 Pan & Scan', '16x9 1.78 Anamorphic', '16x9 1.78 Full Frame',
                                   '16x9 1.85 Letterbox', '16x9 1.85 Matted', '16x9 1.85 Matted Anamorphic',
                                   '16x9 2.00 Letterbox', '16x9 2.10 Letterbox', '16x9 2.20 Letterbox',
                                   '16x9 2.35 Anamorphic', '16x9 2.35 Letterbox', '16x9 2.40 Letterbox',
                                   '16x9 2.55 Letterbox', '4x3 1.33 Full Frame', '4x3 1.78 Letterbox',
                                   '4x3 1.85 Letterbox',
                                   '4x3 2.35 Letterbox', '4x3 2.40 Letterbox'):
            video_aspect_ratio_sel.append_option(video_aspect_ratio, video_aspect_ratio)

        if self.prequal_eval_sobject:
            video_aspect_ratio_sel.set_value(self.prequal_eval_sobject.get_value('video_aspect_ratio'))

        return video_aspect_ratio_sel
Пример #43
0
def get_pipeline_select_wdg(search_type, width=300):
    """
    Given a search type, return a select widget with the pipelines available for that search type

    :param search_type: Search type as a string
    :param width: Width of the widget in pixels
    :return: SelectWdg
    """
    pipeline_select_wdg = SelectWdg('pipeline_code')
    pipeline_select_wdg.set_id('pipeline_code')
    pipeline_select_wdg.add_style('width', '{0}px'.format(width))
    pipeline_select_wdg.add_empty_option()

    pipeline_search = Search('sthpw/pipeline')
    pipeline_search.add_filter('search_type', search_type)
    pipelines = pipeline_search.get_sobjects()

    for pipeline in pipelines:
        pipeline_select_wdg.append_option(pipeline.get_value('name'), pipeline.get_code())

    return pipeline_select_wdg
Пример #44
0
def get_file_classification_select_wdg(width=200, selected=None):
    """
    Get a SelectWdg with the three options available for a file's classification (source, intermediate, and
    deliverable). If 'selected' argument is passed, set the SelectWdg's value to that.

    :param width: Width of the widget in pixels (optional)
    :param selected: String ('source', 'intermediate', 'deliverable', or None)
    :return: SelectWdg
    """
    classification_select_wdg = SelectWdg('file_classification_select')
    classification_select_wdg.set_id('file_classification_select')
    classification_select_wdg.add_style('width', '{0}px'.format(width))

    classification_select_wdg.append_option('Source', 'source')
    classification_select_wdg.append_option('Intermediate', 'intermediate')
    classification_select_wdg.append_option('Deliverable', 'deliverable')

    if selected:
        classification_select_wdg.set_value(selected)

    return classification_select_wdg
Пример #45
0
def get_instructions_template_select_wdg():
    """
    Get a Select Widget with all the instructions template options

    :return: SelectWdg
    """

    instructions_search = Search('twog/instructions_template')

    instructions_template_select_wdg = SelectWdg('instructions_template_select')
    instructions_template_select_wdg.set_id('instructions_template_select')
    instructions_template_select_wdg.add_empty_option()

    instructions_sobjects = instructions_search.get_sobjects()
    instructions_sobjects = sorted(instructions_sobjects, key=lambda sobject: sobject.get('name'))

    for instructions_sobject in instructions_sobjects:
        instructions_template_select_wdg.append_option(instructions_sobject.get('name'),
                                                       instructions_sobject.get_code())

    return instructions_template_select_wdg
    def get_package_select_wdg(self):
        """
        Get a SelectWdg that contains all the possible packages that the component can switch to.

        :return: SelectWdg
        """

        # Set up a basic select widget with an empty object
        package_select_wdg = SelectWdg('reassign_package_select')
        package_select_wdg.set_id('reassign_package_select')
        package_select_wdg.add_style('width', '300px')
        package_select_wdg.add_empty_option()

        # Get the packages
        packages = self.get_packages()

        # Add the package names as the labels and the codes as the values
        for package in packages:
            package_select_wdg.append_option(package.get_value('name'), package.get_code())

        # Return the SelectWdg
        return package_select_wdg
    def get_standard_section(self):
        section_span = SpanWdg()

        section_span.add('Standard: ')

        standard_select = SelectWdg('standard_select')
        standard_select.set_id('standard')
        standard_select.add_style('width', '153px')
        standard_select.add_style('display', 'inline-block')
        standard_select.add_empty_option()

        for standard in ('625', '525', '720', '1080 (4:4:4)', '1080', 'PAL', 'NTSC', '3840', '4160'):
            standard_select.append_option(standard, standard)

        try:
            standard_select.set_value(self.standard)
        except AttributeError:
            pass

        section_span.add(standard_select)

        return section_span
def get_title_select_wdg():
    """
    Get a SelectWdg that contains all the possible titles that the component can switch to.

    :return: SelectWdg
    """

    # Set up a basic select widget with an empty object
    title_select_wdg = SelectWdg('title_select')
    title_select_wdg.set_id('title_select')
    title_select_wdg.add_style('width', '300px')
    title_select_wdg.add_empty_option()

    # Get the titles
    titles_search = Search('twog/title')
    titles = titles_search.get_sobjects()

    # Add the title names as the labels and the codes as the values
    for title in titles:
        title_select_wdg.append_option(title.get_value('name'), title.get_code())

    # Return the SelectWdg
    return title_select_wdg