Changeset 6300

Show
Ignore:
Timestamp:
05/08/06 23:59:09 (3 years ago)
Author:
dkirov
Message:

moved completion definition in a function
get_completion_liststore in gtkgui_helpers

Location:
trunk/src
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/dialogs.py

    r6299 r6300  
    998998                prompt_text = _('Fill in the jid, or nick of the contact you would like\nto send a chat message to:') 
    999999                InputDialog.__init__(self, title, prompt_text, is_modal = False) 
    1000                 # create the completion model for input_entry 
    1001                 completion = gtk.EntryCompletion() 
    1002                 liststore = gtk.ListStore(gtk.gdk.Pixbuf, str) 
    1003                  
    1004                 render_pixbuf = gtk.CellRendererPixbuf() 
    1005                 completion.pack_start(render_pixbuf, expand = False) 
    1006                 completion.add_attribute(render_pixbuf, 'pixbuf', 0) 
    1007                  
    1008                 render_text = gtk.CellRendererText() 
    1009                 completion.pack_start(render_text, expand = True) 
    1010                 completion.add_attribute(render_text, 'text', 1) 
    1011                 completion.set_property('text_column', 1) 
     1000                 
     1001                self.completion_dict = {} 
     1002                liststore = gtkgui_helpers.get_completion_liststore(self.input_entry) 
    10121003                # add all contacts to the model 
    1013                 self.completion_dict = {} 
    10141004                for jid in gajim.contacts.get_jid_list(account): 
    10151005                        contact = gajim.contacts.get_contact_with_highest_priority(account, jid) 
     
    10271017                        img =  gajim.interface.roster.jabber_state_images['16'][contact.show] 
    10281018                        liststore.append((img.get_pixbuf(), jid)) 
    1029  
    1030                 completion.set_model(liststore) 
    1031                 self.input_entry.set_completion(completion) 
    10321019 
    10331020                self.ok_handler = self.new_chat_response 
  • trunk/src/gtkgui_helpers.py

    r6265 r6300  
    5151        return gtk.glade.XML(file_path, root=root, domain=i18n.APP) 
    5252 
     53def get_completion_liststore(entry): 
     54        ''' create a completion model for entry widget 
     55        completion list consists of (Pixbuf, Text) rows''' 
     56        completion = gtk.EntryCompletion() 
     57        liststore = gtk.ListStore(gtk.gdk.Pixbuf, str) 
     58         
     59        render_pixbuf = gtk.CellRendererPixbuf() 
     60        completion.pack_start(render_pixbuf, expand = False) 
     61        completion.add_attribute(render_pixbuf, 'pixbuf', 0) 
     62         
     63        render_text = gtk.CellRendererText() 
     64        completion.pack_start(render_text, expand = True) 
     65        completion.add_attribute(render_text, 'text', 1) 
     66        completion.set_property('text_column', 1) 
     67        completion.set_model(liststore) 
     68        entry.set_completion(completion) 
     69        return liststore 
     70         
     71         
    5372def popup_emoticons_under_button(menu, button, parent_win): 
    5473        ''' pops emoticons menu under button, which is in parent_win'''