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
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
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
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$
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$
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