def testIcons(self):
     '''
     test getting the bootstrap Icons File
     '''
     if getpass.getuser() == "travis":
         return
     iconsFile = Icon.getBootstrapIconsFile()
     self.assertTrue(iconsFile is not None)
     iconNames = Icon.getBootstrapIconsNames()
     self.assertTrue(len(iconNames) > 1000)
     pass
 def widgets(self):
     '''
     test widgets 
     '''
     widgetList=[
         [
             Link("https://github.com/WolfgangFahl/pyFlaskBootstrap4","pyFlaskBootstrap4","Extended Flask + Bootstrap4 Library"),
             Link("http://wiki.bitplan.com/index.php/PyFlaskBootstrap4","Wiki","pyFlaskBootstrap4 wiki"),
             Link("https://github.com/greyli/bootstrap-flask","bootstrap-flask","Flask + Bootstrap4 Library by Grey Li"),
             Link("https://palletsprojects.com/p/flask/","flask","web application framework"),
             Link("https://getbootstrap.com/","bootstrap","Open source web toolkit")
         ],
         [
             Image("https://upload.wikimedia.org/wikipedia/commons/thumb/3/35/Tux.svg/299px-Tux.svg.png",alt="Tux",height=150,title='Tux - the Linux kernel penguin mascot'),
             Image("https://upload.wikimedia.org/wikipedia/commons/thumb/e/e9/Eiffel_Tower_Paris.jpg/180px-Eiffel_Tower_Paris.jpg",alt="Eiffel Tower",height=150,title='Eiffel Tower, Paris'),
             Image("https://upload.wikimedia.org/wikipedia/commons/thumb/4/47/Croce-Mozart-Detail.jpg/185px-Croce-Mozart-Detail.jpg",alt="Mozart",height=150,title='Wolfgang Amadeus Mozart'),
             Image("https://upload.wikimedia.org/wikipedia/commons/thumb/7/78/The_Blue_Marble.jpg/240px-The_Blue_Marble.jpg",alt="Earth",width=150,title='Earth as seen from Apollo 17 mission')
         ],    
         [
             Icon("award"),Icon("battery"),Icon("book"),Icon("heart"),
             Icon("calculator",size=48),Icon("person",size=48,color='red'),
             Icon("wifi",size=64),Icon("wrench",size=64)
         ]    
     ]
     return render_template('widgets.html',widgetList=widgetList)
 def initIcons(self):
     '''
     initialize the icons
     '''
     iconNames = Icon.getBootstrapIconsNames()
     for index, iconName in enumerate(iconNames):
         bootstrapIcon = BootstrapIcon(id=iconName, index=index + 1)
         self.db.session.add(bootstrapIcon)
     self.db.session.commit()
Example #4
0
 def wikis(self) -> str:
     '''
     render the wikis table
     
     Returns:
         str: the html code for the table of wikis
     '''
     wikiUsers = WikiUser.getWikiUsers()
     dictList = []
     for wikiUser in wikiUsers.values():
         url="%s%s/" % (wikiUser.url,wikiUser.scriptPath)
         wikiBackup=WikiBackup(wikiUser)
         dictList.append({
             'wikiId': Link(url,wikiUser.wikiId),
             'url': Link(wikiUser.url,wikiUser.url),
             'scriptPath':wikiUser.scriptPath,
             'version':wikiUser.version,
             'backup': "✅" if wikiBackup.exists() else "❌",
             'git': Icon("github",32) if wikiBackup.hasGit() else ""
         })
     menuList=self.adminMenuList("Wikis")      
     html = render_template("tableview.html", menuList=menuList,title="Wikis", dictList=dictList)
     return html    
 def icon(self):
     myIcon = Icon(self.id)
     myIcon.userdata['#'] = self.index
     return myIcon
    def widgets(self):
        '''
        test widgets 
        '''
        dropDownMenu = DropDownMenu("Links")
        dropDownMenu.addItem(Link("http://www.bitplan.com", "BITPlan Website"))
        dropDownMenu.addItem(
            Link("https://bootstrap-flask.readthedocs.io/", "Docs"))
        dropDownMenu.addItem(
            Link("https://github.com/WolfgangFahl/pyFlaskBootstrap4",
                 "github"))
        dropDownMenu.addItem(Link("https://getbootstrap.com/", "bootstrap"))

        menu = Menu()
        menu.addItem(MenuItem("http://wiki.bitplan.com", "BITPlan Wiki", True))
        menu.addItem(
            MenuItem("https://bootstrap-flask.readthedocs.io/", "Docs"))
        menu.addItem(
            MenuItem(
                "https://github.com/WolfgangFahl/pyFlaskBootstrap4",
                "github",
            ))
        menu.addItem(dropDownMenu)

        lodDataGenerator = lambda n: [
            {
                'text': f'Text message {i}',
                'author': f"Author {i}",
                "Category": f"Category {i}",
                "create time": datetime.now() + timedelta(days=i)
            } for i in range(n)
        ]
        lodTable = LodTable(lodDataGenerator(5))
        lodDataTable = LodTable(lodDataGenerator(500), isDatatable=True)

        widgetList = [
            [
                Link("https://github.com/WolfgangFahl/pyFlaskBootstrap4",
                     "pyFlaskBootstrap4",
                     "Extended Flask + Bootstrap4 Library",
                     newTab=True),
                Link("http://wiki.bitplan.com/index.php/PyFlaskBootstrap4",
                     "Wiki",
                     "pyFlaskBootstrap4 wiki",
                     newTab=True),
                Link("https://github.com/greyli/bootstrap-flask",
                     "bootstrap-flask",
                     "Flask + Bootstrap4 Library by Grey Li",
                     newTab=True),
                Link("https://palletsprojects.com/p/flask/",
                     "flask",
                     "web application framework",
                     newTab=True),
                Link("https://getbootstrap.com/",
                     "bootstrap",
                     "Open source web toolkit",
                     newTab=True),
                Link("https://fonts.google.com/icons",
                     "Google material icons",
                     newTab=True)
            ],
            [
                Image(
                    "https://upload.wikimedia.org/wikipedia/commons/thumb/3/35/Tux.svg/299px-Tux.svg.png",
                    alt="Tux",
                    height=150,
                    title='Tux - the Linux kernel penguin mascot'),
                Image(
                    "https://upload.wikimedia.org/wikipedia/commons/thumb/e/e9/Eiffel_Tower_Paris.jpg/180px-Eiffel_Tower_Paris.jpg",
                    alt="Eiffel Tower",
                    height=150,
                    title='Eiffel Tower, Paris'),
                Image(
                    "https://upload.wikimedia.org/wikipedia/commons/thumb/4/47/Croce-Mozart-Detail.jpg/185px-Croce-Mozart-Detail.jpg",
                    alt="Mozart",
                    height=150,
                    title='Wolfgang Amadeus Mozart'),
                Image(
                    "https://upload.wikimedia.org/wikipedia/commons/thumb/7/78/The_Blue_Marble.jpg/240px-The_Blue_Marble.jpg",
                    alt="Earth",
                    width=150,
                    title='Earth as seen from Apollo 17 mission')
            ],
            [
                Icon("award"),
                Icon("battery"),
                Icon("book"),
                Icon("heart"),
                Icon("calculator", size=48),
                Icon("person", size=48, color='red'),
                Icon("wifi", size=64),
                Icon("wrench", size=64)
            ], [menu], [dropDownMenu], [lodTable, lodDataTable]
        ]
        return self.render_template('widgets.html', widgetList=widgetList)