def _retrieve_cfg_path(self): """ Obtains a saved path from Preferences or asks the user which path should be used and saves it for future use. """ prefs = Preferences("romeo") show_cfg_file = prefs.retrieve("show_cfg_file") while not show_cfg_file: try: show_cfg_file = os.environ['IH_SHOW_CFG_PATH'] except KeyError: self._logger.warning('Environment variable IH_SHOW_CFG_PATH is not defined.') # if there's not a file path set for the file lut, # pop up a dialog to ask for one show_cfg_file = commands.openFileDialog(False, False, False, '*', '/Volumes/romeo_inhouse/romeo/SHARED/romeo/lib/') if show_cfg_file and not os.path.exists(show_cfg_file[0]): # if we can't see the path, reset the path so # that we can ask for it again self._logger.warning("Chosen Romeo config file does not exist on disk, choose again.") show_cfg_file = None else: # otherwise store the preference so we don't # have to find the path again next time prefs.store("show_cfg_file", show_cfg_file[0]) shot_cdl_path = show_cfg_file[0] show_code = prefs.retrieve("show_code") while not show_code: # get the show code if it exists in the environment try: show_code = os.environ['IH_SHOW_CODE'] except KeyError: self._logger.warning('Environment variable IH_SHOW_CODE is not defined. Hard-coding to romeo...') show_code = 'romeo' prefs.store("show_code", show_code) self._show_code = show_code return show_cfg_file