OSDN Git Service

Speech dictionaries:
authorPeter Vágner <peter.v@datagate.sk>
Tue, 21 Sep 2010 16:52:49 +0000 (18:52 +0200)
committerPeter Vágner <peter.v@datagate.sk>
Tue, 21 Sep 2010 16:52:49 +0000 (18:52 +0200)
* Changed title of the Edit dictionary item dialog to add dictionary item when adding an entry to the speech dictionary (Fixes #924).
* Make the case sensitive and regular expression colums say on / off rather than true / false so they are translatable.

source/gui/settingsDialogs.py

index f441404..bbb41b7 100644 (file)
@@ -716,8 +716,8 @@ class DocumentFormattingDialog(SettingsDialog):
 \r
 class DictionaryEntryDialog(wx.Dialog):\r
 \r
-       def __init__(self,parent):\r
-               super(DictionaryEntryDialog,self).__init__(parent,title=_("Edit dictionary entry"))\r
+       def __init__(self,parent,title=_("Edit dictionary entry")):\r
+               super(DictionaryEntryDialog,self).__init__(parent,title=title)\r
                mainSizer=wx.BoxSizer(wx.VERTICAL)\r
                settingsSizer=wx.BoxSizer(wx.VERTICAL)\r
                settingsSizer.Add(wx.StaticText(self,-1,label=_("&Pattern")))\r
@@ -761,8 +761,9 @@ class DictionaryDialog(SettingsDialog):
                self.dictList.InsertColumn(2,_("Replacement"))\r
                self.dictList.InsertColumn(3,_("case sensitive"))\r
                self.dictList.InsertColumn(4,_("Regular expression"))\r
+               self.offOn = (_("off"),_("on"))\r
                for entry in self.tempSpeechDict:\r
-                       self.dictList.Append((entry.comment,entry.pattern,entry.replacement,str(entry.caseSensitive),str(entry.regexp)))\r
+                       self.dictList.Append((entry.comment,entry.pattern,entry.replacement,self.offOn[int(entry.caseSensitive)],self.offOn[int(entry.regexp)]))\r
                self.editingIndex=-1\r
                entriesSizer.Add(self.dictList)\r
                settingsSizer.Add(entriesSizer)\r
@@ -795,10 +796,10 @@ class DictionaryDialog(SettingsDialog):
                super(DictionaryDialog, self).onOk(evt)\r
 \r
        def OnAddClick(self,evt):\r
-               entryDialog=DictionaryEntryDialog(self)\r
+               entryDialog=DictionaryEntryDialog(self,title=_("Add Dictionary Entry"))\r
                if entryDialog.ShowModal()==wx.ID_OK:\r
                        self.tempSpeechDict.append(speechDictHandler.SpeechDictEntry(entryDialog.patternTextCtrl.GetValue(),entryDialog.replacementTextCtrl.GetValue(),entryDialog.commentTextCtrl.GetValue(),bool(entryDialog.caseSensitiveCheckBox.GetValue()),bool(entryDialog.regexpCheckBox.GetValue())))\r
-                       self.dictList.Append((entryDialog.commentTextCtrl.GetValue(),entryDialog.patternTextCtrl.GetValue(),entryDialog.replacementTextCtrl.GetValue(),str(bool(entryDialog.caseSensitiveCheckBox.GetValue())),str(bool(entryDialog.regexpCheckBox.GetValue()))))\r
+                       self.dictList.Append((entryDialog.commentTextCtrl.GetValue(),entryDialog.patternTextCtrl.GetValue(),entryDialog.replacementTextCtrl.GetValue(),self.offOn[int(entryDialog.caseSensitiveCheckBox.GetValue())],self.offOn[int(entryDialog.regexpCheckBox.GetValue())]))\r
                        index=self.dictList.GetFirstSelected()\r
                        while index>=0:\r
                                self.dictList.Select(index,on=0)\r
@@ -826,8 +827,8 @@ class DictionaryDialog(SettingsDialog):
                        self.dictList.SetStringItem(editIndex,0,entryDialog.commentTextCtrl.GetValue())\r
                        self.dictList.SetStringItem(editIndex,1,entryDialog.patternTextCtrl.GetValue())\r
                        self.dictList.SetStringItem(editIndex,2,entryDialog.replacementTextCtrl.GetValue())\r
-                       self.dictList.SetStringItem(editIndex,3,str(bool(entryDialog.caseSensitiveCheckBox.GetValue())))\r
-                       self.dictList.SetStringItem(editIndex,4,str(bool(entryDialog.regexpCheckBox.GetValue())))\r
+                       self.dictList.SetStringItem(editIndex,3,self.offOn[int(entryDialog.caseSensitiveCheckBox.GetValue())])\r
+                       self.dictList.SetStringItem(editIndex,4,self.offOn[int(entryDialog.regexpCheckBox.GetValue())])\r
                        self.dictList.SetFocus()\r
                entryDialog.Destroy()\r
 \r