示例#1
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
示例#2
0
 def get_display(my):
     widget = DivWdg()
     table = Table()
     table.add_attr('class','my_preferences_wdg')
    
     prefs = my.login_obj.get('twog_preferences').split(',')
     for pref in prefs:
         if pref not in [None,'']:
             kv = pref.split('=')
             key = kv[0]
             val = kv[1]
             table.add_row()
             desc = table.add_cell(my.key_dict[key])
             desc.add_attr('nowrap','nowrap')
             this_sel = SelectWdg(key)
             this_sel.add_attr('id',key)
             this_sel.add_style('width: 100px;')
             this_sel.append_option('True','true')
             this_sel.append_option('False','false')
             this_sel.set_value(val)
             table.add_cell(this_sel)
     table.add_row()
     t2 = Table()
     t2.add_row()
     t2.add_cell()
     tc = t2.add_cell('<input type="button" name="Save My Preferences" value="Save My Preferences"/>')
     tc.add_attr('width', '50px')
     tc.add_behavior(my.get_save_preferences())
     t2.add_cell()
     table.add_cell(t2)
     widget.add(table)
     return widget
示例#3
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
示例#4
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_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
    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
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
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
示例#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_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
示例#12
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
    def get_display(self):
        outer_div = DivWdg()
        outer_div.set_id('new-department-request-entry-form')

        page_label = "<div>Fill out the following form to submit a new request. The request will be added to the " \
                     "department's list, and will be addressed as soon as possible. You will receive a " \
                     "notification when the request is complete.</div><br/>"
        outer_div.add(page_label)

        outer_div.add(get_label_widget('Name'))
        outer_div.add(get_text_input_wdg('name', 800))

        outer_div.add(get_label_widget('Description'))
        outer_div.add(obu.get_text_area_input_wdg('description', 800, [('display', 'block')]))

        outer_div.add(get_label_widget('Due Date'))
        outer_div.add(get_datetime_calendar_wdg())

        department_select_wdg = SelectWdg('department_select')
        department_select_wdg.append_option('Onboarding', 'onboarding')
        department_select_wdg.append_option('Edel', 'edel')
        department_select_wdg.append_option('Compression', 'compression')
        department_select_wdg.append_option('QC', 'qc')

        outer_div.add(get_label_widget('Department'))
        outer_div.add(department_select_wdg)

        self.get_submit_widget(outer_div)

        return outer_div
示例#15
0
 def get_assigned_group_select(my, assigned, name):
     # Make the select element for groups
     groups_expr = "@GET(sthpw/login_group['login_group','not in','user|client|compression supervisor|edit supervisor|machine room supervisor|media vault supervisor|qc supervisor|sales supervisor|scheduling supervisor|streamz|executives|admin|management|office employees|it'].login_group)"
     groups = my.server.eval(groups_expr)
     group_sel = SelectWdg(name)
     if len(groups) > 0:
         group_sel.append_option('--Select--', '')
         if assigned:
             group_sel.set_value(assigned)
         else:
             group_sel.set_value('')
         for group in groups:
             group_sel.append_option(group, group)
     return group_sel
示例#16
0
 def get_assigned_select(my, assigned):
     # Make the select element for workers
     workers_expr = "@GET(sthpw/login['location','internal']['license_type','user'].login)"
     workers = my.server.eval(workers_expr)
     work_sel = SelectWdg('task_assigned_select')
     if len(workers) > 0:
         work_sel.append_option('--Select--', '')
         if assigned:
             work_sel.set_value(assigned)
         else:
             work_sel.set_value('')
         for worker in workers:
             work_sel.append_option(worker, worker)
     return work_sel
示例#17
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
    def get_display(self):
        outer_div = DivWdg()
        outer_div.set_id('new-department-request-entry-form')

        page_label = "<div>Fill out the following form to submit a new request. The request will be added to the " \
                     "department's list, and will be addressed as soon as possible. You will receive a " \
                     "notification when the request is complete.</div><br/>"
        outer_div.add(page_label)

        outer_div.add(get_label_widget('Name'))
        outer_div.add(get_text_input_wdg('name', 800))

        outer_div.add(get_label_widget('Description'))
        outer_div.add(
            obu.get_text_area_input_wdg('description', 800,
                                        [('display', 'block')]))

        outer_div.add(get_label_widget('Due Date'))
        outer_div.add(get_datetime_calendar_wdg())

        department_select_wdg = SelectWdg('department_select')
        department_select_wdg.append_option('Onboarding', 'onboarding')
        department_select_wdg.append_option('Edel', 'edel')
        department_select_wdg.append_option('Compression', 'compression')
        department_select_wdg.append_option('QC', 'qc')

        outer_div.add(get_label_widget('Department'))
        outer_div.add(department_select_wdg)

        self.get_submit_widget(outer_div)

        return outer_div
示例#19
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
示例#20
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
示例#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', '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
示例#22
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
示例#23
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
示例#24
0
 def get_sel(my, id_name, arr, default, alpha_sort):
     this_sel = SelectWdg(id_name)
     this_sel.add_attr('id',id_name)
     if default not in arr and default not in [None,'']:
         arr.append(default)
     if alpha_sort:
         arr.sort()
     arr2 = []
     for a in arr:
         arr2.append(a)
     this_sel.append_option('--Select--','')
     for a in arr2:
         this_sel.append_option(a,a)
     this_sel.set_value(default)
     return this_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
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_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
示例#28
0
 def get_assigned_select(self, assigned):
     workers_search = Search("sthpw/login")
     workers_search.add_filter('location', 'internal')
     workers_search.add_filter('license_type', 'user')
     workers = workers_search.get_sobjects()
     work_sel = SelectWdg('task_assigned_select')
     if len(workers) > 0:
         work_sel.append_option('--Select--', '')
         if assigned:
             work_sel.set_value(assigned)
         else:
             work_sel.set_value('')
         for worker in workers:
             work_sel.append_option(worker.get_value('login'), worker.get_value('login'))
     return work_sel
    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
示例#30
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
示例#31
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
示例#32
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
示例#33
0
    def get_assigned_group_select(self, assigned):
        where_str = "('user','client','compression supervisor','edit supervisor','machine room supervisor','media vault supervisor','qc supervisor','sales supervisor','scheduling supervisor','streamz','executives','admin','management','office employees','it')"
        group_search = Search("sthpw/login_group")
        group_search.add_where("\"login_group\" not in %s" % where_str)
        groups = group_search.get_sobjects()

        group_sel = SelectWdg('task_assigned_group_select')
        if len(groups) > 0:
            group_sel.append_option('--Select--', '')
            if assigned:
                group_sel.set_value(assigned)
            else:
                group_sel.set_value('')
            for group in groups:
                group_sel.append_option(group.get_value('login_group'), group.get_value('login_group'))
        return group_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
示例#35
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_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
示例#37
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
示例#38
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
示例#39
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
示例#40
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
示例#41
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
示例#42
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
示例#43
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
示例#44
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
示例#45
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
示例#46
0
    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'):
            standard_select.append_option(standard, standard)

        if self.prequal_eval_sobject:
            standard_select.set_value(self.prequal_eval_sobject.get_value('standard'))

        section_span.add(standard_select)

        return section_span
示例#47
0
    def get_statuses_select_from_task_pipe(self, status, pipe_code, search_type, task_sk, user_is_scheduler):
        # gets the processes from the sobject's pipeline
        statuses = ['Pending', 'Ready', 'On Hold', 'Client Response', 'Fix Needed', 'Rejected', 'In Progress',
                    'DR In Progress', 'Amberfin01 In Progress', 'Amberfin02 In Progress', 'BATON In Progress',
                    'Export In Progress', 'Need Buddy Check', 'Buddy Check In Progress', 'Completed']
        task_select = SelectWdg('task_stat_select')
        task_select.add_attr('old_status', status)
        task_select.add_attr('id', 'status_{0}'.format(task_sk))
        if len(statuses) > 0:
            task_select.append_option('--Select--', '')
            task_select.set_value(status)
            for stat in statuses:
                if stat == 'On Hold' and user_is_scheduler:
                    task_select.append_option(stat, stat)
                if stat == 'Approved':
                    task_select.append_option('Rejected', 'Rejected')
                task_select.append_option(stat, stat)
                if stat == 'Approved':
                    task_select.append_option('Completed', 'Completed')

        return task_select
示例#48
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