add escape to close the singlemessagewindow also add sendandclose button (as default)
This commit is contained in:
parent
5df9361bc4
commit
7877b5c2ac
|
@ -822,12 +822,14 @@ class SingleMessageWindow:
|
|||
self.message_tv_buffer = self.message_textview.get_buffer()
|
||||
self.send_button = self.xml.get_widget('send_button')
|
||||
self.reply_button = self.xml.get_widget('reply_button')
|
||||
self.send_and_close_button = self.xml.get_widget('send_and_close_button')
|
||||
self.message_tv_buffer.connect('changed', self.update_char_counter)
|
||||
|
||||
self.to_entry.set_text(self.contact.jid)
|
||||
|
||||
self.send_button.set_no_show_all(True)
|
||||
self.reply_button.set_no_show_all(True)
|
||||
self.send_and_close_button.set_no_show_all(True)
|
||||
self.to_label.set_no_show_all(True)
|
||||
self.to_entry.set_no_show_all(True)
|
||||
self.from_label.set_no_show_all(True)
|
||||
|
@ -867,17 +869,19 @@ class SingleMessageWindow:
|
|||
if action == 'send':
|
||||
title = _('Send %s') % title
|
||||
self.send_button.show()
|
||||
self.send_and_close_button.show()
|
||||
self.to_label.show()
|
||||
self.to_entry.show()
|
||||
self.reply_button.hide()
|
||||
self.from_label.hide()
|
||||
self.from_entry.hide()
|
||||
elif action == 'receive':
|
||||
title = _('%s Received') % title
|
||||
title = _('Received %s') % title
|
||||
self.reply_button.show()
|
||||
self.from_label.show()
|
||||
self.from_entry.show()
|
||||
self.send_button.hide()
|
||||
self.send_and_close_button.hide()
|
||||
self.to_label.hide()
|
||||
self.to_entry.hide()
|
||||
|
||||
|
@ -890,7 +894,7 @@ class SingleMessageWindow:
|
|||
characters_no = self.message_tv_buffer.get_char_count()
|
||||
self.count_chars_label.set_text(str(characters_no))
|
||||
|
||||
def on_send_button_clicked(self, widget):
|
||||
def send_single_message(self):
|
||||
to_whom_jid = self.to_entry.get_text()
|
||||
if to_whom_jid.find('@') == -1: # if no @ was given
|
||||
ErrorDialog(_('Invalid contact ID'),
|
||||
|
@ -907,15 +911,26 @@ class SingleMessageWindow:
|
|||
self.subject_entry.set_text('') # we sent ok, clear the subject
|
||||
self.message_tv_buffer.set_text('') # we sent ok, clear the textview
|
||||
|
||||
def on_send_button_clicked(self, widget):
|
||||
self.send_single_message()
|
||||
|
||||
def on_reply_button_clicked(self, widget):
|
||||
# we create a new blank window to send and we preset RE: and to jid
|
||||
self.subject = _('RE: %s') % self.subject
|
||||
self.message = _('\n-< Original Message >-\n%s') % self.message
|
||||
self.message = _('\n\n\n== Original Message ==\n%s') % self.message
|
||||
self.window.destroy()
|
||||
SingleMessageWindow(self.plugin, self.account, self.contact,
|
||||
action = 'send', from_whom = self.from_whom, subject = self.subject,
|
||||
message = self.message)
|
||||
|
||||
def on_send_and_close_button_clicked(self, widget):
|
||||
self.send_single_message()
|
||||
self.window.destroy()
|
||||
|
||||
def on_single_message_window_key_press_event(self, widget, event):
|
||||
if event.keyval == gtk.keysyms.Escape: # ESCAPE
|
||||
self.window.destroy()
|
||||
|
||||
class XMLConsoleWindow:
|
||||
def __init__(self, plugin, account):
|
||||
self.plugin = plugin
|
||||
|
|
139
src/gtkgui.glade
139
src/gtkgui.glade
|
@ -15400,7 +15400,7 @@ the Jabber network.</property>
|
|||
<property name="window_position">GTK_WIN_POS_NONE</property>
|
||||
<property name="modal">False</property>
|
||||
<property name="default_width">400</property>
|
||||
<property name="default_height">250</property>
|
||||
<property name="default_height">280</property>
|
||||
<property name="resizable">True</property>
|
||||
<property name="destroy_with_parent">False</property>
|
||||
<property name="decorated">True</property>
|
||||
|
@ -15408,6 +15408,7 @@ the Jabber network.</property>
|
|||
<property name="skip_pager_hint">False</property>
|
||||
<property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
|
||||
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
|
||||
<signal name="key_press_event" handler="on_single_message_window_key_press_event" last_modification_time="Tue, 05 Jul 2005 22:02:15 GMT"/>
|
||||
|
||||
<child>
|
||||
<widget class="GtkVBox" id="vbox97">
|
||||
|
@ -15648,77 +15649,21 @@ the Jabber network.</property>
|
|||
<child>
|
||||
<widget class="GtkButton" id="send_button">
|
||||
<property name="visible">True</property>
|
||||
<property name="tooltip" translatable="yes">Send message</property>
|
||||
<property name="can_default">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">Sen_d</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
<signal name="clicked" handler="on_send_button_clicked" last_modification_time="Tue, 05 Jul 2005 18:37:42 GMT"/>
|
||||
|
||||
<child>
|
||||
<widget class="GtkAlignment" id="alignment81">
|
||||
<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="hbox2981">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">2</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkImage" id="image861">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-ok</property>
|
||||
<property name="icon_size">4</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>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label345">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">_Send</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>
|
||||
|
||||
<child>
|
||||
<widget class="GtkButton" id="reply_button">
|
||||
<property name="visible">True</property>
|
||||
<property name="tooltip" translatable="yes">Reply to this message</property>
|
||||
<property name="can_default">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
|
@ -15786,6 +15731,78 @@ the Jabber network.</property>
|
|||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkButton" id="send_and_close_button">
|
||||
<property name="visible">True</property>
|
||||
<property name="tooltip" translatable="yes">Send message and close window</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_send_and_close_button_clicked" last_modification_time="Tue, 05 Jul 2005 22:03:11 GMT"/>
|
||||
|
||||
<child>
|
||||
<widget class="GtkAlignment" id="alignment83">
|
||||
<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="hbox2983">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">2</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkImage" id="image878">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-ok</property>
|
||||
<property name="icon_size">4</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>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label347">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">_Send & Close</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">6</property>
|
||||
|
|
Loading…
Reference in New Issue