# page_mediumprofile.py - Handler for the project settings page # # (c) Copyright 2010 Michael Towers (larch42 at googlemail dot com) # # This file is part of the larch project. # # larch is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # larch 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 larch; if not, write to the Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # #---------------------------------------------------------------------------- # 2010.07.14 class MediumProfile: def __init__(self): ui.widgetlist(fss('fetch_layout', 'page_mediumprofile.uim')) ui.connectlist( (':bootlines*clicked', self.editbootlines), (':grubtemplate*clicked', self.editgrub), (':syslinuxtemplate*clicked', self.editsyslin), (':cdroot*clicked', self.browsecdroot), (':nosessionsave*toggled', self.nosessionsave), ) def enter(self): """This is called when the page is entered/selected/shown. It performs initializations which depend on the state. """ docviewer.gohome('gui_mediumprofile.html') ui.command(':nosessionsave.set', fss('isfile', 'profile:nosave')) # def data(self, key): # return ui.command('mediumprofile_page_data.get', key) def editbootlines(self): edit('profile:bootlines', 'base:data/bootlines') def editgrub(self): f0 = 'profile:cd-root/grub0/menu.lst' if not fss('isfile', f0): f0 = 'base:cd-root/grub0/menu.lst' edit('profile:cd-root/grub/menu.lst', f0) def editsyslin(self): f0 = 'profile:cd-root/isolinux0/isolinux.cfg' if not fss('isfile', f0): f0 = 'base:cd-root/isolinux0/isolinux.cfg' edit('profile:cd-root/isolinux/isolinux.cfg', f0) def browsecdroot(self): fss('browse', 'profile:cd-root') def nosessionsave(self, on): """Whether session saving is available is firstly determined by the writability of the boot device (assuming the extension feature to allow the use of other devices is not being used). The standard scripts will also not offer session saving if the file larch/nosave is present on the boot medium. """ ns = fss('isfile', 'profile:nosave') if on: if not ns: fss('savefile', 'profile:nosave', "Suggestion to disable session saving" " (can be overridden)") else: fss('rm_rf', 'profile:nosave')