Grammalecte  Check-in [d7ab6f010f]

Overview
Comment:[lo] text formatter editor: small ui update
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | lo
Files: files | file ages | folders
SHA3-256: d7ab6f010f75897b4f8cd6d179cf07612654a1a2c41e7faa271436fc061b401f
User & Date: olr on 2020-12-18 10:31:52
Other Links: manifest | tags
Context
2020-12-18
16:58
[fx] gc editor: don’t modify node content if no modification check-in: a3b0c51a85 user: olr tags: fx, trunk
10:31
[lo] text formatter editor: small ui update check-in: d7ab6f010f user: olr tags: lo, trunk
09:59
[lo] text formatter editor update check-in: 7d2246bb86 user: olr tags: lo, trunk
Changes

Modified gc_lang/fr/oxt/TextFormatter/TextFormatterEditor.py from [8b8fa9d3c8] to [b31844a66b].

   135    135   
   136    136           self.xNewName = self._addWidget('newname', 'Edit', nX, nY1+20, 60, 10, FontDescriptor = xFDMono)
   137    137           self.xNewPattern = self._addWidget('newreplace', 'Edit', nX+65, nY1+20, 130, 10, FontDescriptor = xFDMono)
   138    138           self.xNewRepl = self._addWidget('newby', 'Edit', nX+200, nY1+20, 100, 10, FontDescriptor = xFDMono)
   139    139           self.xNewRegex = self._addWidget('newregex', 'CheckBox', nX+305, nY1+22, 35, nHeight, Label = ui.get("regex"), HelpText=ui.get("regex_help"))
   140    140           self.xNewCaseSens = self._addWidget('newcasesens', 'CheckBox', nX+340, nY1+22, 40, nHeight, Label = ui.get("casesens"), HelpText=ui.get("casesens_help"), State=True)
   141    141   
          142  +        self._addWidget('order_info', 'FixedText', nX, nY1+32, 300, nHeight, Label = ui.get("order_info"))
   142    143           self._addWidget('add', 'Button', self.xDialog.Width-50, nY1+31, 40, 11, Label = ui.get('add'))
   143    144   
   144    145           lColumns = [
   145    146               {"Title": ui.get("name"),     "ColumnWidth": 80},
   146    147               {"Title": ui.get("pattern"),  "ColumnWidth": 160},
   147    148               {"Title": ui.get("repl"),     "ColumnWidth": 120},
   148    149               {"Title": ui.get("regex"),    "ColumnWidth": 60},
................................................................................
   234    235   
   235    236       # XGridSelectionListener
   236    237       def selectionChanged (self, xGridSelectionEvent):
   237    238           try:
   238    239               aRows = self.xGridControl.getSelectedRows()
   239    240               if aRows and len(aRows) == 1:
   240    241                   self.iSelectedRow = aRows[0]
   241         -                self.sSelectedRuleName, sPattern, sRepl, sRegex, sCaseSens = self.xGridModel.GridDataModel.getRowData(self.iSelectedRow)
          242  +                self.sSelectedRuleName, *_ = self.xGridModel.GridDataModel.getRowData(self.iSelectedRow)
   242    243                   # fill fields
          244  +                dRule = self.dRules[self.sSelectedRuleName]
   243    245                   self.xEditName.Text = self.sSelectedRuleName
   244         -                self.xEditPattern.Text = sPattern
   245         -                self.xEditRepl.Text = sRepl
   246         -                self.xEditRegex.State = sRegex == "True"
   247         -                self.xEditCaseSens.State = sCaseSens == "True"
          246  +                self.xEditPattern.Text = dRule["sPattern"]
          247  +                self.xEditRepl.Text = dRule["sRepl"]
          248  +                self.xEditRegex.State = dRule["bRegex"]
          249  +                self.xEditCaseSens.State = dRule["bCaseSens"]
   248    250                   # enable widgets
   249    251                   self.xEditName.Enabled = True
   250    252                   self.xEditPattern.Enabled = True
   251    253                   self.xEditRepl.Enabled = True
   252    254                   self.xEditRegex.Enabled = True
   253    255                   self.xEditCaseSens.Enabled = True
   254    256                   self.xDeleteButton.Enabled = True
................................................................................
   308    310           }
   309    311           xGridDataModel = self.xGridModel.GridDataModel
   310    312           xGridDataModel.addRow(xGridDataModel.RowCount + 1, self._getValuesForRow(sRuleName))
   311    313           xGridDataModel.sortByColumn(0, True)
   312    314           self._clearAddFields()
   313    315   
   314    316       def _getValuesForRow (self, sRuleName):
   315         -        return (sRuleName, self.dRules[sRuleName]["sPattern"], self.dRules[sRuleName]["sRepl"], str(self.dRules[sRuleName]["bRegex"]), str(self.dRules[sRuleName]["bCaseSens"]))
          317  +        return (sRuleName, self.dRules[sRuleName]["sPattern"],
          318  +                self.dRules[sRuleName]["sRepl"],
          319  +                "✓"  if self.dRules[sRuleName]["bRegex"]  else "",
          320  +                "✓"  if self.dRules[sRuleName]["bCaseSens"]  else "")
   316    321   
   317    322       def _checkRuleName (self, sRuleName):
   318    323           return re.search(r"^\w[\w_#.,;!?-]{,14}$", sRuleName)
   319    324   
   320    325       def modifyRule (self):
   321    326           if not self._checkRuleName(self.xEditName.Text):
   322    327               MessageBox(self.xDocument, ui.get("name_error"), ui.get("name_error_title"), ERRORBOX)

Modified gc_lang/fr/oxt/TextFormatter/tfe_strings.py from [10a90636db] to [15882e0f9b].

    24     24           "name": "Nom de la règle",
    25     25           "pattern": "Motif de recherche",
    26     26           "repl": "remplacer par",
    27     27           "regex": "Regex",
    28     28           "regex_help": "Une expression régulière est une forme de syntaxe décrivant un motif de recherche de caractères",
    29     29           "casesens": "Casse rigide",
    30     30           "casesens_help": "La casse des caractères sera respectée telle quelle.",
           31  +        "order_info": "Les règles seront appliquées dans l’ordre alphabétique défini par leur nom.",
    31     32   
    32     33           "new_entry": "Nouvelle entrée",
    33     34           "edit_entry": "Entrée sélectionnée",
    34     35   
    35     36           "add": "Ajouter",
    36     37           "delete": "Supprimer",
    37     38           "modify": "Modifier",
................................................................................
    76     77           "name": "Rule name",
    77     78           "pattern": "Search pattern",
    78     79           "repl": "replace by",
    79     80           "regex": "Regex",
    80     81           "regex_help": "A regular expression is a kind of syntax describing a search pattern of characters",
    81     82           "casesens": "Case sensitivity",
    82     83           "casesens_help": "Characters case will be treated as written.",
           84  +        "order_info": "Rules will applied according to the alphabetical order defined by their name.",
    83     85   
    84     86           "new_entry": "New entry",
    85     87           "edit_entry": "Selected entry",
    86     88   
    87     89           "add": "Add",
    88     90           "delete": "Delete",
    89     91           "modify": "Modify",