def __init__(self, **kwargs):
        Builder.load_file(WIRELESS_CONFIG_VIEW_KV)
        super(WirelessConfigView, self).__init__(**kwargs)
        self.register_event_type("on_config_updated")
        self.base_dir = kwargs.get("base_dir")

        btEnable = kvFind(self, "rcid", "btEnable")
        btEnable.bind(on_setting=self.on_bt_enable)
        btEnable.setControl(SettingsSwitch())

        # btConfig = kvFind(self, 'rcid', 'btconfig')
        # btConfig.bind(on_setting=self.on_bt_configure)
        # btConfig.setControl(SettingsButton(text='Configure', disabled=True))

        cellEnable = kvFind(self, "rcid", "cellEnable")
        cellEnable.bind(on_setting=self.on_cell_enable)
        cellEnable.setControl(SettingsSwitch())

        cellProvider = kvFind(self, "rcid", "cellprovider")
        cellProvider.bind(on_setting=self.on_cell_provider)
        apnSpinner = SettingsMappedSpinner()
        self.loadApnSettingsSpinner(apnSpinner)
        self.apnSpinner = apnSpinner
        cellProvider.setControl(apnSpinner)

        self.apnHostField = kvFind(self, "rcid", "apnHost")
        self.apnUserField = kvFind(self, "rcid", "apnUser")
        self.apnPassField = kvFind(self, "rcid", "apnPass")
 def __init__(self, **kwargs):
     Builder.load_file(DASHBOARD_VIEW_KV)
     super(DashboardView, self).__init__(**kwargs)
     self.register_event_type('on_tracks_updated')
     self._databus = kwargs.get('dataBus')
     self._settings = kwargs.get('settings')
     self.init_view()
Esempio n. 3
0
 def __init__(self, **kwargs):
     Builder.load_string(FLYIN_PANEL_LAYOUT)
     super(FlyinPanel, self).__init__(**kwargs)
     self.hide_decay = Clock.create_trigger(lambda dt: self.hide(), self.SESSION_HIDE_DELAY)
     Window.bind(mouse_pos=self.on_mouse_pos)
     Window.bind(on_motion=self.on_motion)
     Clock.schedule_once(lambda dt: self.show())
 def __init__(self, **kwargs):    
     Builder.load_file(CAN_CONFIG_VIEW_KV)
     super(CANConfigView, self).__init__(**kwargs)
     
     self.register_event_type('on_config_updated')    
     btEnable = self.ids.can_enabled 
     btEnable.bind(on_setting=self.on_can_enabled)
     btEnable.setControl(SettingsSwitch())
 def __init__(self, **kwargs):
     Builder.load_file(ANALYSIS_VIEW_KV)
     super(AnalysisView, self).__init__(**kwargs)
     self.register_event_type('on_tracks_updated')
     self._databus = kwargs.get('dataBus')
     self._settings = kwargs.get('settings')
     self._trackmanager = kwargs.get('trackmanager')
     self.init_view()
Esempio n. 6
0
 def __init__(self, track_manager, status_pump, **kwargs):
     Builder.load_file(STATUS_KV_FILE)
     super(StatusView, self).__init__(**kwargs)
     self.track_manager = track_manager
     self.register_event_type("on_tracks_updated")
     self._menu_node = self.ids.menu
     self._menu_node.bind(selected_node=self._on_menu_select)
     status_pump.add_listener(self.status_updated)
 def __init__(self, **kwargs):
     Builder.load_file(LAPSTATS_VIEW_KV)
     super(LapStatsView, self).__init__(**kwargs)
     self.register_event_type("on_config_updated")
     self.ids.lapstats.setControl(SettingsSwitch())
     self.ids.lapstats.bind(on_setting=self.on_lapstats_enabled)
     self.ids.predtime.setControl(SettingsSwitch())
     self.ids.predtime.bind(on_setting=self.on_predtime_enabled)
    def __init__(self, **kwargs):
        Builder.load_file(IMU_CHANNELS_VIEW_KV)
        super(ImuChannelsView, self).__init__(**kwargs)
        self.register_event_type('on_config_updated')

        imu_container = self.ids.imu_channels
        self.appendImuChannels(imu_container, self.editors, IMU_ACCEL_CHANNEL_IDS)
        self.appendImuChannels(imu_container, self.editors, IMU_GYRO_CHANNEL_IDS)
        self.ids.sr.bind(on_sample_rate = self.on_sample_rate)
Esempio n. 9
0
    def __init__(self, settings, **kwargs):
        Builder.load_file(PREFERENCES_KV_FILE)
        super(PreferencesView, self).__init__(**kwargs)
        self.settings = settings
        self.base_dir = kwargs.get('base_dir')

        self.settings_view = SettingsWithNoMenu()
        self.settings_view.add_json_panel('Preferences', self.settings.userPrefs.config, os.path.join(self.base_dir, 'resource', 'settings', 'settings.json'))

        self.content = kvFind(self, 'rcid', 'preferences')
        self.content.add_widget(self.settings_view)
 def __init__(self, **kwargs):
     Builder.load_file(SCRIPT_VIEW_KV)
     super(LuaScriptingView, self).__init__(**kwargs)
     self.register_event_type('on_config_updated')
     self.register_event_type('on_run_script')
     self.register_event_type('on_poll_logfile')
     self.register_event_type('on_logfile')
     self.register_event_type('on_set_logfile_level')
     self.logfileView = kvFind(self, 'rcid', 'logfile')
     self.script_view = kvFind(self, 'rcid', 'script')
     self.logfileScrollView = kvFind(self, 'rcid', 'logfileSv') 
 def __init__(self, **kwargs):    
     Builder.load_file(TELEMETRY_CONFIG_VIEW_KV)
     super(TelemetryConfigView, self).__init__(**kwargs)
     self.register_event_type('on_config_updated')
 
     deviceId = kvFind(self, 'rcid', 'deviceId') 
     deviceId.bind(on_setting=self.on_device_id)
     deviceId.setControl(SettingsTextField())
     
     bgStream = kvFind(self, 'rcid', 'bgStream')
     bgStream.bind(on_setting=self.on_bg_stream)
     bgStream.setControl(SettingsSwitch())
    def __init__(self, **kwargs):
        Builder.load_file(OBD2_CHANNELS_VIEW_KV)
        super(OBD2ChannelsView, self).__init__(**kwargs)
        self.register_event_type("on_config_updated")
        self.obd2_grid = self.ids.obd2grid
        obd2_enable = self.ids.obd2enable
        obd2_enable.bind(on_setting=self.on_obd2_enabled)
        obd2_enable.setControl(SettingsSwitch())
        self.base_dir = kwargs.get("base_dir")

        self.obd2_settings = OBD2Settings(base_dir=self.base_dir)

        self.update_view_enabled()
Esempio n. 13
0
 def __init__(self, **kwargs):
     Builder.load_file(ANALYSIS_VIEW_KV)
     super(AnalysisView, self).__init__(**kwargs)
     self._datastore = CachingAnalysisDatastore()
     self.register_event_type('on_tracks_updated')
     self._databus = kwargs.get('dataBus')
     self._settings = kwargs.get('settings') 
     self._track_manager = kwargs.get('track_manager')
     self.ids.sessions_view.bind(on_lap_selected=self.lap_selected)
     self.ids.channelvalues.color_sequence = self._color_sequence
     self.ids.mainchart.color_sequence = self._color_sequence
     self.stream_connecting = False
     self.init_view()
Esempio n. 14
0
    def __init__(self, **kwargs):
        Builder.load_file(CONFIG_VIEW_KV)
        super(ConfigView, self).__init__(**kwargs)

        self._databus = kwargs.get('databus')
        self.rc_config = kwargs.get('rcpConfig', None)
        self.rc_api = kwargs.get('rc_api', None)
        self._settings = kwargs.get('settings')
        self.base_dir = kwargs.get('base_dir')

        self.register_event_type('on_config_updated')
        self.register_event_type('on_channels_updated')
        self.register_event_type('on_config_written')
        self.register_event_type('on_tracks_updated')
        self.register_event_type('on_config_modified')
        self.register_event_type('on_read_config')
        self.register_event_type('on_write_config')
Esempio n. 15
0
 def __init__(self, **kwargs):
     Builder.load_file(TRACK_CONFIG_VIEW_KV)
     super(TrackConfigView, self).__init__(**kwargs)
     self._databus = kwargs.get('databus')
     self.register_event_type('on_config_updated')
     
     self.manualTrackConfigView = ManualTrackConfigScreen(name='manual', databus=self._databus)
     self.manualTrackConfigView.bind(on_modified=self.on_modified)
     
     self.autoConfigView = AutomaticTrackConfigScreen(name='auto')
     self.autoConfigView.bind(on_modified=self.on_modified)
     
     screenMgr = kvFind(self, 'rcid', 'screenmgr')
     screenMgr.add_widget(self.manualTrackConfigView)
     self.screenManager = screenMgr
     
     autoDetect = kvFind(self, 'rcid', 'autoDetect')
     autoDetect.bind(on_setting=self.on_auto_detect)
     autoDetect.setControl(SettingsSwitch())
     
     self.autoConfigView.track_manager = kwargs.get('track_manager')
Esempio n. 16
0
    def __init__(self, settings, **kwargs):
        Builder.load_file(PREFERENCES_KV_FILE)
        super(PreferencesView, self).__init__(**kwargs)
        self.settings = settings
        self.base_dir = kwargs.get('base_dir')

        self.settings_view = SettingsWithNoMenu()

        # So, Kivy's Settings object doesn't allow you to add multiple json panels at a time, only 1. If you add
        # multiple, the last one added 'wins'. So what we do is load the settings JSON ourselves and then merge it
        # with any platform-specific settings (if applicable). It's silly, but works.
        settings_json = json.loads(open(os.path.join(self.base_dir, 'resource', 'settings', 'settings.json')).read())

        if platform == 'android':
            android_settings_json = json.loads(open(os.path.join(self.base_dir, 'resource', 'settings', 'android_settings.json')).read())
            settings_json = settings_json + android_settings_json

        self.settings_view.add_json_panel('Preferences', self.settings.userPrefs.config, data=json.dumps(settings_json))

        self.content = kvFind(self, 'rcid', 'preferences')
        self.content.add_widget(self.settings_view)
Esempio n. 17
0
    def build(self):
        self.init_view_builders()
        
        Builder.load_file('racecapture.kv')
        root = self.root
        
        status_bar = root.ids.status_bar
        status_bar.bind(on_main_menu=self.on_main_menu)
        self.status_bar = status_bar

        root.ids.main_menu.bind(on_main_menu_item=self.on_main_menu_item)

        self.mainNav = root.ids.main_nav

        #reveal_below_anim
        #reveal_below_simple
        #slide_above_anim
        #slide_above_simple
        #fade_in
        self.mainNav.anim_type = 'slide_above_anim'

        rc_api = self._rc_api
        rc_api.on_progress = lambda value: status_bar.dispatch('on_progress', value)
        rc_api.on_rx = lambda value: status_bar.dispatch('on_rc_rx', value)
        rc_api.on_tx = lambda value: status_bar.dispatch('on_rc_tx', value)

        screenMgr = root.ids.main
        #NoTransition
        #SlideTransition
        #SwapTransition
        #FadeTransition
        #WipeTransition
        #FallOutTransition
        #RiseInTransition
        screenMgr.transition=NoTransition()

        self.screenMgr = screenMgr
        self.icon = ('resource/images/app_icon_128x128.ico' if sys.platform == 'win32' else 'resource/images/app_icon_128x128.png')
        Clock.schedule_once(lambda dt: self.post_launch(), 1.0)
Esempio n. 18
0
File: app.py Progetto: cfitz25/Kivy
 def build(self):
     Config.set("graphics", "width", X)
     Config.set("graphics", "height", Y)
     self.x = X
     self.y = Y
     self.home_country = ""
     self.destination_country = ""
     self.home_code = ""
     self.destination_code = ""
     self.title = "App"
     self.root = Builder.load_file('gui.kv')
     self.currency_rates = []
     self.app_can_run = True
     return self.root
 def __init__(self, **kwargs):
     Builder.load_file(ANALOG_CHANNELS_VIEW_KV)
     super(AnalogChannelsView, self).__init__(**kwargs)
     self.channel_title = 'Analog '
     self.accordion_item_height = dp(80)
        self.channelConfig = channelConfig
        
    def on_map_updated(self, *args):
        self.channelConfig.stale = True
        self.dispatch('on_modified', self.channelConfig)        
        

class AnalogScaler(Graph):
    def __init__(self, **kwargs):
        super(AnalogScaler, self).__init__(**kwargs)

Builder.load_string('''
<WarnLabel>
    canvas.before:
        Color:
            rgba: (1.0, 0, 0, 0.5)
        Rectangle:
            pos: self.pos
            size: self.size
            
''')

class WarnLabel(Label):
    pass


WARN_DISMISS_TIMEOUT = 3

class AnalogScalingMapEditor(BoxLayout):
    map_size = SCALING_MAP_POINTS
    scaling_map = None
    plot = None
Esempio n. 21
0
import kivy
kivy.require('1.9.0')
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.label import Label
from kivy.app import Builder
from kivy.uix.screenmanager import Screen, ScreenManager
from kivy.clock import Clock
from utils import kvFind
from kivy.properties import ObjectProperty
from autosportlabs.racecapture.views.dashboard.widgets.digitalgauge import DigitalGauge
from kivy.properties import StringProperty
from kivy.graphics import Color, Rectangle

Builder.load_file('autosportlabs/racecapture/views/dashboard/rawchannelview.kv')

NO_DATA_MSG = 'No Data'
DATA_MSG    = ''

RAW_GRID_BGCOLOR_1 = [0  , 0  , 0  , 1.0]
RAW_GRID_BGCOLOR_2 = [0.1, 0.1, 0.1, 1.0]
RAW_NORMAL_COLOR   = [0.0, 1.0, 0.0, 1.0]

class RawGauge(DigitalGauge):
    backgroundColor = ObjectProperty(RAW_GRID_BGCOLOR_1)

    def __init__(self, **kwargs):
        super(RawGauge  , self).__init__(**kwargs)
        self.normal_color =  RAW_NORMAL_COLOR
        
    def update_colors(self):
        color = self.select_alert_color()
Esempio n. 22
0
import math
kivy.require('1.9.1')
from autosportlabs.uix.color import colorgradient
from kivy.uix.label import Label
from kivy.uix.floatlayout import FloatLayout
from kivy.uix.widget import Widget
from kivy.uix.scatter import Scatter
from kivy.app import Builder
from kivy.metrics import sp
from kivy.properties import ListProperty, NumericProperty
from kivy.graphics import Color, Line, Bezier, Rectangle
from autosportlabs.racecapture.geo.geopoint import GeoPoint
from autosportlabs.uix.color.colorgradient import HeatColorGradient, SimpleColorGradient
from utils import *

Builder.load_file('autosportlabs/uix/track/trackmap.kv')

class Point(object):
    x = 0.0
    y = 0.0
    def __init__(self, x, y):
        self.x = x
        self.y = y

class MarkerPoint(Point):
    def __init__(self, color):
        super(MarkerPoint, self).__init__(0, 0)
        self.color = color

class TrackPath(object):
    def __init__(self, path, color):
Esempio n. 23
0
Builder.load_string('''

<WifiConfigView>:
    id: wifi
    cols: 1
    spacing: [0, dp(20)]
    row_default_height: dp(40)
    size_hint: [1, None]
    height: self.minimum_height
    HSeparator:
        text: 'WiFi'
    SettingsView:
        id: wifi_enabled
        label_text: 'WiFi Module'
    BaseLabel:
        text_size: self.size
        halign: 'center'
        text: 'Client Mode Configuration'
        font_size: dp(26)
    BaseLabel:
        text: 'Use this mode to setup the wifi module to connect [b]to[/b] an existing wireless network.'
        markup: True
        text_size: (self.parent.width, None)
        padding: [dp(20), 0]
    SettingsView:
        id: client_mode
        label_text: 'Client Mode'
    GridLayout:
        spacing: (dp(30), dp(5))
        cols: 2
        FieldLabel:
            text: 'SSID'
            halign: 'right'
        ValueField:
            id: client_ssid
            disabled: False
            on_text: root.on_client_ssid(*args)
    GridLayout:
        spacing: (dp(30), dp(5))
        cols: 2
        FieldLabel:
            text: 'Password'
            halign: 'right'
        ValueField:
            id: client_password
            disabled: False
            on_text: root.on_client_password(*args)
    BaseLabel:
        text: 'Access Point Mode Configuration'
        text_size: self.size
        halign: 'center'
        font_size: dp(26)
    BaseLabel:
        text: 'Use this mode to create a wireless network for your phone or table to connect to.'
        markup: True
        text_size: (self.parent.width, None)
        padding: [dp(20), 0]
    SettingsView:
        id: ap_mode
        label_text: 'Access Point Mode'
    GridLayout:
        spacing: (dp(30), dp(5))
        cols: 2
        FieldLabel:
            text: 'SSID'
            halign: 'right'
        BetterTextInput:
            id: ap_ssid
            disabled: False
            on_text: root.on_ap_ssid(*args)
            max_chars: 24
    GridLayout:
        spacing: (dp(30), dp(5))
        cols: 2
        FieldLabel:
            text: 'Password'
            halign: 'right'
        BetterTextInput:
            id: ap_password
            disabled: False
            on_text: root.on_ap_password(*args)
            max_chars: 24
    SettingsView:
        id: ap_channel
        label_text: 'Channel'
    SettingsView:
        id: ap_encryption
        label_text: 'Encryption'
''')
#this code. If not, see <http://www.gnu.org/licenses/>.
import kivy
kivy.require('1.9.1')
from kivy.logger import Logger
from kivy.graphics import Color
from kivy.app import Builder
from kivy.clock import Clock
from kivy.uix.boxlayout import BoxLayout
from kivy.properties import ObjectProperty
from autosportlabs.widgets.scrollcontainer import ScrollContainer
from autosportlabs.racecapture.datastore import DataStore, Filter
from autosportlabs.racecapture.views.analysis.markerevent import SourceRef
from autosportlabs.racecapture.views.analysis.analysiswidget import ChannelAnalysisWidget
from autosportlabs.uix.gauge.bargraphgauge import BarGraphGauge

Builder.load_file('autosportlabs/racecapture/views/analysis/channelvaluesview.kv')
    
class ChannelValueView(BoxLayout):

    def __init__(self, **kwargs):
        super(ChannelValueView, self).__init__(**kwargs)
        self.session_view = self.ids.session
        self.lap_view = self.ids.lap
        self.channel_view = self.ids.channel
        self.value_view = self.ids.value

    @property
    def session(self):
        return self.session_view.text

    @session.setter
# See the GNU General Public License for more details. You should
#have received a copy of the GNU General Public License along with
#this code. If not, see <http://www.gnu.org/licenses/>.
import kivy
kivy.require('1.9.0')
from kivy.logger import Logger
from kivy.app import Builder
from kivy.clock import Clock
from kivy.uix.anchorlayout import AnchorLayout
from iconbutton import IconButton
from autosportlabs.racecapture.views.channels.channelselectview import ChannelSelectView
from autosportlabs.racecapture.views.analysis.customizechannelsview import CustomizeChannelsView
from autosportlabs.racecapture.views.analysis.markerevent import SourceRef
from kivy.uix.popup import Popup
from kivy.properties import BooleanProperty, ObjectProperty
Builder.load_file('autosportlabs/racecapture/views/analysis/analysiswidget.kv')
    
class OptionsButton(AnchorLayout):
    pass

class AnalysisWidget(AnchorLayout):
    """
    The base for all analysis UI widgets
    
    This base class can handle the addition / removal of laps selected for viewing.
    Selected laps are the basis for determining what data is displayed in a particular widget.
    
    Extend this class directly when you want to create a widget that specifically controls the data to be displayed, such as
    the analysis map.
    """
    options_enabled = BooleanProperty(None)
Esempio n. 26
0
DEFAULT_NORMAL_COLOR  = [1.0, 1.0 , 1.0, 1.0]

DEFAULT_VALUE = None
DEFAULT_MIN = 0
DEFAULT_MAX = 100
DEFAULT_PRECISION = 0
DEFAULT_TYPE = CHANNEL_TYPE_SENSOR
MENU_ITEM_RADIUS = 100
POPUP_DISMISS_TIMEOUT_SHORT = 10.0
POPUP_DISMISS_TIMEOUT_LONG = 60.0

Builder.load_string('''
<CustomizeGaugeBubble>
    orientation: 'vertical'
    size_hint: (None, None)
    #pos_hint: {'center_x': .5, 'y': .5}
    #arrow_pos: 'bottom_mid'
    #background_color: (1, 0, 0, 1.0) #50% translucent red
    #border: [0, 0, 0, 0]    
''')

class CustomizeGaugeBubble(CenteredBubble):
    pass

NULL_LAP_TIME='--:--.---'

class Gauge(AnchorLayout):
    rcid = None
    settings = ObjectProperty(None)    
    value_size = NumericProperty(0)
    title_size = NumericProperty(0)
Esempio n. 27
0
from autosportlabs.racecapture.views.util.alertview import alertPopup
from autosportlabs.racecapture.views.analysis.analysiswidget import ChannelAnalysisWidget
from autosportlabs.racecapture.views.analysis.markerevent import MarkerEvent
from autosportlabs.racecapture.datastore import Filter
from autosportlabs.racecapture.views.analysis.analysisdata import ChannelData
from autosportlabs.uix.progressspinner import ProgressSpinner
from autosportlabs.uix.options.optionsview import OptionsView, BaseOptionsScreen
from autosportlabs.racecapture.views.analysis.customizechannelsview import CustomizeChannelsView
from autosportlabs.uix.button.widgetbuttons import LabelButton
from autosportlabs.racecapture.theme.color import ColorScheme
from autosportlabs.uix.toast.kivytoast import toast
from fieldlabel import FieldLabel
from iconbutton import IconButton, LabelIconButton
from autosportlabs.racecapture.views.util.viewutils import format_laptime

Builder.load_file('autosportlabs/racecapture/views/analysis/linechart.kv')

class ChannelPlot(object):

    def __init__(self, plot, channel, min_value, max_value, sourceref):
        self.lap = None
        self.chart_x_index = None
        self.plot = plot
        self.channel = channel
        self.min_value = min_value
        self.max_value = max_value
        self.sourceref = sourceref

    def __str__(self):
        return "{}_{}".format(str(self.sourceref), self.channel)
Esempio n. 28
0
 def build(self):
     self.title="Convert Miles to Kilometres"
     self.root=Builder.load_file("km_converter.kv")
     return self.root
import kivy
kivy.require('1.9.0')
from kivy.uix.boxlayout import BoxLayout
from kivy.app import Builder
from kivy.metrics import dp
from utils import kvFind, kvquery
from kivy.properties import NumericProperty, ObjectProperty
from autosportlabs.racecapture.views.dashboard.widgets.gauge import CustomizableGauge

Builder.load_file('autosportlabs/racecapture/views/dashboard/widgets/digitalgauge.kv')

DEFAULT_BACKGROUND_COLOR = [0, 0, 0, 0]

class DigitalGauge(CustomizableGauge):

    alert_background_color = ObjectProperty(DEFAULT_BACKGROUND_COLOR)        
    
    def __init__(self, **kwargs):
        super(DigitalGauge, self).__init__(**kwargs)
        self.normal_color = DEFAULT_BACKGROUND_COLOR

    def update_title(self, channel, channel_meta):
        try:
            self.title = channel if channel else ''
        except Exception as e:
            print('Failed to update digital gauge title ' + str(e))

    def updateColors(self):
        self.alert_background_color = self.select_alert_color()
Esempio n. 30
0
import kivy
kivy.require('1.9.0')
from kivy.uix.boxlayout import BoxLayout
from kivy.app import Builder
from kivy.properties import StringProperty, ListProperty, BooleanProperty
from autosportlabs.racecapture.theme.color import ColorScheme
from fieldlabel import FieldLabel
from utils import kvFind
import mainfonts

Builder.load_file('autosportlabs/racecapture/menu/mainmenu.kv')

    
class MainMenuItem(BoxLayout):
    disabledColor = (0.3, 0.3, 0.3, 1.0)
    enabledColor = (1.0, 1.0, 1.0, 1.0)
    rcid = None
    icon = StringProperty('')
    description = StringProperty('')
    enabled = BooleanProperty(True)

    def __init__(self, **kwargs):
        super(MainMenuItem, self).__init__(**kwargs)
        self.bind(icon = self.on_icon_text)
        self.bind(description = self.on_description_text)
        rcid = kwargs.get('rcid', None)
        self.register_event_type('on_main_menu_item_selected')

    def setEnabledDisabledColor(self, widget):
        if self.enabled:
            widget.color = self.enabledColor