[rOOt & Asterix] use get_uf_activity/mood to translate them. store subactivities according to selected activity. fixes #3809
This commit is contained in:
parent
855a72855d
commit
05218db68a
|
@ -21,48 +21,14 @@
|
|||
<property name="column_spacing">6</property>
|
||||
<property name="row_spacing">6</property>
|
||||
<child>
|
||||
<widget class="GtkComboBox" id="activity_combobox">
|
||||
<property name="visible">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkComboBox" id="subactivity_combobox">
|
||||
<property name="visible">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="bottom_attach">2</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkEntry" id="description_entry">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="invisible_char">●</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="top_attach">2</property>
|
||||
<property name="bottom_attach">3</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label2">
|
||||
<widget class="GtkLabel" id="label4">
|
||||
<property name="visible">True</property>
|
||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
<property name="label" translatable="yes">General:</property>
|
||||
<property name="label" translatable="yes">Message:</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="top_attach">2</property>
|
||||
<property name="bottom_attach">3</property>
|
||||
<property name="x_options">GTK_FILL</property>
|
||||
<property name="y_options">GTK_FILL</property>
|
||||
</packing>
|
||||
|
@ -81,18 +47,52 @@
|
|||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label4">
|
||||
<widget class="GtkLabel" id="label2">
|
||||
<property name="visible">True</property>
|
||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||
<property name="label" translatable="yes">Message:</property>
|
||||
<property name="label" translatable="yes">General:</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="top_attach">2</property>
|
||||
<property name="bottom_attach">3</property>
|
||||
<property name="x_options">GTK_FILL</property>
|
||||
<property name="y_options">GTK_FILL</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkEntry" id="description_entry">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="top_attach">2</property>
|
||||
<property name="bottom_attach">3</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkComboBox" id="subactivity_combobox">
|
||||
<property name="visible">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="bottom_attach">2</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkComboBox" id="activity_combobox">
|
||||
<property name="visible">True</property>
|
||||
<signal name="changed" handler="on_activity_combobox_changed"/>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="position">2</property>
|
||||
|
|
|
@ -371,31 +371,27 @@ class ChooseGPGKeyDialog:
|
|||
|
||||
|
||||
class ChangeActivityDialog:
|
||||
activities = ['doing_chores', 'drinking', 'eating',
|
||||
'excercising', 'grooming', 'having_appointment',
|
||||
'inactive', 'relaxing', 'talking', 'traveling',
|
||||
'working', ]
|
||||
subactivities = ['at_the_spa', 'brushing_teeth',
|
||||
'buying_groceries', 'cleaning', 'coding',
|
||||
'commuting', 'cooking', 'cycling', 'day_off',
|
||||
'doing_maintenance', 'doing_the_dishes',
|
||||
'doing_the_laundry', 'driving', 'gaming',
|
||||
'gardening', 'getting_a_haircut', 'going_out',
|
||||
'hanging_out', 'having_a_beer', 'having_a_snack',
|
||||
'having_breakfast', 'having_coffee',
|
||||
'having_dinner', 'having_lunch', 'having_tea',
|
||||
'hiking', 'in_a_car', 'in_a_meeting',
|
||||
'in_real_life', 'jogging', 'on_a_bus',
|
||||
'on_a_plane', 'on_a_train', 'on_a_trip',
|
||||
'on_the_phone', 'on_vacation', 'other',
|
||||
'partying', 'playing_sports', 'reading',
|
||||
'rehearsing', 'running', 'running_an_errand',
|
||||
'scheduled_holiday', 'shaving', 'shopping',
|
||||
'skiing', 'sleeping', 'socializing',
|
||||
'studying', 'sunbathing', 'swimming',
|
||||
'taking_a_bath', 'taking_a_shower', 'walking',
|
||||
'walking_the_dog', 'watching_tv',
|
||||
'watching_a_movie', 'working_out', 'writing', ]
|
||||
activities = \
|
||||
{'doing_chores': ['buying_groceries', 'cleaning', 'cooking',
|
||||
'doing_maintenance', 'doing_the_dishes' 'doing_the_laundry',
|
||||
'gardening', 'running_an_errand', 'walking_the_dog'],
|
||||
'drinking': ['having_a_beer', 'having_coffee', 'having_tea'],
|
||||
'eating': ['having_a_snack', 'having_breakfast', 'having_dinner',
|
||||
'having_lunch'],
|
||||
'excercising': ['cycling', 'hiking', 'jogging', 'playing_sports',
|
||||
'running', 'skiing', 'swimming', 'working_out'],
|
||||
'grooming': ['at_the_spa', 'brushing_teeth', 'getting_a_haircut',
|
||||
'shaving','taking_a_bath', 'taking_a_shower'],
|
||||
'having_appointment': [],
|
||||
'inactive': ['day_off', 'hanging_out', 'on_vacation', 'scheduled_holiday',
|
||||
'sleeping'],
|
||||
'relaxing': ['gaming', 'going_out', 'partying', 'reading', 'rehearsing',
|
||||
'shopping', 'socializing', 'sunbathing', 'watching_tv',
|
||||
'watching_a_movie'],
|
||||
'talking': ['in_real_life', 'on_the_phone', 'on_video_phone'],
|
||||
'traveling': ['commuting', 'cycling', 'driving', 'in_a_car', 'on_a_bus',
|
||||
'on_a_plane', 'on_a_train', 'on_a_trip', 'walking'],
|
||||
'working': ['coding', 'in_a_meeting', 'studying', 'writing']}
|
||||
def __init__(self, account):
|
||||
self.account = account
|
||||
self.xml = gtkgui_helpers.get_glade('change_activity_dialog.glade')
|
||||
|
@ -405,23 +401,20 @@ class ChangeActivityDialog:
|
|||
self.entry = self.xml.get_widget('description_entry')
|
||||
|
||||
self.activity_combo = self.xml.get_widget('activity_combobox')
|
||||
self.liststore1 = gtk.ListStore(str)
|
||||
self.liststore1 = gtk.ListStore(str, str) # translated, english
|
||||
self.activity_combo.set_model(self.liststore1)
|
||||
|
||||
for activity in self.activities:
|
||||
self.liststore1.append((activity,))
|
||||
self.liststore1.append((helpers.get_uf_activity(activity), activity))
|
||||
|
||||
cellrenderertext = gtk.CellRendererText()
|
||||
self.activity_combo.pack_start(cellrenderertext, True)
|
||||
self.activity_combo.add_attribute(cellrenderertext, 'text', 0)
|
||||
|
||||
self.subactivity_combo = self.xml.get_widget('subactivity_combobox')
|
||||
self.liststore2 = gtk.ListStore(str)
|
||||
self.liststore2 = gtk.ListStore(str, str) # translated, english
|
||||
self.subactivity_combo.set_model(self.liststore2)
|
||||
|
||||
for subactivity in self.subactivities:
|
||||
self.liststore2.append((subactivity,))
|
||||
|
||||
cellrenderertext = gtk.CellRendererText()
|
||||
self.subactivity_combo.pack_start(cellrenderertext, True)
|
||||
self.subactivity_combo.add_attribute(cellrenderertext, 'text', 0)
|
||||
|
@ -429,6 +422,15 @@ class ChangeActivityDialog:
|
|||
self.xml.signal_autoconnect(self)
|
||||
self.window.show_all()
|
||||
|
||||
def on_activity_combobox_changed(self, widget):
|
||||
self.liststore2.clear()
|
||||
selected_activity = self.activity_combo.get_active()
|
||||
if selected_activity > -1:
|
||||
selected_activity = self.liststore1[selected_activity][1]
|
||||
for subactivity in self.activities[selected_activity]:
|
||||
self.liststore2.append((helpers.get_uf_activity(subactivity),
|
||||
subactivity))
|
||||
|
||||
def on_ok_button_clicked(self, widget):
|
||||
'''Return activity and messsage (None if no activity selected)'''
|
||||
activity = None
|
||||
|
@ -437,9 +439,9 @@ class ChangeActivityDialog:
|
|||
active1 = self.activity_combo.get_active()
|
||||
active2 = self.subactivity_combo.get_active()
|
||||
if active1 > -1:
|
||||
activity = self.liststore1[active1][0].decode('utf-8')
|
||||
activity = self.liststore1[active1][1].decode('utf-8')
|
||||
if active2 > -1:
|
||||
subactivity = self.liststore2[active2][0].decode('utf-8')
|
||||
subactivity = self.liststore2[active2][1].decode('utf-8')
|
||||
message = self.entry.get_text().decode('utf-8')
|
||||
from common import pep
|
||||
pep.user_send_activity(self.account, activity,
|
||||
|
@ -473,11 +475,11 @@ class ChangeMoodDialog:
|
|||
self.entry = self.xml.get_widget('description_entry')
|
||||
|
||||
self.combo = self.xml.get_widget('type_combobox')
|
||||
self.liststore = gtk.ListStore(str)
|
||||
self.liststore = gtk.ListStore(str, str) # translated, english
|
||||
self.combo.set_model(self.liststore)
|
||||
|
||||
for mood in self.moods:
|
||||
self.liststore.append((mood,))
|
||||
self.liststore.append((helpers.get_uf_mood(mood), mood))
|
||||
|
||||
cellrenderertext = gtk.CellRendererText()
|
||||
self.combo.pack_start(cellrenderertext, True)
|
||||
|
@ -491,7 +493,7 @@ class ChangeMoodDialog:
|
|||
message = None
|
||||
active = self.combo.get_active()
|
||||
if active > -1:
|
||||
mood = self.liststore[active][0].decode('utf-8')
|
||||
mood = self.liststore[active][1].decode('utf-8')
|
||||
message = self.entry.get_text().decode('utf-8')
|
||||
from common import pep
|
||||
pep.user_send_mood(self.account, mood, message)
|
||||
|
|
|
@ -501,6 +501,8 @@ class RosterTooltip(NotificationAreaTooltip):
|
|||
|
||||
if contact.mood.has_key('mood'):
|
||||
mood = contact.mood['mood'].strip()
|
||||
# translate it
|
||||
mood = helpers.get_uf_mood(mood)
|
||||
mood = gobject.markup_escape_text(mood)
|
||||
mood_string = _('Mood:') + ' <b>%s</b>' % mood
|
||||
if contact.mood.has_key('text') and contact.mood['text'] != '':
|
||||
|
@ -511,10 +513,14 @@ class RosterTooltip(NotificationAreaTooltip):
|
|||
|
||||
if contact.activity.has_key('activity'):
|
||||
activity = contact.activity['activity'].strip()
|
||||
# translate it
|
||||
activity = helpers.get_uf_activity(activity)
|
||||
activity = gobject.markup_escape_text(activity)
|
||||
activity_string = _('Activity:') + ' <b>%s' % activity
|
||||
if contact.activity.has_key('subactivity'):
|
||||
activity_sub = contact.activity['subactivity'].strip()
|
||||
# translate it
|
||||
activity_sub = helpers.get_uf_activity(activity_sub)
|
||||
activity_sub = gobject.markup_escape_text(activity_sub)
|
||||
activity_string += ' (%s)</b>' % activity_sub
|
||||
else:
|
||||
|
|
Loading…
Reference in New Issue