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


Python IconButtonWdg.add_style方法代码示例

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


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

示例1: get_display

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

        sobject = my.get_current_sobject()

        widget_class = my.get_option("class")
        
        if widget_class == '':
            raise WidgetException("No widget class defined")

        url = WebContainer.get_web().get_widget_url()
        url.set_option("widget", widget_class)
        url.set_option("search_key", sobject.get_search_key())

        ref = url.get_url()

        iframe = Container.get("iframe")
        iframe.set_width(90)
        action = iframe.get_on_script(ref)

        info_type = my.get_option("info_type")
        
        button = IconButtonWdg("%s info" % info_type, IconWdg.INFO)
        button.add_event("onclick", "%s" % (action) )
        button.add_style("margin: 3px 5px")

        return button
开发者ID:0-T-0,项目名称:TACTIC,代码行数:28,代码来源:frame_info_wdg.py

示例2: init

# 需要导入模块: from pyasm.widget import IconButtonWdg [as 别名]
# 或者: from pyasm.widget.IconButtonWdg import add_style [as 别名]
    def init(my):
        my.name = "iframe%s" % (my.generate_unique_id())
        my.img_span_name = '%s_loading' %my.name
        my.iframe = HtmlElement.iframe()
        my.iframe.set_id(my.name)
        my.iframe.set_attr('name',my.name)
        # To adjust the real-time size of the overlay box, do it in get_on_script
        
        my.overlay = OverlayWdg(name='%s_shadowbox'%my.name, \
            width=my.width * 1.0, display=False, iframe_name=my.name )

        
        my.overlay.add(my.iframe)
        
        my.shadowbox = my.overlay.get_shadow_box()

        


        tall_control = IconButtonWdg(name='taller', icon='/context/icons/common/dn_button.png')
        tall_control.add_style("float: right")
        
       
        tall_control.add_event("onclick", my.get_taller_script(my.name, my.shadowbox.name) )
       
        short_control = IconButtonWdg(name='shorter', icon='/context/icons/common/up_button.png')
        short_control.add_style("float: right")
        short_control.add_style("padding-bottom: 4px")
        
        short_control.add_event("onclick", my.get_shorter_script(my.name, my.shadowbox.name) )
        
        control = DivWdg()
        control.add_style('margin-top: -30px')
        control.add(short_control)
        control.add(tall_control)
        
        if not WebContainer.get_web().is_IE():
            my.shadowbox.set_control(control)
        my.overlay.add(my._get_loading_span()) 
        my.add(my.overlay)
开发者ID:0-T-0,项目名称:TACTIC,代码行数:42,代码来源:shadowbox_wdg.py

示例3: get_display

# 需要导入模块: from pyasm.widget import IconButtonWdg [as 别名]
# 或者: from pyasm.widget.IconButtonWdg import add_style [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

示例4: get_buttons_wdg

# 需要导入模块: from pyasm.widget import IconButtonWdg [as 别名]
# 或者: from pyasm.widget.IconButtonWdg import add_style [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

示例5: get_preview_wdg

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

        widget = Widget()

        web = WebContainer.get_web()

        csv_parser = CsvParser(my.file_path)
        csv_parser.parse()
        csv_titles = csv_parser.get_titles()
        csv_data = csv_parser.get_data()



        ajax = AjaxCmd()
        ajax.set_option("search_type", my.search_type)
        ajax.set_option("file_path", my.file_path)
        ajax.add_element_name("has_title")

        event = WebContainer.get_event_container()
        caller = event.get_event_caller(SiteMenuWdg.EVENT_ID)
        div = ajax.generate_div()
        div.set_post_ajax_script(caller)
        widget.add(div)

        columns = []
        num_columns = len(csv_titles)
        ajax.set_option("num_columns", num_columns)
        for i in range(0, num_columns):
            column = web.get_form_value("column_%s" % i)
            if column:
                column = csv_titles[i]
            else:
                column = web.get_form_value("column_new_%s" % i)

            columns.append(column)

            ajax.add_element_name("column_%s" % i)
            ajax.add_element_name("new_column_%s" % i)


        ajax.register_cmd("pyasm.command.csv_import_cmd.CsvImportCmd")
        import_button = IconButtonWdg("Import", IconWdg.REFRESH, True)
        import_button.add_event("onclick", ajax.get_on_script(show_progress=False))
        import_button.add_style("float: right")
        widget.add( import_button )


        preview_submit = IconSubmitWdg("Preview", IconWdg.REFRESH, True)
        preview_submit.add_style("float: right")
        widget.add(preview_submit)

        sobject_title = my.search_type_obj.get_title()
        widget.add("<p>4. Import</p>")
        widget.add(HtmlElement.br())
        widget.add("<p>The following table will be imported into %s (Showing Max: 100)</p>" % sobject_title)


        table = Table(css="table")
        table.add_style("width: 100%")

        table.add_row()
        for i, title in enumerate(columns):
            if not title:
                title = "<b style='color:red'>*</b>"
            table.add_header(title)

        for i, row in enumerate(csv_data):
            if i > 100:
                break
            table.add_row()
            for j, cell in enumerate(row):
                table.add_cell(cell)

        widget.add(table)

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


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