make mood dialog not use blocking run() function
This commit is contained in:
parent
6ab511eee2
commit
a26d9c028a
|
@ -44,6 +44,7 @@
|
|||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
<property name="response_id">-6</property>
|
||||
<signal name="clicked" handler="on_cancel_button_clicked" last_modification_time="Sat, 31 Mar 2007 07:58:52 GMT"/>
|
||||
</widget>
|
||||
</child>
|
||||
|
||||
|
@ -58,6 +59,7 @@
|
|||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
<property name="response_id">-5</property>
|
||||
<signal name="clicked" handler="on_ok_button_clicked" last_modification_time="Sat, 31 Mar 2007 07:57:55 GMT"/>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
|
|
|
@ -308,8 +308,9 @@ class ChooseGPGKeyDialog:
|
|||
|
||||
|
||||
class ChangeMoodDialog:
|
||||
def __init__(self):
|
||||
self.moods = ['afraid', 'amazed', 'angry', 'annoyed', 'anxious', 'aroused', 'ashamed', 'bored', 'brave', 'calm', 'cold', 'confused', 'contented', 'cranky', 'curious', 'depressed', 'disappointed', 'disgusted', 'distracted', 'embarrassed', 'excited', 'flirtatious', 'frustrated', 'grumpy', 'guilty', 'happy', 'hot', 'humbled', 'humiliated', 'hungry', 'hurt', 'impressed', 'in_awe', 'in_love', 'indignant', 'interested', 'intoxicated', 'invincible', 'jealous', 'lonely', 'mean', 'moody', 'nervous', 'neutral', 'offended', 'playful', 'proud', 'relieved', 'remorseful', 'restless', 'sad', 'sarcastic', 'serious', 'shocked', 'shy', 'sick', 'sleepy', 'stressed', 'surprised', 'thirsty', 'worried', ]
|
||||
moods = ['afraid', 'amazed', 'angry', 'annoyed', 'anxious', 'aroused', 'ashamed', 'bored', 'brave', 'calm', 'cold', 'confused', 'contented', 'cranky', 'curious', 'depressed', 'disappointed', 'disgusted', 'distracted', 'embarrassed', 'excited', 'flirtatious', 'frustrated', 'grumpy', 'guilty', 'happy', 'hot', 'humbled', 'humiliated', 'hungry', 'hurt', 'impressed', 'in_awe', 'in_love', 'indignant', 'interested', 'intoxicated', 'invincible', 'jealous', 'lonely', 'mean', 'moody', 'nervous', 'neutral', 'offended', 'playful', 'proud', 'relieved', 'remorseful', 'restless', 'sad', 'sarcastic', 'serious', 'shocked', 'shy', 'sick', 'sleepy', 'stressed', 'surprised', 'thirsty', 'worried', ]
|
||||
def __init__(self, account):
|
||||
self.account = account
|
||||
self.xml = gtkgui_helpers.get_glade('change_mood_dialog.glade')
|
||||
self.window = self.xml.get_widget('change_mood_dialog')
|
||||
self.window.set_transient_for(gajim.interface.roster.window)
|
||||
|
@ -327,22 +328,23 @@ class ChangeMoodDialog:
|
|||
cellrenderertext = gtk.CellRendererText()
|
||||
self.combo.pack_start(cellrenderertext, True)
|
||||
self.combo.add_attribute(cellrenderertext, 'text', 0)
|
||||
self.xml.signal_autoconnect(self)
|
||||
self.window.show_all()
|
||||
|
||||
message_entry = self.xml.get_widget('entry')
|
||||
# self.message_buffer = message_entry.get_buffer()
|
||||
|
||||
def run(self):
|
||||
'''Wait for OK or Cancel button to be pressed and return mood
|
||||
and messsage (None if users pressed Cancel or x button of WM'''
|
||||
rep = self.window.run()
|
||||
def on_ok_button_clicked(self, widget):
|
||||
'''Return mood and messsage (None if no mood selected)'''
|
||||
mood = None
|
||||
message = None
|
||||
if rep == gtk.RESPONSE_OK:
|
||||
mood = self.liststore[self.combo.get_active()][0].decode('utf-8')
|
||||
active = self.combo.get_active()
|
||||
if active > -1:
|
||||
mood = self.liststore[active][0].decode('utf-8')
|
||||
message = self.entry.get_text().decode('utf-8')
|
||||
from common import pep
|
||||
pep.user_send_mood(self.account, mood, message)
|
||||
self.window.destroy()
|
||||
return (mood, message)
|
||||
|
||||
def on_cancel_button_clicked(self, widget):
|
||||
self.window.destroy()
|
||||
|
||||
class ChangeStatusMessageDialog:
|
||||
def __init__(self, show = None):
|
||||
|
|
|
@ -39,7 +39,6 @@ from common import helpers
|
|||
from common import passwords
|
||||
from common.exceptions import GajimGeneralException
|
||||
from common import i18n
|
||||
from common import pep
|
||||
|
||||
from message_window import MessageWindowMgr
|
||||
from chat_control import ChatControl
|
||||
|
@ -2270,10 +2269,10 @@ class RosterWindow:
|
|||
helpers.launch_browser_mailer('url', url)
|
||||
|
||||
def on_change_mood_activate(self, widget, account):
|
||||
dlg = dialogs.ChangeMoodDialog()
|
||||
(mood, message) = dlg.run()
|
||||
if mood is not None: # None is if user pressed Cancel
|
||||
self.send_mood(account, mood, message)
|
||||
dlg = dialogs.ChangeMoodDialog(account)
|
||||
# (mood, message) = dlg.run()
|
||||
# if mood is not None: # None is if user pressed Cancel
|
||||
# self.send_mood(account, mood, message)
|
||||
|
||||
def on_change_status_message_activate(self, widget, account):
|
||||
show = gajim.SHOW_LIST[gajim.connections[account].connected]
|
||||
|
@ -2740,9 +2739,6 @@ class RosterWindow:
|
|||
if gajim.interface.systray_enabled:
|
||||
gajim.interface.systray.change_status('connecting')
|
||||
|
||||
def send_mood(self, account, mood, message):
|
||||
pep.user_send_mood(account, mood, message)
|
||||
|
||||
def send_status(self, account, status, txt, auto = False):
|
||||
model = self.tree.get_model()
|
||||
accountIter = self.get_account_iter(account)
|
||||
|
|
Loading…
Reference in New Issue