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


Python SpanWdg.add_color方法代码示例

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


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

示例1: get_related_wdg

# 需要导入模块: from pyasm.web import SpanWdg [as 别名]
# 或者: from pyasm.web.SpanWdg import add_color [as 别名]
    def get_related_wdg(my, aliases):
        div = DivWdg()
        div.add("<b>Related links</b>: &nbsp;&nbsp")
        div.add_style("margin-top: 5px")
        div.add_style("margin-bottom: 5px")
        div.add_style("margin-left: 10px")

        titles = [Common.get_display_title(x.replace("-"," ")) for x in aliases]
        for alias, title in zip(aliases, titles):

            link_div = SpanWdg()
            div.add(link_div)
            link_div.add_color("background", "background")
            link_div.add(title)
            link_div.add_behavior( {
                'type': 'click_up',
                'cbjs_action': '''
                spt.help.set_top();
                spt.help.load_alias("%s");
                ''' % alias
            } )
            link_div.add_class("spt_link")
            link_div.add_class("hand")

        return div
开发者ID:2gDigitalPost,项目名称:tactic_src,代码行数:27,代码来源:help_wdg.py

示例2: set_text_link

# 需要导入模块: from pyasm.web import SpanWdg [as 别名]
# 或者: from pyasm.web.SpanWdg import add_color [as 别名]
    def set_text_link(self, widget, div, image_link):
        '''override how the text link is drawn'''
        div.add_style('float', 'left')
        div.add_style('margin-left', '10px')
        filename = os.path.basename(image_link)
        if len(filename) > 40:
            filename = "%s..." % (filename[0:40])

        span = SpanWdg(css='med')
        #href = HtmlElement.href(filename, image_link)
        href = SpanWdg(filename)
        href.add_color("color", "color")
        span.add(href)
        widget.add(span)
        span.add_tip('Right-click and choose [Save Link As..] to save to disk.')
开发者ID:mincau,项目名称:TACTIC,代码行数:17,代码来源:dependency_wdg.py

示例3: SpanWdg

# 需要导入模块: from pyasm.web import SpanWdg [as 别名]
# 或者: from pyasm.web.SpanWdg import add_color [as 别名]
            target = xml.get_attribute(node, "target")
            if target:
                target = xml.set_attribute(node, "href", "/doc/%s" % link_rel_path)
                continue

            # get a unique id for the node
            unique_id = my.top.generate_unique_id(base='replace')
            xml.set_attribute(node, "id", unique_id)

            div = SpanWdg()
            elements.append(div)
            div.add_class("spt_replace_element")
            div.add_attr("spt_replace_id", unique_id)
            div.add_class("hand")
            div.add_class("spt_link")
            div.add_color("background", "background")

            text = xml.get_node_value(node)
            div.add(text)
            div.add_behavior( {
                'type': 'click_up',
                'rel_path': link_rel_path,
                'cbjs_action': '''
                spt.help.set_top();
                spt.help.load_rel_path( bvr.rel_path );
                '''
            } )


        # dummy div to get color
        div = DivWdg()
开发者ID:2gDigitalPost,项目名称:tactic_src,代码行数:33,代码来源:help_wdg.py

示例4: get_upload_wdg

# 需要导入模块: from pyasm.web import SpanWdg [as 别名]
# 或者: from pyasm.web.SpanWdg import add_color [as 别名]
    def get_upload_wdg(my):
        '''get search type select and upload wdg'''
        widget = DivWdg(css='spt_import_csv')
        widget.add_color('color','color')
        widget.add_color('background','background')
        widget.add_style('width: 600px')

        # get the search type
        title = DivWdg("<b>Select sType to import data into:</b>&nbsp;&nbsp;")
        widget.add( title )
        title.add_style("float: left")

        # handle new search_types
        new_search_type = CheckboxWdg("new_search_type_checkbox")
        new_search_type.add_event("onclick", "toggle_display('new_search_type_div')")
        #span = SpanWdg(css="med")
        #span.add(new_search_type)
        #span.add("Create new type")
        #span.add(" ... or ... ")
        #widget.add(span)

        new_search_type_div = DivWdg()
        new_search_type_div.set_id("new_search_type_div")

        name_input = TextWdg("asset_name")
        title = TextWdg("asset_title")
        description = TextAreaWdg("asset_description")

        
 
        key='csv_import'
        table = Table()
        table.set_id('csv_main_body')
        table.add_style("margin: 10px 10px")
        table.add_col().set_attr('width','140')
        table.add_col().set_attr('width','400')
        
        table.add_row()
        table.add_header("Search Type: ").set_attr('align','left')
        table.add_cell(name_input)
        table.add_row()
        table.add_header("Title: ").set_attr('align','left')
        table.add_cell(title)
        table.add_row()
        table.add_header("Description: ").set_attr('align','left')
        table.add_cell(description)
        new_search_type_div.add(table)
        new_search_type_div.add_style("display: none")
        #widget.add(new_search_type_div)

        div = DivWdg()

       
        search_type_select = SearchTypeSelectWdg("search_type_filter", mode=SearchTypeSelectWdg.ALL)
        search_type_select.add_empty_option("-- Select --")
        if not search_type_select.get_value():
            search_type_select.set_value(my.search_type)
        search_type_select.set_persist_on_submit()
       

        div.add(search_type_select)

        widget.add(div)

        search_type_select.add_behavior( {'type': 'change', \
                                  'cbjs_action': "spt.panel.load('csv_import_main','%s', {}, {\
                                    'search_type_filter': bvr.src_el.value});" %(Common.get_full_class_name(my)) } )

        if my.search_type:
            sobj = None
            try:
                sobj = SObjectFactory.create(my.search_type)
            except ImportError:
                widget.add(HtmlElement.br())
                widget.add(SpanWdg('WARNING: Import Error encountered. Please choose another search type.', css='warning')) 
                return widget

            required_columns = sobj.get_required_columns()
           
            if required_columns:
                widget.add(HtmlElement.br())
                req_span = SpanWdg("Required Columns: ", css='med')
                req_span.add_color('color','color')
                widget.add(req_span)
                #required_columns = ['n/a']
                req_span.add(', '.join(required_columns))

            widget.add( HtmlElement.br() )



            if my.file_path:
                hidden = HiddenWdg("file_path", my.file_path)
                widget.add(hidden)
                
                if my.web_url:
                    file_span = FloatDivWdg('URL: <i>%s</i>&nbsp;&nbsp;&nbsp;' %my.web_url, css='med')
                else:
                    file_span = FloatDivWdg('File uploaded: <i>%s</i>&nbsp;&nbsp;&nbsp;' %os.path.basename(my.file_path), css='med')
                file_span.add_color('color','color')
#.........这里部分代码省略.........
开发者ID:davidsouthpaw,项目名称:TACTIC,代码行数:103,代码来源:data_export_wdg.py

示例5: get_display

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

        config_search_type = "config/widget_config"
         
        configs = []
	all_element_names = []
        from tactic.ui.panel import SideBarBookmarkMenuWdg
        SideBarBookmarkMenuWdg.add_internal_config(configs, ['definition'])
        for internal_config in configs:
            all_element_names = internal_config.get_element_names()

	search = Search(config_search_type)
        search.add_filter("search_type", 'SideBarWdg')
        search.add_filter("view", 'definition')
        search.add_filter("login", None)

        config = search.get_sobject()
        element_names = []
        if config:
            element_names = config.get_element_names()
            for name in element_names:
                if 'separator' in name:
                    element_names.remove(name)

	all_element_names.extend(element_names)

	
        all_element_names = [str(name) for name in all_element_names] 
	all_element_names = Common.get_unique_list(all_element_names)
        widget = DivWdg(css='spt_load_test_top')
	
	span =SpanWdg('This loads all the pages defined in the Project views in popups. It will take a few minutes.')
	widget.add(span)
	widget.add('<br/>')
        div = ActionButtonWdg(title='Run')
        web = WebContainer.get_web()
        base_url = web.get_base_url().to_string()
        base_url = '%s/tactic/%s' %(base_url, Project.get_project_code())
        div.add_behavior({'type': 'click_up',
           'cbjs_action': '''
            var element_names = eval(%s);
            var all_element_names = eval(%s);
            var top = spt.get_parent(bvr.src_el, '.spt_load_test_top');
            var cb = spt.get_element(top, '.spt_input')
            if (cb.checked)
                element_list = all_element_names;
            else
                element_list = element_names
            for (var k=0; k < element_list.length; k++) {
                var name = element_list[k];
		//if (k > 3) break;

                var url = '%s/#/link/' + name;
		var bvr2 = {
                    title: name,
                    target_id: 'TEST',
                    options: {'link': name,
                    'title': name,
		    'path': '/Link Test/' + name
			},
                    is_popup: true};

                spt.side_bar.display_link_cbk(null, bvr2);

            }
            ''' %(element_names, all_element_names, base_url)})
        widget.add('<br/>')
        
        cb = CheckboxWdg('include_internal', label='include built-in pages')
        
        span = SpanWdg(cb, css='med')
        span.add_color('color','color')
        widget.add(span)
        widget.add(div)

        widget.add('<br/>')
        widget.add('<br/>')
	
        return widget
开发者ID:mincau,项目名称:TACTIC,代码行数:81,代码来源:system_info_wdg.py

示例6: _handle_files

# 需要导入模块: from pyasm.web import SpanWdg [as 别名]
# 或者: from pyasm.web.SpanWdg import add_color [as 别名]
    def _handle_files(self, snapshot, widget, upstream, recursive=True):

        web_dir = snapshot.get_web_dir()
        xml = snapshot.get_xml_value("snapshot")

        # handle files
        files = xml.get_nodes("snapshot/file")
        for file in files:
            
            file_code = Xml.get_attribute(file, "file_code")
            file_type = Xml.get_attribute(file, "type")
            file_range = Xml.get_attribute(file, "file_range")
            #file_range = "1-4/1"

            dir = snapshot.get_client_lib_dir(file_type=file_type)
            lib_dir = snapshot.get_lib_dir(file_type=file_type)
            open_button = IconButtonWdg( "Explore: %s" % dir, IconWdg.LOAD, False)
            if dir == lib_dir:
                open_button.add_behavior({'type':'click_up', 'cbjs_action': '''var applet = spt.Applet.get();
                                       
                                            spt.alert('You are not allowed to browse directories on a web server.');
                                    '''})
            else:
                open_button.add_behavior({'type':'click_up', 
                                        'dir' : dir,
                                        'cbjs_action': '''
                                        var applet = spt.Applet.get();
                                        
                                        var dir = bvr.dir;
                                      
                                        applet.open_explorer(dir);'''})
            open_button.add_class('small')
            open_button.add_style('float: left')
            widget.add(open_button)

            if file_range:
                file_name = Xml.get_attribute(file, "name")
                widget.add("%s [code = %s, type = %s]" % (file_name, file_code, file_type))
                widget.add(HtmlElement.br(2))

                # display all of the paths
                file_names = FileGroup.expand_paths( file_name, FileRange.get(file_range) )
                for file_name in file_names:
                    #link = HtmlElement.href(file_name, "%s/%s" % (web_dir, file_name), target="_blank" )
                    link = SpanWdg(file_name)
                    link.add_color("color", "color")
                    widget.add(link)
                    widget.add(HtmlElement.br())

            else:
                thumb = DependencyThumbWdg()
                thumb.set_show_filename(True)
                thumb.set_sobject(snapshot)
                thumb.set_icon_size(15)
                thumb.set_image_link_order([file_type])
                thumb.set_option('detail', 'false')

                widget.add(SpanWdg(thumb, css='small'))
                widget.add("[code = %s, type = %s]" % ( file_code, file_type))

            widget.add(HtmlElement.br())
            

            block = DivWdg()
            block.add_style("margin-left: 30px")
            block.add_style("margin-top: 10px")
            nodes = xml.get_nodes("snapshot/file[@file_code='%s']/ref" % file_code)
            widget.add(HtmlElement.br(clear="all"))
            # handle sub refs
            for node in nodes:
                self._handle_ref_node(node, block, upstream, recursive)
                block.add(HtmlElement.br())
            if nodes:
                widget.add(block)

            widget.add(HtmlElement.br())



        files = xml.get_nodes("snapshot/unknown_ref")
        if files:
            widget.add(HtmlElement.b("Unknown ref."))
        for file in files:
            block = DivWdg()
            block.add_style("margin-left: 30px")
            block.add_style("margin-top: 10px")

            block.add( IconWdg( "Unknown", IconWdg.UNKNOWN) )

            path = Xml.get_attribute(file, "path")
            block.add(path)
            widget.add(block)
开发者ID:mincau,项目名称:TACTIC,代码行数:94,代码来源:dependency_wdg.py

示例7: get_display

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

        #WebContainer.register_cmd("pyasm.admin.UndoLogCbk")

        # add a time filter
        div = DivWdg()
        div.add_color('background','background', -10)
        div.add_color('color','color')
        div.add_style("padding: 15px")
        div.add_border()
        project = ''
        # add a project filter
        if self.all_namespaces_flag:
            span = SpanWdg("Project: ")
            span.add_color('color','color')
            project_select = FilterSelectWdg("project")
            project_select.add_empty_option(label="-- All Projects --")
            project_select.set_option("query", "sthpw/project|code|title")
            span.add(project_select)
            div.add(span)

            project = project_select.get_value()
        else:
            from pyasm.biz import Project
            project = Project.get_global_project_code()


        # add a time filter
        from pyasm.prod.web import DateFilterWdg
        select = DateFilterWdg("undo_time_filter", label="Show Transaction Log From: ")
        select.set_label(["1 Hour Ago", "Today", "1 Day Ago", "1 Week Ago", "1 Month Ago"])
        select.set_value(["1 Hour", "today", "1 Day", "1 Week", "1 Month"])
        select.set_option("default", "1 Hour")
        div.add(select)

        time_interval = select.get_value() 

        self.add(div)

        if not self.all_users_flag:
            user = Environment.get_user_name()
        else:
            span = SpanWdg(css="med")
            span.add("User: ")
            user_select = FilterSelectWdg("user")
            user_select.set_option("query", "sthpw/login|login|login")
            user_select.add_empty_option()
            span.add(user_select)
            div.add(span)

            user = user_select.get_value()

        transaction_log = TransactionLog.get( user_name=user, \
            namespace=project, time_interval=time_interval)

        from tactic.ui.panel import FastTableLayoutWdg, TableLayoutWdg
        table = FastTableLayoutWdg(search_type="sthpw/transaction_log", view="table", show_shelf='false', show_select="false")
        #table = TableLayoutWdg(search_type="sthpw/transaction_log", view="table", mode='simple', show_row_select="false")
        table.set_sobjects(transaction_log)
        #table.set_refresh_mode("table")
        self.add(table)

        return super(UndoLogWdg, self).get_display()
开发者ID:mincau,项目名称:TACTIC,代码行数:65,代码来源:undo_log_wdg.py

示例8: get_viewer

# 需要导入模块: from pyasm.web import SpanWdg [as 别名]
# 或者: from pyasm.web.SpanWdg import add_color [as 别名]
    def get_viewer(self):
        top = DivWdg(css='spt_single_note_viewer_top')
            
        # draw checkbox options
        swap = SwapDisplayWdg()
        title = SpanWdg('context')
        title.add_color('color','color')
        div = DivWdg(css='spt_context_cb')
        div.add_color('color','color')
        SwapDisplayWdg.create_swap_title(title, swap, div, is_open=False)
        
        checkbox_name = 'split_screen'
        checked_process_names = []
        if self.show_context:
            top.add(swap)
            top.add(title)
            top.add(div)
            
            #checkbox_name = 'note_context_cb'
            checkbox_name = self.checkbox_name
            cb = CheckboxWdg(checkbox_name)
            cb.persistence = True
            cb.persistence_obj = cb

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

                cb.add_behavior({
                    'type': 'click_up',
                    'propagate_evt': True,
                    'cbjs_action': '''
                        var top = bvr.src_el.getParent(".spt_single_note_viewer_top")
                        var table_top = top.getElement('.spt_note_viewer_table');
                        var cbs = top.getElement('.spt_context_cb');
                        var values = spt.api.Utility.get_input_values(cbs);
                        var processes = values.%s;
                        var kwargs = { process_names: processes};
                        spt.input.save_selected(bvr, '%s','%s');
                        spt.panel.refresh(table_top, kwargs, false);
                    ''' % (checkbox_name, checkbox_name, key)
                }) 
                div.add(cb)
        else:
            web = WebContainer.get_web()
            checked_process_names = web.get_form_values('process_names')
        table_top = DivWdg(css='spt_note_viewer_table')
        expression = "@SOBJECT(sthpw/note['context','in','%s'])" %'|'.join(checked_process_names)
        table_id = 'main_table1'
    
        table = TableLayoutWdg(table_id=table_id, search_type='sthpw/note', view=self.view,\
             show_row_select=True, show_insert=False, state={'parent_key': self.parent_key}, inline_search=False, show_refresh=True, expression=expression )
	if self.resize:
	    from tactic.ui.container import ResizeScrollWdg
	    inner_wdg = ResizeScrollWdg( width='500px', height='500px', scroll_bar_size_str='thick', scroll_expansion='inside' )
	    inner_wdg.add(table)
            table_top.add(inner_wdg)
	else:
            table_top.add(table)

        self.set_as_panel(table_top)
        top.add(table_top)

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


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