def on_style_dict(self, instance, value): if value is not None: self.font_name = construct_target_file_name( 'data/font/' + value.font_file, __file__) self.font_size = font_size = get_metric_conversion( value.size_mobile) self.color[3] = value.alpha
class LogBehavior(object): log_manager = LogManager(construct_target_file_name( 'data/logs/', __file__)) def on_touch_down(self, touch): log_manager = self.log_manager if self in touch.ud and log_manager.do_logging: print(self, 'in on touch dwon') coords = (touch.x, touch.y) log_interface = log_manager.log_interface touch_id = log_manager.touch_id touch.ud['log_id'] = touch_id log_interface.set_entry('touches', touch_id, 'touch_down_at', coords, do_timestamp=True) log_manager.touch_id += 1 log_interface.set_entry('touches', 'last_touch_id', 'value', touch_id) return super(LogBehavior, self).on_touch_down(touch) def on_touch_move(self, touch): log_manager = self.log_manager if self in touch.ud and log_manager.do_logging: coords = (touch.x, touch.y) touch_id = touch.ud['log_id'] log_manager.log_interface.append_entry('touches', touch_id, 'touch_moves_at', coords, do_timestamp=True) return super(LogBehavior, self).on_touch_move(touch) def on_touch_up(self, touch): log_manager = self.log_manager if self in touch.ud and log_manager.do_logging: coords = (touch.x, touch.y) touch_id = touch.ud['log_id'] log_manager.log_interface.set_entry('touches', touch_id, 'touch_up_at', coords, do_timestamp=True) return super(LogBehavior, self).on_touch_up(touch)
def __init__(self, **kwargs): self.theme_manager = ThemeManager() self.setup_font_ramps() self.get_color = get_rgba_color self.get_icon = get_icon_char self.get_style = get_style self.get_ramp_group = get_font_ramp_group super(FlatApp, self).__init__(**kwargs) self.setup_themes() self.numpads = numpads = {} numpads['decimal'] = DecimalNumPad() numpads['regular'] = NumPad() if self.do_device_id: log_behavior = LogBehavior() self.log_manager = log_manager = log_behavior.log_manager self.settings_interface = settings_interface = DBInterface( construct_target_file_name('', __file__), 'settings') self.device_id = device_id = settings_interface.get_entry( 'settings', 'device_id', 'value') self.bind(device_id=log_manager.setter('device_id')) if device_id is None: Clock.schedule_once(self.register_device_id)
def get_font(self, font_file): return construct_target_file_name(font_file, None)
from __future__ import unicode_literals, print_function from kivy.utils import platform from kivy.lang import Builder from utils import construct_target_file_name, get_metric_conversion Builder.load_file(construct_target_file_name('ui_elements.kv', __file__)) from kivy.uix.togglebutton import ToggleButton #from kivy.uix.checkbox import CheckBox from kivy.uix.stacklayout import StackLayout from kivy.uix.gridlayout import GridLayout from kivy.properties import (ObjectProperty, StringProperty, OptionProperty, DictProperty, ListProperty, BooleanProperty, NumericProperty, VariableListProperty) from kivy.uix.image import Image from kivy.uix.boxlayout import BoxLayout from kivy.uix.anchorlayout import AnchorLayout from kivy.animation import Animation from kivy.uix.label import Label from kivy.uix.widget import Widget from kivy.uix.scrollview import ScrollView from kivy.uix.popup import Popup from kivy.uix.textinput import TextInput from kivy.app import App from weakref import ref from kivy.graphics import (StencilPush, StencilPop, StencilUse, StencilUnUse, Rectangle, Ellipse, Color, ScissorPush, ScissorPop) from dbinterface import DBInterface from kivy.event import EventDispatcher from kivy.uix.screenmanager import Screen from kivy.clock import Clock
from __future__ import unicode_literals, print_function from kivy.uix.widget import Widget from kivy.properties import (StringProperty, NumericProperty, ObjectProperty) from kivy.lang import Builder from utils import construct_target_file_name Builder.load_file(construct_target_file_name('numpad.kv', __file__)) class NumPad(Widget): display_text = StringProperty("0") display_value = NumericProperty(0) init_value = NumericProperty(100) maximum_value = NumericProperty(None, allownone=True) minimum_value = NumericProperty(None, allownone=True) return_callback = ObjectProperty(None, allownone=True) units = StringProperty(None, allownone=True) def __init__(self, **kwargs): super(NumPad, self).__init__(**kwargs) def check_minimum_value(self): if self.minimum_value != None: if self.display_value < self.minimum_value: self.display_text = str(self.minimum_value) def button_callback(self, button_str): if button_str in [str(x) for x in range(10)]: if self.display_text == '0':
class LogNoTouchBehavior(object): log_manager = LogManager(construct_target_file_name( 'data/logs/', __file__))