def __init__(self, title): ConfigableDialog.__init__(self, title=title, key='recv') self.set_size_request(600, 400) self.set_icon(icons.App.get_pixbuf('logo')) self.lbl_header = gtk.Label() self.lbl_header.show() hbox = gtk.HBox() hbox.show() self.img_status = gtk.Image() self.img_status.show() hbox.pack_start(self.img_status, False, False, 5) hbox.pack_start(self.lbl_header, True, True, 5) self.vbox.pack_start(hbox, False, False, 5) self.msg_area = gtk.VBox() self.msg_area.show() self.btn_att = gtk.Button() self.btn_att.show() self.hbox_att = gtk.HBox() img = icons.Toolbar.get_image('attachment') img.show() self.btn_att.set_image(img) self.hbox_att.pack_start(self.btn_att, True, True, 5) self.msg_area.pack_start(self.hbox_att, False, False, 0) self.txt_recv = HyperMultiEntry() self.txt_recv.invoke('set_editable', False) self.txt_recv.show() self.msg_area.pack_end(self.txt_recv, True, True, 1) self.vbox.pack_start(self.msg_area, True, True, 1) self.btn_open = gtk.Button('Click to open message') self.vbox.pack_end(self.btn_open, True, True, 1) self.btn_close = gtk.Button(label='Close') self.btn_close.connect("button_press_event", lambda w, e : self.destroy()) self.btn_close.show() self.action_area.pack_start(self.btn_close, True, True, 0) self.btn_copy = gtk.Button(label='Copy') self.btn_copy.show() self.action_area.pack_start(self.btn_copy, True, True, 0) self.chk_refer = gtk.CheckButton('Quote') self.chk_refer.set_active(settings['default_quote_msg']) self.chk_refer.show() self.action_area.pack_start(self.chk_refer, True, True, 0) self.btn_reply = gtk.Button(label='Reply') self.btn_reply.show() self.action_area.pack_start(self.btn_reply, True, True, 0) self.update_gconf()
class RecvDlg(ConfigableDialog): def __init__(self, title): ConfigableDialog.__init__(self, title=title, key='recv') self.set_size_request(600, 400) self.set_icon(icons.App.get_pixbuf('logo')) self.lbl_header = gtk.Label() self.lbl_header.show() hbox = gtk.HBox() hbox.show() self.img_status = gtk.Image() self.img_status.show() hbox.pack_start(self.img_status, False, False, 5) hbox.pack_start(self.lbl_header, True, True, 5) self.vbox.pack_start(hbox, False, False, 5) self.msg_area = gtk.VBox() self.msg_area.show() self.btn_att = gtk.Button() self.btn_att.show() self.hbox_att = gtk.HBox() img = icons.Toolbar.get_image('attachment') img.show() self.btn_att.set_image(img) self.hbox_att.pack_start(self.btn_att, True, True, 5) self.msg_area.pack_start(self.hbox_att, False, False, 0) self.txt_recv = HyperMultiEntry() self.txt_recv.invoke('set_editable', False) self.txt_recv.show() self.msg_area.pack_end(self.txt_recv, True, True, 1) self.vbox.pack_start(self.msg_area, True, True, 1) self.btn_open = gtk.Button('Click to open message') self.vbox.pack_end(self.btn_open, True, True, 1) self.btn_close = gtk.Button(label='Close') self.btn_close.connect("button_press_event", lambda w, e : self.destroy()) self.btn_close.show() self.action_area.pack_start(self.btn_close, True, True, 0) self.btn_copy = gtk.Button(label='Copy') self.btn_copy.show() self.action_area.pack_start(self.btn_copy, True, True, 0) self.chk_refer = gtk.CheckButton('Quote') self.chk_refer.set_active(settings['default_quote_msg']) self.chk_refer.show() self.action_area.pack_start(self.chk_refer, True, True, 0) self.btn_reply = gtk.Button(label='Reply') self.btn_reply.show() self.action_area.pack_start(self.btn_reply, True, True, 0) self.update_gconf() def update_gconf(self): font = self.get_gconf('header-font') if font: desc = pango.FontDescription(font) self.lbl_header.modify_font(desc) color = self.get_gconf('header-color') if color: self.lbl_header.modify_text(gtk.STATE_NORMAL, gtk.gdk.color_parse(color)) self.txt_recv.link['foreground'] = self.get_gconf('link-color') self.txt_recv.link['background'] = self.get_gconf('link-bgcolor') self.txt_recv.hover['foreground'] = self.get_gconf('link-hover-color') self.txt_recv.hover['background'] = self.get_gconf('link-hover-bgcolor') self.txt_recv.active['foreground'] = self.get_gconf('link-active-color') self.txt_recv.active['background'] = self.get_gconf('link-active-bgcolor') font = self.get_gconf('content-font') if font: desc = pango.FontDescription(font) self.txt_recv.invoke('modify_font', desc) color = self.get_gconf('content-color') if color: self.txt_recv.invoke('modify_text', gtk.STATE_NORMAL, gtk.gdk.color_parse(color)) bgcolor = self.get_gconf('content-bgcolor') if bgcolor: self.txt_recv.invoke('modify_base', gtk.STATE_NORMAL, gtk.gdk.color_parse(bgcolor)) def init_gconf(self): self.add_gconf_property('header-font', '') self.add_gconf_property('header-color', gtk.gdk.Color(0, 0, 0).to_string()) self.add_gconf_property('content-font', '') self.add_gconf_property('content-color', gtk.gdk.Color(0, 0, 0).to_string()) self.add_gconf_property('content-bgcolor', gtk.gdk.Color(65535, 65535, 65535).to_string()) self.add_gconf_property('link-color', 'blue') self.add_gconf_property('link-bgcolor', 'white') self.add_gconf_property('link-hover-color', 'red') self.add_gconf_property('link-hover-bgcolor', 'gray') self.add_gconf_property('link-active-color', 'red') self.add_gconf_property('link-active-bgcolor', 'gray') def show_settings(self): dlg = RecvSettings(self.key, parent=self) dlg.run()