Grammalecte  Check-in [1d5fe44fe8]

Overview
Comment:[lo] update: lexicon editor
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | lo | multid
Files: files | file ages | folders
SHA3-256: 1d5fe44fe822cb653caea2997f5e9dffd21a7379079ed344eff6b6afe555971e
User & Date: olr on 2018-02-27 17:23:57
Other Links: branch diff | manifest | tags
Context
2018-02-27
18:07
[graphspell][py] dawg: ability to build lexicon directly from a list of tuples check-in: c65e578338 user: olr tags: graphspell, multid
17:23
[lo] update: lexicon editor check-in: 1d5fe44fe8 user: olr tags: lo, multid
2018-02-26
18:46
[lo] update: lexicon editor check-in: db6da7d9a4 user: olr tags: lo, multid
Changes

Modified gc_lang/fr/oxt/DictOptions/LexiconEditor.py from [659bee1976] to [609002a6a0].

     7      7   import re
     8      8   import traceback
     9      9   
    10     10   import helpers
    11     11   import lxe_strings
    12     12   import lxe_conj_data
    13     13   import grammalecte.graphspell as sc
           14  +import grammalecte.graphspell.dawg as dawg
    14     15   import grammalecte.fr.conj as conj
    15     16   
    16     17   from com.sun.star.task import XJobExecutor
    17     18   from com.sun.star.awt import XActionListener
           19  +from com.sun.star.awt import XKeyListener
    18     20   
    19     21   
    20     22   def _waitPointer (funcDecorated):
    21     23       def wrapper (*args, **kwargs):
    22     24           # self is the first parameter if the decorator is applied on a object
    23     25           self = args[0]
    24     26           # before
................................................................................
    37     39               x.setPointer(xPointer)
    38     40           self.xContainer.setVisible(True) # seems necessary to refresh the dialog box and text widgets (why?)
    39     41           # return
    40     42           return result
    41     43       return wrapper
    42     44   
    43     45   
    44         -class LexiconEditor (unohelper.Base, XActionListener, XJobExecutor):
           46  +class LexiconEditor (unohelper.Base, XActionListener, XKeyListener, XJobExecutor):
    45     47   
    46     48       def __init__ (self, ctx):
    47     49           self.ctx = ctx
    48     50           self.xSvMgr = self.ctx.ServiceManager
    49     51           self.xDesktop = self.xSvMgr.createInstanceWithContext("com.sun.star.frame.Desktop", self.ctx)
    50     52           self.xDocument = self.xDesktop.getCurrentComponent()
    51     53           self.xContainer = None
................................................................................
   121    123           nXB = nX1 + 195
   122    124           nXC = nXB + 205
   123    125   
   124    126           nHeight = 10
   125    127   
   126    128           #### Add word
   127    129           self._addWidget("add_section", 'FixedLine', nX1, nY1, 190, nHeight, Label = self.dUI.get("add_section", "#err"), FontDescriptor = xFDTitle)
   128         -        #self._addWidget('main_lemma_label', 'FixedText', nX1, nY1+10, 30, nHeight, Label = self.dUI.get('lemma', "#err"))
   129         -        self.xLemma = self._addWidget('main_lemma', 'Edit', nX1, nY1+10, 120, 14, FontDescriptor = xFDTitle)
   130         -        self._addWidget('generate_button', 'Button', nX1+130, nY1+10, 60, 14, Label = self.dUI.get('generate_button', "#err"), FontDescriptor = xFDTitle, TextColor = 0x550000)
          130  +        self.xLemma = self._addWidget('lemma', 'Edit', nX1, nY1+10, 120, 14, FontDescriptor = xFDTitle)
          131  +        self._addWidget('close_button', 'Button', nX1+130, nY1+10, 60, 14, Label = self.dUI.get('close_button', "#err"), FontDescriptor = xFDTitle, TextColor = 0x550000)
   131    132   
   132    133           # Radio buttons: main POS tag
   133    134           # Note: the only way to group RadioButtons is to create them successively
   134    135           self.xNA = self._addWidget('nom_adj', 'RadioButton', nX1, nY2+12, 60, nHeight, Label = self.dUI.get("nom_adj", "#err"), HelpText = ":N:A")
   135    136           self.xN = self._addWidget('nom', 'RadioButton', nX1, nY2+22, 60, nHeight, Label = self.dUI.get("nom", "#err"), HelpText = ":N")
   136    137           self.xA = self._addWidget('adj', 'RadioButton', nX1, nY2+32, 60, nHeight, Label = self.dUI.get("adj", "#err"), HelpText = ":A")
   137    138           self.xM1 = self._addWidget('M1', 'RadioButton', nX1, nY3+12, 60, nHeight, Label = self.dUI.get("M1", "#err"), HelpText = ":M1")
   138    139           self.xM2 = self._addWidget('M2', 'RadioButton', nX1, nY3+22, 60, nHeight, Label = self.dUI.get("M2", "#err"), HelpText = ":M2")
   139    140           self.xMP = self._addWidget('MP', 'RadioButton', nX1, nY3+32, 60, nHeight, Label = self.dUI.get("MP", "#err"), HelpText = ":MP")
   140         -        self.xV = self._addWidget('verb', 'RadioButton', nX1, nY4+2, 10, nHeight, HelpText = ":V")
   141         -        self.xW = self._addWidget('adv', 'RadioButton', nX1, nY5+2, 10, nHeight, HelpText = ":W")
   142         -        self.xX = self._addWidget('other', 'RadioButton', nX1, nY6+2, 10, nHeight, HelpText = ":X")
          141  +        self.xV = self._addWidget('verb', 'RadioButton', nX1, nY4+2, 30, nHeight, Label = self.dUI.get("verb", "#err"), FontDescriptor = xFDSubTitle, HelpText = ":V")
          142  +        self.xW = self._addWidget('adv', 'RadioButton', nX1, nY5+2, 30, nHeight, Label = self.dUI.get("adverb", "#err"), FontDescriptor = xFDSubTitle, HelpText = ":W")
          143  +        self.xX = self._addWidget('other', 'RadioButton', nX1, nY6+2, 30, nHeight, Label = self.dUI.get("other", "#err"), FontDescriptor = xFDSubTitle, HelpText = ":X")
   143    144           
   144    145           # Nom, adjectif
   145    146           self._addWidget("fl_nom_adj", 'FixedLine', nX1, nY2, 190, nHeight, Label = self.dUI.get("common_name", "#err"), FontDescriptor = xFDSubTitle)
   146    147           self.xSepi = self._addWidget('Sepi', 'RadioButton', nX1+65, nY2+12, 50, nHeight, Label = self.dUI.get("epi", "#err"), HelpText = ":e")
   147    148           self.xSmas = self._addWidget('Smas', 'RadioButton', nX1+65, nY2+22, 50, nHeight, Label = self.dUI.get("mas", "#err"), HelpText = ":m")
   148    149           self.xSfem = self._addWidget('Sfem', 'RadioButton', nX1+65, nY2+32, 50, nHeight, Label = self.dUI.get("fem", "#err"), HelpText = ":f")
   149    150           self._addWidget("fl_sep1", 'FixedLine', nX1, nY2, 1, nHeight)
   150         -        self.xSs = self._addWidget('S-s', 'RadioButton', nX1+120, nY2+12, 50, nHeight, Label = self.dUI.get("-s", "#err"), HelpText = "·s")
   151         -        self.xSx = self._addWidget('S-x', 'RadioButton', nX1+120, nY2+22, 50, nHeight, Label = self.dUI.get("-x", "#err"), HelpText = "·x")
          151  +        self.xSs = self._addWidget('Ss', 'RadioButton', nX1+120, nY2+12, 50, nHeight, Label = self.dUI.get("-s", "#err"), HelpText = "·s")
          152  +        self.xSx = self._addWidget('Sx', 'RadioButton', nX1+120, nY2+22, 50, nHeight, Label = self.dUI.get("-x", "#err"), HelpText = "·x")
   152    153           self.xSinv = self._addWidget('Sinv', 'RadioButton', nX1+120, nY2+32, 50, nHeight, Label = self.dUI.get("inv", "#err"), HelpText = ":i")
   153    154   
   154    155           self._addWidget("alt_lemma_label", 'FixedLine', nX1+10, nY2+42, 180, nHeight, Label = self.dUI.get("alt_lemma", "#err"))
   155    156           self.xAltLemma = self._addWidget('alt_lemma', 'Edit', nX1+10, nY2+52, 120, nHeight)
   156    157           self.xNA2 = self._addWidget('nom_adj2', 'RadioButton', nX1+10, nY2+65, 60, nHeight, Label = self.dUI.get("nom_adj", "#err"), HelpText = ":N:A")
   157    158           self.xN2 = self._addWidget('nom2', 'RadioButton', nX1+10, nY2+75, 60, nHeight, Label = self.dUI.get("nom", "#err"), HelpText = ":N")
   158    159           self.xA2 = self._addWidget('adj2', 'RadioButton', nX1+10, nY2+85, 60, nHeight, Label = self.dUI.get("adj", "#err"), HelpText = ":A")
   159    160           self._addWidget("fl_sep2", 'FixedLine', nX1, nY2, 1, nHeight)
   160    161           self.xSepi2 = self._addWidget('Sepi2', 'RadioButton', nX1+75, nY2+65, 50, nHeight, Label = self.dUI.get("epi", "#err"), HelpText = ":e")
   161    162           self.xSmas2 = self._addWidget('Smas2', 'RadioButton', nX1+75, nY2+75, 50, nHeight, Label = self.dUI.get("mas", "#err"), HelpText = ":m")
   162    163           self.xSfem2 = self._addWidget('Sfem2', 'RadioButton', nX1+75, nY2+85, 50, nHeight, Label = self.dUI.get("fem", "#err"), HelpText = ":f")
   163    164           self._addWidget("fl_sep3", 'FixedLine', nX1, nY2, 1, nHeight)
   164         -        self.xSs2 = self._addWidget('S-s2', 'RadioButton', nX1+130, nY2+65, 50, nHeight, Label = self.dUI.get("-s", "#err"), HelpText = "·s")
   165         -        self.xSx2 = self._addWidget('S-x2', 'RadioButton', nX1+130, nY2+75, 50, nHeight, Label = self.dUI.get("-x", "#err"), HelpText = "·x")
          165  +        self.xSs2 = self._addWidget('Ss2', 'RadioButton', nX1+130, nY2+65, 50, nHeight, Label = self.dUI.get("-s", "#err"), HelpText = "·s")
          166  +        self.xSx2 = self._addWidget('Sx2', 'RadioButton', nX1+130, nY2+75, 50, nHeight, Label = self.dUI.get("-x", "#err"), HelpText = "·x")
   166    167           self.xSinv2 = self._addWidget('Sinv2', 'RadioButton', nX1+130, nY2+85, 50, nHeight, Label = self.dUI.get("inv", "#err"), HelpText = ":i")
   167    168   
   168    169           # Nom propre
   169    170           self._addWidget("fl_M", 'FixedLine', nX1, nY3, 190, nHeight, Label = self.dUI.get("proper_name", "#err"), FontDescriptor = xFDSubTitle)
   170    171           self.xMepi = self._addWidget('Mepi', 'RadioButton', nX1+65, nY3+12, 50, nHeight, Label = self.dUI.get("epi", "#err"), HelpText = ":e")
   171    172           self.xMmas = self._addWidget('Mmas', 'RadioButton', nX1+65, nY3+22, 50, nHeight, Label = self.dUI.get("mas", "#err"), HelpText = ":m")
   172    173           self.xMfem = self._addWidget('Mfem', 'RadioButton', nX1+65, nY3+32, 50, nHeight, Label = self.dUI.get("fem", "#err"), HelpText = ":f")
   173    174   
   174    175           # Verbe
   175         -        self._addWidget("fl_verb", 'FixedLine', nX2, nY4, 180, nHeight, Label = self.dUI.get("verb", "#err"), FontDescriptor = xFDSubTitle)
          176  +        self._addWidget("fl_verb", 'FixedLine', nX2+30, nY4, 150, nHeight, FontDescriptor = xFDSubTitle)
   176    177           self.xV_i = self._addWidget('v_i', 'CheckBox', nX2, nY4+12, 60, nHeight, Label = self.dUI.get("v_i", "#err"))
   177    178           self.xV_t = self._addWidget('v_t', 'CheckBox', nX2, nY4+20, 60, nHeight, Label = self.dUI.get("v_t", "#err"))
   178    179           self.xV_n = self._addWidget('v_n', 'CheckBox', nX2, nY4+28, 60, nHeight, Label = self.dUI.get("v_n", "#err"))
   179    180           self.xV_p = self._addWidget('v_p', 'CheckBox', nX2, nY4+36, 60, nHeight, Label = self.dUI.get("v_p", "#err"))
   180    181           self.xV_m = self._addWidget('v_m', 'CheckBox', nX2, nY4+44, 60, nHeight, Label = self.dUI.get("v_m", "#err"))
   181    182   
   182    183           self._addWidget('aux', 'FixedText', nX2+75, nY4+10, 90, nHeight, Label = self.dUI.get("aux", "#err"))
................................................................................
   185    186   
   186    187           self.xV_pp = self._addWidget('v_pp', 'CheckBox', nX2+75, nY4+44, 90, nHeight, Label = self.dUI.get("v_pp", "#err"))
   187    188   
   188    189           self._addWidget('v_pattern_label', 'FixedText', nX2+10, nY4+56, 70, nHeight, Label = self.dUI.get('v_pattern', "#err"), Align = 2)
   189    190           self.xVpattern = self._addWidget('v_pattern', 'Edit', nX2+85, nY4+56, 80, nHeight)
   190    191   
   191    192           # Adverbe
   192         -        self._addWidget("fl_adv", 'FixedLine', nX2, nY5, 180, nHeight, Label = self.dUI.get("adverb", "#err"), FontDescriptor = xFDSubTitle)
          193  +        self._addWidget("fl_adv", 'FixedLine', nX2+30, nY5, 150, nHeight, FontDescriptor = xFDSubTitle)
   193    194   
   194    195           # Autre
   195         -        self._addWidget("fl_other", 'FixedLine', nX2, nY6, 180, nHeight, Label = self.dUI.get("other", "#err"), FontDescriptor = xFDSubTitle)
          196  +        self._addWidget("fl_other", 'FixedLine', nX2+30, nY6, 150, nHeight, FontDescriptor = xFDSubTitle)
   196    197           self._addWidget('flexion_label', 'FixedText', nX2, nY6+10, 85, nHeight, Label = self.dUI.get('flexion', "#err"))
   197    198           self.xFlexion = self._addWidget('flexion', 'Edit', nX2, nY6+20, 85, nHeight)
   198    199           self._addWidget('tags_label', 'FixedText', nX2+90, nY6+10, 85, nHeight, Label = self.dUI.get('tags', "#err"))
   199    200           self.xTags = self._addWidget('tags', 'Edit', nX2+90, nY6+20, 85, nHeight)
   200    201   
   201    202           #### Generated words
   202    203           self._addWidget("gwords_section", 'FixedLine', nXB, nY1, 200, nHeight, Label = self.dUI.get("new_section", "#err"), FontDescriptor = xFDTitle)
................................................................................
   230    231           ])
   231    232   
   232    233           # container
   233    234           self.xContainer = self.xSvMgr.createInstanceWithContext('com.sun.star.awt.UnoControlDialog', self.ctx)
   234    235           self.xContainer.setModel(self.xDialog)
   235    236           self.xGridControlNew = self.xContainer.getControl('list_grid_gwords')
   236    237           self.xGridControlLex = self.xContainer.getControl('list_grid_lexicon')
          238  +        #helpers.xray(self.xContainer.getControl('lemma'))
          239  +        self._createKeyListeners(['lemma', 'alt_lemma', "v_pattern", 'flexion', 'tags'], "Update")
          240  +        self._createActionListeners(['nom_adj', 'nom', 'adj', 'M1', 'M2', 'MP', 'verb', 'adv', 'other', \
          241  +                                     'Sepi', 'Smas', 'Sfem', 'Ss', 'Sx', 'Sinv', 'nom_adj2', 'nom2', 'adj2', \
          242  +                                     'Sepi2', 'Smas2', 'Sfem2', 'Ss2', 'Sx2', 'Sinv2', 'Mepi', 'Mmas', 'Mfem', \
          243  +                                     'v_i', 'v_t', 'v_n', 'v_p', 'v_m', 'v_ae', 'v_aa', 'v_pp'], "Update")
   237    244           self.xContainer.getControl('add_button').addActionListener(self)
   238    245           self.xContainer.getControl('add_button').setActionCommand('Add')
   239    246           self.xContainer.getControl('delete_button').addActionListener(self)
   240    247           self.xContainer.getControl('delete_button').setActionCommand('Delete')
   241    248           self.xContainer.getControl('save_button').addActionListener(self)
   242    249           self.xContainer.getControl('save_button').setActionCommand('Save')
   243         -        self.xContainer.getControl('generate_button').addActionListener(self)
   244         -        self.xContainer.getControl('generate_button').setActionCommand('Update')
          250  +        self.xContainer.getControl('close_button').addActionListener(self)
          251  +        self.xContainer.getControl('close_button').setActionCommand('Close')
   245    252           self.xContainer.setVisible(False)
   246    253           xToolkit = self.xSvMgr.createInstanceWithContext('com.sun.star.awt.ExtToolkit', self.ctx)
   247    254           self.xContainer.createPeer(xToolkit, None)
   248    255           self.xContainer.execute()
   249    256   
          257  +    def _createKeyListeners (self, lNames, sAction):
          258  +        for sName in lNames:
          259  +            self.xContainer.getControl(sName).addKeyListener(self)
          260  +
          261  +    def _createActionListeners (self, lNames, sAction):
          262  +        for sName in lNames:
          263  +            self.xContainer.getControl(sName).addActionListener(self)
          264  +            self.xContainer.getControl(sName).setActionCommand(sAction)
          265  +
   250    266       # XActionListener
   251    267       def actionPerformed (self, xActionEvent):
   252    268           try:
   253    269               if xActionEvent.ActionCommand == "Add":
   254         -                pass
          270  +                self.addToLexicon()
   255    271               elif xActionEvent.ActionCommand == "Delete":
   256    272                   pass
   257    273               elif xActionEvent.ActionCommand == "Save":
   258         -                pass
          274  +                self.saveLexicon()
   259    275               elif xActionEvent.ActionCommand == "Update":
   260    276                   self.updateGenWords()
   261    277               elif xActionEvent.ActionCommand == "Close":
   262    278                   self.xContainer.endExecute()
   263    279           except:
   264    280               traceback.print_exc()
   265    281       
          282  +    # XKeyListener
          283  +    def keyPressed (self, xKeyEvent):
          284  +        pass
          285  +
          286  +    def keyReleased (self, xKeyEvent):
          287  +        self.updateGenWords()
          288  +
   266    289       # XJobExecutor
   267    290       def trigger (self, args):
   268    291           try:
   269    292               xDialog = LexiconEditor(self.ctx)
   270    293               xDialog.run()
   271    294           except:
   272    295               traceback.print_exc()
   273    296   
   274    297       # Code
   275         -    def getRadioValue (self, *args):
          298  +    @_waitPointer
          299  +    def loadLexicon (self):
          300  +        pass
          301  +
          302  +    @_waitPointer
          303  +    def saveLexicon (self):
          304  +        xGridDataModel = self.xGridModelLex.GridDataModel
          305  +        lEntry = []
          306  +        for i in range(xGridDataModel.RowCount):
          307  +            lEntry.append(xGridDataModel.getRowData(i))
          308  +        oDAWG = dawg.DAWG(lEntry, "S", "fr", "Français", "Dictionnaire personnel")
          309  +
          310  +    def _getRadioValue (self, *args):
   276    311           for x in args:
   277    312               if x.State:
   278    313                   return x.HelpText
   279    314           return None
   280    315   
          316  +    @_waitPointer
   281    317       def updateGenWords (self):
   282    318           self.lGeneratedFlex = []
   283    319           sLemma = self.xLemma.Text.strip()
   284    320           if sLemma:
   285         -            if self.getRadioValue(self.xNA, self.xN, self.xA):
          321  +            if self._getRadioValue(self.xNA, self.xN, self.xA):
   286    322                   # Substantif
   287         -                sPOS = self.getRadioValue(self.xNA, self.xN, self.xA)
   288         -                sGenderTag = self.getRadioValue(self.xSepi, self.xSmas, self.xSfem)
          323  +                sPOS = self._getRadioValue(self.xNA, self.xN, self.xA)
          324  +                sGenderTag = self._getRadioValue(self.xSepi, self.xSmas, self.xSfem)
   289    325                   if sGenderTag:
   290    326                       if self.xSs.State:
   291    327                           self.lGeneratedFlex.append((sLemma, sLemma, sPOS+sGenderTag+":s/*"))
   292    328                           self.lGeneratedFlex.append((sLemma+"s", sLemma, sPOS+sGenderTag+":p/*"))
   293    329                       elif self.xSx.State:
   294    330                           self.lGeneratedFlex.append((sLemma, sLemma, sPOS+sGenderTag+":s/*"))
   295    331                           self.lGeneratedFlex.append((sLemma+"x", sLemma, sPOS+sGenderTag+":p/*"))
   296    332                       elif self.xSinv.State:
   297    333                           self.lGeneratedFlex.append((sLemma, sLemma, sPOS+sGenderTag+":i/*"))
   298    334                       sLemma2 = self.xAltLemma.Text.strip()
   299         -                    if sLemma2 and self.getRadioValue(self.xNA2, self.xN2, self.xA2) and self.getRadioValue(self.xSepi2, self.xSmas2, self.xSfem2):
   300         -                        sTag2 = self.getRadioValue(self.xNA2, self.xN2, self.xA2) + self.getRadioValue(self.xSepi2, self.xSmas2, self.xSfem2)
          335  +                    if sLemma2 and self._getRadioValue(self.xNA2, self.xN2, self.xA2) and self._getRadioValue(self.xSepi2, self.xSmas2, self.xSfem2):
          336  +                        sTag2 = self._getRadioValue(self.xNA2, self.xN2, self.xA2) + self._getRadioValue(self.xSepi2, self.xSmas2, self.xSfem2)
   301    337                           if self.xSs2.State:
   302    338                               self.lGeneratedFlex.append((sLemma2, sLemma, sTag2+":s/*"))
   303    339                               self.lGeneratedFlex.append((sLemma2+"s", sLemma, sTag2+":p/*"))
   304    340                           elif self.xSx2.State:
   305    341                               self.lGeneratedFlex.append((sLemma2, sLemma, sTag2+":s/*"))
   306    342                               self.lGeneratedFlex.append((sLemma2+"x", sLemma, sTag2+":p/*"))
   307    343                           elif self.xSinv2.State:
   308    344                               self.lGeneratedFlex.append((sLemma2, sLemma, sTag2+":i/*"))
   309         -            elif self.getRadioValue(self.xM1, self.xM2, self.xMP):
          345  +            elif self._getRadioValue(self.xM1, self.xM2, self.xMP):
   310    346                   # Nom propre
   311         -                sPOS = self.getRadioValue(self.xM1, self.xM2, self.xMP)
          347  +                sPOS = self._getRadioValue(self.xM1, self.xM2, self.xMP)
   312    348                   sLemma = sLemma[0:1].upper() + sLemma[1:];
   313         -                sGenderTag = self.getRadioValue(self.xMepi, self.xMmas, self.xMfem)
          349  +                sGenderTag = self._getRadioValue(self.xMepi, self.xMmas, self.xMfem)
   314    350                   if sGenderTag:
   315    351                       self.lGeneratedFlex.append((sLemma, sLemma, sPOS+sGenderTag+":i/*"))
   316    352               elif self.xV.State:
   317    353                   # Verbe
   318    354                   if sLemma.endswith(("er", "ir", "re")):
   319    355                       sLemma = sLemma.lower()
   320    356                       c_i = "i"  if self.xV_i.State  else "_"
................................................................................
   367    403                   self.lGeneratedFlex.append((sLemma, sLemma, ":W/*"))
   368    404               elif self.xX.State:
   369    405                   # Autre
   370    406                   sFlexion = self.xFlexion.Text.strip()
   371    407                   sTags = self.xTags.Text.strip()
   372    408                   if sFlexion and sTags.startswith(":"):
   373    409                       self.lGeneratedFlex.append((sFlexion, sLemma, sTags))
   374         -        self.showGenWords()
          410  +        self._showGenWords()
   375    411   
   376    412       def _getConjRules (self, sVerb):
   377    413           if sVerb.endswith("ir"):
   378    414               # deuxième groupe
   379    415               return lxe_conj_data.oConj["V2"]
   380    416           elif sVerb.endswith("er"):
   381    417               # premier groupe, conjugaison en fonction de la terminaison du lemme
................................................................................
   391    427               if sVerb[-3:] in lxe_conj_data.oConj["V1"]:
   392    428                   return lxe_conj_data.oConj["V1"][sVerb[-3:]]
   393    429               return lxe_conj_data.oConj["V1"]["er"]
   394    430           else:
   395    431               # troisième groupe
   396    432               return [ [0, "", ":Y/*", false] ]
   397    433   
   398         -    def showGenWords (self):
          434  +    def _showGenWords (self):
   399    435           xGridDataModel = self.xGridModelNew.GridDataModel
   400    436           xGridDataModel.removeAllRows()
   401    437           if not self.lGeneratedFlex:
   402    438               self.xAdd.Enabled = False
   403    439               return
   404    440           for i, (sFlexion, sLemma, sTag) in enumerate(self.lGeneratedFlex):
   405    441               xGridDataModel.addRow(i, (sFlexion, sLemma, sTag))
   406    442           self.xAdd.Enabled = True
   407    443   
   408         -    @_waitPointer
   409         -    def add (self):
   410         -        pass
          444  +    def _resetWidgets (self):
          445  +        self.xLemma.Text = ""
          446  +        self.xNA.State = False
          447  +        self.xN.State = False
          448  +        self.xA.State = False
          449  +        self.xM1.State = False
          450  +        self.xM2.State = False
          451  +        self.xMP.State = False
          452  +        self.xV.State = False
          453  +        self.xW.State = False
          454  +        self.xX.State = False
          455  +        self.xSepi.State = False
          456  +        self.xSmas.State = False
          457  +        self.xSfem.State = False
          458  +        self.xSs.State = False
          459  +        self.xSx.State = False
          460  +        self.xSinv.State = False
          461  +        self.xAltLemma.Text = ""
          462  +        self.xNA2.State = False
          463  +        self.xN2.State = False
          464  +        self.xA2.State = False
          465  +        self.xSepi2.State = False
          466  +        self.xSmas2.State = False
          467  +        self.xSfem2.State = False
          468  +        self.xSs2.State = False
          469  +        self.xSx2.State = False
          470  +        self.xSinv2.State = False
          471  +        self.xMepi.State = False
          472  +        self.xMmas.State = False
          473  +        self.xMfem.State = False
          474  +        self.xV_i.State = False
          475  +        self.xV_t.State = False
          476  +        self.xV_n.State = False
          477  +        self.xV_p.State = False
          478  +        self.xV_m.State = False
          479  +        self.xV_ae.State = False
          480  +        self.xV_aa.State = False
          481  +        self.xV_pp.State = False
          482  +        self.xVpattern.Text = ""
          483  +        self.xFlexion.Text = ""
          484  +        self.xTags.Text = ""
          485  +        self.xGridModelNew.GridDataModel.removeAllRows()
   411    486   
   412    487       @_waitPointer
   413         -    def delete (self):
   414         -        pass
          488  +    def addToLexicon (self):
          489  +        self.xAdd.Enabled = False
          490  +        xGridDataModelNew = self.xGridModelNew.GridDataModel
          491  +        xGridDataModelLex = self.xGridModelLex.GridDataModel
          492  +        nStart = xGridDataModelLex.RowCount
          493  +        for i in range(xGridDataModelNew.RowCount):
          494  +            sFlexion, sLemma, sTag = xGridDataModelNew.getRowData(i)
          495  +            xGridDataModelLex.addRow(nStart + i, (sFlexion, sLemma, sTag))
          496  +        self.xSave.Enabled = True
          497  +        self._resetWidgets()
   415    498   
   416    499       @_waitPointer
   417         -    def loadLexicon (self):
   418         -        pass
          500  +    def delete (self, xList):
          501  +        xGridDataModel = xList.GridDataModel
   419    502   
   420         -    @_waitPointer
   421         -    def saveLexicon (self):
   422         -        pass    
   423    503   
   424    504   
   425    505   #g_ImplementationHelper = unohelper.ImplementationHelper()
   426    506   #g_ImplementationHelper.addImplementation(LexiconEditor, 'net.grammalecte.LexiconEditor', ('com.sun.star.task.Job',))
   427         -
   428         -
   429         -# const oFlexGen = {
   430         -
   431         -#     cMainTag: "",
   432         -
   433         -#     lFlexion: [],
   434         -
   435         -#     clear: function () {
   436         -#         this.lFlexion = [];
   437         -#         oWidgets.hideElement("actions");
   438         -#     },
   439         -
   440         -#     addToLexicon: function () {
   441         -#         try {
   442         -#             oLexicon.addFlexions(this.lFlexion);
   443         -#             document.getElementById("lemma").value = "";
   444         -#             document.getElementById("lemma").focus();
   445         -#             oWidgets.showSection("section_vide");
   446         -#             oWidgets.hideElement("editor");
   447         -#             oWidgets.hideElement("actions");
   448         -#             oWidgets.clear();
   449         -#             oWidgets.showElement("save_button");
   450         -#             this.clear();
   451         -#             this.cMainTag = "";
   452         -#         }
   453         -#         catch (e) {
   454         -#             showError(e);
   455         -#         }
   456         -#     }
   457         -# }

Modified gc_lang/fr/oxt/DictOptions/lxe_strings.py from [d169176bce] to [c601c28a63].

     6      6   dStrings = {
     7      7       "fr": {
     8      8           "title": "Grammalecte · Éditeur lexical",
     9      9   
    10     10           # Ajout
    11     11           "add_section": "Nouveau mot (lemme)",
    12     12           "lemma": "Lemme",
    13         -        "generate_button": "Créer",
    14     13   
    15     14           # catégories
    16     15           "common_name": "Nom commun",
    17     16           "nom_adj": "Nom et adjectif",
    18     17           "nom": "Nom",
    19     18           "adj": "Adjectif",
    20     19           "alt_lemma": "[optionnel] Autre forme (masculine, féminine, variante, etc.)",
    21         -      
           20  +
    22     21           "proper_name": "Nom propre",
    23     22           "M1": "Prénom",
    24     23           "M2": "Patronyme",
    25     24           "MP": "Autre",
    26     25   
    27     26           "gender": "Genre",
    28     27           "epi": "épicène",