예제 #1
0
 def trigger(self, sCmd):
     try:
         if sCmd == "About":
             import About
             xDialog = About.AboutGrammalecte(self.ctx)
             xDialog.run(self.sLang)
         elif sCmd.startswith("CJ"):
             import Conjugueur
             xDialog = Conjugueur.Conjugueur(self.ctx)
             if sCmd[2:3] == "/":
                 xDialog.run(sCmd[3:])
             else:
                 xDialog.run()
         elif sCmd == "TF":
             import TextFormatter
             xDialog = TextFormatter.TextFormatter(self.ctx)
             xDialog.run(self.sLang)
         elif sCmd == "DS":
             import DictionarySwitcher
             xDialog = DictionarySwitcher.FrenchDictionarySwitcher(self.ctx)
             xDialog.run(self.sLang)
         elif sCmd == "MA":
             import Author
             xDialog = Author.Author(self.ctx)
             xDialog.run(self.sLang)
         elif sCmd == "OP":
             import Options
             xDialog = Options.GC_Options(self.ctx)
             xDialog.run(self.sLang)
         elif sCmd.startswith("FA/"):
             findAll(sCmd[6:], (sCmd[3:4] == "y"), (sCmd[4:5] == "y"))
         # elif sCmd.startswith("URL/"):
         #     # Call from context menu to launch URL?
         #     # http://opengrok.libreoffice.org/xref/core/sw/source/ui/lingu/olmenu.cxx#785
         #     xSystemShellExecute = self.ctx.getServiceManager().createInstanceWithContext('com.sun.star.system.SystemShellExecute', self.ctx)
         #     xSystemShellExecute.execute(url, "", uno.getConstantByName("com.sun.star.system.SystemShellExecuteFlags.URIS_ONLY"))
         elif sCmd == "None":
             pass
         else:
             print("Unknown command: " + str(sCmd))
     except:
         traceback.print_exc()
예제 #2
0
 def trigger(self, sCmd):
     global xLEDialog
     try:
         if sCmd == "About":
             import About
             xAboutDialog = About.AboutGrammalecte(self.ctx)
             xAboutDialog.run(self.sLang)
         elif sCmd.startswith("CJ"):
             import Conjugueur
             xConjDialog = Conjugueur.Conjugueur(self.ctx)
             if sCmd[2:3] == "/":
                 xConjDialog.run(sCmd[3:])
             else:
                 xConjDialog.run()
         elif sCmd == "TF":
             import TextFormatter
             xTFDialog = TextFormatter.TextFormatter(self.ctx)
             xTFDialog.run(self.sLang)
         elif sCmd == "DI":
             import DictOptions
             xDODialog = DictOptions.DictOptions(self.ctx)
             xDODialog.run(self.sLang)
         elif sCmd.startswith("LE"):
             import LexiconEditor
             if not xLEDialog or xLEDialog.bClosed:
                 xLEDialog = LexiconEditor.LexiconEditor(self.ctx)
                 if sCmd[2:3] == "/":
                     xLEDialog.run(self.sLang, sCmd[3:])
                 else:
                     xLEDialog.run(self.sLang)
             elif sCmd[2:3] == "/":
                 xLEDialog.newEntry(sCmd[3:])
         elif sCmd == "MA":
             import Author
             xAuthorDialog = Author.Author(self.ctx)
             xAuthorDialog.run(self.sLang)
         elif sCmd == "OP":
             import Options
             xGCDialog = Options.GC_Options(self.ctx)
             xGCDialog.run(self.sLang)
         elif sCmd == "EN":
             import Enumerator
             xEnumDialog = Enumerator.Enumerator(self.ctx)
             xEnumDialog.run(self.sLang)
         elif sCmd == "GO":
             import GraphicOptions
             xGODialog = GraphicOptions.GraphicOptions(self.ctx)
             xGODialog.run(self.sLang)
         elif sCmd.startswith("FA/"):
             findAll(sCmd[6:], (sCmd[3:4] == "y"), (sCmd[4:5] == "y"))
         elif sCmd == "Console":
             helpers.startConsole()
         # elif sCmd.startswith("URL/"):
         #     # Call from context menu to launch URL?
         #     # http://opengrok.libreoffice.org/xref/core/sw/source/ui/lingu/olmenu.cxx#785
         #     xSystemShellExecute = self.ctx.getServiceManager().createInstanceWithContext('com.sun.star.system.SystemShellExecute', self.ctx)
         #     xSystemShellExecute.execute(url, "", uno.getConstantByName("com.sun.star.system.SystemShellExecuteFlags.URIS_ONLY"))
         elif sCmd == "None":
             pass
         else:
             print("Unknown command: " + str(sCmd))
     except:
         traceback.print_exc()