Beispiel #1
0
    def __init__(self):

        # Check and see if constants rebinding is unsuccessful
        try:
            constants.REBIND_CHECK = False
        except const.ConstError:
            Logger.info("ENV: Environment constants are secure.")
        else:
            raise Exception("Error with environment setup.")

        # Environment
        self.env_dict = {}
        # Create cache
        Cache.register(category='envcache', limit=2)

        # Populate constants
        for attr in dir(constants):
            if attr.isupper():
                self.env_dict[attr] = str(
                    getattr(constants, attr)
                ).encode('string_escape')
                
        # Initiate memory tracker
        if constants.PYMPLER_AVAILABLE:
            self.mem_tracker = tracker.SummaryTracker()
Beispiel #2
0
    def gen_cards(self):
        """
        Method which generate cards with ico projects description.
        :return:
        """
        # Check for active category button.
        if self.last_category_btn is None:
            self.upcoming._active = True

        self.grid_box.bind(minimum_height=self.grid_box.setter('height'))

        # Get active category.
        cat = self.last_category_btn.text.lower() if self.last_category_btn is not None \
            else self.upcoming.text.lower()

        # Get url content.
        url = 'http://127.0.0.1:8000/ico/icobazaar&cat={}&limit=150&skip=0'.format(
            cat)
        icos_lst = utils.get_url_content(url)

        # Clear widgets and generate cards.
        self.grid_box.clear_widgets()
        import gc
        gc.collect()

        for ico_data in icos_lst:
            card = CardIcoBazaar(ico_data)
            self.grid_box.add_widget(card)

        # Set categories box object into cache.
        Cache.register('menu_cats_box')
        Cache.append('menu_cats_box', 'cats_box_obj', self.cats_box)
Beispiel #3
0
    def setdefaults_config():
        Cache.register(CACHE_NAME, limit=1000)
        store = Store()
        store.register_all_table()

        store.set_rm(1000)
        store.add_cache_bike('Default')
        store.add_cache_map('Default')
Beispiel #4
0
    def build(self):
        Cache.register('settings', 10, None)

        self.sm.add_widget(MainMenuScreen(name='main_menu'))
        self.sm.add_widget(SettingsScreen(name='settings'))
        self.sm.add_widget(CreditsScreen(name='credits'))
        self.sm.add_widget(PlayingScreen(name='playing'))
        return self.sm
Beispiel #5
0
def database():
        """ open/read Redelitoral's database
            sea level's plot from database
        """
        # communicate with Redelitoral database
        try:
        	con=mysql.connector.connect(host='54.204.23.126', port=3306, user='******', passwd='m@r3gr2af0', db='maregrafo')
        	cur = con.cursor()
        	cur.execute("SELECT * FROM medida")
        	rows = cur.fetchall()
        except mysql.connector.Error as err:
  		if err.errno == errorcode.ER_ACCESS_DENIED_ERROR:
    		   print("Something is wrong with your user name or password")
  		elif err.errno == errorcode.ER_BAD_DB_ERROR:
    		   print("Database does not exists")
  		else:
                   print(err)
	else:
  		con.close()
        # saving data in a list  
        data = []
        for r in rows:
                data.append(r)
        #select only last 3 days data
        sea_level,sea_mean,min10 =[],[],432
        sea_level = [data[e][3] for e in range(data[-1][0]- min10+1,data[-1][0])]
        #sea_mean =np.mean([data[e][3] for e in range(len(data))])
	sea_mean = np.mean(sea_level)
        # date for axis
        tlast = data[-1][2].strftime('%H:%I %m/%d/%Y')
        tmean = data[-min10/2][2].strftime('%H:%I %m/%d/%Y')
        t0 = data[-min10+1][2].strftime('%H:%I %m/%d/%Y')
        n0,nlast,nmean = 0,min10+1,min10/2
        # plots  
        plot_mean= [sea_mean]* (min10+1)
        fig = plt.figure(figsize=(5,4),dpi=200)
        ax = fig.add_subplot(111)
        ax.plot(sea_level,'bo')
        ax.plot(plot_mean,'b--')
        ax.set_ylim([0.5, 2.0])
        ax.set_xlim([0,min10+2])
        ax.set_xticks([n0,nmean,nlast])
        ax.set_xticklabels([t0,tmean,tlast])
        # annotate min and max values from the last 3 days 
        id_max=np.where(sea_level==np.max(sea_level))[0][0]
        id_min=np.where(sea_level==np.min(sea_level))[0][0]
        plt.text(id_max-5,sea_level[id_max]+0.07, '%s'%sea_level[id_max],fontsize=10)
        plt.text(id_max-5,sea_level[id_max]+0.14, 'max',fontsize=10)
        plt.text(id_min-5,sea_level[id_min]-0.07, '%s'%sea_level[id_min],fontsize=10)
        plt.text(id_min-5,sea_level[id_min]-0.14, 'min',fontsize=10)
        plt.text(min10-50,sea_mean-0.1, 'mean',fontsize=10)
        # title and legend
        ax.set_ylabel('Meters',fontsize=10)
        ax.set_xlabel('Date',fontsize=10)
        plt.title('Sea level for the last 3 days')  
        savefig('fig_data.png', bbox_inches='tight')
        Cache.register('fig_data.png', limit=10, timeout=5) 
        return
Beispiel #6
0
    def set_app(self):
        Cache.register('bike')
        Cache.register('map')
        Cache.remove('bike', 'rm')
        Cache.append('bike', 'rm', RM)

        self.sm = ScreenManager(transition=WipeTransition())
        self.sm.add_widget(MenuScreen(name='menu'))
        self.sm.add_widget(GameScreen(name='game'))
        self.render(self.sm)
    def __init__(self, canvas):
        self._canvas = canvas

        self._texture_handlers = {}
        self._factory = RendererFactory(self._canvas, '', self.load_texture)

        self._lwfs = {}
        self._paths = {}
        self._destroy = []
        self._debug = False

        Cache.register('lwf_data', 10, 120)
Beispiel #8
0
    def __init__(self, **kwargs):
        super(PopupCM, self).__init__(**kwargs)

        self.size_hint = (None, None)
        self.auto_dismiss = True
        self.size = (350, 600)

        self.separator_color = self.theme_cls.primary_color

        # Add popup obj to cache.
        Cache.register('main_popup')
        Cache.append('main_popup', 'popup_obj', self)
Beispiel #9
0
 def __init__(self):
     Cache.register("HMS")
     if self._store.exists("client_token"):
         client_token = self._store.get("client_token")
         if client_token["expires_at"] > time():
             Logger.debug(
                 "HMS: __init__: loaded client_token from JsonStore")
             Cache.append(
                 "HMS",
                 "client_token",
                 client_token,
                 client_token["expires_at"] - time(),
             )
Beispiel #10
0
    def set_app(self):
        BaseGameScreenGUITest.setdefaults_config()
        Cache.register(CACHE_NAME, limit=1000)

        self.manager = ScreenManager(transition=WipeTransition())
        self.manager.add_widget(StartScreen(name='start'))
        self.manager.add_widget(GameScreen(name='game'))
        self.render(self.manager)

        screen = ValidObject.screen(self.manager.get_screen('game'))
        self.road = screen.ids['road']
        self.bike = screen.ids['bike']
        self.road.bike = self.bike
        self.bike.speed = 0
Beispiel #11
0
Datei: main.py Projekt: fresk/shs
    def build(self):

        Cache.register("kv.image", limit=32, timeout=5)
        Cache.register("kv.texture", limit=32, timeout=5)

        self.root = self.viewport = Viewport(size=(2048, 1536))
        self.ensure_directories()
        self.load_questions()

        self.screen_manager = ScreenManager(transition=FadeTransition(duration=0.3))
        self.screen_manager.add_widget(IntroScreen(name="intro"))
        t = Thread(target=load_string_index, args=(self,))
        t.start()

        return self.root
Beispiel #12
0
    def __init__(self, app, **kwargs):
        self._initialized = False
        self.app = app
        super().__init__(**kwargs)

        Cache.register('screens', 20, 60 * 10)

        self.transition = FadeTransition(duration=0.25)
        self.whitelist = []
        self.list = []

        self._create_screen('start_game')
        self.current = 'start_game'

        self._initialized = True
Beispiel #13
0
 def build(self):
     """Build."""
     self.icon = 'icon.png'
     try:
         req = requests.get('https://tolstoj48.pythonanywhere.com/appis/tymy/')
     except:
         self.pop_up_no_connection()
     else:
         self.pop_up()
         result = req.json()
         Cache.register('tymy', limit=1, timeout=20)
         key = "tymy_vysledky"
         instance = result
         Cache.append("tymy", key, instance)
         self.manager = ManagerScreen()
         self.url_req()
         return self.manager
    def initialize(self, loader):
        keys = LOADING_LAYERS
        self._data = {}
        for key in keys:
            self._data[key] = loader.get(key)
        for perk_id in self._data['perks']:
            self._unlocked_perks[perk_id] = False

        Cache.register('preview.slides', 25, 60)

        self._market = Market()
        self._quest_manager = QuestManager()
        self._crafting_queue = CraftingQueue()
        self._load_items(self._data['items'])

        self.generate_equipment_market_prices()

        for item_id, price_tracker in self._data['market_prices'].items():
            self._market.add_item_to_market(item_id, price_tracker)
Beispiel #15
0
    def build(self):
        #salva ate 10 valores com tempo de vida 60 de segundos
        Cache.register('mycache', limit=10, timeout=60)

        # id da cache
        key = 'objectid'
        # objeto a ser salvo
        objeto = Label(text='CACHE')

        # salvando no cache
        Cache.append('mycache', key, objeto)

        # retorna valor do cache
        instance = Cache.get('mycache', key)

        #remove do cahce
        Cache.remove('mycache', key)

        return instance
Beispiel #16
0
    def __init__(self, **kwargs):

        print('PresSPalsh INIT  ??????????????????????????')

        super(PostSplashLoading, self).__init__(**kwargs)

        MainV.add_to_screen_stack(self, self)

        print('this is id {}'.format(self.__class__.__name__))

        ViewControl.t = 0
        # pb = ProgressBar(value=0,max=1000)

        self.event_trig = Clock.schedule_interval(partial(self.update), 1 / 60)
        self.event_trig()

        Cache.register('mycache', limit=10, timeout=None)
        self.key = 'objectid'
        instance = self
        Cache.append('mycache', self.key, instance)
Beispiel #17
0
 def __init__(self, name, *navigate_screens):
     super(WebImagesMenu, self).__init__(name, *navigate_screens)
     self.conf_parser = ConfigParser()
     self.conf_parser.read('settings.ini')
     self.host = self.conf_parser['host_settings']['host_ip']
     self.port = self.conf_parser['host_settings']['host_port']
     self.items_amount = 0
     self.cur_img = 1
     self.loaded_images = []
     self.theme_cls = ThemeManager()
     self.theme_cls.primary_palette = 'Yellow'
     self.theme_cls.accent_palette = 'Red'
     Cache.register('json_cache', timeout=180)
     box = BoxLayout(orientation='vertical',
                     spacing=15,
                     padding=20,
                     size_hint_y=.2)
     self.lower_panel.add_widget(box)
     scan_button = Button(text='Scan for content',
                          on_press=self.scan_content_callback,
                          size_hint_y=.2)
     box.add_widget(scan_button)
Beispiel #18
0
    def on_event(self, obj):
        """
        Event method which fired when clicked on category button.
        This method change set active color to button and remove active color from last pressed.
        :param obj:
        :return:
        """
        try:
            self.last_category_btn._active = False
            self.last_category_btn = obj
        except AttributeError:
            pass

        obj._active = True
        self.last_category_btn = obj

        # Add object text to cache.
        Cache.register('popup')
        Cache.append('popup', 'cat_text', obj.text)

        # Get popup obj from cache and dismiss popup.
        popup_obj = Cache.get('main_popup', 'popup_obj')
        popup_obj.dismiss()
Beispiel #19
0
__all__ = ("Loader", "LoaderBase", "ProxyImage")

from kivy import kivy_data_dir, kivy_base_dir
from kivy.logger import Logger
from kivy.clock import Clock
from kivy.cache import Cache
from kivy.core.image import ImageLoader, Image

from collections import deque
from time import sleep
from os.path import join
from os import write, close, unlink, environ

# Register a cache for loader
Cache.register("kivy.loader", limit=500, timeout=60)


class ProxyImage(Image):
    """Image returned by the Loader.image() function.

    :Properties:
        `loaded`: bool, default to False
            It can be True if the image is already cached

    :Events:
        `on_load`
            Fired when the image is loaded and changed
    """

    def __init__(self, arg, **kwargs):
Beispiel #20
0
            J1=9     J2=12    J3=31    J4=34    J5=53    J6=56    J7=75    J8=78    J9=97    J10=100    J11=119    J12=122    J13=141    J14=144    J15=163    J16=166    J17=185    J18=188
             |         |        |        |        |        |        |        |        |         |          |          |          |          |          |          |          |          |
            K1=10----K2=11    K3=32----K4=33    K5=54----K6=55    K7=76----K8=77    K9=98----K10=99     K11=120----K12=121    K13=142----K14=143    K15=164----K16=165    K17=186----K18=187


'''
'''
Globals
'''
count = 0
global LED_ROUTE_IMAGES, problemButton, Routes, filterBox, FilterLabel, filteredCommandStr, orderCommandStr, addedCommandStr, pageIndex
LED_ROUTE_IMAGES = [None] * 228
'''
In order to not have to access the SD card which can be slow, here we make sure everything stays in the cache increasing performance. (Hopefully)
'''
Cache.register('kv.image', limit=None, timeout=None)

# Window.fullscreen = 'auto'
LED_COUNT = 198
LED_PIN = 18
LED_FREQ_HZ = 800000
LED_DMA = 5
LED_BRIGHTNESS = 255
LED_INVERT = False
LED_CHANNEL = 0

#LED_STRIP = ws.WS2811_STRIP_GRB
#strip = Adafruit_NeoPixel(LED_COUNT, LED_PIN, LED_FREQ_HZ, LED_DMA, LED_INVERT, LED_BRIGHTNESS, LED_CHANNEL, LED_STRIP)
#strip.begin()

Beispiel #21
0
from collections import deque
from threading import Condition, Thread, Event
#from httplib import HTTPConnection
from urllib2 import urlopen
from random import randint

from projections import *

### static configuration - TODO: parametrize ####################################
# number of threads to use
TILESERVER_POOLSIZE = 10
TILESERVER_MAXPIPELINE = 2
#################################################################################

### init cache - TODO: parametrize ##############################################
Cache.register('tileserver.tiles', limit=10, timeout=10) #1000/10000
Cache.register('tileserver.tilesalpha', limit=10, timeout=10)
#################################################################################

class TileServer(object):
    '''Base implementation for a tile provider.
    Check GoogleTileServer and YahooTileServer if you intend to use more
    '''
    provider_name = 'unknown'
    providers = dict()
    
    @staticmethod
    def register(cls):
        TileServer.providers[cls.provider_name] = cls

    def __init__(self, poolsize=TILESERVER_POOLSIZE):
Beispiel #22
0
"""
SVG
===

Abstraction layer for loading SVG files.
"""

__all__ = ("Svg",)

from kivy.core import core_register_libs
from kivy.cache import Cache

Cache.register("kivy.svg", limit=50)


class SvgBase(object):
    """Base to implement an svg loader."""

    __slots__ = ("filename",)

    def __init__(self, filename, **kwargs):
        self.filename = filename

        self.svg_data = Cache.get("kivy.svg", filename)
        if not self.svg_data:
            new_svg = self.load(filename)
            Cache.append("kivy.svg", filename, new_svg)
            self.svg_data = new_svg

    def load(self, filename):
        """Load an svg"""
Beispiel #23
0
import kivy.lang.builder  # imported as absolute to avoid circular import
from kivy.logger import Logger
from kivy.cache import Cache
from kivy import require
from kivy.resources import resource_find
from kivy.utils import rgba
import kivy.metrics as Metrics

__all__ = ("Parser", "ParserException")


trace = Logger.trace
global_idmap = {}

# register cache for creating new classtype (template)
Cache.register("kv.lang")

# all previously included files
__KV_INCLUDES__ = []

# precompile regexp expression
lang_str = re.compile(
    "((?:'''.*?''')|"
    "(?:(?:(?<!')|''')'(?:[^']|\\\\')+?'(?:(?!')|'''))|"
    '(?:""".*?""")|'
    '(?:(?:(?<!")|""")"(?:[^"]|\\\\")+?"(?:(?!")|""")))',
    re.DOTALL,
)
lang_key = re.compile("([a-zA-Z_]+)")
lang_keyvalue = re.compile("([a-zA-Z_][a-zA-Z0-9_.]*\.[a-zA-Z0-9_.]+)")
lang_tr = re.compile("(_\()")
Beispiel #24
0
# -*- coding: utf-8 -*-
__all__ = ('CodeInput', )

from pygments import highlight
from pygments.lexers import PythonLexer
from pygments.formatters import BBCodeFormatter

from kivy.uix.textinput import TextInput
from kivy.uix.label import Label
from kivy.cache import Cache
from kivy.properties import BooleanProperty
from kivy.factory import Factory

Cache.register('codeinput.label.width', timeout=260.)
Cache.register('codeinput.label', timeout=260.)

# TODO: use a config/rc file kivy config ?? for highlighting
# TODO: color chooser new styli
# TODO: use utf8 every where
# TODO: fix unicode keyboard input # kde issue
# TODO: undo
# TODO: fix scroll while deletion
# Known Issue pasting text is slow
# selecting text is slow


class CodeInput(TextInput):
    '''CodeInput class, see module documentation for more information.

    :Events:
        `ccc`
Beispiel #25
0
#Factory.register('OutputItem', module='electrum_dash_gui.kivy.uix.dialogs')

from .uix.dialogs.installwizard import InstallWizard
from .uix.dialogs import InfoBubble
from .uix.dialogs import OutputList, OutputItem

#from kivy.core.window import Window
#Window.softinput_mode = 'below_target'

# delayed imports: for startup speed on android
notification = app = ref = None
util = False

# register widget cache for keeping memory down timeout to forever to cache
# the data
Cache.register('electrum_dash_widgets', timeout=0)

from kivy.uix.screenmanager import Screen
from kivy.uix.tabbedpanel import TabbedPanel
from kivy.uix.label import Label
from kivy.core.clipboard import Clipboard

Factory.register('TabbedCarousel', module='electrum_dash_gui.kivy.uix.screens')

# Register fonts without this you won't be able to use bold/italic...
# inside markup.
from kivy.core.text import Label
Label.register('Roboto', 'gui/kivy/data/fonts/Roboto.ttf',
               'gui/kivy/data/fonts/Roboto.ttf',
               'gui/kivy/data/fonts/Roboto-Bold.ttf',
               'gui/kivy/data/fonts/Roboto-Bold.ttf')
Beispiel #26
0
#Factory.register('OutputItem', module='electrum_gui.kivy.uix.dialogs')

from .uix.dialogs.installwizard import InstallWizard
from .uix.dialogs import InfoBubble
from .uix.dialogs import OutputList, OutputItem

#from kivy.core.window import Window
#Window.softinput_mode = 'below_target'

# delayed imports: for startup speed on android
notification = app = ref = None
util = False

# register widget cache for keeping memory down timeout to forever to cache
# the data
Cache.register('electrum_mona_widgets', timeout=0)

from kivy.uix.screenmanager import Screen
from kivy.uix.tabbedpanel import TabbedPanel
from kivy.uix.label import Label
from kivy.core.clipboard import Clipboard

Factory.register('TabbedCarousel', module='electrum_mona_gui.kivy.uix.screens')

# Register fonts without this you won't be able to use bold/italic...
# inside markup.
from kivy.core.text import Label

Label.register('Roboto', 'gui/kivy/data/fonts/Roboto.ttf',
               'gui/kivy/data/fonts/Roboto.ttf',
               'gui/kivy/data/fonts/Roboto-Bold.ttf',
Beispiel #27
0
from kivy.clock import Clock
from kivy.atlas import Atlas
from kivy.resources import resource_find
from kivy.utils import platform
from kivy.compat import string_types
import zipfile
try:
    import cio as SIO
except ImportError:
    import io as SIO

# late binding
Texture = TextureRegion = None

# register image caching only for keep_data=True
Cache.register('kv.image', timeout=60)
Cache.register('kv.atlas')


class ImageData(object):
    '''Container for images and mipmap images.
    The container will always have at least the mipmap level 0.
    '''

    __slots__ = ('fmt', 'mipmaps', 'source', 'flip_vertical')
    _supported_fmts = ('rgb', 'rgba', 'bgr', 'bgra', 's3tc_dxt1', 's3tc_dxt3',
                       's3tc_dxt5', 'pvrtc_rgb2', 'pvrtc_rgb4', 'pvrtc_rgba2',
                       'pvrtc_rgba4', 'etc1_rgb8')

    def __init__(self,
                 width,
Beispiel #28
0
from .uix.dialogs.installwizard import InstallWizard
from .uix.dialogs import InfoBubble, crash_reporter
from .uix.dialogs import OutputList, OutputItem
from .uix.dialogs import TopLabel, RefLabel

#from kivy.core.window import Window
#Window.softinput_mode = 'below_target'

# delayed imports: for startup speed on android
notification = app = ref = None
util = False

# register widget cache for keeping memory down timeout to forever to cache
# the data
Cache.register('electrum_ltc_widgets', timeout=0)

from kivy.uix.screenmanager import Screen
from kivy.uix.tabbedpanel import TabbedPanel
from kivy.uix.label import Label
from kivy.core.clipboard import Clipboard

Factory.register('TabbedCarousel', module='electrum_ltc_gui.kivy.uix.screens')

# Register fonts without this you won't be able to use bold/italic...
# inside markup.
from kivy.core.text import Label

Label.register('Roboto', 'gui/kivy/data/fonts/Roboto.ttf',
               'gui/kivy/data/fonts/Roboto.ttf',
               'gui/kivy/data/fonts/Roboto-Bold.ttf',
This module is responsible for getting the conversion rates from different
bitcoin exchanges.
'''

import decimal
import json

from kivy.network.urlrequest import UrlRequest
from kivy.event import EventDispatcher
from kivy.properties import (OptionProperty, StringProperty, AliasProperty,
    ListProperty)
from kivy.clock import Clock
from kivy.cache import Cache

# Register local cache
Cache.register('history_rate', timeout=220)

EXCHANGES = ["BitcoinAverage",
             "BitcoinVenezuela",
             "BitPay",
             "Blockchain",
             "BTCChina",
             "CaVirtEx",
             "Coinbase",
             "CoinDesk",
             "LocalBitcoins",
             "Winkdex"]

HISTORY_EXCHNAGES = ['Coindesk',
                     'Winkdex',
                     'BitcoinVenezuela']
Beispiel #30
0
from kivy.cache import Cache
from kivy.core.text import Label
from kivy.uix.widget import Widget
from kivy.uix.bubble import Bubble
from kivy.graphics import Color, Rectangle
from kivy.properties import (
    StringProperty,
    NumericProperty,
    ReferenceListProperty,
    BooleanProperty,
    AliasProperty,
    ListProperty,
    ObjectProperty,
)

Cache.register("textinput.label", timeout=60.0)

FL_IS_NEWLINE = 0x01

# late binding
Clipboard = None


class TextInputCutCopyPaste(Bubble):
    # Internal class used for showing the little bubble popup when
    # copy/cut/paste happen.

    textinput = ObjectProperty(None)

    def do(self, action):
        textinput = self.textinput
            K1=10----K2=11    K3=32----K4=33    K5=54----K6=55    K7=76----K8=77    K9=98----K10=99     K11=120----K12=121    K13=142----K14=143    K15=164----K16=165    K17=186----K18=187


'''
'''
Globals
'''
count = 0
global LED_ROUTE_IMAGES, problemButton, Routes, filterBox, FilterLabel, filteredCommandStr, orderCommandStr, addedCommandStr, pageIndex
LED_ROUTE_IMAGES = [None] * 228


##ASSIGN ALL THE PHOTOS TO AN OBJECT SO WE DON'T ACCESS THE DISK ANYMORE##
im = CoreImage("images/2017/moon-0-0.png")

Cache.register('moonboardCache', limit=1000, timeout=999999)
Cache.register('kv.image', limit=None, timeout=None)

# Window.fullscreen = 'auto'
LED_COUNT = 198
LED_PIN = 18
LED_FREQ_HZ = 800000
LED_DMA = 5
LED_BRIGHTNESS = 255
LED_INVERT = False
LED_CHANNEL = 0


#LED_STRIP = ws.WS2811_STRIP_GRB
#strip = Adafruit_NeoPixel(LED_COUNT, LED_PIN, LED_FREQ_HZ, LED_DMA, LED_INVERT, LED_BRIGHTNESS, LED_CHANNEL, LED_STRIP)
#strip.begin()
Beispiel #32
0
#Factory.register('OutputItem', module='electrum_gui.kivy.uix.dialogs')

from .uix.dialogs.installwizard import InstallWizard
from .uix.dialogs import InfoBubble
from .uix.dialogs import OutputList, OutputItem

#from kivy.core.window import Window
#Window.softinput_mode = 'below_target'

# delayed imports: for startup speed on android
notification = app = ref = None
util = False

# register widget cache for keeping memory down timeout to forever to cache
# the data
Cache.register('electrummlm_widgets', timeout=0)

from kivy.uix.screenmanager import Screen
from kivy.uix.tabbedpanel import TabbedPanel
from kivy.uix.label import Label
from kivy.core.clipboard import Clipboard

Factory.register('TabbedCarousel', module='electrum_mlm_gui.kivy.uix.screens')

# Register fonts without this you won't be able to use bold/italic...
# inside markup.
from kivy.core.text import Label
Label.register('Roboto', 'gui/kivy/data/fonts/Roboto.ttf',
               'gui/kivy/data/fonts/Roboto.ttf',
               'gui/kivy/data/fonts/Roboto-Bold.ttf',
               'gui/kivy/data/fonts/Roboto-Bold.ttf')
Beispiel #33
0
from kivy.logger import Logger
from kivy.clock import Clock
from kivy.cache import Cache
from kivy.core.image import ImageLoader, Image
from kivy.compat import PY2, string_types
from kivy.config import Config

from collections import deque
from time import sleep
from os.path import join
from os import write, close, unlink, environ
import threading
import mimetypes

# Register a cache for loader
Cache.register('kv.loader', limit=500, timeout=60)


class ProxyImage(Image):
    '''Image returned by the Loader.image() function.

    :Properties:
        `loaded`: bool, defaults to False
            This value may be True if the image is already cached.

    :Events:
        `on_load`
            Fired when the image is loaded or changed.
        `on_error`
            Fired when the image cannot be loaded.
            `error`: Exception data that ocurred
             |         |        |        |        |        |        |        |        |         |          |          |          |          |          |          |          |          |
            K1=10----K2=11    K3=32----K4=33    K5=54----K6=55    K7=76----K8=77    K9=98----K10=99     K11=120----K12=121    K13=142----K14=143    K15=164----K16=165    K17=186----K18=187


'''
'''
Globals
'''
count = 0
global LED_ROUTE_IMAGES, problemButton, Routes, filterBox, FilterLabel, filteredCommandStr, orderCommandStr, addedCommandStr, pageIndex
LED_ROUTE_IMAGES = [None] * 228

'''
In order to not have to access the SD card which can be slow, here we make sure everything stays in the cache increasing performance. (Hopefully)
'''
Cache.register('kv.image', limit=None, timeout=None)

# Window.fullscreen = 'auto'
LED_COUNT = 198
LED_PIN = 18
LED_FREQ_HZ = 800000
LED_DMA = 5
LED_BRIGHTNESS = 255
LED_INVERT = False
LED_CHANNEL = 0


# LED_STRIP = ws.WS2811_STRIP_GRB
# strip = Adafruit_NeoPixel(LED_COUNT, LED_PIN, LED_FREQ_HZ, LED_DMA, LED_INVERT, LED_BRIGHTNESS, LED_CHANNEL, LED_STRIP)
# strip.begin()
Beispiel #35
0
from kivy.logger import Logger
from kivy.utils import OrderedDict, QueryDict
from kivy.cache import Cache
from kivy import kivy_data_dir, require
from kivy.lib.debug import make_traceback
import kivy.metrics as metrics


trace = Logger.trace
global_idmap = {}

# late import
Instruction = None

# register cache for creating new classtype (template)
Cache.register('kv.lang')

# precompile regexp expression
lang_str = re.compile('([\'"][^\'"]*[\'"])')
lang_key = re.compile('([a-zA-Z_]+)')
lang_keyvalue = re.compile('([a-zA-Z_][a-zA-Z0-9_.]*\.[a-zA-Z0-9_.]+)')


class ProxyApp(object):
    # proxy app object
    # taken from http://code.activestate.com/recipes/496741-object-proxying/

    __slots__ = ['_obj']

    def __init__(self):
        object.__init__(self)
Beispiel #36
0
#Factory.register('OutputItem', module='electrum_ltc_gui.kivy.uix.dialogs')

from .uix.dialogs.installwizard import InstallWizard
from .uix.dialogs import InfoBubble
from .uix.dialogs import OutputList, OutputItem

#from kivy.core.window import Window
#Window.softinput_mode = 'below_target'

# delayed imports: for startup speed on android
notification = app = ref = None
util = False

# register widget cache for keeping memory down timeout to forever to cache
# the data
Cache.register('garlium_ltc_widgets', timeout=0)

from kivy.uix.screenmanager import Screen
from kivy.uix.tabbedpanel import TabbedPanel
from kivy.uix.label import Label
from kivy.core.clipboard import Clipboard

Factory.register('TabbedCarousel', module='garlium_ltc_gui.kivy.uix.screens')

# Register fonts without this you won't be able to use bold/italic...
# inside markup.
from kivy.core.text import Label
Label.register('Roboto', 'gui/kivy/data/fonts/Roboto.ttf',
               'gui/kivy/data/fonts/Roboto.ttf',
               'gui/kivy/data/fonts/Roboto-Bold.ttf',
               'gui/kivy/data/fonts/Roboto-Bold.ttf')
Beispiel #37
0
from kivy.resources import resource_find
from kivy.utils import platform
import zipfile

try:
    import cStringIO as SIO
except ImportError:
    import StringIO as SIO


# late binding
Texture = TextureRegion = None


# register image caching only for keep_data=True
Cache.register("kv.image", timeout=60)
Cache.register("kv.atlas")


class ImageData(object):
    """Container for image and mipmap images.
    The container will always have at least the mipmap level 0.
    """

    __slots__ = ("fmt", "mipmaps", "source", "flip_vertical")
    _supported_fmts = ("rgb", "rgba", "bgr", "bgra", "s3tc_dxt1", "s3tc_dxt3", "s3tc_dxt5")

    def __init__(self, width, height, fmt, data, source=None, flip_vertical=True):
        assert fmt in ImageData._supported_fmts

        #: Decoded image format, one of a available texture format
Beispiel #38
0
import kivy.lang.builder  # imported as absolute to avoid circular import
from kivy.logger import Logger
from kivy.cache import Cache
from kivy import require
from kivy.resources import resource_find
from kivy.utils import rgba
import kivy.metrics as Metrics

__all__ = ('Parser', 'ParserException')

trace = Logger.trace
global_idmap = {}

# register cache for creating new classtype (template)
Cache.register('kv.lang')

# all previously included files
__KV_INCLUDES__ = []

# precompile regexp expression
lang_str = re.compile(
    "((?:'''.*?''')|"
    "(?:(?:(?<!')|''')'(?:[^']|\\\\')+?'(?:(?!')|'''))|"
    '(?:""".*?""")|'
    '(?:(?:(?<!")|""")"(?:[^"]|\\\\")+?"(?:(?!")|""")))', re.DOTALL)
lang_key = re.compile('([a-zA-Z_]+)')
lang_keyvalue = re.compile('([a-zA-Z_][a-zA-Z0-9_.]*\.[a-zA-Z0-9_.]+)')
lang_tr = re.compile('(_\()')
lang_cls_split_pat = re.compile(', *')
#
# def on_keyboard_event(event):
#     """
#     This method checks if pressed key is banned or not.
#     :param event: It is information held for activated keyboard event.
#     :return: It is boolean depending on whether key is banned or not.
#     """
#
#     if event.Key.lower() in ["lmenu", "lwin", "rwin", "apps", "esc"]:
#         return False
#     else:
#         return True

if __name__ == "__main__":
    Cache.register("info", limit=11)
    Cache.register("lect", limit=9)
    Cache.register("config", limit=2)
    Cache.register("data", limit=2)
    Cache.append("config", "cipher", Fernet(Fernet.generate_key()))
    Cache.register("CurrentExam", limit=1)

    if platform.system() == "Windows":
        import pyHook
        pass

        # hm = pyHook.HookManager()
        # # hm.KeyDown = on_keyboard_event
        # hm.HookKeyboard()

        Cache.append(
Beispiel #40
0
from kivy import kivy_data_dir
from kivy.logger import Logger
from kivy.clock import Clock
from kivy.cache import Cache
from kivy.core.image import ImageLoader, Image
from kivy.compat import PY2

from collections import deque
from time import sleep
from os.path import join
from os import write, close, unlink, environ
import threading

# Register a cache for loader
Cache.register('kv.loader', limit=500, timeout=60)


class ProxyImage(Image):
    '''Image returned by the Loader.image() function.

    :Properties:
        `loaded`: bool, default to False
            It can be True if the image is already cached

    :Events:
        `on_load`
            Fired when the image is loaded and changed
    '''

    __events__ = ('on_load', )
Beispiel #41
0
from .uix.dialogs.installwizard import InstallWizard
from .uix.dialogs import InfoBubble, crash_reporter
from .uix.dialogs import OutputList, OutputItem
from .uix.dialogs import TopLabel, RefLabel

#from kivy.core.window import Window
#Window.softinput_mode = 'below_target'

# delayed imports: for startup speed on android
notification = app = ref = None
util = False

# register widget cache for keeping memory down timeout to forever to cache
# the data
Cache.register('electrum_sparks_widgets', timeout=0)

from kivy.uix.screenmanager import Screen
from kivy.uix.tabbedpanel import TabbedPanel
from kivy.uix.label import Label
from kivy.core.clipboard import Clipboard

Factory.register('TabbedCarousel',
                 module='electrum_sparks.gui.kivy.uix.screens')

# Register fonts without this you won't be able to use bold/italic...
# inside markup.
from kivy.core.text import Label
Label.register('Roboto', 'electrum_sparks/gui/kivy/data/fonts/Roboto.ttf',
               'electrum_sparks/gui/kivy/data/fonts/Roboto.ttf',
               'electrum_sparks/gui/kivy/data/fonts/Roboto-Bold.ttf',
Beispiel #42
0
__all__ = ('TextInput', )

import sys

from kivy.utils import boundary
from kivy.clock import Clock
from kivy.cache import Cache
from kivy.core.text import Label
from kivy.uix.widget import Widget
from kivy.graphics import Color, Rectangle
from kivy.properties import StringProperty, NumericProperty, \
        ReferenceListProperty, BooleanProperty, AliasProperty, \
        ListProperty

Cache.register('textinput.label', timeout=60.)

FL_IS_NEWLINE = 0x01

# late binding
Clipboard = None


class TextInput(Widget):
    '''TextInput class, see module documentation for more information.

    :Events:
        `on_text_validate`
            Fired only in multiline=False mode, when the user hit 'enter'. This
            will also unfocus the textinput.
    '''
Beispiel #43
0
__all__ = ('TextInput', )

import sys

from kivy.utils import boundary
from kivy.clock import Clock
from kivy.cache import Cache
from kivy.core.text import Label
from kivy.uix.widget import Widget
from kivy.graphics import Color, Rectangle
from kivy.properties import StringProperty, NumericProperty, \
        ReferenceListProperty, BooleanProperty, AliasProperty, \
        ListProperty

Cache.register('textinput.label', timeout=60.)

FL_IS_NEWLINE = 0x01


class TextInput(Widget):
    '''TextInput class, see module documentation for more information.

    :Events:
        `on_text_validate`
            Fired only in multiline=False mode, when the user hit 'enter'. This
            will also unfocus the textinput.
    '''
    def __init__(self, **kwargs):
        self._win = None
        self._cursor_blink_time = Clock.get_time()
Beispiel #44
0
Factory.register('OutputItem', module='electrum_gui.kivy.uix.dialogs')



#from kivy.core.window import Window
#Window.softinput_mode = 'below_target'


# delayed imports: for startup speed on android
notification = app = ref = None
util = False


# register widget cache for keeping memory down timeout to forever to cache
# the data
Cache.register('electrum_widgets', timeout=0)

from kivy.uix.screenmanager import Screen
from kivy.uix.tabbedpanel import TabbedPanel
from kivy.uix.label import Label
from kivy.uix.checkbox import CheckBox
from kivy.uix.switch import Switch
from kivy.core.clipboard import Clipboard

Factory.register('TabbedCarousel', module='electrum_gui.kivy.uix.screens')

# Register fonts without this you won't be able to use bold/italic...
# inside markup.
from kivy.core.text import Label
Label.register('Roboto',
               'gui/kivy/data/fonts/Roboto.ttf',
from kivy.clock import Clock
from kivy.core.text import LabelBase
from kivy.core.window import Window
from kivy.factory import Factory
from kivy.garden.moretransitions import *
from kivy.properties import ListProperty, ObjectProperty, BooleanProperty, \
                            AliasProperty, DictProperty, NumericProperty
from kivy.resources import resource_find, resource_add_path
from kivy.uix.button import Button
from kivy.uix.dropdown import DropDown
from kivy.uix.floatlayout import FloatLayout
from kivy.uix.scatter import Scatter
from kivy.uix.screenmanager import ScreenManager, Screen, ScreenManagerException

resource_add_path(os.path.dirname(resource_find("data/images/arduino_uno.png")))
Cache.register('kv.image', timeout=10)

LabelBase.register(name="Ubuntu",  
                   fn_regular="data/fonts/Ubuntu-R.ttf",
                   fn_bold="data/fonts/Ubuntu-B.ttf",
                   fn_italic="data/fonts/Ubuntu-RI.ttf",
                   fn_bolditalic="data/fonts/Ubuntu-BI.ttf")
LabelBase.register(name="UbuntuMedium",  
                   fn_regular="data/fonts/Ubuntu-M.ttf",
                   fn_italic="data/fonts/Ubuntu-MI.ttf",)
LabelBase.register(name="UbuntuCondensed",  
                   fn_regular="data/fonts/Ubuntu-C.ttf")
LabelBase.register(name="UbuntuMono",  
                   fn_regular="data/fonts/UbuntuMono-R.ttf",
                   fn_bold="data/fonts/UbuntuMono-B.ttf",
                   fn_italic="data/fonts/UbuntuMono-RI.ttf",
#Factory.register('OutputItem', module='electrum_bery_gui.kivy.uix.dialogs')

from .uix.dialogs.installwizard import InstallWizard
from .uix.dialogs import InfoBubble
from .uix.dialogs import OutputList, OutputItem

#from kivy.core.window import Window
#Window.softinput_mode = 'below_target'

# delayed imports: for startup speed on android
notification = app = ref = None
util = False

# register widget cache for keeping memory down timeout to forever to cache
# the data
Cache.register('electrum_bery_widgets', timeout=0)

from kivy.uix.screenmanager import Screen
from kivy.uix.tabbedpanel import TabbedPanel
from kivy.uix.label import Label
from kivy.core.clipboard import Clipboard

Factory.register('TabbedCarousel', module='electrum_bery_gui.kivy.uix.screens')

# Register fonts without this you won't be able to use bold/italic...
# inside markup.
from kivy.core.text import Label
Label.register('Roboto', 'gui/kivy/data/fonts/Roboto.ttf',
               'gui/kivy/data/fonts/Roboto.ttf',
               'gui/kivy/data/fonts/Roboto-Bold.ttf',
               'gui/kivy/data/fonts/Roboto-Bold.ttf')
Beispiel #47
0
Factory.register("InfoBubble", module="electrum_gui.kivy.uix.dialogs")
Factory.register("ELTextInput", module="electrum_gui.kivy.uix.screens")


# from kivy.core.window import Window
# Window.softinput_mode = 'below_target'


# delayed imports: for startup speed on android
notification = app = ref = None
util = False


# register widget cache for keeping memory down timeout to forever to cache
# the data
Cache.register("electrum_widgets", timeout=0)

from kivy.uix.screenmanager import Screen
from kivy.uix.tabbedpanel import TabbedPanel
from kivy.uix.label import Label
from kivy.uix.checkbox import CheckBox
from kivy.uix.switch import Switch
from kivy.core.clipboard import Clipboard

Factory.register("TabbedCarousel", module="electrum_gui.kivy.uix.screens")


from electrum.util import base_units


class ElectrumWindow(App):
Factory.register('InstallWizard',
                 module='electrum_twist_gui.kivy.uix.dialogs.installwizard')
Factory.register('InfoBubble', module='electrum_twist_gui.kivy.uix.dialogs')
Factory.register('OutputList', module='electrum_twist_gui.kivy.uix.dialogs')
Factory.register('OutputItem', module='electrum_twist_gui.kivy.uix.dialogs')

#from kivy.core.window import Window
#Window.softinput_mode = 'below_target'

# delayed imports: for startup speed on android
notification = app = ref = None
util = False

# register widget cache for keeping memory down timeout to forever to cache
# the data
Cache.register('electrum_twist_widgets', timeout=0)

from kivy.uix.screenmanager import Screen
from kivy.uix.tabbedpanel import TabbedPanel
from kivy.uix.label import Label
from kivy.core.clipboard import Clipboard

Factory.register('TabbedCarousel',
                 module='electrum_twist_gui.kivy.uix.screens')

# Register fonts without this you won't be able to use bold/italic...
# inside markup.
from kivy.core.text import Label
Label.register('Roboto', 'gui/kivy/data/fonts/Roboto.ttf',
               'gui/kivy/data/fonts/Roboto.ttf',
               'gui/kivy/data/fonts/Roboto-Bold.ttf',
Beispiel #49
0
 def registerCache(self, name, lim, timeout):
     Cache.register(name, limit=lim, timeout=timeout)
Beispiel #50
0
from kivy.resources import resource_find
from kivy.utils import platform
from kivy.compat import string_types
import zipfile
try:
    import cio as SIO
except ImportError:
    import io as SIO


# late binding
Texture = TextureRegion = None


# register image caching only for keep_data=True
Cache.register('kv.image', timeout=60)
Cache.register('kv.atlas')


class ImageData(object):
    '''Container for images and mipmap images.
    The container will always have at least the mipmap level 0.
    '''

    __slots__ = ('fmt', 'mipmaps', 'source', 'flip_vertical', 'source_image')
    _supported_fmts = ('rgb', 'rgba', 'bgr', 'bgra', 's3tc_dxt1', 's3tc_dxt3',
                       's3tc_dxt5', 'pvrtc_rgb2', 'pvrtc_rgb4', 'pvrtc_rgba2',
                       'pvrtc_rgba4', 'etc1_rgb8')

    def __init__(self, width, height, fmt, data, source=None,
                 flip_vertical=True, source_image=None,
Beispiel #51
0
This module is responsible for getting the conversion rates from different
bitcoin exchanges.
"""

import decimal
import json

from kivy.network.urlrequest import UrlRequest
from kivy.event import EventDispatcher
from kivy.properties import OptionProperty, StringProperty, AliasProperty, ListProperty
from kivy.clock import Clock
from kivy.cache import Cache

# Register local cache
Cache.register("history_rate", timeout=220)

EXCHANGES = [
    "BitcoinAverage",
    "BitcoinVenezuela",
    "BitPay",
    "Blockchain",
    "BTCChina",
    "CaVirtEx",
    "Coinbase",
    "CoinDesk",
    "LocalBitcoins",
    "Winkdex",
]

HISTORY_EXCHNAGES = ["Coindesk", "Winkdex", "BitcoinVenezuela"]