[orca] Fix for bgo#621535 - User should be able to select date and time format from gui.
- From: Mesar Hameed <mhameed src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca] Fix for bgo#621535 - User should be able to select date and time format from gui.
- Date: Sat, 3 Jul 2010 13:08:13 +0000 (UTC)
commit a1267c4e3f227f9364c44cf83a50c2001cbb76ed
Author: Deepak Ramchandani <dipito31 hotmail com>
Date: Tue Jun 29 01:26:25 2010 +0100
Fix for bgo#621535 - User should be able to select date and time format from gui.
src/orca/orca-setup.ui | 98 ++++++++++++++++++++++++++++++++++++++++++++
src/orca/orca_gui_prefs.py | 92 +++++++++++++++++++++++++++++++++++++++++
2 files changed, 190 insertions(+), 0 deletions(-)
---
diff --git a/src/orca/orca-setup.ui b/src/orca/orca-setup.ui
index 942babb..46ea8a6 100644
--- a/src/orca/orca-setup.ui
+++ b/src/orca/orca-setup.ui
@@ -226,6 +226,18 @@
</row>
</data>
</object>
+ <object class="GtkListStore" id="liststore2">
+ <columns>
+ <!-- column-name gchararray1 -->
+ <column type="gchararray"/>
+ </columns>
+ </object>
+ <object class="GtkListStore" id="liststore1">
+ <columns>
+ <!-- column-name gchararray1 -->
+ <column type="gchararray"/>
+ </columns>
+ </object>
<object class="GtkDialog" id="orcaSetupWindow">
<property name="title" translatable="yes">Orca Preferences</property>
<property name="type_hint">normal</property>
@@ -416,6 +428,92 @@
<property name="position">6</property>
</packing>
</child>
+ <child>
+ <object class="GtkTable" id="table1">
+ <property name="visible">True</property>
+ <property name="n_rows">2</property>
+ <property name="n_columns">2</property>
+ <property name="column_spacing">9</property>
+ <child>
+ <object class="GtkComboBox" id="dateFormatCombo">
+ <property name="visible">True</property>
+ <property name="model">liststore2</property>
+ <signal name="changed" handler="dateFormatChanged"/>
+ <child>
+ <object class="GtkCellRendererText" id="cellrenderertext1"/>
+ <attributes>
+ <attribute name="text">0</attribute>
+ </attributes>
+ </child>
+ </object>
+ <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="x_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="dateFormatLabel">
+ <property name="visible">True</property>
+ <property name="xalign">0.0099999997764825821</property>
+ <property name="label" translatable="yes" comments="Translators: Orca can present the current date to the user, here they can choose how the date should be presented to them.">Dat_e format:</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">dateFormatCombo</property>
+ <accessibility>
+ <relation type="label-for" target="dateFormatCombo"/>
+ </accessibility>
+ </object>
+ <packing>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options"></property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkComboBox" id="timeFormatCombo">
+ <property name="visible">True</property>
+ <property name="model">liststore1</property>
+ <signal name="changed" handler="timeFormatChanged"/>
+ <child>
+ <object class="GtkCellRendererText" id="cellrenderertext2"/>
+ <attributes>
+ <attribute name="text">0</attribute>
+ </attributes>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="x_options"></property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="timeFormatLabel">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes" comments="Translators: Orca can present the current time to the user, here they can choose how the time should be presented to them.">_Time format:</property>
+ <property name="use_underline">True</property>
+ <property name="justify">right</property>
+ <property name="mnemonic_widget">timeFormatCombo</property>
+ <accessibility>
+ <relation type="label-for" target="timeFormatCombo"/>
+ </accessibility>
+ </object>
+ <packing>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">7</property>
+ </packing>
+ </child>
</object>
</child>
<child type="tab">
diff --git a/src/orca/orca_gui_prefs.py b/src/orca/orca_gui_prefs.py
index 531549a..4c62aef 100644
--- a/src/orca/orca_gui_prefs.py
+++ b/src/orca/orca_gui_prefs.py
@@ -32,6 +32,7 @@ import gtk
import gobject
import pango # for ellipsize property constants of CellRendererText
import locale
+import time
import acss
try:
@@ -76,6 +77,17 @@ from orca_i18n import C_ # to provide qualified translatable strings
#
(DEFAULT, UPPERCASE, HYPERLINK) = range(3)
+# Must match the order that the timeFormatCombo is populated.
+#
+(TIME_FORMAT_LOCALE, TIME_FORMAT_24_HMS,
+ TIME_FORMAT_24_HMS_WITH_WORDS, TIME_FORMAT_24_HM,
+ TIME_FORMAT_24_HM_WITH_WORDS) = range(5)
+
+# Must match the order that the dateFormatCombo is populated.
+#
+(DATE_FORMAT_LOCALE, DATE_FORMAT_WITH_LONG_NAMES,
+ DATE_FORMAT_WITH_SHORT_NAMES) = range(3)
+
class OrcaSetupGUI(orca_gtkbuilder.GtkBuilderWrapper):
# Translators: this is an algorithm for tracking an object
@@ -1559,6 +1571,46 @@ class OrcaSetupGUI(orca_gtkbuilder.GtkBuilderWrapper):
self.populateComboBox(combobox, [_("Line"), _("Sentence")])
combobox.set_active(prefs["sayAllStyle"])
+ combobox2 = self.get_widget("dateFormatCombo")
+ sdtime = time.strftime
+ ltime = time.localtime
+ self.populateComboBox(combobox2,
+ [sdtime(settings.DATE_FORMAT_LOCALE, ltime()),
+ sdtime(settings.DATE_FORMAT_WITH_LONG_NAMES, ltime()),
+ sdtime(settings.DATE_FORMAT_WITH_SHORT_NAMES, ltime())
+ ])
+
+ indexdate = DATE_FORMAT_LOCALE
+ dateFormat = self.prefsDict["presentDateFormat"]
+ if dateFormat == settings.DATE_FORMAT_LOCALE:
+ indexdate = DATE_FORMAT_LOCALE
+ elif dateFormat == settings.DATE_FORMAT_WITH_LONG_NAMES:
+ indexdate = DATE_FORMAT_WITH_LONG_NAMES
+ elif dateFormat == settings.DATE_FORMAT_WITH_SHORT_NAMES:
+ indexdate = DATE_FORMAT_WITH_SHORT_NAMES
+ combobox2.set_active (indexdate)
+
+ combobox3 = self.get_widget("timeFormatCombo")
+ self.populateComboBox(combobox3,
+ [sdtime(settings.TIME_FORMAT_LOCALE, ltime()),
+ sdtime(settings.TIME_FORMAT_24_HMS, ltime()),
+ sdtime(settings.TIME_FORMAT_24_HMS_WITH_WORDS, ltime()),
+ sdtime(settings.TIME_FORMAT_24_HM, ltime()),
+ sdtime(settings.TIME_FORMAT_24_HM_WITH_WORDS, ltime())])
+ indextime = TIME_FORMAT_LOCALE
+ timeFormat = self.prefsDict["presentTimeFormat"]
+ if timeFormat == settings.TIME_FORMAT_LOCALE:
+ indextime = TIME_FORMAT_LOCALE
+ elif timeFormat == settings.TIME_FORMAT_24_HMS:
+ indextime = TIME_FORMAT_24_HMS
+ elif timeFormat == settings.TIME_FORMAT_24_HMS_WITH_WORDS:
+ indextime = TIME_FORMAT_24_HMS_WITH_WORDS
+ elif timeFormat == settings.TIME_FORMAT_24_HM:
+ indextime = TIME_FORMAT_24_HM
+ elif timeFormat == settings.TIME_FORMAT_24_HM_WITH_WORDS:
+ indextime = TIME_FORMAT_24_HM_WITH_WORDS
+ combobox3.set_active (indextime)
+
# Set the sensitivity of the "Update Interval" items, depending
# upon whether the "Speak progress bar updates" checkbox is checked.
#
@@ -2854,6 +2906,46 @@ class OrcaSetupGUI(orca_gtkbuilder.GtkBuilderWrapper):
elif sayAllStyle == _("Sentence"):
self.prefsDict["sayAllStyle"] = settings.SAYALL_STYLE_SENTENCE
+ def dateFormatChanged(self, widget):
+ """Signal handler for the "changed" signal for the dateFormat
+ GtkComboBox widget. Set the 'dateFormat' preference to the
+ new value.
+
+ Arguments:
+ - widget: the component that generated the signal.
+ """
+
+ dateFormatCombo = widget.get_active()
+ if dateFormatCombo == DATE_FORMAT_LOCALE:
+ newFormat = settings.DATE_FORMAT_LOCALE
+ elif dateFormatCombo == DATE_FORMAT_WITH_LONG_NAMES:
+ newFormat = settings.DATE_FORMAT_WITH_LONG_NAMES
+ elif dateFormatCombo == DATE_FORMAT_WITH_SHORT_NAMES:
+ newFormat = settings.DATE_FORMAT_WITH_SHORT_NAMES
+ self.prefsDict["presentDateFormat"] = newFormat
+
+ def timeFormatChanged(self, widget):
+ """Signal handler for the "changed" signal for the timeFormat
+ GtkComboBox widget. Set the 'timeFormat' preference to the
+ new value.
+
+ Arguments:
+ - widget: the component that generated the signal.
+ """
+
+ timeFormatCombo = widget.get_active()
+ if timeFormatCombo == TIME_FORMAT_LOCALE:
+ newFormat = settings.TIME_FORMAT_LOCALE
+ elif timeFormatCombo == TIME_FORMAT_24_HMS:
+ newFormat = settings.TIME_FORMAT_24_HMS
+ elif timeFormatCombo == TIME_FORMAT_24_HMS_WITH_WORDS:
+ newFormat = settings.TIME_FORMAT_24_HMS_WITH_WORDS
+ elif timeFormatCombo == TIME_FORMAT_24_HM:
+ newFormat = settings.TIME_FORMAT_24_HM
+ elif timeFormatCombo == TIME_FORMAT_24_HM_WITH_WORDS:
+ newFormat = settings.TIME_FORMAT_24_HM_WITH_WORDS
+ self.prefsDict["presentTimeFormat"] = newFormat
+
def speechVerbosityChanged(self, widget):
"""Signal handler for the "toggled" signal for the speechBriefButton,
or speechVerboseButton GtkRadioButton widgets. The user has
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]