new emoticons binder in preferences window
This commit is contained in:
parent
d3bb2d31ff
commit
47d7464a73
|
@ -397,15 +397,26 @@ class preference_Window:
|
|||
model.clear()
|
||||
emots = self.load_emots()
|
||||
for i in emots:
|
||||
iter = model.append()
|
||||
model.set(iter, 0, i, 1,emots[i])
|
||||
file = emots[i]
|
||||
iter = model.append((i, file, None))
|
||||
if not os.path.exists(file):
|
||||
continue
|
||||
img = gtk.Image()
|
||||
img.show()
|
||||
if file.find('.gif') != -1:
|
||||
pix = gtk.gdk.PixbufAnimation(file)
|
||||
img.set_from_animation(pix)
|
||||
else:
|
||||
pix = gtk.gdk.pixbuf_new_from_file(file)
|
||||
img.set_from_pixbuf(pix)
|
||||
model.set(iter, 2, img)
|
||||
|
||||
def on_emot_cell_edited(self, cell, row, new_text):
|
||||
model = self.emot_tree.get_model()
|
||||
iter = model.get_iter_from_string(row)
|
||||
model.set_value(iter, 0, new_text)
|
||||
|
||||
def on_button_emoticons_clicked(self, widget, data=None):
|
||||
def on_button_set_image_clicked(self, widget, data=None):
|
||||
(model, iter) = self.emot_tree.get_selection().get_selected()
|
||||
if not iter:
|
||||
return
|
||||
|
@ -448,14 +459,23 @@ class preference_Window:
|
|||
ok = 1
|
||||
dialog.destroy()
|
||||
if file:
|
||||
self.xml.get_widget('entry_emoticons').set_text(file)
|
||||
self.xml.get_widget('image_emoticon').set_from_file(file)
|
||||
model.set_value(iter, 1, file)
|
||||
img = gtk.Image()
|
||||
img.show()
|
||||
if file.find('.gif') != -1:
|
||||
pix = gtk.gdk.PixbufAnimation(file)
|
||||
img.set_from_animation(pix)
|
||||
else:
|
||||
pix = gtk.gdk.pixbuf_new_from_file(file)
|
||||
img.set_from_pixbuf(pix)
|
||||
model.set(iter, 2, img)
|
||||
|
||||
def on_button_new_emoticon_clicked(self, widget, data=None):
|
||||
model = self.emot_tree.get_model()
|
||||
iter = model.append()
|
||||
model.set(iter, 0, 'smeiley', 1, '')
|
||||
col = self.emot_tree.get_column(0)
|
||||
self.emot_tree.set_cursor(model.get_path(iter), col, True)
|
||||
|
||||
def on_button_remove_emoticon_clicked(self, widget, data=None):
|
||||
(model, iter) = self.emot_tree.get_selection().get_selected()
|
||||
|
@ -463,14 +483,6 @@ class preference_Window:
|
|||
return
|
||||
model.remove(iter)
|
||||
|
||||
def on_treeview_emoticons_cursor_changed(self, widget, data=None):
|
||||
(model, iter) = self.emot_tree.get_selection().get_selected()
|
||||
if not iter:
|
||||
return
|
||||
img_str = model.get_value(iter, 1)
|
||||
self.xml.get_widget('entry_emoticons').set_text(img_str)
|
||||
self.xml.get_widget('image_emoticon').set_from_file(img_str)
|
||||
|
||||
def on_chk_toggled(self, widget, widgets):
|
||||
"""set or unset sensitivity of widgets when widget is toggled"""
|
||||
for w in widgets:
|
||||
|
@ -607,13 +619,11 @@ class preference_Window:
|
|||
self.xml.get_widget('button_new_emoticon').set_sensitive(st)
|
||||
self.xml.get_widget('button_remove_emoticon').set_sensitive(st)
|
||||
self.xml.get_widget('treeview_emoticons').set_sensitive(st)
|
||||
self.xml.get_widget('entry_emoticons').set_sensitive(st)
|
||||
self.xml.get_widget('button_emoticons').set_sensitive(st)
|
||||
self.xml.get_widget('image_emoticon').set_sensitive(st)
|
||||
self.xml.get_widget('button_set_image').set_sensitive(st)
|
||||
|
||||
#emoticons
|
||||
self.emot_tree = self.xml.get_widget('treeview_emoticons')
|
||||
model = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_STRING)
|
||||
model = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_STRING, gtk.Image)
|
||||
self.emot_tree.set_model(model)
|
||||
col = gtk.TreeViewColumn('name')
|
||||
self.emot_tree.append_column(col)
|
||||
|
@ -622,6 +632,13 @@ class preference_Window:
|
|||
renderer.set_property('editable', True)
|
||||
col.pack_start(renderer, True)
|
||||
col.set_attributes(renderer, text=0)
|
||||
|
||||
col = gtk.TreeViewColumn('Image')
|
||||
self.emot_tree.append_column(col)
|
||||
renderer = gtkgui.ImageCellRenderer()
|
||||
col.pack_start(renderer, expand = False)
|
||||
col.add_attribute(renderer, 'image', 2)
|
||||
|
||||
self.fill_emot_treeview()
|
||||
|
||||
#sound player
|
||||
|
@ -759,10 +776,8 @@ class preference_Window:
|
|||
self.xml.get_widget('entry_emoticons'),
|
||||
self.xml.get_widget('button_emoticons'),
|
||||
self.xml.get_widget('image_emoticon')])
|
||||
self.xml.signal_connect('on_treeview_emoticons_cursor_changed', \
|
||||
self.on_treeview_emoticons_cursor_changed)
|
||||
self.xml.signal_connect('on_button_emoticons_clicked', \
|
||||
self.on_button_emoticons_clicked)
|
||||
self.xml.signal_connect('on_button_set_image_clicked', \
|
||||
self.on_button_set_image_clicked)
|
||||
self.xml.signal_connect('on_button_new_emoticon_clicked', \
|
||||
self.on_button_new_emoticon_clicked)
|
||||
self.xml.signal_connect('on_button_remove_emoticon_clicked', \
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
<property name="use_underline">True</property>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image209">
|
||||
<widget class="GtkImage" id="image161">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-convert</property>
|
||||
<property name="icon_size">1</property>
|
||||
|
@ -64,10 +64,9 @@
|
|||
<property name="label" translatable="yes">_Preferences</property>
|
||||
<property name="use_underline">True</property>
|
||||
<signal name="activate" handler="on_preferences_activate" last_modification_time="Wed, 22 Oct 2003 21:18:29 GMT"/>
|
||||
<accelerator key="P" modifiers="GDK_CONTROL_MASK" signal="activate"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image210">
|
||||
<widget class="GtkImage" id="image162">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-preferences</property>
|
||||
<property name="icon_size">1</property>
|
||||
|
@ -86,10 +85,9 @@
|
|||
<property name="label" translatable="yes">A_ccounts</property>
|
||||
<property name="use_underline">True</property>
|
||||
<signal name="activate" handler="on_accounts_activate" last_modification_time="Wed, 22 Oct 2003 21:18:21 GMT"/>
|
||||
<accelerator key="A" modifiers="GDK_CONTROL_MASK" signal="activate"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image211">
|
||||
<widget class="GtkImage" id="image163">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-select-color</property>
|
||||
<property name="icon_size">1</property>
|
||||
|
@ -110,7 +108,7 @@
|
|||
<signal name="activate" handler="on_browse_agents_activate" last_modification_time="Wed, 12 Nov 2003 10:50:33 GMT"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image212">
|
||||
<widget class="GtkImage" id="image164">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-find</property>
|
||||
<property name="icon_size">1</property>
|
||||
|
@ -136,7 +134,7 @@
|
|||
<property name="use_underline">True</property>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image213">
|
||||
<widget class="GtkImage" id="image165">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-add</property>
|
||||
<property name="icon_size">1</property>
|
||||
|
@ -156,7 +154,6 @@
|
|||
<property name="use_underline">True</property>
|
||||
<property name="active">False</property>
|
||||
<signal name="activate" handler="on_show_offline_activate" last_modification_time="Wed, 31 Dec 2003 09:49:15 GMT"/>
|
||||
<accelerator key="O" modifiers="GDK_CONTROL_MASK" signal="activate"/>
|
||||
</widget>
|
||||
</child>
|
||||
|
||||
|
@ -183,7 +180,7 @@
|
|||
<signal name="activate" handler="on_about_activate" last_modification_time="Fri, 03 Oct 2003 12:49:50 GMT"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image214">
|
||||
<widget class="GtkImage" id="image166">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-help</property>
|
||||
<property name="icon_size">1</property>
|
||||
|
@ -205,7 +202,7 @@
|
|||
<accelerator key="Q" modifiers="GDK_CONTROL_MASK" signal="activate"/>
|
||||
|
||||
<child internal-child="image">
|
||||
<widget class="GtkImage" id="image215">
|
||||
<widget class="GtkImage" id="image167">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-quit</property>
|
||||
<property name="icon_size">1</property>
|
||||
|
@ -4361,16 +4358,10 @@ on the server.</property>
|
|||
|
||||
<child>
|
||||
<widget class="GtkVBox" id="vbox46">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkVBox" id="vbox47">
|
||||
<property name="border_width">5</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">0</property>
|
||||
<property name="spacing">5</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkCheckButton" id="use_emoticons_checkbutton">
|
||||
|
@ -4392,17 +4383,6 @@ on the server.</property>
|
|||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkHSeparator" id="hseparator14">
|
||||
<property name="visible">True</property>
|
||||
|
@ -4415,52 +4395,11 @@ on the server.</property>
|
|||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkHBox" id="hbox2903">
|
||||
<property name="border_width">5</property>
|
||||
<widget class="GtkHBox" id="hbox2913">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkVBox" id="vbox49">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">5</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkButton" id="button_new_emoticon">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label">gtk-add</property>
|
||||
<property name="use_stock">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
<signal name="clicked" handler="on_button_new_emoticon_clicked" last_modification_time="Wed, 19 Jan 2005 22:25:07 GMT"/>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkButton" id="button_remove_emoticon">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label">gtk-remove</property>
|
||||
<property name="use_stock">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
<signal name="clicked" handler="on_button_remove_emoticon_clicked" last_modification_time="Wed, 19 Jan 2005 22:57:48 GMT"/>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkScrolledWindow" id="scrolledwindow25">
|
||||
<property name="visible">True</property>
|
||||
|
@ -4478,7 +4417,6 @@ on the server.</property>
|
|||
<property name="rules_hint">False</property>
|
||||
<property name="reorderable">False</property>
|
||||
<property name="enable_search">True</property>
|
||||
<signal name="cursor_changed" handler="on_treeview_emoticons_cursor_changed" last_modification_time="Tue, 18 Jan 2005 22:12:10 GMT"/>
|
||||
<signal name="key_press_event" handler="on_treeview_emoticons_key_press_event" last_modification_time="Wed, 02 Feb 2005 21:04:18 GMT"/>
|
||||
</widget>
|
||||
</child>
|
||||
|
@ -4489,74 +4427,72 @@ on the server.</property>
|
|||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkVBox" id="vbox48">
|
||||
<widget class="GtkVButtonBox" id="vbuttonbox2">
|
||||
<property name="border_width">5</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">5</property>
|
||||
<property name="layout_style">GTK_BUTTONBOX_SPREAD</property>
|
||||
<property name="spacing">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkHBox" id="hbox2904">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">5</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkEntry" id="entry_emoticons">
|
||||
<widget class="GtkButton" id="button_new_emoticon">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_default">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="editable">False</property>
|
||||
<property name="visibility">True</property>
|
||||
<property name="max_length">0</property>
|
||||
<property name="text" translatable="yes"></property>
|
||||
<property name="has_frame">True</property>
|
||||
<property name="invisible_char">*</property>
|
||||
<property name="activates_default">False</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkButton" id="button_emoticons">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">...</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="label">gtk-add</property>
|
||||
<property name="use_stock">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
<signal name="clicked" handler="on_button_emoticons_clicked" last_modification_time="Wed, 19 Jan 2005 20:47:01 GMT"/>
|
||||
<signal name="clicked" handler="on_button_new_emoticon_clicked" last_modification_time="Sun, 13 Feb 2005 14:30:54 GMT"/>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="pack_type">GTK_PACK_END</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkImage" id="image_emoticon">
|
||||
<widget class="GtkButton" id="button_remove_emoticon">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_default">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label">gtk-remove</property>
|
||||
<property name="use_stock">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
<signal name="clicked" handler="on_button_remove_emoticon_clicked" last_modification_time="Sun, 13 Feb 2005 14:31:17 GMT"/>
|
||||
</widget>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkButton" id="button_set_image">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_default">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
<signal name="clicked" handler="on_button_set_image_clicked" last_modification_time="Sun, 13 Feb 2005 14:32:31 GMT"/>
|
||||
|
||||
<child>
|
||||
<widget class="GtkAlignment" id="alignment38">
|
||||
<property name="visible">True</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xscale">0</property>
|
||||
<property name="yscale">0</property>
|
||||
<property name="top_padding">0</property>
|
||||
<property name="bottom_padding">0</property>
|
||||
<property name="left_padding">0</property>
|
||||
<property name="right_padding">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkHBox" id="hbox2914">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">2</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkImage" id="image185">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-file</property>
|
||||
<property name="icon_size">4</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
|
@ -4564,14 +4500,41 @@ on the server.</property>
|
|||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label190">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">_Set Image</property>
|
||||
<property name="use_underline">True</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="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
|
|
@ -427,7 +427,18 @@ class tabbed_chat_Window:
|
|||
nb = self.xml.get_widget("notebook")
|
||||
st = "1234567890"
|
||||
if event.keyval == gtk.keysyms.Escape:
|
||||
self.on_close_clicked(widget)
|
||||
jid = self.get_active_jid()
|
||||
if len(self.xmls) == 1:
|
||||
button.get_toplevel().destroy()
|
||||
else:
|
||||
nb.remove_page(nb.get_current_page())
|
||||
del self.plugin.windows[self.account]['chats'][jid]
|
||||
del self.users[jid]
|
||||
del self.nb_unread[jid]
|
||||
del self.xmls[jid]
|
||||
del self.tagIn[jid]
|
||||
del self.tagOut[jid]
|
||||
del self.tagStatus[jid]
|
||||
elif (event.string in st) \
|
||||
and (event.state & gtk.gdk.MOD1_MASK):
|
||||
nb.set_current_page(st.index(event.string))
|
||||
|
|
Loading…
Reference in New Issue