def get_ini_directory(self): models = [] directory = utils.get_env_variable(self.ENV_CDS_DAQ_CHANS) if directory: return os.path.abspath(os.path.expanduser(directory)) else: return None
def get_svn_directory(parent = None): svndir = utils.get_env_variable(ENV_SVN_DAQ_CHANS) if not svndir: QMessageBox.critical(parent, 'Unable to access archive', ('Please set the environmental variable {0} to '+ 'the subversion directory which contains the DAQ .ini files.').format( ENV_SVN_DAQ_CHANS)) return svndir
def get_login(realm, username, may_save): credentials = utils.get_env_variable(ENV_SVN_CREDENTIALS) if not credentials: QMessageBox.critical(parent, 'SVN Credentials not set', ('Please set the environmental variable {0} to '+ 'the subversion login credentials (username:password).').format( ENV_SVN_DAQ_CHANS)) user, passwd = credentials.split(':') return True, user, passwd, True
def launch_post_save_cmd(self, updated_files): print 'Calling post-save command (in {0})...'.format(self.ENV_POST_SAVE_CMD) , cmd = utils.get_env_variable(self.ENV_POST_SAVE_CMD) if cmd: #TODO: maybe use check_output() and then display a log window try: subprocess.check_call([cmd]+updated_files) print 'done.' except subprocess.CalledProcessError as e: QMessageBox.warning(self, 'Error in post-save command', ('There has been an error while executing the post-save ' 'command. The returned error code was {0}. Please check ' 'the output in the command-line terminal to see what ' 'went wrong.').format(e.returncode)) return False else: print 'none set.' return True
def launch_post_save_cmd(self, updated_files): print 'Calling post-save command (in {0})...'.format( self.ENV_POST_SAVE_CMD), cmd = utils.get_env_variable(self.ENV_POST_SAVE_CMD) if cmd: #TODO: maybe use check_output() and then display a log window try: subprocess.check_call([cmd] + updated_files) print 'done.' except subprocess.CalledProcessError as e: QMessageBox.warning( self, 'Error in post-save command', ('There has been an error while executing the post-save ' 'command. The returned error code was {0}. Please check ' 'the output in the command-line terminal to see what ' 'went wrong.').format(e.returncode)) return False else: print 'none set.' return True