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


Python DivWdg.set_name方法代码示例

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


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

示例1: get_tools_wdg

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

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

        div.add("This tool will export out a version of the project")

        button = ActionButtonWdg(title="Export")
        div.add(button)
        button.add_behavior( {
            'type': 'click_up',
            'server': my.server_code,
            'cbjs_action': '''
            var class_name = 'tactic.ui.sync.SyncCreateTemplateCmd';
            var kwargs = {
                server: bvr.server
            }
            spt.app_busy.show("Exporting project ...");
            var server = TacticServerStub.get();
            server.execute_cmd(class_name, kwargs);
            spt.app_busy.hide();

            spt.panel.refresh(bvr.src_el);

            '''
        } )



        return div
开发者ID:blezek,项目名称:TACTIC,代码行数:33,代码来源:share_wdg.py

示例2: get_tables_wdg

# 需要导入模块: from pyasm.web import DivWdg [as 别名]
# 或者: from pyasm.web.DivWdg import set_name [as 别名]
    def get_tables_wdg(my):
        
        div = DivWdg()
        div.set_name("Tables")

        div.add("In order to fully register a database, you must bind it to a TACTIC project")
        div.add("<br/>")



        project_code = "mongodb"
        database = "test_database"

        db_resource = DbResource(
                server='localhost',
                vendor='MongoDb',
                database=database
        )


        try:
            connect = DbContainer.get(db_resource)
        except Exception, e:
            div.add("Could not connect")
            div.add_style("padding: 30px")
            div.add("<br/>"*2)
            div.add(str(e))
            return div
开发者ID:0-T-0,项目名称:TACTIC,代码行数:30,代码来源:db_resource_wdg.py

示例3: get_vendor_wdg

# 需要导入模块: from pyasm.web import DivWdg [as 别名]
# 或者: from pyasm.web.DivWdg import set_name [as 别名]
    def get_vendor_wdg(my):
        
        div = DivWdg()
        div.set_name("Vendor")

        vendors = [
            "SQLite",
            "PostgreSQL",
            "MySQL",
            "Oracle",
            "SQLServer",
            "MongoDb"
        ]

        # unfortunately, Sqlite is capitalized incorectly in the code
        vendor_codes = [
            "Sqlite",
            "PostgreSQL",
            "MySQL",
            "Oracle",
            "SQLServer",
            "MongoDb"
        ]

        vendor_icons = [
            "Sqlite",
            "PostgreSQL",
            "MySQL",
            "Oracle",
            "SQLServer",
            "MongoDb"
        ]



        # get 3rd party vendors


        for vendor in vendors:

            vendor_div = DivWdg()
            div.add(vendor_div)
            vendor_div.add_style("margin: 10px")

            radio = RadioWdg("vendor")
            div.add(radio)
            radio.set_option("value", vendor)

            div.add(vendor)


        return div
开发者ID:0-T-0,项目名称:TACTIC,代码行数:54,代码来源:db_resource_wdg.py

示例4: get_connect_wdg

# 需要导入模块: from pyasm.web import DivWdg [as 别名]
# 或者: from pyasm.web.DivWdg import set_name [as 别名]
    def get_connect_wdg(my):
        
        div = DivWdg()
        div.set_name("Connection")


        table = Table()
        div.add(table)

        from tactic.ui.panel import EditWdg
        edit = EditWdg(search_type="sthpw/db_resource", view="edit")

        table.add_row()
        table.add_cell(edit)


        return div
开发者ID:0-T-0,项目名称:TACTIC,代码行数:19,代码来源:db_resource_wdg.py

示例5: get_info_wdg

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

        div = DivWdg()
        div.set_name("Info")
        div.add_style("padding: 20px")

        
        table = Table()
        div.add(table)
        table.add_color("color", "color")
        #table.add_style("height: 280px")
        table.set_unique_id()

        table.add_smart_style("spt_table_header", "width", "200px")
        table.add_smart_style("spt_table_header", "text-align", "right")
        table.add_smart_style("spt_table_header", "padding-right", "20px")
        table.add_smart_style("spt_table_header", "margin-bottom", "10px")
        table.add_smart_style("spt_table_element", "vertical-align", "top")

        table.add_row()

        #if my.mode == 'insert':
        #    read_only = False
        #else:
        #    read_only = True
        read_only = False

        code = Config.get_value("install", "server") or ""

        td = table.add_cell()
        td.add_class("spt_table_header")
        td.add("Code: ")
        td.add_style("vertical-align: top")
        text = TextInputWdg(name="code", read_only=read_only)
        td = table.add_cell()
        td.add_class("spt_table_element")
        td.add(text)
        text.set_value(code)

        return div
开发者ID:blezek,项目名称:TACTIC,代码行数:42,代码来源:share_wdg.py

示例6: get_convert_to_project_wgd

# 需要导入模块: from pyasm.web import DivWdg [as 别名]
# 或者: from pyasm.web.DivWdg import set_name [as 别名]
    def get_convert_to_project_wgd(my):
        
        div = DivWdg()
        div.set_name("Project")

        return div
开发者ID:0-T-0,项目名称:TACTIC,代码行数:8,代码来源:db_resource_wdg.py

示例7: get_display

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

        top = my.top;
        my.set_as_panel(top)
        top.add_class("spt_chat_top")


        inner = DivWdg()
        top.add(inner)
        inner.add_behavior( {
            'type': 'load',
            'cbjs_action': MessageWdg.get_onload_js()
        } )



        search = Search("sthpw/subscription")
        search.add_filter("category", "chat")
        search.add_user_filter()
        chats = search.get_sobjects()
        keys = [x.get_value("message_code") for x in chats]


        """
        chat_list_div = DivWdg()
        inner.add(chat_list_div)
        for i, chat in enumerate(chats):
            chat_div = DivWdg()
            chat_list_div.add(chat_div)
            chat_div.add_style("padding: 5px")
            chat_div.add_class("hand")

            # find all the users with the same chat
            key = chat.get_value("message_code")
            #chat_div.add(key)
            chat_div.add("#%s: " % i)

            search = Search("sthpw/subscription")
            search.add_filter("message_code", key)
            subscriptions = search.get_sobjects()
            users = [x.get_value("login") for x in subscriptions]
            chat_div.add(", ".join(users))

            chat_div.add_behavior( {
                'type': 'click_up',
                'key': key,
                'cbjs_action': '''
                var class_name = 'tactic.ui.app.ChatSessionWdg';
                var kwargs = {
                    'key': bvr.key,
                }
                spt.panel.load_popup("Chat: " + bvr.key, class_name, kwargs);

                '''
            } )

            chat_div.add_behavior( {
                'type': 'mouseover',
                'cbjs_action': '''
                bvr.src_el.setStyle("color", "#214e75");
                '''
            } )


            chat_div.add_behavior( {
                'type': 'mouseout',
                'cbjs_action': '''
                bvr.src_el.setStyle("color", "");
                '''
            } )
        """



        #keys = my.kwargs.get("keys")
        #if not keys:
        #    return

        inner.add( my.get_add_chat_wdg() )


        inner.add("<br/>")
        

        from tactic.ui.container import TabWdg
        tab = TabWdg(
                show_add=False,
                show_remove=False
        )
        inner.add(tab)

        for key in keys:
            search = Search("sthpw/subscription")
            search.add_filter("message_code", key)
            subscriptions = search.get_sobjects()
            users = [x.get_value("login") for x in subscriptions]
            users = ", ".join(users)

            session_div = DivWdg()
            session_div.set_name(users)
#.........这里部分代码省略.........
开发者ID:0-T-0,项目名称:TACTIC,代码行数:103,代码来源:message_wdg.py

示例8: get_files_wdg

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

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


        shelf_wdg = DivWdg()
        div.add(shelf_wdg)
        shelf_wdg.add_style("height: 25px")
        shelf_wdg.add_style("padding: 5px")
        shelf_wdg.add_border()
        shelf_wdg.add_color("background", "background3")
        shelf_wdg.add_style("margin: 0px -11px 10px -11px")

        project_code = Project.get_project_code()
        share_code = my.server.get_code()

        # NOT supported yet
        base_dir = my.server.get_value("base_dir")
        imports_dir = "%s/imports" % base_dir
        #import datetime
        #now = datetime.datetime.now()
        #version = now.strftime("%Y%m%d_%H%M%S")

        
        button = ActionButtonWdg(title="Export")
        shelf_wdg.add(button)
        button.add_behavior( {
            'type': 'click_up',
            'project_code': project_code,
            'share_code': share_code,
            'imports_dir': imports_dir,
            'cbjs_action': '''

            var class_name = 'tactic.ui.sync.SyncCreateTemplateCmd'
            var kwargs = {
                server: bvr.share_code,
                project_code: bvr.project_code,
                base_dir: bvr.imports_dir,
            }

            spt.app_busy.show("Exporting project ...");
            var server = TacticServerStub.get();
            server.execute_cmd(class_name, kwargs);

            var top = bvr.src_el.getParent(".spt_share_item");
            spt.panel.refresh(top);
            spt.app_busy.hide();

            '''
        })


        from tactic.ui.app import PluginDirListWdg
        dir_list = PluginDirListWdg(base_dir=my.base_dir, location="server")
        #from tactic.ui.widget import DirListWdg
        #dir_list = DirListWdg(base_dir=my.base_dir, location="server")
        div.add(dir_list)



        return div
开发者ID:blezek,项目名称:TACTIC,代码行数:65,代码来源:share_wdg.py

示例9: get_widget_from_hashXX

# 需要导入模块: from pyasm.web import DivWdg [as 别名]
# 或者: from pyasm.web.DivWdg import set_name [as 别名]

#.........这里部分代码省略.........
            elif use_admin in [False, 'false']:
                use_admin = False


            use_sidebar = kwargs.get("use_sidebar")
            if use_sidebar in [False, 'false']:
                use_sidebar = False
            elif use_admin in [True, 'true']:
                use_sidebar = True


            if use_index is not None or use_admin is not None:
                pass

            elif force_no_index in [True, 'true']:
                use_index = False
            else:
                use_index = sobject.get_value("index", no_exception=True)
                if not use_index:
                    use_index = xml.get_value("/element/@index");
                    if use_index in ['true', True]:
                        use_index = True

                use_admin = sobject.get_value("admin", no_exception=True)
                if not use_admin:
                    use_admin = xml.get_value("/element/@admin");
                    if use_admin in ['true', True]:
                        use_admin = True

                    use_sidebar = xml.get_value("/element/@sidebar");
                    if use_sidebar in ['false', False]:
                        use_sidebar = False


            if use_index or use_admin:
                # check if there is an index
                search = Search("config/url")
                search.add_filter("url", "/index")
                index = search.get_sobject()

                if not index or use_admin:
                    # use admin
                    from tactic.ui.app import PageNavContainerWdg
                    top = PageNavContainerWdg( hash=hash, use_sidebar=use_sidebar )

                else:
                    config = index.get_value("widget")
                    xml = Xml()
                    xml.read_string(config)
                    node = xml.get_node("element/display")

                    options = {}
                    options.update(xml.get_node_values_of_children(node))

                    class_name = xml.get_value("element/display/@class")
                    if class_name:
                        options['class_name'] = class_name

                    # this passes the hash value to the index widget
                    # which must handle it accordingly
                    if key == "top":
                        hash = hash.replace("/top", "/tab")
                    options['hash'] = hash
                    top = cls.build_widget(options)



                return top.get_buffer_display()
 

            # build the widget
            if key == "top":
                class_name = 'tactic.ui.panel.HashPanelWdg'
                options = {
                    "hash": hash.replace("/link", "/tab"),
                    "class_name": class_name
                }
            else:
                url = sobject.get_value("url")
                url = url.strip()

                
                options = Common.extract_dict(hash, url)
                for name, value in kwargs.items():
                    options[name] = value

                node = xml.get_node("element/display")
                options.update(xml.get_node_values_of_children(node))

                class_name = xml.get_value("element/display/@class")
                if class_name:
                    options['class_name'] = class_name

            widget = cls.build_widget(options)

            name = hash.lstrip("/")
            name = name.replace("/", " ")
            widget.set_name(name)

            return widget
开发者ID:davidsouthpaw,项目名称:TACTIC,代码行数:104,代码来源:hash_panel_wdg.py

示例10: get_tables_wdg

# 需要导入模块: from pyasm.web import DivWdg [as 别名]
# 或者: from pyasm.web.DivWdg import set_name [as 别名]
    def get_tables_wdg(self):
        
        div = DivWdg()
        div.set_name("Tables")

        div.add("In order to fully register a database, you must bind it to a TACTIC project")
        div.add("<br/>")



        project_code = "mongodb"
        database = "test_database"

        db_resource = DbResource(
                server='localhost',
                vendor='MongoDb',
                database=database
        )


        try:
            connect = DbContainer.get(db_resource)
        except Exception as e:
            div.add("Could not connect")
            div.add_style("padding: 30px")
            div.add("<br/>"*2)
            div.add(str(e))
            return div



        # Bind project to this resource
        database_text = TextWdg("database")
        div.add("Database: ")
        div.add(database_text)

        div.add("<br/>"*2)

        project_text = TextWdg("project")
        div.add("Project Code: ")
        div.add(project_text)

        div.add("<br/>")
        div.add("<hr/>")



        # connect and introspect the tables in this database
        tables = connect.get_tables()


        table = Table()
        div.add(table)
        table.set_max_width()

        for table_name in tables:
            table.add_row()
            search_type = "table/%s?project=%s" % (table_name, project_code)

            td = table.add_cell()
            icon = IconWdg("View Table", IconWdg.FOLDER_GO)
            td.add(icon)
            icon.add_behavior( {
                'type': 'click_up',
                'search_type': search_type,
                'cbjs_action': '''
                var class_name = 'tactic.ui.panel.ViewPanelWdg';
                var kwargs = {
                    search_type: bvr.search_type
                }
                spt.panel.load_popup("table", class_name, kwargs);
                '''
            } )


            td = table.add_cell()
            td.add(table_name)

            td = table.add_cell()
            search = Search(search_type)
            count = search.get_count()
            td.add(" %s item/s" % count)

            columns = search.get_columns()
            td = table.add_cell()
            td.add(columns)

            # search_type
            td = table.add_cell()
            text = TextWdg("search_type")
            td.add(text)
            new_search_type = "%s/%s" % (project_code, table_name)
            text.set_value(new_search_type)



        register_div = DivWdg()
        div.add(register_div)
        register_div.add_style("padding: 20px")

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


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