Overview
| Comment: | [lo] lexical editor: display error message if wrong regex |
|---|---|
| Downloads: | Tarball | ZIP archive | SQL archive |
| Timelines: | family | ancestors | descendants | both | trunk | lo |
| Files: | files | file ages | folders |
| SHA3-256: |
e0e5594553b6e0cb91463175c34db962 |
| User & Date: | olr on 2018-04-13 14:18:48 |
| Other Links: | manifest | tags |
Context
|
2018-04-13
| ||
| 14:32 | [lo] lexicon editor: empty regex patterns if wrong check-in: 0cf6f12f52 user: olr tags: trunk, lo | |
| 14:18 | [lo] lexical editor: display error message if wrong regex check-in: e0e5594553 user: olr tags: trunk, lo | |
| 14:17 | [fr] faux positif: en cour de cassation check-in: dd421a303b user: olr tags: trunk, fr | |
Changes
Modified gc_lang/fr/oxt/DictOptions/SearchWords.py from [fbd244567c] to [ab6e7468d1].
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# Search
# by Olivier R.
# License: MPL 2
import unohelper
import uno
import traceback
import helpers
import sw_strings
import grammalecte.graphspell as sc
import grammalecte.graphspell.ibdawg as ibdawg
from com.sun.star.task import XJobExecutor
from com.sun.star.awt import XActionListener
def _waitPointer (funcDecorated):
def wrapper (*args, **kwargs):
# self is the first parameter if the decorator is applied on a object
self = args[0]
# before
xPointer = self.xSvMgr.createInstanceWithContext("com.sun.star.awt.Pointer", self.ctx)
| > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# Search
# by Olivier R.
# License: MPL 2
import unohelper
import uno
import traceback
import re
import helpers
import sw_strings
import grammalecte.graphspell as sc
import grammalecte.graphspell.ibdawg as ibdawg
from com.sun.star.task import XJobExecutor
from com.sun.star.awt import XActionListener
from com.sun.star.awt.MessageBoxButtons import BUTTONS_OK
# BUTTONS_OK, BUTTONS_OK_CANCEL, BUTTONS_YES_NO, BUTTONS_YES_NO_CANCEL, BUTTONS_RETRY_CANCEL, BUTTONS_ABORT_IGNORE_RETRY
# DEFAULT_BUTTON_OK, DEFAULT_BUTTON_CANCEL, DEFAULT_BUTTON_RETRY, DEFAULT_BUTTON_YES, DEFAULT_BUTTON_NO, DEFAULT_BUTTON_IGNORE
from com.sun.star.awt.MessageBoxType import INFOBOX, ERRORBOX # MESSAGEBOX, INFOBOX, WARNINGBOX, ERRORBOX, QUERYBOX
def MessageBox (xDocument, sMsg, sTitle, nBoxType=INFOBOX, nBoxButtons=BUTTONS_OK):
xParentWin = xDocument.CurrentController.Frame.ContainerWindow
ctx = uno.getComponentContext()
xToolkit = ctx.ServiceManager.createInstanceWithContext("com.sun.star.awt.Toolkit", ctx)
xMsgBox = xToolkit.createMessageBox(xParentWin, nBoxType, nBoxButtons, sTitle, sMsg)
return xMsgBox.execute()
def _waitPointer (funcDecorated):
def wrapper (*args, **kwargs):
# self is the first parameter if the decorator is applied on a object
self = args[0]
# before
xPointer = self.xSvMgr.createInstanceWithContext("com.sun.star.awt.Pointer", self.ctx)
|
| ︙ | ︙ | |||
186 187 188 189 190 191 192 193 194 195 196 197 198 199 |
xGridDataModel.addRow(i, aEntry)
@_waitPointer
def searchRegex (self):
self.initSpellChecker()
sFlexPattern = self.xFlexion.Text.strip()
sTagsPattern = self.xTags.Text.strip()
xGridDataModel = self.xGridModel.GridDataModel
xGridDataModel.removeAllRows()
for i, aEntry in enumerate(self.oSpellChecker.select(sFlexPattern, sTagsPattern)):
xGridDataModel.addRow(i, aEntry)
i += 1
if i >= 2000:
break
| > > > > > > > > > > | 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 |
xGridDataModel.addRow(i, aEntry)
@_waitPointer
def searchRegex (self):
self.initSpellChecker()
sFlexPattern = self.xFlexion.Text.strip()
sTagsPattern = self.xTags.Text.strip()
try:
if sFlexPattern:
re.compile(sFlexPattern)
except:
MessageBox(self.xDocument, self.dUI.get("regex_error_flexion", "#err"), self.dUI.get("error", "#err"), nBoxType=ERRORBOX)
try:
if sTagsPattern:
re.compile(sTagsPattern)
except:
MessageBox(self.xDocument, self.dUI.get("regex_error_tags", "#err"), self.dUI.get("error", "#err"), nBoxType=ERRORBOX)
xGridDataModel = self.xGridModel.GridDataModel
xGridDataModel.removeAllRows()
for i, aEntry in enumerate(self.oSpellChecker.select(sFlexPattern, sTagsPattern)):
xGridDataModel.addRow(i, aEntry)
i += 1
if i >= 2000:
break
|
Modified gc_lang/fr/oxt/DictOptions/sw_strings.py from [3a2ca9bcb9] to [50044502f8].
| ︙ | ︙ | |||
20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
"result_section": "Résultats",
"res_flexion": "Flexions",
"res_lemma": "Lemmes",
"res_tags": "Étiquettes",
"close_button": "Fermer",
},
"en": {
"title": "Grammalecte · Search and informations",
"close_button": "Close",
},
| > > > > | 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
"result_section": "Résultats",
"res_flexion": "Flexions",
"res_lemma": "Lemmes",
"res_tags": "Étiquettes",
"close_button": "Fermer",
"error": "Erreur",
"regex_error_flexion": "L’expression régulière du champ ‹Flexion› est erronée.",
"regex_error_tags": "L’expression régulière du champ ‹Étiquettes› est erronée."
},
"en": {
"title": "Grammalecte · Search and informations",
"close_button": "Close",
},
|
| ︙ | ︙ |