aboutsummaryrefslogtreecommitdiff
path: root/lib/python/Plugins/SystemPlugins/SoftwareManager/ImageWizard.py
diff options
context:
space:
mode:
authorFelix Domke <tmbinc@elitedvb.net>2009-02-13 15:11:21 +0100
committerFelix Domke <tmbinc@elitedvb.net>2009-02-13 15:11:21 +0100
commit935c5f9abeb0d6189c57f8406855d8437db8b0db (patch)
tree1fdce1e69db6448fc8332f9e656868902ca40d1b /lib/python/Plugins/SystemPlugins/SoftwareManager/ImageWizard.py
parent09dca95c63c7c9df2ccf08332f11b69673156e5b (diff)
parentda0da334b1314329d7d1f294d8df59acf66ac0d0 (diff)
downloadenigma2-935c5f9abeb0d6189c57f8406855d8437db8b0db.tar.gz
enigma2-935c5f9abeb0d6189c57f8406855d8437db8b0db.zip
Merge branch 'master' of git://git.opendreambox.org/git/acidburn/enigma2-master
Diffstat (limited to 'lib/python/Plugins/SystemPlugins/SoftwareManager/ImageWizard.py')
-rwxr-xr-xlib/python/Plugins/SystemPlugins/SoftwareManager/ImageWizard.py120
1 files changed, 120 insertions, 0 deletions
diff --git a/lib/python/Plugins/SystemPlugins/SoftwareManager/ImageWizard.py b/lib/python/Plugins/SystemPlugins/SoftwareManager/ImageWizard.py
new file mode 100755
index 00000000..1797e4fe
--- /dev/null
+++ b/lib/python/Plugins/SystemPlugins/SoftwareManager/ImageWizard.py
@@ -0,0 +1,120 @@
+from Screens.Wizard import WizardSummary
+from Screens.WizardLanguage import WizardLanguage
+from Screens.Wizard import wizardManager
+from Screens.Rc import Rc
+from Components.Label import Label
+from Components.MenuList import MenuList
+from Components.PluginComponent import plugins
+from Plugins.Plugin import PluginDescriptor
+from Tools.Directories import fileExists, resolveFilename, SCOPE_PLUGINS, SCOPE_SKIN_IMAGE
+from Components.Pixmap import Pixmap, MovingPixmap, MultiPixmap
+from os import popen, path, makedirs, listdir, access, stat, rename, remove, W_OK, R_OK
+
+from Components.config import config, getConfigListEntry, ConfigSubsection, ConfigText, ConfigLocations, ConfigBoolean
+from Components.Harddisk import harddiskmanager
+config.misc.firstrun = ConfigBoolean(default = True)
+config.plugins.configurationbackup = ConfigSubsection()
+config.plugins.configurationbackup.backuplocation = ConfigText(default = '/media/hdd/', visible_width = 50, fixed_size = False)
+config.plugins.configurationbackup.backupdirs = ConfigLocations(default=['/etc/enigma2/', '/etc/network/interfaces', '/etc/wpa_supplicant.conf'])
+
+
+backupfile = "enigma2settingsbackup.tar.gz"
+
+def checkConfigBackup():
+ parts = [ (r.description, r.mountpoint) for r in harddiskmanager.getMountedPartitions(onlyhotplug = False)]
+ for x in parts:
+ if x[1] == '/':
+ parts.remove(x)
+ if len(parts):
+ for x in parts:
+ if x[1].endswith('/'):
+ fullbackupfile = x[1] + 'backup/' + backupfile
+ if fileExists(fullbackupfile):
+ config.plugins.configurationbackup.backuplocation.value = str(x[1])
+ config.plugins.configurationbackup.backuplocation.save()
+ config.plugins.configurationbackup.save()
+ return x
+ else:
+ fullbackupfile = x[1] + '/backup/' + backupfile
+ if fileExists(fullbackupfile):
+ config.plugins.configurationbackup.backuplocation.value = str(x[1])
+ config.plugins.configurationbackup.backuplocation.save()
+ config.plugins.configurationbackup.save()
+ return x
+ return None
+
+def checkBackupFile():
+ backuplocation = config.plugins.configurationbackup.backuplocation.value
+ if backuplocation.endswith('/'):
+ fullbackupfile = backuplocation + 'backup/' + backupfile
+ if fileExists(fullbackupfile):
+ return True
+ else:
+ return False
+ else:
+ fullbackupfile = backuplocation + '/backup/' + backupfile
+ if fileExists(fullbackupfile):
+ return True
+ else:
+ return False
+
+if checkConfigBackup() is None:
+ backupAvailable = 0
+else:
+ backupAvailable = 1
+
+class ImageWizard(WizardLanguage, Rc):
+ skin = """
+ <screen name="ImageWizard" position="0,0" size="720,576" title="Welcome..." flags="wfNoBorder" >
+ <widget name="text" position="153,40" size="340,330" font="Regular;22" />
+ <widget source="list" render="Listbox" position="43,340" size="490,180" scrollbarMode="showOnDemand" >
+ <convert type="StringList" />
+ </widget>
+ <widget name="config" position="53,340" zPosition="1" size="440,180" transparent="1" scrollbarMode="showOnDemand" />
+ <ePixmap pixmap="skin_default/buttons/button_red.png" position="40,225" zPosition="0" size="15,16" transparent="1" alphatest="on" />
+ <widget name="languagetext" position="55,225" size="95,30" font="Regular;18" />
+ <widget name="wizard" pixmap="skin_default/wizard.png" position="40,50" zPosition="10" size="110,174" alphatest="on" />
+ <widget name="rc" pixmaps="skin_default/rc.png,skin_default/rcold.png" position="530,50" zPosition="10" size="154,500" alphatest="on" />
+ <widget name="arrowdown" pixmap="skin_default/arrowdown.png" position="-100,-100" zPosition="11" size="37,70" alphatest="on" />
+ <widget name="arrowdown2" pixmap="skin_default/arrowdown.png" position="-100,-100" zPosition="11" size="37,70" alphatest="on" />
+ <widget name="arrowup" pixmap="skin_default/arrowup.png" position="-100,-100" zPosition="11" size="37,70" alphatest="on" />
+ <widget name="arrowup2" pixmap="skin_default/arrowup.png" position="-100,-100" zPosition="11" size="37,70" alphatest="on" />
+ </screen>"""
+ def __init__(self, session):
+ self.xmlfile = resolveFilename(SCOPE_PLUGINS, "SystemPlugins/SoftwareManager/imagewizard.xml")
+ WizardLanguage.__init__(self, session, showSteps = False, showStepSlider = False)
+ Rc.__init__(self)
+ self.session = session
+ self["wizard"] = Pixmap()
+ self.selectedDevice = None
+
+ def markDone(self):
+ pass
+
+ def listDevices(self):
+ list = [ (r.description, r.mountpoint) for r in harddiskmanager.getMountedPartitions(onlyhotplug = False)]
+ for x in list:
+ result = access(x[1], W_OK) and access(x[1], R_OK)
+ if result is False or x[1] == '/':
+ list.remove(x)
+ for x in list:
+ if x[1].startswith('/autofs/'):
+ list.remove(x)
+ return list
+
+ def deviceSelectionMade(self, index):
+ self.deviceSelect(index)
+
+ def deviceSelectionMoved(self):
+ self.deviceSelect(self.selection)
+
+ def deviceSelect(self, device):
+ self.selectedDevice = device
+ config.plugins.configurationbackup.backuplocation.value = self.selectedDevice
+ config.plugins.configurationbackup.backuplocation.save()
+ config.plugins.configurationbackup.save()
+
+
+if config.misc.firstrun.value:
+ wizardManager.registerWizard(ImageWizard, backupAvailable, priority = 10)
+