[orca] Fix for bgo#623099 - Present date needs a few more formatting strings



commit 2f491b93606e7b1b82efde480b10c95c60f907ce
Author: Joanmarie Diggs <joanmarie diggs gmail com>
Date:   Sun Jul 4 13:50:54 2010 -0400

    Fix for bgo#623099 - Present date needs a few more formatting strings

 src/orca/orca_gui_prefs.py |   95 ++++++++++++++++++++++++++++++++++++++------
 src/orca/orca_prefs.py     |   34 ++++++++++++++--
 src/orca/settings.py       |   24 ++++++++++-
 3 files changed, 134 insertions(+), 19 deletions(-)
---
diff --git a/src/orca/orca_gui_prefs.py b/src/orca/orca_gui_prefs.py
index 4c62aef..6f4040d 100644
--- a/src/orca/orca_gui_prefs.py
+++ b/src/orca/orca_gui_prefs.py
@@ -85,8 +85,12 @@ from orca_i18n import C_ # to provide qualified translatable strings
 
 # Must match the order that the dateFormatCombo is populated.
 #
-(DATE_FORMAT_LOCALE, DATE_FORMAT_WITH_LONG_NAMES,
- DATE_FORMAT_WITH_SHORT_NAMES) = range(3)
+(DATE_FORMAT_LOCALE, DATE_FORMAT_NUMBERS_DM, DATE_FORMAT_NUMBERS_MD,
+ DATE_FORMAT_NUMBERS_DMY, DATE_FORMAT_NUMBERS_MDY, DATE_FORMAT_NUMBERS_YMD,
+ DATE_FORMAT_FULL_DM, DATE_FORMAT_FULL_MD, DATE_FORMAT_FULL_DMY,
+ DATE_FORMAT_FULL_MDY, DATE_FORMAT_FULL_YMD, DATE_FORMAT_ABBREVIATED_DM,
+ DATE_FORMAT_ABBREVIATED_MD, DATE_FORMAT_ABBREVIATED_DMY,
+ DATE_FORMAT_ABBREVIATED_MDY, DATE_FORMAT_ABBREVIATED_YMD) = range(16)
 
 class OrcaSetupGUI(orca_gtkbuilder.GtkBuilderWrapper):
 
@@ -1576,18 +1580,57 @@ class OrcaSetupGUI(orca_gtkbuilder.GtkBuilderWrapper):
         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())
+           sdtime(settings.DATE_FORMAT_NUMBERS_DM, ltime()),
+           sdtime(settings.DATE_FORMAT_NUMBERS_MD, ltime()),
+           sdtime(settings.DATE_FORMAT_NUMBERS_DMY, ltime()),
+           sdtime(settings.DATE_FORMAT_NUMBERS_MDY, ltime()),
+           sdtime(settings.DATE_FORMAT_NUMBERS_YMD, ltime()),
+           sdtime(settings.DATE_FORMAT_FULL_DM, ltime()),
+           sdtime(settings.DATE_FORMAT_FULL_MD, ltime()),
+           sdtime(settings.DATE_FORMAT_FULL_DMY, ltime()),
+           sdtime(settings.DATE_FORMAT_FULL_MDY, ltime()),
+           sdtime(settings.DATE_FORMAT_FULL_YMD, ltime()),
+           sdtime(settings.DATE_FORMAT_ABBREVIATED_DM, ltime()),
+           sdtime(settings.DATE_FORMAT_ABBREVIATED_MD, ltime()),
+           sdtime(settings.DATE_FORMAT_ABBREVIATED_DMY, ltime()),
+           sdtime(settings.DATE_FORMAT_ABBREVIATED_MDY, ltime()),
+           sdtime(settings.DATE_FORMAT_ABBREVIATED_YMD, 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
+        elif dateFormat == settings.DATE_FORMAT_NUMBERS_DM:
+            indexdate = DATE_FORMAT_NUMBERS_DM
+        elif dateFormat == settings.DATE_FORMAT_NUMBERS_MD:
+            indexdate = DATE_FORMAT_NUMBERS_MD
+        elif dateFormat == settings.DATE_FORMAT_NUMBERS_DMY:
+            indexdate = DATE_FORMAT_NUMBERS_DMY
+        elif dateFormat == settings.DATE_FORMAT_NUMBERS_MDY:
+            indexdate = DATE_FORMAT_NUMBERS_MDY
+        elif dateFormat == settings.DATE_FORMAT_NUMBERS_YMD:
+            indexdate = DATE_FORMAT_NUMBERS_YMD
+        elif dateFormat == settings.DATE_FORMAT_FULL_DM:
+            indexdate = DATE_FORMAT_FULL_DM
+        elif dateFormat == settings.DATE_FORMAT_FULL_MD:
+            indexdate = DATE_FORMAT_FULL_MD
+        elif dateFormat == settings.DATE_FORMAT_FULL_DMY:
+            indexdate = DATE_FORMAT_FULL_DMY
+        elif dateFormat == settings.DATE_FORMAT_FULL_MDY:
+            indexdate = DATE_FORMAT_FULL_MDY
+        elif dateFormat == settings.DATE_FORMAT_FULL_YMD:
+            indexdate = DATE_FORMAT_FULL_YMD
+        elif dateFormat == settings.DATE_FORMAT_ABBREVIATED_DM:
+            indexdate = DATE_FORMAT_ABBREVIATED_DM
+        elif dateFormat == settings.DATE_FORMAT_ABBREVIATED_MD:
+            indexdate = DATE_FORMAT_ABBREVIATED_MD
+        elif dateFormat == settings.DATE_FORMAT_ABBREVIATED_DMY:
+            indexdate = DATE_FORMAT_ABBREVIATED_DMY
+        elif dateFormat == settings.DATE_FORMAT_ABBREVIATED_MDY:
+            indexdate = DATE_FORMAT_ABBREVIATED_MDY
+        elif dateFormat == settings.DATE_FORMAT_ABBREVIATED_YMD:
+            indexdate = DATE_FORMAT_ABBREVIATED_YMD
         combobox2.set_active (indexdate)
         
         combobox3 = self.get_widget("timeFormatCombo")
@@ -2918,10 +2961,36 @@ class OrcaSetupGUI(orca_gtkbuilder.GtkBuilderWrapper):
         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
+        elif dateFormatCombo == DATE_FORMAT_NUMBERS_DM:
+            newFormat = settings.DATE_FORMAT_NUMBERS_DM
+        elif dateFormatCombo == DATE_FORMAT_NUMBERS_MD:
+            newFormat = settings.DATE_FORMAT_NUMBERS_MD
+        elif dateFormatCombo == DATE_FORMAT_NUMBERS_DMY:
+            newFormat = settings.DATE_FORMAT_NUMBERS_DMY
+        elif dateFormatCombo == DATE_FORMAT_NUMBERS_MDY:
+            newFormat = settings.DATE_FORMAT_NUMBERS_MDY
+        elif dateFormatCombo == DATE_FORMAT_NUMBERS_YMD:
+            newFormat = settings.DATE_FORMAT_NUMBERS_YMD
+        elif dateFormatCombo == DATE_FORMAT_FULL_DM:
+            newFormat = settings.DATE_FORMAT_FULL_DM
+        elif dateFormatCombo == DATE_FORMAT_FULL_MD:
+            newFormat = settings.DATE_FORMAT_FULL_MD
+        elif dateFormatCombo == DATE_FORMAT_FULL_DMY:
+            newFormat = settings.DATE_FORMAT_FULL_DMY
+        elif dateFormatCombo == DATE_FORMAT_FULL_MDY:
+            newFormat = settings.DATE_FORMAT_FULL_MDY
+        elif dateFormatCombo == DATE_FORMAT_FULL_YMD:
+            newFormat = settings.DATE_FORMAT_FULL_YMD
+        elif dateFormatCombo == DATE_FORMAT_ABBREVIATED_DM:
+            newFormat = settings.DATE_FORMAT_ABBREVIATED_DM
+        elif dateFormatCombo == DATE_FORMAT_ABBREVIATED_MD:
+            newFormat = settings.DATE_FORMAT_ABBREVIATED_MD
+        elif dateFormatCombo == DATE_FORMAT_ABBREVIATED_DMY:
+            newFormat = settings.DATE_FORMAT_ABBREVIATED_DMY
+        elif dateFormatCombo == DATE_FORMAT_ABBREVIATED_MDY:
+            newFormat = settings.DATE_FORMAT_ABBREVIATED_MDY
+        elif dateFormatCombo == DATE_FORMAT_ABBREVIATED_YMD:
+            newFormat = settings.DATE_FORMAT_ABBREVIATED_YMD
         self.prefsDict["presentDateFormat"] = newFormat
     
     def timeFormatChanged(self, widget):
diff --git a/src/orca/orca_prefs.py b/src/orca/orca_prefs.py
index d06fa9f..3ed534f 100644
--- a/src/orca/orca_prefs.py
+++ b/src/orca/orca_prefs.py
@@ -351,10 +351,36 @@ class OrcaPrefs:
             return "orca.settings.TIME_FORMAT_LOCALE"
 
     def _getPresentDateString(self, val):
-        if val == settings.DATE_FORMAT_WITH_LONG_NAMES:
-            return "orca.settings.DATE_FORMAT_WITH_LONG_NAMES"
-        elif val == settings.DATE_FORMAT_WITH_SHORT_NAMES:
-            return "orca.settings.DATE_FORMAT_WITH_SHORT_NAMES"
+        if val == settings.DATE_FORMAT_NUMBERS_DM:
+            return "orca.settings.DATE_FORMAT_NUMBERS_DM"
+        elif val == settings.DATE_FORMAT_NUMBERS_MD:
+            return "orca.settings.DATE_FORMAT_NUMBERS_MD"
+        elif val == settings.DATE_FORMAT_NUMBERS_DMY:
+            return "orca.settings.DATE_FORMAT_NUMBERS_DMY"
+        elif val == settings.DATE_FORMAT_NUMBERS_MDY:
+            return "orca.settings.DATE_FORMAT_NUMBERS_MDY"
+        elif val == settings.DATE_FORMAT_NUMBERS_YMD:
+            return "orca.settings.DATE_FORMAT_NUMBERS_YMD"
+        elif val == settings.DATE_FORMAT_FULL_DM:
+            return "orca.settings.DATE_FORMAT_FULL_DM"
+        elif val == settings.DATE_FORMAT_FULL_MD:
+            return "orca.settings.DATE_FORMAT_FULL_MD"
+        elif val == settings.DATE_FORMAT_FULL_DMY:
+            return "orca.settings.DATE_FORMAT_FULL_DMY"
+        elif val == settings.DATE_FORMAT_FULL_MDY:
+            return "orca.settings.DATE_FORMAT_FULL_MDY"
+        elif val == settings.DATE_FORMAT_FULL_YMD:
+            return "orca.settings.DATE_FORMAT_FULL_YMD"
+        elif val == settings.DATE_FORMAT_ABBREVIATED_DM:
+            return "orca.settings.DATE_FORMAT_ABBREVIATED_DM"
+        elif val == settings.DATE_FORMAT_ABBREVIATED_MD:
+            return "orca.settings.DATE_FORMAT_ABBREVIATED_MD"
+        elif val == settings.DATE_FORMAT_ABBREVIATED_DMY:
+            return "orca.settings.DATE_FORMAT_ABBREVIATED_DMY"
+        elif val == settings.DATE_FORMAT_ABBREVIATED_MDY:
+            return "orca.settings.DATE_FORMAT_ABBREVIATED_MDY"
+        elif val == settings.DATE_FORMAT_ABBREVIATED_YMD:
+            return "orca.settings.DATE_FORMAT_ABBREVIATED_YMD"
         else:
             return "orca.settings.DATE_FORMAT_LOCALE"
 
diff --git a/src/orca/settings.py b/src/orca/settings.py
index 77424e9..88d3206 100644
--- a/src/orca/settings.py
+++ b/src/orca/settings.py
@@ -1512,6 +1512,7 @@ TIME_FORMAT_24_HM = "%H:%M"
 # user may wish to be presented with.
 #
 TIME_FORMAT_24_HM_WITH_WORDS = _("%H hours and %M minutes.")
+TIME_FORMAT_CUSTOM = "%X"
 presentTimeFormat = TIME_FORMAT_LOCALE
 
 # Format directives to use in presentDate function.
@@ -1521,6 +1522,25 @@ presentTimeFormat = TIME_FORMAT_LOCALE
 # http://docs.python.org/library/time.html#time.strftime
 #
 DATE_FORMAT_LOCALE = "%x"
-DATE_FORMAT_WITH_LONG_NAMES = "%A, %d %B, %Y."
-DATE_FORMAT_WITH_SHORT_NAMES = "%a, %d %b, %Y."
+DATE_FORMAT_NUMBERS_DM = "%d/%m"
+DATE_FORMAT_NUMBERS_MD = "%m/%d"
+DATE_FORMAT_NUMBERS_DMY = "%d/%m/%Y"
+DATE_FORMAT_NUMBERS_MDY = "%m/%d/%Y"
+DATE_FORMAT_NUMBERS_YMD = "%Y/%m/%d"
+DATE_FORMAT_FULL_DM = "%A, %d %B"
+DATE_FORMAT_FULL_MD = "%A, %B %d"
+DATE_FORMAT_FULL_DMY = "%A, %d %B, %Y"
+DATE_FORMAT_FULL_MDY = "%A, %B %d, %Y"
+DATE_FORMAT_FULL_YMD = "%Y. %B %d, %A."
+DATE_FORMAT_ABBREVIATED_DM = "%a, %d %b"
+DATE_FORMAT_ABBREVIATED_MD = "%a, %b %d"
+DATE_FORMAT_ABBREVIATED_DMY = "%a, %d %b, %Y"
+DATE_FORMAT_ABBREVIATED_MDY = "%a, %b %d, %Y"
+DATE_FORMAT_ABBREVIATED_YMD = "%Y. %b %d, %a."
+
+# To keep Orca from spitting up upon launch.
+#
+DATE_FORMAT_WITH_LONG_NAMES = DATE_FORMAT_FULL_DMY
+DATE_FORMAT_WITH_SHORT_NAMES = DATE_FORMAT_ABBREVIATED_DMY
+
 presentDateFormat = DATE_FORMAT_LOCALE



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]