def __init__(self, **kwargs): super(RaceCaptureApp, self).__init__(**kwargs) # We do this because when this app is bundled into a standalone app # by pyinstaller we must reference all files by their absolute paths # sys._MEIPASS is provided by pyinstaller if getattr(sys, 'frozen', False): self.base_dir = sys._MEIPASS else: self.base_dir = os.path.dirname(os.path.abspath(__file__)) #self._keyboard = Window.request_keyboard(self._keyboard_closed, self) #self._keyboard.bind(on_key_down=self._on_keyboard_down) self.settings = SystemSettings(self.user_data_dir, base_dir=self.base_dir) self._databus = DataBusFactory().create_standard_databus( self.settings.systemChannels) self.settings.runtimeChannels.data_bus = self._databus Window.bind(on_keyboard=self._on_keyboard) self.register_event_type('on_tracks_updated') self.processArgs() self.settings.appConfig.setUserDir(self.user_data_dir) self.trackManager = TrackManager( user_dir=self.settings.get_default_data_dir(), base_dir=self.base_dir) self.setup_telemetry()
def __init__(self, **kwargs): super(RaceCaptureApp, self).__init__(**kwargs) if kivy.platform in ['ios', 'macosx', 'linux']: kivy.resources.resource_add_path( os.path.join(os.path.dirname(os.path.realpath(__file__)), "data")) # We do this because when this app is bundled into a standalone app # by pyinstaller we must reference all files by their absolute paths # sys._MEIPASS is provided by pyinstaller if getattr(sys, 'frozen', False): self.base_dir = sys._MEIPASS else: self.base_dir = os.path.dirname(os.path.abspath(__file__)) self.settings = SystemSettings(self.user_data_dir, base_dir=self.base_dir) self.settings.userPrefs.bind(on_pref_change=self._on_preference_change) self.track_manager = TrackManager( user_dir=self.settings.get_default_data_dir(), base_dir=self.base_dir) self.preset_manager = PresetManager( user_dir=self.settings.get_default_data_dir(), base_dir=self.base_dir) # RaceCapture communications API self._rc_api = RcpApi(on_disconnect=self._on_rcp_disconnect, settings=self.settings) self._databus = DataBusFactory().create_standard_databus( self.settings.systemChannels) self.settings.runtimeChannels.data_bus = self._databus self._datastore = CachingAnalysisDatastore(databus=self._databus) self._session_recorder = SessionRecorder(self._datastore, self._databus, self._rc_api, self.settings, self.track_manager, self._status_pump) self._session_recorder.bind(on_recording=self._on_session_recording) HelpInfo.settings = self.settings # Ensure soft input mode text inputs aren't obstructed Window.softinput_mode = 'below_target' # Capture keyboard events for handling escape / back Window.bind(on_keyboard=self._on_keyboard) self.register_event_type('on_tracks_updated') self.processArgs() self.settings.appConfig.setUserDir(self.user_data_dir) self.setup_telemetry()
def __init__(self, **kwargs): super(RaceCaptureApp, self).__init__(**kwargs) #self._keyboard = Window.request_keyboard(self._keyboard_closed, self) #self._keyboard.bind(on_key_down=self._on_keyboard_down) self.settings = SystemSettings(self.user_data_dir) self._data_bus = DataBusFactory().create_standard_databus( self.settings.systemChannels) Window.bind(on_key_down=self._on_keyboard_down) self.register_event_type('on_tracks_updated') self.processArgs() self.settings.appConfig.setUserDir(self.user_data_dir) self.trackManager = TrackManager(user_dir=self.user_data_dir)
# # This software is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # 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/>. from autosportlabs.racecapture.tracks.trackmanager import TrackManager import json import zipfile import StringIO import os tm = TrackManager() tracks = tm.download_all_tracks() mf = StringIO.StringIO() with zipfile.ZipFile(mf, mode='w', compression=zipfile.ZIP_DEFLATED) as zf: for track_id, track in tracks.iteritems(): track_json_string = json.dumps(track.to_dict(), sort_keys=True, indent=2, separators=(',', ': ')) zf.writestr('{}.json'.format(track_id), track_json_string) default_tracks_archive_path = os.path.join('defaults', 'default_tracks.zip') with open(default_tracks_archive_path, 'wb') as f: