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


Python TextWdg.add_attr方法代码示例

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


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

示例1: get_display

# 需要导入模块: from pyasm.widget import TextWdg [as 别名]
# 或者: from pyasm.widget.TextWdg import add_attr [as 别名]
 def get_display(my):
     widget = DivWdg()
     table = Table()
     table.add_attr('class','scraper')
     table.add_row()
     tb = TextWdg('title_box')
     tb.add_attr('id','title_box')
     multiple_titles = None
     print "MY.TITLE_OF_SHOW = %s" % my.title_of_show
     if my.title_of_show not in [None,'']:
         tb.set_value(my.title_of_show)
         #poster_url_text = my.get_poster_url(my.title_of_show)
         #poster_url = poster_url_text.split('=')[1]
         multiple_titles = my.get_multiple_title_info(my.title_of_show)
     print "MULTIPLE_TITLES = %s" % multiple_titles
     tb.add_behavior(my.get_search())
     table.add_cell(tb)
     if multiple_titles not in [None,''] and len(multiple_titles) > 0:
         for m in multiple_titles:
             table.add_row()
             table.add_cell('<img src="%s"/>' % m['TopLevel']['poster'])
             mkeys = m.keys()
             for k in mkeys: 
                 table.add_row()
                 table.add_cell('<b><u>%s</u></b>' % k)
                 dudes = m[k]
                 dkeys = dudes.keys()
                 for d in dkeys:
                     table.add_row()
                     table.add_cell('%s: %s' % (d, dudes[d])) 
     widget.add(table)
     return widget
开发者ID:Smurgledwerf,项目名称:custom,代码行数:34,代码来源:scraper.py

示例2: get_display

# 需要导入模块: from pyasm.widget import TextWdg [as 别名]
# 或者: from pyasm.widget.TextWdg import add_attr [as 别名]
 def get_display(my):   
     from tactic.ui.widget import SObjectCheckinHistoryWdg
     my.code = str(my.kwargs.get('source_code'))
     my.sk = my.server.build_search_key('twog/source',my.code)
     my.movement_code = str(my.kwargs.get('movement_code'))
     ms = MovementScripts(movement_code=my.movement_code)
     clients_expr = "@SOBJECT(twog/client['@ORDER_BY','name desc'])" 
     clients = my.server.eval(clients_expr)
     client_sel = '<select class="REPLACE_ME"><option value="">--Select--</option>'
     for client in clients:
         client_sel = '%s<option value="%s">%s</option>' % (client_sel, client.get('code'), client.get('name'))
     client_sel = '%s</select>' % client_sel
     existing_expr = "@SOBJECT(twog/outside_barcode['source_code','%s'])" % my.code
     existing = my.server.eval(existing_expr)
     count = 0
     table = Table()
     table.add_attr('class','movement_outside_barcodes')
     for obc in existing:
         table.add_row()
         barcode_text_wdg = TextWdg('outside_barcode_insert_%s' % count)
         barcode_text_wdg.set_value(obc.get('barcode'))
         barcode_text_wdg.add_attr('curr_code',obc.get('code'))
         table.add_cell(barcode_text_wdg)
         new_sel = client_sel
         new_sel2 = new_sel.replace('REPLACE_ME','outside_client_%s' % count)
         found = new_sel2.find('"%s"' % obc.get('client_code'))
         if found > 0:
             part1 = new_sel2[:found]
             part2 = new_sel2[found:]
             found2 = part2.find('>')
             if found2 > 0:
                 good2 = part2[found2:]
                 new_sel2 = '%s"%s" selected="selected"%s' % (part1, obc.get('client_code'),good2)
         table.add_cell(new_sel2)
         count = count + 1
     additional_count = [1, 2, 3, 4, 5]
     for n in additional_count:
         table.add_row()
         barcode_text_wdg = TextWdg('outside_barcode_insert_%s' % count)
         barcode_text_wdg.add_attr('curr_code','')
         table.add_cell(barcode_text_wdg)
         new_sel = client_sel
         new_sel = new_sel.replace('REPLACE_ME','outside_client_%s' % count)
         table.add_cell(new_sel)
         count = count + 1
     table.add_row()
     save_tbl = Table()
     save_tbl.add_row()
     s1 = save_tbl.add_cell(' ')
     s1.add_attr('width','100%s' % '%')
     save_cell = table.add_cell('<input type="button" value="Save All"/>')
     save_cell.add_attr('align','center')
     save_cell.add_behavior(ms.get_save_outside_barcodes_behavior(my.code))
     s2 = save_tbl.add_cell(' ')
     s2.add_attr('width','100%s' % '%')
     ss = table.add_cell(save_tbl)
     ss.add_attr('colspan','2')
     ss.add_attr('align','center')
     return table
开发者ID:2gDigitalPost,项目名称:custom,代码行数:61,代码来源:movement_maker.py

示例3: get_display

# 需要导入模块: from pyasm.widget import TextWdg [as 别名]
# 或者: from pyasm.widget.TextWdg import add_attr [as 别名]
 def get_display(my):
     from pyasm.search import Search
     #from tactic_client_lib import TacticServerStub
     barcode = ''
     sources = []
     bad_sources = []
     if 'barcode' in my.kwargs.keys():
         barcode = my.kwargs.get('barcode')
         tracker_s = Search("twog/location_tracker")
         tracker_s.add_filter('location_barcode',barcode)
         trackers = tracker_s.get_sobjects()
         #print "BARCODE = %s" % barcode
         #print "LEN TRACKERS = %s" % len(trackers)
         for t in trackers:
             tdate = t.get('timestamp')
             source_barcode = t.get('source_barcode')
             other_tracks = Search("twog/location_tracker")
             other_tracks.add_filter('source_barcode',source_barcode)
             other_tracks.add_filter('timestamp',tdate, op=">")
             others = other_tracks.get_sobjects()
             if len(others) == 0:
                 source_s = Search("twog/source")
                 source_s.add_filter('barcode',source_barcode)
                 source = source_s.get_sobject()
                 if source:
                     if source.get_value('in_house') in [True,'true','True',1,'1']:
                         sources.append(source)
                 else:
                     bad_sources.append({'barcode': source_barcode, 'title': 'UNKNOWN SOURCE'})
     
     table = Table()
     table.add_attr('class','location_inventory_wdg')
     table.add_row()
     bc = TextWdg('nextbc')
     bc.add_attr('id', 'location_inventory_txtbox')
     bc.add_behavior(my.get_entry_bvr())
     bc.set_value(barcode)
     table.add_cell(bc)
     #print "LEN SOURCES = %s" % len(sources)
     if len(sources) > 0:
         table.add_row()
         table.add_cell("<b>TOTAL: %s (UNKNOWN: %s)</b>" % (len(sources), len(bad_sources)))
     for source in sources:
         table.add_row()
         table.add_cell('Barcode: %s, Code: %s, Name: %s: %s' % (source.get_value('barcode'), source.get_code(), source.get_value('title'), source.get_value('episode')))
     if len(bad_sources) > 0:
         table.add_row()
         table.add_cell("<b>UNKNOWN SOURCES</b>")
         for b in bad_sources:
             table.add_row()
             table.add_cell('Barcode: %s, Name: %s' % (b.get('barcode'), b.get('title')))
     widget = DivWdg()
     widget.add(table)
     return widget
开发者ID:2gDigitalPost,项目名称:custom,代码行数:56,代码来源:asset_tracker.py

示例4: txtbox

# 需要导入模块: from pyasm.widget import TextWdg [as 别名]
# 或者: from pyasm.widget.TextWdg import add_attr [as 别名]
 def txtbox(my, name, val, code, old_val, width='200px', js='no'):
     txt = TextWdg(name)
     txt.add_attr('id', name)
     txt.add_attr('code', code)
     txt.add_attr('old_val', old_val)
     txt.add_style('width: %s;' % width)
     txt.set_value(val)
     if js == 'yes':
         txt.add_behavior(my.get_nums_only())
     return txt
开发者ID:2gDigitalPost,项目名称:custom-rewrite,代码行数:12,代码来源:element_eval_audio_wdg.py

示例5: handle_simple_mode

# 需要导入模块: from pyasm.widget import TextWdg [as 别名]
# 或者: from pyasm.widget.TextWdg import add_attr [as 别名]
    def handle_simple_mode(my, custom_table, mode):

        tbody = custom_table.add_tbody()
        tbody.add_class("spt_custom_simple")
        if mode != 'simple':
            tbody.add_style('display: none')


        name_text = TextWdg("custom_name")
        name_text.add_class("spt_input")
        tr = custom_table.add_row()
        tr.add_color("background", "background", -7)
        td = custom_table.add_cell("Name: ")
        td.add_style("min-width: 150px")
        custom_table.add_cell(name_text)


        # add title
        custom_table.add_row()
        title_wdg = TextWdg("custom_title")
        title_wdg.add_attr("size", "50")
        custom_table.add_cell( "Title: " )
        custom_table.add_cell( title_wdg )

        # add description
        tr = custom_table.add_row()
        tr.add_color("background", "background", -7)
        description_wdg = TextAreaWdg("custom_description")
        custom_table.add_cell( "Description: " )
        custom_table.add_cell( description_wdg )


        type_select = SelectWdg("custom_type")
        type_select.add_class("spt_input")
        #type_select.add_empty_option("-- Select --")
        type_select.set_option("values", "string|text|integer|float|boolean|currency|date|foreign_key|list|button|empty")
        type_select.set_option("labels", "String(db)|Text(db)|Integer(db)|Float(db)|Boolean(db)|Currency(db)|Date(db)|Foreign Key(db)|List(db)|Button|Empty")
        #type_select.set_option("labels", "String|Integer|Boolean|Currency|Timestamp|Link|Foreign Key|List|Checkbox|Text|Number|Date|Date Range")
        tr = custom_table.add_row()
        custom_table.add_cell("Property Type: ")
        td = custom_table.add_cell(type_select)
        type_select.add_event("onchange", "spt.custom_property_adder.property_type_select_cbk(this)")



        # extra info for foreign key
        custom_table.add_row()
        div = DivWdg()
        div.add_class("foreign_key_options")
        div.add_style("display: none")
        div.add_style("margin-top: 10px")
        div.add("Options")
        div.add(HtmlElement.br())
        # TODO: this class should not be in prod!!
        from pyasm.prod.web import SearchTypeSelectWdg
        div.add("Relate to: ")
        search_type_select = SearchTypeSelectWdg("foreign_key_search_select", mode=SearchTypeSelectWdg.CURRENT_PROJECT)
        div.add(search_type_select)
        td.add(div)



        # extra info for list
        custom_table.add_row()
        div = DivWdg()
        div.add_class("list_options")
        div.add_style("display: none")
        div.add_style("margin-top: 10px")
        div.add("Options")
        div.add(HtmlElement.br())
        # TODO: this class should not be in prod!!
        from pyasm.prod.web import SearchTypeSelectWdg
        div.add("Values: ")
        search_type_text = TextWdg("list_values")
        div.add(search_type_text)
        td.add(div)




        # extra info for button
        custom_table.add_row()
        div = DivWdg()
        div.add_class("button_options")
        div.add_style("display: none")
        div.add_style("margin-top: 10px")

        class_path = "tactic.ui.table.ButtonElementWdg"
        button = Common.create_from_class_path(class_path)
        args_keys = button.get_args_keys()


        div.add("Options")
        div.add(HtmlElement.br())

        for key in args_keys.keys():
            div.add("Name: ")
            option_name_text = TextWdg("option_name")
            option_name_text.add_attr("readonly", "true")
            option_name_text.set_value(key)
#.........这里部分代码省略.........
开发者ID:0-T-0,项目名称:TACTIC,代码行数:103,代码来源:custom_property_wdg.py

示例6: get_default_display_wdg

# 需要导入模块: from pyasm.widget import TextWdg [as 别名]
# 或者: from pyasm.widget.TextWdg import add_attr [as 别名]
    def get_default_display_wdg(cls, element_name, display_options, element_type, kbd_handler=False):

        from pyasm.widget import TextAreaWdg, CheckboxWdg, SelectWdg, TextWdg
        if element_type in ["integer", "smallint", "bigint", "int"]:
            behavior = {
                'type': 'keyboard',
                'kbd_handler_name': 'DgTableIntegerTextEdit'
            }
            input = TextWdg("main")
            input.set_options(display_options)
            if kbd_handler:
                input.add_behavior(behavior)

        elif element_type in ["float"]:
            behavior = {
                'type': 'keyboard',
                'kbd_handler_name': 'DgTableFloatTextEdit'
            }
            input = TextAreaWdg("main")
            input.set_options(display_options)
            if kbd_handler:
                input.add_behavior(behavior)

        elif element_type in ["string", "link", "varchar", "character", "timecode"]:
            behavior = {
                'type': 'keyboard',
                'kbd_handler_name': 'DgTableMultiLineTextEdit'
            }
            input = TextWdg('main')
            input.set_options(display_options)
            if kbd_handler:
                input.add_behavior(behavior)


        elif element_type in ["text"]:
            behavior = {
                'type': 'keyboard',
                'kbd_handler_name': 'DgTableMultiLineTextEdit'
            }
            input = TextAreaWdg('main')
            input.set_options(display_options)
            if kbd_handler:
                input.add_behavior(behavior)

        elif element_type == "boolean":
            input = CheckboxWdg('main')
            input.set_options(display_options)
            input.add_behavior(
             {"type" : "click_up",
                    'propagate_evt': True})

        elif element_type in  ["timestamp", "date", "time", "datetime2"]:
            from tactic.ui.widget import CalendarInputWdg, CalendarWdg, TimeInputWdg
            # FIXME: take wild guess for the time
            if element_name.endswith("_time"):
                #input = TimeInputWdg()
                behavior = {
                    'type': 'keyboard',
                    'kbd_handler_name': 'DgTableMultiLineTextEdit'
                }
                input = TextWdg('main')
                input.set_options(display_options)
                if kbd_handler:
                    input.add_behavior(behavior)

            else:
                #input = CalendarWdg()
                input = CalendarInputWdg()
                input.set_option('show_activator', False)
            #input.set_options(display_options)

        elif element_type == 'datetime':
            from tactic.ui.widget import CalendarInputWdg
            input = CalendarInputWdg()
            input.set_option('show_time', 'true')

        elif element_type == "color":
            from tactic.ui.widget import ColorInputWdg
            input = ColorInputWdg()
            input.set_options(display_options)

        elif element_type =="sqlserver_timestamp":
            # better then set it to None
            input = TextWdg()
            input.add_attr('disabled','disabled')
        else:
            # else try to instantiate it as a class
            print "WARNING: EditWdg handles type [%s] as default TextWdg" %element_type
            input = TextWdg()
            input.add("No input defined")

        return input 
开发者ID:funic,项目名称:TACTIC,代码行数:94,代码来源:edit_wdg.py

示例7: get_display

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

示例8: get_display

# 需要导入模块: from pyasm.widget import TextWdg [as 别名]
# 或者: from pyasm.widget.TextWdg import add_attr [as 别名]
    def get_display(my):
        widget = DivWdg()
        table = Table()
        table.add_attr('class','client_deliverable_wdg')
        table.add_row()
        table2 = Table()
        table2.add_style('border-spacing: 5px;')
        table2.add_style('border-collapse: separate;')
        table2.add_row()

        c1 = table2.add_cell('Order Code:')
        c1.add_attr('nowrap','nowrap')
        tb1 = TextWdg('order_code')
        tb1.add_attr('id','order_code')
        tb1.add_attr('disabled','disabled')
        tb1.set_value(my.sob['order_code'])
        table2.add_cell(tb1)

        c1 = table2.add_cell('PO Number:')
        c1.add_attr('nowrap','nowrap')
        tb1 = TextWdg('po_number')
        tb1.add_attr('id','po_number')
        tb1.add_attr('disabled','disabled')
        tb1.set_value(my.sob['po_number'])
        table2.add_cell(tb1)

        c1 = table2.add_cell('Title Code:')
        c1.add_attr('nowrap','nowrap')
        tb1 = TextWdg('title_code')
        tb1.add_attr('id','title_code')
        tb1.add_attr('disabled','disabled')
        tb1.set_value(my.sob['title_code'])
        table2.add_cell(tb1)

        c1 = table2.add_cell('Platform:')
        c1.add_attr('nowrap','nowrap')
        tb1 = TextWdg('platform')
        tb1.add_attr('id','platform')
        tb1.add_attr('disabled','disabled')
        tb1.set_value(my.sob['platform'])
        table2.add_cell(tb1)

        c1 = table2.add_cell('Client:')
        c1.add_attr('nowrap','nowrap')
        tb1 = TextWdg('client_name')
        tb1.add_attr('id','client_name')
        tb1.add_attr('disabled','disabled')
        tb1.set_value(my.sob['client_name'])
        table2.add_cell(tb1)

        table2.add_row()
        table2.add_cell(table2.hr())
        table2.add_row()

        c1 = table2.add_cell('Title Source(s):')
        c1.add_attr('nowrap','nowrap')
        tb1 = TextWdg('original_source_code')
        tb1.add_attr('id','original_source_code')
        tb1.add_attr('disabled','disabled')
        tb1.add_style('width','200px')
        tb1.set_value(my.sob['original_source_code'])
        c2 = table2.add_cell(tb1)
        c2.add_attr('colspan','2')

        c1 = table2.add_cell('Title Source Barcodes(s):')
        c1.add_attr('nowrap','nowrap')
        tb1 = TextWdg('original_source_barcode')
        tb1.add_attr('id','original_source_barcode')
        tb1.add_attr('disabled','disabled')
        tb1.add_style('width','200px')
        tb1.set_value(my.sob['original_source_barcode'])
        c2 = table2.add_cell(tb1)
        c2.add_attr('colspan','2')

        c1 = table2.add_cell('Ancestors:')
        c1.add_attr('nowrap','nowrap')
        tb1 = TextWdg('ancestors')
        tb1.add_attr('id','ancestors')
        tb1.add_attr('disabled','disabled')
        tb1.add_style('width','300px')
        tb1.set_value(my.sob['ancestors'])
        c2 = table2.add_cell(tb1)
        c2.add_attr('colspan','3')

        table2.add_row()
        table2.add_cell(table2.hr())
        table2.add_row()

        c1 = table2.add_cell('Destination:')
        c1.add_attr('nowrap','nowrap')
        destination_sel = SelectWdg('destination')
        destination_sel.add_attr('id','destination')
        destination_sel.append_option('--Select--','')
        for c in my.all_clients:
            destination_sel.append_option(c.get('name'),c.get('name'))
        if my.sob.get('destination') == None:
            my.sob['destination'] = ''
        destination_sel.set_value(my.sob.get('destination'))
        table2.add_cell(destination_sel)

#.........这里部分代码省略.........
开发者ID:2gDigitalPost,项目名称:custom,代码行数:103,代码来源:client_deliverable.py

示例9: get_display

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

        top_wdg = DivWdg()
        top_wdg.add_style("color: black")
        top_wdg.add_style("width: 350px")
        top_wdg.add_style("margin-top: 10px")
        top_wdg.add_style("padding: 10px")
        top_wdg.add_border()
        title = DivWdg()
        title.add_style("color: black")
        title.add_style("margin-top: -22px")

        top_wdg.add(title)
        #if not self.name_string:
        #    title.add('No database column')
        #    return top_wdg
        
        title.add("Widget Definition")

        widget_types = {
            'foreign_key': 'tactic.ui.table.ForeignKeyElementWdg',
            'button': 'tactic.ui.table.ButtonElementWdg',
            'expression': 'tactic.ui.table.ExpressionElementWdg'
        }


        web = WebContainer.get_web()
        config_string = web.get_form_value("config_xml")
        if not config_string:
            config_string = '<config/>'
        xml = Xml()
        xml.read_string(config_string)

        #print "config_string: ", config_string

        # get values from the config file
        element_name = xml.get_value('element/@name')

        config = WidgetConfig.get(view='element',xml='<config><element>%s</element></config>' % config_string)
        display_options = config.get_display_options(element_name)


        title = xml.get_value('element/@title')
        display_handler = xml.get_value('element/display/@class')
        if not display_handler:
            display_handler = 'tactic.ui.panel.TypeTableElementWdg'

        widget_name = xml.get_value('element/display/@widget')
        if not widget_name:
            widget_name = 'custom'

 
        custom_table = Table()
        custom_table.add_style("color: black")
        top_wdg.add(custom_table)

        name_text = DivWdg()
        name_text.add_style("color: black")
        name_text.add(element_name)
        custom_table.add_row()
        custom_table.add_cell("Name: ")
        custom_table.add_cell(name_text)



        # add title
        custom_table.add_row()
        title_wdg = TextWdg("custom_title")
        title_wdg.set_value(title)
        title_wdg.add_attr("size", "50")
        custom_table.add_cell( "Title: " )
        custom_table.add_cell( title_wdg )

        # add description
        #custom_table.add_row()
        #description_wdg = TextAreaWdg("custom_description")
        #td = custom_table.add_cell( "Description: " )
        #td.add_style("vertical-align: top")
        #custom_table.add_cell( description_wdg )


        type_select = SelectWdg("custom_type")
        #type_select.add_empty_option("-- Select --")

        type_select.set_option("values", "string|integer|float|boolean|currency|date|foreign_key|link|list|button|custom")
        type_select.set_option("labels", "String(db)|Integer(db)|Float(db)|Boolean(db)|Currency(db)|Date(db)|Foreign Key|Link|List|Button|Custom")
        type_select.set_value(widget_name)

        #type_select.set_option("values", "string|integer|float|boolean|currency|date|link|list|foreign_key|button|empty")
        #type_select.set_option("labels", "String|Integer|Float|Boolean|Currency|Date|Link|List|Foreign Key|Button|Empty")
        custom_table.add_row()
        td = custom_table.add_cell("Widget Type: ")
        td.add_style("vertical-align: top")
        td = custom_table.add_cell(type_select)
        type_select.add_event("onchange", "spt.CustomProject.property_type_select_cbk(this)")


        td.add(HtmlElement.br())
        display_handler_text = TextWdg("display_handler")
        display_handler_text.add_attr("size", "50")
#.........这里部分代码省略.........
开发者ID:mincau,项目名称:TACTIC,代码行数:103,代码来源:search_type_manager_wdg.py

示例10: get_display

# 需要导入模块: from pyasm.widget import TextWdg [as 别名]
# 或者: from pyasm.widget.TextWdg import add_attr [as 别名]
    def get_display(my):   
        widget = DivWdg()
        widget.add_attr('id','whole_fb_container_%s' % my.custom_top_name)
        if 'dir' in my.kwargs.keys():
            my.dir = my.kwargs.get('dir')
        if 'old_dir' in my.kwargs.keys():
            my.old_dir = my.kwargs.get('old_dir')
        else:
            my.old_dir = my.dir
        if 'mode' in my.kwargs.keys():
            my.mode = my.kwargs.get('mode')
            if my.mode in [None,'']:
                my.mode = 'classic'
        #print "DIR = %s, OLD DIR = %s" % (my.dir, my.old_dir)
        
        err_msg = ''
        if not os.path.isdir(my.dir):
            err_msg = '%s is not a valid directory' % my.dir 
            my.dir = my.old_dir
       
        trimmed_dir = my.dir
        if trimmed_dir[len(trimmed_dir) - 1] == '/' and len(trimmed_dir) > 1:
            trimmed_dir = trimmed_dir[:-1]
        
        prev_dir_s = trimmed_dir.split('/')
        prev_dir_s = prev_dir_s[:-1]
        prev_dir = ''
        
        for ct in range(0,len(prev_dir_s)):
            if prev_dir_s[ct] not in [None,'']:
                if prev_dir == '':
                    prev_dir = '/%s' % prev_dir_s[ct]
                else:   
                    prev_dir = '%s/%s' % (prev_dir, prev_dir_s[ct])
        if prev_dir in [None,'','//']:
            prev_dir = '/'
        #print "PREV DIR = %s" % prev_dir
        
        files_list = []
        dir_list = []
        
        files_dict = {}
        dirs_dict = {}
        
        longest_name_len = 0
        
        for f in os.listdir(my.dir):
            joined = join(my.dir,f)
            if os.path.isfile(joined):
                files_list.append(joined)
                last_modified = 'N/A'
                created = 'N/A'
                size = 'N/A'
                if joined.count('/') > 3:
                    last_modified =  datetime.fromtimestamp(os.path.getmtime(joined)).strftime('%Y-%m-%d %H:%M:%S')
                    created =  datetime.fromtimestamp(os.path.getctime(joined)).strftime('%Y-%m-%d %H:%M:%S')
                    size = my.convertSize(os.path.getsize(joined),'file')
                file_name_s = joined.split('/')
                file_name = file_name_s[len(file_name_s) - 1]
                file_path = joined
                files_dict[joined] = {'last_modified': last_modified, 'created': created, 'size': size, 'name': file_name, 'path': joined}
                if len(file_name) > longest_name_len:
                    longest_name_len = len(file_name)
            
            elif os.path.isdir(joined):
                dir_name_s = joined.split('/')
                dir_name = dir_name_s[len(dir_name_s) - 1]
                if dir_name[0] != '.':
                    dir_list.append(joined)
                    size = 'N/A'
                    created = 'N/A'
                    last_modified = 'N/A'
                   
                    #This is to keep us from calculating the size of the huge base directories
                    #Probably want a way to turn directory sizes on and off
                    if joined.count('/') > 5:
                        last_modified =  datetime.fromtimestamp(os.path.getmtime(joined)).strftime('%Y-%m-%d %H:%M:%S')
                        created =  datetime.fromtimestamp(os.path.getctime(joined)).strftime('%Y-%m-%d %H:%M:%S')
                        prepresize = commands.getoutput('du -s %s' % joined).split()[0]
                        try:
                            presize = float(prepresize)
                            if not math.isnan(presize):
                                size = my.convertSize(float(presize),'dir')
                        except ValueError:
                            print "GOT AN ERROR FOR %s" % joined
                            pass
                    dir_path = joined
                    dirs_dict[joined] = {'size': size, 'created': created, 'last_modified': last_modified, 'name': dir_name, 'path' : dir_path}
                    if len(dir_name) > longest_name_len:
                        longest_name_len = len(dir_name)
        
        #print "LONGEST NAME LEN = %s" % longest_name_len
        name_len = longest_name_len * 10
        
        # Displaying the table of the folders and files 
        top_tbl = Table()
        if err_msg != '':
            top_tbl.add_row()
            top_tbl.add_cell('<b><font color="#FF0000">%s</font></b>' % err_msg)
        top_tbl.add_row()
#.........这里部分代码省略.........
开发者ID:2gDigitalPost,项目名称:custom,代码行数:103,代码来源:file_browser.py

示例11: get_display

# 需要导入模块: from pyasm.widget import TextWdg [as 别名]
# 或者: from pyasm.widget.TextWdg import add_attr [as 别名]
    def get_display(my):
        top = my.top
        top.add_class("spt_script_editor_top")

        """
        top.add_class("SPT_CHANGE")
        top.add_behavior( {
            'type': 'load',
            'cbjs_action': '''
            register_change = function(bvr) {
                var change_top = bvr.src_el.getParent(".SPT_CHANGE"); 
                change_top.addClass("SPT_HAS_CHANGES");
                change_top.update_change(change_top, bvr);
            }

            has_changes = function(bvr) {
                var change_top = bvr.src_el.getParent(".SPT_CHANGE"); 
                return change_top.hasClass("SPT_HAS_CHANGES");
            }

            bvr.src_el.update_change = function(top, bvr) {
                change_el = top.getElement(".spt_change_element");
                change_el.setStyle("display", "");
            }
            '''
        } )
        """

        change_div = DivWdg()
        top.add(change_div)
        #change_div.add("CHANGES!!!")
        change_div.add_style("display: none")
        change_div.add_class("spt_change_element");





        top.add_class("spt_panel")
        top.add_class("spt_js_editor")
        top.add_attr("spt_class_name", Common.get_full_class_name(my) )
        top.add_color("background", "background")
        top.add_style("padding", "10px")
       


        div = DivWdg()
        top.add(div)


        # if script_path
        script_path = my.kwargs.get("script_path")
        search_key = my.kwargs.get("search_key")
        if script_path:
            search = Search("config/custom_script")
            dirname = os.path.dirname(script_path)
            basename = os.path.basename(script_path)

            search.add_filter("folder", dirname)
            search.add_filter("title", basename)
            script_sobj = search.get_sobject()
        elif search_key:
            script_sobj = Search.get_by_search_key(search_key)
        else:
            script_sobj = None


        if script_sobj:
            script_code = script_sobj.get_value("code")
            script_folder = script_sobj.get_value("folder")
            script_name = script_sobj.get_value("title")
            script_value = script_sobj.get_value("script")
            script_language = script_sobj.get_value("langauge")
        else:
            script_code = ''
            script_folder = ''
            script_name = ''
            script_value = ''




        editor = AceEditorWdg(custom_script=script_sobj)
        my.editor_id = editor.get_editor_id()


        if not Container.get_dict("JSLibraries", "spt_script_editor"):
            div.add_behavior( {
                'type': 'load',
                'cbjs_action': my.get_onload_js()
            } )


        # create the insert button
        help_button_wdg = DivWdg()
        div.add(help_button_wdg)
        help_button_wdg.add_style("float: right")
        help_button = ActionButtonWdg(title="?", tip="Script Editor Help", size='s')
        help_button_wdg.add(help_button)

#.........这里部分代码省略.........
开发者ID:funic,项目名称:TACTIC,代码行数:103,代码来源:shelf_wdg.py

示例12: get_display

# 需要导入模块: from pyasm.widget import TextWdg [as 别名]
# 或者: from pyasm.widget.TextWdg import add_attr [as 别名]
    def get_display(my):
        my.sk = str(my.kwargs.get('sk'))
        my.code = my.sk.split('code=')[1]
        my.parent_sk = str(my.kwargs.get('parent_sk'))
        my.order_sk = str(my.kwargs.get('order_sk'))
        order_code = my.order_sk.split('code=')[1]
        my.parent_sid = str(my.kwargs.get('parent_sid'))
        if 'user' in my.kwargs.keys():
            my.user = my.kwargs.get('user')
        else:
            my.user = Environment.get_user_name()
        if 'groups_str' in my.kwargs.keys():
            my.groups_str = my.kwargs.get('groups_str')
        if my.groups_str in [None,'']:
            user_group_names = Environment.get_group_names()
            for mg in user_group_names:
                if my.groups_str == '':
                    my.groups_str = mg
                else:
                    my.groups_str = '%s,%s' % (my.groups_str, mg)

        user_is_scheduler = False
        if 'scheduling' in my.groups_str or 'onboarding' in my.groups_str:
            user_is_scheduler = True

        if 'display_mode' in my.kwargs.keys():
            my.disp_mode = str(my.kwargs.get('display_mode'))
        if my.disp_mode == 'Small':
            my.small = True
        if 'is_master' in my.kwargs.keys():
            my.is_master_str = my.kwargs.get('is_master')
            if my.is_master_str == 'true':
                my.is_master = True
        else:
            order_search = Search("twog/order")
            order_search.add_filter('code',order_code)
            order = order_search.get_sobject()
            order_classification = order.get_value('classification')
            if order_classification in ['master', 'Master']:
                my.is_master = True
                my.is_master_str = 'true'
        open_bottom = False
        if 'open_bottom' in my.kwargs.keys():
            ob_text = my.kwargs.get('open_bottom')
            if ob_text in [True, 'true', 't', '1', 1]:
                open_bottom = True

        main_obj = None
        if 'main_obj' in my.kwargs.keys():
            main_obj = my.kwargs.get('main_obj')
        else:
            main_search = Search("twog/proj")
            main_search.add_filter('code', my.code)
            main_obj = main_search.get_sobject()
        pipe_disp = main_obj.get_value('pipeline_code')
        if pipe_disp in [None, '', 'twog/proj', 'NOTHINGXsXNOTHING']:
            pipe_disp = "Not Assigned"
            tp_search = Search("twog/title")
            tp_search.add_filter('code', main_obj.get_value('title_code'))
            titl = tp_search.get_sobject()
            title_pipe = titl.get_value('pipeline_code')
            cp_search = Search("twog/client_pipes")
            cp_search.add_filter('process_name', main_obj.get_value('process'))
            cp_search.add_filter('pipeline_code', title_pipe)
            client_pipes = cp_search.get_sobjects()
            if len(client_pipes) > 0:
                client_pipe = client_pipes[0]
                my.server.update(main_obj.get_search_key(), {'pipeline_code': client_pipe.get_value('pipe_to_assign')})
                pipe_disp = client_pipe.get_value('pipe_to_assign')
        my.search_id = main_obj.get_value('id')
        due_date = ''
        task_search = Search("sthpw/task")
        task_search.add_filter('code', main_obj.get_value('task_code'))
        task = task_search.get_sobjects()
        task_sk = ''
        status = ''
        active_status = ''
        if len(task) > 0:
            due_date = task[0].get_value('bid_end_date')
            status = task[0].get_value('status')
            task_sk = task[0].get_search_key()
            active_bool = task[0].get_value('active')
            if active_bool in [True, 'true', 't', 1, '1']:
                active_status = '<font color="#0ff000">Active</font>'
            else:
                active_status = '<font color="#ff0000">Inactive</font>'
        wo_search = Search("twog/work_order")
        wo_search.add_filter('proj_code', my.code)
        wo_search.add_order_by('order_in_pipe')
        wos = wo_search.get_sobjects()
        table = Table()
        table.add_attr('class', 'ProjRow_%s' % my.code)
        table.add_attr('id', main_obj.get_value('code'))
        table.add_attr('cellpadding', '0')
        table.add_attr('cellspacing', '0')
        table.add_style('border-collapse', 'separate')
        table.add_style('border-spacing', '25px 0px')
        table.add_style('color: #1d216a;')
        table.add_style('background-color: %s;' % my.off_color)
        table.add_style('width', '100%')
#.........这里部分代码省略.........
开发者ID:2gDigitalPost,项目名称:custom,代码行数:103,代码来源:proj_row.py

示例13: get_display

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

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

        config_view = my.kwargs.get("config_view")
        display_class = config_view.get_display_handler(element_name)
        display_options = config_view.get_display_options(element_name)
        element_attr = config_view.get_element_attributes(element_name)

        name = element_attr.get('name')
        edit = element_attr.get('edit')
        title = element_attr.get('title')
        width = element_attr.get('width')


        # add the name
        from pyasm.web import Table
        table = Table()
        top.add(table)

        table.add_row()
        td = table.add_cell("Name: ")
        td.add_style("padding: 5px")
        name_text = SpanWdg(name)
        name_text.add_style('font-weight: bold')
        name_text.add_attr("size", "50")
        table.add_cell(name_text)


        table.add_row_cell("<br/>Element Attributes:<br/>")

        # add the title
        table.add_row()
        td = table.add_cell("Title: ")
        td.add_style("padding: 5px")
        title_text = TextWdg("title")
        title_text.add_attr("size", "50")
        if title:
            title_text.set_value(title)
        table.add_cell(title_text)



        # add the width
        table.add_row()
        td = table.add_cell("Width: ")
        td.add_style("padding: 5px")
        width_text = TextWdg("width")
        if width:
            width_text.set_value(width)
        width_text.add_attr("size", "50")
        table.add_cell(width_text)

        # add the editable
        table.add_row()
        td = table.add_cell("Editable: ")
        td.add_style("padding: 5px")
        editable_text = CheckboxWdg("editable")
        editable_text.add_attr("size", "50")
        table.add_cell(editable_text)




        table.add_row_cell("<br/>Display:<br/>")

        # add the widget
        table.add_row()
        td = table.add_cell("Widget: ")
        td.add_style("padding: 5px")
        widget_select = SelectWdg("widget")
        options = ['Expression']
        widget_select.set_option("values", options)
        widget_select.add_empty_option("-- Select --")
        #widget_select.set_value(display_class)
        table.add_cell(widget_select)

        table.add_row_cell("&nbsp;&nbsp;&nbsp;&nbsp;- or -")

        # add the class
        table.add_row()
        td = table.add_cell("Class Name: ")
        td.add_style("padding: 5px")
        class_text = TextWdg("class_name")
        class_text.set_value(display_class)
        class_text.add_attr("size", "50")
        table.add_cell(class_text)


        # introspect the widget
        if not display_class:
            display_class = "pyasm.widget.SimpleTableElementWdg"
        #display_class = "tactic.ui.panel.ViewPanelWdg"

        from pyasm.common import Common
        import_stmt = Common.get_import_from_class_path(display_class)
        if import_stmt:
            exec(import_stmt)
        else:
#.........这里部分代码省略.........
开发者ID:0-T-0,项目名称:TACTIC,代码行数:103,代码来源:element_definition_wdg.py

示例14: handle_widget_mode

# 需要导入模块: from pyasm.widget import TextWdg [as 别名]
# 或者: from pyasm.widget.TextWdg import add_attr [as 别名]
    def handle_widget_mode(my, custom_table, mode):

        tbody = custom_table.add_tbody()
        tbody.add_class("spt_custom_widget")
        if mode != 'widget':
            tbody.add_style('display: none')

        # add the name
        name_text = TextWdg("custom_name")
        name_text.add_class("spt_input")
        custom_table.add_row()
        custom_table.add_cell("Name: ")
        custom_table.add_cell(name_text)

        # add title
        custom_table.add_row()
        title_wdg = TextWdg("custom_title")
        title_wdg.add_attr("size", "50")
        custom_table.add_cell( "Title: " )
        custom_table.add_cell( title_wdg )

        # add description
        custom_table.add_row()
        description_wdg = TextAreaWdg("custom_description")
        custom_table.add_cell( "Description: " )
        custom_table.add_cell( description_wdg )


        # add widget class
        custom_table.add_row()
        class_wdg = TextWdg("custom_class")
        class_wdg.add_attr("size", "50")
        custom_table.add_cell( "Widget Class: " )
        custom_table.add_cell( class_wdg )


        # add options
        custom_table.add_row()
        td = custom_table.add_cell()
        td.add("Options")
        td = custom_table.add_cell()

        div = DivWdg()
        div.set_id("another_list_options")
        div.add_style("display: block")
        div.add_style("margin-top: 10px")
        # TODO: this class should not be in prod!!
        from pyasm.prod.web import SearchTypeSelectWdg

        div.add("Name: ")
        option_name_text = TextWdg("option_name")
        div.add(option_name_text)

        div.add(" &nbsp; ")

        div.add("Value: ")
        option_value_text = TextWdg("option_value")
        div.add(option_value_text)

        td.add(div)
        td.add(div)
        td.add(div)

        custom_table.close_tbody()
开发者ID:0-T-0,项目名称:TACTIC,代码行数:66,代码来源:custom_property_wdg.py

示例15: get_display

# 需要导入模块: from pyasm.widget import TextWdg [as 别名]
# 或者: from pyasm.widget.TextWdg import add_attr [as 别名]
    def get_display(my):
        widget = DivWdg()
        table = Table()
        table.add_attr('class', 'scraper')
        table.add_style('background-color: #FFFFFF;')
        table.add_style('height: 1000px;')
        table.add_row()
        tb = TextWdg('title_box')
        tb.add_attr('id', 'title_box')
        tb.add_attr('size', '45')
        multiple_titles = None
        searched_imdb = False
        orders = []

        # TODO: Remove hard-coded URL
        no_img = 'http://tactic.2gdigital.com/imdb_images/no_image.png'
        if 'code' in my.kwargs.keys() and my.title_of_show in [None, '']:
            server = TacticServerStub.get()
            this_order = server.eval("@SOBJECT(twog/order['code','%s'])" % my.kwargs.get('code'))[0]
            my.title_of_show = this_order.get('name')

        if my.title_of_show not in [None, '']:
            tb.set_value(my.title_of_show)
            if my.search_when_loaded:
                # poster_url_text = my.get_poster_url(my.title_of_show)
                # poster_url = poster_url_text.split('=')[1]
                server = TacticServerStub.get()
                orders = server.eval("@SOBJECT(twog/order['name','~','%s']['classification','not in','Master|Cancelled'])" % my.title_of_show)
                # order_s = Search("twog/order")
                # order_s.add_where("\"name\" like '%s%s%s'" %  ('%', my.title_of_show.lower(), '%'))
                # statement = order_s.get_statement()
                # print "STATEMENT = %s" % statement
                # orders = order_s.get_sobjects()
                # print "ORDER LEN = %s" % len(orders)
                if len(orders) > 0:
                    multiple_titles = get_multiple_title_info(my.title_of_show)
                    # print "MULTIPLE TITLES = %s" % multiple_titles
                    searched_imdb = True
        tb.add_behavior(my.get_search())
        top_tbl = Table()
        top_tbl.add_attr('width', '400px')
        top_tbl.add_attr('height', '50px')
        top_tbl.add_attr('cellpadding', '20')
        top_tbl.add_attr('cellspacing', '20')
        top_tbl.add_style('background-color: #417e97;')
        top_tbl.add_row()

        if len(orders) > 0:
            butt = top_tbl.add_cell('<input type="button" value="Associate All Selected"/>')
            butt.add_behavior(my.get_associate_em())

        sn = top_tbl.add_cell('<font color="#d9af1f"><b>Search Name:</b></font>&nbsp;&nbsp;&nbsp;&nbsp;')
        sn.add_attr('align', 'right')
        sn.add_attr('nowrap', 'nowrap')
        tb_cell1 = top_tbl.add_cell(tb)
        tb_cell = table.add_cell(top_tbl)
        tb_cell.add_attr('colspan', '2')
        tb_cell.add_attr('align', 'center')
        order_table = Table()
        order_table.add_attr('border', '1')
        order_table.add_attr('cellpadding', '10')
        order_table.add_row()

        if len(orders) > 0:
            toggler = CustomCheckboxWdg(name='chk_toggler', additional_js=my.get_toggler(), value_field='toggler',
                                        id='selection_toggler', checked='false', text='<b><- Select/Deselect ALL</b>',
                                        text_spot='right', text_align='left', nowrap='nowrap')
            order_table.add_cell(toggler)
            order_table.add_row()
            order_table.add_cell('Selector')
            order_table.add_cell('Poster')
            order_table.add_cell('Order Builder')
            order_table.add_cell('Code')
            order_table.add_cell('Name')
            order_table.add_cell('Client')
            order_table.add_cell('PO Number')
            order_table.add_cell('Classification')
            order_table.add_cell('Platform')
            order_table.add_cell('Due Date')
            order_table.add_cell('Completion Ratio')
            order_table.add_cell('Scheduler')
        elif my.title_of_show not in [None, ''] and my.search_when_loaded:
            description_box = order_table.add_cell('<b>No Tactic Orders Were Found With "%s" In The Name</b>' % my.title_of_show)
            description_box.add_style('font-size: 14px;')
        else:
            description_box = order_table.add_cell('<b>Please type the name of the show in the box above</b>')
            description_box.add_style('font-size: 14px;')
        for order in orders:
            checkbox = CustomCheckboxWdg(name='associate_order_%s' % order.get('code'),
                                         additional_js=my.highlight_order_row(order.get('code')),
                                         alert_name=order.get('name'),
                                         value_field=order.get('code'),
                                         checked='false',
                                         dom_class='associated_orders')
            imarow = order_table.add_row()
            imarow.add_attr('id', 'row_%s' % order.get('code'))
            chk = order_table.add_cell(checkbox)
            chk.add_attr('align', 'center')
            poster_cell = order_table.add_cell(OrderImageWdg(code=order.get('code')))
            poster_cell.add_attr('id', 'img_%s' % order.get('code'))
#.........这里部分代码省略.........
开发者ID:2gDigitalPost,项目名称:custom,代码行数:103,代码来源:order_associator.py


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