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


Python IconButtonWdg.add_behavior方法代码示例

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


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

示例1: get_display

# 需要导入模块: from pyasm.widget import IconButtonWdg [as 别名]
# 或者: from pyasm.widget.IconButtonWdg import add_behavior [as 别名]
    def get_display(my):
        my.view = my.kwargs.get('view')
        if not my.view:
            my.view = 'publish'
        widget = Widget()
        sobject = my.get_current_sobject()
        search_type = sobject.get_search_type()
        search_id = sobject.get_id()

        if my.get_option('preview') != 'false': 
            my.thumb.set_current_index(my.get_current_index())
            widget.add(my.thumb)

        publish_link = PublishLinkWdg(search_type,search_id, config_base=my.view) 
        div = DivWdg(publish_link)
        div.set_style('clear: left; padding-top: 6px')
        widget.add(div)

        # build a popup link to show publish browsing
        browse_link = IconButtonWdg("Publish Browser", IconWdg.CONTENTS)
        browse_link.add_behavior({'type': 'click_up',
            'cbjs_action': 'spt.popup.get_widget(evt, bvr)',
            'options': {'popup_id' : 'publish_browser',
                        'class_name' : 'pyasm.prod.web.PublishBrowserWdg' ,
                        'title': 'Publish Browser'},
            'args' : { 'search_type': search_type,
                        'search_id' : search_id }
            })
        div.add(browse_link)
        div.set_style('padding-top: 6px')


        return widget
开发者ID:funic,项目名称:TACTIC,代码行数:35,代码来源:table_element_wdg.py

示例2: get_display

# 需要导入模块: from pyasm.widget import IconButtonWdg [as 别名]
# 或者: from pyasm.widget.IconButtonWdg import add_behavior [as 别名]
    def get_display(my):


        div = DivWdg()

        sobject = my.get_current_sobject()
        search_key = SearchKey.get_by_sobject(sobject)

        if sobject.is_admin():
            return "ADMIN"

        icon = IconButtonWdg("Global Permissions", IconWdg.EDIT)

        icon.add_behavior( {
            "type": "click_up",
            "cbjs_action": "spt.popup.get_widget(evt, bvr)",
            "options": {
                "class_name": "tactic.ui.panel.SecurityManagerWdg",
                "title": "Permisssion Manager",
                "popup_id": "Permission Manager"

            },
            "args": {
                "search_key": search_key
            }
        } )

        div.add(icon)

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

示例3: get_values_script

# 需要导入模块: from pyasm.widget import IconButtonWdg [as 别名]
# 或者: from pyasm.widget.IconButtonWdg import add_behavior [as 别名]
 def get_values_script(self):
     save_button = IconButtonWdg("Save Settings", IconWdg.SAVE)
     save_button.add_behavior( {
         'type': 'click_up',
         'cbjs_action': '''
         get_values = function() {
             var top = bvr.src_el.getParent(".spt_list_top");
             var elements = bvr.src_el.getElements(".spt_list_items");
             var data = [];
             for (var i=0; i<elements.length; i++) {
                 var values = spt.api.get_input_values(elements[i]);
                 data.push(values)
             }
             return data;
         }
         '''
     } )
     content_div.add(save_button)
开发者ID:mincau,项目名称:TACTIC,代码行数:20,代码来源:dynamic_list_wdg.py

示例4: get_display

# 需要导入模块: from pyasm.widget import IconButtonWdg [as 别名]
# 或者: from pyasm.widget.IconButtonWdg import add_behavior [as 别名]
    def get_display(my):

        my.search_type = my.kwargs.get('search_type')
        my.element_name = my.kwargs.get('element_name')
        assert my.search_type
        assert my.element_name

        class_name = 'tactic.ui.app.aggregate_wdg.AggregateCmd'
        interval = 120
        priority = None

        if my.kwargs.get('is_refresh'):
            user = Environment.get_user_name()

            # these interval jobs need to have a specific code
            code = "aggregate|%s|%s" % (my.search_type, my.element_name)

            # check to see if the job exists
            #job = Search.get_by_code("sthpw/queue", code)
            job = None
            if not job:
                job = SearchType.create("sthpw/queue")
                #job.set_value("code", code)

                job.set_value("project_code", Project.get_project_code() )
                job.set_value("class_name", class_name)
                job.set_value("command", class_name)
                job.set_value("serialized", str(my.kwargs) )
                job.set_value("interval", 120)
                job.set_value("state", 'pending')
                job.set_value("queue", 'interval')
                job.set_value("priority", 9999)
                job.set_value("login", user) 
                job.commit()




        my.view = my.kwargs.get('view')
        if not my.view:
            my.view = 'definition'

        
        top = DivWdg()
        my.set_as_panel(top)

        action_div = DivWdg()
        top.add(action_div)

        refresh = IconButtonWdg("Refresh", IconWdg.REFRESH)
        refresh.add_behavior( {
        'type': 'click_up',
        'cbjs_action': '''
        var top = bvr.src_el.getParent(".spt_panel");
        spt.panel.refresh(top);
        '''
        } )
        action_div.add(refresh)



        register_div = DivWdg()
        register_div.add_class("spt_queue_register")
        top.add(register_div)
        register_div.add_style("border: solid 1px black")
        register_div.add_style("padding: 20px")
        register_div.add("Register new interval aggregate")

        table = Table()
        table.add_style("margin: 15px")
        register_div.add(table)
        table.add_row()
        table.add_cell("command: ")
        table.add_cell(class_name)

        #table.add_row()
        #table.add_cell("priority: ")
        #table.add_cell(priority)

        table.add_row()
        table.add_cell("interval: ")
        td = table.add_cell("every ")
        td.set_attr("title", "Recalculation interval")
        text = TextWdg("interval")
        text.add_style("width: 30px")
        text.set_value(interval)
        td.add(text)

        unit_select = SelectWdg("unit")
        unit_select.set_value(interval)
        unit_select.set_option("values", "seconds|minutes|hours|days")
        td.add(" ")
        td.add(unit_select)

        table.add_row()
        table.add_cell("queue: ")
        table.add_cell("interval")


        from pyasm.widget import ProdIconButtonWdg
#.........这里部分代码省略.........
开发者ID:0-T-0,项目名称:TACTIC,代码行数:103,代码来源:aggregate_wdg.py

示例5: get_tool_bar

# 需要导入模块: from pyasm.widget import IconButtonWdg [as 别名]
# 或者: from pyasm.widget.IconButtonWdg import add_behavior [as 别名]
    def get_tool_bar(my):
        widget = DivWdg()
        widget.add_style("width: 250px")

        refresh = IconButtonWdg("Refresh", IconWdg.REFRESH)
        refresh.add_behavior(
            {
                "type": "click_up",
                "cbjs_action": """
            var top = bvr.src_el.getParent(".spt_panel");
            spt.panel.refresh(top);
            """,
            }
        )

        widget.add(refresh)
        widget.add("&nbsp;&nbsp;&nbsp;")

        trash_div = SpanWdg()
        # reset some global variables on load
        trash_div.add_behavior(
            {"type": "load", "cbjs_action": "spt.side_bar.trashed_items=[]; spt.side_bar.changed_views={}"}
        )

        trash_div.set_id("trash_me")

        trash_div.add(IconWdg("Trash", IconWdg.TRASH))
        trash_div.add_class("hand")
        trash_div.add_class("spt_side_bar_trash")

        trash_div.set_attr("SPT_ACCEPT_DROP", "manageSideBar")
        bvr = {"type": "click_up", "cbjs_action": "alert('Drag and drop link or folder here to remove it.')"}
        trash_div.add_behavior(bvr)

        widget.add(trash_div)

        save_div = SpanWdg(css="med hand spt_side_bar_trash")
        save_div.add(IconWdg("Save Ordering", IconWdg.SAVE))

        bvr = {
            "type": "click_up",
            "search_type": my.search_type,
            "view": my.view,
            "cbjs_action": """
            if (confirm("Save ordering of this view [" + bvr.view + "] ?") ) {

                var top = bvr.src_el.getParent(".spt_view_manager_top");
                var list_top = top.getElement(".spt_menu_item_list");

                var server = TacticServerStub.get();
                server.start({"title": "Updating views"});

                var is_personal = false;
                spt.app_busy.show("Saving", "Saving view ["+bvr.view+"]");
                spt.side_bar.save_view(bvr.search_type, bvr.view, is_personal, list_top);
                server.finish();

                spt.app_busy.hide();
            }
            """,
        }

        save_div.add_behavior(bvr)
        widget.add(save_div)

        gear = my.get_gear_menu()
        gear.add_style("float: right")

        widget.add(gear)

        return widget
开发者ID:hellios78,项目名称:TACTIC,代码行数:73,代码来源:view_manager_wdg.py

示例6: get_display

# 需要导入模块: from pyasm.widget import IconButtonWdg [as 别名]
# 或者: from pyasm.widget.IconButtonWdg import add_behavior [as 别名]
    def get_display(self):
        top = DivWdg()
        self.set_as_panel(top)

        title_div = DivWdg()
        title_div.add_class("maq_search_bar")
        title_div.add("Diagnostics")
        top.add(title_div)


        tool_div = DivWdg()
        top.add(tool_div)
        refresh = IconButtonWdg("Refresh", IconWdg.REFRESH)
        refresh.add_behavior( {
            'type': 'click_up',
            'cbjs_action': '''
            var top = bvr.src_el.getParent(".spt_panel");
            spt.panel.refresh(top);
            '''
        } )
        tool_div.add(refresh)




        content = RoundedCornerDivWdg(hex_color_code="2F2F2F",corner_size="10")
        content.set_dimensions( width_str='300px', content_height_str=None )
        top.add(content)

        server_title_div = DivWdg()
        server_title_div.add_class("maq_search_bar")
        content.add(server_title_div)
        server_title_div.add("Server")
        server_content_div = DivWdg()
        server_content_div.add_style("padding: 10px")
        server_content_div.add(self.get_ping_wdg())
        server_content_div.add(self.get_load_balance_wdg())
        content.add(server_content_div)


        database_title_div = DivWdg()
        database_title_div.add_class("maq_search_bar")
        content.add(database_title_div)
        database_title_div.add("Database")
        database_content_div = DivWdg()
        database_content_div.add_style("padding: 10px")
        database_content_div.add(self.get_database_wdg())
        content.add(database_content_div)


        checkin_title_div = DivWdg()
        checkin_title_div.add_class("maq_search_bar")
        content.add(checkin_title_div)
        checkin_title_div.add("Database")
        checkin_content_div = DivWdg()
        checkin_content_div.add_style("padding: 10px")
        checkin_content_div.add(self.get_asset_dir_wdg() )
        checkin_content_div.add(self.get_asset_management_wdg())
        content.add(checkin_content_div)

 

        return top
开发者ID:mincau,项目名称:TACTIC,代码行数:65,代码来源:diagnostics_wdg.py

示例7: get_display

# 需要导入模块: from pyasm.widget import IconButtonWdg [as 别名]
# 或者: from pyasm.widget.IconButtonWdg import add_behavior [as 别名]
    def get_display(self):
        top = DivWdg()
        top.add_class("ad_input_top")

        name = self.get_name()
        text = TextWdg(self.get_input_name())


        # get the login
        sobject = self.get_current_sobject()
        client = sobject.get_value("contact_name")
        print "client: ", client
        if client:
            login_sobj = Login.get_by_code(client)
        else:
            login_sobj = Environment.get_login()

        # build the display_name
        login = login_sobj.get_value("login")
        display_name = login_sobj.get_value("display_name")
        if not display_name:
            display_name = "%s %s" % (user.get('first_name'), user.get('last_name'))
        display_name = display_name.replace('"', "'")


        
        print "login: ", login
        hidden = HiddenWdg(self.get_input_name())
        hidden.set_options( self.options.copy() )
        hidden.add_class("spt_ad_input")
        if login:
            hidden.set_value(login)
        top.add(hidden)


        # copy over some options
        #text.set_options( self.options.copy() )
        if login:
            text.set_value(display_name)
        text.set_option("read_only", "true")
        text.add_class("spt_ad_display")
        top.add(text)



        top.add("&nbsp;&nbsp;")



        groups_str = self.get_option("groups_allowed_to_search")
        if groups_str:
            stmt = 'groups_list = %s' % groups_str
            exec stmt
        else:
            groups_list = None

        allow_search = True

        if groups_list:
            allow_search = False
            login_in_group_list = Search.eval("@SOBJECT(sthpw/login_in_group['login','=','%s'])" % login)
            for login_in_group in login_in_group_list:
                group = login_in_group.get_value("login_group")
                if group in groups_list:
                    allow_search = True
                    break

        if login == 'admin':
            allow_search = True


        if allow_search:
            button = IconButtonWdg('Search for User', IconWdg.USER)
            #button = ButtonWdg()
            button.add_behavior( {
                'type': 'click_up',
                'cbjs_action': '''
                var top = bvr.src_el.getParent('.ad_input_top');
                var content = top.getElement('.ad_input_content');
                spt.toggle_show_hide(content);
                '''
            } )
            top.add(button)

        ad_top = DivWdg()
        ad_top.add_class("ad_input_content")
        ad_top.add_style("display: none")
        ad_top.add_style("position: absolute")
        ad_top.add_style("background: #222")
        ad_top.add_style("min-width: 300px")
        ad_top.add_style("border: solid 1px #000")
        ad_top.add_style("padding: 20px")

        cbjs_action = '''
        var value = bvr.src_el.getAttribute('spt_input_value');
        var display_value = bvr.src_el.getAttribute('spt_display_value');
        var phone_number = bvr.src_el.getAttribute('spt_phone_number');
        var email = bvr.src_el.getAttribute('spt_mail');

        var top = bvr.src_el.getParent('.ad_input_top');
#.........这里部分代码省略.........
开发者ID:mincau,项目名称:TACTIC,代码行数:103,代码来源:ad_search_wdg.py

示例8: get_display

# 需要导入模块: from pyasm.widget import IconButtonWdg [as 别名]
# 或者: from pyasm.widget.IconButtonWdg import add_behavior [as 别名]
    def get_display(my):

        web = WebContainer.get_web()

        widget = DivWdg()
        widget.add_class("spt_search_limit_top")
        #widget.add_style("border", "solid 1px blue")
        widget.add_color("background", "background")
        widget.add_color("color", "color")
        widget.add_style("padding: 5px")

        hidden = HiddenWdg("prefix", my.prefix)
        widget.add(hidden)

   
        if not my.search and not my.sobjects:
            widget.add("No search or sobjects found")
            return widget

        # my.count should have been set in alter_search()
        # which can be called explicitly thru this instance, my.
        if not my.count:
            my.count = my.search.get_count(no_exception=True)
        
        # if my.sobjects exist thru inheriting from parent widgets
        # or explicitly set, (this is not mandatory though)
        if my.sobjects and len(my.sobjects) < my.search_limit:
            limit = len(my.sobjects)
        elif my.search and my.count < my.search_limit:
            # this is only true if the total result of the search is 
            # less than the limit and so this wdg will not display
            limit = my.count
        else:
            limit = my.search_limit

        if not limit:
            limit = 50
            my.search_limit = limit

    
        if my.refresh: 
            prev = SpanWdg( IconButtonWdg("Prev", IconWdg.LEFT, False ) )
            prev.add_style("margin-left: 8px")
            prev.add_style("margin-right: 6px")
            prev.add_style("margin-top: -2px")
            next = IconButtonWdg("Next", IconWdg.RIGHT, False, icon_pos="right" )
            next.add_style("margin-left: 6px")

            prev.add_behavior( {
                'type': 'click_up',
                'cbjs_action': my.refresh_script
            } )
            next.add_behavior( {
                'type': 'click_up',
                'cbjs_action': my.refresh_script
            } )
        else: # the old code pre 2.5
            prev = IconButtonWdg("Prev", IconWdg.LEFT, False )
            hidden_name = my.prev_hidden_name
            hidden = HiddenWdg(hidden_name,"")
            prev.add(hidden)
            prev.add_event('onclick'," spt.api.Utility.get_input(document,'%s').value ='Prev';%s"\
                    %(hidden_name, my.refresh_script))
            next = IconButtonWdg("Next", IconWdg.RIGHT, False, icon_pos="right" )
            hidden_name = my.next_hidden_name
            hidden = HiddenWdg(hidden_name,"")
            next.add(hidden)
            next.add_event('onclick',"spt.api.Utility.get_input(document,'%s').value ='Next';%s" \
                    %(hidden_name, my.refresh_script))


        showing_wdg = DivWdg()
        widget.add(showing_wdg)
        showing_wdg.add_style("padding: 10px")
        showing_wdg.add_style("margin: 10px")
        showing_wdg.add_color("background", "background", -5)
        showing_wdg.add_border()

        label_span = SpanWdg("Showing: ")
        showing_wdg.add(label_span)
        showing_wdg.add( prev )
       

        # this min calculation is used so that if my.sobjects is not set
        # above for the calculation of the limit, which will make the last 
        # set of range numbers too big
        
        left_bound = my.current_offset+1
        if not limit:
            # prevent error in ItemsNavigatorWdg if a search encounters query error
            limit = 50
            my.search_limit = limit

        right_bound = min(my.current_offset+limit, my.count)
        if left_bound > right_bound:
            left_bound = 1
        current_value = "%d - %d" % (left_bound, right_bound)

        if my.style == my.SIMPLE:
            showing_wdg.add( current_value )
#.........这里部分代码省略.........
开发者ID:hellios78,项目名称:TACTIC,代码行数:103,代码来源:search_limit_wdg.py

示例9: get_display

# 需要导入模块: from pyasm.widget import IconButtonWdg [as 别名]
# 或者: from pyasm.widget.IconButtonWdg import add_behavior [as 别名]
    def get_display(my):

        my.set_option('icon', "CONTENTS")


        sobject = my.get_current_sobject()
        search_type = sobject.get_search_type()

        context = my.get_option("context")
        if not context:
            context = "publish"

        process = my.get_option("process")
        if not process:
            process = "publish"


        if sobject.get_base_search_type() == "sthpw/snapshot":
            snapshot = sobject
            sobject = snapshot.get_parent()
            if sobject:
                search_type = sobject.get_search_type()
            else:
                top = DivWdg()
                return top

        else:
            if process:
                snapshot = Snapshot.get_latest_by_sobject(sobject, process=process)
            else:
                snapshot = Snapshot.get_latest_by_sobject(sobject, context=context)

        if not snapshot:
            top = DivWdg()
            return top





        top = DivWdg()
        icon = IconButtonWdg( "Show Metadata", eval( "IconWdg.%s" % my.get_option('icon') ) )
        top.add(icon)
        top.add_style("text-align: center")


        lib_path = snapshot.get_lib_path_by_type("main")
        basename = os.path.basename(lib_path)
        dirname = os.path.dirname(lib_path)

        my.behavior['basename'] = basename
        my.behavior['dirname'] = dirname
        my.behavior['search_type'] = search_type


        cbjs_action = '''

        var class_name = 'tactic.ui.tools.repo_browser_wdg.RepoBrowserContentWdg';
        var kwargs = {
            basename: '%(basename)s',
            dirname: '%(dirname)s',
            search_type: '%(search_type)s'
        };

        //spt.tab.set_main_body_tab();
        //spt.tab.add_new("Detail", "Detail", class_name, kwargs);
        spt.panel.load_popup("Detail", class_name, kwargs);

        ''' % (my.behavior)

        my.behavior['type'] = 'click_up'
        my.behavior['cbjs_action'] = cbjs_action

        icon.add_behavior(my.behavior)

        return top
开发者ID:0-T-0,项目名称:TACTIC,代码行数:78,代码来源:metadata_element_wdg.py

示例10: get_buttons_wdg

# 需要导入模块: from pyasm.widget import IconButtonWdg [as 别名]
# 或者: from pyasm.widget.IconButtonWdg import add_behavior [as 别名]
    def get_buttons_wdg(my):
        buttons_div = DivWdg()
        buttons_div.add_style("margin-left: 20px")
        buttons_div.add_style("margin-right: 20px")


        # add brush size

        text_note_wdg = DivWdg()
        text_note_wdg.add("<b>Text Note</b>")
        buttons_div.add(text_note_wdg)


        text_note = TextAreaWdg("spt_text_note")
        text_note.add_style("width: 400px")
        text_note.add_class("spt_text_note")
        buttons_div.add(text_note)
        

        from pyasm.widget import IconButtonWdg, IconWdg
        save_button = IconButtonWdg("Export", IconWdg.SAVE)
        save_button.add_style("float: right")
        buttons_div.add(save_button)


        script = '''
        try {
          function getFlashMovie(movieName) {
              var isIE = navigator.appName.indexOf("Microsoft") != -1;
              return (isIE) ? window[movieName] : document[movieName];
          }


          spt.app_busy.show("Exporting Visual Note", " ")
         
          var data = getFlashMovie("visual_notes_wdg").visual_notes_export();

          var applet = spt.Applet.get();
          var server = TacticServerStub.get();
          //server.start();
          var search_key = bvr.kwargs.search_key;

          var txt_path = "c:/sthpw/sandbox/temp/visual_notes/visual_notes_temp.txt" 
          var jpg_path = "c:/sthpw/sandbox/temp/visual_notes/visual_notes_temp.jpg" 

          applet.create_file(txt_path, data);
          applet.decodeFileToFile(txt_path, jpg_path);

          var top_el = bvr.src_el.getParent(".spt_visual_notes_top");
          var context = bvr.kwargs.context;
          var snapshot = server.simple_checkin(search_key, context, jpg_path);

          //var note_context = context + "|note";
          var note_context = context;
          var note = top_el.getElement(".spt_text_note").value;
          var note_sobj = server.insert("sthpw/note", { note: note, context: note_context}, {parent_key: search_key} );
          server.connect_sobjects( snapshot, note_sobj);

          //server.finish("Visual Notes");      


          spt.app_busy.hide();
          alert("Visual note added for [" + context + "]");
        }
        catch(err) {
            spt.app_busy.hide();
            alert(err);
        }
        '''
        save_button.add_behavior( {
        'type': 'click_up',
        'cbjs_action': script,
        'kwargs': {
            'search_key': my.search_key,
            'context': my.note_context
        }
        })
   

        return buttons_div
开发者ID:0-T-0,项目名称:TACTIC,代码行数:82,代码来源:visual_notes_wdg.py

示例11: get_display

# 需要导入模块: from pyasm.widget import IconButtonWdg [as 别名]
# 或者: from pyasm.widget.IconButtonWdg import add_behavior [as 别名]
    def get_display(self):
        current = self.get_current_sobject()

        if current.is_insert():
            widget = Widget()
            parent_key = self.get_option('parent_key')
            if parent_key:
                parent = SearchKey.get_by_search_key(parent_key)
                if parent:
                    widget.add(SpanWdg(parent.get_code()))
            else:

                # use the project as the parent
                parent = Project.get()
                widget.add(SpanWdg("Project: %s" % parent.get_code()))

                #raise TacticException('Task creation aborted since parent is undetermined. Please check the configuration that generates this table.')

            text = HiddenWdg(self.get_input_name())
            text.set_option('size','40')
            text.set_value(parent_key)

            widget.add(text)
            return widget

        else:
           

            search_type = current.get_value('search_type')
            if not search_type:
                return "No parent type"
            
            widget = Widget()
            parent = current.get_parent()
            if parent:
                widget.add(parent.get_code())
                return widget
        
        # What is this look up code for?
        text = TextWdg(self.get_input_name())
        behavior = {
            'type': 'keyboard',
            'kbd_handler_name': 'DgTableMultiLineTextEdit'
        }
        text.add_behavior(behavior)



        widget.add(text)

        icon = IconButtonWdg("Look up", IconWdg.ZOOM)
        icon.add_behavior( {
            'type': 'click_up',
            'cbjs_action': '''
                var options = {
                    title: '%s',
                    class_name: 'tactic.ui.panel.ViewPanelWdg'
                };
                var args = {
                    search_type: '%s',
                    view: 'list'
                };
                spt.popup.get_widget( {}, {options: options, args: args} );
            ''' % (search_type, search_type)
        } )
        widget.add(icon)

        return widget
开发者ID:mincau,项目名称:TACTIC,代码行数:70,代码来源:task_input_wdg.py

示例12: get_action_wdg

# 需要导入模块: from pyasm.widget import IconButtonWdg [as 别名]
# 或者: from pyasm.widget.IconButtonWdg import add_behavior [as 别名]
    def get_action_wdg(self):
       
        main_div = DivWdg(css="filter_box center_content")
        div = DivWdg()
        main_div.add(self.get_view_select())
        main_div.add(div)
        div.add_style('height', '16px')
        div.add_style('margin', '3px 0 3px 0')

        search_type = self.get_search_type()
         
        div.add(HtmlElement.b("Action: "))
        add_button = IconButtonWdg(self.ADD_BUTTON, IconWdg.ADD, long=True)
        behavior = {
            'type': 'click_up',
            'mouse_btn': 'LMB',
            'cbfn_action': 'spt.sobject_planner.action',
            'action': 'add',
            'search_type': search_type
        }
        add_button.add_behavior(behavior)


        retire_button = IconButtonWdg("Retire Instance",\
            IconWdg.RETIRE, long=True)
        behavior = {
            'type': 'click_up',
            'mouse_btn': 'LMB',
            'cbfn_action': 'spt.sobject_planner.action',
            'action': 'retire',
            'search_type': search_type
        }
        retire_button.add_behavior(behavior)


        delete_button = IconButtonWdg("Delete Instance",\
            IconWdg.DELETE, long=True)
        behavior = {
            'type': 'click_up',
            'mouse_btn': 'LMB',
            'cbfn_action': 'spt.sobject_planner.action',
            'action': 'delete',
            'search_type': search_type
        }
        delete_button.add_behavior(behavior)






        div.add(add_button)
        div.add(retire_button)
        div.add(delete_button)

        '''
        # add test popup
        from tactic.ui.container import PopupWdg
        from tactic.ui.panel import TableLayoutWdg
        popup = PopupWdg(id="planner", allow_page_activity=True)

        content = DivWdg()
        #content.add_style("height: 500px")
        #content.add_style("overflow: scroll")
        search_type = self.get_search_type()
        layout = TableLayoutWdg(search_type=search_type, view="planner_left")
        search = Search(search_type)
        layout.set_sobjects( search.get_sobjects() )
        content.add(layout)

        popup.add("Assets", "title")
        popup.add(content, "content")

        popup_button = IconButtonWdg("Popup",\
            IconWdg.DELETE, long=True)
        popup_button.add_event("onclick", "$('planner').setStyle('display','')")

        main_div.add(popup)
        main_div.add(popup_button)
        '''




        return main_div
开发者ID:mincau,项目名称:TACTIC,代码行数:87,代码来源:sobject_planner_wdg.py

示例13: get_display

# 需要导入模块: from pyasm.widget import IconButtonWdg [as 别名]
# 或者: from pyasm.widget.IconButtonWdg import add_behavior [as 别名]
    def get_display(my):

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

        assert my.search_key
        assert my.context

        top = DivWdg()
        my.set_as_panel(top)
        top.add_class("spt_review_top")

        table = Table()
        top.add(table)
        table.add_row()
        left = table.add_cell()
        left.add_style("vertical-align: top")

        button = IconButtonWdg("Visual Notes", IconWdg.EDIT)
        button.add_behavior(
            {
                "type": "click_up",
                "kwargs": {"search_key": my.search_key, "context": my.context},
                "cbjs_action": """
        var top = bvr.src_el.getParent(".spt_review_top");
        var content = top.getElement(".spt_review_content");
        spt.panel.load(content, "tactic.ui.widget.visual_notes_wdg.VisualNotesWdg", bvr.kwargs);
        """,
            }
        )
        left.add(button)

        # add a refresh button and a gear menu
        button = IconButtonWdg("Refresh", IconWdg.REFRESH)
        button.add_behavior(
            {
                "type": "click_up",
                "cbjs_action": """
        var panel = bvr.src_el.getParent(".spt_review_top");
        spt.panel.refresh(panel);
        """,
            }
        )
        left.add(button)

        right = table.add_cell()
        right.add_style("vertical-align: top")
        right.add("Image Area")

        content_div = DivWdg()
        content_div.add_class("spt_review_content")
        content_div.add_style("padding: 5px")
        content_div.add_style("margin: 5px")
        content_div.add_style("border: solid 1px #999")
        content_div.add_style("min-width: 500px")
        content_div.add_style("min-height: 400px")
        content_div.add_style("height: 100%")

        right.add(content_div)

        sobject = Search.get_by_search_key(my.search_key)

        note_context = "%s|note" % my.context
        snapshots = Search.eval("@SOBJECT(sthpw/snapshot['context','=','%s'])" % note_context, [sobject])

        vnotes_div = DivWdg()
        vnotes_div.add_style("overflow: auto")
        vnotes_div.add_style("width: 200px")
        vnotes_div.add_style("min-height: 400px")
        vnotes_div.add_style("max-height: 600px")
        vnotes_div.add_style("border: solid 1px #999")
        vnotes_div.add_style("padding: 5px")
        vnotes_div.add_style("margin: 5px")

        left.add(vnotes_div)

        if not snapshots:
            vnotes_div.add("<b>No review notes available</b>")

            notes_wdg = VisualNotesWdg(search_key=my.search_key, context=my.context)
            content_div.add(notes_wdg)

        for snapshot in snapshots:
            vnote_div = DivWdg()
            vnotes_div.add(vnote_div)

            file_obj = snapshot.get_file_by_type("main")
            if not file_obj:
                vnote_div.add("None found")
                continue

            rel_path = file_obj.get_value("relative_dir")
            file_name = file_obj.get_value("file_name")
            image_url = "/assets/%s/%s" % (rel_path, file_name)

            login = snapshot.get_value("login")
            date = snapshot.get_value("timestamp")
            import dateutil

            date_str = dateutil.parser.parse(date).strftime("%b %m %Y - %H:%M")
#.........这里部分代码省略.........
开发者ID:hellios78,项目名称:TACTIC,代码行数:103,代码来源:review_wdg.py


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