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


Python ActionButtonWdg.set_id方法代码示例

本文整理汇总了Python中tactic.ui.widget.ActionButtonWdg.set_id方法的典型用法代码示例。如果您正苦于以下问题:Python ActionButtonWdg.set_id方法的具体用法?Python ActionButtonWdg.set_id怎么用?Python ActionButtonWdg.set_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在tactic.ui.widget.ActionButtonWdg的用法示例。


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

示例1: get_display

# 需要导入模块: from tactic.ui.widget import ActionButtonWdg [as 别名]
# 或者: from tactic.ui.widget.ActionButtonWdg import set_id [as 别名]
    def get_display(my):

        top = my.top
        top.add_class("spt_upload_top")

        title = my.kwargs.get("title")
        name = my.kwargs.get("name")

        if not name:
            name = "upload"

        if not title:
            title = Common.get_display_title(name)

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


        hidden = HiddenWdg(name)
        top.add(hidden)


        multiple = my.kwargs.get("multiple")
        if multiple in [True, 'true']:
            multiple = True
        else:
            multiple = False

       
        if my.upload_id:
            upload_id = my.upload_id
        else:
            upload = Html5UploadWdg(name=name, multiple=multiple)
            top.add(upload)
            upload_id = upload.get_upload_id()



        from tactic.ui.widget import ActionButtonWdg
        button = ActionButtonWdg(title=title)


        button_id = my.kwargs.get("id")
        if button_id:
            button.set_id(button_id)
        top.add(button)

        upload_init = my.kwargs.get("upload_init")
        if not upload_init:
            upload_init = ""



        upload_start = my.kwargs.get("upload_start")
        if not upload_start:
            upload_start = '''
            var top = bvr.src_el.getParent(".spt_upload_top");
            var hidden = top.getElement(".spt_input");
            var file = spt.html5upload.get_file();
            if (!file) {
               return;
            }
            hidden.value = file.name;
            '''
 
        on_complete = my.get_on_complete()
        if not on_complete:
            on_complete = '''
            var files = spt.html5upload.get_files();
            if (files.length == 0) {
               alert('Error: files cannot be found.')
               spt.app_busy.hide();
               return;
            }

            spt.notify.show_message("Uploaded "+files.length+" files");
            spt.app_busy.hide();
            '''

        upload_progress = my.kwargs.get("upload_progress")
        if not upload_progress:
            upload_progress = '''
            var percent = Math.round(evt.loaded * 100 / evt.total);
            spt.app_busy.show("Uploading ["+percent+"%% complete]");
            '''

        reader_load = my.kwargs.get("reader_load")
        if not reader_load:
            reader_load = ""


        button.add_behavior( {
            'type': 'click_up',
            'upload_id': upload_id,
            'search_key': search_key,
            'ticket': my.ticket,
            'multiple': multiple,
            'kwargs': my.on_complete_kwargs,
            'cbjs_action': '''
            var search_key = bvr.search_key;

#.........这里部分代码省略.........
开发者ID:makeittotop,项目名称:python-scripts,代码行数:103,代码来源:html5_upload_wdg.py


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