we can now receive photos in vcard (sending it come soon)
This commit is contained in:
parent
69a6aaff74
commit
051adcab4d
100
src/gtkgui.glade
100
src/gtkgui.glade
|
@ -4775,7 +4775,7 @@
|
|||
<property name="has_frame">True</property>
|
||||
<property name="invisible_char">*</property>
|
||||
<property name="activates_default">False</property>
|
||||
<signal name="changed" handler="on_sounds_entry_changed" last_modification_time="Tue, 06 Jun 2005 19:59:41 GMT"/>
|
||||
<signal name="changed" handler="on_sounds_entry_changed" last_modification_time="Mon, 06 Jun 2005 19:59:41 GMT"/>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
|
@ -8012,33 +8012,89 @@ Custom</property>
|
|||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkScrolledWindow" id="scrolledwindow33">
|
||||
<widget class="GtkVBox" id="vbox85">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
|
||||
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
|
||||
<property name="shadow_type">GTK_SHADOW_NONE</property>
|
||||
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkTextView" id="DESC_textview">
|
||||
<property name="border_width">6</property>
|
||||
<widget class="GtkScrolledWindow" id="scrolledwindow33">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="editable">False</property>
|
||||
<property name="overwrite">False</property>
|
||||
<property name="accepts_tab">True</property>
|
||||
<property name="justification">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap_mode">GTK_WRAP_WORD</property>
|
||||
<property name="cursor_visible">False</property>
|
||||
<property name="pixels_above_lines">0</property>
|
||||
<property name="pixels_below_lines">0</property>
|
||||
<property name="pixels_inside_wrap">0</property>
|
||||
<property name="left_margin">0</property>
|
||||
<property name="right_margin">0</property>
|
||||
<property name="indent">0</property>
|
||||
<property name="text" translatable="yes"></property>
|
||||
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
|
||||
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
|
||||
<property name="shadow_type">GTK_SHADOW_NONE</property>
|
||||
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkTextView" id="DESC_textview">
|
||||
<property name="border_width">6</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="editable">False</property>
|
||||
<property name="overwrite">False</property>
|
||||
<property name="accepts_tab">True</property>
|
||||
<property name="justification">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap_mode">GTK_WRAP_WORD</property>
|
||||
<property name="cursor_visible">False</property>
|
||||
<property name="pixels_above_lines">0</property>
|
||||
<property name="pixels_below_lines">0</property>
|
||||
<property name="pixels_inside_wrap">0</property>
|
||||
<property name="left_margin">0</property>
|
||||
<property name="right_margin">0</property>
|
||||
<property name="indent">0</property>
|
||||
<property name="text" translatable="yes"></property>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkExpander" id="expander6">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="expanded">True</property>
|
||||
<property name="spacing">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkImage" id="PHOTO_image">
|
||||
<property name="visible">True</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
</widget>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label310">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Photo</property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="type">label_item</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
|
|
25
src/vcard.py
25
src/vcard.py
|
@ -19,6 +19,8 @@
|
|||
|
||||
import gtk
|
||||
import gtk.glade
|
||||
import urllib
|
||||
import base64
|
||||
from common import gajim
|
||||
from common import i18n
|
||||
_ = i18n._
|
||||
|
@ -76,6 +78,29 @@ class Vcard_window:
|
|||
def set_values(self, vcard):
|
||||
for i in vcard.keys():
|
||||
if type(vcard[i]) == type({}):
|
||||
if i == 'PHOTO':
|
||||
img_decoded = None
|
||||
if vcard[i].has_key('BINVAL'):
|
||||
try:
|
||||
img_encoded = vcard[i]['BINVAL']
|
||||
img_decoded = base64.decodestring(img_encoded)
|
||||
except:
|
||||
pass
|
||||
elif vcard[i].has_key('EXTVAL'):
|
||||
url = vcard[i]['EXTVAL']
|
||||
try:
|
||||
fd = urllib.urlopen(url)
|
||||
img_decoded = fd.read()
|
||||
except:
|
||||
pass
|
||||
if img_decoded:
|
||||
pixbufloader = gtk.gdk.PixbufLoader()
|
||||
pixbufloader.write(img_decoded)
|
||||
pixbufloader.close()
|
||||
pixbuf = pixbufloader.get_pixbuf()
|
||||
image = self.xml.get_widget('PHOTO_image')
|
||||
image.set_from_pixbuf(pixbuf)
|
||||
continue
|
||||
add_on = ''
|
||||
if i == 'ADR' or i == 'TEL' or i == 'EMAIL':
|
||||
add_on = '_HOME'
|
||||
|
|
Loading…
Reference in New Issue