def on_synchronize_button_clicked(self,widget,event=None): status = self.preferences.main_window_obj.mcontroller.dialer.status() if status != MobileManager.PPP_STATUS_CONNECTED: mesg = gtk.MessageDialog(None, gtk.DIALOG_MODAL, gtk.MESSAGE_ERROR, gtk.BUTTONS_CLOSE) mesg.set_icon_from_file(MSD.icons_files_dir + "addressbook_16x16.png") mesg.set_markup(_(u"<b>No hay conexión establecida</b>")) mesg.format_secondary_markup(_(u"Es necesario estar conectado para poder importar los contactos de Copiagenda movistar. Por favor, conecta previamente y vuelve a intentarlo.")) if (mesg.run() != None): mesg.destroy() return username = self.conf.get_celular_info()[0] password = self.conf.get_celular_info()[1] if username is None or password is None or username=="" or password=="" or self.conf.get_ask_password_activate(): # dlg=gtk.MessageDialog(None, 0, gtk.MESSAGE_ERROR, gtk.BUTTONS_OK, _(u"Faltan datos de usuario y contraseña para utilizar el servicio Copiagenda.\nPor favor, introduce estos datos en las opciones de configuración y vuelve a intentarlo.")) # dlg.set_title("Importar") # dlg.set_icon_from_file(MSD.icons_files_dir + "synchronize_32x32.png") # dlg.run() # dlg.destroy() # self.preferences.show_all(3) MSD.MSDSecurityManager(self.conf).run_security_dialog() username = self.conf.get_celular_info()[0] password = self.conf.get_celular_info()[1] if username is not None and password is not None and username!="" and password!="": sync=emsync.Sync() if sync != None: sync.start( self._addressbook.db_path, self.conf.get_syncml_server(), # . "195.235.160.141", self.conf.get_syncml_service(), # "syncml", self.conf.get_syncml_resource(), # "./pab", "1234567890", username, # "609000055", password, # "1234567890123456789", username) # "609000055") progress = MDImportProgress(sync) # progress.run() # state = emsync.Sync.State_Connecting # while state != sync.State_Finished and state != emsync.Sync.State_FinishedWithError and state != emsync.Sync.State_Cancelled and state != emsync.Sync.State_FinishedWithPartialDownload : # state = sync.get_state() emsync.filter_contacts(self._addressbook.db_path, self.conf.get_country_code()) self.__build_model() else: dlg=gtk.MessageDialog(None, 0, gtk.MESSAGE_ERROR, gtk.BUTTONS_OK, _(u"Ha ocurrido un problema al intentar importar.\nReinstalar la aplicación podría resolver el problema.")) dlg.set_title("Importar") dlg.set_icon_from_file(MSD.icons_files_dir + "synchronize_32x32.png") dlg.run() dlg.destroy()
def on_add_button_clicked(self,widget,event=None): response = self._contact_editor.run() if response != gtk.RESPONSE_OK: print _(u"Canceled") return # Creo uno nuevo d = self._contact_editor.get_dict() MDContact(**d) emsync.filter_contacts(self._addressbook.db_path, self.conf.get_country_code()) self.__build_model() # TODO optimizar self.__check_button_sensitivity()
def on_edit_button_clicked(self,widget,event=None): selection = self._contact_treeview.get_selection() if selection.count_selected_rows()!= 1: return contacts = self.__selected_contacts() if len(contacts) == 1: contact =contacts[0] response = self._contact_editor.run(contact) if response != gtk.RESPONSE_OK: print "Canceled" return d = self._contact_editor.get_dict() contact.set(**d) emsync.filter_contacts(self._addressbook.db_path, self.conf.get_country_code()) self.__build_model() # TODO optimizar self.__check_button_sensitivity()