Changeset 1146:0321756c76fe
- Timestamp:
- 04/24/24 13:54:14 (8 months ago)
- Branch:
- python3
- Phase:
- public
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
dcdatagen.py
r1145 r1146 27 27 # Row type: an actual delay code 28 28 DELAYCODE = 2 29 30 # Row type: an actual delay code requiring a textual explanation 31 DELAYCODE_EXPLANATION_REQUIRED = 3 29 32 30 33 #---------------------------------------------------------------------------- … … 702 705 print("msgid \"%srow%d\"" % (poPrefix, rowIndex), file=poFile) 703 706 generateMsgStr(poFile, columns[i]) 704 elif type ==DELAYCODE:707 elif type in [DELAYCODE, DELAYCODE_EXPLANATION_REQUIRED]: 705 708 columnIndex = 0 706 709 for column in columns: … … 739 742 continue 740 743 741 if type ==DELAYCODE:744 if type in [DELAYCODE, DELAYCODE_EXPLANATION_REQUIRED]: 742 745 print(" \"%s\": \"%s\"," % \ 743 746 (str(columns[codeIndex]).strip(), columns[meaningIndex][0].replace("\n", "")), file=dcdata) … … 756 759 tableMask = 1 757 760 for i in range(0, len(tablePrefixes)): 761 print("_%s_code2explanationRequired = {" % (tablePrefixes[i],), file=dcdata) 762 763 columnIndexes = [] 764 for j in range(0, len(headings)): 765 if ( (headingFlags[j]&tableMask)==tableMask ): 766 columnIndexes.append(j) 767 768 codeIndex = columnIndexes[0] 769 meaningIndex = columnIndexes[2] 770 771 rowIndex = 0 772 for (type, mask, columns) in rows: 773 if (mask&tableMask)!=tableMask: 774 continue 775 776 if type in [DELAYCODE, DELAYCODE_EXPLANATION_REQUIRED]: 777 print(" \"%s\": %s," % \ 778 (str(columns[codeIndex]).strip(), 779 "True" if type==DELAYCODE_EXPLANATION_REQUIRED else 780 "False"), 781 file = dcdata) 782 783 print("}", file=dcdata) 784 print(file=dcdata) 785 786 tableMask <<= 1 787 788 print("def _isExplanationRequired(table, row):", file=dcdata) 789 print(" code = row[0].strip()", file=dcdata) 790 print(" return table[code] if code in table else false", file=dcdata) 791 print(file=dcdata) 792 793 tableMask = 1 794 for i in range(0, len(tablePrefixes)): 758 795 759 796 print("_%s_data = (" % (tablePrefixes[i],), file=dcdata) 760 print(" lambda row: _extract(_%s_code2meaning, row)," % \ 797 print(" (lambda row: row[0].strip(),", file=dcdata) 798 print(" lambda row: _extract(_%s_code2meaning, row)," % \ 799 (tablePrefixes[i],), file=dcdata) 800 print(" lambda row: _isExplanationRequired(_%s_code2explanationRequired, row))," % \ 761 801 (tablePrefixes[i],), file=dcdata) 762 802 print(" [", end=' ', file=dcdata) … … 783 823 print(" (CAPTION, xstr(\"%srow%d\"))," % \ 784 824 (poPrefix, rowIndex), file=dcdata) 785 elif type ==DELAYCODE:825 elif type in [DELAYCODE, DELAYCODE_EXPLANATION_REQUIRED]: 786 826 print(" (DELAYCODE, [", file=dcdata) 787 827 for j in columnIndexes: -
locale/en/mlx.po
r1144 r1146 1404 1404 msgid "info_delay" 1405 1405 msgstr "Delay codes" 1406 1407 msgid "info_delay_explain" 1408 msgstr "Delay code: %s" 1406 1409 1407 1410 msgid "statusbar_conn_tooltip" -
locale/hu/mlx.po
r1144 r1146 1407 1407 msgid "info_delay" 1408 1408 msgstr "Késés kódok" 1409 1410 msgid "info_delay_explain" 1411 msgstr "Késés kód: %s" 1409 1412 1410 1413 msgid "statusbar_conn_tooltip" -
src/mlx/gui/delaycodes.py
r1035 r1146 191 191 self._alignments = [] 192 192 self._checkButtons = [] 193 self._codesToExplain = [] 193 194 194 195 self._eventBox = Gtk.EventBox() … … 203 204 204 205 self._previousWidth = 0 206 207 @property 208 def _delayCodeRows(self): 209 """Get a list of the row indexes in the delay code data table of 210 the delay codes that are enabled.""" 211 rows = [] 212 213 for checkButton in self._checkButtons: 214 if checkButton.get_active(): 215 rows.append(checkButton.delayCodeRow) 216 217 return rows 205 218 206 219 @property … … 210 223 211 224 if self._delayCodeData is not None: 212 codeExtractor = self._delayCodeData[0] 213 for checkButton in self._checkButtons: 214 if checkButton.get_active(): 215 codes.append(codeExtractor(checkButton.delayCodeRow)) 225 codeExtractor = self._delayCodeData[0][1] 226 for row in self._delayCodeRows: 227 codes.append(codeExtractor(row)) 216 228 217 229 return codes … … 337 349 def _delayCodesChanged(self, button): 338 350 """Called when one of the delay codes have changed.""" 339 numDelayCodes = len(self.delayCodes) 351 delayCodeRows = self._delayCodeRows 352 numDelayCodes = len(delayCodeRows) 340 353 if numDelayCodes>=4: 341 354 for checkButton in self._checkButtons: … … 346 359 checkButton.set_sensitive(True) 347 360 361 codeExtractor = self._delayCodeData[0][0] 362 isExplanationRequired = self._delayCodeData[0][2] 363 codesToExplain = [] 364 for row in delayCodeRows: 365 if isExplanationRequired(row): 366 code = codeExtractor(row) 367 codesToExplain.append(code) 368 if code not in self._codesToExplain: 369 self._info.addFault("dc_" + code, 370 xstr("info_delay_explain") % (code,)) 371 372 for code in self._codesToExplain: 373 if code not in codesToExplain: 374 self._info.clearFault("dc_" + code) 375 self._codesToExplain = codesToExplain 376 348 377 self._info.delayCodesChanged() 349 378
Note:
See TracChangeset
for help on using the changeset viewer.