Ticket #1742: untested_patch.diff
| File untested_patch.diff, 4.2 kB (added by nk, 2 years ago) |
|---|
-
src/vcard.py
231 231 menu.popup(None, None, None, event.button, event.time) 232 232 233 233 def set_value(self, entry_name, value): 234 '''puts the value in the entry_name label''' 234 235 try: 235 236 self.xml.get_widget(entry_name).set_text(value) 236 237 except AttributeError: 237 238 pass 238 239 239 240 def set_values(self, vcard): 240 for i in vcard.keys(): 241 if i == 'PHOTO': 241 '''puts the info from the vcard dict to the window''' 242 for key in vcard.keys(): 243 if key == 'PHOTO': 242 244 pixbuf, self.avatar_encoded, self.avatar_mime_type = \ 243 get_avatar_pixbuf_encoded_mime(vcard[ i])245 get_avatar_pixbuf_encoded_mime(vcard[key]) 244 246 if not pixbuf: 245 247 continue 246 248 image = self.xml.get_widget('PHOTO_image') … … 250 252 self.avatar_save_as_id = eventbox.connect('button-press-event', 251 253 self.on_PHOTO_eventbox_button_press_event) 252 254 continue 253 if i == 'ADR' or i == 'TEL' or i == 'EMAIL':254 for entry in vcard[ i]:255 if key in ('ADR', 'TEL', 'EMAIL'): 256 for entry in vcard[key]: 255 257 add_on = '_HOME' 256 258 if 'WORK' in entry: 257 259 add_on = '_WORK' 258 260 for j in entry.keys(): 259 self.set_value( i+ add_on + '_' + j + '_entry', entry[j])260 if isinstance(vcard[ i], dict):261 for j in vcard[ i].keys():262 self.set_value( i + '_' + j + '_entry', vcard[i][j])261 self.set_value(key + add_on + '_' + j + '_entry', entry[j]) 262 if isinstance(vcard[key], dict): 263 for j in vcard[key].keys(): 264 self.set_value(key + '_' + j + '_entry', vcard[key][j]) 263 265 else: 264 if i== 'DESC':266 if key == 'DESC': 265 267 self.xml.get_widget('DESC_textview').get_buffer().set_text( 266 vcard[i], 0) 268 vcard[key], 0) 269 elif gtk.pygtk_version >= (2, 10, 0) and gtk.gtk_version >= (2, 10, 0) and key == 'URL': 270 #FIXME: remove all this stuff when we migrate to GTK 2.10 271 general_info_table = self.xml.get_widget('general_info_table') 272 general_info_table.remove(self.xml.get_widget('URL_entry')) 273 general_info_table.attach(gtk.LinkButton(key, key), 0, 1, 5, 6) 274 267 275 else: 268 self.set_value( i + '_entry', vcard[i])276 self.set_value(key + '_entry', vcard[key]) 269 277 270 278 def set_last_status_time(self): 271 279 self.fill_status_label() … … 436 444 'ORG_ORGUNIT', 'TITLE', 'ROLE', 'TEL_WORK_NUMBER', 'EMAIL_WORK_USERID', 437 445 'ADR_WORK_STREET', 'ADR_WORK_EXTADR', 'ADR_WORK_LOCALITY', 438 446 'ADR_WORK_REGION', 'ADR_WORK_PCODE', 'ADR_WORK_CTRY'] 447 439 448 vcard = {} 440 for e in entries: 441 txt = self.xml.get_widget(e + '_entry').get_text().decode('utf-8') 449 for entry in entries: 450 txt = self.xml.get_widget(entry + '_entry').get_text()\ 451 .decode('utf-8') 442 452 if txt != '': 443 vcard = self.add_to_vcard(vcard, e , txt)453 vcard = self.add_to_vcard(vcard, entry, txt) 444 454 445 455 # DESC textview 446 456 buff = self.xml.get_widget('DESC_textview').get_buffer() … … 480 490 'ORG_ORGUNIT', 'TITLE', 'ROLE', 'ADR_WORK_STREET', 'ADR_WORK_EXTADR', 481 491 'ADR_WORK_LOCALITY', 'ADR_WORK_REGION', 'ADR_WORK_PCODE', 482 492 'ADR_WORK_CTRY'] 493 494 if gtk.pygtk_version >= (2, 10, 0) and gtk.gtk_version >= (2, 10, 0): 495 entries.remove('URL') 496 #FIXME: when we migrate to 2.10 remove URL from entries list completely 497 483 498 if gajim.connections[self.account].connected > 1: 484 499 # clear all entries 485 500 for e in entries: -
data/glade/vcard_information_window.glade
621 621 </child> 622 622 623 623 <child> 624 <widget class="GtkTable" id=" table11">624 <widget class="GtkTable" id="general_info_table"> 625 625 <property name="border_width">6</property> 626 626 <property name="visible">True</property> 627 627 <property name="n_rows">7</property> … … 708 708 </child> 709 709 710 710 <child> 711 <widget class="GtkLabel" id=" label119">711 <widget class="GtkLabel" id="URL_label"> 712 712 <property name="visible">True</property> 713 713 <property name="label" translatable="yes">Homepage:</property> 714 714 <property name="use_underline">False</property>
