def on_choose_temp_target_btn_clicked(self, widget, data=None): dlg = gtk.FileChooserDialog(action=gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER, buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, gtk.STOCK_OPEN, gtk.RESPONSE_OK)) if dlg.run() == gtk.RESPONSE_OK: backup_location = RemoveableBackupLocation(dbus.SystemBus(), arbitrary_path=dlg.get_filename()) self.config.backup_location_identifier = backup_location.serialize() self.volume_name_label.set_text(backup_location.volume_label()) self.relative_path_label.set_text(backup_location.rel_path) dlg.destroy()
def __setup_controls(self): if self.config.backup_enabled is not None: self.enable_checkbox.set_active(self.config.backup_enabled) else: print "No configuration found. Creating new one with backup disabled." self.enable_checkbox.set_active(False) self.global_sections.set_sensitive(self.enable_checkbox.get_active()) if self.config.data_path is not None: self.source_path_label.set_text(self.config.data_path) else: self.source_path_label.set_text('Not configured') identifier = self.config.backup_location_identifier if self.config.backup_location_type is not None: if self.config.backup_location_type == 'removeable_volume': self.temp_radio.set_active(True) if identifier is not None: uuid, rel_path = identifier.split(':') backup_location = RemoveableBackupLocation(dbus.SystemBus(), uuid, rel_path) self.volume_name_label.set_text(backup_location.volume_label()) self.relative_path_label.set_text(rel_path) else: self.volume_name_label.set_text('Not configured') self.relative_path_label.set_text('Not configured') else: self.permanent_radio.set_active(True) if identifier is not None: self.absolute_path_label.set_text(identifier) else: self.absolute_path_label.set_text('Not configured') else: self.permanent_radio.set_active(True) self.absolute_path_label.set_text('Not configured') self.on_permanent_mode_changed(self.permanent_radio) self.on_temporary_mode_changed(self.temp_radio) if self.config.backup_type is not None: if self.config.backup_type == 'CozyFS': self.cozyfs_radio.set_active(True) elif self.config.backup_type == 'PlainFS': self.plainfs_radio.set_active(True) self.on_radio_cozyfs_changed(self.cozyfs_radio) self.on_radio_plainfs_changed(self.plainfs_radio)