def opt4_datas(self): p_lLines = { 'text': "Device", 'icon': None, 'color_val': "type_color_1" } try: self.m_oEXTSTGClass except: self.m_oEXTSTGClass = external_storage() if self.m_oEXTSTGClass.check(): value = self.m_oEXTSTGClass.check_connected() logging.info("estado usb %s" % value) if not value: value = "Waiting..." p_lLines.update({'color_val': "type_color_7"}) else: p_lLines.update({'text': "Eject"}) p_lLines.update({'icon': "icon_eject"}) else: value = "--" p_lLines.update({'color_val': "type_color_7"}) p_lLines.update({'value': value}) return p_lLines
def opt3_datas(self): p_lLines = {'text': "Available", 'color_val': "type_color_1"} disk = "/dev/root" try: self.m_oEXTSTGClass except: self.m_oEXTSTGClass = external_storage() value = self.m_oEXTSTGClass.check_connected() if value: disk = value try: command = 'df -h | grep %s' % disk tmp = subprocess.check_output(command, shell=True).decode("utf-8") tmp = re.sub(r' +', " ", tmp).strip().split(" ") except: tmp = "" try: p_iFree = str(100 - int(tmp[4].replace('%', ''))) + '%' space = tmp[3] + '/' + tmp[1] + '(' + p_iFree + ')' if not '%' in tmp[4]: space = "CALCULATING..." except: space = "CALCULATING..." if space == "CALCULATING...": p_lLines.update({'color_val': "type_color_7"}) p_lLines.update({'value': space}) return p_lLines
def opt2_datas(self): p_lLines = {'text': "ROMs Storage", 'color_val': "type_color_1"} try: self.m_oEXTSTGClass except: self.m_oEXTSTGClass = external_storage() disk = "SD" value = self.m_oEXTSTGClass.check_connected() if value and "usb" in value: disk = "USB" p_lLines.update({'value': disk}) return p_lLines
def opt1_datas(self): p_lLines = {'text': "Enable External USB", 'color_val': "type_color_1", 'es_restart': False} try: self.m_oEXTSTGClass except: self.m_oEXTSTGClass = external_storage() value = self.m_oEXTSTGClass.check() if value: p_lLines.update({'es_restart': True}) p_lLines.update({'value': value}) return p_lLines
def opt4(self, p_iJoy = None, p_iLine = None): p_lLines = {} try: self.m_oEXTSTGClass except: self.m_oEXTSTGClass = external_storage() if p_iJoy == None: return self.opt4_datas() if p_iJoy & CRT_OK: if self.m_oEXTSTGClass.check_connected(): self.info("Please Wait", 'icon_clock') self.m_oEXTSTGClass.eject() time.sleep(2) self.info()
def opt1(self, p_iJoy = None, p_iLine = None): try: self.m_oEXTSTGClass except: self.m_oEXTSTGClass = external_storage() p_lLines = {} if p_iJoy == None: return self.opt1_datas() if p_iJoy & CRT_OK: list = self.m_lLines[p_iLine]['options'] value = self.m_lLines[p_iLine]['value'] new = explore_list(p_iJoy, value, list) if value and not new: self.m_lCtrl[p_iLine].update({'es_restart': True}) else: self.m_lCtrl[p_iLine].update({'es_restart': False}) self.info("Please Wait", "icon_clock") if new == False: self.m_oEXTSTGClass.stop() elif new == True: self.m_oEXTSTGClass.init() self.info() self.m_lLines[p_iLine]['value'] = new