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


Python CheckboxWdg.persistence方法代码示例

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


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

示例1: get_display

# 需要导入模块: from pyasm.widget import CheckboxWdg [as 别名]
# 或者: from pyasm.widget.CheckboxWdg import persistence [as 别名]

#.........这里部分代码省略.........
        process_div = DivWdg()
        process_dialog.add(process_div)
        #process_div.add_style("padding: 5px")
        process_div.add_color("background", "background")
        process_div.add_color("color", "color")
        process_div.add_border()

        refresh = ActionButtonWdg(title="Refresh")
        refresh.add_style('margin: 0 auto 10px auto')
        process_div.add(refresh)
        refresh.add_behavior( {
        'type': 'click_up',
        'cbjs_action': '''
            var top = bvr.src_el.getParent(".spt_uber_notes_top");
            var tbody = top.getElements('.spt_table_tbody')[2];
            var values = spt.api.Utility.get_input_values(tbody);
            spt.panel.refresh(top, values, false);
        '''
        } )
        process_div.add("<hr/>")


        selected_process_names = []
        step = 0
        
        for idx, value in enumerate(self.process_names):
            checkbox_name = 'note_process_cb'
            if self.child_mode:
                selected_process_names.append(value)
                #break
            cb = CheckboxWdg(checkbox_name, label=value)

           
            cb.persistence = True
            cb.persistence_obj = cb
            key = cb.get_key()
            cb.set_option('value', value)
            #cb.set_persistence()

            cb.add_behavior({
                'type': 'click_up',
                'cbjs_action': '''
                    spt.input.save_selected(bvr, '%s','%s');
                ''' % (checkbox_name, key)
            }) 

            # only 1 is selected in child_mode
            if cb.is_checked():
                selected_process_names.append(value)


            if idx == 0 or idx == 10 * step:
                # add a new inner div
                inner_div = self._get_inner_div()
                process_div.add(inner_div, 'inner%s'%step)
                step += 1
                
            inner_div.add(cb)

            inner_div.add("<br/>")
            

        # if less than 10, make it wider
        if len(self.process_names) < 10:
            inner_div.add_style('width: 100px')
开发者ID:mincau,项目名称:TACTIC,代码行数:69,代码来源:note_wdg.py

示例2: get_viewer

# 需要导入模块: from pyasm.widget import CheckboxWdg [as 别名]
# 或者: from pyasm.widget.CheckboxWdg import persistence [as 别名]
    def get_viewer(self):
        top = DivWdg(css='spt_note_viewer_top')
            
        # draw checkbox options
        swap = SwapDisplayWdg()
        title = SpanWdg('main context')

        split_div = FloatDivWdg(css='spt_split_cb')
        div = DivWdg(css='spt_main_context_cb')
        content_div = DivWdg()
        content_div.add_color('color','color')
        content_div.add_style('padding: 10px') 
        SwapDisplayWdg.create_swap_title(title, swap, content_div, is_open=False)
        div.add(swap)

        div.add(title)

        checkbox_name = 'split_screen'
        split_cb = CheckboxWdg(checkbox_name, label='Split View')
        split_cb.persistence = True
        split_cb.persistence_obj = split_cb
        key = split_cb.get_key()
      
        #cb.add_style('float: left') 
        split_cb.add_behavior({'type': 'click_up',
        
                'propagate_evt': True,
                'cbjs_action': '''
                    var top = bvr.src_el.getParent(".spt_note_viewer_top");
                    var table_top = top.getElement(".spt_note_viewer_table");

                    var cbs = top.getElement('.spt_main_context_cb');
                    var values = spt.api.Utility.get_input_values(cbs);

                    var processes = values.note_context_cb;
                    var kwargs = { process_names: processes};
                    if (bvr.src_el.checked) {
		        kwargs.split_view = 'true';
			kwargs.show_context = 'true';
                        kwargs.left_process_names = processes;
                        kwargs.right_process_names = processes;
                   
                    }

                    spt.input.save_selected(bvr, '%s','%s');
                    spt.app_busy.show("Note Viewer", 'Loading') ;
                    setTimeout(function(){
                        spt.panel.refresh(table_top, kwargs, false);
                        if (bvr.src_el.checked) 
                            spt.hide(cbs);
                        else 
                            spt.show(cbs);
                        spt.app_busy.hide();
                        }, 50 );
                    
                ''' % ( checkbox_name, key)
                })
       	split_div.add(split_cb)
        
        top.add(split_div)
        top.add(div)
        div.add(content_div)
        top.add(HtmlElement.br())
        
        
        checkbox_name = 'note_main_context_cb'
        cb = CheckboxWdg(checkbox_name)
        cb.persistence = True
        cb.persistence_obj = cb

        self.checked_process_names = cb.get_values()
        
        for value in self.process_names:
            #self.checked_process_names = web.get_form_values('process_names')
            cb = CheckboxWdg(checkbox_name, label=value)
            
            if value in self.checked_process_names:
                self.checked_processes.append(value)
            # FIXME: this is very tenous.  Accessing private members to
            # override behavior
            
            cb.persistence = True
            cb.persistence_obj = cb
            key = cb.get_key()
            cb.set_option('value', value)

            cb.add_behavior({
                'type': 'click_up',
                'propagate_evt': True,
                'cbjs_action': '''
                    var top = bvr.src_el.getParent(".spt_note_viewer_top")
                    var table_top = top.getElement('.spt_note_viewer_table');
                    var cbs = top.getElement('.spt_main_context_cb');
                    var values = spt.api.Utility.get_input_values(cbs);
                   
                    var processes = values.note_main_context_cb;
                    var kwargs = { process_names: processes};
                    spt.input.save_selected(bvr, '%s','%s');
                    spt.panel.refresh(table_top, kwargs, false);
                ''' % (checkbox_name, key)
#.........这里部分代码省略.........
开发者ID:mincau,项目名称:TACTIC,代码行数:103,代码来源:note_wdg.py


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