def config_EVOLUTION_addressbook(self): """Convierte e integra los contactos en la libreta de direcciones de Evolution """ vcard = os.path.join(self.dest.path, _("Contactos")) if not os.path.exists(vcard): vcard = commands.getoutput("rgrep -l VCARD %s" % self.dest.path.replace(' ', '\ ')) if not vcard or not os.path.exists(vcard): return 0 import bsddb adb=os.path.join(os.path.expanduser('~'),'.evolution','addressbook','local','system','addressbook.db') folder(os.path.dirname(adb)) db = bsddb.hashopen(adb,'w') if not 'PAS-DB-VERSION\x00' in db.keys(): db['PAS-DB-VERSION\x00'] = '0.2\x00' contacts = open(vcard, 'r') while 1: l = contacts.readline() if not l: break if l.find('BEGIN:VCARD') != -1: randomid = 'pas-id-' + str(random.random())[2:] db[randomid+'\x00'] = 'BEGIN:VCARD\r\nUID:' + randomid + '\r\n' while 1: v = contacts.readline() if v.find('END:VCARD') != -1: db[randomid+'\x00'] += 'END:VCARD\x00' break else: db[randomid+'\x00'] += v.replace('PERSONAL','HOME').replace('\n', '\r\n') db.sync() db.close() os.remove(vcard)
def get_configuration(self): if self.user.os.find('XP') > 0: e = self.user.search_key("Software\eMule") if e and 'Install Path' in e.keys(): path = e["Install Path"].replace(e["Install Path"][:2], self.user.mount_points[e["Install Path"][:2]]) if exists(join(path,'config','preferences.ini')): return folder(join(path,'config')) elif self.user.os.find('Vista') > 0: d = join(self.user.folders["Local AppData"].path, 'eMule', 'config') if exists(d): return folder(d)
def config_EVOLUTION_calendar(self): """Convierte e integra el calendario en Evolution""" vcal = os.path.join(self.dest.path, _("Calendario")) if not os.path.exists(vcal): vcal = commands.getoutput("rgrep -l VEVENT %s" % self.dest.path.replace(' ', '\ ')) if not vcal or not os.path.exists(vcal): return 0 old = None dates = [] evo_cal = os.path.join(os.path.expanduser('~'),'.evolution','calendar','local','system','calendar.ics') folder(os.path.dirname(evo_cal)) if os.path.exists(evo_cal): old = backup(evo_cal) if old: new_cal = open(evo_cal, "w") old_cal = open(old, 'r') for l in old_cal.readlines(): if l.find('END:VCALENDAR') == -1: new_cal.write(l) if l.find('BEGIN:VEVENT') != -1: dt, sum = None, None elif l.find('END:VEVENT') != -1: if dt and sum: dates.append(dt+sum) elif l.find('DTSTART') != -1: dt = l.replace('DTSTART:', '') elif l.find('SUMMARY') != -1: sum = l.replace('SUMMARY:', '') old_cal.close() orig = open(vcal,"r") events = False if not old: new_cal = open(evo_cal, "w") new_cal.write('BEGIN:VCALENDAR\n') new_cal.write('CALSCALE:GREGORIAN\n') new_cal.write('VERSION:2.0\n') buffer = '' for l in orig.readlines(): buffer += l if l.find('BEGIN:VEVENT') != -1: dt, sum = None, None buffer = l elif l.find('END:VEVENT') != -1: if dt and sum and not dt+sum in dates: new_cal.write(buffer) elif l.find('DTSTART') != -1: dt = l.replace('DTSTART:', '') elif l.find('SUMMARY') != -1: sum = l.replace('SUMMARY:', '') new_cal.write('END:VCALENDAR\n') orig.close() os.remove(vcal)
def __init__(self): """Constructor de la clase""" self.errors = [] self.config_file = os.path.join(os.path.expanduser('~'), '.purple', 'accounts.xml') if not os.path.exists(self.config_file): folder(os.path.join(os.path.expanduser("~"),'.purple')) try: f = open (self.config_file, "w") f.write('<?xml version=\'1.0\' encoding=\'UTF-8\' ?>\n') f.write('<account version=\'1.0\'>\n') f.write('</account>') f.close() except: self.error('Failed to create %s' % config_file) return 0
def msn2amsn(cuenta): """Configura las cuentas de amsn Argumento de entrada: cuenta -> identificador de cuenta de MSN """ destino = folder(os.path.join(os.path.expanduser("~"),'.amsn')) if destino: if os.path.exists(os.path.join(destino.path, 'profiles')): bak = backup(os.path.join(destino.path, 'profiles')) try: f = open (os.path.join(destino.path, 'profiles'), "a") #insert at the bottom, the program automatically will reorder the file f.write(cuenta + ' 0\n') f.close() except: f.close() error("Config aMSN failed") restore_backup(bak) else: try: f = open (os.path.join(destino.path, 'profiles'), "w") f.write('amsn_profiles_version 1\n') f.write(cuenta + ' 0\n') f.close() except: f.close() error("Config aMSN failed")
def import_mails(self): """Convierte los correos al formato Mailbox.""" self.dest = folder( os.path.join(os.path.expanduser("~"), ".evolution", "mail", "local", _("Correo de ") + self.name + ".sbd") ) for mb in self.mailboxes: mb.copy(self.dest, exclude=[".dat", ".msf"])
def check_config(self, c): """Comprueba que la configuración de la cuenta está completa Argumentos de entrada: c -> objeto de tipo Mailconfig """ c[c["type"].upper() + " Server"] = c["hostname"] c[c["type"].upper() + " User Name"] = c["userName"] if "port" in c.keys(): c[c["type"].upper() + " Port"] = eval(c["port"]) if "socketType" in c.keys(): c["Connection Type"] = str(c["socketType"]) if c["socketType"] == "3": c[c["type"].upper() + " Use SSL"] = "1" c["Account Name"] = c["name"] c["SMTP Display Name"] = c["fullName"] c["SMTP Email Address"] = c["smtpusername"] c["SMTP Server"] = c["smtphostname"] if "smtpport" in c.keys(): c["SMTP Port"] = eval(c["smtpport"]) if "smtptry_ssl" in c.keys(): c["SMTP Use SSL"] = "1" c["Email Address"] = c["useremail"] if "leave_on_server" in c.keys(): c["Leave Mail On Server"] = "1" if "empty_trash_on_exit" in c.keys(): c["Remove When Deleted"] = "1" # print c # print c['directory-rel'].replace("[ProfD]",os.path.dirname(self.user.get_THUNDERBIRD_prefs())+'/') self.mailboxes.append( folder(c["directory-rel"].replace("[ProfD]", os.path.dirname(self.user.get_THUNDERBIRD_prefs()) + "/")) ) return c
def get_user_folders(self, pc): """Devuelve las carpetas de archivos, confifguraciones y programas del usuario""" r = self.search_key("Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders") if r: if "!Do not use this registry key" in r: del r["!Do not use this registry key"] if self.os.find("Vista") > 1: r["Downloads"] = os.path.join(os.path.split(r["Personal"])[0], "Downloads") self.mount_points = pc.map_win_units(r) # Obtener los puntos de montaje for k, v in r.iteritems(): if v: try: if not k == 'Wallpaper': r[k] = folder(self.check_path(v), False) #print "%s: %s --> %s" % (k, v, r[k].path) else: r[k] = self.check_path(v) #print "%s: %s --> %s" % (k, v, r[k]) except: pass return r else: raise Exception("Error reading de registry")
def config_aMule(self): """Configura el programa de P2P aMule con la configuración del programa eMule en Windows""" amule = folder(join(expanduser('~'), '.aMule')) if amule: # copy edonkey config files self.cfg_dir.copy(amule, extension = ['.ini','.dat','.met']) # copy edonkey temporary files conf = join(amule.path, 'amule.conf') bak = backup(conf) try: emupref = open(join(amule.path,'preferences.ini'),'r') amuconf = open(conf, 'w') for l in emupref.readlines(): if l.find("IncomingDir") != -1: l = "IncomingDir=%s\n" % join(amule.path,'Incoming') if l.find("TempDir") != -1: l = "TempDir=%s\n" % join(amule.path,'Temp') amuconf.write(l) amuconf.close() emupref.close() except: amuconf.close() emupref.close() if bak: restore_backup(bak) else: return 1
def do(self): old = None evo_cal = join(expanduser('~'),'.evolution','calendar','local','system','calendar.ics') folder(dirname(evo_cal)) dates = [] if exists(evo_cal): old = backup(evo_cal) if old: new_cal = open(evo_cal, "w") old_cal = open(old, 'r') for l in old_cal.readlines(): if l.find('END:VCALENDAR') == -1: new_cal.write(l) if l.find('BEGIN:VEVENT') != -1: dt, sum = None, None elif l.find('END:VEVENT') != -1: if dt and sum: dates.append(dt+sum) elif l.find('DTSTART') != -1: dt = l.replace('DTSTART:', '') elif l.find('SUMMARY') != -1: sum = l.replace('SUMMARY:', '') old_cal.close() if not old: new_cal = open(evo_cal, "w") new_cal.write('BEGIN:VCALENDAR\n') new_cal.write('CALSCALE:GREGORIAN\n') new_cal.write('VERSION:2.0\n') for ical in self.icals: orig = open(ical,"r") buffer = '' for l in orig.readlines(): buffer += l if l.find('BEGIN:VEVENT') != -1: dt, sum = None, None buffer = l elif l.find('END:VEVENT') != -1: if dt and sum and not dt+sum in dates: new_cal.write(buffer) elif l.find('DTSTART') != -1: dt = l.replace('DTSTART:', '') elif l.find('SUMMARY') != -1: sum = l.replace('SUMMARY:', '') orig.close() new_cal.write('END:VCALENDAR\n') return 1
def get_messenger_accounts(self): """Devuelve las cuentas de mensajería de Windows Live Messenger""" accounts = [] live_msn = folder(os.path.join(self.folders['Local AppData'].path, 'Microsoft', 'Messenger'), False) if live_msn.path and os.path.exists(live_msn.path): for m in os.listdir(live_msn.path): if m.find('@') != -1: accounts.append(m) return accounts
def __init__(self): """Constructor de la clase""" try: self.bookmarks_file = glob(os.path.join(os.path.expanduser('~'), '.mozilla', 'firefox', '*.default', 'places.sqlite'))[0] except: # create profile and bookmarks file ff_dir = folder(os.path.join(os.path.expanduser('~'), '.mozilla', 'firefox','m1gra73d.default')) prof = open(os.path.join(os.path.expanduser('~'), '.mozilla', 'firefox','profiles.ini'), 'w') prof.write("[General]\n") prof.write("StartWithLastProfile=1\n\n") prof.write("[Profile0]\n") prof.write("Name=migrated\n") prof.write("IsRelative=1\n") prof.write("Path=m1gra73d.default\n") prof.close() self.bookmarks_file = None if not self.bookmarks_file: self.bookmarks_file = os.path.join(ff_dir.path,'places.sqlite') try: conn = sqlite3.connect(self.bookmarks_file) c = conn.cursor() c.executescript("""CREATE TABLE moz_anno_attributes (id INTEGER PRIMARY KEY,name VARCHAR(32) UNIQUE NOT NULL); CREATE TABLE moz_annos (id INTEGER PRIMARY KEY,place_id INTEGER NOT NULL,anno_attribute_id INTEGER,mime_type VARCHAR(32) DEFAULT NULL,content LONGVARCHAR, flags INTEGER DEFAULT 0,expiration INTEGER DEFAULT 0,type INTEGER DEFAULT 0,dateAdded INTEGER DEFAULT 0,lastModified INTEGER DEFAULT 0); CREATE TABLE moz_bookmarks (id INTEGER PRIMARY KEY,type INTEGER, fk INTEGER DEFAULT NULL, parent INTEGER, position INTEGER, title LONGVARCHAR, keyword_id INTEGER, folder_type TEXT, dateAdded INTEGER, lastModified INTEGER); CREATE TABLE moz_bookmarks_roots (root_name VARCHAR(16) UNIQUE, folder_id INTEGER); CREATE TABLE moz_favicons (id INTEGER PRIMARY KEY, url LONGVARCHAR UNIQUE, data BLOB, mime_type VARCHAR(32), expiration LONG); CREATE TABLE moz_historyvisits (id INTEGER PRIMARY KEY, from_visit INTEGER, place_id INTEGER, visit_date INTEGER, visit_type INTEGER, session INTEGER); CREATE TABLE moz_inputhistory (place_id INTEGER NOT NULL, input LONGVARCHAR NOT NULL, use_count INTEGER, PRIMARY KEY (place_id, input)); CREATE TABLE moz_items_annos (id INTEGER PRIMARY KEY,item_id INTEGER NOT NULL,anno_attribute_id INTEGER,mime_type VARCHAR(32) DEFAULT NULL,content LONGVARCHAR, flags INTEGER DEFAULT 0,expiration INTEGER DEFAULT 0,type INTEGER DEFAULT 0,dateAdded INTEGER DEFAULT 0,lastModified INTEGER DEFAULT 0); CREATE TABLE moz_keywords (id INTEGER PRIMARY KEY AUTOINCREMENT, keyword TEXT UNIQUE); CREATE TABLE moz_places (id INTEGER PRIMARY KEY, url LONGVARCHAR, title LONGVARCHAR, rev_host LONGVARCHAR, visit_count INTEGER DEFAULT 0, hidden INTEGER DEFAULT 0 NOT NULL, typed INTEGER DEFAULT 0 NOT NULL, favicon_id INTEGER, frecency INTEGER DEFAULT -1 NOT NULL); CREATE UNIQUE INDEX moz_annos_placeattributeindex ON moz_annos (place_id, anno_attribute_id); CREATE INDEX moz_bookmarks_itemindex ON moz_bookmarks (fk,type); CREATE INDEX moz_bookmarks_itemlastmodifiedindex ON moz_bookmarks (fk, lastModified); CREATE INDEX moz_bookmarks_parentindex ON moz_bookmarks (parent,position); CREATE INDEX moz_historyvisits_dateindex ON moz_historyvisits (visit_date); CREATE INDEX moz_historyvisits_fromindex ON moz_historyvisits (from_visit); CREATE INDEX moz_historyvisits_placedateindex ON moz_historyvisits (place_id, visit_date); CREATE UNIQUE INDEX moz_items_annos_itemattributeindex ON moz_items_annos (item_id, anno_attribute_id); CREATE INDEX moz_places_faviconindex ON moz_places (favicon_id); CREATE INDEX moz_places_frecencyindex ON moz_places (frecency); CREATE INDEX moz_places_hostindex ON moz_places (rev_host); CREATE UNIQUE INDEX moz_places_url_uniqueindex ON moz_places (url); CREATE INDEX moz_places_visitcount ON moz_places (visit_count); CREATE TRIGGER moz_bookmarks_beforedelete_v1_trigger BEFORE DELETE ON moz_bookmarks FOR EACH ROW WHEN OLD.keyword_id NOT NULL BEGIN DELETE FROM moz_keywords WHERE id = OLD.keyword_id AND NOT EXISTS (SELECT id FROM moz_bookmarks WHERE keyword_id = OLD.keyword_id AND id <> OLD.id LIMIT 1); END; CREATE TRIGGER moz_historyvisits_afterdelete_v1_trigger AFTER DELETE ON moz_historyvisits FOR EACH ROW WHEN OLD.visit_type NOT IN (0,4,7) BEGIN UPDATE moz_places SET visit_count = visit_count - 1 WHERE moz_places.id = OLD.place_id AND visit_count > 0; END; CREATE TRIGGER moz_historyvisits_afterinsert_v1_trigger AFTER INSERT ON moz_historyvisits FOR EACH ROW WHEN NEW.visit_type NOT IN (0,4,7) BEGIN UPDATE moz_places SET visit_count = visit_count + 1 WHERE moz_places.id = NEW.place_id; END;INSERT INTO moz_bookmarks (type, parent, position, title, keyword_id, folder_type) VALUES (2, 0, 0, '', NULL, NULL);INSERT INTO moz_bookmarks (type, parent, position, title, keyword_id, folder_type) VALUES (2, 1, 0, '', NULL, NULL);INSERT INTO moz_bookmarks (type, parent, position, title, keyword_id, folder_type) VALUES (2, 1, 1, '', NULL, NULL);INSERT INTO moz_bookmarks (type, parent, position, title, keyword_id, folder_type) VALUES (2, 1, 2, '', NULL, NULL);INSERT INTO moz_bookmarks (type, parent, position, title, keyword_id, folder_type) VALUES (2, 1, 3, '', NULL, NULL);INSERT INTO moz_bookmarks_roots (root_name, folder_id) VALUES('places',1);INSERT INTO moz_bookmarks_roots (root_name, folder_id) VALUES('menu',2);INSERT INTO moz_bookmarks_roots (root_name, folder_id) VALUES('toolbar',3);INSERT INTO moz_bookmarks_roots (root_name, folder_id) VALUES('tags',4);INSERT INTO moz_bookmarks_roots (root_name, folder_id) VALUES('unfiled',5);""") conn.commit() except sqlite3.Error, e: print "An error occurred:", e.args[0] conn.close() #FIX ME!!!!!!!!!!!!!!!!!! try: shutil.copy2('/usr/share/amigu/places.sqlite', self.bookmarks_file) except: pass
def actualizar_espacio(self, widget=None): """Actualiza el espacio libre en disco""" destino = self.entry.get_text() if os.path.exists(destino): d = folder(destino) self.available["data"] = d.get_free_space() self.datos_libre.set_markup("<i>%dKiB</i>" % self.available["data"]) self.conf_libre.set_markup("<i>%dKiB</i>" % self.available["conf"]) self.datos_req.set_markup("<i>%dKiB</i>" % self.required["data"]) self.conf_req.set_markup("<i>%dKiB</i>" % self.required["conf"])
def initialize(self): """Inicializa los valores específicos de la aplicación. Este método debe ser apliado en las clases hijas """ self.name = _("Lector de correo") self.size = 0 self.mailconfigs = [] self.mailboxes = [] self.dest = folder(os.path.join(os.path.expanduser('~'),'.evolution','mail','local', _("Correo de ")+ self.name +'.sbd')) self.description = self.name +": %d"%len(self.mailconfigs)+ _("cuentas de correo")
def do(self): import bsddb adb=join(expanduser('~'),'.evolution','addressbook','local','system','addressbook.db') folder(dirname(adb)) db = bsddb.hashopen(adb,'w') if not 'PAS-DB-VERSION\x00' in db.keys(): db['PAS-DB-VERSION\x00'] = '0.2\x00' for file in self.cs: c = contact(file) vcard = c.tovcard() if vcard: randomid = 'pas-id-' + str(random.random())[2:] vcard.insert(2, 'UID:'+randomid) db[randomid+'\x00'] = '' for l in vcard: db[randomid+'\x00'] += l + '\r\n' db[randomid+'\x00'] += '\x00' db.sync() db.close() return 1
def do(self): dest = folder(join(expanduser('~'),'.fonts','ttf-windows')) inc = 0 if self.model: inc = 99.9/self.user.folders["Fonts"].count_files() try: self.user.folders["Fonts"].copy(destino=dest.path, extension='.ttf', function=self.update_progress, delta=inc) except: pass else: return 1
def get_paths(self): """Devuelve la ruta del directorio de descargas""" a = None try: a = open(join(self.cfg_dir.path,'preferences.ini'), 'r') for l in a.readlines(): l = l.replace('\r\n','') if l.find("IncomingDir") != -1: inc = l.split('=')[1] inc = inc.replace('\\','/') inc = self.user.mount_points[inc[:2]] + inc[2:] self.inc_dir = folder(inc) elif l.find("TempDir") != -1: tmp = l.split('=')[1] tmp = tmp.replace('\\','/') tmp = self.user.mount_points[tmp[:2]] + tmp[2:] self.tmp_dir = folder(tmp) except: pass else: a.close()
def get_user_folders(self, pc): """Devuelve un diccionario que contiene las carpetas de archivos, configuraciones y programas del usuario. Esta clase debe ampliarse en las clases hijas Argumentos de entrada: pc -- objeto de tipo PC """ folders = {} folders["Personal"] = folder(self.path) return folders
def get_configuration(self): """Devuelve la configuración de la aplicación de correo""" configs = [] for key in self.option: try: c = mailconfig(key) except: continue else: configs.append(c) mb = folder(os.path.dirname(key), False) if mb.path: self.mailboxes.append(mb) return configs
def __init__(self,folders): """Contructor de la clase. Recibe un diccionario con las rutas obtenidas del registro""" konqueror = folder(os.path.join(os.path.expanduser('~'),'.kde','share','apps','konqueror')) self.bookmarks_file = os.path.join(konqueror.path,'bookmarks.xml') #create bookmark.xml if not exists if not os.path.exists(self.bookmarks_file): try: b = open(self.bookmarks_file, 'w') b.write ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE xbel>\n<xbel>\n</xbel>") b.close() except: self.error("Unable to create bookmarks.xml for Konqueror")
def get_configuration(self): """Devuelve la configuración de la aplicación de correo""" configs = [] for key in self.option: r = self.user.search_key(key) mb = glob.glob(os.path.join(self.user.folders["Local AppData"].path, 'Identities','{*}','Microsoft','Outlook Express')) if mb: self.mailboxes.append(folder(mb[0])) try: c = mailconfig(r) except: continue else: configs.append(c) return configs
def import_windows_settings(self, AppData): """Importa la configuración de Thunderbird en Windows. SOBREESCRIBE LA INFORMACIÓN EXISTENTE""" winprofile = folder(self.get_thunderbird_profile(os.path.join(AppData, 'Thunderbird'))) if winprofile: # copy all files from the winprofile winprofile.copy(self.profile) # modify prefs.js try: wp = open (os.path.join(winprofile.path, 'prefs.js'), 'r') p = open (self.config_file, 'w') for l in wp.readlines(): if l.find(':\\') == -1: p.write(l) except: self.error("Failed to copy Thunderbird profile") wp.close() p.close() return 0
def __init__(self): """Constructor de la clase""" thunderbird = folder(os.path.join(os.path.expanduser('~'),'.mozilla-thunderbird')) self.profile = self.get_thunderbird_profile(thunderbird.path) self.errors = [] if not self.profile and thunderbird.path: try: prof = open(os.path.join(thunderbird.path,'profiles.ini'), 'w') prof.write("[General]\n") prof.write("StartWithLastProfile=1\n\n") prof.write("[Profile0]\n") prof.write("Name=migrated\n") prof.write("IsRelative=1\n") prof.write("Path=m1gra73d.default\n") prof.close() self.profile = thunderbird.create_subfolder("m1gra73d.default") except: self.error("Unable to create Mozilla Thunderbird profile") return 0 self.config_file = os.path.join(self.get_thunderbird_profile(thunderbird.path), 'prefs.js')
def eml2mbox(emlpath, mbxpath): """Convierte archivos .eml a formato mailbox Argumentos de entrada: emlpath -> ruta donde residen los archivos eml mbxpath -> ruta de destino de los archivos mailbox """ i = 0 pattern = re.compile('(?P<date>Date:)\s+(?P<day>\w{3})\s+(?P<number>\d{1,2})\s+(?P<month>\w{3})\s+(?P<year>\d{4})\s+(?P<hour>[\d:]{5,8}).+') try: d = open(mbxpath, 'w') except: return 0 for e in os.listdir(emlpath): if os.path.isdir(os.path.join(emlpath, e)): new = folder(mbxpath+'.sbd') eml2mbox(os.path.join(emlpath, e), os.path.join(new.path, e)) elif os.path.splitext(e)[-1] == '.eml': try: m = open(os.path.join(emlpath, e),'r') content = m.readlines() m.close() except: continue else: for l in content: r = pattern.match(l.replace(',','')) if r: d.write("From - %s %s %s %s %s\n" % (r.group('day'), r.group('month'), r.group('number'), r.group('hour'), r.group('year'))) for l in content: d.write(l.replace('\r', '')) d.write('\n\n') i += 1 break d.close() print "Carpeta %s: %d archivos procesados" % (os.path.basename(emlpath), i)
def mostrar_paso(self): """Actualiza el contenido del asistente en función del paso actual""" # Ocultar todo self.box_inicial.hide() self.box_usuarios.hide() self.box_opciones.hide() self.box_migracion.hide() self.back_boton.show_all() self.back_boton.set_sensitive(True) self.forward_boton.show() self.forward_boton.set_sensitive(False) self.apply_boton.hide() self.jump_boton.hide() self.about_boton.hide() self.etapa.set_markup("<span face=\"arial\" size=\"8000\" foreground=\"chocolate\"><b>"+_('Paso %d de 5')%self.paso+"</b></span>") if self.paso == 1: self.box_inicial.show() self.labelpri.set_markup('') self.back_boton.hide_all() self.forward_boton.set_sensitive(True) elif self.paso == 2: self.box_usuarios.show_all() self.labelpri.set_markup('<span face="arial" size="12000" foreground="chocolate"><b>'+_('SELECCIÓN DE USUARIO')+'</b></span>') if not len(self.list_users): #self.textbuffer.set_text(_('Buscando usuarios de Windows. Por favor espere...')) self.stop_boton.window.set_cursor(self.watch) self.hilo = threading.Thread(target=self.buscar_usuarios, args=()) self.hilo.start() #self.buscar_usuarios() elif self.paso == 3: model, iter = self.users.get_selection().get_selected() self.selected_user = model.get_value(iter, 3) if self.selected_user.os.find('Windows') == -1: self.paso = 2 self.box_usuarios.show() self.dialogo_advertencia(_("Opción no disponible actualmente. \nSeleccione otro tipo de usuario")) return 0 self.imagen_usuario.set_from_pixbuf(gtk.gdk.pixbuf_new_from_file_at_size(self.selected_user.get_avatar(), 80, 80)) self.cuenta.set_markup('<b>%s</b>\n<span face="arial" size="8000"><i>%s</i></span>'% (self.selected_user.get_name(), self.selected_user.os)) self.labelpri.set_markup('<span face="arial" size="12000" foreground="chocolate"><b>'+_('OPCIONES DE MIGRACIÓN')+'</b></span>') #self.options.set_model(self.selected_user.get_tree_options()) self.options.set_model(None) self.hilo = threading.Thread(target=self.load_options, args=()) self.hilo.start() self.box_opciones.show_all() self.forward_boton.show_all() self.dialogo_advertencia(_("Analizando usuario..."),True) elif self.paso == 4: self.destino = self.entry.get_text() self.forward_boton.set_sensitive(True) if self.destino: f = folder(self.destino) if not f or not f.path: self.paso = 3 self.box_opciones.show() self.dialogo_advertencia(_("Ruta de destino no válida")) elif not f.is_writable(): self.paso = 3 self.box_opciones.show() self.dialogo_advertencia(_("No dispone de permiso de escritura para la ubicación seleccionada")) elif self.available["data"] < self.required["data"]: self.paso = 3 self.box_opciones.show() self.dialogo_advertencia(_("Espacio en disco insuficiente.") + '\n' + _('Seleccione otra ubicación de destino o cambie sus opciones de migración')) elif self.available["conf"] < self.required["conf"]: self.paso = 3 self.box_opciones.show() self.dialogo_advertencia(_("Espacio en disco insuficiente.") + '\n' + _('Libere espacio en su carpeta personal o cambie sus opciones de migración')) else: self.labelpri.set_markup('<span face="arial" size="12000" foreground="chocolate"><b>'+_('RESUMEN DE TAREAS')+'</b></span>') self.generar_resumen(self.options.get_model()) self.forward_boton.hide() self.apply_boton.show_all() self.box_migracion.show_all() self.progreso.hide() self.window.set_focus(self.apply_boton) else: self.paso = 3 self.box_opciones.show() self.dialogo_advertencia(_("Introduzca una ubicación de destino")) elif self.paso == 5: self.labelpri.set_markup('<span face="arial" size="12000" foreground="chocolate"><b>'+_('DETALLES DE LA MIGRACIÓN')+'</b></span>') self.box_migracion.show_all() self.back_boton.hide_all() self.forward_boton.hide_all() time.sleep(0.2) self.hilo = threading.Thread(target=self.aplicar, args=()) self.hilo.start() self.stop_boton.window.set_cursor(None)
def __init__(self): """Constructor de la interfaz""" self.previous_excepthook = sys.excepthook sys.excepthook = self.excepthook self.working = False self.abort = False # Main Window self.window = gtk.Window() self.window.set_title(_("Nuevo Asistencia para la Migración a Canaima Z")) self.window.set_default_size(700, 570) self.window.set_border_width(0) self.window.move(150, 50) self.window.connect("destroy", self.destroy) self.window.set_icon_from_file(os.path.join(dir_imagenes, "icon_paginacion.png")) # Atributos self.paso = 1 self.url = "http://forja.guadalinex.org/webs/amigu/" self.pc = None self.watch = gtk.gdk.Cursor(gtk.gdk.WATCH) self.hilo = None # Usuarios self.list_users = gtk.ListStore(gtk.gdk.Pixbuf, gobject.TYPE_STRING, gobject.TYPE_STRING, object) self.users = gtk.TreeView(self.list_users) self.users.set_rules_hint(True) self.users.connect("cursor-changed", self.marcar_usuario) rndr = gtk.CellRendererText() rndr2 = gtk.CellRendererText() rndr3 = gtk.CellRendererText() rndr_pixbuf = gtk.CellRendererPixbuf() rndr_pixbuf.set_property("stock-size",3) rndr_pixbuf.set_property('xalign', 0.5) rndr_pixbuf.set_property('width', 100) rndr_pixbuf.set_property('ypad', 5) column1 = gtk.TreeViewColumn(_("Cuenta"), rndr3, text=1) rndr3.set_property('scale', 1.5) rndr3.set_property('width', 300) column2 = gtk.TreeViewColumn(_("Sistema Operativo"), rndr, text=2) column3 = gtk.TreeViewColumn(_("Imagen"), rndr_pixbuf, pixbuf=0) self.users.append_column( column3 ) self.users.append_column( column1 ) self.users.append_column( column2 ) self.users.expand_all() # Opciones self.options = gtk.TreeView() rndr1 = gtk.CellRendererToggle() rndr1.set_property('activatable', True) rndr1.connect( 'toggled', self.marcar_opcion) column4 = gtk.TreeViewColumn(_("Opción"), rndr, text=0) column5 = gtk.TreeViewColumn(_("Tamaño"), rndr2, text=2) rndr2.set_property('xalign', 1.0) column5.set_cell_data_func(rndr2, self.space_units, data=None) column6 = gtk.TreeViewColumn(_("Descripción"), rndr, text=3) column6.set_cell_data_func(rndr, self.italic, data=None) column7 = gtk.TreeViewColumn(_("Migrar"), rndr1 ) column7.add_attribute( rndr1, "active", 1) self.options.append_column( column4 ) self.options.append_column( column7 ) self.options.append_column( column5 ) self.options.append_column( column6 ) #Resumen self.tasks = gtk.ListStore( gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_FLOAT, gobject.TYPE_STRING, gobject.TYPE_INT, object) self.resumen = gtk.TreeView(self.tasks) column8 = gtk.TreeViewColumn(_("Tarea"), rndr, text=0) column9 = gtk.TreeViewColumn("", rndr_pixbuf, stock_id=1) progressrenderer = gtk.CellRendererProgress() column10 = gtk.TreeViewColumn(_("Progreso"), progressrenderer, value=2, text=3, pulse=4) progressrenderer.set_property('height', 10) self.resumen.append_column( column9 ) self.resumen.append_column( column8 ) self.resumen.append_column( column10 ) gtk.about_dialog_set_url_hook(self.open_url, self.url) # ventana box_principal box_principal = gtk.VBox(False, 0)#Creo la caja vertical box_principal # Etapas o Stages self.box_inicial = gtk.VBox(False, 1) self.box_usuarios = gtk.VBox(False, 1) self.box_opciones = gtk.HBox(False, 1) self.box_migracion = gtk.VBox(False, 1) separador1 = gtk.HSeparator() separador2 = gtk.HSeparator() box_statico_sup = gtk.HBox(False, 1)#Creo lo que se va a quedar siempre en la ventana box_variable = gtk.VBox(False, 1)#Creo lo que va a ir variando box_statico_inf = gtk.HBox(False, 1)#Creo lo que se va a quedar siempre en la ventana box_statico_infver1 = gtk.HBox(False, 1) box_statico_infver2 = gtk.HButtonBox() box_statico_infver2.set_layout(gtk.BUTTONBOX_END) box_statico_infver2.set_size_request(550,60) box_statico_infver2.set_border_width(10) image = gtk.Image() image.set_from_file(os.path.join(dir_imagenes, "cab_amigu.png")) image1 = gtk.Image() image1.set_from_file(os.path.join(dir_imagenes, "icon_paginacion.png")) self.etapa = gtk.Label() self.etapa.set_use_markup(True) self.etapa.set_markup("<span face = \"arial\" size = \"8000\" foreground = \"chocolate\"><b>Paso %d de 5</b></span>"%self.paso) espacio = gtk.Label() # botones self.stop_boton = gtk.Button(stock = gtk.STOCK_CANCEL) self.back_boton = gtk.Button(stock = gtk.STOCK_GO_BACK) self.forward_boton = gtk.Button(stock = gtk.STOCK_GO_FORWARD) self.apply_boton = gtk.Button(stock = gtk.STOCK_APPLY) self.exit_boton = gtk.Button(stock = gtk.STOCK_QUIT) self.about_boton = gtk.Button(label=_("Acerca de")) self.jump_boton = gtk.Button(label=_("Omitir")) # añadir self.labelpri = gtk.Label("") self.labelpri.set_line_wrap(True) self.labelpri.set_justify(gtk.JUSTIFY_LEFT) self.labelpri.set_use_markup(True) box_statico_sup.pack_start(self.labelpri, False, False, 10) box_variable.pack_start(self.box_inicial, True, False, 0) box_statico_inf.pack_start(box_statico_infver1, False, False, 0) box_statico_inf.pack_start(box_statico_infver2, True, False, 0) box_statico_infver1.pack_start(image1, True, True, 10) box_statico_infver1.pack_start(self.etapa, False, False, 1) box_statico_infver2.pack_start(self.about_boton, False, False, 0) box_statico_infver2.pack_start(self.back_boton, False, False, 0) box_statico_infver2.pack_start(self.forward_boton, False, False, 0) box_statico_infver2.pack_start(self.apply_boton, False, False, 0) box_statico_infver2.pack_start(espacio, True, True, 2) box_statico_infver2.pack_start(self.exit_boton, False, False, 0) box_statico_infver2.pack_start(self.jump_boton, False, False, 0) box_statico_infver2.pack_start(self.stop_boton, True, False, 5) box_principal.pack_start(image, False, False, 0) box_principal.pack_start(separador1, False, True, 10) box_principal.pack_start(box_statico_sup, False, False, 1) box_principal.pack_start(box_variable, True, True, 1) box_principal.pack_start(separador2, False, True, 10) box_principal.pack_start(box_statico_inf, False, True, 1) box_variable.pack_start(self.box_usuarios, True, True, 1) box_variable.pack_start(self.box_opciones, True, True, 1) box_variable.pack_start(self.box_migracion, True, True, 1) self.window.add(box_principal)#Añado a la ventana el box_principal # eventos self.back_boton.connect("clicked", self.etapa_anterior) self.forward_boton.connect("clicked", self.etapa_siguiente) self.apply_boton.connect("clicked", self.dialogo_confirmacion) self.exit_boton.connect("clicked", self.destroy) self.stop_boton.connect_object("clicked", self.dialogo_cancelacion, self.window) self.about_boton.connect_object("clicked", self.about, self.window) self.jump_boton.connect_object("clicked", self.omitir, self.window) # mostrar ventana self.window.show_all() self.apply_boton.hide() self.exit_boton.hide() self.jump_boton.hide() ################Primera Ventana # crear label1 = gtk.Label() label1.set_use_markup(True) label1.set_line_wrap(True) label1.set_justify(gtk.JUSTIFY_CENTER) label1.set_markup('<b>'+_('Bienvenido al Asistente de Migración de Canaima - AMIGU') + '\n\n' + _('Este asistente le guiará durante el proceso de migración de sus documentos y configuraciones de su sistema operativo Windows.') + '\n' + _('Pulse el botón Adelante para comenzar.') + '</b>') # añadir self.box_inicial.pack_start(label1, True, True, 10) # mostrar self.back_boton.hide_all() self.box_inicial.show_all() ################Segunda Ventana #crear self.box_usuarioshor1 = gtk.HBox(False, 1) self.box_usuarioshor2 = gtk.HBox(True, 10) self.label2 = gtk.Label() self.label2.set_use_markup(True) self.label2.set_markup('<b>'+_('Buscando usuarios de otros sistemas...')+'</b>') frame1 = gtk.Frame(_("Usuarios encontrados")) sw = gtk.ScrolledWindow() sw.set_size_request(600, 175) sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) # añadir sw.add(self.users) frame1.add(sw) self.box_usuarioshor1.pack_start(self.label2, False, False, 10) self.box_usuarioshor2.pack_start(frame1, True, True, 10) self.box_usuarios.pack_start(self.box_usuarioshor2, True, True, 1) self.box_usuarios.pack_start(self.box_usuarioshor1, False, False, 1) ###############################Tercera Ventana # crear self.box_opcionesver1 = gtk.HBox(False, 10) self.box_opcionesver2 = gtk.HBox(False, 5) self.box_opcionesver3 = gtk.HBox(False, 10) self.box_opcionesver4 = gtk.HBox(False, 10) self.box_opcioneshor1 = gtk.VBox(False, 3) self.box_opcioneshor2 = gtk.VBox(False, 10) self.box_opcioneshor3 = gtk.VBox(False, 5) self.box_opcioneshor4 = gtk.VBox(False, 5) self.box_opcioneshor5 = gtk.VBox(False, 5) self.box_opcioneshor6 = gtk.VBox(False, 5) self.frame4 = gtk.Frame(_("Cuenta")) frame2 = gtk.Frame(_("Espacio requerido")) self.entry = gtk.Entry() self.entry.set_max_length(50) f = folder(os.path.expanduser('~')) self.required = {'data':0, 'conf':0} self.available = {'data':f.get_free_space(), 'conf':f.get_free_space()} self.cuenta = gtk.Label() self.cuenta.set_use_markup(True) self.datos = SpaceIndicator(self.window) self.configuraciones = SpaceIndicator(self.window) self.entry.connect("activate", self.actualizar_espacio) self.entry.set_text(f.get_path()) self.actualizar_espacio() boton22 = gtk.Button(label = _("Seleccionar otra carpeta"), stock = None) boton22.connect_object("clicked", self.buscar, self.window) #tip22 = gtk.Tooltip(boton22) #tip22.set_text(_("Elija la carpeta Destino donde quiere guardar los archivos")) frame5 = gtk.Frame(_("Opciones de migración")) self.arbol_inicializado = False self.imagen_usuario = gtk.Image() self.sw3 = gtk.ScrolledWindow() self.sw3.set_size_request(280, 200) self.sw3.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) self.sw3.add(self.options) # añadir self.box_opciones.pack_start(self.box_opcionesver1, False, False, 0) self.box_opciones.pack_start(frame5, True, True, 0) self.box_opcionesver1.pack_start(self.box_opcioneshor2, False, False, 10) self.box_opcionesver2.pack_start(self.imagen_usuario, True, True, 5) self.box_opcionesver2.pack_start(self.cuenta, True, True, 5) frame5.add(self.sw3) self.frame4.add(self.box_opcionesver2) frame2.add(self.box_opcioneshor1) self.box_opcioneshor1.pack_start(gtk.Label(_('Datos de usuario')), True, True, 0) self.box_opcioneshor1.pack_start(self.datos, True, True, 0) self.box_opcioneshor1.pack_start(self.entry, True, False, 0) self.box_opcioneshor1.pack_start(boton22, True, False, 0) self.box_opcioneshor1.pack_start(gtk.HSeparator(), True, False, 0) self.box_opcioneshor1.pack_start(gtk.Label(_('Configuraciones')), True, True, 0) self.box_opcioneshor1.pack_start(self.configuraciones, True, True, 0) self.box_opcioneshor2.pack_start(self.frame4, True, False, 0) self.box_opcioneshor2.pack_start(frame2, True, False, 0) ################Cuarta Ventana # crear self.box_migracionhor1 = gtk.HBox(False, 10) frame3 = gtk.Frame(_("Tareas a realizar")) sw1 = gtk.ScrolledWindow() sw1.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) sw1.set_size_request(600, 225) self.progreso = gtk.ProgressBar(None) self.progreso.set_fraction(0.0) self.progreso.set_orientation(gtk.PROGRESS_LEFT_TO_RIGHT) self.progreso.set_text(_("Realizando las tareas solicitadas...")) #añadir self.box_migracion.pack_start(self.box_migracionhor1, True, True, 0) self.box_migracionhor1.pack_start(frame3, True, True, 10) frame3.add(sw1) sw1.add(self.resumen) #self.box_migracion.pack_start(gtk.Label(_("Estado del proceso de migración")), True, False, 2) self.box_migracion.pack_start(self.progreso, False, False, 9) try: child = gtk.EventBox() b = gtk.LinkButton(self.url, label=_("Más información sobre Amigu")) child.add(b) text_view.add_child_in_window(child, gtk.TEXT_WINDOW_TEXT, 480, 173) except: pass self.window.set_focus(self.forward_boton)
def direct_import(self): """Importa directamente la configuración en Thunderbird""" dest = folder(os.path.join(os.path.expanduser("~"), ".mozilla-thunderbird")) origen = folder(os.path.join(self.user.folders["AppData"].path, "Thunderbird")) origen.copy(dest)
def get_tree_options(self, update=False): """Devuele el árbol de opciones generado para el usario seleccionado. El objeto devuelto es de tipo gtk.TreeStore. Argumentos de entrada: update -- indica si se debe actualizar el contenido del árbol (default False) """ if self.tree_options: if update: self.tree_options.clear() else: sleep(2.0) return self.tree_options else: self.tree_options = TreeStore(str, "gboolean", str, str, object) name_usr = self.tree_options.append(None, [self.get_name(), None, None, _("Usuario seleccionado"), None]) # Files data = self.tree_options.append(name_usr, [_("Archivos"), None, None, _("Importar archivos"), None]) folder_2_copy = [] if self.os.find("Vista") > 1: for s in folder(self.path).get_subfolders(): add = ( s.get_size() and not s.get_name() in ( "AppData", "Links", "Tracing", "Searches", "Cookies", "NetHood", "PrintHood", "Local Settings", "Application Data", "Recent", "Templates", "SendTo", "Start Menu", "Saved Games", "Favorites", "Contacts", ) and not s.get_name().startswith("{") ) if add: folder_2_copy.append(s) else: folder_2_copy.append(self.folders["Personal"]) folder_2_copy.append(self.folders["Desktop"]) # eMule if "eMule" in self.folders.keys(): emule_inc = self.get_incoming_path() emule_temp = self.get_temp_path() try: self.tree_options.append( data, [ _("Descargados eMule"), None, str(emule_inc.get_size()), _("Archivos descargados: ") + emule_inc.get_info(), "", ], ) self.tree_options.append( data, [ _("Temporales eMule"), None, str(emule_temp.get_size()), _("Archivos temporales: ") + emule_temp.get_info(), "", ], ) except: pass for f in folder_2_copy: try: c = self.get_copier(f) dir = self.tree_options.append(data, [c.name, None, str(c.size), c.description, c]) try: conv = converter(self, f) self.tree_options.append(dir, [conv.name, None, str(conv.size), conv.description, conv]) except: pass except: pass # configuraciones conf = self.tree_options.append( name_usr, [_("Configuraciones"), None, None, _("Importar configuraciones"), None] ) # Bookmarks navegadores = [] try: navegadores.append(firefox.firefox(self)) except: pass try: navegadores.append(explorer.iexplorer(self)) except: pass try: navegadores.append(opera.opera(self)) except: pass try: navegadores.append(chrome.chrome(self)) except: pass if navegadores: nav = self.tree_options.append(conf, [_("Navegadores"), None, None, _("Navegadores web"), None]) for n in navegadores: self.tree_options.append(nav, [n.name, None, n.size, n.description, n]) # Correo lectores = [] try: lectores.append(thunderbird.thunderbird(self, self.get_THUNDERBIRD_accounts())) except: pass out = self.get_OUTLOOK_accounts() for k, v in out.iteritems(): try: if k == "Outlook12": lectores.append(outlook.outlook12(self, v)) elif k == "Outlook11": lectores.append(outlook.outlook11(self, v)) elif k == "Outlook Express": lectores.append(outlook.outlook_express(self, v)) elif k == "Outlook9": lectores.append(outlook.outlook9(self, v)) except: pass try: lectores.append(livemail.windowsmail(self, self.get_WINDOWS_MAIL_accounts().values())) except: pass try: lectores.append(livemail.windowslivemail(self, self.get_WINDOWS_LIVE_MAIL_accounts().values())) except: pass if lectores: lec = self.tree_options.append( conf, [_("Gestores de correo"), None, None, _("Gestores de correo electrónico"), None] ) for l in lectores: self.tree_options.append(lec, [l.name, None, l.size, l.description, l]) # Instant Messenger cuentas = [] try: cuentas.append(live.windowslive(self, self.get_MSN_account())) except: pass for ac in self.get_messenger_accounts(): try: cuentas.append(live.windowslive(self, ac)) except: pass try: cuentas.append(gtalk.gtalk(self)) except: pass if cuentas: im = self.tree_options.append(conf, [_("Mensajería Instantánea"), None, None, _("Cuentas de IM"), None]) for a in cuentas: self.tree_options.append(im, [a.name, None, a.size, a.description, a]) # Otras configuraciones configuraciones = [] try: configuraciones.append(misc.wallpaper(self)) except: pass try: configuraciones.append(misc.fonts_installer(self)) except: pass try: configuraciones.append(emule.emule(self)) except: pass try: configuraciones.append(misc.avatar(self)) except: pass try: configuraciones.append(planner.calendar(self)) except: pass try: configuraciones.append(addressbook.contacts(self)) except: pass if len(configuraciones): cfg = self.tree_options.append(conf, [_("Otros"), None, None, _("Otras opciones de configuración"), None]) for c in configuraciones: try: self.tree_options.append(cfg, [c.name, None, c.size, c.description, c]) except: pass return self.tree_options
def get_tree_options(self, update=False): """Devuele el árbol de opciones generado para el usario seleccionado. El objeto devuelto es de tipo gtk.TreeStore. Argumentos de entrada: update -- indica si se debe actualizar el contenido del árbol (default False) """ if self.tree_options: if update: self.tree_options.clear() else: return self.tree_options else: self.tree_options = TreeStore( str, 'gboolean', str, str, object) name_usr = self.tree_options.append(None, [self.get_name(), None, None, _('Usuario seleccionado'), None]) # Files data = self.tree_options.append(name_usr , [_("Archivos"), None, None, _('Importar archivos'), None] ) folder_2_copy = [] if self.os.find("Vista") > 1: for s in folder(self.path).get_subfolders(): add = s.get_size() and not s.get_name() in ('AppData', 'Links', 'Tracing', 'Searches', 'Cookies', 'NetHood', 'PrintHood', 'Local Settings', 'Application Data', 'Recent', 'Templates', 'SendTo', 'Start Menu', 'Saved Games', 'Favorites','Contacts') and not s.get_name().startswith('{') if add: folder_2_copy.append(s) else: folder_2_copy.append(self.folders['Personal']) folder_2_copy.append(self.folders['Desktop']) # eMule if 'eMule' in self.folders.keys(): emule_inc = self.get_incoming_path() emule_temp = self.get_temp_path() try: self.tree_options.append( data, [_("Descargados eMule"), None, str(emule_inc.get_size()), _('Archivos descargados: ')+ emule_inc.get_info(), ''] ) self.tree_options.append( data, [_("Temporales eMule"), None, str(emule_temp.get_size()), _('Archivos temporales: ')+ emule_temp.get_info(), ''] ) except: pass for f in folder_2_copy: c = self.get_copier(f) self.tree_options.append( data, [c.name, None, str(c.size), c.description, c] ) # configuraciones conf = self.tree_options.append(name_usr , [_("Configuraciones"), None, None, _('Importar configuraciones'), None] ) # Bookmarks navegadores = [] try: navegadores.append(webbrowser.winfirefox(self)) except: pass try: navegadores.append(webbrowser.iexplorer(self)) except: pass try: navegadores.append(webbrowser.opera(self)) except: pass try: navegadores.append(webbrowser.chrome(self)) except: pass if navegadores: nav = self.tree_options.append(conf, [_("Navegadores"), None, None, _('Navegadores web'), None] ) for n in navegadores: self.tree_options.append(nav, [n.name, None, n.size, n.description, n] ) # Correo lectores = [] out = self.get_OUTLOOK_accounts() for k, v in out.iteritems(): try: if k == "Outlook12": lectores.append(mail.outlook12(self, v)) elif k == "Outlook11": lectores.append(mail.outlook11(self, v)) elif k == "Outlook Express": lectores.append(mail.outlook_express(self, v)) elif k == "Outlook9": lectores.append(mail.outlook9(self, v)) except: pass try: lectores.append(mail.windowsmail(self, self.get_WINDOWS_MAIL_accounts().values())) except: pass try: lectores.append(mail.windowslivemail(self, self.get_WINDOWS_LIVE_MAIL_accounts().values())) except: pass try: lectores.append(mail.winthunderbird(self, self.get_THUNDERBIRD_accounts())) except: pass if lectores: lec = self.tree_options.append(conf, [_("Gestores de correo"), None, None, _('Gestores de correo electrónico'), None] ) for l in lectores: self.tree_options.append(lec, [l.name, None, l.size, l.description, l] ) # Instant Messenger cuentas = messenger.get_IM_accounts(self) if cuentas: im = self.tree_options.append(conf, [_("Mensajería Instantánea"), None, None, _('Cuentas de IM'), None] ) for a in cuentas: self.tree_options.append(im, [a.name, None, a.size, a.description, a] ) # Otras configuraciones configuraciones = [] try: configuraciones.append(settings.wallpaper(self)) except: pass try: configuraciones.append(settings.fonts_installer(self)) except: pass try: configuraciones.append(settings.emule(self)) except: pass try: configuraciones.append(settings.avatar(self)) except: pass try: configuraciones.append(settings.calendar(self)) except: pass try: configuraciones.append(settings.contacts(self)) except: pass if configuraciones: cfg = self.tree_options.append(conf, [_("Otros"), None, None, _('Otras opciones de configuración'), None] ) for c in configuraciones: self.tree_options.append(cfg, [c.name, None, c.size, c.description, c] ) return self.tree_options
def __init__(self): """Constructor de la clase""" self.errors = [] self.config_file = os.path.join(os.path.expanduser('~'), '.kde', 'share', 'config', 'kopeterc') folder(os.path.join(os.path.expanduser('~'), '.kde', 'share', 'config'))