def build(self): super(TTApp, self).build() kivy.resources.resource_add_path(ttlib_dir("data/glyphicons")) kivy.resources.resource_add_path(self.data_dir("glyphicons")) kivy.resources.resource_add_path(self.data_dir("themes/default")) self.theme = self.config.get(self.app_name, 'theme') if self.theme != 'default': kivy.resources.resource_add_path(self.data_dir("themes", self.theme)) self.goto_screen("new")
def __init__(self, **kwargs): super(TTSettingInt, self).__init__(**kwargs) self.minus.children[0].source = ttlib_dir("data/glyphicons/circle_minus.png") self.plus.children[0].source = ttlib_dir("data/glyphicons/circle_plus.png")
from __future__ import division, absolute_import, print_function from kivy.lang import Builder from kivy.properties import NumericProperty, ObjectProperty from kivy.uix.button import Button from kivy.uix.settings import SettingItem from ttlib import ttlib_dir class TTSettingInt(SettingItem): minimum = NumericProperty(0) maximum = NumericProperty(float("inf")) step = NumericProperty(1) plus = ObjectProperty(None) minus = ObjectProperty(None) def __init__(self, **kwargs): super(TTSettingInt, self).__init__(**kwargs) self.minus.children[0].source = ttlib_dir("data/glyphicons/circle_minus.png") self.plus.children[0].source = ttlib_dir("data/glyphicons/circle_plus.png") def step_up(self, obj): if int(self.value) < self.maximum: self.value = str( min(self.maximum, int(self.value) + self.step) ) def step_down(self, obj): if int(self.value) > self.minimum: self.value = str( max(self.minimum, int(self.value) - self.step) ) Builder.load_file(ttlib_dir("ttsettingint.kv"), rulesonly=True)