def buildMy_rec(self, device): mypath = DeliteGetSkinPath() device2 = re.sub('[0-9]', '', device) devicetype = path.realpath('/sys/block/' + device2 + '/device') d2 = device name = _('HARD DISK: ') mypixmap = mypath + 'icons/dev_hdd.png' model = file('/sys/block/' + device2 + '/device/model').read() model = str(model).replace('\n', '') des = '' if devicetype.find('usb') != -1: name = _('USB: ') mypixmap = mypath + 'icons/dev_usb.png' name = name + model f = open('/proc/mounts', 'r') for line in f.readlines(): if line.find(device) != -1: parts = line.strip().split() d1 = parts[1] dtype = parts[2] break continue else: d1 = _('None') dtype = _('unavailable') f.close() size = Harddisk(device).diskSize() if float(size) / 1024 / 1024 >= 1: des = _('Size: ') + str(round(float(size) / 1024 / 1024, 2)) + _('TB') elif size / 1024 >= 1: des = _('Size: ') + str(round(float(size) / 1024, 2)) + _('GB') elif size >= 1: des = _('Size: ') + str(size) + _('MB') else: des = _('Size: ') + _('unavailable') item = NoSave( ConfigSelection(default='/media/' + device, choices=[('/media/' + device, '/media/' + device), ('/universe', '/universe'), ('/media/hdd', '/media/hdd'), ('/media/usb', '/media/usb'), ('/media/downloads', '/media/downloads'), ('/media/music', '/media/music'), ('/media/personal', '/media/personal'), ('/media/video', '/media/video'), ('/media/photo', '/media/photo')])) if dtype == 'Linux': dtype = 'ext3' else: dtype = 'auto' item.value = d1.strip() text = name + ' ' + des + ' /dev/' + device res = getConfigListEntry(text, item, device, dtype) if des != '' and self.list.append(res): pass
def updateList(self): self.list = [] mypath = DeliteGetSkinPath() mypixmap = mypath + 'icons/plugin_list_setup.png' png = LoadPixmap(mypixmap) name = _('Reorder plugins list') idx = 0 res = (name, png, idx) self.list.append(res) mypixmap = mypath + 'icons/fast_plugin_setup.png' png = LoadPixmap(mypixmap) name = _('Fast Plugin Setup') idx = 1 res = (name, png, idx) self.list.append(res) self['list'].list = self.list
def buildMy_rec(self, device): mypath = DeliteGetSkinPath()
def buildMy_rec(self, device): mypath = DeliteGetSkinPath() device2 = re.sub('[0-9]', '', device) devicetype = path.realpath('/sys/block/' + device2 + '/device') d2 = device name = _('HARD DISK: ') mypixmap = mypath + 'icons/dev_hdd.png' model = file('/sys/block/' + device2 + '/device/model').read() model = str(model).replace('\n', '') des = '' if devicetype.find('usb') != -1: name = _('USB: ') mypixmap = mypath + 'icons/dev_usb.png' name = name + model self.Console = Console() self.Console.ePopen("sfdisk -l /dev/sd? | grep swap | awk '{print $(NF-9)}' >/tmp/devices.tmp") sleep(0.5) f = open('/tmp/devices.tmp', 'r') swapdevices = f.read() f.close() if path.exists('/tmp/devices.tmp'): remove('/tmp/devices.tmp') swapdevices = swapdevices.replace('\n', '') swapdevices = swapdevices.split('/') f = open('/proc/mounts', 'r') for line in f.readlines(): if line.find(device) != -1: parts = line.strip().split() d1 = parts[1] dtype = parts[2] rw = parts[3] break continue elif device in swapdevices: parts = line.strip().split() d1 = _('None') dtype = 'swap' rw = _('None') break continue else: d1 = _('None') dtype = _('unavailable') rw = _('None') f.close() size = Harddisk(device).diskSize() if float(size) / 1024 / 1024 >= 1: des = _('Size: ') + str(round(float(size) / 1024 / 1024, 2)) + _('TB') elif size / 1024 >= 1: des = _('Size: ') + str(round(float(size) / 1024, 2)) + _('GB') elif size >= 1: des = _('Size: ') + str(size) + _('MB') else: des = _('Size: ') + _('unavailable') if des != '': if rw.startswith('rw'): rw = ' R/W' elif rw.startswith('ro'): rw = ' R/O' else: rw = '' des += '\t' + _('Mount: ') + d1 + '\n' + _('Device: ') + '/dev/' + device + '\t' + _('Type: ') + dtype + rw png = LoadPixmap(mypixmap) res = (name, des, png) self.list.append(res)
def updateList(self): self.list = [] mypath = DeliteGetSkinPath() rc = system('df -h > /tmp/syinfo.tmp') mypixmap = mypath + 'icons/icon_home_BH.png' png = LoadPixmap(mypixmap) name = 'Black Hole' title = MultiContentEntryText(pos=(120, 30), size=(480, 50), font=0, text=name) png = MultiContentEntryPixmapAlphaTest(pos=(0, 3), size=(100, 100), png=png) self.list.append([name, title, png]) mypixmap = mypath + 'icons/icon_avalon.png' png = LoadPixmap(mypixmap) name = 'Avalon' title = MultiContentEntryText(pos=(120, 30), size=(480, 50), font=0, text=name) png = MultiContentEntryPixmapAlphaTest(pos=(0, 3), size=(100, 100), png=png) self.list.append([name, title, png]) mypixmap = mypath + 'icons/icon_chaos.png' png = LoadPixmap(mypixmap) name = 'Chaos' title = MultiContentEntryText(pos=(120, 30), size=(480, 50), font=0, text=name) png = MultiContentEntryPixmapAlphaTest(pos=(0, 3), size=(100, 100), png=png) self.list.append([name, title, png]) mypixmap = mypath + 'icons/icon_ghost.png' png = LoadPixmap(mypixmap) name = 'Ghost' title = MultiContentEntryText(pos=(120, 30), size=(480, 50), font=0, text=name) png = MultiContentEntryPixmapAlphaTest(pos=(0, 3), size=(100, 100), png=png) self.list.append([name, title, png]) self['list'].setList(self.list) self.current_universe = self.whereIAm() txt = _('You are in %s universe.') % self.current_universe self['lab1'].setText(txt) btot = buse = bempty = utot = uuse = uempty = '' f = open('/tmp/syinfo.tmp', 'r') for line in f.readlines(): parts = line.split() tot = len(parts) - 1 if parts[tot].strip() == '/': btot = parts[tot - 4].strip() buse = parts[tot - 1].strip() bempty = parts[tot - 2].strip() elif parts[tot].strip() == '/universe': utot = parts[tot - 4].strip() uuse = parts[tot - 1].strip() uempty = parts[tot - 2].strip() break f.close() os_remove('/tmp/syinfo.tmp') text = _('Black Hole details:\nBlack Hole is the original matrix of all Parallel Universes and resides in its own phisycal space.\n') text += _('Estimated size: %s \n') % btot text += _('Occupied space: %s \n') % buse text += _('Empty space: %s \n\n') % bempty text += _('Parallel Universes details:\nParallel Universes share the same space because they are all together in the same place, but in different dimensions.\n') text += _('Estimated size: %s \n') % utot text += _('Occupied space: %s \n') % uuse text += _('Empty space: %s \n\n') % uempty self['lab2'].setText(text) pos = 0 sel = self['list'].getCurrent() for x in self.list: if x[0] == self.current_universe: self['list'].moveToIndex(pos) break pos += 1
def updateList(self): self.list = [] mypath = DeliteGetSkinPath() rc = system("df -h > /tmp/syinfo.tmp") mypixmap = mypath + "icons/icon_home_BH.png" png = LoadPixmap(mypixmap) name = "Black Hole" title = MultiContentEntryText(pos=(120, 30), size=(480, 50), font=0, text=name) png = MultiContentEntryPixmapAlphaTest(pos=(0, 3), size=(100, 100), png=png) self.list.append([name, title, png]) mypixmap = mypath + "icons/icon_avalon.png" png = LoadPixmap(mypixmap) name = "Avalon" title = MultiContentEntryText(pos=(120, 30), size=(480, 50), font=0, text=name) png = MultiContentEntryPixmapAlphaTest(pos=(0, 3), size=(100, 100), png=png) self.list.append([name, title, png]) mypixmap = mypath + "icons/icon_chaos.png" png = LoadPixmap(mypixmap) name = "Chaos" title = MultiContentEntryText(pos=(120, 30), size=(480, 50), font=0, text=name) png = MultiContentEntryPixmapAlphaTest(pos=(0, 3), size=(100, 100), png=png) self.list.append([name, title, png]) mypixmap = mypath + "icons/icon_ghost.png" png = LoadPixmap(mypixmap) name = "Ghost" title = MultiContentEntryText(pos=(120, 30), size=(480, 50), font=0, text=name) png = MultiContentEntryPixmapAlphaTest(pos=(0, 3), size=(100, 100), png=png) self.list.append([name, title, png]) self["list"].setList(self.list) self.current_universe = self.whereIAm() txt = _("You are in %s universe.") % (self.current_universe) self["lab1"].setText(txt) btot = buse = bempty = utot = uuse = uempty = "" f = open("/tmp/syinfo.tmp", 'r') for line in f.readlines(): parts = line.split() tot = len(parts) - 1 if parts[tot].strip() == "/": btot = parts[(tot - 4)].strip() buse = parts[(tot - 1)].strip() bempty = parts[(tot - 2)].strip() elif parts[tot].strip() == "/universe": utot = parts[(tot - 4)].strip() uuse = parts[(tot - 1)].strip() uempty = parts[(tot - 2)].strip() break f.close() os_remove("/tmp/syinfo.tmp") text = _( "Black Hole details:\nBlack Hole is the original matrix of all Parallel Universes and resides in its own phisycal space.\n" ) text += _("Estimated size: %s \n") % (btot) text += _("Occupied space: %s \n") % (buse) text += _("Empty space: %s \n\n") % (bempty) text += _( "Parallel Universes details:\nParallel Universes share the same space because they are all together in the same place, but in different dimensions.\n" ) text += _("Estimated size: %s \n") % (utot) text += _("Occupied space: %s \n") % (uuse) text += _("Empty space: %s \n\n") % (uempty) self["lab2"].setText(text) pos = 0 sel = self["list"].getCurrent() for x in self.list: if x[0] == self.current_universe: self["list"].moveToIndex(pos) break pos += 1