Properish mood dialog
This commit is contained in:
parent
4f68782ec7
commit
37de10d82f
|
@ -19,6 +19,7 @@
|
||||||
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
|
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
|
||||||
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
|
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
|
||||||
<property name="focus_on_map">True</property>
|
<property name="focus_on_map">True</property>
|
||||||
|
<property name="urgency_hint">False</property>
|
||||||
<property name="has_separator">True</property>
|
<property name="has_separator">True</property>
|
||||||
<signal name="key_press_event" handler="on_change_status_message_dialog_key_press_event" last_modification_time="Wed, 16 Mar 2005 00:53:06 GMT"/>
|
<signal name="key_press_event" handler="on_change_status_message_dialog_key_press_event" last_modification_time="Wed, 16 Mar 2005 00:53:06 GMT"/>
|
||||||
|
|
||||||
|
@ -95,123 +96,10 @@
|
||||||
<property name="spacing">6</property>
|
<property name="spacing">6</property>
|
||||||
|
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkScrolledWindow" id="scrolledwindow24">
|
<widget class="GtkComboBox" id="combobox">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="add_tearoffs">False</property>
|
||||||
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
|
<property name="focus_on_click">True</property>
|
||||||
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
|
|
||||||
<property name="shadow_type">GTK_SHADOW_IN</property>
|
|
||||||
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
|
|
||||||
|
|
||||||
<child>
|
|
||||||
<widget class="GtkTextView" id="message_textview">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can_focus">True</property>
|
|
||||||
<property name="has_focus">True</property>
|
|
||||||
<property name="editable">True</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">True</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="GtkHButtonBox" id="hbuttonbox33">
|
|
||||||
<property name="visible">False</property>
|
|
||||||
<property name="layout_style">GTK_BUTTONBOX_END</property>
|
|
||||||
<property name="spacing">0</property>
|
|
||||||
|
|
||||||
<child>
|
|
||||||
<widget class="GtkButton" id="save_as_preset_button">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="sensitive">False</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_save_as_preset_button_clicked" last_modification_time="Thu, 26 Jan 2006 17:31:47 GMT"/>
|
|
||||||
|
|
||||||
<child>
|
|
||||||
<widget class="GtkAlignment" id="alignment106">
|
|
||||||
<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="hbox3021">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="homogeneous">False</property>
|
|
||||||
<property name="spacing">2</property>
|
|
||||||
|
|
||||||
<child>
|
|
||||||
<widget class="GtkImage" id="image1369">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="stock">gtk-save-as</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="label380">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="label" translatable="yes">Save as Preset...</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>
|
|
||||||
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
|
|
||||||
<property name="width_chars">-1</property>
|
|
||||||
<property name="single_line_mode">False</property>
|
|
||||||
<property name="angle">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>
|
</widget>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="padding">0</property>
|
<property name="padding">0</property>
|
||||||
|
@ -221,83 +109,27 @@
|
||||||
</child>
|
</child>
|
||||||
|
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkHBox" id="hbox3022">
|
<widget class="GtkEntry" id="entry">
|
||||||
<property name="visible">False</property>
|
<property name="visible">True</property>
|
||||||
<property name="homogeneous">False</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="spacing">6</property>
|
<property name="editable">True</property>
|
||||||
|
<property name="visibility">True</property>
|
||||||
<child>
|
<property name="max_length">0</property>
|
||||||
<widget class="GtkLabel" id="label165">
|
<property name="text" translatable="yes"></property>
|
||||||
<property name="visible">True</property>
|
<property name="has_frame">True</property>
|
||||||
<property name="label" translatable="yes">Preset messages:</property>
|
<property name="invisible_char">●</property>
|
||||||
<property name="use_underline">False</property>
|
<property name="activates_default">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</property>
|
|
||||||
<property name="yalign">0.5</property>
|
|
||||||
<property name="xpad">0</property>
|
|
||||||
<property name="ypad">0</property>
|
|
||||||
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
|
|
||||||
<property name="width_chars">-1</property>
|
|
||||||
<property name="single_line_mode">False</property>
|
|
||||||
<property name="angle">0</property>
|
|
||||||
</widget>
|
|
||||||
<packing>
|
|
||||||
<property name="padding">0</property>
|
|
||||||
<property name="expand">False</property>
|
|
||||||
<property name="fill">False</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
|
|
||||||
<child>
|
|
||||||
<widget class="GtkComboBox" id="message_combobox">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="add_tearoffs">False</property>
|
|
||||||
<property name="focus_on_click">True</property>
|
|
||||||
<signal name="changed" handler="on_message_combobox_changed" last_modification_time="Tue, 07 Mar 2006 13:25:23 GMT"/>
|
|
||||||
</widget>
|
|
||||||
<packing>
|
|
||||||
<property name="padding">0</property>
|
|
||||||
<property name="expand">True</property>
|
|
||||||
<property name="fill">True</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
</widget>
|
</widget>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="padding">0</property>
|
<property name="padding">0</property>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
<property name="fill">True</property>
|
<property name="fill">False</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
</widget>
|
</widget>
|
||||||
</child>
|
</child>
|
||||||
</widget>
|
</widget>
|
||||||
</child>
|
</child>
|
||||||
|
|
||||||
<child>
|
|
||||||
<widget class="GtkLabel" id="label383">
|
|
||||||
<property name="visible">False</property>
|
|
||||||
<property name="label" translatable="yes"><b>Type your new status message</b></property>
|
|
||||||
<property name="use_underline">False</property>
|
|
||||||
<property name="use_markup">True</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>
|
|
||||||
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
|
|
||||||
<property name="width_chars">-1</property>
|
|
||||||
<property name="single_line_mode">False</property>
|
|
||||||
<property name="angle">0</property>
|
|
||||||
</widget>
|
|
||||||
<packing>
|
|
||||||
<property name="type">label_item</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
</widget>
|
</widget>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="padding">0</property>
|
<property name="padding">0</property>
|
||||||
|
|
|
@ -309,15 +309,27 @@ class ChooseGPGKeyDialog:
|
||||||
|
|
||||||
class ChangeMoodDialog:
|
class ChangeMoodDialog:
|
||||||
def __init__(self):
|
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', ]
|
||||||
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)
|
||||||
self.window.set_title('Mood')
|
self.window.set_title('Mood')
|
||||||
|
|
||||||
message_textview = self.xml.get_widget('message_textview')
|
self.entry = self.xml.get_widget('entry')
|
||||||
self.message_buffer = message_textview.get_buffer()
|
|
||||||
#self.message_buffer.connect('changed',
|
self.combo = self.xml.get_widget('combobox')
|
||||||
# self.toggle_sensitiviy_of_save_as_preset)
|
self.liststore = gtk.ListStore(str)
|
||||||
|
self.combo.set_model(self.liststore)
|
||||||
|
|
||||||
|
for mood in self.moods:
|
||||||
|
self.liststore.append((mood,))
|
||||||
|
|
||||||
|
cellrenderertext = gtk.CellRendererText()
|
||||||
|
self.combo.pack_start(cellrenderertext, True)
|
||||||
|
self.combo.add_attribute(cellrenderertext, 'text', 0)
|
||||||
|
|
||||||
|
message_entry = self.xml.get_widget('entry')
|
||||||
|
# self.message_buffer = message_entry.get_buffer()
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
'''Wait for OK or Cancel button to be pressed and return mood
|
'''Wait for OK or Cancel button to be pressed and return mood
|
||||||
|
@ -326,10 +338,8 @@ class ChangeMoodDialog:
|
||||||
mood = None
|
mood = None
|
||||||
message = None
|
message = None
|
||||||
if rep == gtk.RESPONSE_OK:
|
if rep == gtk.RESPONSE_OK:
|
||||||
beg, end = self.message_buffer.get_bounds()
|
mood = self.liststore[self.combo.get_active()][0].decode('utf-8')
|
||||||
message = self.message_buffer.get_text(beg, end).decode('utf-8')\
|
message = self.entry.get_text().decode('utf-8')
|
||||||
.strip()
|
|
||||||
msg = helpers.to_one_line(message)
|
|
||||||
self.window.destroy()
|
self.window.destroy()
|
||||||
return (mood, message)
|
return (mood, message)
|
||||||
|
|
||||||
|
|
|
@ -2273,7 +2273,6 @@ class RosterWindow:
|
||||||
dlg = dialogs.ChangeMoodDialog()
|
dlg = dialogs.ChangeMoodDialog()
|
||||||
(mood, message) = dlg.run()
|
(mood, message) = dlg.run()
|
||||||
mood = 'happy'
|
mood = 'happy'
|
||||||
print account, mood, message
|
|
||||||
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)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue