Changeset 9988
- Timestamp:
- 07/23/08 00:20:51 (4 months ago)
- Location:
- trunk
- Files:
-
- 2 modified
-
data/glade/change_mood_dialog.glade (modified) (4 diffs)
-
src/dialogs.py (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/data/glade/change_mood_dialog.glade
r9543 r9988 15 15 <widget class="GtkTable" id="table1"> 16 16 <property name="visible">True</property> 17 <property name="n_rows"> 2</property>17 <property name="n_rows">3</property> 18 18 <property name="n_columns">2</property> 19 19 <property name="column_spacing">6</property> 20 20 <property name="row_spacing">6</property> 21 21 <child> 22 <widget class="GtkEntry" id="description_entry"> 23 <property name="visible">True</property> 24 <property name="can_focus">True</property> 22 <widget class="GtkLabel" id="mood_label"> 23 <property name="visible">True</property> 24 <property name="xalign">0</property> 25 <property name="label" translatable="yes">None</property> 25 26 </widget> 26 27 <packing> … … 33 34 </child> 34 35 <child> 35 <widget class="GtkComboBox" id="type_combobox"> 36 <property name="visible">True</property> 36 <widget class="GtkTable" id="mood_icons_table"> 37 <property name="visible">True</property> 38 <property name="n_rows">6</property> 39 <property name="n_columns">11</property> 40 <child> 41 <placeholder/> 42 </child> 43 <child> 44 <placeholder/> 45 </child> 46 <child> 47 <placeholder/> 48 </child> 49 <child> 50 <placeholder/> 51 </child> 52 <child> 53 <placeholder/> 54 </child> 55 <child> 56 <placeholder/> 57 </child> 58 <child> 59 <placeholder/> 60 </child> 61 <child> 62 <placeholder/> 63 </child> 64 <child> 65 <placeholder/> 66 </child> 67 <child> 68 <placeholder/> 69 </child> 70 <child> 71 <placeholder/> 72 </child> 73 <child> 74 <placeholder/> 75 </child> 76 <child> 77 <placeholder/> 78 </child> 79 <child> 80 <placeholder/> 81 </child> 82 <child> 83 <placeholder/> 84 </child> 85 <child> 86 <placeholder/> 87 </child> 88 <child> 89 <placeholder/> 90 </child> 91 <child> 92 <placeholder/> 93 </child> 94 <child> 95 <placeholder/> 96 </child> 97 <child> 98 <placeholder/> 99 </child> 100 <child> 101 <placeholder/> 102 </child> 103 <child> 104 <placeholder/> 105 </child> 106 <child> 107 <placeholder/> 108 </child> 109 <child> 110 <placeholder/> 111 </child> 112 <child> 113 <placeholder/> 114 </child> 115 <child> 116 <placeholder/> 117 </child> 118 <child> 119 <placeholder/> 120 </child> 121 <child> 122 <placeholder/> 123 </child> 124 <child> 125 <placeholder/> 126 </child> 127 <child> 128 <placeholder/> 129 </child> 130 <child> 131 <placeholder/> 132 </child> 133 <child> 134 <placeholder/> 135 </child> 136 <child> 137 <placeholder/> 138 </child> 139 <child> 140 <placeholder/> 141 </child> 142 <child> 143 <placeholder/> 144 </child> 145 <child> 146 <placeholder/> 147 </child> 148 <child> 149 <placeholder/> 150 </child> 151 <child> 152 <placeholder/> 153 </child> 154 <child> 155 <placeholder/> 156 </child> 157 <child> 158 <placeholder/> 159 </child> 160 <child> 161 <placeholder/> 162 </child> 163 <child> 164 <placeholder/> 165 </child> 166 <child> 167 <placeholder/> 168 </child> 169 <child> 170 <placeholder/> 171 </child> 172 <child> 173 <placeholder/> 174 </child> 175 <child> 176 <placeholder/> 177 </child> 178 <child> 179 <placeholder/> 180 </child> 181 <child> 182 <placeholder/> 183 </child> 184 <child> 185 <placeholder/> 186 </child> 187 <child> 188 <placeholder/> 189 </child> 190 <child> 191 <placeholder/> 192 </child> 193 <child> 194 <placeholder/> 195 </child> 196 <child> 197 <placeholder/> 198 </child> 199 <child> 200 <placeholder/> 201 </child> 202 <child> 203 <placeholder/> 204 </child> 205 <child> 206 <placeholder/> 207 </child> 208 <child> 209 <placeholder/> 210 </child> 211 <child> 212 <placeholder/> 213 </child> 214 <child> 215 <placeholder/> 216 </child> 217 <child> 218 <placeholder/> 219 </child> 220 <child> 221 <placeholder/> 222 </child> 223 <child> 224 <placeholder/> 225 </child> 226 <child> 227 <placeholder/> 228 </child> 229 <child> 230 <placeholder/> 231 </child> 232 <child> 233 <placeholder/> 234 </child> 235 <child> 236 <widget class="GtkRadioButton" id="no_mood_button"> 237 <property name="visible">True</property> 238 <property name="can_focus">True</property> 239 <property name="tooltip_text">No mood</property> 240 <property name="relief">GTK_RELIEF_NONE</property> 241 <property name="response_id">0</property> 242 <child> 243 <widget class="GtkImage" id="image1"> 244 <property name="visible">True</property> 245 <property name="stock">gtk-cancel</property> 246 <property name="icon_size">1</property> 247 </widget> 248 </child> 249 </widget> 250 </child> 251 </widget> 252 <packing> 253 <property name="right_attach">2</property> 254 </packing> 255 </child> 256 <child> 257 <widget class="GtkEntry" id="description_entry"> 258 <property name="visible">True</property> 259 <property name="can_focus">True</property> 37 260 </widget> 38 261 <packing> 39 262 <property name="left_attach">1</property> 40 263 <property name="right_attach">2</property> 264 <property name="top_attach">2</property> 265 <property name="bottom_attach">3</property> 41 266 <property name="y_options"></property> 42 267 </packing> … … 45 270 <widget class="GtkLabel" id="label"> 46 271 <property name="visible">True</property> 47 <property name="label" translatable="yes">Type:</property> 48 </widget> 49 <packing> 272 <property name="label" translatable="yes"><b>Mood:</b></property> 273 <property name="use_markup">True</property> 274 </widget> 275 <packing> 276 <property name="top_attach">1</property> 277 <property name="bottom_attach">2</property> 50 278 <property name="x_options"></property> 51 279 <property name="y_options"></property> … … 55 283 <widget class="GtkLabel" id="label2"> 56 284 <property name="visible">True</property> 57 <property name="label" translatable="yes">Message:</property> 58 </widget> 59 <packing> 60 <property name="top_attach">1</property> 61 <property name="bottom_attach">2</property> 285 <property name="label" translatable="yes"><b>Message:</b></property> 286 <property name="use_markup">True</property> 287 </widget> 288 <packing> 289 <property name="top_attach">2</property> 290 <property name="bottom_attach">3</property> 62 291 <property name="x_options"></property> 63 292 <property name="y_options"></property> -
trunk/src/dialogs.py
r9986 r9988 38 38 39 39 from random import randrange 40 from common .pep import MOODS40 from common import pep 41 41 42 42 try: … … 432 432 if subactivity is None: 433 433 subactivity = '' 434 from common import pep435 434 if activity == 'None': 436 435 pep.user_retract_activity(self.account) … … 444 443 445 444 class ChangeMoodDialog: 446 moods = MOODS 445 COLS = 11 446 447 447 def __init__(self, account): 448 448 self.account = account 449 449 self.xml = gtkgui_helpers.get_glade('change_mood_dialog.glade') 450 self.mood = None 451 450 452 self.window = self.xml.get_widget('change_mood_dialog') 451 453 self.window.set_transient_for(gajim.interface.roster.window) 452 454 self.window.set_title(_('Set Mood')) 453 455 456 table = self.xml.get_widget('mood_icons_table') 457 self.label = self.xml.get_widget('mood_label') 454 458 self.entry = self.xml.get_widget('description_entry') 455 459 456 self.combo = self.xml.get_widget('type_combobox') 457 self.liststore = gtk.ListStore(str, str) # translated, english 458 self.combo.set_model(self.liststore) 459 460 for mood in self.moods: 461 self.liststore.append((helpers.get_uf_mood(mood), mood)) 460 no_mood_button = self.xml.get_widget('no_mood_button') 461 no_mood_button.set_mode(False) 462 no_mood_button.connect('clicked', 463 self.on_mood_button_clicked, None) 464 465 x = 1 466 y = 0 467 self.mood_buttons = {} 468 for mood in pep.MOODS: 469 self.mood_buttons[mood] = gtk.RadioButton( 470 no_mood_button) 471 self.mood_buttons[mood].set_mode(False) 472 self.mood_buttons[mood].add( 473 gtkgui_helpers.load_mood_icon(mood)) 474 self.mood_buttons[mood].set_relief(gtk.RELIEF_NONE) 475 self.mood_buttons[mood].set_tooltip_text(_(mood)) 476 self.mood_buttons[mood].connect('clicked', 477 self.on_mood_button_clicked, mood) 478 table.attach(self.mood_buttons[mood], 479 x, x + 1, y, y + 1) 480 481 # Calculate the next position 482 x += 1 483 if x >= self.COLS: 484 x = 0 485 y += 1 462 486 463 487 con = gajim.connections[account] 464 if 'mood' in con.mood and con.mood['mood'] in self.moods: 465 self.combo.set_active(self.moods.index(con.mood['mood'])) 466 else: 467 self.combo.set_active(0) 488 if 'mood' in con.mood: 489 self.mood = con.mood['mood'] 490 self.label.set_text(con.mood['mood']) 491 if con.mood['mood'] in pep.MOODS: 492 self.mood_buttons[con.mood['mood']]. \ 493 set_active(True) 494 495 self.entry.set_sensitive(True if self.mood else False) 468 496 469 497 if 'text' in con.mood: 470 498 self.entry.set_text(con.mood['text']) 471 499 472 cellrenderertext = gtk.CellRendererText()473 self.combo.pack_start(cellrenderertext, True)474 self.combo.add_attribute(cellrenderertext, 'text', 0)475 500 self.xml.signal_autoconnect(self) 476 501 self.window.show_all() 477 502 503 def on_mood_button_clicked(self, widget, data): 504 self.label.set_text(_(data)) 505 506 if data: 507 self.entry.set_sensitive(True) 508 else: 509 self.entry.set_text('') 510 self.entry.set_sensitive(False) 511 self.mood = data 512 478 513 def on_ok_button_clicked(self, widget): 479 514 '''Return mood and messsage (None if no mood selected)''' 480 mood = None 481 message = None 482 active = self.combo.get_active() 483 if active > -1: 484 mood = self.liststore[active][1].decode('utf-8') 485 message = self.entry.get_text().decode('utf-8') 486 from common import pep 487 if mood == 'None': 488 pep.user_retract_mood(self.account) 489 else: 490 pep.user_send_mood(self.account, mood, message) 491 self.window.destroy() 515 message = self.entry.get_text().decode('utf-8') 516 if self.mood is None: 517 pep.user_retract_mood(self.account) 518 else: 519 pep.user_send_mood(self.account, self.mood, message) 520 self.window.destroy() 492 521 493 522 def on_cancel_button_clicked(self, widget):
