Exemplo n.º 1
0
def get_next_tasks_div(task_sobject):
    div_wdg = DivWdg()

    div_wdg.add(HtmlElement.h4('Next Tasks'))

    pipeline_code = task_sobject.get_parent().get('pipeline_code')

    pipeline_xml = get_pipeline_xml(pipeline_code)

    next_task_processes = get_next_tasks_processes_from_xml(
        pipeline_xml, task_sobject.get('process'))

    if next_task_processes:
        for process in next_task_processes:
            div_wdg.add(process)

            next_task_sobject = get_task_sobject_from_xml_and_process(
                pipeline_xml, process, task_sobject.get('search_code'))

            if next_task_sobject:
                task_load_button = ButtonNewWdg(title='Load Order',
                                                icon='WORK')
                task_load_button.add_behavior(
                    obu.get_load_new_tab_behavior(
                        'task_{0}'.format(next_task_sobject.get_code()),
                        process, 'widgets.TaskInspectWdg',
                        next_task_sobject.get_search_key()))
                task_load_button.add_style('display', 'inline-block')
                div_wdg.add(task_load_button)
    else:
        div_wdg.add('None')

    return div_wdg
    def get_files_list(self):
        outer_div = DivWdg()

        file_in_package_sobjects = get_file_in_package_sobjects_by_package_code(self.package_sobject.get_code())
        file_sobjects = get_file_sobjects_from_file_in_package_sobjects(file_in_package_sobjects)

        files_unordered_html_list = HtmlElement.ul()

        for file_sobject, file_in_package_sobject in zip(file_sobjects, file_in_package_sobjects):
            task_sobject = file_in_package_sobject.get_all_children('sthpw/task')[0]

            file_li = HtmlElement.li()
            file_li.add(file_sobject.get('file_path') + ' - ' + task_sobject.get('status'))

            change_status_button = ButtonNewWdg(title='Change Status', icon='EDIT')
            change_status_button.add_behavior(
                obu.get_load_popup_widget_with_reload_behavior(
                    'Change Status', 'widgets.ChangeStatusWdg', task_sobject.get_search_key(),
                    'Package', 'widgets.PackageInspectWdg', self.package_sobject.get_search_key()
                )
            )
            change_status_button.add_style('display', 'inline-block')

            file_li.add(change_status_button)

            files_unordered_html_list.add(file_li)

        outer_div.add(files_unordered_html_list)

        return outer_div
def get_next_tasks_div(task_sobject):
    div_wdg = DivWdg()

    div_wdg.add(HtmlElement.h4('Next Tasks'))

    pipeline_code = task_sobject.get_parent().get('pipeline_code')

    pipeline_xml = get_pipeline_xml(pipeline_code)

    next_task_processes = get_next_tasks_processes_from_xml(pipeline_xml, task_sobject.get('process'))

    if next_task_processes:
        for process in next_task_processes:
            div_wdg.add(process)

            next_task_sobject = get_task_sobject_from_xml_and_process(pipeline_xml, process,
                                                                          task_sobject.get('search_code'))

            if next_task_sobject:
                task_load_button = ButtonNewWdg(title='Load Order', icon='WORK')
                task_load_button.add_behavior(
                    obu.get_load_new_tab_behavior(
                        'task_{0}'.format(next_task_sobject.get_code()), process, 'widgets.TaskInspectWdg',
                        next_task_sobject.get_search_key()
                    )
                )
                task_load_button.add_style('display', 'inline-block')
                div_wdg.add(task_load_button)
    else:
        div_wdg.add('None')

    return div_wdg
def get_out_files_list(task_data_code, task_sobject_search_key):
    out_files_list = get_task_data_out_files(task_data_code)

    div_wdg = DivWdg()

    if out_files_list:
        out_files_unordered_html_list = HtmlElement.ul()

        for out_file in out_files_list:
            file_li = HtmlElement.li()
            file_li.add('{0} ({1})'.format(out_file.get('file_path'), out_file.get('classification').title()))

            file_edit_button = ButtonNewWdg(title='Edit File', icon='EDIT')
            file_edit_button.add_behavior(
                obu.get_load_popup_widget_with_reload_behavior(
                    'Edit File', 'widgets.EditFileWdg', out_file.get_search_key(),
                    'Task', 'widgets.TaskInspectWdg', task_sobject_search_key
                )
            )
            file_edit_button.add_style('display', 'inline-block')

            file_li.add(file_edit_button)

            out_files_unordered_html_list.add(file_li)

        div_wdg.add(out_files_unordered_html_list)
    else:
        div_wdg.add('No output files exist for this task')

    return div_wdg
Exemplo n.º 5
0
def get_out_files_list(task_data_code, task_sobject_search_key):
    out_files_list = get_task_data_out_files(task_data_code)

    div_wdg = DivWdg()

    if out_files_list:
        out_files_unordered_html_list = HtmlElement.ul()

        for out_file in out_files_list:
            file_li = HtmlElement.li()
            file_li.add('{0} ({1})'.format(
                out_file.get('file_path'),
                out_file.get('classification').title()))

            file_edit_button = ButtonNewWdg(title='Edit File', icon='EDIT')
            file_edit_button.add_behavior(
                obu.get_load_popup_widget_with_reload_behavior(
                    'Edit File', 'widgets.EditFileWdg',
                    out_file.get_search_key(), 'Task',
                    'widgets.TaskInspectWdg', task_sobject_search_key))
            file_edit_button.add_style('display', 'inline-block')

            file_li.add(file_edit_button)

            out_files_unordered_html_list.add(file_li)

        div_wdg.add(out_files_unordered_html_list)
    else:
        div_wdg.add('No output files exist for this task')

    return div_wdg
Exemplo n.º 6
0
    def get_add_row_button(self):
        span_wdg = SpanWdg()

        add_row_button = ButtonNewWdg(title='Add Row', icon='ADD')
        add_row_button.add_class('add_row_button')
        add_row_button.add_style('display', 'inline-block')
        add_row_button.add_behavior(self.get_add_row_behavior())

        span_wdg.add(add_row_button)

        return span_wdg
Exemplo n.º 7
0
    def get_row_checked_button(self, row_code):
        span_wdg = SpanWdg()

        checked_row_button = ButtonNewWdg(title='Checked Row', icon='CHECK')
        checked_row_button.add_style('display', 'inline-block')
        checked_row_button.add_behavior(
            self.get_checked_row_behavior(row_code))

        span_wdg.add(checked_row_button)

        return span_wdg
    def get_add_multiple_rows_button(self):
        span_wdg = SpanWdg()

        add_rows_button = ButtonNewWdg(title='Add Multiple Row', icon='PLUS_ADD')
        add_rows_button.add_class('add_rows_button')
        add_rows_button.add_style('display', 'inline-block')
        add_rows_button.add_behavior(self.get_add_multiple_rows_behavior())

        span_wdg.add(add_rows_button)

        return span_wdg
    def get_remove_row_button(self, row_code):
        span_wdg = SpanWdg()

        remove_row_button = ButtonNewWdg(title='Remove Row', icon='DELETE')

        remove_row_button.add_class('subtract_row_button')
        remove_row_button.add_style('display', 'inline-block')
        remove_row_button.add_behavior(self.get_remove_row_behavior(row_code))

        span_wdg.add(remove_row_button)

        return span_wdg
Exemplo n.º 10
0
    def get_remove_row_button(self, row_code):
        span_wdg = SpanWdg()

        remove_row_button = ButtonNewWdg(title='Remove Row', icon='DELETE')

        remove_row_button.add_class('subtract_row_button')
        remove_row_button.add_style('display', 'inline-block')
        remove_row_button.add_behavior(self.get_remove_row_behavior(row_code))

        span_wdg.add(remove_row_button)

        return span_wdg
Exemplo n.º 11
0
    def get_add_multiple_rows_button(self):
        span_wdg = SpanWdg()

        # TODO: Find a better icon for this
        add_row_button = ButtonNewWdg(title='Add Multiple Row',
                                      icon='PLUS_ADD')
        add_row_button.add_class('add_row_button')
        add_row_button.add_style('display', 'inline-block')
        add_row_button.add_behavior(self.get_add_multiple_rows_behavior())

        span_wdg.add(add_row_button)

        return span_wdg
Exemplo n.º 12
0
    def setup_html_list_for_file_flows_in_order(self, width=600):
        file_flows_list = HtmlElement.ul()
        file_flows_list.add_style('list-style-type', 'none')
        file_flows_list.add_style('margin-left', '10px')
        file_flows_list.add_style('padding-left', '0px')

        component_sobjects = get_component_sobjects_from_order_code(self.order_sobject.get_code())\

        # Only do the searching and rendering if components exist for the Order
        if component_sobjects:
            component_sobjects_string = ','.join([
                "'{0}'".format(component.get_code())
                for component in component_sobjects
            ])

            file_flow_search = Search('twog/file_flow')
            file_flow_search.add_where('\"component_code\" in ({0})'.format(
                component_sobjects_string))
            file_flows = file_flow_search.get_sobjects()

            for file_flow in file_flows:
                file_flow_div = DivWdg()
                file_flow_div.add_style('background-color', '#d9edf7')
                file_flow_div.add_style('padding', '10px')
                file_flow_div.add_style('border-radius', '10px')

                file_flow_div.add(file_flow.get('name'))
                file_flow_div.add_style('display', 'block')

                change_component_button = ButtonNewWdg(
                    title='Change Component', icon='PIPELINE')
                change_component_button.add_behavior(
                    obu.get_load_popup_widget_with_reload_behavior(
                        'Change Component',
                        'widgets.ChangeComponentForFileFlowWdg',
                        file_flow.get_search_key(), 'Order Builder',
                        'order_builder.OrderBuilderWdg',
                        self.order_sobject.get_search_key()))
                change_component_button.add_style('display', 'inline-block')

                file_flow_div.add(change_component_button)

                li = HtmlElement.li()

                li.add(file_flow_div)
                file_flows_list.add(li)

        return file_flows_list
    def get_buttons_row(self):
        outer_div = DivWdg()

        download_attached_files_button =  ButtonNewWdg(title='Download Attached Files', icon='DOWNLOAD')
        download_attached_files_button.add_behavior(obu.get_download_attached_files_behavior(
            self.task_sobject.get_search_key()
        ))
        download_attached_files_button.add_style('display', 'inline-block')

        note_button = ButtonNewWdg(title='Add Note', icon='NOTE')
        note_button.add_behavior(obu.get_add_notes_behavior(self.task_sobject.get_search_key()))
        note_button.add_style('display', 'inline-block')

        outer_div.add(download_attached_files_button)
        outer_div.add(note_button)

        return outer_div
    def get_buttons_row(self):
        outer_div = DivWdg()

        edit_all_statuses_button = ButtonNewWdg(title='Edit All Statuses', icon='EDIT')
        edit_all_statuses_button.add_behavior(
            obu.get_load_popup_widget_with_reload_behavior(
                'Change Statuses', 'widgets.ChangeMultipleFileStatusesOnPackageWdg',
                self.package_sobject.get_search_key(), 'Package', 'widgets.PackageInspectWdg',
                self.package_sobject.get_search_key()
            )
        )
        edit_all_statuses_button.add_style('display', 'inline-block')

        note_button = ButtonNewWdg(title='Add Note', icon='NOTE')
        note_button.add_behavior(obu.get_add_notes_behavior(self.package_sobject.get_search_key()))
        note_button.add_style('display', 'inline-block')

        outer_div.add(edit_all_statuses_button)
        outer_div.add(note_button)

        return outer_div
Exemplo n.º 15
0
    def get_display(self):
        outer_div = DivWdg()
        outer_div.set_id('package_inspect_{0}'.format(
            self.package_sobject.get_code()))

        outer_div.add(get_page_header(self.package_sobject.get('name')))
        outer_div.add(
            HtmlElement.h4('Code: {0}'.format(
                self.package_sobject.get_code())))

        task_sobject = self.package_sobject.get_all_children('sthpw/task')[0]

        change_status_button = ButtonNewWdg(title='Change Status', icon='EDIT')
        change_status_button.add_behavior(
            obu.get_load_popup_widget_with_reload_behavior(
                'Change Status', 'widgets.ChangeStatusWdg',
                task_sobject.get_search_key(), 'Package',
                'widgets.PackageInspectWdg',
                self.package_sobject.get_search_key()))
        change_status_button.add_style('display', 'inline-block')

        outer_div.add(
            HtmlElement.h4('Status: {0}'.format(task_sobject.get('status'))))
        outer_div.add(change_status_button)

        outer_div.add(HtmlElement.h4('<u>Files</u>'))
        outer_div.add(self.get_files_list())

        outer_div.add(HtmlElement.h4('<u>Instructions</u>'))

        instructions = self.package_sobject.get('delivery_instructions')

        if not instructions:
            instructions = 'Sorry, instructions have not been added yet.'

            outer_div.add(instructions.encode('utf-8'))

        outer_div.add(self.get_buttons_row())

        return outer_div
Exemplo n.º 16
0
    def get_buttons_row(self):
        outer_div = DivWdg()

        edit_all_statuses_button = ButtonNewWdg(title='Edit All Statuses',
                                                icon='EDIT')
        edit_all_statuses_button.add_behavior(
            obu.get_load_popup_widget_with_reload_behavior(
                'Change Statuses',
                'widgets.ChangeMultipleFileStatusesOnPackageWdg',
                self.package_sobject.get_search_key(), 'Package',
                'widgets.PackageInspectWdg',
                self.package_sobject.get_search_key()))
        edit_all_statuses_button.add_style('display', 'inline-block')

        note_button = ButtonNewWdg(title='Add Note', icon='NOTE')
        note_button.add_behavior(
            obu.get_add_notes_behavior(self.package_sobject.get_search_key()))
        note_button.add_style('display', 'inline-block')

        outer_div.add(edit_all_statuses_button)
        outer_div.add(note_button)

        return outer_div
Exemplo n.º 17
0
    def get_files_list(self):
        outer_div = DivWdg()

        file_in_package_sobjects = get_file_in_package_sobjects_by_package_code(
            self.package_sobject.get_code())
        file_sobjects = get_file_sobjects_from_file_in_package_sobjects(
            file_in_package_sobjects)

        files_unordered_html_list = HtmlElement.ul()

        for file_sobject, file_in_package_sobject in zip(
                file_sobjects, file_in_package_sobjects):
            task_sobject = file_in_package_sobject.get_all_children(
                'sthpw/task')[0]

            file_li = HtmlElement.li()
            file_li.add(
                file_sobject.get('file_path') + ' - ' +
                task_sobject.get('status'))

            change_status_button = ButtonNewWdg(title='Change Status',
                                                icon='EDIT')
            change_status_button.add_behavior(
                obu.get_load_popup_widget_with_reload_behavior(
                    'Change Status', 'widgets.ChangeStatusWdg',
                    task_sobject.get_search_key(), 'Package',
                    'widgets.PackageInspectWdg',
                    self.package_sobject.get_search_key()))
            change_status_button.add_style('display', 'inline-block')

            file_li.add(change_status_button)

            files_unordered_html_list.add(file_li)

        outer_div.add(files_unordered_html_list)

        return outer_div
    def get_display(self):
        outer_div = DivWdg()
        outer_div.set_id('package_inspect_{0}'.format(self.package_sobject.get_code()))

        outer_div.add(get_page_header(self.package_sobject.get('name')))
        outer_div.add(HtmlElement.h4('Code: {0}'.format(self.package_sobject.get_code())))

        task_sobject = self.package_sobject.get_all_children('sthpw/task')[0]

        change_status_button = ButtonNewWdg(title='Change Status', icon='EDIT')
        change_status_button.add_behavior(
            obu.get_load_popup_widget_with_reload_behavior(
                'Change Status', 'widgets.ChangeStatusWdg', task_sobject.get_search_key(),
                'Package', 'widgets.PackageInspectWdg', self.package_sobject.get_search_key()
            )
        )
        change_status_button.add_style('display', 'inline-block')

        outer_div.add(HtmlElement.h4('Status: {0}'.format(task_sobject.get('status'))))
        outer_div.add(change_status_button)

        outer_div.add(HtmlElement.h4('<u>Files</u>'))
        outer_div.add(self.get_files_list())

        outer_div.add(HtmlElement.h4('<u>Instructions</u>'))

        instructions = self.package_sobject.get('delivery_instructions')

        if not instructions:
            instructions = 'Sorry, instructions have not been added yet.'

            outer_div.add(instructions.encode('utf-8'))

        outer_div.add(self.get_buttons_row())

        return outer_div
    def get_display(self):
        div_wdg = DivWdg()
        div_wdg.set_id('task_inspect_{0}'.format(self.task_sobject.get_code()))

        div_wdg.add(get_page_header(self.task_sobject.get('process')))
        div_wdg.add(HtmlElement.h4('Code: {0}'.format(self.task_sobject.get_code())))
        div_wdg.add(HtmlElement.h4('Package: {0} ({1})'.format(self.parent_component.get('name'),
                                                                 self.parent_component.get_code())))

        # Get the order that contains the parent component and display its information
        order_sobject = get_order_sobject_from_component_sobject(self.parent_component)
        div_wdg.add(HtmlElement.h4('Order: {0} ({1})'.format(order_sobject.get('name'), order_sobject.get_code())))

        div_wdg.add(HtmlElement.h4('<u>Status</u>'))
        div_wdg.add(get_task_status_select_wdg(self.task_sobject))

        div_wdg.add(HtmlElement.h4('<u>Estimated Hours: {0}</u>'.format(self.task_data.get('estimated_hours'))))

        change_estimated_hours_button = ButtonNewWdg(title='Change Estimated Hours', icon='TIME')
        change_estimated_hours_button.add_behavior(
            obu.get_load_popup_widget_with_reload_behavior(
                'Change Estimated Hours', 'widgets.ChangeEstimatedHoursForTaskWdg', self.task_sobject.get_search_key(),
                'Task', 'widgets.TaskInspectWdg', self.task_sobject.get_search_key()
            )
        )
        change_estimated_hours_button.add_style('display', 'inline-block')
        div_wdg.add(change_estimated_hours_button)

        add_input_file_button = ButtonNewWdg(title='Add Input Files', icon='INSERT_MULTI')
        add_input_file_button.add_behavior(
            obu.get_load_popup_widget_behavior('Add Input Files from Order',
                                               'widgets.AddInputFilesToTaskWdg',
                                               self.task_sobject.get_search_key())
        )
        add_input_file_button.add_style('display', 'inline-block')
        div_wdg.add(add_input_file_button)

        create_input_file_button = ButtonNewWdg(title='Create a new Input File', icon='ADD')
        create_input_file_button.add_behavior(
            obu.get_load_popup_widget_with_reload_behavior(
                'Create a new Input File', 'widgets.CreateNewInputFileForTaskWdg', self.task_sobject.get_search_key(),
                'Task', 'widgets.TaskInspectWdg', self.task_sobject.get_search_key()
            )
        )
        create_input_file_button.add_style('display', 'inline-block')
        div_wdg.add(create_input_file_button)

        move_input_file_to_output_button = ButtonNewWdg(title='Move Input File to Output', icon='RIGHT')
        move_input_file_to_output_button.add_behavior(
            obu.get_load_popup_widget_with_reload_behavior(
                'Move Input File to Output', 'widgets.MoveInputFileToOutputWdg', self.task_sobject.get_search_key(),
                'Task', 'widgets.TaskInspectWdg', self.task_sobject.get_search_key()
            )
        )
        move_input_file_to_output_button.add_style('display', 'inline-block')
        div_wdg.add(move_input_file_to_output_button)

        add_equipment_button = ButtonNewWdg(title='Add Equipment', icon='INSERT_MULTI')
        add_equipment_button.add_behavior(
            obu.get_load_popup_widget_with_reload_behavior('Add Equipment', 'widgets.EquipmentInTaskWdg',
                                                           self.task_sobject.get_search_key(), 'Task',
                                                           'widgets.TaskInspectWdg', self.task_sobject.get_search_key())
        )
        add_equipment_button.add_style('display', 'inline-block')
        div_wdg.add(add_equipment_button)

        if self.parent_component.get_search_type() == u'twog/component?project=twog':
            div_wdg.add(HtmlElement.h4('<u>Instructions</u>'))

            instructions_code = self.parent_component.get('instructions_code')
            instructions = get_task_instructions_text_from_instructions_code(instructions_code,
                                                                             self.task_sobject.get('process'))

            if not instructions:
                instructions = 'Sorry, instructions have not been added yet.'

            div_wdg.add(self.parse_instruction_text(instructions.encode('utf-8')))
        elif self.parent_component.get_search_type() == u'twog/package?project=twog':
            div_wdg.add(HtmlElement.h4('<u>Instructions</u>'))

            instructions = self.parent_component.get('delivery_instructions')

            if not instructions:
                instructions = 'Sorry, instructions have not been added yet.'

            div_wdg.add(self.parse_instruction_text(instructions.encode('utf-8')))

        div_wdg.add(self.get_buttons_row())

        submit_button = SubmitWdg('Submit Changes')
        submit_button.add_behavior(self.submit_button_behavior())
        submit_button.add_style('display', 'block')

        div_wdg.add(submit_button)

        return div_wdg
Exemplo n.º 20
0
    def setup_html_list_for_components_in_order(self, width=600):
        components_list = HtmlElement.ul()
        components_list.add_style('list-style-type', 'none')
        components_list.add_style('margin-left', '10px')
        components_list.add_style('padding-left', '0px')

        component_search = Search('twog/component')
        component_search.add_filter('order_code',
                                    self.order_sobject.get_code())
        components = component_search.get_sobjects()

        for component in components:
            component_name_div = DivWdg()
            component_name_div.add_style('font-weight', 'bold')
            component_name_div.add(component.get('name'))

            component_code_div = DivWdg()
            component_code_div.add('Code: {0}'.format(component.get_code()))

            component_title_div = DivWdg()
            component_title = get_sobject_name_by_code(
                'twog/title', component.get('title_code'))

            if component_title:
                component_title_div.add('Title: {0}'.format(component_title))
            else:
                component_title_div.add('No Title Selected')

            component_description_div = DivWdg()
            component_description_div.add_style('font-style', 'italic')
            component_description_div.add(component.get('description'))

            component_pipeline_div = DivWdg()
            component_pipeline_name = get_sobject_name_by_code(
                'sthpw/pipeline', component.get('pipeline_code'))

            if component_pipeline_name:
                component_pipeline_div.add(
                    'Pipeline: <i>{0}</i>'.format(component_pipeline_name))
            else:
                component_pipeline_div.add('<i>No Pipeline Assigned</i>')

            component_instructions_div = DivWdg()
            component_instructions_name = get_sobject_name_by_code(
                'twog/instructions', component.get('instructions_code'))

            if component_instructions_name:
                component_instructions_div.add(
                    'Instructions: <i>{0}</i>'.format(
                        component_instructions_name))
            else:
                component_instructions_div.add(
                    '<i>No Instrutions assigned</i>')

            component_language_div = DivWdg()
            component_language = get_sobject_name_by_code(
                'twog/language', component.get_value('language_code'))

            if component_language:
                component_language_div.add(
                    'Language: <i>{0}</i>'.format(component_language))
            else:
                component_language_div.add('<i>No language selected</i>')

            # Set up a div for the component's status, if one exists (it should).
            component_status_div = DivWdg()
            component_status = component.get('status')

            if component_status:
                # Get the label and color for the component status by looking it up in a dictionary.
                # If the status is not found, None will be returned instead
                component_status_label, component_status_color = get_component_status_label_and_color(
                    component_status)

                if component_status_label and component_status_color:
                    # Put the label in a span, so it can be assigned a color
                    component_status_span = SpanWdg()
                    component_status_span.add(component_status_label)
                    component_status_span.add_style('color',
                                                    component_status_color)

                    # Add "Status:" along with the colored span to the div
                    component_status_div.add('Status: ')
                    component_status_div.add(component_status_span)
                else:
                    # Status was not found, present it as it is in the database
                    component_status_div.add(
                        'Status: {0}'.format(component_status))
            else:
                # There should never be a case where a status is not set on a component, but it could happen
                component_status_div.add('<i>Status not set</i>')

            component_estimated_total_hours_div = DivWdg()
            estimated_total_hours = get_component_estimated_total_hours_from_component_code(
                component.get_code())

            if estimated_total_hours:
                component_estimated_total_hours_div.add(
                    'Estimated Total Hours: {0}'.format(estimated_total_hours))

            component_estimated_remaining_hours_div = DivWdg()
            estimated_remaining_hours = get_component_estimated_remaining_hours_from_component_code(
                component.get_code())

            if estimated_remaining_hours:
                component_estimated_remaining_hours_div.add(
                    'Estimated Remaining Hours: {0}'.format(
                        estimated_remaining_hours))

            component_div = DivWdg()
            component_div.add_style('background-color', '#d9edcf')
            component_div.add_style('padding', '10px')
            component_div.add_style('border-radius', '10px')

            component_div.add(component_name_div)
            component_div.add(component_code_div)
            component_div.add(component_title_div)
            component_div.add(component_description_div)
            component_div.add(component_pipeline_div)
            component_div.add(component_instructions_div)
            component_div.add(component_language_div)
            component_div.add(component_status_div)
            component_div.add(component_estimated_total_hours_div)
            component_div.add(component_estimated_remaining_hours_div)

            instructions_button = ButtonNewWdg(title='Instructions',
                                               icon='CONTENTS')
            instructions_button.add_behavior(
                obu.get_load_popup_widget_behavior(
                    'Component Instructions',
                    'order_builder.ComponentInstructionsWdg',
                    component.get_search_key()))
            instructions_button.add_style('display', 'inline-block')

            change_instructions_button = ButtonNewWdg(
                title='Change Instructions', icon='DOCUMENTATION')
            change_instructions_button.add_behavior(
                obu.get_load_popup_widget_with_reload_behavior(
                    'Change Instructions',
                    'order_builder.ChangeInstructionsWdg',
                    component.get_search_key(), 'Order Builder',
                    'order_builder.OrderBuilderWdg',
                    self.order_sobject.get_search_key()))
            change_instructions_button.add_style('display', 'inline-block')

            # Get the instructions search key for the Edit Instructions widget
            instructions_document_search_key = SearchKey.build_search_key(
                'twog/instructions',
                component.get('instructions_code'),
                project_code='twog')

            edit_instructions_button = ButtonNewWdg(title='Edit Instructions',
                                                    icon='EDIT')
            edit_instructions_button.add_behavior(
                obu.get_load_new_tab_behavior(
                    'edit_instructions_{0}'.format(
                        instructions_document_search_key), 'Edit Instructions',
                    'widgets.EditInstructionsWdg',
                    instructions_document_search_key))
            edit_instructions_button.add_style('display', 'inline-block')

            add_instructions_from_template_button = ButtonNewWdg(
                title='Add Instructions From Template', icon='EDIT')
            add_instructions_from_template_button.add_behavior(
                obu.get_load_popup_widget_with_reload_behavior(
                    'Add Instructions From Template',
                    'widgets.AddInstructionsFromTemplateWdg',
                    component.get_search_key(), 'Order Builder',
                    'order_builder.OrderBuilderWdg',
                    self.order_sobject.get_search_key()))
            add_instructions_from_template_button.add_style(
                'display', 'inline-block')

            change_title_button = ButtonNewWdg(title='Change Title', icon='')
            change_title_button.add_behavior(
                obu.get_load_popup_widget_with_reload_behavior(
                    'Change Title', 'order_builder.ChangeTitleWdg',
                    component.get_search_key(), 'Order Builder',
                    'order_builder.OrderBuilderWdg',
                    self.order_sobject.get_search_key()))
            change_title_button.add_style('display', 'inline-block')

            change_pipeline_button = ButtonNewWdg(title='Change Pipeline',
                                                  icon='PIPELINE')
            change_pipeline_button.add_behavior(
                obu.get_load_popup_widget_with_reload_behavior(
                    'Change Pipeline', 'widgets.AssignPipelineWdg',
                    component.get_search_key(), 'Order Builder',
                    'order_builder.OrderBuilderWdg',
                    self.order_sobject.get_search_key()))
            change_pipeline_button.add_style('display', 'inline-block')

            add_tasks_from_pipeline_wdg = ButtonNewWdg(
                title='Add Tasks from Pipeline', icon='INSERT_MULTI')
            add_tasks_from_pipeline_wdg.add_behavior(
                get_load_assign_tasks_wdg(component.get_search_key()))
            add_tasks_from_pipeline_wdg.add_style('display', 'inline-block')

            add_task_button = ButtonNewWdg(title='Add Task', icon='INSERT')
            add_task_button.add_behavior(
                obu.get_load_popup_widget_behavior(
                    'Add Task', 'order_builder.InsertTaskWdg',
                    component.get_search_key()))
            add_task_button.add_style('display', 'inline-block')

            note_button = ButtonNewWdg(title='Add Note', icon='NOTE')
            note_button.add_behavior(
                obu.get_add_notes_behavior(component.get_search_key()))
            note_button.add_style('display', 'inline-block')

            button_row_div = SpanWdg()
            button_row_div.add_style('display', 'inline-block')
            button_row_div.add(instructions_button)
            button_row_div.add(edit_instructions_button)
            button_row_div.add(change_instructions_button)
            button_row_div.add(add_instructions_from_template_button)
            button_row_div.add(change_title_button)
            button_row_div.add(change_pipeline_button)
            button_row_div.add(add_tasks_from_pipeline_wdg)
            button_row_div.add(add_task_button)
            button_row_div.add(note_button)

            component_div.add(button_row_div)

            tasks = component.get_all_children('sthpw/task')

            component_task_div = DivWdg()
            component_task_div.add_style('width', '{0}px'.format(width - 10))
            component_task_div.add_style('margin-left', '10px')

            # If there are tasks associated with the component, add them as a sub-list below it
            if tasks:
                task_list = DivWdg()

                for task in sorted(tasks, key=lambda x: x.get_code()):
                    task_div = DivWdg()
                    task_div.add(self.get_task_div(task))
                    task_list.add(task_div)

                component_task_div.add(task_list)

            component_outer_div = DivWdg()
            component_outer_div.add(component_div)
            component_outer_div.add(component_task_div)

            components_list.add(component_outer_div)

        return components_list
Exemplo n.º 21
0
    def get_package_task_div(self, task):
        """
            Take a task object and set up the Div to display it.

            :param task: sthpw/task object
            :return: DivWdg
            """

        task_div = DivWdg()
        task_div.add_style('display', 'inline-block')
        task_div.add_style('background-color', '#F2F2F2')
        task_div.add_style('padding-left', '10px')
        task_div.add_style('padding-top', '10px')
        task_div.add_style('border-radius', '10px')
        task_div.add_style('width', '90%')

        process_div = DivWdg()
        process_div.add_style('font-weight', 'bold')
        process_div.add(task.get('process'))

        code_div = DivWdg()
        code_div.add('Code: {0}'.format(task.get_code()))

        status_div = DivWdg()
        status_span = SpanWdg()
        status = task.get('status')
        status_span.add(status)

        if status in obu.TASK_COLORS.keys():
            status_span.add_style('color', obu.TASK_COLORS.get(status))

        status_div.add('Status: ')
        status_div.add(status_span)

        assigned_div = DivWdg()
        assigned_div.add_style('font-style', 'italic')
        assigned = task.get('assigned')

        if assigned:
            assigned_div.add('Assigned to: ' + assigned)
        else:
            assigned_div.add('Not yet assigned')

        department_div = DivWdg()
        department_div.add_style('font-style', 'italic')
        department = obu.get_assigned_group_from_task(task)

        if department:
            department_div.add('Department: ' + department)
        else:
            department_div.add('No department assigned')

        task_data_div = get_task_data_div(task.get_code())

        instructions_button = ButtonNewWdg(title='Instructions',
                                           icon='CONTENTS')
        instructions_button.add_behavior(
            obu.load_task_instructions_behavior(task.get_search_key()))
        instructions_button.add_style('display', 'inline-block')

        inspect_button = ButtonNewWdg(title='Inspect', icon='WORK')
        inspect_button.add_behavior(
            obu.load_task_inspect_widget(task.get_search_key()))
        inspect_button.add_style('display', 'inline-block')

        note_button = ButtonNewWdg(title='Add Note', icon='NOTE')
        note_button.add_behavior(
            obu.get_add_notes_behavior(task.get_search_key()))
        note_button.add_style('display', 'inline-block')

        task_div.add(process_div)
        task_div.add(code_div)
        task_div.add(status_div)
        task_div.add(assigned_div)
        task_div.add(department_div)
        task_div.add(task_data_div)
        task_div.add(instructions_button)
        task_div.add(inspect_button)
        task_div.add(note_button)

        return task_div
Exemplo n.º 22
0
    def setup_html_list_for_packages_in_orders(self, width=600):
        """
        Add the packages that go into the order to an HTML style unordered list

        :return: HtmlElement.ul containing the packages
        """

        packages_list = HtmlElement.ul()
        packages_list.add_style('list-style-type', 'none')
        packages_list.add_style('margin-left', '10px')
        packages_list.add_style('padding-left', '0px')

        for package in obu.get_packages_from_order(
                self.order_sobject.get_code()):
            package_div = DivWdg()
            package_div.add_style('background-color', '#d9edf7')
            package_div.add_style('padding', '10px')
            package_div.add_style('border-radius', '10px')

            package_name_div = DivWdg()
            package_name_div.add_style('font-weight', 'bold')
            package_name_div.add(package.get('name'))

            package_code_div = DivWdg()
            package_code_div.add('Code: {0}'.format(package.get_code()))

            package_description_div = DivWdg()
            package_description_div.add_style('font-style', 'italic')
            package_description_div.add(package.get('description'))

            package_platform_div = DivWdg()
            connection_status_div = DivWdg()
            platform_code = package.get('platform_code')

            if platform_code:
                platform = get_sobject_by_code('twog/platform', platform_code)

                if platform:
                    package_platform_div.add('Platform: {0}'.format(
                        platform.get('name')))

                    platform_connection = get_platform_connection_by_package_sobject(
                        package)

                    if platform_connection:
                        platform_connection_status = platform_connection.get(
                            'connection_status')

                        connection_status_text_span = SpanWdg()
                        connection_status_text_span.add(
                            platform_connection_status.title())

                        if platform_connection_status == 'disconnected':
                            connection_status_text_span.add_style(
                                'color', 'red')
                        elif platform_connection_status == 'testing':
                            connection_status_text_span.add_style(
                                'color', '#afb332')
                        elif platform_connection_status == 'connected':
                            connection_status_text_span.add_style(
                                'color', 'green')

                        connection_status_div.add('Connection Status: ')
                        connection_status_div.add(connection_status_text_span)

            package_due_date_div = DivWdg()

            if package.get('due_date'):
                package_due_date_div.add('Due: {0}'.format(
                    package.get('due_date')))

            package_delivery_task_div = DivWdg()
            package_delivery_task = get_delivery_task_for_package(package)

            if package_delivery_task:
                package_delivery_task_div.add('Delivery Status: {0}'.format(
                    package_delivery_task.get('status')))

            package_instructions_div = DivWdg()
            package_instructions_code = package.get(
                'package_instructions_code')

            if package_instructions_code:
                package_instructions = get_sobject_by_code(
                    'twog/package_instructions', package_instructions_code)

                package_instructions_name = package_instructions.get('name')

                package_instructions_div.add(
                    'Instructions: {0}'.format(package_instructions_name))
            else:
                package_instructions_div.add('Instructions have not been set.')

            package_pipeline_div = DivWdg()
            package_pipeline_name = get_sobject_name_by_code(
                'sthpw/pipeline', package.get('pipeline_code'))

            if package_pipeline_name:
                package_pipeline_div.add(
                    'Pipeline: <i>{0}</i>'.format(package_pipeline_name))
            else:
                package_pipeline_div.add('<i>No Pipeline Assigned</i>')

            change_pipeline_button = ButtonNewWdg(title='Change Pipeline',
                                                  icon='PIPELINE')
            change_pipeline_button.add_behavior(
                obu.get_load_popup_widget_with_reload_behavior(
                    'Change Pipeline', 'widgets.AssignPipelineWdg',
                    package.get_search_key(), 'Order Builder',
                    'order_builder.OrderBuilderWdg',
                    self.order_sobject.get_search_key()))
            change_pipeline_button.add_style('display', 'inline-block')

            change_instructions_button = ButtonNewWdg(
                title='Change Instructions', icon='DOCUMENTATION')
            change_instructions_button.add_behavior(
                obu.get_load_popup_widget_with_reload_behavior(
                    'Change Instructions',
                    'widgets.ChangePackageInstructionsWdg',
                    package.get_search_key(), 'Order Builder',
                    'order_builder.OrderBuilderWdg',
                    self.order_sobject.get_search_key()))
            change_instructions_button.add_style('display', 'inline-block')

            add_tasks_from_pipeline_wdg = ButtonNewWdg(
                title='Add Tasks from Pipeline', icon='INSERT_MULTI')
            add_tasks_from_pipeline_wdg.add_behavior(
                get_load_assign_tasks_wdg(package.get_search_key()))
            add_tasks_from_pipeline_wdg.add_style('display', 'inline-block')

            note_button = ButtonNewWdg(title='Add Note', icon='NOTE')
            note_button.add_behavior(
                obu.get_add_notes_behavior(package.get_search_key()))
            note_button.add_style('display', 'inline-block')

            button_row_div = SpanWdg()
            button_row_div.add_style('display', 'inline-block')
            button_row_div.add(change_pipeline_button)
            button_row_div.add(change_instructions_button)
            button_row_div.add(add_tasks_from_pipeline_wdg)
            button_row_div.add(note_button)

            package_div.add(package_name_div)
            package_div.add(package_code_div)
            package_div.add(package_description_div)
            package_div.add(package_pipeline_div)
            package_div.add(package_instructions_div)
            package_div.add(package_due_date_div)
            package_div.add(package_delivery_task_div)
            package_div.add(package_platform_div)
            package_div.add(connection_status_div)

            files_in_package_sobjects = get_file_in_package_sobjects_by_package_code(
                package.get_code())
            files_in_package_list = get_files_for_package(package.get_code())

            if files_in_package_list:
                package_div.add(
                    widgets.html_widgets.get_label_widget(
                        'Deliverable Files:'))

                unordered_html_list = HtmlElement.ul()

                for file_sobject, file_in_package_sobject in zip(
                        files_in_package_list, files_in_package_sobjects):
                    li = HtmlElement.li()

                    task_status = get_file_in_package_status(
                        file_in_package_sobject)
                    text = file_sobject.get(
                        'file_path') + ' - Status: ' + task_status

                    li.add(text)
                    unordered_html_list.add(li)

                    package_div.add(unordered_html_list)

            package_div.add(button_row_div)

            tasks = package.get_all_children('sthpw/task')

            package_task_div = DivWdg()
            package_task_div.add_style('width', '{0}px'.format(width - 10))
            package_task_div.add_style('margin-left', '10px')

            # If there are tasks associated with the component, add them as a sub-list below it
            if tasks:
                task_list = DivWdg()

                for task in sorted(tasks, key=lambda x: x.get_code()):
                    task_div = DivWdg()
                    task_div.add(self.get_package_task_div(task))
                    task_list.add(task_div)

                package_task_div.add(task_list)

            package_outer_div = DivWdg()
            package_outer_div.add(package_div)
            package_outer_div.add(package_task_div)

            package_list_div = DivWdg()
            package_list_div.add(package_outer_div)

            packages_list.add(package_list_div)

        return packages_list
Exemplo n.º 23
0
    def set_row(self, order, table, counter, header_groups, tasks):
        order_name = order.get('name')
        order_code = order.get('code')
        division_code = order.get('division_code')
        due_date = order.get('due_date')

        order_table = Table()
        order_table.add_style('width', '100%')

        name_row = order_table.add_row()
        name_row.add_style('font-size', '14px')
        name_row.add_style('font-weight', 'bold')

        name_data = '<span style="color: #FF0000">{0}.</span> <u>{1}</u>'.format(counter, order_name)

        order_table.add_cell(data=name_data, row=name_row, css='order-row')

        code_row = order_table.add_row()
        code_row.add_style('font-size', '12px')

        code_cell = order_table.add_cell(data='<strong>Order code:</strong> {0}'.format(order_code), row=code_row)
        code_cell.add_style('padding-top', '3px')
        code_cell.add_style('padding-bottom', '3px')
        code_cell.add_style('padding-left', '3px')

        division_row = order_table.add_row()

        division_search = Search('twog/division')
        division_search.add_code_filter(division_code)
        division = division_search.get_sobject()

        # TODO: Find the division image
        division_data = '<b>Division:</b> {0}'.format(division.get('name'))

        order_table.add_cell(data=division_data, row=division_row)

        date_row = order_table.add_row()
        due_date_data = '<b>Due:</b> {0}'.format(due_date)
        order_table.add_cell(data=due_date_data, row=date_row)

        # Add the buttons for the Order
        button_row = order_table.add_row()

        order_builder_button = ButtonNewWdg(title='Order Builder', icon='WORK')
        order_builder_button.add_behavior(get_order_builder_launch_behavior(order.get('__search_key__')))

        note_button = ButtonNewWdg(title='Add Note', icon='NOTE')
        note_button.add_behavior(get_add_notes_behavior(order.get('__search_key__')))
        note_button.add_style('display', 'inline-block')

        order_table.add_cell(data=order_builder_button, row=button_row)
        order_table.add_cell(data=note_button, row=button_row)

        current_row = table.add_row()
        current_row.add_style('width', '100%')
        current_row.add_style('vertical-align', 'top')

        order_cell_background_color = '#D7D7D7'

        order_cell = table.add_cell(order_table, row=current_row)
        order_cell.add_style('background-color', order_cell_background_color)
        order_cell.add_style('border', '1px solid #EEE')
        order_cell.add_style('padding', '4px')
        order_cell.add_style('width', '24%')

        for column in header_groups:
            if tasks:
                column_tasks = tasks.get(column)
            else:
                column_tasks = []

            if column_tasks:
                task_table = Table()
                task_table.add_style('width', '100%')
                task_table.add_style('font-size', '10px')

                for task in column_tasks:
                    current_task_row = task_table.add_row()
                    current_task_row.add_style('background-color',
                                               self.TASK_COLOR_DICT.get(task.get_value('status').lower(), '#FFFFFF'))
                    current_task_row.add_style('padding', '3px')
                    current_task_row.add_style('min-height', '20px')
                    current_task_row.add_style('border-top-left-radius', '10px')
                    current_task_row.add_style('border-bottom-left-radius', '10px')

                    inspect_button = ButtonNewWdg(title='Task Inspect', icon='WORK')
                    inspect_button.add_behavior(get_load_popup_widget_behavior('Task Inspect',
                                                                               'widgets.TaskInspectWdg',
                                                                               task.get_search_key(),
                                                                               width=600, height=600))
                    task_table.add_cell(data=inspect_button, row=current_task_row)

                    # Each task in the row will have the following properties to be displayed
                    cell_names = ['process', 'status']

                    # Add each property from left to right in the current task row. Abbreviate the text to make it
                    # fit better
                    for cell_name in cell_names:
                        task_table.add_cell(data=abbreviate_text(task.get_value(cell_name), 15), row=current_task_row)

                row_cell = table.add_cell(task_table)
                row_cell.add_style('border', '1px solid #EEE')
                row_cell.add_style('vertical-align', 'top')
                row_cell.add_style('width', '{0}%'.format(76.0 / len(header_groups)))
            else:
                table.add_cell()
Exemplo n.º 24
0
    def get_display(my):

        my.search_key = my.kwargs.get("search_key")
        my.process = my.kwargs.get("process")
        my.sobject = Search.get_by_search_key(my.search_key)
        my.pipeline_code = my.kwargs.get("pipeline_code")

        top = DivWdg()
        top.add_class("spt_file_selector")
        top.add_style("position: relative")

        hidden = HiddenWdg("mode")
        #hidden = TextWdg("mode")
        hidden.add_class("spt_mode")
        top.add(hidden)

        top.add_style("padding: 5px")
        top.add_style("min-width: 500px")
        top.add_style("min-height: 400px")
        top.add_color("background", "background")
        top.add_color("color", "color")
        #top.add_border()

        logo_wdg = DivWdg()
        logo = HtmlElement.img(src="/context/icons/logo/perforce_logo.gif")
        logo_wdg.add(logo)
        top.add(logo_wdg)
        logo_wdg.add_style("opacity: 0.2")
        logo_wdg.add_style("position: absolute")
        logo_wdg.add_style("bottom: 0px")
        logo_wdg.add_style("right: 5px")

        # get some info from the config file
        """
        client_env_var = Config.get_value("perforce", "client_env_var")
        if not client_env_var:
            client_env_var = "P4Client"
        port_env_var = Config.get_value("perforce", "port_env_var")
        if not port_env_var:
            port_env_var = "P4Port"
        user_env_var = Config.get_value("perforce", "user_env_var")
        if not user_env_var:
            user_env_var = "P4User"
        password_env_var = Config.get_value("perforce", "password_env_var")
        if not password_env_var:
            password_env_var = "P4Passwd"
        """

        # {GET(sthpw/login)}_user
        host = ""
        client = ""
        user = ""
        password = ""
        port = ""

        project = my.sobject.get_project()
        depot = project.get_value("location", no_exception=True)
        if not depot:
            depot = ""

        top.add_behavior({
            'type': 'load',
            #'client_env_var': client_env_var,
            #'port_env_var': port_env_var,
            #'user_env_var': user_env_var,
            #'password_env_var': password_env_var,
            'client': client,
            'user': user,
            'password': password,
            'host': host,
            'port': port,
            'depot': depot,
            'cbjs_action': get_onload_js()
        })

        list_wdg = DivWdg()
        top.add(list_wdg)
        list_wdg.add_style("height: 32px")

        from tactic.ui.widget import SingleButtonWdg, ButtonNewWdg, ButtonRowWdg

        button_row = ButtonRowWdg()
        list_wdg.add(button_row)
        button_row.add_style("float: left")

        button = ButtonNewWdg(title="Refresh",
                              icon=IconWdg.REFRESH,
                              long=False)
        button_row.add(button)
        button.add_style("float: left")
        button.add_behavior({
            'type':
            'click_up',
            'cbjs_action':
            '''
        spt.app_busy.show("Reading file system ...")
        var top = bvr.src_el.getParent(".spt_checkin_top");
        spt.panel.refresh(top);
        spt.app_busy.hide();
        '''
        })

        button = ButtonNewWdg(title="Check-out",
                              icon=IconWdg.CHECK_OUT,
                              long=False)
        button_row.add(button)

        my.sandbox_dir = my.kwargs.get("sandbox_dir")

        # what are we trying to do here???
        #my.root_sandbox_dir = Environment.get_sandbox_dir()
        #project = my.sobject.get_project()
        #my.root_sandbox_dir = "%s/%s" % (my.root_sandbox_dir, project.get_code())
        #repo_dir = my.sandbox_dir.replace("%s/" % my.root_sandbox_dir, "")
        #repo_dir = "%s/%s" % (project.get_code(), repo_dir)

        # checkout command requires either starting with //<depot>/ or just
        # the relative path to the root.  The following removes
        # the root of the sandbox folder assuming that this is mapped
        # to the base of the depot
        my.root_sandbox_dir = Environment.get_sandbox_dir()
        repo_dir = my.sandbox_dir
        repo_dir = my.sandbox_dir.replace("%s/" % my.root_sandbox_dir, "")

        #button.add_style("padding-right: 14px")
        button.add_style("float: left")
        button.add_behavior({
            'type':
            'click_up',
            'repo_dir':
            repo_dir,
            'cbjs_action':
            '''
        var top = bvr.src_el.getParent(".spt_checkin_top");
        spt.app_busy.show("Reading file system ...")

        var data = spt.scm.checkout(bvr.repo_dir)
        spt.panel.refresh(top);

        spt.app_busy.hide();
        '''
        })

        button = ButtonNewWdg(title="Perforce Actions",
                              icon=IconWdg.PERFORCE,
                              show_arrow=True)
        #button.set_show_arrow_menu(True)
        button_row.add(button)

        menu = Menu(width=220)
        menu_item = MenuItem(type='title', label='Perforce')
        menu.add(menu_item)

        menu_item = MenuItem(type='action', label='Show Workspaces')
        menu.add(menu_item)
        menu_item.add_behavior({
            'type':
            'click_up',
            'cbjs_action':
            '''
            var activator = spt.smenu.get_activator(bvr);

            var class_name = 'tactic.ui.checkin.WorkspaceWdg';
            var top = activator.getParent(".spt_checkin_top");
            var content = top.getElement(".spt_checkin_content");

            var el = top.getElement(".spt_mode");
            el.value = "workspace";

            var kwargs = {};
            spt.panel.load(content, class_name, kwargs);
            '''
        })

        menu_item = MenuItem(type='action', label='Show Changelists')
        menu.add(menu_item)
        menu_item.add_behavior({
            'type':
            'click_up',
            'cbjs_action':
            '''
            var activator = spt.smenu.get_activator(bvr);

            var class_name = 'tactic.ui.checkin.ChangelistWdg';
            var top = activator.getParent(".spt_checkin_top");
            var content = top.getElement(".spt_checkin_content");

            var el = top.getElement(".spt_mode");
            el.value = "changelist";

            var kwargs = {};
            spt.panel.load(content, class_name, kwargs);
            '''
        })

        menu_item = MenuItem(type='action', label='Show Branches')
        menu.add(menu_item)
        menu_item.add_behavior({
            'type':
            'click_up',
            'cbjs_action':
            '''
            var activator = spt.smenu.get_activator(bvr);

            var class_name = 'tactic.ui.checkin.branch_wdg.BranchWdg';
            var top = activator.getParent(".spt_checkin_top");
            var content = top.getElement(".spt_checkin_content");

            var el = top.getElement(".spt_mode");
            el.value = "branch";

            var kwargs = {};
            spt.panel.load(content, class_name, kwargs);
            '''
        })

        menu_item = MenuItem(type='title', label='Actions')
        menu.add(menu_item)
        menu_item = MenuItem(type='action', label='Add New Changelist')
        menu.add(menu_item)

        menu_item.add_behavior({
            'type':
            'load',
            'cbjs_action':
            '''
            var activator = spt.smenu.get_activator(bvr);
            spt.scm.run("add_changelist", ["New Changelist"]);

            var class_name = 'tactic.ui.checkin.ChangelistWdg';
            var top = activator.getParent(".spt_checkin_top");
            var content = top.getElement(".spt_checkin_content");
            spt.panel.load(content, class_name);

            '''
        })

        menu_item = MenuItem(type='separator')
        menu.add(menu_item)

        menu_item = MenuItem(type='action', label='Sign Out of Perforce')
        menu.add(menu_item)

        menu_item.add_behavior({
            'type':
            'load',
            'cbjs_action':
            '''

            if (!confirm("Are you sure you wish to sign out of Perforce?")) {
                return;
            }
            spt.scm.signout_user();

            var activator = spt.smenu.get_activator(bvr);
            var top = activator.getParent(".spt_checkin_top");
            spt.panel.refresh(top);


            '''
        })

        #SmartMenu.add_smart_menu_set( button.get_arrow_wdg(), { 'BUTTON_MENU': menu } )
        #SmartMenu.assign_as_local_activator( button.get_arrow_wdg(), "BUTTON_MENU", True )

        SmartMenu.add_smart_menu_set(button.get_button_wdg(),
                                     {'BUTTON_MENU': menu})
        SmartMenu.assign_as_local_activator(button.get_button_wdg(),
                                            "BUTTON_MENU", True)

        # Perforce script editor. (nice because it should run as the user
        # in the appopriate environment
        """
        button = ButtonNewWdg(title="P4 Script Editor", icon=IconWdg.CREATE, show_arrow=True)
        #button_row.add(button)
        button.add_style("padding-right: 14px")
        button.add_style("float: left")
        """

        button = ButtonNewWdg(title="Changelists Counter",
                              icon=IconWdg.CHECK_OUT_SM,
                              show_arrow=True)
        #button_row.add(button)
        #button.add_style("padding-right: 14px")
        button.add_style("float: left")
        button.add_behavior({
            'type':
            'click_up',
            'cbjs_action':
            '''
                // find any changelists that were missed
                var changelists = spt.scm.run("get_changelists", []);
                for (var i = 0; i < changelists.length; i++) {
                    var changelist = changelists[i];
                    var info = spt.scm.run("get_changelist_info",[changelist.change]);
                    console.log(info);
                }
                '''
        })

        # Hiding this for now

        button = ButtonNewWdg(title="Create",
                              icon=IconWdg.NEW,
                              show_arrow=True)
        #button_row.add(button)
        button.add_style("padding-right: 14px")
        button.add_style("float: left")

        menu = Menu(width=220)
        menu_item = MenuItem(type='title', label='New ...')
        menu.add(menu_item)

        menu_item = MenuItem(type='action', label='Text File')
        menu.add(menu_item)
        menu_item.add_behavior({
            'type':
            'click_up',
            'sandbox_dir':
            my.sandbox_dir,
            'cbjs_action':
            '''
        var path = bvr.sandbox_dir + "/" + "new_text_file.txt";
        var env = spt.Environment.get();
        var url = env.get_server_url() + "/context/VERSION_API";
        var applet = spt.Applet.get();
        applet.download_file(url, path);

        var activator = spt.smenu.get_activator(bvr);
        var top = activator.getParent(".spt_checkin_top");
        spt.panel.refresh(top);

        '''
        })

        #create_sobj = SObject.create("sthpw/virtual")
        #create_sobj.set_value("title", "Maya Project")
        #create_sobj.set_value("script_path", "create/maya_project")

        script_path = 'create/maya_project'
        menu_item = MenuItem(type='action', label='Maya Project')
        menu.add(menu_item)
        menu_item.add_behavior({
            'type':
            'click_up',
            'sandbox_dir':
            my.sandbox_dir,
            'process':
            my.process,
            'script_path':
            script_path,
            'cbjs_action':
            '''
        var script = spt.CustomProject.get_script_by_path(bvr.script_path);
        var options = {};
        options.script = script;

        // add some data to options
        options.sandbox_dir = bvr.sandbox_dir;
        options.process = bvr.process;
        spt.CustomProject.exec_custom_script({}, options);

        var activator = spt.smenu.get_activator(bvr);
        var top = activator.getParent(".spt_checkin_top");
        spt.panel.refresh(top);
        '''
        })

        template_path = '/context/template/maya_project.zip'
        menu_item = MenuItem(type='action', label='Zipped Template')
        menu.add(menu_item)
        menu_item.add_behavior({
            'type':
            'click_up',
            'sandbox_dir':
            my.sandbox_dir,
            'template_path':
            template_path,
            'cbjs_action':
            '''
        var path = bvr.sandbox_dir + "/" + "_template.zip";
        var env = spt.Environment.get();
        var url = env.get_server_url() + bvr.template_path;
        var applet = spt.Applet.get();
        applet.download_file(url, path);
        applet.unzip_file(path, bvr.sandbox_dir);
        applet.rmtree(path);

        var activator = spt.smenu.get_activator(bvr);
        var top = activator.getParent(".spt_checkin_top");
        spt.panel.refresh(top);

        '''
        })

        SmartMenu.add_smart_menu_set(button, {'BUTTON_MENU': menu})
        SmartMenu.assign_as_local_activator(button, "BUTTON_MENU", True)

        # Browse button for browsing files and dirs directly
        """
        browse_div = DivWdg()
        list_wdg.add(browse_div)
        browse_div.add_style("float: left")

        button = ActionButtonWdg(title="Browse", tip="Select Files or Folder to Check-In")
        browse_div.add(button)

        behavior = {
        'type': 'click_up',
        'base_dir': my.sandbox_dir,
        'cbjs_action': '''
            var current_dir = bvr.base_dir;
            var is_sandbox = false;
            spt.checkin.browse_folder(current_dir, is_sandbox);
        '''
        }
        button.add_behavior( behavior )
        """

        from tactic.ui.widget import SandboxButtonWdg, CheckoutButtonWdg, ExploreButtonWdg, GearMenuButtonWdg

        button_row = ButtonRowWdg()
        list_wdg.add(button_row)
        button_row.add_style("float: right")

        #button = SandboxButtonWdg(base_dir=my.sandbox_dir, process=my.process)
        #button_row.add(button)

        #button = CheckoutButtonWdg(base_dir=my.sandbox_dir, sobject=my.sobject, proces=my.process)
        #button_row.add(button)

        button = ExploreButtonWdg(base_dir=my.sandbox_dir)
        button_row.add(button)

        button = GearMenuButtonWdg(base_dir=my.sandbox_dir,
                                   process=my.process,
                                   pipeline_code=my.pipeline_code)
        button_row.add(button)

        list_wdg.add("<br clear='all'/>")

        top.add("<hr/>")

        content_div = DivWdg()
        top.add(content_div)
        content_div.add_class("spt_checkin_content")

        content = my.get_content_wdg()
        content_div.add(content)

        return top
Exemplo n.º 25
0
    def get_display(my):

        my.search_key = my.kwargs.get("search_key")
        my.process = my.kwargs.get("process")
        my.sobject = Search.get_by_search_key(my.search_key)
        my.pipeline_code = my.kwargs.get("pipeline_code")

        top = DivWdg()
        top.add_class("spt_file_selector")
        top.add_style("position: relative")


        hidden = HiddenWdg("mode")
        #hidden = TextWdg("mode")
        hidden.add_class("spt_mode")
        top.add(hidden)



        top.add_style("padding: 5px")
        top.add_style("min-width: 500px")
        top.add_style("min-height: 400px")
        top.add_color("background", "background")
        top.add_color("color", "color")
        #top.add_border()


        logo_wdg = DivWdg()
        logo = HtmlElement.img(src="/context/icons/logo/perforce_logo.gif")
        logo_wdg.add(logo)
        top.add(logo_wdg)
        logo_wdg.add_style("opacity: 0.2")
        logo_wdg.add_style("position: absolute")
        logo_wdg.add_style("bottom: 0px")
        logo_wdg.add_style("right: 5px")



        # get some info from the config file
        """
        client_env_var = Config.get_value("perforce", "client_env_var")
        if not client_env_var:
            client_env_var = "P4Client"
        port_env_var = Config.get_value("perforce", "port_env_var")
        if not port_env_var:
            port_env_var = "P4Port"
        user_env_var = Config.get_value("perforce", "user_env_var")
        if not user_env_var:
            user_env_var = "P4User"
        password_env_var = Config.get_value("perforce", "password_env_var")
        if not password_env_var:
            password_env_var = "P4Passwd"
        """

        # {GET(sthpw/login)}_user
        host = ""
        client = ""
        user = ""
        password = ""
        port = ""

        project = my.sobject.get_project()
        depot = project.get_value("location", no_exception=True)
        if not depot:
            depot = ""


        top.add_behavior( {
            'type': 'load',
            #'client_env_var': client_env_var,
            #'port_env_var': port_env_var,
            #'user_env_var': user_env_var,
            #'password_env_var': password_env_var,
            'client': client,
            'user': user,
            'password': password,
            'host': host,
            'port': port,
            'depot': depot,
            'cbjs_action': get_onload_js()
        } )


        list_wdg = DivWdg()
        top.add(list_wdg)
        list_wdg.add_style("height: 32px")

        from tactic.ui.widget import SingleButtonWdg, ButtonNewWdg, ButtonRowWdg

        button_row = ButtonRowWdg()
        list_wdg.add(button_row)
        button_row.add_style("float: left")

        button = ButtonNewWdg(title="Refresh", icon=IconWdg.REFRESH, long=False)
        button_row.add(button)
        button.add_style("float: left")
        button.add_behavior( {
        'type': 'click_up',
        'cbjs_action': '''
        spt.app_busy.show("Reading file system ...")
        var top = bvr.src_el.getParent(".spt_checkin_top");
        spt.panel.refresh(top);
        spt.app_busy.hide();
        '''
        } )



        button = ButtonNewWdg(title="Check-out", icon=IconWdg.CHECK_OUT, long=False)
        button_row.add(button)

        my.sandbox_dir = my.kwargs.get("sandbox_dir")



        # what are we trying to do here???
        #my.root_sandbox_dir = Environment.get_sandbox_dir()
        #project = my.sobject.get_project()
        #my.root_sandbox_dir = "%s/%s" % (my.root_sandbox_dir, project.get_code())
        #repo_dir = my.sandbox_dir.replace("%s/" % my.root_sandbox_dir, "")
        #repo_dir = "%s/%s" % (project.get_code(), repo_dir)




        # checkout command requires either starting with //<depot>/ or just
        # the relative path to the root.  The following removes
        # the root of the sandbox folder assuming that this is mapped
        # to the base of the depot
        my.root_sandbox_dir = Environment.get_sandbox_dir()
        repo_dir = my.sandbox_dir
        repo_dir = my.sandbox_dir.replace("%s/" % my.root_sandbox_dir, "")



        #button.add_style("padding-right: 14px")
        button.add_style("float: left")
        button.add_behavior( {
        'type': 'click_up',
        'repo_dir': repo_dir,
        'cbjs_action': '''
        var top = bvr.src_el.getParent(".spt_checkin_top");
        spt.app_busy.show("Reading file system ...")

        var data = spt.scm.checkout(bvr.repo_dir)
        spt.panel.refresh(top);

        spt.app_busy.hide();
        '''
        } )





        button = ButtonNewWdg(title="Perforce Actions", icon=IconWdg.PERFORCE, show_arrow=True)
        #button.set_show_arrow_menu(True)
        button_row.add(button)

        menu = Menu(width=220)
        menu_item = MenuItem(type='title', label='Perforce')
        menu.add(menu_item)

        menu_item = MenuItem(type='action', label='Show Workspaces')
        menu.add(menu_item)
        menu_item.add_behavior( {
            'type': 'click_up',
            'cbjs_action': '''
            var activator = spt.smenu.get_activator(bvr);

            var class_name = 'tactic.ui.checkin.WorkspaceWdg';
            var top = activator.getParent(".spt_checkin_top");
            var content = top.getElement(".spt_checkin_content");

            var el = top.getElement(".spt_mode");
            el.value = "workspace";

            var kwargs = {};
            spt.panel.load(content, class_name, kwargs);
            '''
        } )





        menu_item = MenuItem(type='action', label='Show Changelists')
        menu.add(menu_item)
        menu_item.add_behavior( {
            'type': 'click_up',
            'cbjs_action': '''
            var activator = spt.smenu.get_activator(bvr);

            var class_name = 'tactic.ui.checkin.ChangelistWdg';
            var top = activator.getParent(".spt_checkin_top");
            var content = top.getElement(".spt_checkin_content");

            var el = top.getElement(".spt_mode");
            el.value = "changelist";

            var kwargs = {};
            spt.panel.load(content, class_name, kwargs);
            '''
        } )



        menu_item = MenuItem(type='action', label='Show Branches')
        menu.add(menu_item)
        menu_item.add_behavior( {
            'type': 'click_up',
            'cbjs_action': '''
            var activator = spt.smenu.get_activator(bvr);

            var class_name = 'tactic.ui.checkin.branch_wdg.BranchWdg';
            var top = activator.getParent(".spt_checkin_top");
            var content = top.getElement(".spt_checkin_content");

            var el = top.getElement(".spt_mode");
            el.value = "branch";

            var kwargs = {};
            spt.panel.load(content, class_name, kwargs);
            '''
        } )


        menu_item = MenuItem(type='title', label='Actions')
        menu.add(menu_item)
        menu_item = MenuItem(type='action', label='Add New Changelist')
        menu.add(menu_item)

        menu_item.add_behavior( {
            'type': 'load',
            'cbjs_action': '''
            var activator = spt.smenu.get_activator(bvr);
            spt.scm.run("add_changelist", ["New Changelist"]);

            var class_name = 'tactic.ui.checkin.ChangelistWdg';
            var top = activator.getParent(".spt_checkin_top");
            var content = top.getElement(".spt_checkin_content");
            spt.panel.load(content, class_name);

            '''
        } )


        menu_item = MenuItem(type='separator')
        menu.add(menu_item)

        menu_item = MenuItem(type='action', label='Sign Out of Perforce')
        menu.add(menu_item)

        menu_item.add_behavior( {
            'type': 'load',
            'cbjs_action': '''

            if (!confirm("Are you sure you wish to sign out of Perforce?")) {
                return;
            }
            spt.scm.host = null;
            spt.scm.user = null;
            spt.scm.password = null;

            var activator = spt.smenu.get_activator(bvr);
            var top = activator.getParent(".spt_checkin_top");
            spt.panel.refresh(top);


            '''
        } )



 
        #SmartMenu.add_smart_menu_set( button.get_arrow_wdg(), { 'BUTTON_MENU': menu } )
        #SmartMenu.assign_as_local_activator( button.get_arrow_wdg(), "BUTTON_MENU", True )

        SmartMenu.add_smart_menu_set( button.get_button_wdg(), { 'BUTTON_MENU': menu } )
        SmartMenu.assign_as_local_activator( button.get_button_wdg(), "BUTTON_MENU", True )




        # Perforce script editor. (nice because it should run as the user
        # in the appopriate environment
        """
        button = ButtonNewWdg(title="P4 Script Editor", icon=IconWdg.CREATE, show_arrow=True)
        #button_row.add(button)
        button.add_style("padding-right: 14px")
        button.add_style("float: left")
        """



        button = ButtonNewWdg(title="Changelists Counter", icon=IconWdg.CHECK_OUT_SM, show_arrow=True)
        #button_row.add(button)
        #button.add_style("padding-right: 14px")
        button.add_style("float: left")
        button.add_behavior( {
            'type': 'click_up',
            'cbjs_action': '''
                // find any changelists that were missed
                var changelists = spt.scm.run("get_changelists", []);
                for (var i = 0; i < changelists.length; i++) {
                    var changelist = changelists[i];
                    var info = spt.scm.run("get_changelist_info",[changelist.change]);
                    console.log(info);
                }
                '''
            } )



        # Hiding this for now

        button = ButtonNewWdg(title="Create", icon=IconWdg.NEW, show_arrow=True)
        #button_row.add(button)
        button.add_style("padding-right: 14px")
        button.add_style("float: left")

        menu = Menu(width=220)
        menu_item = MenuItem(type='title', label='New ...')
        menu.add(menu_item)


        menu_item = MenuItem(type='action', label='Text File')
        menu.add(menu_item)
        menu_item.add_behavior( {
        'type': 'click_up',
        'sandbox_dir': my.sandbox_dir,
        'cbjs_action': '''
        var path = bvr.sandbox_dir + "/" + "new_text_file.txt";
        var env = spt.Environment.get();
        var url = env.get_server_url() + "/context/VERSION_API";
        var applet = spt.Applet.get();
        applet.download_file(url, path);

        var activator = spt.smenu.get_activator(bvr);
        var top = activator.getParent(".spt_checkin_top");
        spt.panel.refresh(top);

        '''
        } )


        #create_sobj = SObject.create("sthpw/virtual")
        #create_sobj.set_value("title", "Maya Project")
        #create_sobj.set_value("script_path", "create/maya_project")


        script_path = 'create/maya_project'
        menu_item = MenuItem(type='action', label='Maya Project')
        menu.add(menu_item)
        menu_item.add_behavior( {
        'type': 'click_up',
        'sandbox_dir': my.sandbox_dir,
        'process': my.process,
        'script_path': script_path,
        'cbjs_action': '''
        var script = spt.CustomProject.get_script_by_path(bvr.script_path);
        var options = {};
        options.script = script;

        // add some data to options
        options.sandbox_dir = bvr.sandbox_dir;
        options.process = bvr.process;
        spt.CustomProject.exec_custom_script({}, options);

        var activator = spt.smenu.get_activator(bvr);
        var top = activator.getParent(".spt_checkin_top");
        spt.panel.refresh(top);
        '''
        } )


        template_path = '/context/template/maya_project.zip'
        menu_item = MenuItem(type='action', label='Zipped Template')
        menu.add(menu_item)
        menu_item.add_behavior( {
        'type': 'click_up',
        'sandbox_dir': my.sandbox_dir,
        'template_path': template_path,
        'cbjs_action': '''
        var path = bvr.sandbox_dir + "/" + "_template.zip";
        var env = spt.Environment.get();
        var url = env.get_server_url() + bvr.template_path;
        var applet = spt.Applet.get();
        applet.download_file(url, path);
        applet.unzip_file(path, bvr.sandbox_dir);
        applet.rmtree(path);

        var activator = spt.smenu.get_activator(bvr);
        var top = activator.getParent(".spt_checkin_top");
        spt.panel.refresh(top);

        '''
        } )



        SmartMenu.add_smart_menu_set( button, { 'BUTTON_MENU': menu } )
        SmartMenu.assign_as_local_activator( button, "BUTTON_MENU", True )



        # Browse button for browsing files and dirs directly
        """
        browse_div = DivWdg()
        list_wdg.add(browse_div)
        browse_div.add_style("float: left")

        button = ActionButtonWdg(title="Browse", tip="Select Files or Folder to Check-In")
        browse_div.add(button)

        behavior = {
        'type': 'click_up',
        'base_dir': my.sandbox_dir,
        'cbjs_action': '''
            var current_dir = bvr.base_dir;
            var is_sandbox = false;
            spt.checkin.browse_folder(current_dir, is_sandbox);
        '''
        }
        button.add_behavior( behavior )
        """

        from tactic.ui.widget import SandboxButtonWdg, CheckoutButtonWdg, ExploreButtonWdg, GearMenuButtonWdg

        button_row = ButtonRowWdg()
        list_wdg.add(button_row)
        button_row.add_style("float: right")

        #button = SandboxButtonWdg(base_dir=my.sandbox_dir, process=my.process)
        #button_row.add(button)

        #button = CheckoutButtonWdg(base_dir=my.sandbox_dir, sobject=my.sobject, proces=my.process)
        #button_row.add(button)

        button = ExploreButtonWdg(base_dir=my.sandbox_dir)
        button_row.add(button)

        button = GearMenuButtonWdg(base_dir=my.sandbox_dir, process=my.process, pipeline_code=my.pipeline_code)
        button_row.add(button)



        list_wdg.add("<br clear='all'/>")

        top.add("<hr/>")

        content_div = DivWdg()
        top.add(content_div)
        content_div.add_class("spt_checkin_content")

        content = my.get_content_wdg()
        content_div.add(content)

        return top
Exemplo n.º 26
0
    def setup_order_information(self):
        """
        Set up a div widget to go at the top of the page. It will hold information about the order, including it's
        name, the client, and PO number, if it exists.

        :return: DivWdg
        """

        order_div = DivWdg()

        # Show some information for the order at the top.
        order_name = self.order_sobject.get('name')
        order_code = self.order_sobject.get_code()
        division_name = get_sobject_name_by_code(
            'twog/division', self.order_sobject.get('division_code'))
        client_name = obu.get_client_name_from_division_code(
            self.order_sobject.get('division_code'))
        po_number = self.order_sobject.get_value('po_number') or 'None'
        description = self.order_sobject.get('description')

        due_date = self.order_sobject.get('due_date')
        expected_completion_date = self.order_sobject.get(
            'expected_completion_date')

        if due_date:
            due_date_datetime_object = datetime.strptime(
                due_date, '%Y-%m-%d %H:%M:%S')
            due_date_string = due_date_datetime_object.strftime(
                '%A, %b %d, %Y at %H:%M %p')
        else:
            due_date_string = 'Due Date not specified'

        if expected_completion_date:
            expected_completion_string = datetime_string_to_timezone_aware_string(
                expected_completion_date)
            # expected_completion_datetime_object = datetime.strptime(expected_completion_date, '%Y-%m-%d %H:%M:%S')
            # expected_completion_string = expected_completion_datetime_object.strftime('%A, %b %d, %Y at %H:%M %p')
        else:
            expected_completion_string = 'Not specified'

        order_priority = get_order_priority_relative_to_all_orders(
            self.order_sobject)
        order_priority_div = DivWdg()
        order_priority_div.add('Priority: {0}'.format(order_priority))

        order_name_div = DivWdg()
        order_name_div.add_style('text-decoration', 'underline')
        order_name_div.add_style('font-size', '24px')
        order_name_div.add(order_name)

        order_code_div = DivWdg()
        order_code_div.add('Code: ' + order_code)

        order_due_date_div = DivWdg()
        order_due_date_div.add('Due Date: ' + due_date_string)
        order_due_date_div.add_style('font-weight', 'bold')

        order_expected_completion_date_div = DivWdg()
        order_expected_completion_date_div.add('Expected Completion Date: ' +
                                               expected_completion_string)
        order_expected_completion_date_div.add_style('font-weight', 'bold')

        client_name_div = DivWdg()

        if division_name:
            client_text = 'Client: ' + division_name

            if client_name:
                client_text += ' - ' + client_name
        else:
            client_text = 'No Client Selected'

        client_name_div.add(client_text)

        po_number_div = DivWdg()
        po_number_div.add('PO Number: ' + po_number)

        description_div = DivWdg()
        description_div.add_style('font-style', 'italic')

        if description:
            description_div.add('Description: ' + description)
        else:
            description_div.add('No description available')

        estimated_total_hours_div = DivWdg()
        estimated_total_hours = get_order_estimated_total_hours_from_order_code(
            order_code)

        if estimated_total_hours:
            estimated_total_hours_div.add(
                'Estimated Total Hours: {0}'.format(estimated_total_hours))

        add_component_button = ButtonNewWdg(title='Add Component',
                                            icon='INSERT')
        add_component_button.add_behavior(
            obu.get_load_popup_widget_with_reload_behavior(
                'Insert Component', 'widgets.InsertComponentInOrderWdg',
                self.order_sobject.get_search_key(), 'Order Builder',
                'order_builder.OrderBuilderWdg',
                self.order_sobject.get_search_key()))
        add_component_button.add_style('display', 'inline-block')

        add_component_by_language_button = ButtonNewWdg(
            title='Add Component By Language', icon='INSERT_MULTI')
        add_component_by_language_button.add_behavior(
            obu.get_load_popup_widget_with_reload_behavior(
                'Insert Component by Language',
                'widgets.InsertComponentByLanguageWdg',
                self.order_sobject.get_search_key(), 'Order Builder',
                'order_builder.OrderBuilderWdg',
                self.order_sobject.get_search_key()))
        add_component_by_language_button.add_style('display', 'inline-block')

        add_component_by_season_button = ButtonNewWdg(
            title='Add Component By Season', icon='INSERT_MULTI')
        add_component_by_season_button.add_behavior(
            obu.get_load_popup_widget_with_reload_behavior(
                'Insert Components by Title Collection',
                'widgets.InsertComponentBySeasonWdg',
                self.order_sobject.get_search_key(), 'Order Builder',
                'order_builder.OrderBuilderWdg',
                self.order_sobject.get_search_key()))
        add_component_by_season_button.add_style('display', 'inline-block')

        add_packages_button = ButtonNewWdg(title='Add Package', icon='INSERT')
        add_packages_button.add_behavior(
            obu.get_load_popup_widget_with_reload_behavior(
                'Insert Package', 'order_builder.InsertPackageInOrderWdg',
                self.order_sobject.get_search_key(), 'Order Builder',
                'order_builder.OrderBuilderWdg',
                self.order_sobject.get_search_key()))

        add_packages_button.add_style('display', 'inline-block')

        add_packages_by_platform = ButtonNewWdg(
            title='Add Package By Platform', icon='INSERT_MULTI')
        add_packages_by_platform.add_behavior(
            obu.get_load_popup_widget_with_reload_behavior(
                'Insert Packages by Platform',
                'order_builder.InsertPackageByPlatformWdg',
                self.order_sobject.get_search_key(), 'Order Builder',
                'order_builder.OrderBuilderWdg',
                self.order_sobject.get_search_key()))
        add_packages_by_platform.add_style('display', 'inline-block')

        add_file_to_order_button = ButtonNewWdg(title='Add Files to Order',
                                                icon='ADD')
        add_file_to_order_button.add_behavior(
            obu.get_load_popup_widget_with_reload_behavior(
                'Add Files to Order', 'widgets.AddFilesToOrderWdg',
                self.order_sobject.get_search_key(), 'Order Builder',
                'order_builder.OrderBuilderWdg',
                self.order_sobject.get_search_key()))
        add_file_to_order_button.add_style('display', 'inline-block')

        create_file_for_order_button = ButtonNewWdg(
            title='Create a new File for this Order', icon='NEW')
        create_file_for_order_button.add_behavior(
            obu.get_load_popup_widget_with_reload_behavior(
                'Create a new File for this Order',
                'widgets.CreateFileForOrderWdg',
                self.order_sobject.get_search_key(), 'Order Builder',
                'order_builder.OrderBuilderWdg',
                self.order_sobject.get_search_key()))
        create_file_for_order_button.add_style('display', 'inline-block')

        link_components_to_packages_button = ButtonNewWdg(
            title='Link Components to Packages', icon='ARROW_RIGHT')
        link_components_to_packages_button.add_behavior(
            obu.get_load_popup_widget_with_reload_behavior(
                'Link Components to Packages',
                'widgets.LinkComponentsToPackagesWdg',
                self.order_sobject.get_search_key(), 'Order Builder',
                'order_builder.OrderBuilderWdg',
                self.order_sobject.get_search_key()))
        link_components_to_packages_button.add_style('display', 'inline-block')

        change_expected_completion_date_button = ButtonNewWdg(
            title='Change Expected Completion Date', icon='CALENDAR')
        change_expected_completion_date_button.add_behavior(
            obu.get_load_popup_widget_with_reload_behavior(
                'Change Expected Completion Date',
                'widgets.ChangeOrderExpectedCompletionDate',
                self.order_sobject.get_search_key(), 'Order Builder',
                'order_builder.OrderBuilderWdg',
                self.order_sobject.get_search_key()))
        change_expected_completion_date_button.add_style(
            'display', 'inline-block')

        note_button = ButtonNewWdg(title='Add Note', icon='NOTE')
        note_button.add_behavior(
            obu.get_add_notes_behavior(self.order_sobject.get_search_key()))
        note_button.add_style('display', 'inline-block')

        order_url = obu.get_order_builder_url(self.order_sobject.get_code())
        copy_url_button = ButtonNewWdg(title='Copy URL to Clipboard',
                                       icon='LINK')
        copy_url_button.add_behavior(get_order_builder_url_on_click(order_url))
        copy_url_button.add_style('display', 'inline-block')

        # Add the divs to the outer_div for display
        order_div.add(order_name_div)
        order_div.add(order_code_div)
        order_div.add(order_due_date_div)
        order_div.add(order_expected_completion_date_div)
        order_div.add(order_priority_div)
        order_div.add(client_name_div)
        order_div.add(po_number_div)
        order_div.add(description_div)
        order_div.add(estimated_total_hours_div)
        order_div.add(add_component_button)
        order_div.add(add_component_by_language_button)
        order_div.add(add_component_by_season_button)
        order_div.add(add_packages_button)
        order_div.add(add_packages_by_platform)
        order_div.add(add_file_to_order_button)
        order_div.add(create_file_for_order_button)
        order_div.add(link_components_to_packages_button)
        order_div.add(change_expected_completion_date_button)
        order_div.add(note_button)
        order_div.add(copy_url_button)

        return order_div