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


Python SelectWdg.get_value方法代码示例

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


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

示例1: get_display

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

        widget = Widget()

        div = DivWdg(css="filter_box")

        show_span = SpanWdg(css="med")
        show_span.add("Show All Types: ")
        checkbox = FilterCheckboxWdg("show_all_types")
        checkbox.set_persistence()
        show_span.add(checkbox)
        show_all_types = checkbox.get_value()
        div.add(show_span)

        span = SpanWdg(css="med")
        span.add("Search Type: ")

        select = SelectWdg("filter|search_type")
        select.add_empty_option("-- Select --")
        project = Project.get()
        project_type = project.get_base_type()
        search = Search("sthpw/search_object")
        if show_all_types:
            search.add_where(
                """
            namespace = '%s' or namespace = '%s' or search_type in ('sthpw/task')
            """
                % (project_type, project.get_code())
            )
        else:
            # show only the custom ones
            search.add_filter("namespace", project.get_code())

        search.add_order_by("title")
        sobjects = search.get_sobjects()

        select.set_sobjects_for_options(sobjects, "search_type", "title")
        # select.set_option("query", "sthpw/search_object|search_type|title")
        select.set_persistence()
        select.add_event("onchange", "document.form.submit()")
        search_type = select.get_value()
        span.add(select)
        div.add(span)

        # make sure the current selection exists
        try:
            SearchType.get(search_type)
        except SearchException, e:
            return div
开发者ID:hellios78,项目名称:TACTIC,代码行数:51,代码来源:custom_view_app_wdg.py

示例2: get_display

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

        web = WebContainer.get_web()
        naming_util = NamingUtil()

        if not my.widget_name:
            my.widget_name = my.get_name()

        # get the sobject required by this input
        sobject = my.get_current_sobject()
        if not sobject:
            sobject = Search.get_by_id(my.search_type, my.search_id)

        if my.new_sample_name:
            my.new_sample_name.replace("//", "/")
        else:
            my.new_sample_name = sobject.get_value(my.widget_name)

        widget = DivWdg()
        widget.set_id("naming")
        widget.add_style("display: block")

        # set the sample text
        div = DivWdg()
        div.add("Sample name: <i>%s</i>" % my.new_sample_name)
        div.add(HtmlElement.br(2))

        new_sample_wdg = ProdIconButtonWdg("Set New Sample")
        new_sample_wdg.add_event("onclick", "toggle_display('generate')")
        div.add(new_sample_wdg)

        generate = DivWdg()
        generate.add(HtmlElement.br())
        generate.set_id("generate")
        generate.add_style("display: none")
        sample_text = TextWdg("new_sample_name")
        sample_text.set_option("size", "30")
        # sample_text.set_persist_on_submit()
        # if my.new_sample_name:
        #    sample_text.set_value(my.new_sample_name)
        generate.add(sample_text)

        button = IconButtonWdg("Generate", IconWdg.REFRESH, long=True)
        on_script = my.setup_ajax("naming")
        button.add_event("onclick", on_script)
        generate.add(button)
        generate.add(HtmlElement.br(2))

        div.add(generate)
        widget.add(div)

        hidden = TextWdg(my.widget_name)
        value = my.naming
        hidden.set_value(my.new_sample_name)
        widget.add(my.widget_name)
        widget.add(hidden)

        # get all of the parts

        # TODO: not sure if this should be dictated by the sample name
        # break up the name into parts
        import re

        if my.new_sample_name:
            tmp = my.new_sample_name.strip("/")
            parts = re.split("[\\/._]", tmp)
            print "parts: ", parts
        else:
            return widget

        # if there is a naming, then populate that
        if my.edit_search_type:
            options = naming_util.get_options(my.edit_search_type)
        else:
            options = naming_util.get_options(sobject.get_value("search_type"))

        table = Table()
        type_values = []
        padding_values = []
        for idx, part in enumerate(parts):
            table.add_row()
            table.add_cell(part)

            type_select = SelectWdg("type_%s" % idx)
            type_select.add_empty_option("-- Explicit --")
            type_select.set_persist_on_submit()
            type_select.set_option("values", "|".join(options))
            type_values.append(type_select.get_value())
            td = table.add_cell(type_select)

        widget.add(table)

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

示例3: get_display

# 需要导入模块: from pyasm.widget import SelectWdg [as 别名]
# 或者: from pyasm.widget.SelectWdg import get_value [as 别名]
    def get_display(self):
        self.check()
        if self.is_refresh:
            div = Widget()
        else:
            div = DivWdg()
            self.set_as_panel(div)
            div.add_style('padding','6px')
            min_width = '400px'
            div.add_style('min-width', min_width)
            div.add_color('background','background')
            div.add_class('spt_add_task_panel')
            div.add_style("padding: 20px")


        from tactic.ui.app import HelpButtonWdg
        help_button = HelpButtonWdg(alias="creating-tasks")
        div.add(help_button)
        help_button.add_style("float: right")
        help_button.add_style("margin-top: -5px")

        if not self.search_key_list:
            msg_div = DivWdg()
            msg_table = Table()
            msg_div.add(msg_table)
            msg_table.add_row()
            msg_table.add_cell( IconWdg("No items selected", IconWdg.WARNING) )
            msg_table.add_cell('Please select at least 1 item to add tasks to.')

            msg_div.add_style('margin: 10px')
            msg_table.add_style("font-weight: bold")
            div.add(msg_div)
            return div

        msg_div = DivWdg()
        msg_div.add_style('margin-left: 4px')
        div.add(msg_div, 'info')
        msg_div.add('Total: %s item/s to add tasks to' %len(self.search_key_list))
        div.add(HtmlElement.br())
        hint = HintWdg('Tasks are added according to the assigned pipeline.')
        msg_div.add(" &nbsp; ")
        msg_div.add(hint)
        msg_div.add(HtmlElement.br())
        
        
        option_div = DivWdg(css='spt_ui_options')
        #option_div.add_style('margin-left: 12px')
        
        sel = SelectWdg('pipeline_mode', label='Create tasks by: ')
        sel.set_option('values', ['simple process','context', 'standard'])
        sel.set_option('labels', ['process','context', 'all contexts in process'])
        sel.set_persistence()
        sel.add_behavior({'type':'change',
                 'cbjs_action': 'spt.panel.refresh(bvr.src_el)'}) 
        
        option_div.add(sel)

        value = sel.get_value()
        # default to simple process
        if not value:
            value = 'simple process'
        msg = ''
        if value not in ['simple process','context','standard']:
            value = 'simple process'
        
        if value == 'context':
            msg = 'In context mode, a single task will be created for each selected context.'
        elif value == 'simple process':
            msg = 'In process mode, a single task will be created for each selected process.'

        elif value == 'standard':
            msg = 'In this mode, a task will be created for all contexts of each selected process.'

        option_div.add(HintWdg(msg))
        div.add(option_div)
        div.add(HtmlElement.br())

        title = DivWdg('Assigned Pipelines')
        title.add_style('padding: 6px')
        title.add_color('background','background2')
        title.add_color('color','color', +120)
        div.add(title)
    
        content_div = DivWdg()
        content_div.add_style('min-height', '150px')
        div.add(content_div)
        content_div.add_border()
        
        filtered_search_key_list = []
        for sk in self.search_key_list:
            id = SearchKey.extract_id(sk)
            if id=='-1':
                continue
            filtered_search_key_list.append(sk)

        sobjects = SearchKey.get_by_search_keys(filtered_search_key_list)
        skipped = []
        pipeline_codes = []
        for sobject in sobjects:
            if isinstance(sobject, Task):
#.........这里部分代码省略.........
开发者ID:mincau,项目名称:TACTIC,代码行数:103,代码来源:task_wdg.py

示例4: get_display

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

        # add the detail widget
        detail_wdg = DivWdg(css='spt_detail_panel')
        if not self.name_string and not self.config_string:
            detail_wdg.add("<br/>"*3)
            detail_wdg.add('<- Click on an item on the left for modification.')
            detail_wdg.add_style("padding: 10px")
            detail_wdg.add_color("background", "background", -5)
            detail_wdg.add_style("width: 350px")
            detail_wdg.add_style("height: 400px")
            detail_wdg.add_border()

            return detail_wdg

        if self.kwargs.get("mode") == "empty":
            overlay = DivWdg()
            detail_wdg.add(overlay)

        detail_wdg.add_border()
        detail_wdg.add_color("color", "black")
        detail_wdg.add_style("padding: 10px")
        detail_wdg.add_color("background", "background", -5)

        detail_wdg.set_id('search_type_detail')

        # put in the selection for simple or advanced
        select = SelectWdg("config_mode", label='Mode: ')
        select.set_persistence()
        values = ['simple', 'advanced']
        select.set_option("values", values)
        config_mode = select.get_value()
        #select.add_behavior({"type": "change", "cbjs_action": "spt.simple_display_toggle( spt.get_cousin(bvr.src_el, '.spt_detail_panel','.config_simple') )"})
        select.add_behavior({"type": "change", "cbjs_action": \
            "spt.simple_display_toggle( spt.get_cousin(bvr.src_el, '.spt_detail_panel','.config_advanced')); %s" %select.get_save_script()})

        select.add_class('spt_config_mode')

        title_div = DivWdg("Column Detail")
        title_div.add_class("maq_search_bar")
        detail_wdg.add(title_div)
        detail_wdg.add("<br/>")
        detail_wdg.add(select)
        detail_wdg.add(HtmlElement.br(2))

        #simple_mode_wdg = WidgetDetailSimpleModeWdg()
        #detail_wdg.add(simple_mode_wdg)
        #detail_wdg.add(HtmlElement.br(2))

        if self.is_new_column:
            detail_wdg.add( self.get_new_definition_wdg() )
        else:
            
            simple_wdg = self.get_simple_definition_wdg()
           
            simple_wdg.add_class("config_simple")
            detail_wdg.add( simple_wdg )
            adv_wdg = self.get_advanced_definition_wdg()
            adv_wdg.add_class("config_advanced")
            if config_mode == 'simple':
                adv_wdg.add_style('display: none')
            detail_wdg.add(HtmlElement.br(2))
            detail_wdg.add( adv_wdg )

        detail_wdg.add(HtmlElement.br(2))


        security_wdg = self.get_security_wdg()
        detail_wdg.add(security_wdg)


        # add hidden input for view for panel refreshing
        # we are only interested in whether it is project_view or definition
        # sub-views of project_view is not of our interest

        #if self.view != 'project_view':
        #    self.view = 'custom_definition'
        detail_wdg.add(HiddenWdg('view', self.view))


        return detail_wdg
开发者ID:mincau,项目名称:TACTIC,代码行数:83,代码来源:search_type_manager_wdg.py

示例5: init

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

        search = Search("sthpw/queue")
        search.add_order_by("priority desc")
        search.add_order_by("timestamp desc")

        widget = Widget()

        div = DivWdg(css="filter_box")

        span = SpanWdg(css="med")

        from pyasm.prod.web import SearchFilterWdg

        search_filter = SearchFilterWdg(columns=Queue.get_search_columns())
        search_filter.alter_search(search)
        span.add(search_filter)
        div.add(span)

        span = SpanWdg(css="med")
        priority_wdg = TextWdg("priority_search")
        priority_wdg.set_persistence()
        priority = priority_wdg.get_value()
        if priority:
            search.add_filter("priority", priority)
        span.add("Priority: ")
        span.add(priority_wdg)
        div.add(span)

        select = SelectWdg("queue_state")
        select.set_option("values", "|pending|locked|error|done")
        select.set_option("labels", "All|pending|locked|error|done")
        select.add_event("onchange", "document.form.submit()")
        select.set_persistence()

        span = SpanWdg(css="med")
        span.add("State: ")
        span.add(select)
        div.add(span)
        queue_state = select.get_value()
        if queue_state != "":
            search.add_filter("state", queue_state)

        user_select = SelectWdg("user_select")
        user_select.add_empty_option()

        user_search = Search("sthpw/login")
        user_select.set_search_for_options(user_search, "login", "login")
        user_select.add_event("onchange", "document.form.submit()")
        user_select.set_persistence()

        div.add("User: ")
        div.add(user_select)
        queue_user = user_select.get_value()
        if queue_user != "":
            search.add_filter("login", queue_user)

        search_limit = SearchLimitWdg()
        search_limit.set_limit(10)
        div.add(search_limit)
        search_limit.alter_search(search)

        widget.add(div)

        sobjects = search.get_sobjects()

        table = TableWdg("sthpw/queue")
        table.set_sobjects(sobjects)
        widget.add(table)

        my.add(widget)
开发者ID:pombredanne,项目名称:TACTIC,代码行数:73,代码来源:queue_wdg.py

示例6: get_display

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

        div = DivWdg()
        div.add_style("padding: 10px 0px 10px 0px")

        behavior = {"type": "keyboard", "kbd_handler_name": "DgTableMultiLineTextEdit"}
        div.add_behavior(behavior)

        project_code = None
        sobject = my.get_current_sobject()
        if sobject:
            project_code = sobject.get_project_code()
        project_filter = Project.get_project_filter(project_code)

        query_filter = my.get_option("query_filter")
        if not query_filter:
            # try getting it from the search_type
            web = WebContainer.get_web()
            search_type = web.get_form_value("search_type")
            if search_type:
                search_type_obj = SearchType.get(search_type)
                base_search_type = search_type_obj.get_base_search_type()
                query_filter = "search_type = '%s'" % base_search_type

        # add the project filter
        if query_filter:
            query_filter = "%s and %s" % (query_filter, project_filter)
        else:
            query_filter = project_filter

        my.set_option("query_filter", query_filter)

        select = SelectWdg()
        select.add_empty_option("-- Select --")
        select.copy(my)

        select.add_event("onchange", "alert('cow')")
        div.add(select)

        span = SpanWdg(css="med")
        span.add("Add Initial Tasks: ")
        checkbox = CheckboxWdg("add_initial_tasks")
        checkbox.set_persistence()
        if checkbox.is_checked(False):
            checkbox.set_checked()
        span.add(checkbox)
        div.add(span)

        # list all of the processes with checkboxes
        pipeline_code = select.get_value()
        if pipeline_code:
            pipeline = Pipeline.get_by_code(pipeline_code)
            if not pipeline:
                print "WARNING: pipeline '%s' does not exist" % pipeline_code
                return
            process_names = pipeline.get_process_names(recurse=True)

            process_div = DivWdg()
            for process in process_names:
                checkbox = CheckboxWdg("add_initial_tasks")
                process_div.add(checkbox)
                process_div.add("&nbsp;")
                process_div.add(process)
                process_div.add(HtmlElement.br())
            div.add(process_div)

        return div
开发者ID:hellios78,项目名称:TACTIC,代码行数:69,代码来源:asset_task_creator_wdg.py

示例7: Search

# 需要导入模块: from pyasm.widget import SelectWdg [as 别名]
# 或者: from pyasm.widget.SelectWdg import get_value [as 别名]
        div.add(HtmlElement.br(2))

        div.add(my.get_new_tab_wdg())

        widget.add(div)

        search = Search("sthpw/widget_config")
        # search.add_user_filter()
        search.add_filter("search_type", search_type)
        search.add_where("view != 'definition' and view != 'custom'")
        # search.add_column("view")
        widget_configs = search.get_sobjects()
        if widget_configs:
            view_select.set_sobjects_for_options(widget_configs, "view", "view")
        view = view_select.get_value()
        if not view:
            view = "custom"
            # return widget

        # get the selected widget config
        for widget_config in widget_configs:
            if widget_config.get_value("view") == view:
                break
        else:
            return widget

        # get the handler: a little HACKY.
        config_xml = widget_config.get_xml_value("config")
        handler = config_xml.get_value("config/%s/@handler" % view)
开发者ID:hellios78,项目名称:TACTIC,代码行数:31,代码来源:custom_view_app_wdg.py

示例8: get_first_row_wdg

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

示例9: get_display

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

        widget = Widget()

        div = DivWdg(css="filter_box")

        show_span = SpanWdg(css='med')
        show_span.add('Show All Types: ')
        checkbox = FilterCheckboxWdg('show_all_types')
        checkbox.set_persistence()
        show_span.add(checkbox)
        show_all_types = checkbox.get_value()
        div.add(show_span)


        span = SpanWdg(css="med")
        span.add("Search Type: ")

        select = SelectWdg("filter|search_type")
        select.add_empty_option("-- Select --")
        project = Project.get()
        project_type = project.get_base_type()
        search = Search("sthpw/search_object")
        if show_all_types:
            search.add_where('''
            namespace = '%s' or namespace = '%s' or search_type in ('sthpw/task')
            ''' % (project_type, project.get_code()) )
        else:
            # show only the custom ones
            search.add_filter('namespace', project.get_code() )

        search.add_order_by("title")
        sobjects = search.get_sobjects()

        select.set_sobjects_for_options(sobjects,"search_type", "title")
        #select.set_option("query", "sthpw/search_object|search_type|title")
        select.set_persistence()
        select.add_event("onchange", "document.form.submit()")
        search_type = select.get_value()
        span.add(select)
        div.add(span)


        # make sure the current selection exists
        try:
            SearchType.get(search_type)
        except SearchException as e:
            return div
        except SqlException as e:
            return div


        # add the view selector
        view_select = SelectWdg("view")
        view_select.add_empty_option("-- View --")
        view_select.add_event("onchange", "document.form.submit()")
        view_select.set_persist_on_submit()
        #view_select.set_persistence()
        span = SpanWdg(css="med")
        span.add("Defined Views: ")
        span.add(view_select)
        div.add(span)

        div.add( self.get_create_view_wdg(search_type))

        div.add( HtmlElement.br(2) )


        div.add( self.get_new_tab_wdg() )


        widget.add(div)

        search = Search("sthpw/widget_config")
        #search.add_user_filter()
        search.add_filter("search_type", search_type)
        search.add_where("view != 'definition' and view != 'custom'")
        #search.add_column("view")
        widget_configs = search.get_sobjects()
        if widget_configs:
            view_select.set_sobjects_for_options(widget_configs,"view","view")
        view = view_select.get_value()
        if not view:
            view = "custom"
            #return widget

        # get the selected widget config
        for widget_config in widget_configs:
            if widget_config.get_value("view") == view:
                break
        else:
            return widget

        # get the handler: a little HACKY.
        config_xml = widget_config.get_xml_value("config")
        handler = config_xml.get_value("config/%s/@handler" % view)

        if not search_type:
            return widget

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


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