Exemplo n.º 1
0
 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()
    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')
Exemplo n.º 3
0
 def build(self):
     Builder.load_file(os.path.join(KV_DIRECTORY, "main.kv"))
     layout = Main()
     game = Game()
     layout.ventures = game.ventures
     game.calculate()
     return layout
Exemplo n.º 4
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.register_event_type('on_pref_change')

        self.settings_view = SettingsWithNoMenu()
        self.settings_view.bind(on_config_change=self._on_preferences_change)

        # 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)
Exemplo n.º 5
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(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")
Exemplo n.º 7
0
    def build(self) -> App:
        self.title = "PathFinder"

        Builder.load_file('ui/ui_path_finder.kv')

        app = UiPathFinder()
        return app
Exemplo n.º 8
0
 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()
 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())
Exemplo n.º 10
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)
Exemplo n.º 11
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)
Exemplo n.º 12
0
    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())
Exemplo n.º 13
0
 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(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()
 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)
Exemplo n.º 16
0
 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()
Exemplo n.º 17
0
    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)
Exemplo n.º 18
0
 def __init__(self, app):
     Builder.load_file("Dossier/Dossier.kv")
     super(Dossier, self).__init__()
     self.App = app
     self.grid = self.ids.grid
     self.grid.bind(minimum_height=self.grid.setter("height"))
     for i in self.load_chars():
         btn = DossierButton(text=i.Name, char=i)
         btn.bind(on_press=self.btn_press)
         self.ids.grid.add_widget(btn)
Exemplo n.º 19
0
 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')
Exemplo n.º 20
0
 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') 
Exemplo n.º 21
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)
Exemplo n.º 22
0
    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)
Exemplo n.º 23
0
    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(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())
Exemplo n.º 25
0
    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()
    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()
Exemplo n.º 27
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()
Exemplo n.º 28
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)
Exemplo n.º 29
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_selection=self.lap_selection)
     self.ids.channelvalues.color_sequence = self._color_sequence
     self.ids.mainchart.color_sequence = self._color_sequence
     self.stream_connecting = False
     Window.bind(mouse_pos=self.on_mouse_pos)
     Window.bind(on_motion=self.on_motion)
     self.init_view()
Exemplo n.º 30
0
class Laptime(SingleChannelGauge):
    Builder.load_string("""
<Laptime>:
    anchor_x: 'center'
    anchor_y: 'center'
    value_size: self.height
    AutoShrinkFieldLabel:
        text: root.NULL_LAP_TIME
        id: value
        font_size: root.font_size
    """)

    NULL_LAP_TIME = '--:--.--'
    value = BoundedNumericProperty(0,
                                   min=MIN_LAP_TIME,
                                   max=MAX_LAP_TIME,
                                   errorhandler=lambda x: MAX_LAP_TIME
                                   if x > MAX_LAP_TIME else MIN_LAP_TIME)
    font_size = NumericProperty()

    def __init__(self, **kwargs):
        super(Laptime, self).__init__(**kwargs)

    def on_value(self, instance, value):
        view = self.valueView
        if view:
            view.text = format_laptime(value)
        self.update_colors()

    def on_normal_color(self, instance, value):
        self.valueView.color = value
Exemplo n.º 31
0
class TimeDeltaGraph(SingleChannelGauge):
    Builder.load_string(TIME_DELTA_GRAPH_KV)
    label_color = ListProperty([1, 1, 1, 1.0])
    color = ListProperty([1, 1, 1, 0.5])
    minval = NumericProperty(-3.0)
    maxval = NumericProperty(3.0)
    ahead_color = ObjectProperty(DEFAULT_AHEAD_COLOR)
    behind_color = ObjectProperty(DEFAULT_BEHIND_COLOR)
    formatted_delta = StringProperty()

    def __init__(self, **kwargs):
        super(TimeDeltaGraph, self).__init__(**kwargs)
        self.bind(pos=self._update_size)
        self.bind(size=self._update_size)

    def _update_size(self, *args):
        self.refresh_value(self.value)

    def value_to_percent(self, value):
        min_value = self.minval
        max_value = self.maxval
        railed_value = max(min_value, min(max_value, value))

        range = max_value - min_value
        range = 1 if range == 0 else range

        offset = railed_value - min_value

        return offset * 100 / range

    def update_delta_color(self):
        self.color = self.ahead_color if self.value < 0 else self.behind_color

    def refresh_value(self, value):

        value = 0 if value is None else value

        pct = self.value_to_percent(value) / 100.0

        stencil = self.ids.stencil
        width = 0
        x = 0

        # Draw the bar, extending from either the left or right side of the center label
        # ========(DELTA)
        #         (DELTA)========
        delta_value_width = self.ids.delta_value.width
        # There seems to be a static 5 pixel offset fo the label,
        # cannot identify where this is coming from. leave this for now.
        MYSTERY_PIXEL_OFFSET = 5
        label_offset = (delta_value_width * 0.5) - MYSTERY_PIXEL_OFFSET

        center = self.width * 0.5
        width = abs(pct - 0.5) * (self.width - delta_value_width)
        x = center - width - label_offset if value > 0 else center + label_offset

        stencil.width = width
        stencil.x = x
        self.update_delta_color()
        self.formatted_delta = u'{0:+1.1f}\u2206'.format(value)
Exemplo n.º 32
0
class ComboView(DashboardScreen):
    Builder.load_string(COMBO_VIEW_KV)

    def __init__(self, databus, settings, **kwargs):
        super(ComboView, self).__init__(**kwargs)
        self.register_event_type('on_tracks_updated')
        self._databus = databus
        self._settings = settings
        self._initialized = False

    def init_view(self):
        data_bus = self._databus
        settings = self._settings

        gauges = list(kvFindClass(self, Gauge))

        for gauge in gauges:
            gauge.settings = settings
            gauge.data_bus = data_bus
        self._initialized = True

    def on_tracks_updated(self, trackmanager):
        pass

    def on_enter(self):
        if not self._initialized:
            self.init_view()
Exemplo n.º 33
0
class LapLegend(BoxLayout):
    '''
    A compound widget that presents a colored legend with session/lap information
    '''
    Builder.load_string('''
<LapLegend>:
    orientation: 'horizontal'
    spacing: sp(5)
    FieldLabel:
        id: lap
        size_hint_x: 0.7
        halign: 'right'
        valign: 'middle'
        text: '{} :: {}'.format(root.session, root.lap)
        color: root.color
    FieldLabel:
        id: laptime
        size_hint_x: 0.3
        halign: 'right'
        valign: 'middle'
        text: '{}'.format(root.lap_time)
    ''')
    color = ListProperty([1.0, 1.0, 1.0, 1.0])
    session = StringProperty('')
    lap = StringProperty('')
    lap_time = StringProperty('')
Exemplo n.º 34
0
class CustomizeChannelsScreen(BaseOptionsScreen):
    '''
    The customization view for customizing the selected channels
    '''
    Builder.load_string('''
<CustomizeChannelsScreen>:
    ''')

    def __init__(self, params, values, **kwargs):
        super(CustomizeChannelsScreen, self).__init__(params, values, **kwargs)
        self.params = params
        self.values = values

    def on_modified(self, *args):
        self.values.current_channels = args[1]
        super(CustomizeChannelsScreen, self).on_modified(*args)

    def on_enter(self):
        if self.initialized == False:
            content = CustomizeChannelsView(
                datastore=self.params.datastore,
                current_channels=self.values.current_channels)
            content.bind(on_channels_customized=self.on_modified)
            self.add_widget(content)
            self.initialized = True
Exemplo n.º 35
0
class TrackSelectionPopup(BoxLayout):
    Builder.load_string("""
<TrackSelectionPopup>:
    orientation: 'vertical'
    TracksBrowser:
        trackHeight: dp(200)
        id: browser
        size_hint_y: 0.90
    BoxLayout:
        size_hint_y: 0.1
        orientation: 'horizontal'
        IconButton:
            text: '\357\200\214'
            color: ColorScheme.get_accent()
            on_release: root.confirm_add_tracks()    
    """)

    def __init__(self, **kwargs):
        super(TrackSelectionPopup, self).__init__(**kwargs)
        self.register_event_type('on_tracks_selected')
        track_manager = kwargs.get('track_manager', None)
        track_browser = self.ids.browser
        track_browser.set_trackmanager(track_manager)
        track_browser.init_view()
        self.track_browser = track_browser

    def on_tracks_selected(self, selectedTrackIds):
        pass

    def confirm_add_tracks(self):
        self.dispatch('on_tracks_selected',
                      self.track_browser.selectedTrackIds)
Exemplo n.º 36
0
class TracksUpdateStatusView(BoxLayout):
    Builder.load_string("""
<TracksUpdateStatusView>:
    orientation: 'vertical'
    ProgressBar:
        id: progress
    Label:
        id: updatemsg    
    """)
    progressView = None
    messageView = None

    def __init__(self, **kwargs):
        super(TracksUpdateStatusView, self).__init__(**kwargs)
        self.progressView = self.ids.progress
        self.messageView = self.ids.updatemsg

    def _update_progress(self, percent):
        self.progressView.value = percent

    def _update_message(self, message):
        self.messageView.text = message

    def on_progress(self, count=None, total=None, message=None):
        if count and total:
            progress_percent = (float(count) / float(total) * 100)
            Clock.schedule_once(
                lambda dt: self._update_progress(progress_percent))
        if message:
            Clock.schedule_once(lambda dt: self._update_message(message))

    def on_message(self, message):
        self.messageView.text = message
Exemplo n.º 37
0
class AutomaticTrackConfigScreen(Screen):
    Builder.load_string(AUTOMATIC_TRACK_CONFIG_SCREEN_KV)
    track_manager = ObjectProperty(None)
    TRACK_ITEM_MIN_HEIGHT = 200
    def __init__(self, **kwargs):
        super(AutomaticTrackConfigScreen, self).__init__(**kwargs)
        tracks_view = self.ids.track_collection
        tracks_view._track_db = None
        tracks_view.bind(on_modified=self._on_modified)
        self.register_event_type('on_modified')

    def _on_modified(self, *args):
        self.dispatch('on_modified', args)

    def on_modified(self, *args):
        pass

    def on_config_updated(self, track_db):
        tracks_view = self.ids.track_collection
        tracks_view.on_config_updated(track_db)
        tracks_view.disableView(False)

    def on_track_manager(self, instance, value):
        tracks_view = self.ids.track_collection
        tracks_view.track_manager = value
        tracks_view.init_tracks_list()

    def disableView(self, disabled):
        self.ids.track_collection.disableView(disabled)
Exemplo n.º 38
0
class SelectDeviceView(InfoView):
    """
    A setup screen that lets users select what device they have.
    """
    Builder.load_string(SELECT_DEVICE_VIEW_KV)

    def __init__(self, **kwargs):
        super(SelectDeviceView, self).__init__(**kwargs)
        self.ids.next.disabled = True

    def select_device(self, device):
        self.ids.next.disabled = False
        self.ids.next.pulsing = True
        # update our setup config with the selected device
        step = self.get_setup_step('device')
        step['device'] = device

    def on_setup_config(self, instance, value):
        self._update_ui()

    def _update_ui(self):
        # set the button that matches what's in the current config, if set
        if self.setup_config is not None:
            step = self.get_setup_step('device')
            current_device = step['device']
            current_device_button = self.ids.get(current_device)
            if current_device_button is not None:
                current_device_button.active = True
Exemplo n.º 39
0
class TractionView(DashboardScreen):
    Builder.load_string(TRACTION_VIEW_KV)

    def __init__(self, databus, settings, dashboard_state, **kwargs):
        super(TractionView, self).__init__(**kwargs)
        self.register_event_type('on_tracks_updated')
        self._databus = databus
        self._settings = settings
        self._dashboard_state = dashboard_state
        self._initialized = False

    def init_view(self):
        data_bus = self._databus
        settings = self._settings

        gauges = list(kvFindClass(self, Gauge))

        for gauge in gauges:
            gauge.settings = settings
            gauge.data_bus = data_bus
            gauge.dashboard_state = self._dashboard_state
        self._initialized = True

        self.ids.imu_gauge.zoom = 0.5

    def on_tracks_updated(self, trackmanager):
        pass

    def on_enter(self):
        if not self._initialized:
            self.init_view()
        super(TractionView, self).on_enter()
Exemplo n.º 40
0
class TachometerView(DashboardScreen):
    Builder.load_string(TACHOMETER_VIEW_KV)

    _databus = None
    _settings = None

    def __init__(self, databus, settings, **kwargs):
        super(TachometerView, self).__init__(**kwargs)
        self._databus = databus
        self._settings = settings
        self._initialized = False

    def on_meta(self, channelMetas):
        pass

    def on_enter(self):
        if not self._initialized:
            self._init_screen()
        super(TachometerView, self).on_enter()

    def _init_screen(self):
        dataBus = self._databus
        settings = self._settings
        dataBus.addMetaListener(self.on_meta)

        gauges = list(kvFindClass(self, Gauge))

        for gauge in gauges:
            gauge.settings = settings
            gauge.data_bus = dataBus

        self._initialized = True
Exemplo n.º 41
0
class SymbolFieldLabel(FieldLabel):
    Builder.load_string("""
<SymbolFieldLabel>:
    font_size: self.height * 0.6
    font_name: 'resource/fonts/Roboto-Bold.ttf'
    shorten: False
""")
Exemplo n.º 42
0
class CustomizeTrackView(BaseOptionsScreen):
    """
    The customization view for selecting a track to display
    """
    Builder.load_string('''
<CustomizeTrackView>:
    BoxLayout:
        orientation: 'vertical'
        TracksBrowser:
            trackHeight: dp(200)
            multi_select: False
            id: track_browser
            size_hint_y: 0.90    
    ''')
    track_id = StringProperty(None, allownone=True)

    def __init__(self, params, values, **kwargs):
        super(CustomizeTrackView, self).__init__(params, values, **kwargs)
        self.ids.track_browser.set_trackmanager(self.params.track_manager)
        self.ids.track_browser.bind(on_track_selected=self.track_selected)
        self.ids.track_browser.init_view()

    def track_selected(self, instance, value):
        if type(value) is set:
            self.values.track_id = None if len(value) == 0 else next(
                iter(value))
        self.dispatch('on_screen_modified')
Exemplo n.º 43
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')
Exemplo n.º 44
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)
Exemplo n.º 45
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')
Exemplo n.º 46
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)
Exemplo n.º 47
0
Arquivo: app.py Projeto: 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
Exemplo n.º 48
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
Exemplo n.º 49
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()
Exemplo n.º 51
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'
''')
Exemplo n.º 52
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)
Exemplo n.º 53
0
# 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)
Exemplo n.º 54
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):
#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
Exemplo n.º 56
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)
 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
Exemplo n.º 59
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()