def on_save_profile(self, category): dlg = wx.FileDialog(self, _("Select profile file to save"), profile.get_base_path(), category.replace('_settings', ''), style=wx.FD_SAVE) dlg.SetWildcard("JSON files (*.json)|*.json") if dlg.ShowModal() == wx.ID_OK: profile_file = dlg.GetPath() if not profile_file.endswith('.json'): if sys.is_linux(): # hack for linux, as for some reason the .json is not appended. profile_file += '.json' profile.settings.save_settings(profile_file, categories=[category]) dlg.Destroy()
def _save_image(self): image = driver.camera.capture_image() dlg = wx.FileDialog(self, _("Save image"), style=wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT) wildcard_list = ';'.join(map(lambda s: '*' + s, ['.png'])) wildcard_filter = "Image files (%s)|%s;%s" % (wildcard_list, wildcard_list, wildcard_list.upper()) dlg.SetWildcard(wildcard_filter) if dlg.ShowModal() == wx.ID_OK: filename = dlg.GetPath() if not filename.endswith('.png'): if sys.is_linux(): # hack for linux, as for some reason the .ply is not appended. filename += '.png' driver.camera.save_image(filename, image) dlg.Destroy()
def on_export_log(self, event): dlg = wx.FileDialog(self, _("Select log file to save"), profile.get_base_path(), style=wx.FD_SAVE) dlg.SetWildcard("Log files (*.log)|*.log") if dlg.ShowModal() == wx.ID_OK: log_file = dlg.GetPath() if not log_file.endswith('.log'): if sys.is_linux(): # hack for linux, as for some reason the .log is not appended. log_file += '.log' with open(log_file, 'w') as _file: with open('horus.log', 'r') as _log: _file.write(_log.read()) log_file dlg.Destroy()
def on_save_model(self, event): if self.workbench['scanning'].scene_view._object is None or \ not self.workbench['scanning'].scene_view._object._is_point_cloud: return dlg = wx.FileDialog(self, _("Save 3D model"), os.path.split( profile.settings['last_file'])[0], style=wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT) file_extensions = mesh_loader.save_supported_extensions() wildcard_list = ';'.join(['*' + s for s in file_extensions]) wildcard_filter = "Mesh files (%s)|%s;%s" % (wildcard_list, wildcard_list, wildcard_list.upper()) dlg.SetWildcard(wildcard_filter) if dlg.ShowModal() == wx.ID_OK: filename = dlg.GetPath() if not filename.endswith('.ply'): if sys.is_linux(): # hack for linux, as for some reason the .ply is not appended. filename += '.ply' mesh_loader.save_mesh(filename, self.workbench['scanning'].scene_view._object) self.append_last_file(filename) dlg.Destroy()
def initialize_driver(self): # Serial name serial_list = driver.board.get_serial_list() current_serial = profile.settings['serial_name'] if len(serial_list) > 0: if current_serial not in serial_list: profile.settings['serial_name'] = serial_list[0] # Video id video_list = driver.camera.get_video_list() current_video_id = profile.settings['camera_id'] if len(video_list) > 0: if current_video_id not in video_list: profile.settings['camera_id'] = unicode(video_list[0]) if len(profile.settings['camera_id']): driver.camera.camera_id = int(profile.settings['camera_id'][-1:]) driver.board.serial_name = profile.settings['serial_name'] driver.board.baud_rate = profile.settings['baud_rate'] driver.board.motor_invert(profile.settings['invert_motor']) platform_extrinsics.set_estimated_size( profile.settings['estimated_size']) flush_setting = 'flush_' flush_stream_setting = 'flush_stream_' if sys.is_linux(): flush_setting += 'linux' flush_stream_setting += 'linux' elif sys.is_darwin(): flush_setting += 'darwin' flush_stream_setting += 'darwin' elif sys.is_windows(): flush_setting += 'windows' flush_stream_setting += 'windows' texture, laser, pattern = profile.settings[flush_setting] image_capture.set_flush_values(texture, laser, pattern) texture, laser, pattern = profile.settings[flush_stream_setting] image_capture.set_flush_stream_values(texture, laser, pattern)
def _get_executable_url(version): url = None if sys.is_linux(): import platform url = 'https://launchpad.net/~bqlabs/+archive/ubuntu/horus/+files/' url += 'horus_' url += version + '-' url += platform.linux_distribution()[2] + '1_' if platform.architecture()[0] == '64bit': url += 'amd64.deb' elif platform.architecture()[0] == '32bit': url += 'i386.deb' del platform elif sys.is_windows(): url = URL_DOWNLOAD url += latest_version url += '/Horus_' url += version + '.exe' elif sys.is_darwin(): url = URL_DOWNLOAD url += latest_version url += '/Horus_' url += version + '.dmg' return url