Example #1
0
 def test_icon(self):
     iconfonts.register('name', 'iconfont_sample.ttf',
                        'iconfont_sample.fontd')
     r = iconfonts.icon('icon-comment')
     self.assertEqual(
         "[font=iconfont_sample.ttf]%s[/font]" % (unichr(59397)), r)
     r = iconfonts.icon('icon-comment', 20)
     self.assertEqual(
         "[size=20][font=iconfont_sample.ttf]%s[/font][/size]" %
         (unichr(59397)), r)
Example #2
0
 def test_icon(self):
     iconfonts.register('name', 'iconfont_sample.ttf',
                        'iconfont_sample.fontd')
     r = iconfonts.icon('icon-comment')
     self.assertEqual(
         "[font=iconfont_sample.ttf]%s[/font]" % (unichr(59397)), r)
     r = iconfonts.icon('icon-comment', 20)
     self.assertEqual(
         "[size=20][font=iconfont_sample.ttf]%s[/font][/size]" %
         (unichr(59397)), r)
Example #3
0
from kivy.uix.gridlayout import GridLayout
from kivy.uix.scrollview import ScrollView
from kivy.base import runTouchApp

import os
from os.path import join, dirname
import json
import sys
filepath = join(os.getcwd(), __file__)

sys.path.append(dirname(dirname(filepath)))
from iconfonts import register, icon

font_file = join(dirname(__file__), 'font-awesome.fontd')

register('awesome_font', 'font-awesome.ttf', font_file)

with open(font_file, 'r') as f:
    fontd = json.loads(f.read())

scroll = ScrollView(bar_width='24dp')
grid = GridLayout(cols=1, size_hint_y=None, height='40dp')
grid.bind(minimum_height=grid.setter('height'))
scroll.add_widget(grid)

keys = fontd.keys()
keys.sort()
for icon_name in keys:
    lb = Label(markup=True, size_hint_y=None)
    lb.text = '[color=3280ff]%s[/color] ' % (icon(icon_name, 32)) + icon_name
    grid.add_widget(lb)
Example #4
0
 def test_register(self):
     iconfonts.register('name', 'iconfont_sample.ttf',
                        'iconfont_sample.fontd')
     self.assertEqual(iconfonts._register['name'][0], 'iconfont_sample.ttf')
Example #5
0
 def test_register(self):
     iconfonts.register('name', 'iconfont_sample.ttf',
                        'iconfont_sample.fontd')
     self.assertEqual(iconfonts._register['name'][0], 'iconfont_sample.ttf')
Example #6
0
        tryReconnect(None)

    # todo: remove this when profiling is done
    #def on_start(self):
        #self.profile = cProfile.Profile()
        #self.profile.enable()


    def on_stop(self):
        self.saveState(False)
        # todo: remove this when profiling is done
        #self.profile.disable()
        #self.profile.dump_stats(os.path.join(self.get_dataPath(), 'slowresume.profile'))


    def get_dataPath(self):
        try:
            Environment = autoclass('android.os.Environment')
            return os.path.join(Environment.get_running_app().getExternalStorageDirectory(), 'boards')

        # Not on Android
        except:
            return os.path.join(self.user_data_dir, 'boards')

iconfonts.register('default_font', 'iconfonts/fontawesome-webfont.ttf', 'iconfonts/font-awesome.fontd')

Application = attDashApp()

if __name__ == '__main__':
    sm.loadSkins('skins')
    Application.run()
Example #7
0
# Set up GPIO:
speed = 1.0
beepPin = 17
ledPin = 27
buttonPin = 22
flashLedPin = 10
#GPIO.setmode(GPIO.BCM)
#GPIO.setup(beepPin, GPIO.OUT)
#GPIO.output(beepPin, GPIO.LOW)
#GPIO.setup(ledPin, GPIO.OUT)
#GPIO.output(ledPin, GPIO.LOW)
#GPIO.setup(flashLedPin, GPIO.OUT)
#GPIO.output(flashLedPin, GPIO.LOW)
#GPIO.setup(buttonPin, GPIO.IN, pull_up_down=GPIO.PUD_UP)
iconfonts.register('default_font',
                   join(dirname(__file__), 'fonts/fa-light-300.ttf'),
                   join(dirname(__file__), 'font-awesome.fontd'))
# Define some helper functions:
defaultKeyCode = 0
reader = SimpleMFRC522()
trackImage = AsyncImage(
    source='https://dummyimage.com/300x400/000/fff.png&text=Track+image')
trackTitle = Label(text='')
trackAlbumTitle = Label(text='')
trackPlayPauseBtn = Button(size_hint=(None, None),
                           size=(40, 40),
                           markup=True,
                           text="%s" % (iconfonts.icon('fa-play', 32)))
currentTrackIsPlay = False

Example #8
0
from app.models import db
from app.util import TELAS
from app.views.configuracao import Configuracao
from app.views.contatos import (TelaContatos, TelaEditarContato,
                                TelaNovoContato, TelaVisualizarContato)
from app.views.inicio import Home
from app.views.sobre import Sobre
from app.views.transacoes import (TelaNovaTransacao, TelaTransacoes,
                                  TelaVisualizarTransacao, TelaEditarTransacao)
from iconfonts import create_fontdict_file, register
from settings import ICONFONTS, FONTS, LOCALE

for font in ICONFONTS:
    create_fontdict_file(font['css'], font['fontd'])
    register(font['name'], font['prefix'], font['ttf'], font['fontd'])

for font in FONTS:
    LabelBase.register(**font)


class MyRootLayout(NavigationLayout):
    def __init__(self, **kwargs):
        super(MyRootLayout, self).__init__(**kwargs)
        self.pp = App.get_running_app()

    def switch_to(self, screen, **kwargs):
        if screen == TELAS.INICIO:
            self.ids.scr_mngr.switch_to(Home(name=screen.name))

        elif screen == TELAS.LISTA_CONTATO: