예제 #1
0
    def _isValidNonExistingDirectory(self, value):
        parentDir = fileutil.findExistingParentDirectory(value)

        if not fileutil.isDirectoryWritable(parentDir):
            return self._setReason(_extstr(u"newprofile.DirectoryNotWritableError")) #$NON-NLS-1$

        return True
예제 #2
0
    def _isValidNonExistingDirectory(self, value):
        parentDir = fileutil.findExistingParentDirectory(value)

        if not fileutil.isDirectoryWritable(parentDir):
            return self._setReason(
                _extstr(u"newprofile.DirectoryNotWritableError"))  #$NON-NLS-1$

        return True
예제 #3
0
    def _isValidExistingDirectory(self, value):
        # Is the value a directory?
        if not os.path.isdir(value):
            return self._setReason(_extstr(u"newprofile.NotADirectoryError")) #$NON-NLS-1$

        # Is it an existing Raven profile?
        ravenConfigFilePath = os.path.join(value, u"config", u"user-properties.xml") #$NON-NLS-1$ #$NON-NLS-2$
        if os.path.isfile(ravenConfigFilePath):
            return True

        # If not, the directory must be writable and empty.

        if len(os.listdir(value)) > 0:
            return self._setReason(_extstr(u"newprofile.DirectoryNotEmptyError")) #$NON-NLS-1$

        if not fileutil.isDirectoryWritable(value):
            return self._setReason(_extstr(u"newprofile.DirectoryNotWritableError")) #$NON-NLS-1$

        return True
예제 #4
0
def ZShowTranslationManager():
    global TRANSLATION_MANAGER_WINDOW
    try:
        # Check if the bundle dir is writeable - if not, don't allow
        # the user to open the translation manager.
        systemProfile = getApplicationModel().getSystemProfile()
        bundleDirectory = systemProfile.getBundleDirectory()
        if not fileutil.isDirectoryWritable(bundleDirectory):
            title = _extstr(u"translationmanager.TranslationEditingNotAllowed") #$NON-NLS-1$
            message = _extstr(u"translationmanager.MustHaveWriteAccessError") #$NON-NLS-1$
            ZShowWarnMessage(None, message, title)
            return

        if TRANSLATION_MANAGER_WINDOW is None:
            TRANSLATION_MANAGER_WINDOW = ZTranslationManagerWindow(None)
        TRANSLATION_MANAGER_WINDOW.Show()
        TRANSLATION_MANAGER_WINDOW.Raise()
        return TRANSLATION_MANAGER_WINDOW
    except Exception, e:
        ZShowExceptionMessage(None, ZException(u"Error opening Translation Manager", e)) #$NON-NLS-1$
예제 #5
0
def ZShowTranslationManager():
    global TRANSLATION_MANAGER_WINDOW
    try:
        # Check if the bundle dir is writeable - if not, don't allow
        # the user to open the translation manager.
        systemProfile = getApplicationModel().getSystemProfile()
        bundleDirectory = systemProfile.getBundleDirectory()
        if not fileutil.isDirectoryWritable(bundleDirectory):
            title = _extstr(u"translationmanager.TranslationEditingNotAllowed"
                            )  #$NON-NLS-1$
            message = _extstr(
                u"translationmanager.MustHaveWriteAccessError")  #$NON-NLS-1$
            ZShowWarnMessage(None, message, title)
            return

        if TRANSLATION_MANAGER_WINDOW is None:
            TRANSLATION_MANAGER_WINDOW = ZTranslationManagerWindow(None)
        TRANSLATION_MANAGER_WINDOW.Show()
        TRANSLATION_MANAGER_WINDOW.Raise()
        return TRANSLATION_MANAGER_WINDOW
    except Exception, e:
        ZShowExceptionMessage(None,
                              ZException(u"Error opening Translation Manager",
                                         e))  #$NON-NLS-1$
예제 #6
0
    def _isValidExistingDirectory(self, value):
        # Is the value a directory?
        if not os.path.isdir(value):
            return self._setReason(
                _extstr(u"newprofile.NotADirectoryError"))  #$NON-NLS-1$

        # Is it an existing Raven profile?
        ravenConfigFilePath = os.path.join(
            value, u"config",
            u"user-properties.xml")  #$NON-NLS-1$ #$NON-NLS-2$
        if os.path.isfile(ravenConfigFilePath):
            return True

        # If not, the directory must be writable and empty.

        if len(os.listdir(value)) > 0:
            return self._setReason(
                _extstr(u"newprofile.DirectoryNotEmptyError"))  #$NON-NLS-1$

        if not fileutil.isDirectoryWritable(value):
            return self._setReason(
                _extstr(u"newprofile.DirectoryNotWritableError"))  #$NON-NLS-1$

        return True