Esempio n. 1
0
    def get_display(my):
        sobject = None
        if 'order_code' in my.kwargs.keys():
            my.order_code = my.kwargs.get('order_code')
        else:
            sobject = my.get_current_sobject()
            my.order_code = sobject.get_code()
        sobject = my.server.eval("@SOBJECT(twog/order['code','%s'])" % my.order_code)[0]
        my.order_name = sobject.get('name')
        widget = DivWdg()
        table = Table()
        table.add_attr('width', '50px')
        login = Environment.get_login()
        user_name = login.get_login()
        table.add_row()
        cell1 = table.add_cell('<b><u>Calculate Costs</u></b>')
        cell1.add_attr('order_code', my.order_code)
        cell1.add_attr('user', user_name)
        cell1.add_attr('order_name', my.order_name)
        cell1.add_attr('nowrap','nowrap')
        launch_behavior = my.get_launch_behavior()
        cell1.add_style('cursor: pointer;')
        cell1.add_behavior(launch_behavior)
        widget.add(table)

        return widget
Esempio n. 2
0
    def get_display(my):
        #--print "IN OBLW"
        code = ''
        if 'search_key' in my.kwargs.keys():
            search_key = str(my.kwargs.get('search_key'))
            code = search_key.split('code=')[1]
            search_type = search_key.split('?')[0]
            sob_platform = my.server.eval("@GET(%s['code','%s'].platform)" % (search_type, code))
        else: 
            sobject = my.get_current_sobject()
            code = sobject.get_code()
            sob_platform = sobject.get_value('platform')

        platform_sk = ''
        if sob_platform not in [None,'']:
            platform_sk = my.server.eval("@GET(twog/platform['name','%s'].__search_key__)" % sob_platform)
            if len(platform_sk) > 0:
                platform_sk = platform_sk[0]
            else:
                platform_sk = ''
            
        widget = DivWdg()
        table = Table()
        if platform_sk not in [None,'']:
            table.add_attr('width', '50px')
            table.add_row()
            cell1 =  table.add_cell('<img border="0" style="vertical-align: middle" title="" src="/context/icons/silk/email.png">')
            launch_behavior = my.get_launch_behavior(platform_sk)
            cell1.add_style('cursor: pointer;')
            cell1.add_behavior(launch_behavior)
        widget.add(table)

        return widget
Esempio n. 3
0
 def get_display(my):
     sobject = my.get_current_sobject()
     sk = sobject.get_search_key()
     widget = DivWdg()
     sts_to_perm = {'twog/qc_report_vars': 'compression|qc supervisor|edeliveries'}
     if '-1' not in sk:
         table = Table()
         table.add_attr('width', '50px')
         login = Environment.get_login()
         user_name = login.get_login()
         groups = Environment.get_group_names()
         st = sk.split('?')[0]; 
         perms = sts_to_perm[st] 
         allow = False
         for g in groups:
             if g in perms:
                 allow = True
         if user_name == 'admin':
             allow = True
         if allow:
             table.add_row()
             cell1 =  table.add_cell(my.x_butt)
             cell1.add_attr('id','sp_del_%s' % sk)
             launch_behavior = my.get_delete_behavior(sk)
             cell1.add_style('cursor: pointer;')
             cell1.add_behavior(launch_behavior)
             widget.add(table)
     return widget
    def get_display(my):
        sobject = None
        code = ''
        show_checks = False
        if 'source_code' in my.kwargs.keys():
            code = str(my.kwargs.get('source_code'))    
        else:
            sobject = my.get_current_sobject()
            code = sobject.get_code()
        if sobject.get_value('high_security') in [True,'T','t','1']:
            show_checks = True
        widget = DivWdg()
        table = Table()
        table.add_attr('width', '50px')
        if show_checks:
            table.add_style('background-color: #ff0000;')
            login = Environment.get_login()
            user_name = login.get_login()
            table.add_row()
            cell1 =  table.add_cell('<img border="0" style="vertical-align: middle" title="Security Checklist" name="Security Checklist" src="/context/icons/32x32/lock_32_01.png">')
            cell1.add_attr('user', user_name)
            launch_behavior = my.get_launch_behavior(code,user_name)
            cell1.add_style('cursor: pointer;')
            cell1.add_behavior(launch_behavior)
        widget.add(table)

        return widget
Esempio n. 5
0
 def get_display(my): 
     #my.init()
     item_table = Table(css='minimal')
     item_table.add_style('margin-left','30px')
    
     for item in my.items:
         item_table.add_row()
         space_td = item_table.add_blank_cell()
         
         item_td = item_table.add_cell(item.get_description())
         item_td.set_attr("nowrap", "1")
         
         delete = IconSubmitWdg("Remove from group", \
             "stock_stop-16.png",add_hidden=False)
         delete.add_event("onclick","document.form.remove_cmd.value=\
             '%s|%s';document.form.submit();" \
             % (my.group.get_primary_key_value(), item.get_primary_key_value()) )
         del_span = SpanWdg(css='med')
         del_span.add(delete)
         item_table.add_cell(del_span)
     if not my.items:
         item_table.add_blank_cell()
    
     my.add(item_table)
     return super(ItemInContainerWdg, my).get_display()
Esempio n. 6
0
    def get_display(self):

        dd_activator = DivWdg()

        if self.style:
            dd_activator.add_styles( self.style )

        dd_activator.add_style( "width: %spx" % self.width )
        dd_activator.add_class("SPT_DTS");

        if self.nudge_menu_horiz != 0:
            dd_activator.set_attr("spt_nudge_menu_horiz", self.nudge_menu_horiz)

        if self.nudge_menu_vert != 0:
            dd_activator.set_attr("spt_nudge_menu_vert", self.nudge_menu_vert)

        # Generate button ...
        #
        table = Table()
        table.add_row()
        table.add_styles("width: 100%; padding: 0px; margin: 0px;")
        td = table.add_cell()
        td.add_looks("menu border curs_default")
        td.add_styles( "padding: 0px; width: 100%; overflow: hidden; height: 12px; max-height: 12px;" )

        title_div = DivWdg()
        title_div.add_styles( "padding: 0px; margin-left: 4px; margin-top: 1px;" )
        if self.icon_path:
            img = HtmlElement.img()
            img.set_attr("src", self.icon_path)
            img.set_attr("title", self.title)
            img.add_styles("padding: 0px; padding-bottom: 1px; margin: 0px; text-decoration: none;")
            title_div.add(img)
            title_div.add_looks("menu")
        else:
            title_div.add(self.title)
            title_div.add_looks("menu fnt_text")

        td.add( title_div )

        td = table.add_cell()
        # -- Example of setting only some of the borders with dotted style ...
        # td.add_looks( "menu_btn_icon clear_borders border_bottom border_right dotted" )
        td.add_looks( "menu_btn_icon border curs_default" )
        td.add_styles( "padding: 0px; text-align: center; overflow: hidden; " \
                       "width: 15px; min-width: 15px;" \
                       "height: 12px; max-height: 12px;" )

        arrow_img = HtmlElement.img("/context/icons/silk/_spt_bullet_arrow_down_dark_8x8.png")
        arrow_img.add_styles( "border: 0px; margin-left: 1px; margin-top: 0px;" )
        td.add( arrow_img )

        dd_activator.add(table)

        dd_activator.add( self.kwargs.get("smart_menu_set") )
        dd_activator.add_class("SPT_SMENU_ACTIVATOR")
        dd_activator.add_behavior( { 'type': 'click_up', 'activator_type' : 'smart_menu',
                                     'cbjs_action': 'spt.smenu.show_on_dropdown_click_cbk( evt, bvr )' } )

        return dd_activator
Esempio n. 7
0
 def handle_sidebar_clear(self, top):
     top.add(DivWdg('Clear Side Bar Cache ', css='spt_info_title'))
     table = Table()
     table.add_color("color", "color")
     table.add_style("margin: 10px")
     top.add(table)
     table.add_row()
     td = table.add_cell("Clear the Side Bar Cache for all users")
     td.add_style("width: 250px")
     button = ActionButtonWdg(title='Run')
     table.add_cell(button)
     button.add_behavior({
         'type':
         'click_up',
         'cbjs_action':
         '''
         try {
         var s = TacticServerStub.get();
         s.execute_cmd('tactic.ui.app.ClearSideBarCache');
         
         } catch(e) {
             spt.alert(spt.exception.handler(e));
         }
         spt.info('Side Bar cache cleared.')
     '''
     })
Esempio n. 8
0
    def handle_python_script_test(self, top):
        top.add(DivWdg('Python Script Test', css='spt_info_title'))
        table = Table(css='script')
        table.add_color("color", "color")
        table.add_style("margin: 10px")
        table.add_style("width: 100%")
        top.add(table)
        table.add_row()
        td = table.add_cell("Script Path: ")
        td.add_style("width: 150px")
        text = TextWdg('script_path')
        td = table.add_cell(text)
        button = ActionButtonWdg(title='Run')
        table.add_cell(button)
        button.add_style("float: right")
        button.add_behavior( {
        'type': 'click_up',
        'cbjs_action': '''
             var s = TacticServerStub.get();
             try {
                var path =  bvr.src_el.getParent('.script').getElement('.spt_input').value;
                if (! path)
                    throw('Please enter a valid script path');
                s.execute_cmd('tactic.command.PythonCmd', {script_path: path});
             } catch(e) {
                spt.alert(spt.exception.handler(e));
             }

        '''
        })
Esempio n. 9
0
    def get_display(my):
        sobject = my.get_current_sobject()
        code = sobject.get_code()
        sk = my.server.build_search_key("twog/movement", code)
        shipping_class = sobject.get_value("shipping_class")
        title = sobject.get_value("name")
        waybill = sobject.get_value("waybill")
        sending_company_code = sobject.get_value("sending_company_code")
        receiving_company_code = sobject.get_value("receiving_company_code")
        shipper_code = sobject.get_value("shipper_code")
        description = sobject.get_value("description")
        timestamp = sobject.get_value("timestamp")

        widget = DivWdg()
        table = Table()
        table.add_attr("width", "50px")
        table.add_row()
        cell1 = table.add_cell(
            '<img border="0" style="vertical-align: middle" title="" src="/context/icons/silk/printer.png">'
        )
        launch_behavior = my.get_launch_behavior()
        cell1.add_attr("sk", sk)
        cell1.add_attr("shipping_class", shipping_class)
        cell1.add_attr("to_comp", receiving_company_code)
        cell1.add_attr("from_comp", sending_company_code)
        cell1.add_attr("waybill", waybill)
        cell1.add_attr("title", title)
        cell1.add_attr("shipper", shipper_code)
        cell1.add_attr("description", description)
        cell1.add_attr("timestamp", timestamp)
        cell1.add_style("cursor: pointer;")
        cell1.add_behavior(launch_behavior)
        widget.add(table)

        return widget
Esempio n. 10
0
 def get_display(my):
     do_button = False
     if 'work_order_code' not in my.kwargs.keys(): 
         sobject = my.get_current_sobject()
         code = sobject.get_code()
     else:
         code = my.kwargs.get('work_order_code')    
         do_button = True
     
     widget = DivWdg()
     table = Table()
     table.add_attr('width', '50px')
     table.add_row()
     launch_behavior = my.get_launch_behavior(code)
     what_goes_in = '<img border="0" style="vertical-align: middle" title="" src="/context/icons/silk/printer.png">'
     if do_button:
        what_goes_in = ButtonSmallNewWdg(title="Print Work Order", icon=IconWdg.PRINTER)
        what_goes_in.add_behavior(launch_behavior) 
     cell1 = table.add_cell(what_goes_in)
     cell1.add_attr('code',code)
     cell1.add_style('cursor: pointer;')
     if not do_button:
         cell1.add_behavior(launch_behavior)
     widget.add(table)
     if do_button:
         return what_goes_in
     else:
         return widget
Esempio n. 11
0
    def get_display(my):
        name = ''
        if 'code' in my.kwargs.keys():
            code = my.kwargs.get('code') 
        else: 
            sobject = my.get_current_sobject()
            code = sobject.get_code()
            name = sobject.get_value('name')
        if 'name' in my.kwargs.keys():
            name = my.kwargs.get('name')
        search_on_load = 'false'
        if 'search_on_load' in my.kwargs.keys():
            search_on_load = my.kwargs.get('search_on_load')

        widget = DivWdg()
        table = Table()
        table.add_attr('width', '50px')
        table.add_row()
        cell1 = table.add_cell('<img border="0" style="vertical-align: middle" title="" src="/context/icons/custom/imdb.png">')
        cell1.add_attr('code', code)
        cell1.add_attr('name', name)
        cell1.add_attr('search_on_load', search_on_load)
        launch_behavior = my.get_launch_behavior()
        cell1.add_style('cursor: pointer;')
        cell1.add_behavior(launch_behavior)
        widget.add(table)

        return widget
Esempio n. 12
0
def get_files_checkbox_from_file_list(file_sobjects, selected_file_sobjects):
    """
    Given a list of file sobjects, return a table of Checkbox widgets (CheckboxWdg) using the file paths and codes.
    If a file is also in the selected_file_sobjects list, check it automatically.

    :param file_sobjects: List of file sobjects
    :param selected_file_sobjects: List of file sobjects (that are already selected)
    :return: Table
    """

    files_checkbox_table = Table()

    header_row = files_checkbox_table.add_row()
    header = files_checkbox_table.add_header(data='Files', row=header_row)
    header.add_style('text-align', 'center')
    header.add_style('text-decoration', 'underline')

    for file_sobject in file_sobjects:
        checkbox = CheckboxWdg(name=file_sobject.get_code())

        if file_sobject.get_code() in [
                selected_file.get_code()
                for selected_file in selected_file_sobjects
        ]:
            checkbox.set_checked()

        checkbox_row = files_checkbox_table.add_row()

        files_checkbox_table.add_cell(data=checkbox, row=checkbox_row)
        files_checkbox_table.add_cell(data=file_sobject.get_value('file_path'),
                                      row=checkbox_row)

    return files_checkbox_table
Esempio n. 13
0
    def get_display(self):
        if self.is_refresh:
            top = Widget()
            self.add(top)
            web = WebContainer.get_web()
            self.checked_processes = web.get_form_values('process_names')
            left_checked_processes = web.get_form_values('left_process_names')
            right_checked_processes = web.get_form_values('right_process_names')
            is_split_view = web.get_form_values('split_view') == 'true'
        else:
            top = self.get_viewer()
            
       
	self.process_names = [x  for x in self.process_names if x ]
        if self.is_refresh:
            if self.process_names:
                table = Table()
                table.add_row()
                td = table.add_cell()
                expression = "@SOBJECT(sthpw/note['context','in','%s'])" %'|'.join(self.process_names)
                table_id = 'main_table_left'
        
                left_table = TableLayoutWdg(table_id=table_id, search_type='sthpw/note', view=self.view,\
                    show_row_select=True, show_insert=False, state={'parent_key': self.parent_key}, inline_search=False, show_refresh=True, expression=expression )
                if self.resize:
  	 	    from tactic.ui.container import ResizeScrollWdg
                    inner_wdg = ResizeScrollWdg( width='500px', height='500px', scroll_bar_size_str='thick', scroll_expansion='inside' )
                    inner_wdg.add(left_table)
                    td.add(inner_wdg)
		else:
                    td.add(left_table)
		top.add(table)
		
        return top
Esempio n. 14
0
    def get_display(self):
        #self.init()
        item_table = Table(css='minimal')
        item_table.add_style('margin-left', '30px')

        for item in self.items:
            item_table.add_row()
            space_td = item_table.add_blank_cell()

            item_td = item_table.add_cell(item.get_description())
            item_td.set_attr("nowrap", "1")

            delete = IconSubmitWdg("Remove from group", \
                "stock_stop-16.png",add_hidden=False)
            delete.add_event("onclick","document.form.remove_cmd.value=\
                '%s|%s';document.form.submit();" \
                % (self.group.get_primary_key_value(), item.get_primary_key_value()) )
            del_span = SpanWdg(css='med')
            del_span.add(delete)
            item_table.add_cell(del_span)
        if not self.items:
            item_table.add_blank_cell()

        self.add(item_table)
        return super(ItemInContainerWdg, self).get_display()
Esempio n. 15
0
    def get_content_wdg(my):

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

        table = Table()
        div.add(table)
        table.add_row()

        td = table.add_cell()
        from table_layout_wdg import FastTableLayoutWdg

        kwargs = my.kwargs.copy()

        td.add_style("width: 1%")
        td.add_style("vertical-align: top")
        layout_div = DivWdg()
        layout_div.add_style("min-height: 500px")
        td.add(layout_div)

        element_names = my.kwargs.get("element_names")
        if not element_names:
            kwargs['element_names'] = [
                'name', 'description', 'detail', 'file_list', 'general_checkin'
            ]
        #kwargs['element_names'] = ['preview','name','detail', 'task_summary']

        kwargs['show_shelf'] = False
        kwargs['show_search_limit'] = False
        layout = FastTableLayoutWdg(**kwargs)
        layout_div.add(layout)
        #from tactic.ui.panel import TileLayoutWdg
        #layout = TileLayoutWdg(**my.kwargs)
        #layout_div.add(layout)

        td = table.add_cell()
        td.add_border(color="#EEE")
        td.add_style("vertical-align: top")

        content = DivWdg()
        td.add(content)
        content.add_class("spt_tool_content")
        #content.add_style("margin: -1px")

        no_content_wdg = DivWdg()
        content.add(no_content_wdg)
        no_content_wdg.add("<br/>" * 3)
        no_content_wdg.add("<i>-- No Content --</i>")
        #no_content_wdg.add_style("opacity: 0.5")
        no_content_wdg.add_style("margin: 30px auto")
        no_content_wdg.add_color("color", "color3")
        no_content_wdg.add_color("background", "background3")
        no_content_wdg.add_style("text-align", "center")
        no_content_wdg.add_style("padding-top: 20px")
        no_content_wdg.add_style("padding-bottom: 20px")
        no_content_wdg.add_style("width: 350px")
        no_content_wdg.add_style("height: 110px")
        no_content_wdg.add_border()

        return div
Esempio n. 16
0
    def _get_target_span(self):
        # get the target span
        search = Search(self.container_cls)
        self._order_search(search)
        groups = search.get_sobjects()
        if groups:
            self.container_sobj = groups[0]

        target_span = SpanWdg(css='med')
        group_table = Table(self.GROUP_TABLE_NAME, css='table')
        group_table.add_style('width', '30em')
        group_table.add_col(css='small')
        group_table.add_col(css='small')
        group_table.add_col()

        target_span.add(group_table)
        group_table.add_row_cell(search.get_search_type_obj()\
            .get_description(), "heading")
        checkbox = CheckboxWdg()
        checkbox.set_option("onclick", \
            "a=new Elements('container_ids');a.toggle_all(this);")
        group_table.add_row()
        group_table.add_cell(checkbox)
        col_name = group_table.get_next_col_name()

        toggle_control = HiddenRowToggleWdg(col_name=col_name,
                                            is_control=True,
                                            auto_index=True)

        group_table.add_cell(toggle_control)
        group_table.add_cell('MASTER CONTROL')

        remove_cmd = HiddenWdg(SObjectGroupCmd.REMOVE_CMD)
        self.add(remove_cmd)
        for group in groups:
            group_table.add_row()
            checkbox = CheckboxWdg("container_ids")
            checkbox.set_option("value", group.get_primary_key_value())

            toggle = HiddenRowToggleWdg(col_name, auto_index=True)
            toggle.store_event()

            group_details = ItemInContainerWdg(group, self.item_sobj,
                                               self.item_cls,
                                               self.grouping_cls)

            # set the target content of the toggle
            toggle.set_static_content(group_details)

            group_table.add_cell(checkbox)
            group_table.add_cell(toggle, add_hidden_wdg=True)
            group_table.add_cell(group.get_description())
            num_items = group_details.get_num_items()
            if num_items:
                td = group_table.add_cell("( %s )" % num_items, 'no_wrap')
                td.add_color(color)
            else:
                group_table.add_blank_cell()

        return target_span
Esempio n. 17
0
 def make_check_table(my, dictoid, arr, sob, sk, my_name, color):
     #Makes a table of checklisted items
     table = Table()
     table.add_style('background-color: %s;' % color)
     #The maximum width across (max number of columns of checkboxes)
     max_width = 3
     table.add_row()
     top_cell = table.add_cell('<b><u>%s</u></b>' % my_name)
     top_cell.add_attr('colspan',max_width)
     top_cell.add_attr('align','center')
     count = 0
     for entry in arr:
         #If it has hit the max width for the row, create a new row
         if count % max_width == 0:
             table.add_row()
         #Create textbox
         check_bool = 'false'
         if sob:
             if sob.get(dictoid[entry]):
                 check_bool = 'true'
             else:
                 check_bool = 'false'
         else:
             check_bool = 'false'
         checker = CustomCheckboxWdg(name='errcheck_%s_%s' % (dictoid[entry], sk),value_field=dictoid[entry],checked=check_bool,dom_class='check_table_selector',field=dictoid[entry])
         check_hold = table.add_cell(checker)
         check_hold.add_attr('field', dictoid[entry])
         label = table.add_cell(entry)
         label.add_attr('nowrap','nowrap')
         label.add_attr('width','190px')
         count = count + 1
     return table
Esempio n. 18
0
 def get_display(my):
     sob_sk = ''
     name = ''
     height = 20
     if 'sk' in my.kwargs.keys():
         sob_sk = str(my.kwargs.get('sk'))
     else: 
         sobject = my.get_current_sobject()
         sob_sk = sobject.get_search_key() 
     if 'name' in my.kwargs.keys():
         name = my.kwargs.get('name')
         if 'height' in my.kwargs.keys():
             height = my.kwargs.get('height') 
     processes = ''
     if 'processes' in my.kwargs.keys():
         processes = my.kwargs.get('processes')
         
     widget = DivWdg()
     table = Table()
     table.add_attr('width', '50px')
     table.add_row()
     cell1 = None
     if name == '':
         cell1 = table.add_cell('<img border="0" style="vertical-align: middle" title="" src="/context/icons/silk/_spt_upload.png">')
     else:
         cell1 = table.add_cell('<input type="button" value="%s" style="height: %spx"/>' % (name, height))
     cell1.add_attr('sk', sob_sk)
     cell1.add_attr('processes', processes)
     launch_behavior = my.get_launch_behavior()
     cell1.add_style('cursor: pointer;')
     cell1.add_behavior(launch_behavior)
     widget.add(table)
     return widget
    def get_display(self):
        self.order_sk = str(self.kwargs.get("order_sk"))
        self.title_code = str(self.kwargs.get("title_code"))
        full_title = str(self.kwargs.get("full_title"))
        delivs_search = Search("twog/work_order_deliverables")
        delivs_search.add_filter("title_code", self.title_code)
        delivs = delivs_search.get_sobjects()
        linked = []
        for d in delivs:
            linked.append(d.get_value("satisfied"))
        satisfied = 0
        unsatisfied = 0
        for link in linked:
            if link == True:
                satisfied += 1
            else:
                unsatisfied += 1

        table = Table()
        table.add_row()
        deliverable_launcher = table.add_cell("<u>Delivs: (%s/%s)</u>" % (satisfied, satisfied + unsatisfied))
        deliverable_launcher.add_attr("nowrap", "nowrap")
        deliverable_launcher.add_attr("valign", "bottom")
        deliverable_launcher.add_style("font-size: 80%;")
        deliverable_launcher.add_style("font-color: #2e2e2e;")
        deliverable_launcher.add_style("cursor: pointer;")
        deliverable_launcher.add_behavior(get_launch_deliverables_behavior(self.order_sk, self.title_code, full_title))

        return table
Esempio n. 20
0
    def get_display(my):
        from tactic_client_lib import TacticServerStub

        sobject = None
        code = ""
        if "source_code" in my.kwargs.keys():
            code = str(my.kwargs.get("source_code"))
        else:
            sobject = my.get_current_sobject()
            code = sobject.get_code()
        widget = DivWdg()
        table = Table()
        table.add_attr("width", "50px")
        login = Environment.get_login()
        user_name = login.get_login()
        table.add_row()
        cell1 = table.add_cell(
            '<img border="0" style="vertical-align: middle" title="Clone Source" name="Clone Source" src="/context/icons/silk/star.png">'
        )
        cell1.add_attr("user", user_name)
        launch_behavior = my.get_launch_behavior(code, user_name)
        cell1.add_style("cursor: pointer;")
        cell1.add_behavior(launch_behavior)
        widget.add(table)

        return widget
Esempio n. 21
0
    def get_sobject_info_wdg(my):
        div = DivWdg()
        return div

        attr_table = Table()
        div.add(attr_table)

        attr_table.add_color("color", "color")

        sobject = my.get_sobject()

        titles, exprs = my.get_sobject_info()
        for title, expr in zip(titles, exprs):
            try:
                value = Search.eval(expr, sobject)
            except Exception, e:
                print "WARNING: ", e.message
                continue

            if value == '':
                value = '<i>none</i>'
            if len(value) > 100:
                value = "%s..." % value[:100]

            attr_table.add_row()
            th = attr_table.add_header("%s: " % title)
            th.add_style("text-align: left")
            td = attr_table.add_cell(value)
Esempio n. 22
0
    def get_example_display(self):

        div = DivWdg()

        # --- Example of using _handoff_ property in behavior -----------------------------------------------------

        table = Table()
        table.add_row()
        td = table.add_cell()
        td.set_style( "background: #0f0f0f; color: #9f9f9f; border: 1px solid black; padding: 4px;" )
        td_id = 'HandOffSource'
        td.set_id(td_id)
        td.add( "Element '%s' with '_handoff_' property in bvr spec" % td_id )
        td.add_behavior( {
                '_handoff_': '$(@.parentNode).getElement("#HandOffTarget")',

                'type': 'click',
                'cbfn_action': 'spt.ui_play.test_handoff',
                'dst_el': '$(@.parentNode).getElement("#DestElForBvr");'
            } )

        td = table.add_cell()
        td.set_style( "background: #2f2f2f; color: #9f9f9f; border: 1px solid black; padding: 4px; cursor: pointer;" )
        td_id = 'HandOffTarget'
        td.set_id(td_id)
        td.add( "Element '%s' that receives the handed off behavior" % td_id );

        td = table.add_cell()
        td.set_style( "background: #4f4f4f; color: #9f9f9f; border: 1px solid black; padding: 4px;" )
        td_id = 'DestElForBvr'
        td.set_id(td_id)
        td.add( "Element '%s' specified as dst_el for handed off behavior" % td_id );
        div.add( table )

        return div
    def get_delivery_snapshot_section(self):
        label_value_pairs = (
            ('Feature', 'feature_delivery_snapshot'),
            ('Trailer', 'trailer_delivery_snapshot'),
            ('Alt Audio', 'alt_audio_delivery_snapshot'),
            ('Subtitle', 'subtitle_delivery_snapshot'),
            ('CC', 'cc_delivery_snapshot'),
            ('Vendor Notes', 'vendor_notes_delivery_snapshot'),
            ('Poster Art', 'poster_art_delivery_snapshot'),
            ('Dub Card', 'dub_card_delivery_snapshot')
        )

        table = Table()
        table.add_style('float', 'left')

        table.add_row()
        table.add_header('Delivery Snapshot')

        for label_value_pair in label_value_pairs:
            label, value = label_value_pair

            table.add_row()
            table.add_cell(label)
            table.add_cell(self.get_true_false_select_wdg(value))

        section_div = DivWdg()
        section_div.add(table)

        return section_div
Esempio n. 24
0
    def get_sobject_info_wdg(my):
        attr_table = Table()
        attr_table.add_color("color", "color")
        attr_table.add_color("background", "background", -5)
        attr_table.add_border()
        attr_table.set_box_shadow("0px 0px 5px")

        sobject = my.get_sobject()

        tr, td = attr_table.add_row_cell()
        td.add("<b>Task Info<hr/></b>")
        td.add_style("padding-top: 5px")
        td.add_style("padding-left: 5px")


        titles, exprs = my.get_task_info()
        for title, expr in zip(titles, exprs):
            try:
                value = Search.eval(expr, sobject, single=True)
            except Exception, e:
                print "WARNING: ", e.message
                continue

            if value == '':
                value = '<i>none</i>'
            attr_table.add_row()
            th = attr_table.add_cell("%s: " % title)
            th.add_style("text-align: left")
            th.add_style("padding-right: 15px")
            th.add_style("padding-left: 5px")
            th.add_style("padding-bottom: 2px")
            td = attr_table.add_cell(value)
Esempio n. 25
0
    def get_display(self):
        sobject = self.get_current_sobject()

        snapshots = []
        if isinstance(sobject, Layer):
            # for layer renders, we try to get all render sobjects
            renders = Render.get_all_by_sobject(sobject)
            if renders:
                snapshots = Snapshot.get_by_sobjects(renders, is_current=True)
        else:  # for object that has direct snapshots like plates
            snapshot = Snapshot.get_current_by_sobject(sobject)
            if snapshot:
                snapshots.append(snapshot)

        if not snapshots:
            return "<i>- no files -</i>"

        div = DivWdg()

        for snapshot in snapshots:
            file_types = snapshot.get_all_file_types()
            table = Table(css='embed')

            for file_type in file_types:
                table.add_row()

                table.add_cell(self.get_open_wdg(snapshot, file_type))
                dir = snapshot.get_client_lib_dir(file_type=file_type)

                table.add_cell("%s: <i>%s</i>" % (file_type, dir))

            div.add(table)
        return div
Esempio n. 26
0
    def get_sobject_info_wdg(my):
        div = DivWdg()
        return div

        attr_table = Table()
        div.add(attr_table)

        attr_table.add_color("color", "color")

        sobject = my.get_sobject()

        titles, exprs = my.get_sobject_info()
        for title, expr in zip(titles, exprs):
            try:
                value = Search.eval(expr, sobject)
            except Exception, e:
                print "WARNING: ", e.message
                continue


            if value == '':
                value = '<i>none</i>'
            if len(value) > 100:
                value = "%s..." % value[:100]

            attr_table.add_row()
            th = attr_table.add_header("%s: " % title)
            th.add_style("text-align: left")
            td = attr_table.add_cell(value)
Esempio n. 27
0
    def get_display(self):
        sobject = self.get_current_sobject()

        snapshots = []
        if isinstance(sobject, Layer):
            # for layer renders, we try to get all render sobjects
            renders = Render.get_all_by_sobject(sobject)
            if renders:
                snapshots = Snapshot.get_by_sobjects(renders, is_current=True)
        else: # for object that has direct snapshots like plates
            snapshot = Snapshot.get_current_by_sobject(sobject)
            if snapshot:
                snapshots.append(snapshot)

        if not snapshots:
            return "<i>- no files -</i>"

        div = DivWdg()

        for snapshot in snapshots:
            file_types = snapshot.get_all_file_types()
            table = Table(css='embed')

            for file_type in file_types:
                table.add_row()
                
                table.add_cell( self.get_open_wdg(snapshot, file_type) )
                dir = snapshot.get_client_lib_dir(file_type=file_type)
                
                
                table.add_cell( "%s: <i>%s</i>" % (file_type, dir) )
         

            div.add(table)
        return div
Esempio n. 28
0
    def get_display(my):

        dd_activator = DivWdg()

        if my.style:
            dd_activator.add_styles( my.style )

        dd_activator.add_style( "width: %spx" % my.width )
        dd_activator.add_class("SPT_DTS");

        if my.nudge_menu_horiz != 0:
            dd_activator.set_attr("spt_nudge_menu_horiz", my.nudge_menu_horiz)

        if my.nudge_menu_vert != 0:
            dd_activator.set_attr("spt_nudge_menu_vert", my.nudge_menu_vert)

        # Generate button ...
        #
        table = Table()
        table.add_row()
        table.add_styles("width: 100%; padding: 0px; margin: 0px;")
        td = table.add_cell()
        td.add_looks("menu border curs_default")
        td.add_styles( "padding: 0px; width: 100%; overflow: hidden; height: 12px; max-height: 12px;" )

        title_div = DivWdg()
        title_div.add_styles( "padding: 0px; margin-left: 4px; margin-top: 1px;" )
        if my.icon_path:
            img = HtmlElement.img()
            img.set_attr("src", my.icon_path)
            img.set_attr("title", my.title)
            img.add_styles("padding: 0px; padding-bottom: 1px; margin: 0px; text-decoration: none;")
            title_div.add(img)
            title_div.add_looks("menu")
        else:
            title_div.add(my.title)
            title_div.add_looks("menu fnt_text")

        td.add( title_div )

        td = table.add_cell()
        # -- Example of setting only some of the borders with dotted style ...
        # td.add_looks( "menu_btn_icon clear_borders border_bottom border_right dotted" )
        td.add_looks( "menu_btn_icon border curs_default" )
        td.add_styles( "padding: 0px; text-align: center; overflow: hidden; " \
                       "width: 15px; min-width: 15px;" \
                       "height: 12px; max-height: 12px;" )

        arrow_img = HtmlElement.img("/context/icons/silk/_spt_bullet_arrow_down_dark_8x8.png")
        arrow_img.add_styles( "border: 0px; margin-left: 1px; margin-top: 0px;" )
        td.add( arrow_img )

        dd_activator.add(table)

        dd_activator.add( my.kwargs.get("smart_menu_set") )
        dd_activator.add_class("SPT_SMENU_ACTIVATOR")
        dd_activator.add_behavior( { 'type': 'click_up', 'activator_type' : 'smart_menu',
                                     'cbjs_action': 'spt.smenu.show_on_dropdown_click_cbk( evt, bvr )' } )

        return dd_activator
Esempio n. 29
0
 def get_display(my):
     import re
     from client.tactic_client_lib import TacticServerStub
     from tactic.ui.panel import FastTableLayoutWdg
     server = TacticServerStub.get()
     sk = str(my.kwargs.get('sk'))
     splits = sk.split('code=')
     search_type = splits[0].split('?')[0];
     code = splits[1];
     search_id = re.findall(r'\d+', code)
     search_id = int(search_id[0])
     widget = DivWdg()
     table = Table()
     table.add_attr('class','snapshot_viewer_wdg')
     table.add_attr('sk',sk)
     #ftl = FastTableLayoutWdg(search_type='sthpw/snapshot', view='table', element_names='preview,process,description,web_path,timestamp,login', show_row_select=True, search_key=sk, show_gear=False, show_shelf=False, show_select=True, width='100%s' % '%', show_column_manager=False, expression="@UNION(@SOBJECT(sthpw/snapshot),@SOBJECT(sthpw/note.sthpw/snapshot))", temp=True)
     if search_type == 'sthpw/note':
         expression = "@SOBJECT(sthpw/snapshot)"
     else:
         expression="@UNION(@SOBJECT(sthpw/snapshot),@SOBJECT(sthpw/note.sthpw/snapshot))"
     ftl = FastTableLayoutWdg(search_type='sthpw/snapshot', view='snapshot_by_process', show_row_select=True, search_key=sk, show_gear=False, show_shelf=False, show_select=True, height='300px', width='100%s' % '%', show_column_manager=False, expression=expression, temp=True)
     table.add_row()
     table.add_cell(ftl) 
     widget.add(table)
     return widget
Esempio n. 30
0
    def get_section_two_bottom_table(self):
        table = Table()
        table.add_style('margin', '10px')
        table.add_row()

        table.add_header('')
        table.add_header('Feature')
        table.add_header('Audio Bundle')
        table.add_header('Trailer/Preview')

        label_value_pairs = ((
            'Audio configuration verified (stereo or mono/mapping is correct)?',
            'audio_configuration_verified'
        ), ('Audio is in sync with video (checked in 3 random spots and head/tail)?',
            'audio_in_sync_with_video'), (
                'Audio is tagged correctly?', 'audio_tagged_correctly'
            ), ('No audio is cut off (at beginning or end)?',
                'no_audio_cut_off'), (
                    'TRT of audio equals TRT of the video?',
                    'trt_audio_equals_trt_video'
                ), ('Correct language is present (on applicable channels)?',
                    'correct_language_present'))

        for label_value_pair in label_value_pairs:
            table.add_row()
            table.add_cell(label_value_pair[0])

            for section in ('feature', 'audio', 'preview'):
                table.add_cell(
                    self.get_true_false_select_wdg(label_value_pair[1] + '_' +
                                                   section))

        return table
def get_files_checkbox_from_file_list(file_sobjects, selected_file_sobjects):
    """
    Given a list of file sobjects, return a table of Checkbox widgets (CheckboxWdg) using the file paths and codes.
    If a file is also in the selected_file_sobjects list, check it automatically.

    :param file_sobjects: List of file sobjects
    :param selected_file_sobjects: List of file sobjects (that are already selected)
    :return: Table
    """

    files_checkbox_table = Table()

    header_row = files_checkbox_table.add_row()
    header = files_checkbox_table.add_header(data='Files', row=header_row)
    header.add_style('text-align', 'center')
    header.add_style('text-decoration', 'underline')

    for file_sobject in file_sobjects:
        checkbox = CheckboxWdg(name=file_sobject.get_code())

        if file_sobject.get_code() in [selected_file.get_code() for selected_file in selected_file_sobjects]:
            checkbox.set_checked()

        checkbox_row = files_checkbox_table.add_row()

        files_checkbox_table.add_cell(data=checkbox, row=checkbox_row)
        files_checkbox_table.add_cell(data=file_sobject.get_value('file_path'), row=checkbox_row)

    return files_checkbox_table
Esempio n. 32
0
    def get_delivery_snapshot_section(self):
        label_value_pairs = (('Feature', 'feature_delivery_snapshot'),
                             ('Trailer', 'trailer_delivery_snapshot'),
                             ('Alt Audio', 'alt_audio_delivery_snapshot'),
                             ('Subtitle', 'subtitle_delivery_snapshot'),
                             ('CC', 'cc_delivery_snapshot'),
                             ('Vendor Notes',
                              'vendor_notes_delivery_snapshot'),
                             ('Poster Art', 'poster_art_delivery_snapshot'),
                             ('Dub Card', 'dub_card_delivery_snapshot'))

        table = Table()
        table.add_style('float', 'left')

        table.add_row()
        table.add_header('Delivery Snapshot')

        for label_value_pair in label_value_pairs:
            label, value = label_value_pair

            table.add_row()
            table.add_cell(label)
            table.add_cell(self.get_true_false_select_wdg(value))

        section_div = DivWdg()
        section_div.add(table)

        return section_div
Esempio n. 33
0
    def get_header_wdg(self):
        outer = DivWdg()

        div = DivWdg()
        outer.add(div)
        div.add_color("background", "background", -3)
        div.add_style("padding: 5px")
        div.add_border()

        table = Table()
        table.add_style("margin-left: auto")
        table.add_style("margin-right: auto")
        table.add_color("color", "color")
        table.add_style("font-size: 1.5em")
        table.add_style("font-weight: bold")

        table.add_row()

        # add the month navigators
        date_str = "%s, %s" % (self.MONTHS[self.month - 1], self.year)
        month_wdg = DivWdg()
        month_wdg.add_style("width: 150px")
        month_wdg.add(date_str)

        prev_month_wdg = self.get_prev_month_wdg()
        next_month_wdg = self.get_next_month_wdg()

        table.add_cell(prev_month_wdg)
        td = table.add_cell(month_wdg)
        td.add_style("text-align: center")
        table.add_cell(next_month_wdg)

        div.add(table)

        return outer
Esempio n. 34
0
    def get_section_three_subsection_one(self):
        label_value_pairs = (
            ('Forced narrative on feature?', 'forced_narrative_feature',
             'Does not overlap any credits or other text?',
             'overlap_credits_text_1'),
            ('Forced narrative on trailer?', 'forced_narrative_trailer',
             'Does not overlap any credits or other text?',
             'overlap_credits_text_2'),
            ('Subtitles on feature?', 'subtitles_on_feature',
             'Does not overlap any credits or other text?',
             'overlap_credits_text_3'),
            ('Subtitles on trailer?', 'subtitles_on_trailer',
             'Does not overlap any credits or other text?',
             'overlap_credits_text_4'),
        )

        table = Table()

        for label_value_pair in label_value_pairs:
            label_1, value_1, label_2, value_2 = label_value_pair

            table.add_row()
            table.add_cell(label_1)
            table.add_cell(self.get_true_false_select_wdg(value_1))
            table.add_cell(label_2)
            table.add_cell(self.get_true_false_select_wdg(value_2))

        section_div = DivWdg()
        section_div.add(table)

        return section_div
Esempio n. 35
0
    def get_display(self):
        table = Table()

        self.set_header(table)

        tasks = get_edel_tasks()

        for task in tasks:
            process_cell = table.add_cell(task.get_value('process'))

            status_cell = table.add_cell(task.get_value('status'))

            title_order = get_title_order_from_code(
                task.get_value('search_code'))
            if (title_order):
                title_order_cell = table.add_cell(
                    title_order.get_value('name'))
            else:
                title_order_cell = table.add_cell()

            # work_on_task_cell = table.add_cell(WorkElementWdg(search_key='sthpw/task?code=TASK00000009'))

            # self.apply_styling_to_cells([process_cell, status_cell, title_order_cell, work_on_task_cell])
            self.apply_styling_to_cells(
                [process_cell, status_cell, title_order_cell])

            table.add_row()

        outer_div = DivWdg()
        outer_div.add(table)

        return outer_div
Esempio n. 36
0
    def get_display(my):
        sobject = my.get_current_sobject()
        code = sobject.get_code()
        sk = my.server.build_search_key('twog/movement', code)
        shipping_class = sobject.get_value('shipping_class')
        title = sobject.get_value('name')
        waybill = sobject.get_value('waybill')
        sending_company_code = sobject.get_value('sending_company_code')
        receiving_company_code = sobject.get_value('receiving_company_code')
        shipper_code = sobject.get_value('shipper_code')
        description = sobject.get_value('description')
        timestamp = sobject.get_value('timestamp')
        
        widget = DivWdg()
        table = Table()
        table.add_attr('width', '50px')
        table.add_row()
        cell1 = table.add_cell('<img border="0" style="vertical-align: middle" title="" src="/context/icons/silk/printer.png">')
        launch_behavior = my.get_launch_behavior()
        cell1.add_attr('sk',sk)
        cell1.add_attr('shipping_class',shipping_class)
        cell1.add_attr('to_comp',receiving_company_code)
        cell1.add_attr('from_comp',sending_company_code)
        cell1.add_attr('waybill',waybill)
        cell1.add_attr('title',title)
        cell1.add_attr('shipper',shipper_code)
        cell1.add_attr('description',description)
        cell1.add_attr('timestamp',timestamp)
        cell1.add_style('cursor: pointer;')
        cell1.add_behavior(launch_behavior)
        widget.add(table)

        return widget
Esempio n. 37
0
    def get_header_wdg(my):
        outer = DivWdg()

        div = DivWdg()
        outer.add(div)
        div.add_color("background", "background3")
        div.add_style("padding: 5px")
        div.add_border()

        table = Table()
        table.add_style("margin-left: auto")
        table.add_style("margin-right: auto")
        table.add_color("color", "color")
        table.add_style("font-size: 1.5em")
        table.add_style("font-weight: bold")

        table.add_row()

        # add the month navigators
        date_str = "%s, %s" % (my.MONTHS[my.month - 1], my.year)
        month_wdg = DivWdg()
        month_wdg.add_style("width: 150px")
        month_wdg.add(date_str)

        prev_month_wdg = my.get_prev_month_wdg()
        next_month_wdg = my.get_next_month_wdg()

        table.add_cell(prev_month_wdg)
        td = table.add_cell(month_wdg)
        td.add_style("text-align: center")
        table.add_cell(next_month_wdg)

        div.add(table)

        return outer
Esempio n. 38
0
    def get_split_viewer(self):
        table = Table()
        table.add_row()
        td = table.add_cell()
        inner_wdg = SingleNoteViewerWdg(
            processes_names=self.process_names,
            parent_key=self.kwargs.get('parent_key'),
            resize='true',
            checkbox_name='left_context_cb',
            show_context='true',
            append_context=self.append_context,
            view=self.view)
        td.add(inner_wdg)

        td = table.add_cell()
        inner_wdg = SingleNoteViewerWdg(
            processes_names=self.process_names,
            parent_key=self.kwargs.get('parent_key'),
            resize='true',
            checkbox_name='right_context_cb',
            show_context='true',
            append_context=self.append_context,
            view=self.view)
        td.add(inner_wdg)
        return table
Esempio n. 39
0
    def get_sobject_info_wdg(my):
        attr_table = Table()
        attr_table.add_color("color", "color")
        attr_table.add_color("background", "background", -5)
        attr_table.add_border()
        attr_table.set_box_shadow("0px 0px 5px")

        sobject = my.get_sobject()

        tr, td = attr_table.add_row_cell()
        td.add("<b>Task Info<hr/></b>")
        td.add_style("padding-top: 5px")
        td.add_style("padding-left: 5px")

        titles, exprs = my.get_task_info()
        for title, expr in zip(titles, exprs):
            try:
                value = Search.eval(expr, sobject, single=True)
            except Exception, e:
                print "WARNING: ", e.message
                continue

            if value == '':
                value = '<i>none</i>'
            attr_table.add_row()
            th = attr_table.add_cell("%s: " % title)
            th.add_style("text-align: left")
            th.add_style("padding-right: 15px")
            th.add_style("padding-left: 5px")
            th.add_style("padding-bottom: 2px")
            td = attr_table.add_cell(value)
Esempio n. 40
0
 def make_check_table(my, dictoid, arr, sob, my_name, color, is_external_rejection=False):
     table = Table()
     table.add_style('background-color: %s;' % color)
     max_width = 3
     table.add_row()
     top_cell = table.add_cell('<b><u>%s</u></b>' % my_name)
     top_cell.add_attr('colspan',max_width)
     top_cell.add_attr('align','center')
     count = 0
     for entry in arr:
         if count % max_width == 0:
             table.add_row()
         checker = CheckboxWdg('check_%s' % dictoid[entry])
         checker.add_attr('code', sob.get('code'))
         checker.add_attr('field', dictoid[entry])
         #checker.set_persistence()
         if sob.get(dictoid[entry]):
             checker.set_value(True)
         else:
             checker.set_value(False)
         if not is_external_rejection:
             checker.add_behavior(my.get_reason_check_behavior(dictoid[entry]))
         check_hold = table.add_cell(checker)
         check_hold.add_attr('code', sob.get('code'))
         check_hold.add_attr('field', dictoid[entry])
         label = table.add_cell(entry)
         label.add_attr('nowrap','nowrap')
         label.add_attr('width','190px')
         count = count + 1 
     return table
    def get_section_two_bottom_table(self):
        table = Table()
        table.add_style('margin', '10px')
        table.add_row()

        table.add_header('')
        table.add_header('Feature')
        table.add_header('Audio Bundle')
        table.add_header('Trailer/Preview')

        label_value_pairs = (
            ('Audio configuration verified (stereo or mono/mapping is correct)?', 'audio_configuration_verified'),
            ('Audio is in sync with video (checked in 3 random spots and head/tail)?', 'audio_in_sync_with_video'),
            ('Audio is tagged correctly?', 'audio_tagged_correctly'),
            ('No audio is cut off (at beginning or end)?', 'no_audio_cut_off'),
            ('TRT of audio equals TRT of the video?', 'trt_audio_equals_trt_video'),
            ('Correct language is present (on applicable channels)?', 'correct_language_present')
        )

        for label_value_pair in label_value_pairs:
            table.add_row()
            table.add_cell(label_value_pair[0])

            for section in ('feature', 'audio', 'preview'):
                table.add_cell(self.get_true_false_select_wdg(label_value_pair[1] + '_' + section))

        return table
Esempio n. 42
0
 def make_login_table(my, sob):
     table = Table()
     table.add_style('background-color: #fffff1;')
     max_width = 4
     table.add_row()
     top_cell = table.add_cell('<b><u>Responsible</u></b>')
     top_cell.add_attr('colspan',max_width)
     top_cell.add_attr('align','center')
     count = 0
     users = my.server.eval("@SOBJECT(sthpw/login['location','internal']['license_type','user']['@ORDER_BY','login'])")
     for u in users:
         if count % max_width == 0:
             table.add_row()
         checker = CheckboxWdg('responsible_%s' % u.get('login'))
         checker.add_attr('login',u.get('login'))
         checker.add_attr('code',sob.get('code'))
         checker.add_attr('current_list', sob.get('responsible_users'))
         #checker.set_persistence()
         if sob.get('responsible_users') not in [None,'']:
             if u.get('login') in sob.get('responsible_users'):
                 checker.set_value(True)
             else:
                 checker.set_value(False)
         else:
             checker.set_value(False)
         checker.add_behavior(my.get_make_responsible_behavior())
         table.add_cell(checker)
         label = table.add_cell(u.get('login'))
         label.add_attr('nowrap','nowrap')
         label.add_attr('width','137px')
         count = count + 1
     return table
    def get_section_three_subsection_one(self):
        label_value_pairs = (
            ('Forced narrative on feature?', 'forced_narrative_feature',
             'Does not overlap any credits or other text?', 'overlap_credits_text_1'),
            ('Forced narrative on trailer?', 'forced_narrative_trailer',
             'Does not overlap any credits or other text?', 'overlap_credits_text_2'),
            ('Subtitles on feature?', 'subtitles_on_feature',
             'Does not overlap any credits or other text?', 'overlap_credits_text_3'),
            ('Subtitles on trailer?', 'subtitles_on_trailer',
             'Does not overlap any credits or other text?', 'overlap_credits_text_4'),
        )

        table = Table()

        for label_value_pair in label_value_pairs:
            label_1, value_1, label_2, value_2 = label_value_pair

            table.add_row()
            table.add_cell(label_1)
            table.add_cell(self.get_true_false_select_wdg(value_1))
            table.add_cell(label_2)
            table.add_cell(self.get_true_false_select_wdg(value_2))

        section_div = DivWdg()
        section_div.add(table)

        return section_div
Esempio n. 44
0
    def handle_python_script_test(self, top):
        top.add(DivWdg('Python Script Test', css='spt_info_title'))
        table = Table(css='script')
        table.add_color("color", "color")
        table.add_style("margin: 10px")
        table.add_style("width: 100%")
        top.add(table)
        table.add_row()
        td = table.add_cell("Script Path: ")
        td.add_style("width: 150px")
        text = TextWdg('script_path')
        td = table.add_cell(text)
        button = ActionButtonWdg(title='Run')
        table.add_cell(button)
        button.add_style("float: right")
        button.add_behavior({
            'type':
            'click_up',
            'cbjs_action':
            '''
             var s = TacticServerStub.get();
             try {
                var path =  bvr.src_el.getParent('.script').getElement('.spt_input').value;
                if (! path)
                    throw('Please enter a valid script path');
                s.execute_cmd('tactic.command.PythonCmd', {script_path: path});
             } catch(e) {
                spt.alert(spt.exception.handler(e));
             }

        '''
        })
Esempio n. 45
0
    def handle_load_balancing(self, top):
        # deal with asset directories
        top.add(DivWdg('Load Balancing', css='spt_info_title'))
        table = Table()
        table.add_class("spt_loadbalance")
        table.add_color("color", "color")
        table.add_style("margin: 10px")
        top.add(table)
        table.add_row()
        td = table.add_cell("Load Balancing: ")
        td.add_style("width: 150px")

        button = ActionButtonWdg(title='Test')
        td = table.add_cell(button)
        message_div = DivWdg()
        message_div.add_class("spt_loadbalance_message")
        table.add_cell(message_div)
        button.add_behavior( {
        'type': 'click_up',
        'cbjs_action': '''
        var server = TacticServerStub.get()
        var ports = {};
        var count = 0;
        for (var i = 0; i < 50; i++) {
          var info = server.get_connection_info();
          var port = info.port;
          var num = ports[port];
          if (!num) {
            ports[port] = 1;
            count += 1;
          }
          else {
            ports[port] += 1;
          }
          // if there are 10 requests and still only one, then break
          if (i == 10 && count == 1)
            break;
        }


        // build the ports string
        x = [];
        for (i in ports) {
            x.push(i);
        }
        x.sort();
        x = x.join(", ");

        var loadbalance_el = bvr.src_el.getParent(".spt_loadbalance");
        var message_el = loadbalance_el.getElement(".spt_loadbalance_message");
        if (count > 1) {
            var message = "Yes (found " + count + " ports: "+x+")";
        }
        else {
            var message = "<blink style='background: red; padding: 3px'>Not enabled (found only port " + x + ")</blink>";
        }
        message_el.innerHTML = message
        '''
        } )
Esempio n. 46
0
    def get_display(my):
        div = DivWdg()
        div.add_class("spt_view_manager_top")
        my.set_as_panel(div)

        if not my.search_type or not my.view:
            return div

        div.add(my.get_action_wdg())

        div.add(HtmlElement.br(2))

        tool_bar = my.get_tool_bar()
        div.add(tool_bar)

        div.add(HtmlElement.br())

        # add the template view containing the possible items to be added
        # ie: New Folder, New Entry, New Separator
        menu_div = DivWdg()
        menu_div.set_id("menu_item_template")
        menu_div.add_style("display: none")
        menu_div.add(my.get_section_wdg("_template", editable=False))
        div.add(menu_div)

        table = Table()
        table.add_row()

        # add the section
        td = table.add_cell()
        project_view = DivWdg()
        project_view.set_id("menu_item_list")
        project_view.add(my.get_section_wdg(my.view))
        td.add(project_view)
        td.add_style("vertical-align: top")
        #td.add_attr("rowspan", "2")

        tool_bar = my.get_tool_bar()
        td.add(tool_bar)

        td.add("<br/>")

        # add detail information
        td = table.add_cell(my.get_detail_wdg())

        # FIXME: get rid of hard coded classes
        # set the panel information
        td.set_id("manage_side_bar_detail")
        td.add_class("spt_view_manager_detail")
        td.add_style("display", "table-cell")
        td.add_attr("spt_class_name", "tactic.ui.panel.ManageSideBarDetailWdg")
        td.add_attr("spt_search_type", my.search_type)

        td.add_style("padding: 0 20px 20px 20px")
        td.add_style("vertical-align: top")

        div.add(table)
        return div
Esempio n. 47
0
    def get_top(my):
        top = my.top
        top.add_color("background", "background", -5)
        top.add_style("margin-bottom: -2px")
        top.add_class("spt_filter_top")

        table = Table()
        top.add(table)

        table.add_style("margin-left: auto")
        table.add_style("margin-right: auto")
        table.add_style("width: 100%")


        tr = table.add_row()

        if not my.content:
            my.content = DivWdg()
            my.content.add("No Content")

        td = table.add_cell()
        td.add(my.content)
        my.content.add_style("margin: -2 -1 -2 -2")


        search_wdg = my.get_search_wdg()
        table.add_row()
        search_wdg.add_style("float: middle")
        #search_wdg.add_style("padding-left: 370px")

        search_wdg.add_style("padding-top: 6px")
        search_wdg.add_style("height: 33px")
        #search_wdg.add_style("margin-top: -3px")


        td = table.add_cell()
        td.add_border()
        td.add(search_wdg)
        td.add_color("background", "background", -10)

        #td.add_style("padding-left: 16px")
        #td.add_style("padding-right: 16px")
        #td.add_style("padding-bottom: 15px")

        #td.add_style("padding-top: 8px")
        #td.add_style("border-style: solid")
        #td.add_style("border-color: %s" % td.get_color("border") )
        #td.add_style("border-width: 0px 1px 0px 0px" )




        hidden = HiddenWdg("prefix", my.prefix)
        top.add(hidden)
        # this cannot be spt_search as it will confuse spt.dg_table.search_cbk() 
        top.add_class("spt_simple_search")

        return top
Esempio n. 48
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
Esempio n. 49
0
    def get_info_wdg(my, sobject):

        div = DivWdg()
        div.add_style("margin: 10px 20px 20px 20px")
        div.add_style("padding: 20px")
        div.add_color("background", "background", -3)
        div.add_border()
        div.add_color("color", "color3")
        div.set_round_corners(5)

        div.add_style("height", "100%")
        div.add_style("position: relative")

        element_names = my.kwargs.get("element_names")
        if not element_names:
            element_names = [
                "code",
                "name",
                "description",
            ]
        else:
            element_names = element_names.split(",")

        view = "table"

        from pyasm.widget import WidgetConfigView
        search_type = sobject.get_search_type()
        config = WidgetConfigView.get_by_search_type(search_type, view)

        table = Table()
        table.add_style("height", "100%")
        div.add(table)
        for element_name in element_names:
            table.add_row()
            title = Common.get_display_title(element_name)
            td = table.add_cell("%s: " % title)
            td.add_style("width: 200px")
            td.add_style("padding: 5px")

            element = config.get_display_widget(element_name)
            element.set_sobject(sobject)
            element.preprocess()
            td = table.add_cell(element)
            td.add_style("padding: 5px")
            #value = sobject.get_value(element_name, no_exception=True) or "N/A"
            #table.add_cell(value)

        div.add("<br/>")
        from tactic.ui.widget import DiscussionWdg
        search_key = sobject.get_search_key()
        notes_wdg = DiscussionWdg(search_key=search_key)
        notes_wdg.set_sobject(sobject)
        div.add(notes_wdg)

        return div
Esempio n. 50
0
    def add_unassigned_instances(self, widget, shot_inst_names):
        ''' add the unassigned instances into a SwapDisplayWdg '''
        info = []
        session = SessionContents.get()
        if not session:
            return ""

        tactic_nodes = session.get_instance_names(is_tactic_node=True)
        non_tactic_nodes = session.get_node_names(is_tactic_node=False)
        """
        title = HtmlElement.b('Unassigned instances')
        widget.add(title)

                  # this is just a filler for now, can be any sobjects
        snapshots = []
        for tactic_node in tactic_nodes:
            if tactic_node not in shot_inst_names:
                session_version = session.get_version(tactic_node) 
                session_snap = session.get_snapshot(tactic_node)
                if session_snap:
                    snapshots.append(session_snap)
                    info.append({'session_version': session_version, 'instance':\
                    tactic_node})

        div = DivWdg(id="unassigned_table")

        SwapDisplayWdg.create_swap_title( title, swap, div) 
        table = TableWdg('sthpw/snapshot', 'session_items')
        table.set_show_property(False)
        table.set_aux_data(info)
        table.set_sobjects(snapshots)
        div.add(table)
        widget.add(div)
        widget.add(HtmlElement.br())

        """
        # Add other non-tactic nodes
        swap2 = SwapDisplayWdg.get_triangle_wdg()

        title2 = HtmlElement.b('Other Nodes')
        div2 = DivWdg(id="other_node_div")

        widget.add(swap2)
        widget.add(title2)

        SwapDisplayWdg.create_swap_title(title2, swap2, div2)
        hidden_table = Table(css='table')
        div2.add(hidden_table)
        hidden_table.set_max_width()
        for node in non_tactic_nodes:
            hidden_table.add_row()
            hidden_table.add_cell(node)
            hidden_table.add_blank_cell()

        widget.add(div2)
Esempio n. 51
0
    def get_display(self):

        top = self.top
        top.add_class("spt_share_top")
        self.set_as_panel(top)

        top.add_color("background", "background")

        title = DivWdg()
        top.add(title)
        title.add_style("font-size: 18px")
        title.add_style("font-weight: bold")
        title.add_style("text-align: center")
        title.add_style("padding: 10px")
        #title.add_style("margin: -10px -10px 10px -10px")

        title.add_gradient("background", "background3", 5, -10)

        title.add("Share Project")



        # add the main layout
        #table = ResizableTableWdg()
        table = Table()
        table.add_color("color", "color")
        top.add(table)

        table.add_row()
        left = table.add_cell()
        left.add_border()
        left.add_style("vertical-align: top")
        left.add_style("min-width: 250px")
        left.add_style("height: 400px")
        left.add_color("background", "background3")

        left.add(self.get_share_wdg() )

        right = table.add_cell()
        right.add_border()
        right.add_style("vertical-align: top")
        right.add_style("min-width: 400px")
        right.add_style("width: 100%")
        right.add_style("height: 400px")
        right.add_style("padding: 5px")

        right.add_class("spt_share_content")


        share_item_wdg = ShareItemWdg()
        right.add(share_item_wdg)


        return top
Esempio n. 52
0
    def get_row_wdg_new(my, buttons, show_title=False):

        div = DivWdg()
        """
        div.set_round_corners(8)
        div.add_border()
        div.add_style("padding-top: 1px")
        div.add_style("padding-left: 5px")
        div.add_style("padding-right: 5px")
        div.add_gradient("background", "background", 5, -30)
        """

        div = DivWdg()
        div.set_round_corners(3)
        #div.add_border()
        div.add_style("padding-top: 1px")
        div.add_style("padding-left: 5px")
        div.add_style("padding-right: 5px")
        #div.add_gradient("background", "background", -5, -10)

        web = WebContainer.get_web()
        browser = web.get_browser()

        table = Table()
        div.add(table)
        div.add_style("overflow: hidden")

        table.add_attr("cellspacing", "0px")
        table.add_attr("cellpadding", "0px")
        table.add_row()

        if browser == "Mozilla":
            table.add_style("margin-top: -5px")
            div.add_style("height: 30px")
        else:
            table.add_style("margin-top: -5px")

        base = "%s/%s" % (BASE, my.top.get_theme())

        for count, button in enumerate(buttons):
            td = table.add_cell()
            td.add(button)

            if button.get_show_arrow_menu():
                spacer = DivWdg()
                table.add_cell(spacer)
                spacer.add_style("width: 6px")

            if count < len(buttons) - 1:
                spacer = DivWdg()
                table.add_cell(spacer)
                spacer.add_style("width: 6px")

        return div
Esempio n. 53
0
    def get_info_wdg(self, sobject):

        div = DivWdg()
        div.add_style("margin: 10px 20px 20px 20px")
        div.add_style("padding: 0px 20px")
        #div.add_color("background", "background", -3)
        #div.add_border()
        #div.add_color("color", "color3")
        #div.set_round_corners(5)

        div.add_style("height", "100%")
        div.add_style("position: relative")

        element_names = self.element_names
        config = self.config

        table = Table()
        table.add_style("height", "100%")
        div.add(table)
        for element_name in element_names:
            table.add_row()
            title = Common.get_display_title(element_name)
            td = table.add_cell("%s: " % title)
            td.add_style("width: 200px")
            td.add_style("padding: 5px")

            element = config.get_display_widget(element_name)

            if self.first:
                try:
                    element.handle_layout_behaviors(self.layout_wdg)
                except Exception as e:
                    print "e :", e
                    pass

            element.set_sobject(sobject)
            element.preprocess()
            td = table.add_cell(element)
            td.add_style("padding: 5px")
            #value = sobject.get_value(element_name, no_exception=True) or "N/A"
            #table.add_cell(value)

        show_notes = self.kwargs.get("show_notes")

        if show_notes in [True, 'true']:
            div.add("<br/>")
            from tactic.ui.widget import DiscussionWdg
            search_key = sobject.get_search_key()
            notes_wdg = DiscussionWdg(search_key=search_key)
            notes_wdg.set_sobject(sobject)
            div.add(notes_wdg)

        return div
Esempio n. 54
0
    def get_top(my):
        top = my.top
        top.add_color("background", "background", -5)
        top.add_style("margin-bottom: -2px")
        top.add_class("spt_filter_top")

        table = Table()
        top.add(table)

        table.add_style("margin-left: auto")
        table.add_style("margin-right: auto")
        table.add_style("width: 100%")


        tr = table.add_row()

        if not my.content:
            my.content = DivWdg()
            my.content.add("No Content")

        td = table.add_cell()
        td.add(my.content)
        my.content.add_style("margin: -2 -1 -2 -2")


        show_search = my.kwargs.get("show_search")
        if show_search in [False, 'false']:
            show_search = False
        else:
            show_search = True
        if show_search:
            search_wdg = my.get_search_wdg()
            table.add_row()
            search_wdg.add_style("float: right")

            search_wdg.add_style("padding-top: 6px")
            search_wdg.add_style("padding-left: 10px")
            search_wdg.add_style("height: 33px")

            td = table.add_cell()
            td.add(search_wdg)
            td.add_style("padding: 10px 20px")
            #td.add_border()
            #td.add_color("background", "background", -10)



        hidden = HiddenWdg("prefix", my.prefix)
        top.add(hidden)
        # this cannot be spt_search as it will confuse spt.dg_table.search_cbk() 
        top.add_class("spt_simple_search")

        return top
    def get_display(self):
        audio_configuration_table = Table()
        audio_configuration_table.set_id('audio_configuration_table')
        audio_configuration_table.add_style('margin', '10px')

        if self.lines:
            audio_configuration_table.add_row()
            audio_configuration_table.add_header('Audio Configuration')

            audio_configuration_table.add_row()
            audio_configuration_table.add_header('Channel')
            audio_configuration_table.add_header('Content')
            audio_configuration_table.add_header('Tone')
            audio_configuration_table.add_header('Peak')

            for iterator, line in enumerate(self.lines):
                current_row = audio_configuration_table.add_row()

                audio_configuration_table.add_cell(
                    self.get_text_input_wdg_for_audio_config(
                        'channel-{0}'.format(iterator), 150,
                        line.get_value('channel')))
                audio_configuration_table.add_cell(
                    self.get_text_input_wdg_for_audio_config(
                        'content-{0}'.format(iterator), 150,
                        line.get_value('content')))
                audio_configuration_table.add_cell(
                    self.get_text_input_wdg_for_audio_config(
                        'tone-{0}'.format(iterator), 150,
                        line.get_value('tone')))
                audio_configuration_table.add_cell(
                    self.get_text_input_wdg_for_audio_config(
                        'peak-{0}'.format(iterator), 150,
                        line.get_value('peak')))
                audio_configuration_table.add_cell(
                    HiddenWdg('audio-line-code-{0}'.format(iterator),
                              line.get_code()))
                audio_configuration_table.add_cell(
                    self.get_remove_row_button(line.get_code()))
        else:
            audio_configuration_table.add(
                "No Audio Configuration lines exist yet. Add one?")

        audio_configuration_table.add(self.get_add_row_button())

        main_div = DivWdg()
        main_div.set_id('audio_config_lines_div')
        main_div.add_style('margin', '10px')
        main_div.add(audio_configuration_table)

        return main_div
Esempio n. 56
0
    def get_display(my):
        notification_logins = my.get_logins()

        table = Table()
        table.add_color("color", "color")

        for notification_login in notification_logins:
            type = notification_login.get_value("type")
            user = notification_login.get_value("login")
            table.add_row()
            table.add_cell(type)
            table.add_cell(user)

        return table
Esempio n. 57
0
    def get_section_four_table_two(self, label_value_pairs):
        table = Table()

        table.add_row()
        table.add_header('Poster Art (One Sheet)')

        for label_value_pair in label_value_pairs:
            label, value = label_value_pair

            table.add_row()
            table.add_cell(label)
            table.add_cell(self.get_true_false_select_wdg(value))

        return table
Esempio n. 58
0
    def get_section_one_table_three(self, label_value_pairs):
        table = Table()

        table.add_row()
        table.add_header('Confirm the build of trailer/preview')

        for label_value_pair in label_value_pairs:
            label, value = label_value_pair

            table.add_row()
            table.add_cell(label)
            table.add_cell(self.get_true_false_select_wdg(value))

        return table
Esempio n. 59
0
    def get_section_one_table_two(self, label_value_pairs):
        table = Table()
        table.add_style('float', 'left')

        table.add_row()
        table.add_header('Confirm the build of the feature')

        for label_value_pair in label_value_pairs:
            label, value = label_value_pair

            table.add_row()
            table.add_cell(label)
            table.add_cell(self.get_true_false_select_wdg(value))

        return table
Esempio n. 60
0
    def get_connect_wdg(self):

        div = DivWdg()
        div.set_name("Connection")

        table = Table()
        div.add(table)

        from tactic.ui.panel import EditWdg
        edit = EditWdg(search_type="sthpw/db_resource", view="edit")

        table.add_row()
        table.add_cell(edit)

        return div