예제 #1
0
    def install(self, filePath):
        """Install dictionary"""

        extention = os.path.splitext(filePath)[1][1:]
        succeeded = False

        try:
            if extention.lower() in dicttype.PLUGIN.getFileExtentions():
                try:
                    directory, dtype = installPlugin(filePath)
                    if directory:
                        if dtype.lower() == 'plugin':
                            dictionary = newplugin._loadDictionaryPlugin(
                                directory)
                        else:
                            dictionary = plaindict._loadPlainDictionary(
                                directory)
                        self.mainWin.addDictionary(dictionary)
                        succeeded = True

                except Exception as e:
                    errorwin.showErrorMessage(_("Installation failed"),
                                              e.args[0] or '')
                    self.mainWin.SetStatusText(_("Installation failed"))
                    return

            else:
                try:
                    directory = installPlainDictionary(filePath)
                    if directory:
                        dictionary = plaindict._loadPlainDictionary(directory)
                        self.mainWin.addDictionary(dictionary)
                        succeeded = True
                except Exception as e:
                    traceback.print_exc()
                    errorwin.showErrorMessage(_("Installation Error"),
                                              e.args[0] or '')
                    self.mainWin.SetStatusText(_("Error: Installation failed"))
                    return
        except:
            # Can this happen?
            self.mainWin.SetStatusText(_("Error: Installation failed"))
            traceback.print_exc()

        if succeeded:
            title = _("Dictionary installed")
            msg = _("Dictionary successfully installed. You can choose it " \
                    "from \"Dictionaries\" menu now.")
            errorwin.showInfoMessage(title, msg)
예제 #2
0
    def install(self, filePath):
        """Install dictionary"""

        extention = os.path.splitext(filePath)[1][1:]
        succeeded = False

        try:
            if extention.lower() in dicttype.PLUGIN.getFileExtentions():
                try:
                    directory, dtype = installPlugin(filePath)
                    if directory:
                        if dtype.lower() == 'plugin':
                            dictionary = newplugin._loadDictionaryPlugin(
                                directory)
                        else:
                            dictionary = plaindict._loadPlainDictionary(
                                directory)
                        self.mainWin.addDictionary(dictionary)
                        succeeded = True

                except Exception, e:
                    errorwin.showErrorMessage(_("Installation failed"),
                                              e.args[0] or '')
                    self.mainWin.SetStatusText(_("Installation failed"))
                    return

            else:
예제 #3
0
    def install(self, filePath):
        """Install dictionary"""

        extention = os.path.splitext(filePath)[1][1:]
        succeeded = False
 
        try:
            if extention.lower() in dicttype.PLUGIN.getFileExtentions():
                try:
                    directory, dtype = installPlugin(filePath)
                    if directory:
                        if dtype.lower() == 'plugin':
                            dictionary = newplugin._loadDictionaryPlugin(directory)
                        else:
                            dictionary = plaindict._loadPlainDictionary(directory)
                        self.mainWin.addDictionary(dictionary)
                        succeeded = True
                        
                except Exception, e:
                    errorwin.showErrorMessage(_("Installation failed"),
                                              e.args[0] or '')
                    self.mainWin.SetStatusText(_("Installation failed"))
                    return

            else:
예제 #4
0
                            dictionary = plaindict._loadPlainDictionary(
                                directory)
                        self.mainWin.addDictionary(dictionary)
                        succeeded = True

                except Exception, e:
                    errorwin.showErrorMessage(_("Installation failed"),
                                              e.args[0] or '')
                    self.mainWin.SetStatusText(_("Installation failed"))
                    return

            else:
                try:
                    directory = installPlainDictionary(filePath)
                    if directory:
                        dictionary = plaindict._loadPlainDictionary(directory)
                        self.mainWin.addDictionary(dictionary)
                        succeeded = True
                except Exception, e:
                    traceback.print_exc()
                    errorwin.showErrorMessage(_("Installation Error"),
                                              e.args[0] or '')
                    self.mainWin.SetStatusText(_("Error: Installation failed"))
                    return
        except:
            # Can this happen?
            self.mainWin.SetStatusText(_("Error: Installation failed"))
            traceback.print_exc()

        if succeeded:
            title = _("Dictionary installed")
예제 #5
0
                        else:
                            dictionary = plaindict._loadPlainDictionary(directory)
                        self.mainWin.addDictionary(dictionary)
                        succeeded = True
                        
                except Exception, e:
                    errorwin.showErrorMessage(_("Installation failed"),
                                              e.args[0] or '')
                    self.mainWin.SetStatusText(_("Installation failed"))
                    return

            else:
                try:
                    directory = installPlainDictionary(filePath)
                    if directory:
                        dictionary = plaindict._loadPlainDictionary(directory)
                        self.mainWin.addDictionary(dictionary)
                        succeeded = True
                except Exception, e:
                    traceback.print_exc()
                    errorwin.showErrorMessage(_("Installation Error"),
                                              e.args[0] or '')
                    self.mainWin.SetStatusText(_("Error: Installation failed"))
                    return
        except:
            # Can this happen?
            self.mainWin.SetStatusText(_("Error: Installation failed"))
            traceback.print_exc()

        if succeeded:
            title = _("Dictionary installed")