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="relief">GTK_RELIEF_NORMAL</property>
|
||||||
<property name="focus_on_click">True</property>
|
<property name="focus_on_click">True</property>
|
||||||
<property name="response_id">-6</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>
|
</widget>
|
||||||
</child>
|
</child>
|
||||||
|
|
||||||
|
@ -58,6 +59,7 @@
|
||||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||||
<property name="focus_on_click">True</property>
|
<property name="focus_on_click">True</property>
|
||||||
<property name="response_id">-5</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>
|
</widget>
|
||||||
</child>
|
</child>
|
||||||
</widget>
|
</widget>
|
||||||
|
|
|
@ -308,8 +308,9 @@ class ChooseGPGKeyDialog:
|
||||||
|
|
||||||
|
|
||||||
class ChangeMoodDialog:
|
class ChangeMoodDialog:
|
||||||
def __init__(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', ]
|
||||||
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', ]
|
def __init__(self, account):
|
||||||
|
self.account = account
|
||||||
self.xml = gtkgui_helpers.get_glade('change_mood_dialog.glade')
|
self.xml = gtkgui_helpers.get_glade('change_mood_dialog.glade')
|
||||||
self.window = self.xml.get_widget('change_mood_dialog')
|
self.window = self.xml.get_widget('change_mood_dialog')
|
||||||
self.window.set_transient_for(gajim.interface.roster.window)
|
self.window.set_transient_for(gajim.interface.roster.window)
|
||||||
|
@ -327,22 +328,23 @@ class ChangeMoodDialog:
|
||||||
cellrenderertext = gtk.CellRendererText()
|
cellrenderertext = gtk.CellRendererText()
|
||||||
self.combo.pack_start(cellrenderertext, True)
|
self.combo.pack_start(cellrenderertext, True)
|
||||||
self.combo.add_attribute(cellrenderertext, 'text', 0)
|
self.combo.add_attribute(cellrenderertext, 'text', 0)
|
||||||
|
self.xml.signal_autoconnect(self)
|
||||||
|
self.window.show_all()
|
||||||
|
|
||||||
message_entry = self.xml.get_widget('entry')
|
def on_ok_button_clicked(self, widget):
|
||||||
# self.message_buffer = message_entry.get_buffer()
|
'''Return mood and messsage (None if no mood selected)'''
|
||||||
|
|
||||||
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()
|
|
||||||
mood = None
|
mood = None
|
||||||
message = None
|
message = None
|
||||||
if rep == gtk.RESPONSE_OK:
|
active = self.combo.get_active()
|
||||||
mood = self.liststore[self.combo.get_active()][0].decode('utf-8')
|
if active > -1:
|
||||||
|
mood = self.liststore[active][0].decode('utf-8')
|
||||||
message = self.entry.get_text().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()
|
self.window.destroy()
|
||||||
return (mood, message)
|
|
||||||
|
|
||||||
|
def on_cancel_button_clicked(self, widget):
|
||||||
|
self.window.destroy()
|
||||||
|
|
||||||
class ChangeStatusMessageDialog:
|
class ChangeStatusMessageDialog:
|
||||||
def __init__(self, show = None):
|
def __init__(self, show = None):
|
||||||
|
|
|
@ -39,7 +39,6 @@ from common import helpers
|
||||||
from common import passwords
|
from common import passwords
|
||||||
from common.exceptions import GajimGeneralException
|
from common.exceptions import GajimGeneralException
|
||||||
from common import i18n
|
from common import i18n
|
||||||
from common import pep
|
|
||||||
|
|
||||||
from message_window import MessageWindowMgr
|
from message_window import MessageWindowMgr
|
||||||
from chat_control import ChatControl
|
from chat_control import ChatControl
|
||||||
|
@ -2270,10 +2269,10 @@ class RosterWindow:
|
||||||
helpers.launch_browser_mailer('url', url)
|
helpers.launch_browser_mailer('url', url)
|
||||||
|
|
||||||
def on_change_mood_activate(self, widget, account):
|
def on_change_mood_activate(self, widget, account):
|
||||||
dlg = dialogs.ChangeMoodDialog()
|
dlg = dialogs.ChangeMoodDialog(account)
|
||||||
(mood, message) = dlg.run()
|
# (mood, message) = dlg.run()
|
||||||
if mood is not None: # None is if user pressed Cancel
|
# if mood is not None: # None is if user pressed Cancel
|
||||||
self.send_mood(account, mood, message)
|
# self.send_mood(account, mood, message)
|
||||||
|
|
||||||
def on_change_status_message_activate(self, widget, account):
|
def on_change_status_message_activate(self, widget, account):
|
||||||
show = gajim.SHOW_LIST[gajim.connections[account].connected]
|
show = gajim.SHOW_LIST[gajim.connections[account].connected]
|
||||||
|
@ -2740,9 +2739,6 @@ class RosterWindow:
|
||||||
if gajim.interface.systray_enabled:
|
if gajim.interface.systray_enabled:
|
||||||
gajim.interface.systray.change_status('connecting')
|
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):
|
def send_status(self, account, status, txt, auto = False):
|
||||||
model = self.tree.get_model()
|
model = self.tree.get_model()
|
||||||
accountIter = self.get_account_iter(account)
|
accountIter = self.get_account_iter(account)
|
||||||
|
|
Loading…
Reference in New Issue