def save(self, event=None): self.name = name = self.name_entry.get().strip() if name != self.mailbox: # change name of mailbox os.remove(os.path.join(LOCAL_PATH, self.mailbox)) active = CONFIG.get("Mailboxes", "active").split(", ") inactive = CONFIG.get("Mailboxes", "inactive").split(", ") while "" in active: active.remove("") while "" in inactive: inactive.remove("") if self.mailbox in active: active.remove(self.mailbox) active.append(name) elif self.mailbox in inactive: inactive.remove(self.mailbox) inactive.append(name) CONFIG.set("Mailboxes", "active", ", ".join(active)) CONFIG.set("Mailboxes", "inactive", ", ".join(inactive)) save_config() encrypt(name, self.pwd, self.server_entry.get().strip(), self.login_entry.get().strip(), self.password_entry.get().strip(), self.folder_entry.get().strip()) self.destroy()
def ok(self): time = float(self.time_entry.get()) * 60000 timeout = float(self.timeout_entry.get()) * 60000 CONFIG.set("General", "time", "%i" % time) CONFIG.set("General", "timeout", "%i" % timeout) CONFIG.set("General", "language", self.lang.get().lower()[:2]) CONFIG.set("General", "font", self.font.get()) CONFIG.set("General", "trayicon", self.gui.get().lower()) save_config() self.destroy()
def quit(self): """Save configuration and destroy the dialog.""" active = [] inactive = [] for box, (c, l, b1, b2) in self.mailboxes.items(): if "selected" in c.state(): active.append(box) else: inactive.append(box) CONFIG.set("Mailboxes", "active", ", ".join(active)) CONFIG.set("Mailboxes", "inactive", ", ".join(inactive)) save_config() self.destroy()
def reset_password(self): """ Reset the master password and delete all the mailboxes config files since they cannot be decrypted without the password. """ rep = askokcancel( _("Confirmation"), _("The reset of the password will erase all the stored mailbox connection information" ), icon="warning") if rep: mailboxes = CONFIG.get("Mailboxes", "active").split(", ") + CONFIG.get( "Mailboxes", "inactive").split(", ") while "" in mailboxes: mailboxes.remove("") CONFIG.set("Mailboxes", "active", "") CONFIG.set("Mailboxes", "inactive", "") save_config() for mailbox in mailboxes: os.remove(os.path.join(LOCAL_PATH, mailbox)) logging.info('Reset') self.set_password()
def quit(self): CONFIG.set("General", "check_update", str("selected" in self.ch.state())) save_config() self.destroy()