def __init__(self, get_share_status_func=(lambda :[]), remove_share_func=(lambda id:None)): dlg = ConfigableDialog(key='sharemonitor', title='Shared files') dlg.set_size_request(600, 400) att_list = self.make_share_list() att_list.show() dlg.vbox.pack_start(att_list, True, True, 5) self.get_share_status_func = get_share_status_func self.remove_share_func = remove_share_func btn = gtk.Button('Remove') btn.show() btn.connect('button_press_event', self.on_remove) dlg.action_area.pack_start(btn) btn = gtk.Button('Close') btn.connect('button_press_event', lambda w, e: dlg.hide()) btn.show() dlg.action_area.pack_start(btn) self.dlg = dlg self.att_list = att_list self.reload_contacts_sid = gobject.timeout_add(1000, self.do_get_share_status) self.dlg.connect('delete_event', self.dlg.hide_on_delete)
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 __init__(self): ConfigableDialog.__init__(self, key='logviewer', title='Previous Conversations') self.set_size_request(800, 600) self.contacts_list = ContactList() self.contacts_list.show() self.group_list = ContactList() self.group_list.show() self.nb = gtk.Notebook() self.nb.show() self.nb.set_tab_pos(gtk.POS_TOP) self.nb.set_property('show-border', False) self.nb.set_property('tab-border', 2) self.nb.set_show_tabs(True) sw = gtk.ScrolledWindow() sw.show() sw.set_property('can-focus', False) sw.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC) sw.add_with_viewport(self.contacts_list) lbl = gtk.Label('Contact') lbl.show() self.nb.append_page(sw, lbl) sw = gtk.ScrolledWindow() sw.show() sw.set_property('can-focus', False) sw.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC) sw.add_with_viewport(self.group_list) lbl = gtk.Label('Group') lbl.show() self.nb.append_page(sw, lbl) self.nb.set_property('can-focus', False) self.calendar = gtk.Calendar() self.calendar.show() self.filter_date = DateFilterScale() self.filter_date.show() self.filter_date.set_value(DateFilterScale.DAY) nav_box = gtk.VBox(False, 1) nav_box.pack_end(self.calendar, False, False, 2) nav_box.pack_end(self.filter_date, False, False, 2) nav_box.pack_end(self.nb, True, True, 2) nav_box.show() txt_log = ConversationView(rules=[]) txt_log.show() txt_log.invoke('set_editable', False) self.txt_log = txt_log def url_clicked_cb(widget, type, url, btn): if btn == 1: util.launch_file(url) txt_log.connect('anchor-clicked', url_clicked_cb) txt_search = gtk.Entry() txt_search.set_icon_from_pixbuf(0, icons.Toolbar.get_pixbuf('search')) txt_search.set_icon_activatable(0, False) txt_search.show() self.txt_search = txt_search hbox_search = gtk.HBox(False, 1) hbox_search.show() hbox_search.pack_start(txt_search, True, True, 5) vbox = gtk.VBox(False, 1) vbox.pack_end(txt_log, True, True, 5) vbox.pack_start(hbox_search, False, False, 5) vbox.show() hbox = gtk.HBox(False, 1) hbox.pack_start(nav_box, False, False, 5) hbox.pack_start(vbox, True, True, 10) hbox.show() self.vbox.pack_start(hbox, True, True, 0) btn = gtk.Button('Launch') btn.set_tooltip_markup('Open the log file using external editor') btn.show() self.action_area.pack_start(btn, True, True, 0) self.btn_launch = btn btn = gtk.Button('Reload') btn.set_tooltip_markup('Reload from file') btn.show() self.action_area.pack_start(btn, True, True, 0) self.btn_reload = btn btn_close = gtk.Button('Close') btn_close.show() btn_close.connect('button_press_event', lambda w, e: self.hide()) self.action_area.pack_end(btn_close, True, True, 0) self.btn_close = btn_close self.update_gconf()
def __init__(self, title): ConfigableDialog.__init__(self, title=title, key='send') self.set_size_request(600, 400) self.set_icon(icons.App.get_pixbuf('logo')) self.action_area.set_homogeneous(False) self.action_area.set_spacing(10) self.cl = ContactList(get_contacts_func = (lambda : ipmsg.get_contacts().values()), grouping = settings['grouping']) self.cl.show() self.txt_send = MultiEntry() self.txt_send.show() self.txt_send.invoke('set_editable', True) self.txt_send.invoke('drag_dest_set', gtk.DEST_DEFAULT_DROP, [('text/plain', 0, 82), ('image/*', 0, 83)], gtk.gdk.ACTION_COPY) hsep = gtk.HSeparator() hsep.show() chbox = gtk.HBox(False, 1) self.lbl_cnt = gtk.Label('Contacts: %s' % len(ipmsg.get_contacts())) self.lbl_cnt.show() self.btn_group = gtk.ToggleButton('') self.btn_group.show() self.btn_group.set_active(settings['grouping']) self.btn_group.set_relief(gtk.RELIEF_NONE) def set_group_image(active): self.btn_group.set_image(icons.Toolbar.get_image(active and 'group-off' or 'group-on', cache=False)) set_group_image(self.btn_group.get_active()) def on_group_toggled(widget, *args): settings['grouping'] = not settings['grouping'] widget.set_active(settings['grouping']) set_group_image(widget.get_active()) self.cl.toggle_grouping() if settings['grouping']: self.cl.get_column(2).set_visible(False) else: self.cl.get_column(2).set_visible(self.get_gconf('contacts-list-header-visible-group')) self.btn_group.connect('toggled', on_group_toggled) self.btn_group.set_tooltip_markup('Switch groupping mode') self.btn_refresh = gtk.Button('') self.btn_refresh.set_image(icons.Toolbar.get_image('refresh', cache=False)) self.btn_refresh.set_relief(gtk.RELIEF_NONE) self.btn_refresh.set_property('can-focus', False) self.btn_refresh.set_tooltip_markup('Request for the latest contacts list') self.btn_refresh.show() self.btn_refresh.connect("enter", lambda w: w.set_relief(gtk.RELIEF_NORMAL)) self.btn_refresh.connect("leave", lambda w: w.set_relief(gtk.RELIEF_NONE)) chbox.pack_start(self.lbl_cnt, False, False, 5) chbox.pack_end(self.btn_group, False, False, 5) chbox.pack_end(self.btn_refresh, False, False, 2) chbox.show() contact_box = gtk.VBox(False, 2) contact_box.pack_start(chbox, False, False, 2) sw = gtk.ScrolledWindow() sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) sw.show() sw.add_with_viewport(self.cl) contact_box.pack_end(sw, True, True, 0) contact_box.show() hbox = gtk.HBox(False, 1) self.btn_share = gtk.Button('Attachments: None') self.btn_share.set_tooltip_markup('Click or drag to attach files') self.btn_share.show() self.btn_share.set_relief(gtk.RELIEF_NONE) self.btn_share.set_image(icons.Toolbar.get_image('attachment', cache=False)) self.btn_share.set_property('can-focus', False) self.btn_share.connect("enter", lambda w: w.set_relief(gtk.RELIEF_NORMAL)) self.btn_share.connect("leave", lambda w: w.set_relief(gtk.RELIEF_NONE)) hbox.pack_start(self.btn_share, True, True, 2) self.chk_webshare = gtk.CheckButton('Via HTTP') self.chk_webshare.set_tooltip_markup('Use http style share') self.chk_webshare.set_active(settings['default_webshare']) self.chk_webshare.show() hbox.pack_end(self.chk_webshare, False, False, 5) hbox.show() vbox = gtk.VBox(False, 1) vbox.pack_start(hbox, False, False, 2) vbox.pack_end(self.txt_send, True, True, 0) vbox.show() hpan = gtk.HPaned() hpan.show() hpan.pack1(contact_box, shrink=False) hpan.pack2(vbox, shrink=False) self.vbox.pack_start(hpan, True, True, 0) self.chk_seal = gtk.CheckButton('Seal') self.chk_seal.set_tooltip_markup('Seal message') self.chk_seal.show() self.action_area.pack_end(self.chk_seal, False, False, 0) self.chk_password = gtk.CheckButton('Password') self.chk_password.set_tooltip_markup('Require password') self.chk_password.set_active(False) self.chk_password.show() self.action_area.pack_end(self.chk_password, False, False, 0) def seal_toggled_cb(w, *args): self.chk_password.set_sensitive(w.get_active()) if not w.get_active(): self.chk_password.set_active(False) self.chk_seal.connect('toggled', seal_toggled_cb) self.chk_seal.set_active(True) self.chk_seal.set_active(settings['default_seal_msg']) self.btn_send = gtk.Button('Send') self.btn_send.show() self.action_area.pack_end(self.btn_send, False, False, 0) self. update_gconf()
def __init__(self): self.items = {} self.__gconf_key = 'preferences' self.gconf_properties = { 'last_log_file_path' : GConfProperty(self.__gconf_key, 'last_log_file_path', '.'), } dlg = ConfigableDialog(title='Preferences', key='preferences') dlg.set_size_request(600, 400) tv = self.make_preferences_menu() nb = gtk.Notebook() nb.set_tab_pos(gtk.POS_TOP) nb.set_property('show-border', False) nb.set_property('tab-border', 5) nb.set_show_tabs(False) self.panels = [ ('common', CommonPanel(dlg)), ('message', MessagePanel(dlg)), ('log', LogPanel(dlg)), ('hotkey', HotkeyPanel(dlg)), ('rules', RulesPanel(dlg)), ] for idx, (name, panel) in enumerate(self.panels): label = gtk.Label(name.title()) label.show() self.items.update(panel.items) panel.show() nb.append_page(panel, label) tv.get_model().append([idx, name.title()]) nb.show() menu_box = gtk.VBox(False, 1) menu_box.pack_start(tv, True, True, 0) menu_box.show() vbox = gtk.VBox(True, 1) vbox.pack_start(nb, True, True, 0) #vbox.set_size_request(700, 400) vbox.show() hbox = gtk.HBox(False, 1) hbox.pack_start(menu_box, False, False, 0) hbox.pack_start(vbox, True, True, 0) hbox.show() dlg.vbox.pack_start(hbox, True, True, 0) btn_reload = gtk.Button('Restore') btn_reload.show() btn_reload.connect('button_press_event', self.do_reload) dlg.action_area.pack_start(btn_reload, True, True, 0) btn_apply = gtk.Button('Apply') btn_apply.show() btn_apply.connect('button_press_event', self.do_apply) dlg.action_area.pack_start(btn_apply, True, True, 0) btn_ok = gtk.Button('OK') btn_ok.show() btn_ok.connect('button_press_event', self.do_ok) dlg.action_area.pack_end(btn_ok, True, True, 0) btn_cancel = gtk.Button('Cancel') btn_cancel.show() btn_cancel.connect('button_press_event', self.do_close) dlg.action_area.pack_end(btn_cancel, True, True, 0) tv.connect('cursor-changed', self.show_category, nb) tv.get_selection().select_path((0)) self.dlg = dlg self.disable_escape() self.dlg.connect('delete_event', self.dlg.hide_on_delete)