Пример #1
0
    def fill_tree(self, fav_list):
        if platform == 'win':
            user_path = expanduser(u'~')
            if not isdir(user_path + sep + 'Desktop'):
                user_path = dirname(user_path) + sep
            else:
                user_path += sep
        else:
            user_path = expanduser(u'~') + sep
            
        self._favs = self.add_node(TreeLabel(text='Favorites', is_open=True, no_selection=True))
        self.reload_favs(fav_list)

        if not is_mobile_platform():
            libs = self.add_node(TreeLabel(text='Libraries', is_open=True,
                                           no_selection=True))
            places = ('Documents', 'Music', 'Pictures', 'Videos')
            for place in places:
                if isdir(user_path + place):
                    self.add_node(TreeLabel(text=place, path=user_path +
                                            place), libs)
            self._computer_node = self.add_node(TreeLabel(text='Computer',\
            is_open=True, no_selection=True))
            self._computer_node.bind(on_touch_down=self._drives_touch)
            self.reload_drives()
Пример #2
0
    def fill_tree(self, fav_list):
        if platform == 'win':
            user_path = expanduser(u'~')
            if not isdir(user_path + sep + 'Desktop'):
                user_path = dirname(user_path) + sep
            else:
                user_path += sep
        else:
            user_path = expanduser(u'~') + sep

        self._favs = self.add_node(
            TreeLabel(text='Favorites', is_open=True, no_selection=True))
        self.reload_favs(fav_list)

        if not is_mobile_platform():
            libs = self.add_node(
                TreeLabel(text='Libraries', is_open=True, no_selection=True))
            places = ('Documents', 'Music', 'Pictures', 'Videos')
            for place in places:
                if isdir(user_path + place):
                    self.add_node(
                        TreeLabel(text=place, path=user_path + place), libs)
            self._computer_node = self.add_node(TreeLabel(text='Computer',\
            is_open=True, no_selection=True))
            self._computer_node.bind(on_touch_down=self._drives_touch)
            self.reload_drives()
Пример #3
0
 def __init__(self, **kwargs):
     super(LuaScriptingView, self).__init__(**kwargs)
     self.script_cfg = None
     self.register_event_type("on_config_updated")
     self._logwindow_max_length = (
         LOGWINDOW_MAX_LENGTH_MOBILE if is_mobile_platform() else LOGWINDOW_MAX_LENGTH_DESKTOP
     )
     self.rc_api.addListener("logfile", lambda value: Clock.schedule_once(lambda dt: self.on_logfile(value)))
Пример #4
0
 def __init__(self, **kwargs):
     super(LuaScriptingView, self).__init__(**kwargs)
     self.script_cfg = None
     self.register_event_type('on_config_updated')
     self._logwindow_max_length = LOGWINDOW_MAX_LENGTH_MOBILE\
         if is_mobile_platform() else LOGWINDOW_MAX_LENGTH_DESKTOP
     self.rc_api.addListener(
         'logfile', lambda value: Clock.schedule_once(lambda dt: self.
                                                      on_logfile(value)))
Пример #5
0
    def __init__(self, capabilities, **kwargs):
        super(LuaScriptingView, self).__init__(**kwargs)
        self.script_cfg = None
        self.register_event_type('on_config_updated')
        self._logwindow_max_length = LOGWINDOW_MAX_LENGTH_MOBILE\
            if is_mobile_platform() else LOGWINDOW_MAX_LENGTH_DESKTOP
        self.rc_api.addListener('logfile', lambda value: Clock.schedule_once(lambda dt: self.on_logfile(value)))
        self._capabilities = capabilities

        if not capabilities.has_script:
            self._hide_lua()
Пример #6
0
    def set_config_defaults(self):
        '''
        Set defaults for preferences 
        '''
        # Base system preferences
        self.config.adddefaultsection('help')
        self.config.adddefaultsection('preferences')
        self.config.setdefault('preferences', 'distance_units', 'miles')
        self.config.setdefault('preferences', 'temperature_units', 'Fahrenheit')
        self.config.setdefault('preferences', 'show_laptimes', 1)
        self.config.setdefault('preferences', 'startup_screen', 'Home Page')
        default_user_files_dir = self.user_files_dir
        self.config.setdefault('preferences', 'config_file_dir', default_user_files_dir)
        self.config.setdefault('preferences', 'export_file_dir', default_user_files_dir)
        self.config.setdefault('preferences', 'firmware_dir', default_user_files_dir)
        self.config.setdefault('preferences', 'import_datalog_dir', default_user_files_dir)
        self.config.setdefault('preferences', 'send_telemetry', '0')
        self.config.setdefault('preferences', 'record_session', '1')
        self.config.setdefault('preferences', 'global_help', True)

        # Connection type for mobile
        if is_mobile_platform():
            if is_android():
                self.config.setdefault('preferences', 'conn_type', 'Bluetooth')
            elif is_ios():
                self.config.setdefault('preferences', 'conn_type', 'WiFi')
        else:
            self.config.setdefault('preferences', 'conn_type', 'Serial')

        # Dashboard preferences
        self.config.adddefaultsection('dashboard_preferences')
        self.config.setdefault('dashboard_preferences', 'last_dash_screen', '5x_gauge_view')
        self.config.setdefault('dashboard_preferences', 'pitstoptimer_enabled', 1)
        self.config.setdefault('dashboard_preferences', 'pitstoptimer_trigger_speed', 5)
        self.config.setdefault('dashboard_preferences', 'pitstoptimer_alert_speed', 25)
        self.config.setdefault('dashboard_preferences', 'pitstoptimer_exit_speed', 55)

        # Track detection pref
        self.config.adddefaultsection('track_detection')
        self.config.setdefault('track_detection', 'last_selected_track_id', 0)
        self.config.setdefault('track_detection', 'last_selected_track_timestamp', 0)
        self.config.setdefault('track_detection', 'user_cancelled_location', '0,0')

        self.config.adddefaultsection('analysis_preferences')
        self.config.setdefault('analysis_preferences', 'selected_sessions_laps', '{"sessions":{}}')
        self.config.setdefault('analysis_preferences', 'selected_analysis_channels', ','.join(UserPrefs.DEFAULT_ANALYSIS_CHANNELS))

        self.config.adddefaultsection('setup')
        self.config.setdefault('setup', 'setup_enabled', 1)
Пример #7
0
 import traceback
 import time
 from threading import Thread
 from kivy.properties import AliasProperty
 from functools import partial
 from kivy.clock import Clock
 from kivy.config import Config
 from kivy.logger import Logger
 kivy.require('1.9.1')
 from kivy.base import ExceptionManager, ExceptionHandler
 Config.set('graphics', 'width', '1024')
 Config.set('graphics', 'height', '576')
 Config.set('kivy', 'exit_on_escape', 0)
 from utils import is_mobile_platform
 # optimize scroll vs touch behavior for mobile platform
 if is_mobile_platform():
     Config.set('widgets', 'scroll_distance', 40)
     Config.set('widgets', 'scroll_timeout', 250)
 from kivy.core.window import Window
 from kivy.uix.boxlayout import BoxLayout
 from kivy.uix.label import Label
 from kivy.uix.popup import Popup
 from kivy.uix.screenmanager import *
 from installfix_garden_navigationdrawer import NavigationDrawer
 from autosportlabs.racecapture.views.util.alertview import alertPopup, confirmPopup
 from autosportlabs.racecapture.views.configuration.rcp.configview import ConfigView
 from autosportlabs.racecapture.views.status.statusview import StatusView
 from autosportlabs.racecapture.views.dashboard.dashboardview import DashboardView
 from autosportlabs.racecapture.views.analysis.analysisview import AnalysisView
 from autosportlabs.racecapture.views.preferences.preferences import PreferencesView
 from autosportlabs.racecapture.views.toolbar.toolbarview import ToolbarView
Пример #8
0
    import time
    from threading import Thread
    from kivy.config import Config
    from kivy.properties import AliasProperty
    from functools import partial
    from kivy.clock import Clock
    from kivy.logger import Logger
    kivy.require('1.10.0')
    from kivy.base import ExceptionManager, ExceptionHandler
    Config.set('graphics', 'width', '1024')
    Config.set('graphics', 'height', '576')
    Config.set('kivy', 'exit_on_escape', 0)
    from utils import is_mobile_platform, is_windows


    if is_mobile_platform():
        # optimize scroll vs touch behavior for mobile platform
        Config.set('widgets', 'scroll_distance', 40)
        Config.set('widgets', 'scroll_timeout', 250)

    from kivy.core.window import Window
    from kivy.uix.boxlayout import BoxLayout
    from kivy.uix.label import Label
    from kivy.uix.popup import Popup
    from kivy.uix.screenmanager import *
    if hasattr(sys, '_MEIPASS'):  # handle pyinstaller frozen packaging
        kivy.resources.resource_add_path(os.path.join(sys._MEIPASS))

    from installfix_garden_navigationdrawer import NavigationDrawer
    from autosportlabs.racecapture.views.util.alertview import alertPopup, confirmPopup
    from autosportlabs.racecapture.views.configuration.rcp.configview import ConfigView
Пример #9
0
 def _wifi_modified(self):
     if is_mobile_platform():
         Clock.schedule_once(
             lambda dt: HelpInfo.help_popup('wifi_warning', self.parent.
                                            parent), 1.0)
     self.dispatch('on_modified')
 def _wifi_modified(self):
     if is_mobile_platform():
         Clock.schedule_once(lambda dt: HelpInfo.help_popup('wifi_warning', self.parent.parent), 1.0)
     self.dispatch('on_modified')
Пример #11
0
 def on_info_ref(self, instance, value):
     print('ref')
     if value == 'podium' and is_mobile_platform():
         webbrowser.open('http://podium.live')
Пример #12
0
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
# 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.1')
from kivy.logger import Logger
from utils import is_mobile_platform, is_android
from kivy.clock import mainthread, Clock
from kivy.logger import Logger
from autosportlabs.racecapture.config.rcpconfig import GpsConfig
from autosportlabs.racecapture.geo.geopoint import GeoPoint
from kivy.event import EventDispatcher
if is_mobile_platform():
    from plyer import gps
    if is_android():
        from jnius import autoclass


class GeoProvider(EventDispatcher):
    """
    Provides a unified source of GPS data- 
    either from RaceCapture or an internal phone GPS sensor.
    """
    GPS_SOURCE_NONE = 0
    GPS_SOURCE_RACECAPTURE = 1
    GPS_SOURCE_INTERNAL = 2
    INTERNAL_GPS_UPDATE_INTERVAL_SEC = 0.5
Пример #13
0
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
# 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.10.0')
from kivy.logger import Logger
from utils import is_mobile_platform, is_android
from kivy.clock import mainthread, Clock
from kivy.logger import Logger
from autosportlabs.racecapture.config.rcpconfig import GpsConfig
from autosportlabs.racecapture.geo.geopoint import GeoPoint
from kivy.event import EventDispatcher
if is_mobile_platform():
    from plyer import gps
    if is_android():
        from jnius import autoclass


class GeoProvider(EventDispatcher):
    """
    Provides a unified source of GPS data- 
    either from RaceCapture or an internal phone GPS sensor.
    """
    GPS_SOURCE_NONE = 0
    GPS_SOURCE_RACECAPTURE = 1
    GPS_SOURCE_INTERNAL = 2
    INTERNAL_GPS_UPDATE_INTERVAL_SEC = 0.5