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


Python WidgetSettings.get_value_by_key方法代码示例

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


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

示例1: set_filter_data

# 需要导入模块: from pyasm.web import WidgetSettings [as 别名]
# 或者: from pyasm.web.WidgetSettings import get_value_by_key [as 别名]
    def set_filter_data(search_type, view=None):
        '''set filter data based on some saved search values in wdg_settings'''

        # NOTE - This is MMS specific and is deprecated and will be deleted
        # DISABLING FOR Job and Request until job_detail stops stack tracing
        # This is due to mixing of searches between job and request in the
        # job detail.  Cannot find the issue.
        # 1) FilterData is global: should be scoped by search type
        # 2) After introduction of scroll bars, it started stack tracing
        # It looks like the state is not being properly passed through

        # temp fix to avoid cross contamination of filter data for Planners UI
        if search_type in ['MMS/job','MMS/request'] or view == '_planner':
            return
        
        filter_data = FilterData.get()
        if not filter_data.get_data():
            # use widget settings
            key = SearchWdg._get_key(search_type, view)
            data = WidgetSettings.get_value_by_key(key)
            if data:
              
                try:
                    filter_data = FilterData(data)
                    filter_data.set_to_cgi()
                except SetupException, e:
                    print "This filter data is causing error:", data
                    print e
开发者ID:hellios78,项目名称:TACTIC,代码行数:30,代码来源:search_wdg.py

示例2: set_filter_data

# 需要导入模块: from pyasm.web import WidgetSettings [as 别名]
# 或者: from pyasm.web.WidgetSettings import get_value_by_key [as 别名]
    def set_filter_data(search_type, view=None):
        '''set filter data based on some saved search values in wdg_settings'''

        filter_data = FilterData.get()
        if not filter_data.get_data():
            # use widget settings
            key = SearchWdg._get_key(search_type, view)
            data = WidgetSettings.get_value_by_key(key)
            if data:
              
                try:
                    filter_data = FilterData(data)
                    filter_data.set_to_cgi()
                except SetupException, e:
                    print "This filter data is causing error:", data
                    print e
开发者ID:0-T-0,项目名称:TACTIC,代码行数:18,代码来源:search_wdg.py

示例3: get_config_xml

# 需要导入模块: from pyasm.web import WidgetSettings [as 别名]
# 或者: from pyasm.web.WidgetSettings import get_value_by_key [as 别名]
    def get_config_xml(my):

        from pyasm.web import WidgetSettings
        config_xml  = WidgetSettings.get_value_by_key("main_body_tab")
        config_xml = None

        if not config_xml:
            config_xml = '''<config><tab/></config>'''
            """
            config_xml = '''<config><tab>
            <element name='Ingestion'>
              <display class='tactic.ui.widget.file_browser_wdg.FileBrowserWdg'>
                <search_type>sthpw/login_group</search_type>
                <view>table</view>
              </display>
            </element>
            </tab>
            </config>'''
            """
 
        return config_xml
开发者ID:CeltonMcGrath,项目名称:TACTIC,代码行数:23,代码来源:page_nav_container_wdg.py

示例4: alter_task_search

# 需要导入模块: from pyasm.web import WidgetSettings [as 别名]
# 或者: from pyasm.web.WidgetSettings import get_value_by_key [as 别名]
    def alter_task_search(my, search, prefix='children', prefix_namespace='' ):
        from tactic.ui.filter import FilterData, BaseFilterWdg, GeneralFilterWdg
        filter_data = FilterData.get()
        parent_search_type = get_search_type()
        
        if not filter_data.get_data():
            # use widget settings
            key = "last_search:%s" % parent_search_type
            data = WidgetSettings.get_value_by_key(key)
            if data:
                filter_data = FilterData(data)
            filter_data.set_to_cgi()

        
        filter_mode_prefix = 'filter_mode'
        if prefix_namespace:
            filter_mode_prefix = '%s_%s' %(prefix_namespace, filter_mode_prefix)
        
        filter_mode = 'and'
        filter_mode_value = filter_data.get_values_by_index(filter_mode_prefix, 0)
        if filter_mode_value:
            filter_mode = filter_mode_value.get('filter_mode')
       
        if prefix_namespace:
            prefix = '%s_%s' %(prefix_namespace, prefix)
        values_list = BaseFilterWdg.get_search_data_list(prefix, \
                search_type=my.get_searchable_search_type())
        if values_list:
            
            search.add_op('begin')
            GeneralFilterWdg.alter_sobject_search( search, values_list, prefix)
            if filter_mode != 'custom': 
                search.add_op(filter_mode)
        
        
        return search
开发者ID:0-T-0,项目名称:TACTIC,代码行数:38,代码来源:task_wdg.py

示例5: get_display

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

        top = my.top
        top.add_class("spt_changelist_content")
        my.set_as_panel(top)
        top.add_color("color", "color")
        top.add_color("background", "background")
        #top.add_border()
        #top.add_style("padding", "10px")
        top.add_style("min-width: 600px")
        top.add_style("min-height: 400px")

        top.add_behavior( {
            'type': 'load',
            'cbjs_action': scm_get_onload_js()
        } )



        sync_dir = Environment.get_sandbox_dir()
        # HARD CODED
        project = Project.get()
        depot = project.get_value("location", no_exception=True)
        if not depot:
            depot = project.get_code()
        location = '//%s' % depot


        changelist = my.kwargs.get("changelist")
        if not changelist:
            changelist = WidgetSettings.get_value_by_key("current_changelist")
        else:
            WidgetSettings.set_value_by_key("current_changelist", changelist)

        if not changelist:
            changelist = 'default'


        changelists = my.kwargs.get("changelists")
        if not changelists:
            changelists = []
        elif isinstance(changelists, basestring):
            changelists = changelists.replace("'", '"')
            changelists = jsonloads(changelists)

        top.add_behavior( {
            'type': 'load',
            'sync_dir': sync_dir,
            'depot': depot,
            'cbjs_action': '''
            spt.scm.sync_dir = bvr.sync_dir;
            spt.scm.depot = bvr.depot;
            '''
        } )



        inner = DivWdg()
        top.add(inner)

        table = Table()
        inner.add(table)
        table.add_style("width: 100%")
        table.add_color("background", "background", -3)

        table.add_row()
        th = table.add_header("")

        th = table.add_header("Changelist")
        th.add_style("text-align: left")
        th = table.add_header("Description")
        th.add_style("text-align: left")
        th = table.add_header("# Items")
        th.add_style("text-align: left")
        th = table.add_header("Status")
        th.add_style("text-align: left")
        th = table.add_header("View")
        th.add_style("text-align: left")
        th = table.add_header("Delete")
        th.add_style("text-align: left")
        #table.set_unique_id()
        #table.add_smart_styles("spt_changelist_item", {
        #    'text-align: right'
        #    } ))

        bgcolor = table.get_color("background", -8)
        table.add_relay_behavior( {
            'type': 'mouseover',
            'bvr_match_class': 'spt_changelist_item',
            'bgcolor': bgcolor,
            'cbjs_action': '''
            bvr.src_el.setStyle("background-color", bvr.bgcolor);
            '''
        } )
        table.add_relay_behavior( {
            'type': 'mouseout',
            'bvr_match_class': 'spt_changelist_item',
            'cbjs_action': '''
            bvr.src_el.setStyle("background-color", '');
            '''
#.........这里部分代码省略.........
开发者ID:0-T-0,项目名称:TACTIC,代码行数:103,代码来源:changelist_wdg.py

示例6: get_display

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

        top = my.top
        top.add_class("spt_sandbox_select_top")

        sandbox_options = [
                {
                    'name': 'fast',
                    'base_dir': 'C:/Fast',
                },
                {
                    'name': 'faster',
                    'base_dir': 'C:/Faster',
                },
                {
                    'name': 'slow',
                    'base_dir': 'Z:/Slow',
                }
        ]

        process = my.kwargs.get("process")

        search_key = my.kwargs.get("search_key")
        sobject = Search.get_by_search_key(search_key)


        search_type = sobject.get_base_search_type()

        client_os = Environment.get_env_object().get_client_os()
        if client_os == 'nt':
            prefix = "win32"
        else:
            prefix = "linux"
        alias_dict = Config.get_dict_value("checkin", "%s_sandbox_dir" % prefix)

        search_key = sobject.get_search_key()
        key = "sandbox_dir:%s" % search_key
        from pyasm.web import WidgetSettings
        value = WidgetSettings.get_value_by_key(key)


        sandboxes_div = DivWdg()
        top.add(sandboxes_div)

        sandboxes_div.add_relay_behavior( {
            'type': 'mouseenter',
            'bvr_match_class': 'spt_sandbox_option',
            'cbjs_action': '''
            var last_background = bvr.src_el.getStyle("background-color");
            bvr.src_el.setAttribute("spt_last_background", last_background);
            bvr.src_el.setStyle("background-color", "#E0E0E0");
            bvr.src_el.setStyle("opacity", "1.0");
            '''
        } )

        sandboxes_div.add_relay_behavior( {
            'type': 'mouseleave',
            'bvr_match_class': 'spt_sandbox_option',
            'cbjs_action': '''
            var last_background = bvr.src_el.getAttribute("spt_last_background");
            bvr.src_el.setStyle("background-color", last_background);
            if (!bvr.src_el.hasClass("spt_selected")) {
                bvr.src_el.setStyle("opacity", "0.5");
            }
            '''
        } )




        sandboxes_div.add_relay_behavior( {
            'type': 'mouseup',
            'key': key,
            'bvr_match_class': 'spt_sandbox_option',
            'cbjs_action': '''
            var sandbox_dir = bvr.src_el.getAttribute("spt_sandbox_dir");
            var server = TacticServerStub.get();
            server.set_widget_setting(bvr.key, sandbox_dir);


            var applet = spt.Applet.get();

            applet.makedirs(sandbox_dir);

            //var top = bvr.src_el.getParent(".spt_sandbox_select_top");
            var top = bvr.src_el.getParent(".spt_checkin_top");
            spt.panel.refresh(top);
            '''
        } )



        #search = Search("config/naming")
        #search.add_filter("search_type", search_type)
        #search.add_filter("process", process)
        #namings = search.get_sobjects()
        #naming = namings[0]

        from pyasm.biz import Snapshot, Naming
        virtual_snapshot = Snapshot.create_new()
#.........这里部分代码省略.........
开发者ID:0-T-0,项目名称:TACTIC,代码行数:103,代码来源:sandbox_select_wdg.py

示例7: add_top_behaviors

# 需要导入模块: from pyasm.web import WidgetSettings [as 别名]
# 或者: from pyasm.web.WidgetSettings import get_value_by_key [as 别名]
    def add_top_behaviors(my, top):

        super(ScmDirListWdg, my).add_top_behaviors(top)

        changelist = WidgetSettings.get_value_by_key("current_changelist")

        menu_item = MenuItem(type='title', label="Perforce Actions")
        my.menu.add(menu_item)

        menu_item = MenuItem(type='action', label='Add To Changelist [%s]' % changelist)
        my.menu.add(menu_item)
        menu_item.add_behavior( {
            'type': 'click_up',
            'changelist': changelist,
            'cbjs_action': '''
            var activator = spt.smenu.get_activator(bvr);

            var paths = spt.checkin.get_selected_paths();
            if (paths.length == 0) {
                var path = activator.getAttribute("spt_path");
                paths = [path]
            }

            var changelist = bvr.changelist;

            // TODO: optimize this to call on once by passing in the array
            // of paths
            for (var i = 0; i < paths.length; i++) {
                var path = paths[i];
                spt.scm.run("add", [path, changelist]);
            }
            var top = activator.getParent(".spt_checkin_top");
            spt.panel.refresh(top);
            '''
        } )


        menu_item = MenuItem(type='action', label='Make Editable')
        my.menu.add(menu_item)
        menu_item.add_behavior( {
            'type': 'click_up',
            'changelist': changelist,
            'cbjs_action': '''
            var activator = spt.smenu.get_activator(bvr);

            var paths = spt.checkin.get_selected_paths();
            if (paths.length == 0) {
                var path = activator.getAttribute("spt_path");
                paths = [path]
            }

            // TODO: optimize this to call on once by passing in the array
            // of paths
            for (var i = 0; i < paths.length; i++) {
                var path = paths[i];
                spt.scm.run("edit", [path, bvr.changelist]);
            }

            var top = activator.getParent(".spt_checkin_top");
            spt.panel.refresh(top);

            '''
        } )


        menu_item = MenuItem(type='action', label='Revert File')
        my.menu.add(menu_item)
        menu_item.add_behavior( {
            'type': 'click_up',
            'cbjs_action': '''
            var activator = spt.smenu.get_activator(bvr);
            var path = activator.getAttribute("spt_path");
            try {
                spt.scm.revert(path);
                var top = activator.getParent(".spt_checkin_top");
                spt.panel.refresh(top);
            }
            catch (e) {
                spt.scm.handle_error(e);
            }

            '''
        } )



        menu_item = MenuItem(type='action', label='File Log')
        my.menu.add(menu_item)
        menu_item.add_behavior( {
            'type': 'click_up',
            'cbjs_action': '''
            var activator = spt.smenu.get_activator(bvr);
            var path = activator.getAttribute("spt_path");
            try {
                var file_logs = spt.scm.file_log(path);

                var class_name = 'tactic.ui.checkin.ScmCheckinHistoryWdg';
                var kwargs = {
                    'file_logs': file_logs
                }
#.........这里部分代码省略.........
开发者ID:blezek,项目名称:TACTIC,代码行数:103,代码来源:scm_dir_list_wdg.py

示例8: get_display

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

        my.sobject = my.kwargs.get("sobject")
        search_key = my.sobject.get_search_key()

        top = DivWdg()
        top.add_class("spt_checkin_publish")
        top.add_style("padding: 10px")

        margin_top = '60px'
        top.add_style("margin-top", margin_top)
        top.add_style("position: relative")


        current_changelist = WidgetSettings.get_value_by_key("current_changelist")
        current_branch = WidgetSettings.get_value_by_key("current_branch")
        current_workspace = WidgetSettings.get_value_by_key("current_workspace")

        top.add("Branch: %s<br/>" % current_branch)
        top.add("Changelist: %s<br/>" % current_changelist)
        top.add("Workspace: %s<br/>" % current_workspace)
        top.add("<br/>")


        checked_out_div = DivWdg()
        checkbox = CheckboxWdg("editable")
        top.add(checked_out_div)
        checkbox.add_class("spt_checkin_editable")
        checked_out_div.add(checkbox)
        checked_out_div.add("Leave files editable")

        top.add("<br/>")

        top.add("Publish Description<br/>")
        text = TextAreaWdg("description")
        # this needs to be set or it will stick out to the right
        text.add_style("width: 220px")
        text.add_class("spt_checkin_description")
        top.add(text)


        # add as a note
        note_div = DivWdg()
        top.add(note_div)
        note_div.add_class("spt_add_note")
        checkbox = CheckboxWdg("add_note")

        web = WebContainer.get_web()
        browser = web.get_browser()
        if browser in ['Qt']:
            checkbox.add_style("margin-top: -4px")
            checkbox.add_style("margin-right: 3px")
            note_div.add_style("margin-top: 3px")



        checkbox.add_class("spt_checkin_add_note")
        note_div.add(checkbox)
        note_div.add("Also add as note")

        top.add("<br/><br/>")


        button = ActionButtonWdg(title="Check-in", icon=IconWdg.PUBLISH, size='medium')
        top.add(button)

        my.repo_type = 'perforce'
        if my.repo_type == 'perforce':

            # the depot is set per project (unless overridden)
            project = my.sobject.get_project()
            depot = project.get_value("location", no_exception=True)
            if not depot:
                depot = project.get_code()

            asset_dir = Environment.get_asset_dir()
            sandbox_dir = Environment.get_sandbox_dir()
           
            changelist = WidgetSettings.get_value_by_key("current_changelist")
            button.add_behavior( {
            'type': 'click_up',
            'depot': depot,
            'changelist': changelist,
            'sandbox_dir': sandbox_dir,
            'search_key': search_key,
            'cbjs_action': '''

            var paths = spt.checkin.get_selected_paths();
            spt.app_busy.show("Checking in "+paths.length+" file/s into Perforce");
            var top = bvr.src_el.getParent(".spt_checkin_top");
            var description = top.getElement(".spt_checkin_description").value;
            var add_note = top.getElement(".spt_checkin_add_note").value;
            var editable = top.getElement(".spt_checkin_editable").value;

            if (editable == 'on') {
                editable = true;
            }
            else {
                editable = false;
            }
#.........这里部分代码省略.........
开发者ID:blezek,项目名称:TACTIC,代码行数:103,代码来源:scm_dir_list_wdg.py

示例9: get_display

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

        top = self.top
        top.add_class("spt_switcher_top")
        
        '''
        This supports supports two menu definitions:
        menu - specifies a view for SideBarWdg which will be ingected as menu 
        config_xml - specifies menu entries. For example:

        <display class="tactic.ui.widget.LayoutSwitcherWdg">
          <!-- config_xml -->
          <config>
            <!-- Menu item 1 -->
            <element name="self_tasks_default" title="My Tasks" target=spt_my_tasks_table_top">
              <display class="tactic.ui.panel.ViewPanelWdg">
                <search_type>sthpw/task</search_type>
                <show_shelf>false</show_shelf>
                <view>my_tasks_default</view>
              </display>
            </element>
            <!-- Menu item 2 -->
            <element ... >
              <display ... >
              </display>
            </element>
          </config>
        </display>

        target - specifies target div to load views when using "menu" kwarg
        use_href - updates address bar hash (this is TODO)
        '''
        
        menu = self.kwargs.get("menu")
        config_xml = self.kwargs.get("config_xml")
        target = self.kwargs.get("target")

        #default
        default_layout = self.kwargs.get("default_layout")

        # find the save state value, if state is to be saved
        save_state = self.kwargs.get("save_state")

        if save_state in [False, 'false']:
            save_state = None
            show_first = False
        else:
            show_first = True

        state_value = None
        if save_state:
            state_value = WidgetSettings.get_value_by_key(save_state)
        elif default_layout:
            state_value = default_layout

        title = self.kwargs.get("title")
        if not title and state_value:
            title = state_value
        if not title:
            title = "Switch Layout"

        mode = self.kwargs.get("mode")
        if mode == "button":
            color = self.kwargs.get("color") or "default"
            activator = DivWdg("<button class='btn btn-%s dropdown-toggle' style='width: 160px'><span class='spt_title'>%s</span> <span class='caret'></span></button>" % (color, title))
        elif mode == "div":
            color = self.kwargs.get("color") or ""
            background = self.kwargs.get("background") or "transparent"
            activator = DivWdg("<button class='btn dropdown-toggle' style='width: 160px; background: %s; color: %s; font-weight: bold'><span class='spt_title'>%s</span> <span class='caret'></span></button>" % (background, color, title))

        else:
            activator = IconButtonWdg( name="Layout Switcher", icon="BS_TH_LIST")


        top.add(activator)
        activator.add_class("spt_switcher_activator")
        activator.add_behavior( {
            'type': 'click_up',
            'cbjs_action': '''
            var activator = bvr.src_el;
            var top = activator.getParent(".spt_switcher_top");
            var menu = top.getElement(".spt_switcher_menu");
            
            if (top.hasClass("spt_selected")) {
                top.removeClass("spt_selected");
                menu.setStyle("display", "none");    
            } else {
                top.addClass("spt_selected");
                menu.setStyle("display", "");
                var pos = activator.getPosition();
                var button_size = activator.getSize();
                var menu_size = menu.getSize();
                var offset = {
                    x: button_size.x - menu_size.x,
                    y: button_size.y
                }
                menu.position({position: 'upperleft', relativeTo: activator, offset: offset});

                spt.body.add_focus_element(menu);

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

示例10: init

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

        my.user_override = my.kwargs.get('user_override') in ['true', True]

        custom_search_view = my.kwargs.get('custom_search_view')
        if not custom_search_view or not custom_search_view.strip():
            custom_search_view = 'search'

        # create a search for this search widget
        my.search_type = my.kwargs.get('search_type')
        my.search = Search(my.search_type)
        my.config = None

        # determine whether or not to use the last search.  If any kind of
        # state has been set, then ignore the last_search
        my.use_last_search = True
        parent_key = my.kwargs.get('parent_key')
        state = my.kwargs.get('state')
        if parent_key or state or my.kwargs.get('use_last_search') == False:
            my.use_last_search = False
       
        my.prefix_namespace = my.kwargs.get('prefix_namespace')


        # NOTE: this is still hard coded
        my.prefix = 'main_body'
        # if we are asking for a specific saved search
        save = my.kwargs.get('save')


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

        # get the config from a specific location

        # if the view is specified, use this view with the values
        # specified explicitly in this view
        my.config = None

        # see if a filter is explicitly passed in
        filter = my.kwargs.get('filter')
        my.limit = my.kwargs.get('limit')
        my.run_search_bvr = my.kwargs.get('run_search_bvr')

        # get from search view
     
        # filter can be either dict(data) or a list or
        # xml(filter wdg definition)
        if filter:
            if type(filter) == types.DictType:
                my.config = my.get_default_filter_config()
                filter_data = FilterData([filter])
                filter_data.set_to_cgi()
            elif type(filter) == types.ListType:
                my.config = my.get_default_filter_config()
                filter_data = FilterData(filter)
                filter_data.set_to_cgi()
        
            else:
                
                try:
                    filter_data = None

                    # TODO: remove this. This is for backward compatibilty
                    my.config = WidgetConfig.get(xml=filter, view='filter')
                    filter_data = FilterData.get()
                    if not filter_data.get_data():
                        # use widget settings
                        key = SearchWdg._get_key(my.search_type, my.view)

                        data = WidgetSettings.get_value_by_key(key)
                        if data:
                            filter_data = FilterData(data)
                        filter_data.set_to_cgi()

                except XmlException, e:
                    print "WARNING: non-xml filter detected!! %s" %filter
开发者ID:hellios78,项目名称:TACTIC,代码行数:78,代码来源:search_wdg.py

示例11: get_display

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

        top = my.top
        top.add_class("spt_branch_content")
        my.set_as_panel(top)
        top.add_color("color", "color")
        top.add_color("background", "background")
        #top.add_border()
        #top.add_style("padding", "10px")
        top.add_style("min-width: 600px")
        top.add_style("min-height: 400px")

        top.add_behavior( {
            'type': 'load',
            'cbjs_action': scm_get_onload_js()
        } )



        sync_dir = Environment.get_sandbox_dir()
        project = Project.get()
        depot = project.get_value("location", no_exception=True)
        if not depot:
            depot = project.get_code()
        location = '//%s' % depot


        branch = my.kwargs.get("branch")
        if not branch:
            branch = WidgetSettings.get_value_by_key("current_branch")
        else:
            WidgetSettings.set_value_by_key("current_branch", branch)

        if not branch:
            branch = 'main'


        branches = my.kwargs.get("branches")
        if not branches:
            branches = []
        elif isinstance(branches, basestring):
            branches = branches.replace("'", '"')
            branches = jsonloads(branches)

        top.add_behavior( {
            'type': 'load',
            'depot': depot,
            'sync_dir': sync_dir,
            'cbjs_action': '''
            spt.scm.sync_dir = bvr.sync_dir;
            spt.scm.depot = bvr.depot;
            '''
        } )



        inner = DivWdg()
        top.add(inner)

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

        table.add_row()
        th = table.add_header("")

        th = table.add_header("Branches")
        th.add_style("text-align: left")
        th = table.add_header("Options")
        th.add_style("text-align: left")
        th = table.add_header("Owner")
        th.add_style("text-align: left")
        th = table.add_header("Check-out")
        th.add_style("text-align: left")

        bgcolor = table.get_color("background", -8)
        table.add_relay_behavior( {
            'type': 'mouseover',
            'bvr_match_class': 'spt_branch_item',
            'bgcolor': bgcolor,
            'cbjs_action': '''
            bvr.src_el.setStyle("background-color", bvr.bgcolor);
            '''
        } )
        table.add_relay_behavior( {
            'type': 'mouseout',
            'bvr_match_class': 'spt_branch_item',
            'cbjs_action': '''
            bvr.src_el.setStyle("background-color", '');
            '''
        } )


        table.add_relay_behavior( {
            'type': 'mouseup',
            'bvr_match_class': "spt_branch_radio",
            'cbjs_action': '''
            var value = bvr.src_el.value;


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

示例12: init

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

        self.user_override = self.kwargs.get('user_override') in ['true', True]

        custom_search_view = self.kwargs.get('custom_search_view')
        if not custom_search_view or not custom_search_view.strip():
            custom_search_view = 'search'

        # create a search for this search widget
        self.search_type = self.kwargs.get('search_type')

        self.search = self.kwargs.get("search")
        if not self.search:
            self.search = Search(self.search_type)
        self.config = None

        # determine whether or not to use the last search.  If any kind of
        # state has been set, then ignore the last_search
        self.use_last_search = True
        parent_key = self.kwargs.get('parent_key')
        state = self.kwargs.get('state')
        if parent_key or state or self.kwargs.get('use_last_search') in [False, 'false']:
            self.use_last_search = False
       
        self.prefix_namespace = self.kwargs.get('prefix_namespace')


        # NOTE: this is still hard coded
        self.prefix = 'main_body'
        # if we are asking for a specific saved search
        save = self.kwargs.get('save')


        self.view = self.kwargs.get('view')

        # get the config from a specific location

        # if the view is specified, use this view with the values
        # specified explicitly in this view
        self.config = None

        # see if a filter is explicitly passed in
        filter = self.kwargs.get('filter')
        self.limit = self.kwargs.get('limit')
        self.run_search_bvr = self.kwargs.get('run_search_bvr')

        # get from search view
     
        # filter can be either dict(data) or a list or
        # xml(filter wdg definition)
        if filter:
            if type(filter) == types.DictType:
                self.config = self.get_default_filter_config()
                filter_data = FilterData([filter])
                filter_data.set_to_cgi()
            elif type(filter) == types.ListType:
                self.config = self.get_default_filter_config()
                filter_data = FilterData(filter)
                filter_data.set_to_cgi()
        
            else:
                
                try:
                    filter_data = None

                    # TODO: remove this. This is for backward compatibilty
                    self.config = WidgetConfig.get(xml=filter, view='filter')
                    filter_data = FilterData.get()
                    if not filter_data.get_data():
                        # use widget settings
                        key = SearchWdg._get_key(self.search_type, self.view)

                        data = WidgetSettings.get_value_by_key(key)
                        if data:
                            filter_data = FilterData(data)
                        filter_data.set_to_cgi()

                except XmlException as e:
                    print("WARNING: non-xml filter detected!!")

        
        # NOTE: this is only used to maintain backwards compatibility
        # plus it is needed for link_search: which contains the filter_config (old way of doing it)
        if not self.config:# and self.view:
            """
            if ':' in self.view: # avoid view of a SearchWdg like link_search:<search_type>:<view>
                search_view = custom_search_view
            else:
                search_view = self.view
            """
            search_view = custom_search_view
            config_view = WidgetConfigView.get_by_search_type(self.search_type, view=search_view)
            # get the self.config first for the display of SearchWdg
            # then get the filter data below if there is any
            if config_view.get_config().has_view(search_view):
                self.config = config_view.get_config()   

            try:
                search = Search('config/widget_config')
                search.add_filter("view", self.view)
#.........这里部分代码省略.........
开发者ID:mincau,项目名称:TACTIC,代码行数:103,代码来源:search_wdg.py

示例13: get_display

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

        top = my.top
        top.add_class("spt_workspace_content")
        my.set_as_panel(top)
        top.add_color("color", "color")
        top.add_color("background", "background")
        top.add_style("min-width: 600px")
        top.add_style("min-height: 400px")


        # NOTE: is there ever a time when this is not loaded already?
        top.add_behavior( {
            'type': 'load',
            'cbjs_action': scm_get_onload_js()
        } )



        sync_dir = Environment.get_sandbox_dir()
        project = Project.get()
        depot = project.get_value("location", no_exception=True)
        if not depot:
            depot = project.get_code()
        location = '//%s' % depot


        workspace = my.kwargs.get("workspace")
        if not workspace:
            workspace = WidgetSettings.get_value_by_key("current_workspace")
        else:
            WidgetSettings.set_value_by_key("current_workspace", workspace)

        if not workspace:
            workspace = 'main'


        workspaces = my.kwargs.get("workspaces")
        if not workspaces:
            workspaces = []
        elif isinstance(workspaces, basestring):
            workspaces = workspaces.replace("'", '"')
            workspaces = jsonloads(workspaces)

        top.add_behavior( {
            'type': 'load',
            'depot': depot,
            'sync_dir': sync_dir,
            'cbjs_action': '''
            spt.scm.sync_dir = bvr.sync_dir;
            spt.scm.depot = bvr.depot;
            '''
        } )



        inner = DivWdg()
        top.add(inner)

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

        table.add_row()
        th = table.add_header("")



        th = table.add_header("Workspaces")
        th.add_style("text-align: left")
        th = table.add_header("Description")
        th.add_style("text-align: left")
        th = table.add_header("Owner")
        th.add_style("text-align: left")
        th = table.add_header("Root")
        th.add_style("text-align: left")


        bgcolor = table.get_color("background", -8)
        table.add_relay_behavior( {
            'type': 'mouseover',
            'bvr_match_class': 'spt_workspace_item',
            'bgcolor': bgcolor,
            'cbjs_action': '''
            bvr.src_el.setStyle("background-color", bvr.bgcolor);
            '''
        } )


        table.add_relay_behavior( {
            'type': 'mouseout',
            'bvr_match_class': 'spt_workspace_item',
            'cbjs_action': '''
            bvr.src_el.setStyle("background-color", '');
            '''
        } )


        table.add_relay_behavior( {
            'type': 'mouseup',
#.........这里部分代码省略.........
开发者ID:0-T-0,项目名称:TACTIC,代码行数:103,代码来源:workspace_wdg.py


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