Ejemplo n.º 1
0
 def setup_kivy_survey(self):
     if __name__ != '__main__':
         self.kivy_survey = survey = Builder.load_file(
             construct_target_file_name('kivysurvey.kv', __file__))
     else:
         self.kivy_survey = survey = KivySurvey()
     survey.current_page = current_page = survey.ids.questions1
     survey.current_subjects_page = survey.ids.subjects1
     db_interface = survey.db_interface
     survey.start_questionnaire('household_questionnaire')
     survey.subject_id = 0
     return survey
Ejemplo n.º 2
0
 def setup_kivy_survey(self):
     if __name__ != '__main__':
         self.kivy_survey = survey = Builder.load_file(
             construct_target_file_name('kivysurvey.kv', __file__))
     else:
         self.kivy_survey = survey = KivySurvey()
     survey.current_page = current_page = survey.ids.questions1
     survey.current_subjects_page = survey.ids.subjects1
     db_interface = survey.db_interface
     survey.start_questionnaire('household_questionnaire')
     survey.subject_id = 0
     return survey
Ejemplo n.º 3
0
 def __init__(self, **kwargs):
     global_idmap.update({'kivysurvey': self})
     self.db_interface = DBInterface(self)
     super(KivySurvey, self).__init__(**kwargs)
     self.transition = SlideTransition()
     json = JsonStore(construct_target_file_name('survey.json', __file__))
     for each in json:
         print(each)
     self.survey = Survey(json)
     try:
         gps.configure(on_location=self.receive_gps)
     except:
         pass
     Clock.schedule_once(self.start_gps)
Ejemplo n.º 4
0
 def __init__(self, **kwargs):
     global_idmap.update({'kivysurvey': self})
     self.db_interface = DBInterface(self)
     super(KivySurvey, self).__init__(**kwargs)
     self.transition = SlideTransition()
     json = JsonStore(construct_target_file_name('survey.json', __file__))
     for each in json:
         print(each)
     self.survey = Survey(json)
     try:
         gps.configure(on_location=self.receive_gps)
     except:
         pass
     Clock.schedule_once(self.start_gps)
Ejemplo n.º 5
0
    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)
Ejemplo n.º 6
0
    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)
Ejemplo n.º 7
0
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 flat_kivy.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':
                self.display_text = button_str
Ejemplo n.º 8
0
 def get_font(self, font_file):
     return construct_target_file_name(font_file, None)
Ejemplo n.º 9
0
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 flat_kivy.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':
Ejemplo n.º 10
0
from oauth2client.client import OAuth2WebServerFlow
from oauth2client.file import Storage
from kivy.uix.image import AsyncImage, Image
from kivy.core.image import ImageData
from kivy.clock import Clock
from kivy.storage.jsonstore import JsonStore
from kivy.properties import ListProperty, NumericProperty
from dbinterface import DBInterface
from functools import partial
import json
from kivy.uix.popup import Popup
from kivy.uix.floatlayout import FloatLayout
from flat_kivy.utils import construct_target_file_name
import weakref

storage = Storage(construct_target_file_name('drive_key.secret', __file__))
with open(construct_target_file_name('client_secret.secret', __file__),
          'rb') as client_secret:
    data = json.load(client_secret)
    CLIENT_ID = data[u'installed'][u'client_id']
    CLIENT_SECRET = data[u'installed'][u'client_secret']
    REDIRECT_URI = data[u'installed'][u'redirect_uris'][0]

# Check https://developers.google.com/drive/scopes for all available scopes
OAUTH_SCOPE = 'https://www.googleapis.com/auth/drive.readonly'


def start_drive_thread(folders_to_track, pyfile):
    global drive_main_thread
    drive_main_thread = DriveMainThread(folders_to_track, 1, pyfile)
    drive_main_thread.setDaemon(True)
Ejemplo n.º 11
0
 def get_font(self, font_file):
     return construct_target_file_name(font_file, None)
Ejemplo n.º 12
0
from oauth2client.client import OAuth2WebServerFlow
from oauth2client.file import Storage
from kivy.uix.image import AsyncImage, Image
from kivy.core.image import ImageData
from kivy.clock import Clock
from kivy.storage.jsonstore import JsonStore
from kivy.properties import ListProperty, NumericProperty
from dbinterface import DBInterface
from functools import partial
import json
from kivy.uix.popup import Popup
from kivy.uix.floatlayout import FloatLayout
from flat_kivy.utils import construct_target_file_name
import weakref

storage = Storage(construct_target_file_name('drive_key.secret', __file__))
with open(construct_target_file_name(
    'client_secret.secret', __file__), 'rb') as client_secret:
    data = json.load(client_secret)
    CLIENT_ID = data[u'installed'][u'client_id']
    CLIENT_SECRET = data[u'installed'][u'client_secret']
    REDIRECT_URI = data[u'installed'][u'redirect_uris'][0]


# Check https://developers.google.com/drive/scopes for all available scopes
OAUTH_SCOPE = 'https://www.googleapis.com/auth/drive.readonly'

def start_drive_thread(folders_to_track, pyfile):
    global drive_main_thread
    drive_main_thread = DriveMainThread(folders_to_track, 1, pyfile)
    drive_main_thread.setDaemon(True)
Ejemplo n.º 13
0
from __future__ import unicode_literals, print_function
from kivy.uix.widget import Widget
from kivy.properties import (BooleanProperty, ObjectProperty, StringProperty,
    NumericProperty, ReferenceListProperty, ListProperty)
from flat_kivy.numpad import NumPad, DecimalNumPad
from kivy.clock import Clock
from kivy.utils import platform
from flat_kivy.ui_elements import (TextInputFocus, 
    CheckBoxListItem as CheckboxAnswerWidget, 
    FlatPopup as Popup, FlatToggleButton)
from kivy.lang import Builder
from functools import partial
from kivy.core.window import Window
from kivy.uix.screenmanager import NoTransition, SlideTransition
from flat_kivy.utils import construct_target_file_name
Builder.load_file(construct_target_file_name('surveyquestions.kv', __file__))


class SurveyQuestion(Widget):
    allow_no_answer = BooleanProperty(False)
    answer = ObjectProperty(None, allownone=True)
    question_name = StringProperty('default_question_name')
    question_text = StringProperty(None)
    validated = BooleanProperty(False)
    font_ramp_tuple = ListProperty(['question_default', '1'])
    do_transition = BooleanProperty(True)
    do_state = BooleanProperty(False)

    def __init__(self, **kwargs):
        super(SurveyQuestion, self).__init__(**kwargs)
        self._no_trans = NoTransition()
Ejemplo n.º 14
0
from kivy.uix.widget import Widget
from kivy.properties import (BooleanProperty, ObjectProperty, StringProperty,
                             NumericProperty, ReferenceListProperty,
                             ListProperty)
from flat_kivy.numpad import NumPad, DecimalNumPad
from kivy.clock import Clock
from kivy.utils import platform
from flat_kivy.ui_elements import (TextInputFocus, CheckBoxListItem as
                                   CheckboxAnswerWidget, FlatPopup as Popup,
                                   FlatToggleButton)
from kivy.lang import Builder
from functools import partial
from kivy.core.window import Window
from kivy.uix.screenmanager import NoTransition, SlideTransition
from flat_kivy.utils import construct_target_file_name
Builder.load_file(construct_target_file_name('surveyquestions.kv', __file__))


class SurveyQuestion(Widget):
    allow_no_answer = BooleanProperty(False)
    answer = ObjectProperty(None, allownone=True)
    question_name = StringProperty('default_question_name')
    question_text = StringProperty(None)
    validated = BooleanProperty(False)
    font_ramp_tuple = ListProperty(['question_default', '1'])
    do_transition = BooleanProperty(True)
    do_state = BooleanProperty(False)

    def __init__(self, **kwargs):
        super(SurveyQuestion, self).__init__(**kwargs)
        self._no_trans = NoTransition()