Пример #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_security_wdg(my):

        div = DivWdg()
        div.add_class("spt_security")

        div.add(
            "A server can sync either be scoped for a single project or all projects.  Transactions that occur in the admin project never get synced."
        )

        div.add("<br/>" * 2)

        div.add("Project: ")

        search = Search("sthpw/project")
        search.add_filters("code", ['admin', 'unittest'], op='not in')
        search.add_order_by("title")
        projects = search.get_sobjects()

        select = SelectWdg("projects")
        div.add(select)
        labels = [x.get_value("title") for x in projects]
        values = [x.get_value("code") for x in projects]

        project_code = Project.get_project_code()
        if project_code != 'admin':
            select.set_value(project_code)
        select.set_option("labels", labels)
        select.set_option("values", values)
        select.add_empty_option("-- All --")

        div.add("<br/>" * 2)

        return div
Пример #3
0
    def get_security_wdg(self):

        div = DivWdg()
        div.add_class("spt_security")

        div.add("A server can sync either be scoped for a single project or all projects.  Transactions that occur in the admin project never get synced.")

        div.add("<br/>"*2)

        div.add("Project: ")

        search = Search("sthpw/project")
        search.add_filters("code", ['admin','unittest'], op='not in')
        search.add_order_by("title")
        projects = search.get_sobjects()

        select = SelectWdg("projects")
        div.add(select)
        labels = [x.get_value("title") for x in projects]
        values = [x.get_value("code") for x in projects]

        project_code = Project.get_project_code()
        if project_code != 'admin':
            select.set_value(project_code)
        select.set_option("labels", labels)
        select.set_option("values", values)
        select.add_empty_option("-- All --")


        div.add("<br/>"*2)

        return div
Пример #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
Пример #6
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
Пример #7
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
Пример #8
0
    def get_display(my):
        sobject = my.get_current_sobject()
        key = sobject.get_value("key")
        options = sobject.get_value("options")
        type = sobject.get_value("type")

        # get the value of the users preferences
        search = Search("sthpw/pref_setting")
        search.add_user_filter()
        search.add_filter("key", key)
        pref_setting = search.get_sobject()
        if pref_setting:
            value = pref_setting.get_value("value")
        else:
            value = ""

        div = DivWdg()

        element_name = "%s_%s" % (my.get_name(), sobject.get_id() )
      
        script = '''var server = TacticServerStub.get();
                var value = bvr.src_el.value;
                if (!value) return;

                spt.app_busy.show("Saving", "Saving Preference for [%s]");

                setTimeout( function() {
                    try{
                        server.execute_cmd('tactic.ui.table.SetPreferenceCmd', {key: '%s', value: value});
                    }catch(e){
                        spt.alert(spt.exception.handler(e));
                    }
                        
                    spt.app_busy.hide() 
                        
                    }, 200);'''%(key, key)

        if key in ['skin', 'palette', 'js_logging_level']:
            script = '''%s; spt.app_busy.show('Reloading Page ...'); setTimeout('spt.refresh_page()', 200);'''%script

        if type == "sequence":
            from pyasm.prod.web import SelectWdg
            select = SelectWdg(element_name)
            select.add_behavior({'type': "change", 
                'cbjs_action': script})

            select.set_option("values",options)
            if value:
                select.set_value(value)
            div.add(select)
        else:
            text = TextWdg(element_name)
            text.add_behavior({'type': "blur", 
                'cbjs_action': script})
            if value:
                text.set_value(value)
            div.add(text)
     
        return div
Пример #9
0
    def get_display(my):
        sobject = my.get_current_sobject()
        key = sobject.get_value("key")
        options = sobject.get_value("options")
        type = sobject.get_value("type")

        # get the value of the users preferences
        search = Search("sthpw/pref_setting")
        search.add_user_filter()
        search.add_filter("key", key)
        pref_setting = search.get_sobject()
        if pref_setting:
            value = pref_setting.get_value("value")
        else:
            value = ""

        div = DivWdg()

        element_name = "%s_%s" % (my.get_name(), sobject.get_id())

        script = '''var server = TacticServerStub.get();
                var value = bvr.src_el.value;
                if (!value) return;

                spt.app_busy.show("Saving", "Saving Preference for [%s]");

                setTimeout( function() {
                    try{
                        server.execute_cmd('tactic.ui.table.SetPreferenceCmd', {key: '%s', value: value});
                    }catch(e){
                        spt.alert(spt.exception.handler(e));
                    }
                        
                    spt.app_busy.hide() 
                        
                    }, 200);''' % (key, key)

        if key in ['skin', 'palette', 'js_logging_level']:
            script = '''%s; spt.app_busy.show('Reloading Page ...'); setTimeout('spt.refresh_page()', 200);''' % script

        if type == "sequence":
            from pyasm.prod.web import SelectWdg
            select = SelectWdg(element_name)
            select.add_behavior({'type': "change", 'cbjs_action': script})

            select.set_option("values", options)
            if value:
                select.set_value(value)
            div.add(select)
        else:
            text = TextWdg(element_name)
            text.add_behavior({'type': "blur", 'cbjs_action': script})
            if value:
                text.set_value(value)
            div.add(text)

        return div
Пример #10
0
    def configure_category(my, title, category, options, options_type = {}):
        div = DivWdg()

        title_wdg = DivWdg()
        div.add(title_wdg)

        #from tactic.ui.widget.swap_display_wdg import SwapDisplayWdg
        #swap = SwapDisplayWdg()
        #div.add(swap)

        title_wdg.add("<b>%s</b>" % title)


        table = Table()
        div.add(table)
        #table.add_color("color", "color")
        table.add_style("color: #000")
        table.add_style("margin: 20px")

        for option in options:
            table.add_row()
            display_title = Common.get_display_title(option)
            td = table.add_cell("%s: " % display_title)
            td.add_style("width: 150px")

            option_type = options_type.get(option)
            validation_scheme = ""

            #add selectWdg for those options whose type is bool
            if option_type == 'bool':
                text = SelectWdg(name="%s/%s" % (category, option))
                text.set_option('values','true|false')
                text.set_option('empty','true')
                text.add_style("margin-left: 0px")

                        
            elif option.endswith('password'):
                text = PasswordInputWdg(name="%s/%s" % (category, option))

            # dealing with options whose type is number   
            else:
                if option_type == 'number':
                    validation_scheme = 'INTEGER'
                    
                else:
                    validation_scheme = ""

                text = TextInputWdg(name="%s/%s" % (category, option), validation_scheme=validation_scheme, read_only="false")
                

            value = Config.get_value(category, option)
            if value:
                text.set_value(value)

            table.add_cell(text)

        return div
Пример #11
0
    def get_display(my):

        state = my.get_state()
        search_type = state.get("search_type")
        sobj = my.get_current_sobject()

        if search_type:
            st = search_type
        else:

            st = sobj.get_base_search_type()
        # for inline insert, this should proceed
        #if not sobj:
        #    return ''

        st_suffix = st.split('/', 1)

        if len(st_suffix) == 2:
            st_suffix = st_suffix[1]

        search = Search('sthpw/pipeline')
        search.add_op_filters([('search_type', 'EQ', '/%s' % st_suffix)])

        # takes into account site-wide pipeline
        search.add_project_filter(show_unset=True)
        sobjects = search.get_sobjects()

        codes = [x.get_code() for x in sobjects]

        if my.get_option("use_code") in [True, 'true']:
            names = codes
        else:

            names = []
            for x in sobjects:
                name = x.get_value("name")
                if not name:
                    name = x.get_value("code")
                names.append(name)

        select = SelectWdg(my.get_input_name())
        select.add_empty_option("-- Default --")
        select.set_option("values", codes)
        select.set_option("labels", names)
        if sobj:
            value = sobj.get_value(my.get_name())
            if value:
                select.set_value(value)

        else:
            # only for inline
            #behavior =  { 'type': 'click',
            #       'cbjs_action': 'spt.dg_table.select_wdg_clicked( evt, bvr.src_el );'}
            #select.add_behavior(behavior)
            pass

        return select
Пример #12
0
    def configure_category(my, title, category, options, options_type={}):
        div = DivWdg()

        title_wdg = DivWdg()
        div.add(title_wdg)

        #from tactic.ui.widget.swap_display_wdg import SwapDisplayWdg
        #swap = SwapDisplayWdg()
        #div.add(swap)

        title_wdg.add("<b>%s</b>" % title)

        table = Table()
        div.add(table)
        #table.add_color("color", "color")
        table.add_style("color: #000")
        table.add_style("margin: 20px")

        for option in options:
            table.add_row()
            display_title = Common.get_display_title(option)
            td = table.add_cell("%s: " % display_title)
            td.add_style("width: 150px")

            option_type = options_type.get(option)
            validation_scheme = ""

            #add selectWdg for those options whose type is bool
            if option_type == 'bool':
                text = SelectWdg(name="%s/%s" % (category, option))
                text.set_option('values', 'true|false')
                text.set_option('empty', 'true')
                text.add_style("margin-left: 0px")

            elif option.endswith('password'):
                text = PasswordInputWdg(name="%s/%s" % (category, option))

            # dealing with options whose type is number
            else:
                if option_type == 'number':
                    validation_scheme = 'INTEGER'

                else:
                    validation_scheme = ""

                text = TextInputWdg(name="%s/%s" % (category, option),
                                    validation_scheme=validation_scheme,
                                    read_only="false")

            value = Config.get_value(category, option)
            if value:
                text.set_value(value)

            table.add_cell(text)

        return div
Пример #13
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
Пример #14
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
Пример #15
0
    def get_display(self):

        widget = DivWdg()

        pipeline_code = self.get_option('pipeline')
        pipeline = Pipeline.get_by_code(pipeline_code)
        if not pipeline:
            widget.add("No pipeline defined")
            return widget
            

        processes = pipeline.get_process_names()

        widget.add_style("border: solid 1px blue")
        widget.add_style("position: absolute")
        widget.add_style("top: 300")
        widget.add_style("left: -500")

        for process in processes:

            #inputs = pipeline.get_input_processes(process)
            outputs = pipeline.get_output_processes(process)

            div = DivWdg()
            widget.add(div)
            div.add_class("spt_input_option")
            div.add_attr("spt_input_key", process)

            #if not outputs:
            #    # then we can't go anywhere, so just add a message
            #    text = ""
            #    div.add(text)
            #    continue

            values = []
            #values.extend( [str(x) for x in inputs] )
            values.append(process)
            values.extend( [str(x) for x in outputs] )


            select = SelectWdg(self.get_input_name())
            select.set_value(process)
            select.add_empty_option('-- Select --')
            select.set_option("values", values)
            div.add(select)

            from tactic.ui.panel import CellEditWdg
            CellEditWdg.add_edit_behavior(select)


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

        widget = DivWdg()

        pipeline_code = my.get_option('pipeline')
        pipeline = Pipeline.get_by_code(pipeline_code)
        if not pipeline:
            widget.add("No pipeline defined")
            return widget
            

        processes = pipeline.get_process_names()

        widget.add_style("border: solid 1px blue")
        widget.add_style("position: absolute")
        widget.add_style("top: 300")
        widget.add_style("left: -500")

        for process in processes:

            #inputs = pipeline.get_input_processes(process)
            outputs = pipeline.get_output_processes(process)

            div = DivWdg()
            widget.add(div)
            div.add_class("spt_input_option")
            div.add_attr("spt_input_key", process)

            #if not outputs:
            #    # then we can't go anywhere, so just add a message
            #    text = ""
            #    div.add(text)
            #    continue

            values = []
            #values.extend( [str(x) for x in inputs] )
            values.append(process)
            values.extend( [str(x) for x in outputs] )


            select = SelectWdg(my.get_input_name())
            select.set_value(process)
            select.add_empty_option('-- Select --')
            select.set_option("values", values)
            div.add(select)

            from tactic.ui.panel import CellEditWdg
            CellEditWdg.add_edit_behavior(select)


        return widget
Пример #17
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
Пример #18
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
Пример #19
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
Пример #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', '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
Пример #21
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
Пример #22
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
Пример #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_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
Пример #27
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
    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
Пример #29
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
Пример #30
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
Пример #31
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
Пример #32
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
Пример #33
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
Пример #35
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
Пример #36
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
Пример #37
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
Пример #38
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
Пример #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_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
Пример #42
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
Пример #43
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
Пример #44
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
Пример #45
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
Пример #46
0
    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
Пример #47
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', '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_true_false_select_wdg(self, name, width=80):
        """
        Set up a select widget with True and False values, with the labels being Yes and No. Most of the MetaData report
        is made up of such select widgets.

        :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()

        select_wdg.append_option('Yes', True)
        select_wdg.append_option('No', False)

        # 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
    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