• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python web.WidgetSettings类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: execute

    def execute(my):

        class_names = my.kwargs.get("class_names")
        attrs_list = my.kwargs.get("attrs_list")
        kwargs_list = my.kwargs.get("kwargs_list")

        xml = Xml()
        xml.create_doc("config")
        root = xml.get_root_node()

        view = xml.create_element("tab")
        xml.append_child(root, view)

        for class_name, attrs, kwargs in zip(class_names, attrs_list, kwargs_list):

            element = xml.create_element("element")
            xml.append_child(view, element)

            for key, value in attrs.items():
                xml.set_attribute(element, key, value)

            display = xml.create_element("display")
            xml.append_child(element, display)

            xml.set_attribute(display, "class", class_name)

            for key, value in kwargs.items():
                attr = xml.create_text_element(key, value, node=display)
                xml.append_child(display, attr)

        xml_string = xml.to_string()

        from pyasm.web import WidgetSettings
        WidgetSettings.set_value_by_key("tab", xml_string)
开发者ID:CeltonMcGrath,项目名称:TACTIC,代码行数:34,代码来源:page_nav_container_wdg.py


示例2: set_persistent_value

    def set_persistent_value(my):
        filter_data = FilterData.get_from_cgi()

        json = filter_data.serialize()

        # use widget settings instead
        key = SearchWdg._get_key(my.search_type, my.view)
        
        WidgetSettings.set_value_by_key(key, json)
        #value = WidgetSettings.get_value_by_key(key)
        #print "value: ", value
        return
开发者ID:blezek,项目名称:TACTIC,代码行数:12,代码来源:search_wdg.py


示例3: set_persistent_value

    def set_persistent_value(my):
        filter_data = FilterData.get_from_cgi()

        json = filter_data.serialize()
        # use widget settings instead
        # Using solely TableLayoutWdg will result in having no search view
        if my.view:
            key = SearchWdg._get_key(my.search_type, my.view)
            WidgetSettings.set_value_by_key(key, json)
        #value = WidgetSettings.get_value_by_key(key)
        #print "value: ", value
        return
开发者ID:hellios78,项目名称:TACTIC,代码行数:12,代码来源:search_wdg.py


示例4: set_filter_data

    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,代码行数:28,代码来源:search_wdg.py


示例5: execute

 def execute(self):
    
     settings_key = "%s|%s" % (self.key, self.widget_name)
  
     from pyasm.web import WidgetSettings
     settings = WidgetSettings.get_by_key(settings_key)
     if not settings:
         return
     self.description = "Widget settings '%s'='%s'" % (settings_key, self.value)
  
     if settings.get_value("data") != self.value:
         settings.set_value("data", self.value)
         settings.commit()
开发者ID:mincau,项目名称:TACTIC,代码行数:13,代码来源:widget_settings_cmd.py


示例6: set_filter_data

    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,代码行数:16,代码来源:search_wdg.py


示例7: get_config_xml

    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,代码行数:21,代码来源:page_nav_container_wdg.py


示例8: set_tab_key

    def set_tab_key(my,tab_key):
        ''' set the name of the tab for redirection. If one value is passed in,
        it assumes it's one the current set of subtabs. To jump to a tab from 
        a totally different category, pass in a dict using set_redirect or 
        get_redirect_script'''
        web = WebContainer.get_web()
        my.tab_key = tab_key
        redirect = Container.get(my.TAB_REDIRECT)
        if not redirect:
            # find it from the web form
            redirect = web.get_form_value(my.TAB_REDIRECT)
            if redirect:
                redirect_dict = {}
                redirect = redirect.split(',')
                # expecting key, value pairs
                for idx, item in enumerate(redirect):
                    if idx % 2 == 0:
                        redirect_dict[item] = redirect[idx+1]
        
                redirect = redirect_dict

        if redirect:
            
            if isinstance(redirect, dict):
                for key, value in redirect.items():
                    # set only the relevant key
                    if key == tab_key:
                        web.set_form_value(key, value)
                        break
            else:
                web.set_form_value(tab_key, redirect)
                
            web.set_form_value('is_form_submitted','init')

        # this implicitly sets the tab value
        class_name = my.__class__.__name__
        my.tab_value = WidgetSettings.get_key_value(class_name,my.tab_key)
开发者ID:0-T-0,项目名称:TACTIC,代码行数:37,代码来源:tab_wdg.py


示例9: alter_task_search

    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,代码行数:36,代码来源:task_wdg.py


示例10: add_top_behaviors

    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,代码行数:101,代码来源:scm_dir_list_wdg.py


示例11: get_display

    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,代码行数:101,代码来源:scm_dir_list_wdg.py


示例12: get_display

    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,代码行数:101,代码来源:layout_switcher_wdg.py


示例13: clear_search_data

 def clear_search_data(search_type, view=None):
     DbContainer.abort_thread_sql(force=True)
     key = SearchWdg._get_key(search_type, view)
     WidgetSettings.set_value_by_key(key, '')
开发者ID:hellios78,项目名称:TACTIC,代码行数:4,代码来源:search_wdg.py


示例14: init

    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,代码行数:101,代码来源:search_wdg.py


示例15: get_display

    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,代码行数:101,代码来源:sandbox_select_wdg.py


示例16: init

    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,代码行数:76,代码来源:search_wdg.py


示例17: commit

 def commit(my):
     # store the widget persistently
     config_xml = my.serialize()
     key = my.get_persistent_key()
     WidgetSettings.set_key_values(key, [config.xml.to_string()])
开发者ID:CeltonMcGrath,项目名称:TACTIC,代码行数:5,代码来源:base_refresh_wdg.py


示例18: get_display

    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,代码行数:101,代码来源:branch_wdg.py


示例19: get_by_key

 def get_by_key(my, key):
     key = my.get_persistent_key()
     return WidgetSettings.set_key_values(key, [config.xml.to_string()])
开发者ID:CeltonMcGrath,项目名称:TACTIC,代码行数:3,代码来源:base_refresh_wdg.py


示例20: get_display

    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' 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python widget.CheckboxWdg类代码示例发布时间:2022-05-25
下一篇:
Python web.Widget类代码示例发布时间:2022-05-25
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap