Overview
Comment: | [lo] text formatter editor update |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk | lo |
Files: | files | file ages | folders |
SHA3-256: |
7d2246bb86b0f8e57dafac338d778df0 |
User & Date: | olr on 2020-12-18 09:59:47 |
Other Links: | manifest | tags |
Context
2020-12-18
| ||
10:31 | [lo] text formatter editor: small ui update check-in: d7ab6f010f user: olr tags: trunk, lo | |
09:59 | [lo] text formatter editor update check-in: 7d2246bb86 user: olr tags: trunk, lo | |
2020-12-17
| ||
20:31 | [lo] code cleaning & clarification check-in: 130814503c user: olr tags: trunk, lo | |
Changes
Modified gc_lang/fr/config.ini from [9d8deb0cf0] to [ac5fc1a082].
1 2 3 4 5 6 7 8 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | - + | [args] lang = fr lang_name = French locales = fr_FR fr_BE fr_CA fr_CH fr_LU fr_BF fr_BJ fr_CD fr_CI fr_CM fr_MA fr_ML fr_MU fr_NE fr_RE fr_SN fr_TG country_default = FR name = Grammalecte implname = grammalecte # always use 3 numbers for version: x.y.z |
︙ |
Modified gc_lang/fr/oxt/TextFormatter/TextFormatterEditor.py from [5fe2011618] to [8b8fa9d3c8].
︙ | |||
13 14 15 16 17 18 19 | 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | - + | import helpers import tfe_strings as ui import grammalecte.graphspell as sc from com.sun.star.awt import XActionListener from com.sun.star.awt.grid import XGridSelectionListener |
︙ | |||
139 140 141 142 143 144 145 | 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 | - - + + | self.xNewRegex = self._addWidget('newregex', 'CheckBox', nX+305, nY1+22, 35, nHeight, Label = ui.get("regex"), HelpText=ui.get("regex_help")) self.xNewCaseSens = self._addWidget('newcasesens', 'CheckBox', nX+340, nY1+22, 40, nHeight, Label = ui.get("casesens"), HelpText=ui.get("casesens_help"), State=True) self._addWidget('add', 'Button', self.xDialog.Width-50, nY1+31, 40, 11, Label = ui.get('add')) lColumns = [ {"Title": ui.get("name"), "ColumnWidth": 80}, |
︙ | |||
173 174 175 176 177 178 179 180 181 182 183 184 185 186 | 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 | + | self._addWidget('export', 'Button', nX+55, self.xDialog.Height-20, 50, 14, Label = ui.get('export'), FontDescriptor = xFDTitle, TextColor = 0x00AA00) self._addWidget('delete_all', 'Button', nX + (self.xDialog.Width/2)-35, self.xDialog.Height-20, 70, 14, Label = ui.get('delete_all'), FontDescriptor = xFDTitle, TextColor = 0xAA0000) self._addWidget('save_and_close', 'Button', self.xDialog.Width-110, self.xDialog.Height-20, 100, 14, Label = ui.get('save_and_close'), FontDescriptor = xFDTitle, TextColor = 0x00AA00) # data self.dRules = {} self.iSelectedRow = -1 self.nFieldMaxLen = 250 # load configuration self.xGLOptionNode = helpers.getConfigSetting("/org.openoffice.Lightproof_${implname}/Other/", True) self.loadRules() # container self.xContainer = self.xSvMgr.createInstanceWithContext('com.sun.star.awt.UnoControlDialog', self.ctx) |
︙ | |||
288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 | 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 | + + + + - + + + + | def addRule (self): if not self._checkRuleName(self.xNewName.Text): MessageBox(self.xDocument, ui.get("name_error"), ui.get("name_error_title"), ERRORBOX) return if not self.xNewName.Text or not self.xNewPattern.Text: MessageBox(self.xDocument, ui.get("name_and_replace_error"), ui.get("name_and_replace_error_title"), ERRORBOX) return if len(self.xNewPattern.Text) > self.nFieldMaxLen or len(self.xNewRepl.Text) > self.nFieldMaxLen: MessageBox(self.xDocument, ui.get("max_len_error"), ui.get("max_len_error_title"), ERRORBOX) return sRuleName = self.xNewName.Text if sRuleName in self.dRules: MessageBox(self.xDocument, ui.get('add_name_error'), ui.get("add_name_error_title"), ERRORBOX) return self.dRules[sRuleName] = { "sPattern": self.xNewPattern.Text, "sRepl": self.xNewRepl.Text, "bRegex": self.xNewRegex.State == 1, "bCaseSens": self.xNewCaseSens.State == 1 } xGridDataModel = self.xGridModel.GridDataModel xGridDataModel.addRow(xGridDataModel.RowCount + 1, self._getValuesForRow(sRuleName)) xGridDataModel.sortByColumn(0, True) self._clearAddFields() def _getValuesForRow (self, sRuleName): return (sRuleName, self.dRules[sRuleName]["sPattern"], self.dRules[sRuleName]["sRepl"], str(self.dRules[sRuleName]["bRegex"]), str(self.dRules[sRuleName]["bCaseSens"])) def _checkRuleName (self, sRuleName): |
︙ | |||
347 348 349 350 351 352 353 | 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 | + + - - + + | self.xGridModel.GridDataModel.removeRow(self.iSelectedRow) self.iSelectedRow = -1 del self.dRules[sRuleName] except: traceback.print_exc() def deleteAll (self): nButton = MessageBox(self.xDocument, ui.get('delete_all_confirm'), ui.get('delete_all'), QUERYBOX, BUTTONS_YES_NO) if nButton == 2: # ok |
︙ | |||
375 376 377 378 379 380 381 382 383 384 385 386 387 388 | 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 | + | sTFEditorOptions = xChild.getPropertyValue("tfe_rules") if not sTFEditorOptions: return self.dRules = json.loads(sTFEditorOptions) xGridDataModel = self.xGridModel.GridDataModel for sRuleName in self.dRules: xGridDataModel.addRow(xGridDataModel.RowCount + 1, self._getValuesForRow(sRuleName)) xGridDataModel.sortByColumn(0, True) except: sMessage = traceback.format_exc() MessageBox(self.xDocument, sMessage, ui.get('error'), ERRORBOX) @_waitPointer def saveRules (self): try: |
︙ | |||
436 437 438 439 440 441 442 443 444 445 446 447 448 449 | 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 | + | for sRuleName in self.dRules: xGridDataModel.addRow(xGridDataModel.RowCount + 1, self._getValuesForRow(sRuleName)) else: # 3 = no for sRuleName, dValues in dImportedRules.items(): if not sRuleName in self.dRules: self.dRules[sRuleName] = dValues xGridDataModel.addRow(xGridDataModel.RowCount + 1, self._getValuesForRow(sRuleName)) xGridDataModel.sortByColumn(0, True) def exportRules (self): if not self.dRules: return sText = json.dumps(self.dRules, ensure_ascii=False) try: xFilePicker = self.xSvMgr.createInstanceWithContext('com.sun.star.ui.dialogs.FilePicker', self.ctx) # other possibility: com.sun.star.ui.dialogs.SystemFilePicker |
︙ |
Modified gc_lang/fr/oxt/TextFormatter/tfe_strings.py from [cec8754aec] to [10a90636db].
︙ | |||
18 19 20 21 22 23 24 | 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 | - - + + + + - - + + + + + - - + + + + - + + + + | dStrings = { "fr": { "title": "Grammalecte · Éditeur des transformations personnalisées", "name": "Nom de la règle", |