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


Python TextWdg.set_attr方法代码示例

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


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

示例1: get_new_tab_wdg

# 需要导入模块: from pyasm.widget import TextWdg [as 别名]
# 或者: from pyasm.widget.TextWdg import set_attr [as 别名]
    def get_new_tab_wdg(self):
        widget = Widget()

        span = SpanWdg()
        swap = SwapDisplayWdg.get_triangle_wdg()
        title = SpanWdg("Tab Creation")
        span.add(swap)
        span.add(title)
        span.add_style("float: left")
        widget.add(span)
        widget.add(HtmlElement.br() )

        # add the tab selector
        div = DivWdg()
        SwapDisplayWdg.create_swap_title( title, swap, div)

        tab_text = TextWdg("tab")
        tab_text.set_persistence()
        span = SpanWdg(css="med")
        span.add("Tab: ")
        span.add(tab_text)
        div.add(span)

        # parent
        index_text = TextWdg("parent_tab")
        index_text.set_persistence()
        span = SpanWdg(css="med")
        span.add("Parent Tab: ")
        span.add(index_text)
        span.add(HintWdg("Enter the name of the tab that this will fall under. Leave empty to put on the main tab") )
        div.add(span)


        # index
        index_text = TextWdg("index")
        index_text.set_attr("size", "4")
        index_text.set_persistence()
        span = SpanWdg(css="med")
        span.add("Index: ")
        span.add(index_text)
        span.add(HintWdg("Enter the numeric location for this tab to be placed") )
        div.add(span)

        WebContainer.register_cmd("CreateTabCmd")
        button = IconSubmitWdg("Create Tab", IconWdg.CREATE, True)
        div.add(button)

        widget.add(div)

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

示例2: get_display

# 需要导入模块: from pyasm.widget import TextWdg [as 别名]
# 或者: from pyasm.widget.TextWdg import set_attr [as 别名]
    def get_display(my):
        name = my.get_name()

        # get the sobject required by this input
        sobject = my.get_current_sobject()

        widget = DivWdg()

        # add an advanced widget
        text = TextWdg("%s" % name)
        text.set_attr("size", 90)
        value = sobject.get_value(name)
        text.set_value(value)
        div = DivWdg()
        # div.add("Advanced: ")
        div.add(text)
        widget.add(div)

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

示例3: get_display

# 需要导入模块: from pyasm.widget import TextWdg [as 别名]
# 或者: from pyasm.widget.TextWdg import set_attr [as 别名]
    def get_display(my):
        from tactic_client_lib import TacticServerStub
        login = Environment.get_login()
        user_name = login.get_login()
        user_name = user_name.replace('.','')
        barcodes = []
        complete = False
        errors = ''
        first_loc_num1 = 5660
        last_loc_num1 = 5991
        first_loc_num2 = 6020
        last_loc_num2 = 6037
        if 'barcodes' in my.kwargs.keys():
            barcodes = my.kwargs.get('barcodes').split(',') 
        if 'complete' in my.kwargs.keys():
            complete = my.kwargs.get('complete')
        if 'errors' in my.kwargs.keys():
            errors = my.kwargs.get('errors')
        table = Table()
        table.add_attr('id','tracker_%s' % user_name) 
        table.add_attr('class','tracker_%s' % user_name) 
        if errors not in [None,'']:
            table.add_row()
            csp1 = table.add_cell(errors)
            csp1.add_attr('colspan','2')
        count = 0
        if complete:
            server = TacticServerStub.get()
            t2 = Table()
            for bc in barcodes:
                if 'EMP' in bc:
                    that_user = server.eval("@SOBJECT(sthpw/login['barcode','%s'])" % bc)
                    if that_user:
                        that_user = that_user[0]
                    else:
                        that_user = {'login': 'UNKNOWN USER'}
                    t2.add_row()
                    t2.add_cell('USER: ')
                    t2.add_cell(that_user.get('login'))
                    t2.add_cell('BARCODE: %s' % bc)
            for bc in barcodes:
                bc_num = 555555555
                if '2G' in bc:
                    bc_num = bc.replace('2G','').replace('A','').replace('B','').replace('C','').replace('V','')
                    bc_num = int(bc_num)
                if (bc_num >= first_loc_num1 and bc_num <= last_loc_num1) or (bc_num >= first_loc_num2 and bc_num <= last_loc_num2):
                    that_location = server.eval("@SOBJECT(twog/inhouse_locations['barcode','%s'])" % bc)
                    if that_location:
                        that_location = that_location[0]
                    else:
                        that_location = {'name': 'UNKNOWN LOCATION'}
                    t2.add_row()
                    t2.add_cell('LOCATION: ')
                    t2.add_cell(that_location.get('name'))
                    t2.add_cell('BARCODE: %s' % bc)
            for bc in barcodes:
                bc_num = 555555555
                if '2G' in bc:
                    bc_num = bc.replace('2G','').replace('A','').replace('B','').replace('C','').replace('V','')
                    bc_num = int(bc_num)
                #if 'LOC' not in bc and 'EMP' not in bc:
                if not ((bc_num >= first_loc_num1 and bc_num <= last_loc_num1) or (bc_num >= first_loc_num2 and bc_num <= last_loc_num2)) and 'EMP' not in bc:
                    that_src = server.eval("@SOBJECT(twog/source['barcode','%s'])" % bc)
                    if that_src:
                        that_src = that_src[0]
                    else:
                        that_src = {'title': 'UNKNOWN SOURCE', 'episode': '', 'season': '', 'part': ''}
                    full_name = that_src.get('title')
                    if that_src.get('episode') not in [None,'']:
                        full_name = '%s EPISODE: %s' % (full_name, that_src.get('episode'))
                    if that_src.get('season') not in [None,'']:
                        full_name = '%s SEASON: %s' % (full_name, that_src.get('season'))
                    if that_src.get('part') not in [None,'']: 
                        full_name = '%s PART: %s' % (full_name, that_src.get('part'))
                    t2.add_row()
                    t2.add_cell('SOURCE: ')
                    t2.add_cell(full_name)
                    t2.add_cell('BARCODE: %s' % bc)
            table.add_row()
            csp2 = table.add_cell(t2)
            csp2.add_attr('colspan','2')
        else:                
            for bc in barcodes:
                table.add_row()
                table.add_cell('BARCODE: ')
                oldtxt = TextWdg('oldtxt')
                oldtxt.set_attr('id', 'txt_%s' % count)
                oldtxt.set_value(bc)
                table.add_cell(oldtxt)
                count = count + 1
            
        table.add_row()
        nextbc = TextWdg('nextbc')
        nextbc.add_attr('id', 'txt_%s' % count)
        nextbc.add_behavior(my.get_entry_bvr(user_name))
        table.add_cell('Barcode: ')
        table.add_cell(nextbc)

        widget = DivWdg()
        widget.add(table)
#.........这里部分代码省略.........
开发者ID:Smurgledwerf,项目名称:custom,代码行数:103,代码来源:asset_tracker_bak.py

示例4: get_bottom_wdg

# 需要导入模块: from pyasm.widget import TextWdg [as 别名]
# 或者: from pyasm.widget.TextWdg import set_attr [as 别名]
    def get_bottom_wdg(my, search_keys=[]):
        # check if the user has enabled it
        info = my.check_bottom_wdg()

        if info.get('check') == False:
            return None

        if info.get('mode') != 'total':
            top = DivWdg()
            top.add("Only [total] is supported. Please change it in Edit Column Definition")
            return top

        my.today = datetime.date.today()

        if my.is_refresh:
            top = Widget()
        else:
            top = DivWdg()
           
        days = []
        for date in my.dates:
            days.append( date.strftime("%Y_%m_%d") )

        today = my.today.strftime("%Y_%m_%d")

        table = Table()
        top.add(table)

        row_list = [my.ST_ROW]
        if my.show_overtime:
            row_list.append( my.OT_ROW)
            
        for row_to_draw in row_list:

            table.add_row()
            table.add_color("color", "color")
            table.add_styles("width: %spx; float: left"%my.table_width)

            td = table.add_blank_cell()
            td.add_style("min-width: %spx" % (my.MONTH_WIDTH + my.LEFT_WIDTH+8))
            time_prefix = ''
            if row_to_draw == my.OT_ROW:
                time_prefix = 'ot'
                div = DivWdg()
                div.add("OT")
               
                div.add_styles('text-align: right; margin-right: 4px; margin-bottom: 6px')
                td.add(div)
            elif row_to_draw == my.STT_ROW:
                time_prefix = 'stt'
                div = DivWdg()
                div.add("ST")
               
                div.add_styles('text-align: right; margin-right: 4px; margin-bottom: 6px')
                td.add(div)
            elif row_to_draw == my.ENT_ROW:
                time_prefix = 'ent'
                div = DivWdg()
                div.add("ET")
               
                div.add_styles('text-align: right; margin-right: 4px; margin-bottom: 6px')
                td.add(div)


            for idx, day in enumerate(days):
                day_wdg = DivWdg()
                day_wdg.add(day)
                
                td = table.add_cell()
                td.add_style("width: %spx" % my.day_width)
                # keep it as text input for consistent alignment
                text = TextWdg("%sday_%s" % (time_prefix, day) )

                if row_to_draw == my.OT_ROW:
                    sobj_daily_dict = my.summary_ot[idx]
                else:
                    sobj_daily_dict = my.summary_st[idx]

                if search_keys:
                    sobj_daily_sub_dict = Common.subset_dict(sobj_daily_dict, search_keys)
                else:
                    sobj_daily_sub_dict = sobj_daily_dict

                daily_total = 0
                for value in sobj_daily_sub_dict.values():
                    if value:
                        daily_total += value

                text.set_value(daily_total)
                td.add(text)

                text.add_class("spt_day%s" % (time_prefix))
                text.add_style("width: %spx"%(my.day_width-2))
                #text.add_style("width: 100%")
                text.add_style("text-align: right")
                text.add_style("padding-left: 2px")
                text.add_style('font-weight: 500')
                text.set_attr("readonly", "readonly")
                # grey out the text color
                text.add_color('color', 'color', +40)
#.........这里部分代码省略.........
开发者ID:0-T-0,项目名称:TACTIC,代码行数:103,代码来源:work_hours_element_wdg.py

示例5: get_display

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

#.........这里部分代码省略.........
        performance_wdg = PerformanceWdg()
        top.add(performance_wdg)

      
        top.add('<br/>')

        # mail server
        title_div = DivWdg()
        top.add(title_div)
        title_div.add("Mail Server")
        title_div.add_class("spt_info_title")

        table = Table(css='email_server')
        table.add_color("color", "color")
        table.add_style("margin: 10px")
        top.add(table)
        table.add_row()
        td = table.add_cell("Server: ")
        td.add_style("width: 150px")
        mailserver = Config.get_value("services", "mailserver")
        has_mailserver = True
        if mailserver:
            table.add_cell( mailserver )
        else:
            table.add_cell("None configured")
            has_mailserver = False

        login = Login.get_by_login('admin')
        login_email = login.get_value('email')
        table.add_row()
        td = table.add_cell("From: ")
        td.add_style("width: 150px")
        text = TextWdg('email_from')
        text.set_attr('size', '40')
        text.set_value(login_email)
        text.add_class('email_from')
        table.add_cell(text)
        
        table.add_row()
        td = table.add_cell("To: ")
        td.add_style("width: 150px")
        text = TextWdg('email_to')
        text.set_attr('size', '40')
        text.add_class('email_to')
        text.set_value(login_email)
        table.add_cell(text)


        button = ActionButtonWdg(title='Email Send Test')
        table.add_row_cell('<br/>')
        table.add_row()

        table.add_cell(button)
        button.add_style("float: right")
        button.add_behavior( {
        'type': 'click_up',
        'has_mailserver': has_mailserver,
        'cbjs_action': '''
             if (!bvr.has_mailserver) {
                spt.alert('You have to fill in mailserver and possibly other mail related options in the TACTIC config file to send email.');
                return;
            }
             var s = TacticServerStub.get();
             try {

                spt.app_busy.show('Sending email'); 
开发者ID:mincau,项目名称:TACTIC,代码行数:70,代码来源:system_info_wdg.py

示例6: get_first_row_wdg

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

        # read the csv file
        my.file_path = ""

        div = DivWdg()

        div.add( my.get_upload_wdg() )

        if not my.search_type:
            return div

        if not my.file_path:
            return div


        if not my.file_path.endswith(".csv"):
            div.add( "Uploaded file [%s] is not a csv file"% my.file_path)
            return div

        if not os.path.exists(my.file_path):
            raise Exception("Path '%s' does not exists" % my.file_path)

        div.add(HtmlElement.br(2))

        div.add( HtmlElement.b("The following is taken from first line in the uploaded csv file.  Select the appropriate column to match.") )
        div.add(HtmlElement.br())
        div.add(  HtmlElement.b("Make sure you have all the required columns** in the csv."))
        option_div = DivWdg()
        
        option_div.add_style("float: left")
        option_div.add_style("margin-right: 30px")

        option_div.add("<p>3. Parsing Options:</p>")

        my.search_type_obj = SearchType.get(my.search_type)


        # first row and second row
        option_div.add( HtmlElement.br(2) )
        option_div.add("Use Title Row: ")
        title_row_checkbox = FilterCheckboxWdg("has_title")
        title_row_checkbox.set_default_checked()
        option_div.add(title_row_checkbox)
        option_div.add( HintWdg("Set this to use the first row as a title row to match up columns in the database") )
        
        option_div.add( HtmlElement.br(2) )
        option_div.add("Sample Data Row: ")
        data_row_text = TextWdg("data_row")
        data_row_text.set_attr("size", "3")
        option_div.add(data_row_text)
        option_div.add( HintWdg("Set this as a sample data row to match the columns to the database") )

        option_div.add( HtmlElement.br(2) )
        
       
        div.add(option_div)
        my.has_title = title_row_checkbox.is_checked()
        
        
        # parse the first fow
        csv_parser = CsvParser(my.file_path)
        if my.has_title:
            csv_parser.set_has_title_row(True)
        else:
            csv_parser.set_has_title_row(False)
        csv_parser.parse()
        csv_titles = csv_parser.get_titles()
        csv_data = csv_parser.get_data()



        data_row = data_row_text.get_value()
        if not data_row:
            data_row = 0
        else:
            try:
                data_row = int(data_row)
            except ValueError:
                data_row = 0

            if data_row >= len(csv_data):
                data_row = len(csv_data)-1
        data_row_text.set_value(data_row)




        table = Table()
        table.set_attr("cellpadding", "10")

        table.add_row()
        table.add_header("CSV Column Value")
        table.add_header("TACTIC Column")
        table.add_header("Create New Column")
        
        columns = my.search_type_obj.get_columns()
        search_type = my.search_type_obj.get_base_search_type()
        sobj = SObjectFactory.create(search_type)
        required_columns = sobj.get_required_columns()
#.........这里部分代码省略.........
开发者ID:0-T-0,项目名称:TACTIC,代码行数:103,代码来源:csv_import_wdg.py


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