Grammalecte  Check-in [4b27c6f0ef]

Overview
Comment:[lo] moving FilePicker test to import command
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | lo
Files: files | file ages | folders
SHA3-256: 4b27c6f0efb1b584690804e03522a66feb5e875aa16c4976f0ae5c28eba99fb9
User & Date: olr on 2018-04-14 12:15:09
Other Links: manifest | tags
Context
2018-04-14
12:33
[fr] confusion à le/la/les +Vconj check-in: a4f90241d1 user: olr tags: fr, trunk
12:15
[lo] moving FilePicker test to import command check-in: 4b27c6f0ef user: olr tags: lo, trunk
2018-04-13
15:47
[lo] lexicon editor: widen label check-in: e1af0d2719 user: olr tags: lo, trunk
Changes

Modified gc_lang/fr/oxt/DictOptions/LexiconEditor.py from [c909e5a543] to [bbf80e041f].

369
370
371
372
373
374
375













376
377
378
379
380
381
382
...
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
        else:
            self.xNumLex.Label = 0
            self.xNumDic.Label = 0
            self.xDateDic.Label = self.dUI.get("void", "#err")

    @_waitPointer
    def importDictionary (self):













        spfImported = os.path.join(os.environ['USERPROFILE'], "fr.personal.json")
        if os.path.isfile(spfImported):
            with open(spfImported, "r", encoding="utf-8") as hDst:
                sJSON = hDst.read()
                try:
                    sTest = json.loads(sJSON)
                except:
................................................................................
            else:
                sMessage = self.dUI.get('empty_dictionary', "#err")
            MessageBox(self.xDocument, sMessage, self.dUI.get('export_title', "#err"))
        except:
            sMessage = traceback.format_exc()
            MessageBox(self.xDocument, sMessage, self.dUI.get('export_title', "#err"), ERRORBOX)

        # FilePicker doesn’t work at all…
        #xFilePicker = self.xSvMgr.createInstanceWithContext('com.sun.star.ui.dialogs.SystemFilePicker', self.ctx)
        #xFilePicker.appendFilter("Supported files", "*.json; *.bdic")
        #xFilePicker.setDisplayDirectory("")
        #xFilePicker.setMultiSelectionMode(True)
        #nResult = xFilePicker.execute()
        #if nResult == 1:
            #pass
            #lFile = xFilePicker.getSelectedFiles()
            #lFile = xFilePicker.getFiles()

    def _getRadioValue (self, *args):
        for x in args:
            if x.State:
                return x.HelpText
        return None

    @_waitPointer







>
>
>
>
>
>
>
>
>
>
>
>
>







 







<
<
<
<
<
<
<
<
<
<
<







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
...
433
434
435
436
437
438
439











440
441
442
443
444
445
446
        else:
            self.xNumLex.Label = 0
            self.xNumDic.Label = 0
            self.xDateDic.Label = self.dUI.get("void", "#err")

    @_waitPointer
    def importDictionary (self):
        # FilePicker doesn’t work at all…
        #xFilePicker = self.xSvMgr.createInstanceWithContext('com.sun.star.ui.dialogs.FilePicker', self.ctx)  # other possibility: com.sun.star.ui.dialogs.SystemFilePicker
        #xFilePicker.initialize([uno.getConstantByName("com.sun.star.ui.dialogs.TemplateDescription.FILEOPEN_SIMPLE")]) # seems useless
        #xFilePicker.appendFilter("Supported files", "*.json; *.bdic")
        #xFilePicker.setDefaultName("fr.personal.json") # useless, doesn’t work
        #xFilePicker.setDisplayDirectory("")
        #xFilePicker.setMultiSelectionMode(False)
        #nResult = xFilePicker.execute()
        #if nResult == 1:
        #    lFile = xFilePicker.getSelectedFiles()
        #    lFile = xFilePicker.getFiles()
        #    print(lFile)
        # workaround
        spfImported = os.path.join(os.environ['USERPROFILE'], "fr.personal.json")
        if os.path.isfile(spfImported):
            with open(spfImported, "r", encoding="utf-8") as hDst:
                sJSON = hDst.read()
                try:
                    sTest = json.loads(sJSON)
                except:
................................................................................
            else:
                sMessage = self.dUI.get('empty_dictionary', "#err")
            MessageBox(self.xDocument, sMessage, self.dUI.get('export_title', "#err"))
        except:
            sMessage = traceback.format_exc()
            MessageBox(self.xDocument, sMessage, self.dUI.get('export_title', "#err"), ERRORBOX)












    def _getRadioValue (self, *args):
        for x in args:
            if x.State:
                return x.HelpText
        return None

    @_waitPointer