def __init__(self, reader): global instance if instance: return instance = self self.reader = reader purgeswin = reader.readglade("purgeswin", self) self.widget = sqmail.gui.utils.WidgetStore(purgeswin) # Load the pixmaps. self.enabled_purge_pixmap = gtk.GtkPixmap(self.widget.list.get_window(), \ sys.path[0] + "/images/enabled-purge.xpm") self.disabled_purge_pixmap = gtk.GtkPixmap(self.widget.list.get_window(), \ sys.path[0] + "/images/disabled-purge.xpm") # Look up the purges, and add them to the list. self.update_list() # Because we start with nothing selected, deactive the controls. self.set_sensitive(0)
def __init__(self, reader): aliaseswin = reader.readglade("aliaseswin", self) self.widget = sqmail.gui.utils.WidgetStore(aliaseswin) self.cursor = sqmail.db.cursor() self.cursor.execute("SELECT name, addresslist FROM aliases") while 1: i = self.cursor.fetchone() if not i: break fp = cStringIO.StringIO(i[1]) msglist = cPickle.load(fp) parent = self.widget.tree.insert_node(None, None, [i[0]], \ is_leaf=0, expanded=1) self.widget.tree.node_set_row_data(parent, i[0]) for j in msglist: node = self.widget.tree.insert_node(parent, None, [j], \ is_leaf=0, expanded=1) self.widget.tree.node_set_row_data(node, j) self.widget.tree.set_reorderable(1) self.on_unselect(None, None, None)
def __init__(self, reader, message, addrlist): self.reader = reader self.message = message composewin = reader.readglade("composewin", self) self.widget = sqmail.gui.utils.WidgetStore(composewin) self.font = gtk.load_font(sqmail.preferences.get_composefont()) # Ensure the text box is 80 columns wide. width = gtk.gdk_char_width(self.font, "m") * 82 # Set up the header fields. if addrlist: self.widget.tofield.set_text( sqmail.gui.utils.render_addrlist(addrlist)) self.widget.fromfield.set_text(sqmail.preferences.get_fromaddress()) if message: i = self.message.getsubject() if (i[:3] == "Re:") or (i[:3] == "re:"): self.widget.subjectfield.set_text(i) else: self.widget.subjectfield.set_text("Re: " + i) # Set up the sign button. self.signaturespopup = gtk.GtkMenu() signatures = os.listdir(os.path.expanduser("~")) signatures.sort() for i in signatures: if (i[0:10] == ".signature"): w = gtk.GtkMenuItem(i) w.show() w.connect("activate", sqmail.gui.utils.Callback(self)["on_sign_with"]) w.set_data("file", i) self.signaturespopup.append(w) # Set up the quote button. if message: self.quotepopup = gtk.GtkMenu() attachments = message.mimeflatten() for i in attachments: if (i[1] in sqmail.gui.textviewer.displayable): w = gtk.GtkMenuItem(i[1] + ": " + i[0]) w.show() w.connect("activate", sqmail.gui.utils.Callback(self)["on_quote_with"]) w.set_data("msg", i[2]) self.quotepopup.append(w) else: self.widget.quotebutton.set_sensitive(0) self.widget.textbox.freeze() self.widget.textbox.set_usize(width, 0) # These two lines set the font. *shrug* self.widget.textbox.insert(self.font, None, None, "\n") self.widget.textbox.delete_text(0, 1) # We want word wrapping. self.widget.textbox.set_word_wrap(1) self.widget.textbox.thaw()
def __init__(self, reader, message, addrlist): self.reader = reader self.message = message composewin = reader.readglade("composewin", self) self.widget = sqmail.gui.utils.WidgetStore(composewin) self.font = gtk.load_font(sqmail.preferences.get_composefont()) # Ensure the text box is 80 columns wide. width = gtk.gdk_char_width(self.font, "m")*82 # Set up the header fields. if addrlist: self.widget.tofield.set_text(sqmail.gui.utils.render_addrlist(addrlist)) self.widget.fromfield.set_text(sqmail.preferences.get_fromaddress()) if message: i = self.message.getsubject() if (i[:3] == "Re:") or (i[:3] == "re:"): self.widget.subjectfield.set_text(i) else: self.widget.subjectfield.set_text("Re: "+i) # Set up the sign button. self.signaturespopup = gtk.GtkMenu() signatures = os.listdir(os.path.expanduser("~")) signatures.sort() for i in signatures: if (i[0:10] == ".signature"): w = gtk.GtkMenuItem(i) w.show() w.connect("activate", sqmail.gui.utils.Callback(self)["on_sign_with"]) w.set_data("file", i) self.signaturespopup.append(w) # Set up the quote button. if message: self.quotepopup = gtk.GtkMenu() attachments = message.mimeflatten() for i in attachments: if (i[1] in sqmail.gui.textviewer.displayable): w = gtk.GtkMenuItem(i[1]+": "+i[0]) w.show() w.connect("activate", sqmail.gui.utils.Callback(self)["on_quote_with"]) w.set_data("msg", i[2]) self.quotepopup.append(w) else: self.widget.quotebutton.set_sensitive(0) self.widget.textbox.freeze() self.widget.textbox.set_usize(width, 0) # These two lines set the font. *shrug* self.widget.textbox.insert(self.font, None, None, "\n") self.widget.textbox.delete_text(0, 1) # We want word wrapping. self.widget.textbox.set_word_wrap(1) self.widget.textbox.thaw()
def __init__(self, reader): global instance if instance: return instance = self self.reader = reader preferenceswin = reader.readglade("preferenceswin", self) self.widget = sqmail.gui.utils.WidgetStore(preferenceswin) # Transport p = sqmail.preferences.get_incomingprotocol() if (p == "IMAP"): self.widget.imapbutton.set_active(1) elif (p == "POP"): self.widget.popbutton.set_active(1) elif (p == "Spool"): self.widget.spoolbutton.set_active(1) self.widget.incomingserver.set_text(sqmail.preferences.get_incomingserver()) self.widget.incomingport.set_text(str(sqmail.preferences.get_incomingport())) self.widget.incomingusername.set_text(sqmail.preferences.get_incomingusername()) self.widget.incomingpassword.set_text(sqmail.preferences.get_incomingpassword()) self.widget.incomingpath.set_text(sqmail.preferences.get_incomingpath()) self.widget.deleteremotebutton.set_active(sqmail.preferences.get_deleteremote()) self.widget.fromaddress.set_text(sqmail.preferences.get_fromaddress()) self.widget.outgoingserver.set_text(sqmail.preferences.get_outgoingserver()) self.widget.outgoingport.set_text(str(sqmail.preferences.get_outgoingport())) self.widget.smtpdebug.set_active(sqmail.preferences.get_smtpdebuglevel()) self.widget.defaultdomain.set_text(sqmail.preferences.get_defaultdomain()) self.widget.sendxface.set_active(sqmail.preferences.get_sendxface()) sqmail.gui.utils.set_face(self.widget.outgoingxfaceicon, sqmail.preferences.get_outgoingxfaceicon()) # Appearances self.widget.textmessagefont.set_font_name(sqmail.preferences.get_textmessagefont()) self.widget.composefont.set_font_name(sqmail.preferences.get_composefont()) self.widget.vfolderfont.set_font_name(sqmail.preferences.get_vfolderfont()) apply(self.widget.vfolderfg.set_i16, sqmail.preferences.get_vfolderfg()) apply(self.widget.vfolderbg.set_i16, sqmail.preferences.get_vfolderbg()) self.widget.vfolderunreadfont.set_font_name(sqmail.preferences.get_vfolderunreadfont()) apply(self.widget.vfolderunreadfg.set_i16, sqmail.preferences.get_vfolderunreadfg()) apply(self.widget.vfolderunreadbg.set_i16, sqmail.preferences.get_vfolderunreadbg()) self.widget.vfolderpendingfont.set_font_name(sqmail.preferences.get_vfolderpendingfont()) apply(self.widget.vfolderpendingfg.set_i16, sqmail.preferences.get_vfolderpendingfg()) apply(self.widget.vfolderpendingbg.set_i16, sqmail.preferences.get_vfolderpendingbg()) self.widget.msglistfont.set_font_name(sqmail.preferences.get_msglistfont()) self.widget.unreadmsglistfont.set_font_name(sqmail.preferences.get_unreadmsglistfont()) self.widget.pendingmsglistfont.set_font_name(sqmail.preferences.get_pendingmsglistfont()) # Spamcop self.widget.deletespam.set_active(sqmail.preferences.get_deletespam()) self.widget.deletespamreply.set_active(sqmail.preferences.get_deletespamreply()) self.widget.spamaddress.set_text(sqmail.preferences.get_spamaddress()) self.widget.spamreplyfrom.set_text(sqmail.preferences.get_spamreplyfrom()) p = sqmail.preferences.get_spamcopmember() if p: self.widget.spamcopmemberyes.set_active(1) else: self.widget.spamcopmemberno.set_active(1) # Mail icons self.widget.usexfaces.set_active(sqmail.preferences.get_usexfaces()) self.widget.xfacedecoder.set_text(sqmail.preferences.get_xfacedecoder()) self.widget.xfaceencoder.set_text(sqmail.preferences.get_xfaceencoder()) self.widget.usepicons.set_active(sqmail.preferences.get_usepicons()) self.widget.usepiconsproxy.set_active(sqmail.preferences.get_usepiconsproxy()) self.widget.omitpiconsuser.set_active(sqmail.preferences.get_omitpiconsuser()) self.widget.piconsserver.set_text(sqmail.preferences.get_piconsserver()) self.widget.piconsproxyserver.set_text(sqmail.preferences.get_piconsproxyserver()) self.widget.piconsproxyport.set_text("%d" % sqmail.preferences.get_piconsproxyport()) self.on_update_piconsstatus(None) # Miscellaneous self.widget.quoteprefix.set_text(sqmail.preferences.get_quoteprefix())