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


Python TX.module2Path方法代码示例

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


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

示例1: baseComponents

# 需要导入模块: from xierpa3.toolbox.transformer import TX [as 别名]
# 或者: from xierpa3.toolbox.transformer.TX import module2Path [as 别名]
    def baseComponents(self):        
        # Import current example site, as anchor for the article files.
        from xierpa3.sites import doingbydesign
        # Root path where to find the article Simples wiki file for this example page.
        articleRoot = TX.module2Path(doingbydesign) + '/files/articles/'
        adapter = DbDAdapter(articleRoot) # Preferred adapter class for articles in this site.

        logo = Logo(text='Doing by Design', fontFamily='Impact', color=Color('#888'), fontSize=Em(1.8))
        menu = Menu()
        mobileNavigation = DbDMobileNavigation()
        article = Article()

        featuredByImage = FeaturedByImage(start=0, width=Perc(65.4), showTitle=False,
            showHeadline=False, showTopic=False)
        featuredByText = FeaturedByText(start=0, width=Perc(30.75))

        # Containers
        top = Top(components=(logo, menu), media=Media(max=self.C.M_MOBILE_MAX, display=self.C.NONE))
        featured = Featured(components=(featuredByImage, featuredByText), backgroundColor=Color('#262c37'))
        section = Section(components=(featuredByImage,))
        mainContent = MainContent(components=article)
        footer = Footer(components=(menu))

        homePage = Page(name=self.C.TEMPLATE_INDEX,
            components=(mobileNavigation, top, featured, section, mainContent, footer),
            css=self.C.URL_CSS, fonts=self.C.URL_FONTS, js=self.URL_JAVASCRIPT,
            favicon=self.C.URL_FAVICON, adapter=adapter)

        articlePage = Page(name=self.C.TEMPLATE_ARTICLE,
            comoonents=(mobileNavigation, top, article, footer),
            css=self.C.URL_CSS, fonts=self.C.URL_FONTS, js=self.URL_JAVASCRIPT,
            favicon=self.C.URL_FAVICON, adapter=adapter)

        return [homePage, articlePage]
开发者ID:petrvanblokland,项目名称:Xierpa3,代码行数:36,代码来源:doingbydesign.py

示例2: baseComponents

# 需要导入模块: from xierpa3.toolbox.transformer import TX [as 别名]
# 或者: from xierpa3.toolbox.transformer.TX import module2Path [as 别名]
 def baseComponents(self):
     u"""Create the component instances"""
     # Import current example site, as anchor for the article files.
     from xierpa3.sites.examples import textilearticles
     # Root path where to find the article Simples wiki file for this example page.
     articleRoot = TX.module2Path(textilearticles) + '/files/articles/' 
     adapter = ArticleAdapter(articleRoot) # Preferred adapter class for articles in this site.
     # Create navigation instance, to choose between the available articles.
     menu = Menu(adapter=adapter)
     menuContainer = Container(components=menu)
     # Create the article component to contain articles answered by the adapter.
     #article = SimplexArticle(adapter=adapter) 
     article = Article(width=Perc(70), adapter=adapter, showPoster=True, splitChapters=False) 
     articleSideBar = ArticleSideBar(width=Perc(22), adapter=adapter)
     featuredArticles = FeaturedByImage(width=Perc(22), adapter=adapter, 
         # Example to overwrite the default BluePrint parameter titleColor                               
         titleColor=Color('red'))
     #featuredByImage = FeaturedByText(widht=Perc(22), adapter=adapter)
     # Make main page container for the article column
     container = Container(components=(
         #article,
         articleSideBar,
         #featuredArticles,
         #featuredByImage
     )) 
     # The class is also the page name in the url.
     homePage = Page(class_=self.C.TEMPLATE_INDEX, name=self.C.TEMPLATE_INDEX, 
         fonts=self.URL_FONTS, title=self.TITLE, css=self.C.URL_CSS, 
         components=(menuContainer, container))
     return [homePage]
开发者ID:petrvanblokland,项目名称:Xierpa3,代码行数:32,代码来源:make.py

示例3: baseComponents

# 需要导入模块: from xierpa3.toolbox.transformer import TX [as 别名]
# 或者: from xierpa3.toolbox.transformer.TX import module2Path [as 别名]
    def baseComponents(self):
        # Create the article adapter
        # Import articles from the doingbydesign site, sharing the article files.
        from xierpa3.sites import doingbydesign
        # Root path where to find the article Simplex wiki file for this example page.
        articleRoot = TX.module2Path(doingbydesign) + '/files/articles/'
        adapter = SimpleSiteAdapter(articleRoot)

        # Header
        logo = Logo()
        menu = Menu()
        header = Header(components=(logo,menu), mobileContainerDisplay=self.C.NONE,
            doc_mobileContainerDisplay=u'Header is not visible for mobile')
        mobileNavigation = MobileNavigation() # Is container by itself. Change??

        # Create the component instances
        article = Article(width=Perc(68))
        featuredByImage = FeaturedByImage(count=1, width=Perc(30))
        featuredByText = FeaturedByText(start=1, count=3, width=Perc(30))
        # Create the single page instance, containing the number of components
        mainHome = Container(components=(article, featuredByImage, featuredByText))

        # Footer
        footer = Footer(components=(menu,), containerBackgroundColor=self.FOOTERBGCOLOR)

        # The class is also the page name in the url.
        homePage = Page(class_=self.C.TEMPLATE_INDEX, name=self.C.TEMPLATE_INDEX, adapter=adapter,
            #components=(mobileNavigation, header, mainHome, footer),
            #components=(header, mainHome, footer),
            components=Container(header),
            fonts=self.URL_FONTS, title=self.TITLE, css=self.C.URL_CSS)
        return [homePage]
开发者ID:thongnv,项目名称:Xierpa3,代码行数:34,代码来源:make.py

示例4: buildResource

# 需要导入模块: from xierpa3.toolbox.transformer import TX [as 别名]
# 或者: from xierpa3.toolbox.transformer.TX import module2Path [as 别名]
 def buildResource(self, site):
     u"""The url refers to a xierpa3 resource, try to find it and answer the result
     with the appropriate mime type."""
     path = TX.path2ParentDirectory(TX.module2Path(xierpa3)) + site.e.request.path
     if os.path.exists(path):
         f = open(path, 'rb')
         result = f.read()
         f.close()
         return result, self.C.MIMETYPE_PNG
     return '', self.C.MIMETYPE_HTML
开发者ID:petrvanblokland,项目名称:Xierpa3,代码行数:12,代码来源:baseclient.py

示例5: getMenu

# 需要导入模块: from xierpa3.toolbox.transformer import TX [as 别名]
# 或者: from xierpa3.toolbox.transformer.TX import module2Path [as 别名]
    def getMenu(self, component, id):
        u"""Answer the list of menu articles in this component."""
        data = Data()
        data.menuItems = []
        article = self.getArticle(component, id)
        if article:
            for menu in article.menu:
                menuArticle = self.getArticle(component, menu.attrib['id'])
                if menuArticle is not None:
                    data.menuItems.append(menuArticle)
        return data
    
    def getLogo(self, component):
        data = Data()
        data.url = '/home'
        data.src = 'http://data.doingbydesign.com.s3.amazonaws.com/_images/logo.png'
        return data

if __name__ == '__main__':
    # Cache the adapter
    from xierpa3.sites import doingbydesign
    fa = FileAdapter(root=TX.module2Path(doingbydesign)+'/files/articles')
    if 0:
        print fa.getIdPaths()
        print fa.getPages(None).items
    if 1: 
        featured = fa.getFeaturedArticles(None, 'home', 3).items
        print featured
        print featured[0].name        
        print featured[0].poster
开发者ID:simons-design,项目名称:Xierpa3,代码行数:32,代码来源:fileadapter.py

示例6: getSiteAdapter

# 需要导入模块: from xierpa3.toolbox.transformer import TX [as 别名]
# 或者: from xierpa3.toolbox.transformer.TX import module2Path [as 别名]
 def getSiteAdapter(self):
     u"""Answer the adapter for this site, including all articles of the DbD site."""
     from xierpa3.sites import doingbydesign
     # Root path where to find the article Simples wiki file for this example page.
     articleRoot = TX.module2Path(doingbydesign) + '/files/articles/'
     return TextileFileAdapter(articleRoot) # Preferred adapter class for articles in this site.
开发者ID:petrvanblokland,项目名称:Xierpa3,代码行数:8,代码来源:make.py

示例7: baseComponents

# 需要导入模块: from xierpa3.toolbox.transformer import TX [as 别名]
# 或者: from xierpa3.toolbox.transformer.TX import module2Path [as 别名]
    def baseComponents(self):        
        logo = Logo()
        menu = Menu()
        socialmedia = SocialMedia(twitterAccount='doingbydesign', facebookAccount='doingbydesign') 

        header = Header(components=(logo,menu), mobileContainerDisplay=self.C.NONE,
            doc_mobileContainerDisplay=u'Header is not visible for mobile')
        mobileNavigation = MobileNavigation() # Is container by itself. Change??
        # Articles featured by image
        #featuredByImage = FeaturedByImage() # Featured article on a page. Main photo+link
        #featuredByImage100 = FeaturedByImage(colWidth=9) # Featured article as group item
        #featuredByImageList = FeaturedByImageList() # Featured article on a page. List of related links
        # Articles featured by summary text
        #featuredSideText = FeaturedByDiapText(colWidth=4, itemStart=1, label='Featured course')
        #featuredByText = FeaturedByText(itemStart=2, showPoster=False)
        #featuredByTextList = FeaturedByTextList(itemStart=5)
        #featuredSideText = Featured(colWidth=4, itemStart=1, label='Featured course')
        #featuredByText = Featured(itemStart=2, showPoster=False)
        #featuredByTextList = Featured(itemStart=5)
        featuredSideText = featuredByImage = featuredByText = featuredByTextList = featuredByImage100 = FeaturedByImage()
        # Featured black container
        BGCOLOR = Color('#323A47')
        featuredImages = FeaturedByImage(class_='featuredImages',
            components=(featuredByImage, featuredSideText),
            containerBackgroundColor=BGCOLOR)
        # Featured text container
        BGCOLOR = Color('#E8E8E8')
        featuredTexts = FeaturedByImage(class_='featuredTexts',
            components=(featuredByText, featuredByTextList),
            containerBackgroundColor=BGCOLOR)
        # Footer group
        footer = Footer(components=(menu,), containerBackgroundColor=self.CSS_FOOTERBGCOLOR)

        # Documentation
        # The documentation class knows how to collect methods and their attributes
        # from components, adapters and builders and build them in an automated
        # documentation site.
        documentation = Documentation()
        
        # Article
        #featuredByTextList = FeaturedByTextList() # Default start at featured index 0
        featuredByTextList = FeaturedByImage() # Default start at featured index 0
        article = Container(class_=self.C.CLASS_ARTICLE,
            containerBackgroundImage=self.URL_BACKGROUNDIMAGE, containerBackgroundRepeat=self.C.REPEAT, 
            components=(Article(), socialmedia, ArticleSideBar(), featuredByTextList))
    
        # Floating items
        thumbnails = ItemGroup(components=(featuredByImage100,))

        # Import current example site, as anchor for the article files.
        from xierpa3.sites import doingbydesign
        # Root path where to find the article Simples wiki file for this example page.
        articleRoot = TX.module2Path(doingbydesign) + '/files/articles/' 
        adapter = DbDAdapter(articleRoot) # Preferred adapter class for articles in this site.
       
        #homePage = Page(name=self.C.TEMPLATE_INDEX,
        #    components=(mobileNavigation, header, featuredImages, featuredTexts, footer),
        #    css=self.C.URL_CSS, fonts=self.C.URL_FONTS, js=self.URL_JAVASCRIPT, 
        #    favicon=self.C.URL_FAVICON, adapter=adapter)

        homePage = Page(name=self.C.TEMPLATE_INDEX,
            components=featuredSideText,
            css=self.C.URL_CSS, fonts=self.C.URL_FONTS, js=self.URL_JAVASCRIPT, 
            favicon=self.C.URL_FAVICON, adapter=adapter)
    
        articlePage = Page(name=self.C.TEMPLATE_ARTICLE,
            components=(mobileNavigation, header, article, footer),
            css=self.C.URL_CSS, fonts=self.C.URL_FONTS, js=self.URL_JAVASCRIPT, 
            favicon=self.C.URL_FAVICON, adapter=adapter)

        thumbnailPage = Page(name=self.TEMPLATE_COURSES,
            components=(mobileNavigation, header, featuredImages, footer),
            css=self.C.URL_CSS, fonts=self.C.URL_FONTS, js=self.URL_JAVASCRIPT, 
            favicon=self.C.URL_FAVICON, adapter=adapter)

        productsPage = Page(name=self.TEMPLATE_PRODUCTS,
            components=(mobileNavigation, header, thumbnails, footer),
            css=self.C.URL_CSS, fonts=self.C.URL_FONTS, js=self.URL_JAVASCRIPT, 
            favicon=self.C.URL_FAVICON, adapter=adapter)

        categoryPage = Page(name=self.TEMPLATE_CATEGORY,
            components=(mobileNavigation, header, footer),
            css=self.C.URL_CSS, fonts=self.C.URL_FONTS, js=self.URL_JAVASCRIPT, 
            favicon=self.C.URL_FAVICON, adapter=adapter)

        # Automatic documentation about Xierpa3
        documentationPage = Page(name=self.C.TEMPLATE_DOCUMENTATION,
            components=(mobileNavigation, header, documentation, footer),
            css=self.C.URL_CSS, fonts=self.C.URL_FONTS, js=self.URL_JAVASCRIPT, 
            favicon=self.C.URL_FAVICON, adapter=adapter)

        return [homePage, articlePage, productsPage, thumbnailPage, categoryPage, documentationPage]
开发者ID:petrvanblokland,项目名称:Xierpa3,代码行数:94,代码来源:doingbydesign_ORG.py


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