当前位置: 首页>>代码示例>>Python>>正文


Python web.HtmlElement类代码示例

本文整理汇总了Python中pyasm.web.HtmlElement的典型用法代码示例。如果您正苦于以下问题:Python HtmlElement类的具体用法?Python HtmlElement怎么用?Python HtmlElement使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了HtmlElement类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _get_sobject_history_wdg

    def _get_sobject_history_wdg(my):
        ''' this method is called thru ajax '''
        args = WebContainer.get_web().get_form_args()
        
        # get the args in the URL
        search_type = args['search_type']
        search_id = args['search_id']
        #sobject = Search.get_by_id(search_type, search_id)

        div = Widget()

        search = Search("sthpw/sobject_log")
        search.add_filter("search_type", search_type)
        search.add_filter("search_id", search_id)
        sobjects = search.get_sobjects()

        search = Search("sthpw/transaction_log")
        search.add_filters("id", [x.get_value("transaction_log_id") for x in sobjects] )
        sobjects = search.get_sobjects()


        table = TableWdg("sthpw/transaction_log", "table", css='table')
        table.set_show_property(False)
        table.set_sobjects(sobjects)
        div.add(table)
        div.add(HtmlElement.br(2))

        return div

     
        div.add(assigned_shot_wdg)
        div.add(HtmlElement.br(2))
        return div
开发者ID:0-T-0,项目名称:TACTIC,代码行数:33,代码来源:asset_detail_wdg.py

示例2: draw_widgets

 def draw_widgets(my, widget, delete_widget, item_span):
     '''actually drawing the widgets'''
     widget.add(item_span)
     widget.add(HtmlElement.br(2))
     widget.add(SpanWdg(my.select, css='med'))
     widget.add(delete_widget)
     widget.add(HtmlElement.br(2))
开发者ID:0-T-0,项目名称:TACTIC,代码行数:7,代码来源:task_wdg.py

示例3: get_display

    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
开发者ID:2gDigitalPost,项目名称:tactic_src,代码行数:60,代码来源:smart_menu_wdg.py

示例4: get_div_for_department_instructions

    def get_div_for_department_instructions(self, department_instructions_sobject):
        department_instructions_div = DivWdg()

        department_instructions_div.add(HtmlElement.h4(department_instructions_sobject.get('name')))
        department_instructions_div.add(HtmlElement.p(department_instructions_sobject.get('instructions_text')))

        return department_instructions_div
开发者ID:2gDigitalPost,项目名称:custom-rewrite,代码行数:7,代码来源:instructions_template_builder_wdg.py

示例5: get_display

    def get_display(self):
        # Set up the outer <div> to hold all the form elements
        outer_div = DivWdg()
        outer_div.add_class('new-order-entry-form')
        outer_div.set_id('new-order-entry-form')

        # Set up the <input> widget for 'name'
        outer_div.add(HtmlElement.label('Name'))
        name_input = TextInputWdg(name='name')
        outer_div.add(name_input)

        # Set up the <input> widget for 'po_number'
        outer_div.add(HtmlElement.label('PO Number'))
        po_number_input = TextInputWdg()
        po_number_input.set_name('po_number')
        outer_div.add(po_number_input)

        # Set up the <select> widget and it's options for 'client'
        outer_div.add(HtmlElement.label('Client'))
        client_select_wdg = get_select_widget_from_search_type('twog/client', 'client', 'name', 'code')
        outer_div.add(client_select_wdg)

        # Set up the Save button
        save_button = SubmitWdg('Save')
        save_button.add_behavior(self.save_button_behavior())
        outer_div.add(save_button)

        # Set up the Save and Add button
        save_and_add_button = SubmitWdg('Save and Add')
        save_and_add_button.add_behavior(self.save_and_add_button_behavior())
        outer_div.add(save_and_add_button)

        return outer_div
开发者ID:2gDigitalPost,项目名称:custom-rewrite,代码行数:33,代码来源:new_order_entry.py

示例6: get_folder_wdg

    def get_folder_wdg(my, element_name, config, options, base_path, current_path, info, personal, use_same_config):
        li = HtmlElement.li()
        li.add_class("spt_side_bar_link")
        li.add_class("main_li")


        title = my._get_title(config, element_name)
        title_wdg = DivWdg()
        title_wdg.add_class("menu_header")
        li.add(title_wdg)
        title_wdg.add(title)


        ul = HtmlElement.ul()
        li.add(ul)
        ul.add_class("spt_side_bar_section")
        ul.add_class("sub_ul")

        # then get view name from options in order to read a new
        # config and recurse ...
        options_view_name = options.get('view')
        if options_view_name:
            if use_same_config:
                xml = config.get_xml()
                sub_config = WidgetConfig.get(xml=xml)
                sub_config.set_view(options_view_name)
            else:
                sub_config = my.get_config( my.config_search_type, options_view_name, default=my.default, personal=personal)

            info['level'] += 1
            my.generate_section( sub_config, ul, info, base_path=current_path, personal=personal, use_same_config=use_same_config )
            info['level'] -= 1

        return li
开发者ID:davidsouthpaw,项目名称:TACTIC,代码行数:34,代码来源:simple_side_bar_wdg.py

示例7: get_out_files_list

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
开发者ID:2gDigitalPost,项目名称:custom-rewrite,代码行数:30,代码来源:task_inspect_wdg.py

示例8: get_license_info_wdg

    def get_license_info_wdg(self):
        div = DivWdg()

        license = Environment.get_security().get_license()
        if self.first_error:
            return div
        #if not license.is_licensed():
        #    return div

        msg = DivWdg()
        div.add(msg)
        msg.add("The following describes the details of the installed license:<br/><br/>")


        info_wdg = DivWdg()
        div.add(info_wdg)
        info_wdg.add_style("margin: 10px 30px")
        info_wdg.add_style("font-size: 12px")

        version = license.get_data("tactic_version")
        if version:
            info_wdg.add("TACTIC Version: ")
            if version == "ALL":
                version = "ALL (Open Source)"
            info_wdg.add(version)
            info_wdg.add(HtmlElement.br(2))


        company = license.get_data("company")
        info_wdg.add("Licensed To: ")
        if company.find("Southpaw EPL") != -1:
            company = SpanWdg("<a name='license'>Eclipse Public License v1.0</a> &nbsp;")
            icon = IconWdg("EPL v1.0", IconWdg.ZOOM)
            company.add(icon)
            company.add_class("hand")
            company.add_behavior( {
                'type': 'click_up',
                'cbjs_action': '''
                    spt.help.load_alias("license")
                '''
            } )
        info_wdg.add(company)
        info_wdg.add(HtmlElement.br(2))

        info_wdg.add("Max Users: ")
        info_wdg.add(license.get_data("max_users") )
        info_wdg.add(HtmlElement.br(2))

        info_wdg.add("Current Users: ")
        info_wdg.add(license.get_current_users() )
        info_wdg.add(HtmlElement.br(2))

        info_wdg.add("Expiry Date: ")
        expiry_date = license.get_data("expiry_date")
        if not expiry_date:
            expiry_date = "Permanent"
        info_wdg.add(expiry_date)
        info_wdg.add(HtmlElement.br(2))

        return div
开发者ID:mincau,项目名称:TACTIC,代码行数:60,代码来源:license_manager_wdg.py

示例9: get_files_list

    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
开发者ID:2gDigitalPost,项目名称:custom-rewrite,代码行数:30,代码来源:package_inspect_wdg.py

示例10: get_display

    def get_display(my):

        width = my.kwargs.get("width")
        if not width:
            width = "100%"
        height = my.kwargs.get("height")

        sobject = my.get_current_sobject()

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

        path = my.path
        if path:
            img = HtmlElement.img(src=path)
        else:
            search_type = sobject.get_search_type_obj()
            path = my.get_path_from_sobject(search_type)
            if path:
                img = DivWdg()
                img.add_style("opacity: 0.2")

                img_inner = HtmlElement.img(src=path)
                img.add(img_inner)

                img_inner.add_style("width: %s" % width)

        if path and path.startswith("/context"):
            img.add_style("padding: 10px 15%")
            img.add_style("width: 70%")
        elif path:
            img.add_style("width: %s" % width)
            if height:
                img.add_style("height: %s" % height)
            img.add_style('margin-left','auto')
            img.add_style('margin-right','auto')

        if not path:
            img = DivWdg()
        img.add_class("spt_image")
        div.add(img)

        if height or my.show_name_hover in ["True","true",True]:
            div.add_style("height: 100%")

        if my.show_name_hover in ["True","true",True]:
            name_hover = DivWdg()
            name_hover.add_class("spt_name_hover")
            name_hover.add(sobject.get('name'))
            name_hover.add_attr('onmouseenter',"this.setStyle('opacity',1)")
            name_hover.add_attr('onmouseleave',"this.setStyle('opacity',0)")
            name_hover.add_styles('opacity: 0; font-size: 16px; color: rgb(217, 217, 217); top: 0px; \
                                transition: opacity 0s ease-out; -webkit-transition: opacity 0s ease-out; \
                                height: 100%; width: 100%; position: absolute; padding-top: 20px; \
                                text-align: center; background-color: rgba(0, 0, 0, 0.6);')
            div.add(name_hover)

        return div
开发者ID:2gDigitalPost,项目名称:tactic_src,代码行数:58,代码来源:tile_layout_wdg.py

示例11: get_no_icon_wdg

    def get_no_icon_wdg(my, missing=False):
        sobject = my.get_current_sobject()
        if not sobject:
            return ''

        div = my.top
        div.add_style("position: relative")
        div.add_style("margin: 3px")
        div.add_class("spt_thumb_top")

        div.set_id( "thumb_%s" %  sobject.get_search_key() )
        icon_size = my.get_icon_size()

        if icon_size:
            div.add_style("%s: %s" % (my.aspect, icon_size) )

        if missing:
            img = HtmlElement.img(ThumbWdg.get_missing_image())
        elif sobject.get_value("_is_collection", no_exception=True):
            img = HtmlElement.img("/context/icons/mime-types/folder2.jpg")
        else:
            img = HtmlElement.img(ThumbWdg.get_no_image())

        img.add_class("spt_image")


        #from tactic.ui.table import SObjectDetailElementWdg
        #detail = SObjectDetailElementWdg()
        #detail.set_widget(img)
        #detail.set_sobject(sobject)
        #div.add(detail)

        div.add(img)
        div.add_class("hand")
        if my.SQL_ERROR:
            warning_div = DivWdg('<i>-- preprocess error --</i>')
            warning_div.add_styles('position: absolute; z-index: 100; float: left; top: 0; left: 0; font-size: smaller;')
            div.add_style('position: relative')
            div.add(warning_div)

        search_key = SearchKey.get_by_sobject(sobject)
        code = sobject.get_code()
       
        
        detail = my.get_option("detail")
        if detail != 'false':
            my.add_icon_behavior(div, sobject)

        unit = None
        if isinstance(icon_size, basestring):
            icon_size, unit = my.split_icon_size(icon_size)

            img.add_style("%s: 100%%" % my.aspect )
        else:
            img.add_style("%s: %s" % (my.aspect, my.get_icon_size()) )
            img.add_style("min-%s: 15px" % my.aspect)

        return div
开发者ID:asmboom,项目名称:TACTIC,代码行数:58,代码来源:file_wdg.py

示例12: init

    def init(self):
        if self.icon_path.startswith("BS") or self.icon_path.startswith("FA"):
            icon_path = self.icon_path
        elif not self.icon_path.startswith("/"):
            # icon_path = "/context/icons/oo/%s" % self.icon_path
            icon_path = "/context/icons/silk/%s" % self.icon_path
        else:
            icon_path = self.icon_path

        if icon_path.startswith("BS_"):
            icon = HtmlElement.span()
            icon.add_class("glyphicon")
            part = icon_path.replace("BS_", "")
            part = part.lower()
            part = part.replace("_","-")
            if part == "save":
                part = "floppy-disk"
            icon.add_class("glyphicon-%s" % part)
            if not self.size:
                self.size = "16px"
            icon.add_style("font-size: %s" % self.size)
            if not self.opacity:
                self.opacity = 0.6

        elif icon_path.startswith("FA"):
            icon = HtmlElement.i()
            icon.add_class("fa")
            part = icon_path.replace("FA_", "")
            part = part.lower()
            part = part.replace("_","-")
            icon.add_class("fa-%s" % part)
            if not self.size:
                self.size = "16px"
            icon.add_style("font-size: %s" % self.size)
            if not self.opacity:
                self.opacity = 0.6


        else:
            icon = HtmlElement.img(icon_path)

        if self.opacity:
            icon.add_style("opacity: %s" % self.opacity)


        if self.text and self.text != "":
            icon.set_attr("title", self.text)
        if self.right_margin:
            icon.add_style("margin-right: %s" % self.right_margin)
       
        self.icon = icon

        inline = self.kwargs.get("inline")
        if inline in [False, 'false']:
            self.add_style("float: left")
        else:
            self.add_style("display: inline")
开发者ID:mincau,项目名称:TACTIC,代码行数:57,代码来源:icon_wdg.py

示例13: get_display

    def get_display(my):
        web = WebContainer.get_web()
        if not my.view:
            view = web.get_form_value("filter|view")

        # create popup
        create_popup = PopupWdg("create_action")
        create_popup.set_auto_hide(False)
        create_popup.add("Enter name of view: ")
        create_popup.add(TextWdg("create_view_name"))
        # create_popup.add( HtmlElement.br(2) )
        # create_popup.add( "Copy from template: " )
        # template_select = SelectWdg("copy_from_template")
        # template_select.add_empty_option("-- None --")
        # template_select.set_option("values", "list|summary|task")
        # create_popup.add( template_select )

        create_popup.add(HtmlElement.br(2, clear="all"))

        from pyasm.prod.web import ProdIconButtonWdg, ProdIconSubmitWdg

        create_icon = ProdIconButtonWdg("Create")

        ajax = AjaxCmd()
        ajax.register_cmd("pyasm.widget.CustomCreateViewCbk")
        ajax.add_element_name("create_view_name")
        ajax.add_element_name("auto_create_edit")
        ajax.set_option("search_type", my.search_type)
        ajax.set_option("project", Project.get_project_code())
        if my.view:
            ajax.set_option("template_view", my.view)
        create_icon.add_event(
            "onclick",
            "%s;%s"
            % (ajax.get_on_script(), "toggle_display('create_action');setTimeout('document.form.submit()',1000)"),
        )

        cancel_icon = ProdIconButtonWdg("Cancel")
        cancel_icon.add_event("onclick", "toggle_display('create_action')")

        span = SpanWdg()
        span.add(create_icon)
        span.add(cancel_icon)
        create_popup.add(span)
        create_popup.add(HtmlElement.br())

        # add the create button
        create = IconButtonWdg("Create View", IconWdg.SAVE, True)
        create.add_event("onclick", "%s" % create_popup.get_on_script())

        # lay it all out
        widget = Widget()
        widget.add(create_popup)
        # Browser does not have create
        # widget.add(create)
        return widget
开发者ID:hellios78,项目名称:TACTIC,代码行数:56,代码来源:custom_view_app_wdg.py

示例14: get_display

    def get_display(my):

        # just refresh the whole thing 
        widget = DivWdg()
        
        outer_widget = DivWdg(css='spt_view_panel')
        search_div = DivWdg()
        search_bvr = {
            'type':         'click_up',
            'cbjs_action':  'spt.dg_table.search_cbk(evt, bvr)',
            'override_class_name': 'tactic.ui.cgapp.AppShotPanelWdg',
            'override_target': 'bvr.src_el.getParent(".spt_app_shot_panel")',
            'extra_args': {'instance_search_type': my.instance_search_type,
                        'asset_search_type': my.asset_search_type}
            #'panel_id':     'main_body_search'
            
        }

        # WARNING: this is made just for main search box and  won't be compatible with the simple search wdg
        search_wdg = SearchWdg(search_type=my.search_type, custom_search_view='search_shot_loader', parent_key='', filter=''\
            , display='block', custom_filter_view='', state=None, run_search_bvr=search_bvr)

        #from tactic.ui.app.simple_search_wdg import SimpleSearchWdg
        #search_wdg = SimpleSearchWdg(search_type=my.search_type, search_view=my.simple_search_view, state=None, run_search_bvr=search_bvr)
        search_div.add( HtmlElement.spacer_div(1,10) )
        search_div.add(search_wdg)

        # if there is result, it could only be one shot
        search = search_wdg.get_search()
        shots = search.get_sobjects()

        # avoid getting a shot when no shot is selected
        if not my.shot_code and len(shots) == 1:
            my.shot_code = shots[0].get_code()
        
        outer_widget.add(search_div)

        my.set_as_panel(outer_widget, class_name='spt_panel spt_view_panel spt_app_shot_panel')
        #show_shot_panel = False
        #if show_shot_panel:
        panel = ViewPanelWdg( search_type=my.search_type, \
                 inline_search=True, show_search='false', show_refresh='false', view=my.view, \
                run_search_bvr=search_bvr, simple_search_view=my.simple_search_view)
        panel.set_sobjects(shots)

        widget.add(panel)
         
        show_instances_in_shot = ProdSetting.get_value_by_key("show_instances_in_shot_panel")
        if show_instances_in_shot != "false":

            widget.add(HtmlElement.h3("Asset Instances in Shot [%s]" %my.shot_code))
            widget.add(HtmlElement.br(2))
            asset_inst_panel = AppAssetInstancePanelWdg(search_type=my.search_type, instance_search_type=my.instance_search_type, asset_search_type=my.asset_search_type, shot_code=my.shot_code, show_search='false')
            widget.add(asset_inst_panel)
        outer_widget.add(widget)
        return outer_widget
开发者ID:0-T-0,项目名称:TACTIC,代码行数:56,代码来源:app_panel_wdg.py

示例15: get_error_wdg

    def get_error_wdg(my):
        div = DivWdg()
        error_div = DivWdg()
        error_div.add("Error %s" % my.status)
        div.add(error_div)
        error_div.add_style("font-size: 18px")
        error_div.add_style("font-weight: bold")
        error_div.add_style("padding: 10px")
        error_div.add_style("width: auto")
        error_div.add_gradient("background", "background")
        error_div.add_border()
        error_div.add_style("margin-left: 5px")
        error_div.add_style("margin-right: 5px")
        error_div.add_style("margin-top: -10px")

        div.add("<br/>")


        span = DivWdg()
        #span.add_color("color", "color")
        span.add_style("color", "#FFF")
        if my.status == 404:
            span.add(HtmlElement.b("You have tried to access a url that is not recognized."))
        else:
            span.add(HtmlElement.b(my.message))
        span.add(HtmlElement.br(2))

        web = WebContainer.get_web()
        root = web.get_site_root()
        if my.message.startswith('No project ['):
            label = 'You may need to correct the default_project setting in the TACTIC config.'
        else:
            label = "Go to the Main page for a list of valid projects"
        span.add(label)
        div.add(span)
        div.add(HtmlElement.br())

        from tactic.ui.widget import ActionButtonWdg
        button_div = DivWdg()
        button_div.add_style("width: 90px")
        button_div.add_style("margin: 0px auto")

        div.add(button_div)
        button = ActionButtonWdg(title="Go to Main", tip='Click to go to main page')
        button_div.add(button)
        
        button.add_behavior( {
        'type': 'click_up',
        'cbjs_action': '''
        document.location = '/';
        '''
        } )
        button.add_event("onmouseup", "document.location='/'")

        return div
开发者ID:0-T-0,项目名称:TACTIC,代码行数:55,代码来源:error_wdg.py


注:本文中的pyasm.web.HtmlElement类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。