Overview
Comment: | [lo][fr][py] conjugueur: table de conjugaison dans le module conj au lieu de l’ui |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk | fr | lo |
Files: | files | file ages | folders |
SHA3-256: |
b8c51fb5f6f74092435b22b756d648eb |
User & Date: | olr on 2019-05-06 10:30:18 |
Original Comment: | [fr][py] conjugueur: table de conjugaison dans le module conj au lieu de l’ui |
Other Links: | manifest | tags |
Context
2019-05-06
| ||
13:55 | [lo] conjugueur: code clarification check-in: 32fd16071a user: olr tags: trunk, lo | |
10:30 | [lo][fr][py] conjugueur: table de conjugaison dans le module conj au lieu de l’ui check-in: b8c51fb5f6 user: olr tags: trunk, fr, lo | |
08:49 | [fr] faux positif check-in: 93e1325a10 user: olr tags: trunk, fr | |
Changes
Modified gc_lang/fr/modules/conj.py from [258383e97f] to [fb581126e7].
︙ | ︙ | |||
172 173 174 175 176 177 178 179 180 181 182 183 184 185 | self.sInfo = self._readableInfo() self.bProWithEn = (self._sRawInfo[5] == "e") self._tTags = _getTags(sVerbPattern) if not self._tTags: raise ValueError("Unknown verb.") self._tTagsAux = _getTags(self.sVerbAux) self.cGroup = self._sRawInfo[0] self.dConj = { ":Y": { "label": "Infinitif", ":": sVerb, }, ":P": { "label": "Participe présent", | > > > > > > > > > > > > > > | 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 | self.sInfo = self._readableInfo() self.bProWithEn = (self._sRawInfo[5] == "e") self._tTags = _getTags(sVerbPattern) if not self._tTags: raise ValueError("Unknown verb.") self._tTagsAux = _getTags(self.sVerbAux) self.cGroup = self._sRawInfo[0] self.bUncomplete = self._sRawInfo.endswith("zz") self.sProLabel = "pronominal" if self._sRawInfo[5] == "_": self.nPronominable = -1 elif self._sRawInfo[5] in ["q", "u", "v", "e"]: self.nPronominable = 0 elif self._sRawInfo[5] == "p" or self._sRawInfo[5] == "r": self.nPronominable = 1 elif self._sRawInfo[5] == "x": self.sProLabel = "cas particuliers" self.nPronominable = 2 else: self.sProLabel = "# erreur #" self.nPronominable = -1 self.dConj = { ":Y": { "label": "Infinitif", ":": sVerb, }, ":P": { "label": "Participe présent", |
︙ | ︙ | |||
455 456 457 458 459 460 461 | return self.dConj[":Q"][":Q2"] if bPlur and self.dConj[":Q"][":Q2"] else self.dConj[":Q"][":Q1"] if not bPlur: return self.dConj[":Q"][":Q3"] if self.dConj[":Q"][":Q3"] else self.dConj[":Q"][":Q1"] return self.dConj[":Q"][":Q4"] if self.dConj[":Q"][":Q4"] else self.dConj[":Q"][":Q1"] except: traceback.print_exc() return "# erreur" | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 | return self.dConj[":Q"][":Q2"] if bPlur and self.dConj[":Q"][":Q2"] else self.dConj[":Q"][":Q1"] if not bPlur: return self.dConj[":Q"][":Q3"] if self.dConj[":Q"][":Q3"] else self.dConj[":Q"][":Q1"] return self.dConj[":Q"][":Q4"] if self.dConj[":Q"][":Q4"] else self.dConj[":Q"][":Q1"] except: traceback.print_exc() return "# erreur" def createConjTable (self, bPro=False, bNeg=False, bTpsCo=False, bInt=False, bFem=False): dConjTable = { "t_infi": "Infinitif", "infi": self.infinitif(bPro, bNeg, bTpsCo, bInt, bFem), "t_ppre": "Participe présent", "ppre": self.participePresent(bPro, bNeg, bTpsCo, bInt, bFem), "t_ppas": "Participes passés", "ppas1": self.participePasse(":Q1"), "ppas2": self.participePasse(":Q2"), "ppas3": self.participePasse(":Q3"), "ppas4": self.participePasse(":Q4"), "t_imp": "Impératif", "t_impe": "" if bInt else "Présent" if not bTpsCo else "Passé", "impe1": self.imperatif(":2s", bPro, bNeg, bTpsCo, bFem) if not bInt else "", "impe2": self.imperatif(":1p", bPro, bNeg, bTpsCo, bFem) if not bInt else "", "impe3": self.imperatif(":2p", bPro, bNeg, bTpsCo, bFem) if not bInt else "", "t_indi": "Indicatif", "t_ipre": "Présent" if not bTpsCo else "Passé composé", "ipre1": self.conjugue(":Ip", ":1s", bPro, bNeg, bTpsCo, bInt, bFem), "ipre2": self.conjugue(":Ip", ":2s", bPro, bNeg, bTpsCo, bInt, bFem), "ipre3": self.conjugue(":Ip", ":3s", bPro, bNeg, bTpsCo, bInt, bFem), "ipre4": self.conjugue(":Ip", ":1p", bPro, bNeg, bTpsCo, bInt, bFem), "ipre5": self.conjugue(":Ip", ":2p", bPro, bNeg, bTpsCo, bInt, bFem), "ipre6": self.conjugue(":Ip", ":3p", bPro, bNeg, bTpsCo, bInt, bFem), "t_iimp": "Imparfait" if not bTpsCo else "Plus-que-parfait", "iimp1": self.conjugue(":Iq", ":1s", bPro, bNeg, bTpsCo, bInt, bFem), "iimp2": self.conjugue(":Iq", ":2s", bPro, bNeg, bTpsCo, bInt, bFem), "iimp3": self.conjugue(":Iq", ":3s", bPro, bNeg, bTpsCo, bInt, bFem), "iimp4": self.conjugue(":Iq", ":1p", bPro, bNeg, bTpsCo, bInt, bFem), "iimp5": self.conjugue(":Iq", ":2p", bPro, bNeg, bTpsCo, bInt, bFem), "iimp6": self.conjugue(":Iq", ":3p", bPro, bNeg, bTpsCo, bInt, bFem), "t_ipsi": "Passé simple" if not bTpsCo else "Passé antérieur", "ipsi1": self.conjugue(":Is", ":1s", bPro, bNeg, bTpsCo, bInt, bFem), "ipsi2": self.conjugue(":Is", ":2s", bPro, bNeg, bTpsCo, bInt, bFem), "ipsi3": self.conjugue(":Is", ":3s", bPro, bNeg, bTpsCo, bInt, bFem), "ipsi4": self.conjugue(":Is", ":1p", bPro, bNeg, bTpsCo, bInt, bFem), "ipsi5": self.conjugue(":Is", ":2p", bPro, bNeg, bTpsCo, bInt, bFem), "ipsi6": self.conjugue(":Is", ":3p", bPro, bNeg, bTpsCo, bInt, bFem), "t_ifut": "Futur" if not bTpsCo else "Futur antérieur", "ifut1": self.conjugue(":If", ":1s", bPro, bNeg, bTpsCo, bInt, bFem), "ifut2": self.conjugue(":If", ":2s", bPro, bNeg, bTpsCo, bInt, bFem), "ifut3": self.conjugue(":If", ":3s", bPro, bNeg, bTpsCo, bInt, bFem), "ifut4": self.conjugue(":If", ":1p", bPro, bNeg, bTpsCo, bInt, bFem), "ifut5": self.conjugue(":If", ":2p", bPro, bNeg, bTpsCo, bInt, bFem), "ifut6": self.conjugue(":If", ":3p", bPro, bNeg, bTpsCo, bInt, bFem), "t_cond": "Conditionnel", "t_conda": "Présent" if not bTpsCo else "Passé (1ʳᵉ forme)", "conda1": self.conjugue(":K", ":1s", bPro, bNeg, bTpsCo, bInt, bFem), "conda2": self.conjugue(":K", ":2s", bPro, bNeg, bTpsCo, bInt, bFem), "conda3": self.conjugue(":K", ":3s", bPro, bNeg, bTpsCo, bInt, bFem), "conda4": self.conjugue(":K", ":1p", bPro, bNeg, bTpsCo, bInt, bFem), "conda5": self.conjugue(":K", ":2p", bPro, bNeg, bTpsCo, bInt, bFem), "conda6": self.conjugue(":K", ":3p", bPro, bNeg, bTpsCo, bInt, bFem), "t_condb": "" if not bTpsCo else "Passé (2ᵉ forme)", "condb1": self.conjugue(":Sq", ":1s", bPro, bNeg, bTpsCo, bInt, bFem) if bTpsCo else "", "condb2": self.conjugue(":Sq", ":2s", bPro, bNeg, bTpsCo, bInt, bFem) if bTpsCo else "", "condb3": self.conjugue(":Sq", ":3s", bPro, bNeg, bTpsCo, bInt, bFem) if bTpsCo else "", "condb4": self.conjugue(":Sq", ":1p", bPro, bNeg, bTpsCo, bInt, bFem) if bTpsCo else "", "condb5": self.conjugue(":Sq", ":2p", bPro, bNeg, bTpsCo, bInt, bFem) if bTpsCo else "", "condb6": self.conjugue(":Sq", ":3p", bPro, bNeg, bTpsCo, bInt, bFem) if bTpsCo else "", "t_subj": "Subjonctif", "t_spre": "" if bInt else "Présent" if not bTpsCo else "Passé", "spre1": self.conjugue(":Sp", ":1s", bPro, bNeg, bTpsCo, bInt, bFem) if not bInt else "", "spre2": self.conjugue(":Sp", ":2s", bPro, bNeg, bTpsCo, bInt, bFem) if not bInt else "", "spre3": self.conjugue(":Sp", ":3s", bPro, bNeg, bTpsCo, bInt, bFem) if not bInt else "", "spre4": self.conjugue(":Sp", ":1p", bPro, bNeg, bTpsCo, bInt, bFem) if not bInt else "", "spre5": self.conjugue(":Sp", ":2p", bPro, bNeg, bTpsCo, bInt, bFem) if not bInt else "", "spre6": self.conjugue(":Sp", ":3p", bPro, bNeg, bTpsCo, bInt, bFem) if not bInt else "", "t_simp": "" if bInt else "Imparfait" if not bTpsCo else "Plus-que-parfait", "simp1": self.conjugue(":Sq", ":1s", bPro, bNeg, bTpsCo, bInt, bFem) if not bInt else "", "simp2": self.conjugue(":Sq", ":2s", bPro, bNeg, bTpsCo, bInt, bFem) if not bInt else "", "simp3": self.conjugue(":Sq", ":3s", bPro, bNeg, bTpsCo, bInt, bFem) if not bInt else "", "simp4": self.conjugue(":Sq", ":1p", bPro, bNeg, bTpsCo, bInt, bFem) if not bInt else "", "simp5": self.conjugue(":Sq", ":2p", bPro, bNeg, bTpsCo, bInt, bFem) if not bInt else "", "simp6": self.conjugue(":Sq", ":3p", bPro, bNeg, bTpsCo, bInt, bFem) if not bInt else "" } return dConjTable |
Modified gc_lang/fr/oxt/Conjugueur/Conjugueur.py from [79fb2363d1] to [04a573e2a5].
︙ | ︙ | |||
244 245 246 247 248 249 250 | def actionPerformed (self, xActionEvent): try: if xActionEvent.ActionCommand == 'Close': self.xContainer.endExecute() elif xActionEvent.ActionCommand == 'New': self._newVerb() elif xActionEvent.ActionCommand == 'Change': | > | | 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 | def actionPerformed (self, xActionEvent): try: if xActionEvent.ActionCommand == 'Close': self.xContainer.endExecute() elif xActionEvent.ActionCommand == 'New': self._newVerb() elif xActionEvent.ActionCommand == 'Change': if self.oVerb: self._displayResults(self.oVerb.createConjTable(self.opro.State, self.oneg.State, self.otco.State, self.oint.State, self.ofem.State)) else: print(str(xActionEvent)) except: traceback.print_exc() # XJobExecutor def trigger (self, args): |
︙ | ︙ | |||
267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 | self.opro.State = False self.oint.State = False self.otco.State = False self.ofem.State = False # request analyzing sVerb = self.input.Text.strip().lower().replace(u"’", "'").replace(" ", " ") if sVerb: if sVerb.startswith("ne pas "): self.oneg.State = True sVerb = sVerb[7:] if sVerb.startswith("se "): self.opro.State = True sVerb = sVerb[3:] elif sVerb.startswith("s'"): self.opro.State = True sVerb = sVerb[2:] if sVerb.endswith("?"): self.oint.State = True sVerb = sVerb.rstrip(" ?") if not conj_fr.isVerb(sVerb): self.input.TextColor = 0xAA2200 else: self.input.TextColor = 0x666666 self.oVerb = conj_fr.Verb(sVerb) | > < | | < < < | | | < < < < | < | | | | > > > > | | | | | | > > > | | < | | | | | | > > | | | | | < < < < < < < < < < < < | > > | | | | | | > | | | | | | | > > | | | | | | > | | | > > > | | | | | | | | > | | | | | | | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 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 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 | self.opro.State = False self.oint.State = False self.otco.State = False self.ofem.State = False # request analyzing sVerb = self.input.Text.strip().lower().replace(u"’", "'").replace(" ", " ") if sVerb: self.oVerb = None if sVerb.startswith("ne pas "): self.oneg.State = True sVerb = sVerb[7:] if sVerb.startswith("se "): self.opro.State = True sVerb = sVerb[3:] elif sVerb.startswith("s'"): self.opro.State = True sVerb = sVerb[2:] if sVerb.endswith("?"): self.oint.State = True sVerb = sVerb.rstrip(" ?") if not conj_fr.isVerb(sVerb): self.input.TextColor = 0xAA2200 else: self.input.TextColor = 0x666666 self.oVerb = conj_fr.Verb(sVerb) self.info.Label = self.oVerb.sInfo self.opro.Label = self.oVerb.sProLabel if self.oVerb.bUncomplete: self.opro.State = False self.opro.Enabled = False self.otco.State = False self.otco.Enabled = False self.option_msg.Label = self.sWarning else: self.otco.Enabled = True if self.oVerb.nPronominable == 0: self.opro.State = False self.opro.Enabled = True elif self.oVerb.nPronominable == 1: self.opro.State = True self.opro.Enabled = False else: # -1 or 1 or error self.opro.State = False self.opro.Enabled = False self.option_msg.Label = "" self._displayResults(self.oVerb.createConjTable(self.opro.State, self.oneg.State, self.otco.State, self.oint.State, self.ofem.State)) def _displayResults (self, dConjTable): try: self.input.Text = "" # infinitif self.infi.Label = dConjTable["infi"] # participe présent self.ppre.Label = dConjTable["ppre"] # participes passés self.ppas1.Label = dConjTable["ppas1"] self.ppas2.Label = dConjTable["ppas2"] self.ppas3.Label = dConjTable["ppas3"] self.ppas4.Label = dConjTable["ppas4"] # impératif self.impe.Label = dConjTable["t_impe"] self.impe1.Label = dConjTable["impe1"] self.impe2.Label = dConjTable["impe2"] self.impe3.Label = dConjTable["impe3"] # présent self.ipre.Label = dConjTable["t_ipre"] self.ipre1.Label = dConjTable["ipre1"] self.ipre2.Label = dConjTable["ipre2"] self.ipre3.Label = dConjTable["ipre3"] self.ipre4.Label = dConjTable["ipre4"] self.ipre5.Label = dConjTable["ipre5"] self.ipre6.Label = dConjTable["ipre6"] # imparfait self.iimp.Label = dConjTable["t_iimp"] self.iimp1.Label = dConjTable["iimp1"] self.iimp2.Label = dConjTable["iimp2"] self.iimp3.Label = dConjTable["iimp3"] self.iimp4.Label = dConjTable["iimp4"] self.iimp5.Label = dConjTable["iimp5"] self.iimp6.Label = dConjTable["iimp6"] # passé simple self.ipsi.Label = dConjTable["t_ipsi"] self.ipsi1.Label = dConjTable["ipsi1"] self.ipsi2.Label = dConjTable["ipsi2"] self.ipsi3.Label = dConjTable["ipsi3"] self.ipsi4.Label = dConjTable["ipsi4"] self.ipsi5.Label = dConjTable["ipsi5"] self.ipsi6.Label = dConjTable["ipsi6"] # futur self.ifut.Label = dConjTable["t_ifut"] self.ifut1.Label = dConjTable["ifut1"] self.ifut2.Label = dConjTable["ifut2"] self.ifut3.Label = dConjTable["ifut3"] self.ifut4.Label = dConjTable["ifut4"] self.ifut5.Label = dConjTable["ifut5"] self.ifut6.Label = dConjTable["ifut6"] # Conditionnel self.conda.Label = dConjTable["t_conda"] self.conda1.Label = dConjTable["conda1"] self.conda2.Label = dConjTable["conda2"] self.conda3.Label = dConjTable["conda3"] self.conda4.Label = dConjTable["conda4"] self.conda5.Label = dConjTable["conda5"] self.conda6.Label = dConjTable["conda6"] self.condb.Label = dConjTable["t_condb"] self.condb1.Label = dConjTable["condb1"] self.condb2.Label = dConjTable["condb2"] self.condb3.Label = dConjTable["condb3"] self.condb4.Label = dConjTable["condb4"] self.condb5.Label = dConjTable["condb5"] self.condb6.Label = dConjTable["condb6"] # subjonctif présent self.spre.Label = dConjTable["t_spre"] self.spre1.Label = dConjTable["spre1"] self.spre2.Label = dConjTable["spre2"] self.spre3.Label = dConjTable["spre3"] self.spre4.Label = dConjTable["spre4"] self.spre5.Label = dConjTable["spre5"] self.spre6.Label = dConjTable["spre6"] # subjonctif imparfait self.simp.Label = dConjTable["t_simp"] self.simp1.Label = dConjTable["simp1"] self.simp2.Label = dConjTable["simp2"] self.simp3.Label = dConjTable["simp3"] self.simp4.Label = dConjTable["simp4"] self.simp5.Label = dConjTable["simp5"] self.simp6.Label = dConjTable["simp6"] # refresh self.xContainer.setVisible(True) except: traceback.print_exc() # g_ImplementationHelper = unohelper.ImplementationHelper() # g_ImplementationHelper.addImplementation(Conjugueur, 'dicollecte.Conjugueur', ('com.sun.star.task.Job',)) |