def main(): gobject.threads_init() gtk.threads_init() DBusGMainLoop(set_as_default=True) session_bus = dbus.SessionBus() system_bus = dbus.SystemBus() name = dbus.service.BusName('org.freedesktop.Cozy', session_bus) mainloop = gobject.MainLoop() config = Configuration() backup_provider = BackupProvider() location_manager = LocationManager(config, system_bus) backup_location = location_manager.get_backup_location() with RestoreBackend(config, backup_provider, backup_location) as restore_backend: standard_fallback_restore_client_loader = StandardFallbackRestoreClientLoader(config.data_path) restore_control_center = RestoreControlCenter(restore_backend) wait_until_event_loop_is_running_thread = WaitUntilEventLoopIsRunningThread(mainloop, restore_control_center, standard_fallback_restore_client_loader) wait_until_event_loop_is_running_thread.start() restore_frontend = RestoreFrontend(restore_control_center, mainloop.quit) mainloop.run() restore_control_center.go_to_present()
def main(): gobject.threads_init() #@UndefinedVariable gtk.gdk.threads_init() #@UndefinedVariable DBusGMainLoop(set_as_default=True) mainloop = gobject.MainLoop() session_bus = dbus.SessionBus() notification_service_object = session_bus.get_object('org.freedesktop.Notifications', '/org/freedesktop/Notifications') notification_service = dbus.Interface(notification_service_object, dbus_interface='org.freedesktop.Notifications') name = dbus.service.BusName('org.freedesktop.Cozy', session_bus) backup_provider = BackupProvider() config = Configuration() system_bus = dbus.SystemBus() location_manager = LocationManager(system_bus) backup_location = location_manager.get_backup_location(config) standard_fallback_restore_client_loader = StandardFallbackRestoreClientLoader(config.data_path) restore_client_connector = RestoreClientConnector(session_bus, standard_fallback_restore_client_loader) with RestoreBackend(config, backup_provider, backup_location) as restore_backend: with RestoreControlCenter(restore_backend) as restore_control_center: icon = CozyIcon(config, restore_backend, notification_service, mainloop, restore_client_connector, restore_control_center, location_manager) mainloop.run()
def __create_filestructure_in_backup_location(self): system_bus = dbus.SystemBus() location_manager = LocationManager(system_bus) backup_location = location_manager.get_backup_location(self.config) backup_path = backup_location.get_path() if self.config.backup_type == 'CozyFS': subprocess.check_call([COZY_MKFS_PATH, '--no-version', backup_path, str(self.config.backup_id)]) elif self.config.backup_type == 'PlainFS': os.makedirs(os.path.join(backup_path, str(self.config.backup_id), '0')) elif self.config.backup_type == 'HardlinkedFS': pass