def CreateConfigDir(): """ Creates the user config directory its default sub directories and any of the default config files. @postcondition: all default configuration files/folders are created """ #---- Resolve Paths ----# config_dir = ed_glob.CONFIG['CONFIG_BASE'] if config_dir is None: config_dir = wx.StandardPaths_Get().GetUserDataDir() + os.sep profile_dir = os.path.join(config_dir, u"profiles") dest_file = os.path.join(profile_dir, u"default.ppb") ext_cfg = [u"cache", u"styles", u"plugins"] #---- Create Directories ----# if not os.path.exists(config_dir): os.mkdir(config_dir) if not os.path.exists(profile_dir): os.mkdir(profile_dir) for cfg in ext_cfg: if not HasConfigDir(cfg): MakeConfigDir(cfg) import profiler profiler.TheProfile.LoadDefaults() profiler.Profile_Set("MYPROFILE", dest_file) profiler.TheProfile.Write(dest_file) profiler.UpdateProfileLoader()
def GetUserConfigPath(self, relpath): """Get the path to a resource file in the users configuration directory. @param relpath: relative path (i.e config.cfg) @return: string """ path = wx.StandardPaths_Get().GetUserDataDir() path = os.path.join(path, relpath) return path
def HasConfigDir(loc=u""): """ Checks if the user has a config directory and returns True if the config directory exists or False if it does not. @return: whether config dir in question exists on an expected path """ cbase = ed_glob.CONFIG['CONFIG_BASE'] if cbase is None: cbase = wx.StandardPaths_Get().GetUserDataDir() + os.sep to_check = os.path.join(cbase, loc) return os.path.exists(to_check)
def InitializeConfig(self): """Setup config directories""" # Create main user config directory if it does # not exist. datap = wx.StandardPaths_Get().GetUserDataDir() if not os.path.exists(datap): os.mkdir(datap) # Make sure that any other application specific # config subdirectories have been created. if self.userdirs: for dname in userdirs: self.CreateUserCfgDir(dname)
def GetUserConfigBase(): """Get the base user configuration directory path""" cbase = ed_glob.CONFIG['CONFIG_BASE'] if cbase is None: cbase = wx.StandardPaths_Get().GetUserDataDir() if wx.Platform == '__WXGTK__': if u'.config' not in cbase and not os.path.exists(cbase): # If no existing configuration return xdg config path base, cfgdir = os.path.split(cbase) tmp_path = os.path.join(base, '.config') if os.path.exists(tmp_path): cbase = os.path.join(tmp_path, cfgdir.lstrip(u'.')) return cbase + os.sep
def MakeConfigDir(name): """Makes a user config directory @param name: name of config directory to make in user config dir """ cbase = ed_glob.CONFIG['CONFIG_BASE'] if cbase is None: cbase = wx.StandardPaths_Get().GetUserDataDir() try: os.mkdir(cbase + os.sep + name) except (OSError, IOError): pass
def GetLoader(): """Finds the loader to use @return: path to profile loader @note: path may not exist, only returns the path to where the loader should be. """ cbase = CONFIG['CONFIG_BASE'] if cbase is None: cbase = wx.StandardPaths_Get().GetUserDataDir() loader = os.path.join(cbase, u"profiles", u".loader2") return loader
def __init__(self, parent, title): super(MyFrame, self).__init__(parent, title=title) sizer = wx.BoxSizer() self._grid = gridlib.Grid(self) spaths = wx.StandardPaths_Get(); temp = spaths.GetTempDir() self._table = DirDataSource(temp) self._grid.SetTable(self._table) self._grid.AutoSizeColumns() self._grid.EnableEditing(False) sizer.Add(self._grid, 1, wx.EXPAND) self.SetSizer(sizer) self.SetInitialSize((-1,400))
def _setLocale(self, language): ''' Try to set the locale, trying possibly multiple localeStrings. ''' # This is necessary for standard dialog texts to be translated: locale.setlocale(locale.LC_ALL, '') # Set the wxPython locale: for localeString in self._localeStrings(language): languageInfo = wx.Locale.FindLanguageInfo(localeString) if languageInfo: self.__locale = wx.Locale(languageInfo.Language) # Add the wxWidgets message catalog. This is really only for # py2exe'ified versions, but it doesn't seem to hurt on other # platforms... localeDir = os.path.join( wx.StandardPaths_Get().GetResourcesDir(), 'locale') self.__locale.AddCatalogLookupPathPrefix(localeDir) self.__locale.AddCatalog('wxstd') break
def _setLocale(self, language): ''' Try to set the locale, trying possibly multiple localeStrings. ''' if not operating_system.isGTK(): locale.setlocale(locale.LC_ALL, '') # Set the wxPython locale: for localeString in self._localeStrings(language): languageInfo = wx.Locale.FindLanguageInfo(localeString) if languageInfo: self.__locale = wx.Locale(languageInfo.Language) # pylint: disable=W0201 # Add the wxWidgets message catalog. This is really only for # py2exe'ified versions, but it doesn't seem to hurt on other # platforms... localeDir = os.path.join( wx.StandardPaths_Get().GetResourcesDir(), 'locale') self.__locale.AddCatalogLookupPathPrefix(localeDir) self.__locale.AddCatalog('wxstd') break if operating_system.isGTK(): locale.setlocale(locale.LC_ALL, '') self._fixBrokenLocales()
def __init__(self): """Create parser object """ description = ('IBS command line interface. ' '') epilog = ('') parser = ArgumentParser(description=description, epilog=epilog) log_levels = [ 'notset', 'debug', 'info', 'warning', 'error', 'critical' ] parser.add_argument( '--log-level', dest='log_level_str', default='info', choices=log_levels, help=('Log level. ' 'One of {0} or {1} (%(default)s by default)'.format( ', '.join(log_levels[:-1]), log_levels[-1]))) parser.add_argument('--log-dir', dest='log_dir', default=os.path.join( wx.StandardPaths_Get().GetTempDir()), help=('Path to the directory to store log files')) parser.add_argument('-z', '--zsync-input', dest='zsync_file', default=None, help=('file path of zsync input path')) parser.add_argument('-g', '--osd', action='store_true', dest="osd", default=False, help=('show OSD notify during monitor')) # Append to log on subsequent startups parser.add_argument('--append', action='store_true', default=False, help=SUPPRESS) self.parser = parser
def ResolvConfigDir(config_dir, sys_only=False): """Checks for a user config directory and if it is not found it then resolves the absolute path of the executables directory from the relative execution path. This is then used to find the location of the specified directory as it relates to the executable directory, and returns that path as a string. @param config_dir: name of config directory to resolve @keyword sys_only: only get paths of system config directory or user one @note: This method is probably much more complex than it needs to be but the code has proven itself. """ stdpath = wx.StandardPaths_Get() # Try to get a User config directory if not sys_only: user_config = ed_glob.CONFIG['CONFIG_BASE'] if user_config is None: user_config = stdpath.GetUserDataDir() + os.sep user_config = os.path.join(user_config, config_dir) if os.path.exists(user_config): return user_config + os.sep # The following lines are used only when Editra is being run as a # source package. If the found path does not exist then Editra is # running as as a built package. if not hasattr(sys, 'frozen'): path = __file__ path = os.sep.join(path.split(os.sep)[:-2]) path = path + os.sep + config_dir + os.sep if os.path.exists(path): if not isinstance(path, types.UnicodeType): path = unicode(path, sys.getfilesystemencoding()) return path # If we get here we need to do some platform dependant lookup # to find everything. path = sys.argv[0] if not isinstance(path, types.UnicodeType): path = unicode(path, sys.getfilesystemencoding()) # If it is a link get the real path if os.path.islink(path): path = os.path.realpath(path) # Tokenize path pieces = path.split(os.sep) if os.sys.platform == 'win32': # On Windows the exe is in same dir as config directories pro_path = os.sep.join(pieces[:-1]) if os.path.isabs(pro_path): pass elif pro_path == "": pro_path = os.getcwd() pieces = pro_path.split(os.sep) pro_path = os.sep.join(pieces[:-1]) else: pro_path = os.path.abspath(pro_path) elif os.sys.platform == "darwin": # On OS X the config directories are in the applet under Resources pro_path = stdpath.GetResourcesDir() pro_path = os.path.join(pro_path, config_dir) else: pro_path = os.sep.join(pieces[:-2]) if pro_path.startswith(os.sep): pass elif pro_path == u"": pro_path = os.getcwd() pieces = pro_path.split(os.sep) if pieces[-1] not in [ ed_glob.PROG_NAME.lower(), ed_glob.PROG_NAME ]: pro_path = os.sep.join(pieces[:-1]) else: pro_path = os.path.abspath(pro_path) if os.sys.platform != "darwin": pro_path = pro_path + os.sep + config_dir + os.sep path = os.path.normpath(pro_path) + os.sep # Make sure path is unicode if not isinstance(path, types.UnicodeType): path = unicode(path, sys.getdefaultencoding()) return path
def UserConfigDir(self): return wx.StandardPaths_Get().GetUserDataDir()
def __init__(self): #Appearance self.def_aspects = self.aspects = True self.aspect = [True, False, False, True, False, True, True, False, False, False, True] self.def_aspect = self.aspect[:] self.def_symbols = self.symbols = True self.def_traditionalaspects = self.traditionalaspects = False self.def_houses = self.houses = True self.def_positions = self.positions = False self.def_intables = self.intables = False self.def_bw = self.bw = False self.def_theme = self.theme = 0 self.def_ascmcsize = self.ascmcsize = 5 self.def_tablesize = self.tablesize = 0.75 self.def_planetarydayhour = self.planetarydayhour = True self.def_housesystem = self.housesystem = True self.transcendental = [True, True, True] self.def_transcendental = self.transcendental[:] self.def_shownodes = self.shownodes = True self.def_aspectstonodes = self.aspectstonodes = False self.def_showlof = self.showlof = True self.def_showaspectstolof = self.showaspectstolof = False self.def_showterms = self.showterms = False self.def_showdecans = self.showdecans = False self.def_showfixstars = self.showfixstars = 0 self.def_showfixstarsnodes = self.showfixstarsnodes = False self.def_showfixstarshcs = self.showfixstarshcs = False self.def_showfixstarslof = self.showfixstarslof = False self.def_topocentric = self.topocentric = False self.def_usetradfixstarnamespdlist = self.usetradfixstarnamespdlist = False self.def_netbook = self.netbook = False #AppearanceII self.speculums = [[True, True, True, True, False, False, False, False, False, False, False, False, False, False], [True, True, True, True, False, False, False, False, False, False, False, False]] self.def_speculums = copy.deepcopy(self.speculums) self.intime = False self.def_intime = self.intime #Symbols self.def_uranus = self.uranus = True self.def_pluto = self.pluto = 0 self.def_signs = self.signs = True #Dignities(planets, domicile, exaltatio) #Sun self.dignities = [[[False, False, False, False, True, False, False, False, False, False, False, False], [True, False, False, False, False, False, False, False, False, False, False, False]], #Moon [[False, False, False, True, False, False, False, False, False, False, False, False], [False, True, False, False, False, False, False, False, False, False, False, False]], #Mercury [[False, False, True, False, False, True, False, False, False, False, False, False], [False, False, False, False, False, True, False, False, False, False, False, False]], #Venus [[False, True, False, False, False, False, True, False, False, False, False, False], [False, False, False, False, False, False, False, False, False, False, False, True]], #Mars [[True, False, False, False, False, False, False, True, False, False, False, False], [False, False, False, False, False, False, False, False, False, True, False, False]], #Jupiter [[False, False, False, False, False, False, False, False, True, False, False, True], [False, False, False, True, False, False, False, False, False, False, False, False]], #Saturnus [[False, False, False, False, False, False, False, False, False, True, True, False], [False, False, False, False, False, False, True, False, False, False, False, False]], #Uranus [[False, False, False, False, False, False, False, False, False, False, False, False], [False, False, False, False, False, False, False, False, False, False, False, False]], #Neptune [[False, False, False, False, False, False, False, False, False, False, False, False], [False, False, False, False, False, False, False, False, False, False, False, False]], #Pluto [[False, False, False, False, False, False, False, False, False, False, False, False], [False, False, False, False, False, False, False, False, False, False, False, False]]] self.def_dignities = copy.deepcopy(self.dignities) #Minor dignities #Triplicities self.seltrip = 0 self.def_seltrip = self.seltrip self.trips = [[[0, 5, 6], [6, 2, 5], [3, 4, 1], [3, 1, 4]], [[0, 5, 7], [6, 2, 7], [4, 4, 7], [3, 1, 7]], [[0, 4, 5], [6, 3, 2], [5, 1, 4], [2, 6, 3]]] self.def_trips = copy.deepcopy(self.trips) #Terms self.selterm = 0 self.def_selterm = self.selterm self.terms = [[[[5, 6], [3, 6], [2, 8], [4, 5], [6, 5]], [[3, 8], [2, 6], [5, 8], [6, 5], [4, 3]], [[2, 6], [5, 6], [3, 5], [4, 7], [6, 6]], [[4, 7], [3, 6], [2, 6], [5, 7], [6, 4]], [[5, 6], [3, 5], [6, 7], [2, 6], [4, 6]], [[2, 7], [3, 10], [5, 4], [4, 7], [6, 2]], [[6, 6], [2, 8], [5, 7], [3, 7], [4, 2]], [[4, 7], [3, 4], [2, 8], [5, 5], [6, 6]], [[5, 12], [3, 5], [2, 4], [6, 5], [4, 4]], [[2, 7], [5, 7], [3, 8], [6, 4], [4, 4]], [[2, 7], [3, 6], [5, 7], [4, 5], [6, 5]], [[3, 12], [5, 4], [2, 3], [4, 9], [6, 2]]], [[[5, 6], [3, 8], [2, 7], [4, 5], [6, 4]], [[3, 8], [2, 7], [5, 7], [6, 2], [4, 6]], [[2, 7], [5, 6], [3, 7], [4, 6], [6, 4]], [[4, 6], [5, 7], [2, 7], [3, 7], [6, 3]], [[5, 6], [2, 7], [6, 6], [3, 6], [4, 5]], [[2, 7], [3, 6], [5, 5], [6, 6], [4, 6]], [[6, 6], [3, 5], [2, 5], [5, 8], [4, 6]], [[4, 6], [3, 7], [5, 8], [2, 6], [6, 3]], [[5, 8], [3, 6], [2, 5], [6, 6], [4, 5]], [[3, 6], [2, 6], [5, 7], [6, 6], [4, 5]], [[6, 6], [2, 6], [3, 8], [5, 5], [4, 5]], [[3, 8], [5, 6], [2, 6], [4, 5], [6, 5]]]] self.def_terms = copy.deepcopy(self.terms) #Decans self.seldecan = 0 self.def_seldecan = self.seldecan self.decans = [[[4, 0, 3], [2, 1, 6], [5, 4, 0], [3, 2, 1], [6, 5, 4], [0, 3, 2], [1, 6, 5], [4, 0, 3], [2, 1, 6], [5, 4, 0], [3, 2, 1], [6, 5, 4]], [[4, 0, 5], [3, 2, 6], [2, 3, 6], [1, 4, 5], [0, 5, 4], [2, 6, 3], [3, 6, 2], [4, 5, 1], [5, 4, 0], [6, 3, 2], [6, 2, 3], [5, 1, 4]]] self.def_decans = copy.deepcopy(self.decans) #ChartAlmuten self.def_oneruler = self.oneruler = True self.def_usedaynightorb = self.usedaynightorb = False self.def_dignityscores = self.dignityscores = [5, 4, 3, 2, 1] self.def_useaccidental = self.useaccidental = True self.def_housescores = self.housescores = [12, 6, 3, 9, 7, 1, 10, 5, 4, 11, 8, 2] self.def_sunphases = self.sunphases = [3, 2, 1] self.def_dayhourscores = self.dayhourscores = [7, 6] self.def_useexaltationmercury = self.useexaltationmercury = False #TopicalAlmuten and Parts self.def_topicals = self.topicals = None #Arabic Parts self.def_arabicpartsref = self.arabicpartsref = 0 self.def_daynightorbdeg = self.daynightorbdeg = 0 self.def_daynightorbmin = self.daynightorbmin = 0 self.def_arabicparts = self.arabicparts = None #Ayanamsha self.def_ayanamsha = self.ayanamsha = 0 #Colors self.def_clrframe = self.clrframe = (0,0,255) self.def_clrsigns = self.clrsigns = (0,0,255) self.def_clrAscMC = self.clrAscMC = (0,0,0) self.def_clrhouses = self.clrhouses = (0,0,255) self.def_clrhousenumbers = self.clrhousenumbers = (0,0,255) self.def_clrpositions = self.clrpositions = (0,0,128) self.def_clrperegrin = self.clrperegrin = (0,0,128) self.def_clrdomicil = self.clrdomicil = (2, 191, 2) self.def_clrexil = self.clrexil = (255,0,0) self.def_clrexal = self.clrexal = (255,215,0) self.def_clrcasus = self.clrcasus = (205,92,92) self.clraspect = [(0,0,128), (0,128,0), (128,0,0), (0,128,0), (0,128,0), (128,0,0), (0,128,0), (128,0,0), (0,128,0), (128,0,0), (128,0,0)] self.def_clraspect = self.clraspect[:] self.clrindividual = [(255,215,0), (0,191,255), (138,43,226), (0,128,0), (178,34,34), (0,0,255), (0,0,0), (0,0,128), (0,0,128), (0,0,128), (139,54,38), (205,96,144)] self.def_clrindividual = self.clrindividual[:] self.def_useplanetcolors = self.useplanetcolors = False # self.def_clrbackground = self.clrbackground = (wx.SystemSettings.GetColour(wx.SYS_COLOUR_WINDOWFRAME)).Get(False) self.def_clrbackground = self.clrbackground = (192,192,192) self.def_clrtable = self.clrtable = (0,0,0) self.def_clrtexts = self.clrtexts = (0,0,0) #Housesystem self.def_hsys = self.hsys = 'P' #Nodes self.def_meannode = self.meannode = True #Orbis self.orbis = [[5.0, 1.75, 1.75, 3.0, 1.75, 4.0, 4.0, 1.75, 1.75, 1.75, 5.0], [5.0, 1.75, 1.75, 3.0, 1.75, 4.0, 4.0, 1.75, 1.75, 1.75, 5.0], [3.5, 1.5, 1.5, 2.5, 1.5, 3.0, 3.0, 1.5, 1.5, 1.5, 3.5], [3.5, 1.5, 1.5, 2.5, 1.5, 3.0, 3.0, 1.5, 1.5, 1.5, 3.5], [3.5, 1.5, 1.5, 2.5, 1.5, 3.0, 3.0, 1.5, 1.5, 1.5, 3.5], [4.0, 1.5, 1.5, 3.0, 1.5, 3.5, 3.5, 1.5, 1.5, 1.5, 4.0], [4.0, 1.5, 1.5, 3.0, 1.5, 3.5, 3.5, 1.5, 1.5, 1.5, 4.0], [3.0, 1.0, 1.0, 2.0, 1.0, 2.5, 2.5, 1.0, 1.0, 1.0, 3.0], [3.0, 1.0, 1.0, 2.0, 1.0, 2.5, 2.5, 1.0, 1.0, 1.0, 3.0], [3.0, 1.0, 1.0, 2.0, 1.0, 2.5, 2.5, 1.0, 1.0, 1.0, 3.0], [0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5]] self.def_orbis = copy.deepcopy(self.orbis) self.orbisplanetspar = [[1.0, 1.0], [1.0, 1.0], [1.0, 1.0], [1.0, 1.0], [1.0, 1.0], [1.0, 1.0], [1.0, 1.0], [1.0, 1.0], [1.0, 1.0], [1.0, 1.0], [1.0, 1.0]] self.def_orbisplanetspar = copy.deepcopy(self.orbisplanetspar) # Houses self.orbisH = [0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25] self.def_orbisH = self.orbisH[:] self.orbisparH = [0.25, 0.25] #parallel/contraparallel self.def_orbisparH = self.orbisparH[:] self.def_orbiscuspH = self.orbiscuspH = 3.0 # Asc,MC self.orbisAscMC = [0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5] self.def_orbisAscMC = self.orbisAscMC[:] self.orbisparAscMC = [0.5, 0.5] self.def_orbisparAscMC = self.orbisparAscMC[:] self.def_orbiscuspAscMC = self.orbiscuspAscMC = 5.0 self.def_exact = self.exact = 1.0 #Primary Dirs self.def_primarydir = self.primarydir = primdirs.PrimDirs.PLACIDIANSEMIARC self.def_subprimarydir = self.subprimarydir = primdirs.PrimDirs.MUNDANE self.def_subzodiacal = self.subzodiacal = primdirs.PrimDirs.SZNEITHER self.def_bianchini = self.bianchini = False self.sigascmc = [True, True] self.def_sigascmc = self.sigascmc[:] self.sighouses = False self.def_sighouses = self.sighouses self.sigplanets = [True, True, True, True, True, True, True, True, True, True, True, True] self.def_sigplanets = self.sigplanets[:] self.promplanets = [True, True, True, True, True, True, True, True, True, True, True, True] self.def_promplanets = self.promplanets[:] self.pdaspects = [True, False, False, True, False, True, True, False, False, False, True] self.def_pdaspects = self.pdaspects[:] self.pdmidpoints = False self.def_pdmidpoints = self.pdmidpoints self.pdparallels = [False, False] self.def_pdparallels = self.pdparallels[:] self.pdsecmotion = self.def_pdsecmotion = False self.pdsecmotioniter = self.def_pdsecmotioniter = 2 #3rd iter is the default self.zodpromsigasps = [True, False] self.def_zodpromsigasps = self.zodpromsigasps[:] self.ascmchcsasproms = False self.def_ascmchcsasproms = self.ascmchcsasproms self.pdfixstars = False self.def_pdfixstars = self.pdfixstars self.pdfixstarssel = [False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False] self.def_pdfixstarssel = self.pdfixstarssel[:] self.pdlof = [False, False] self.def_pdlof = self.pdlof[:] self.pdsyzygy = self.def_pdsyzygy = False self.pdterms = False self.def_pdterms = self.pdterms self.pdantiscia = False self.def_pdantiscia = self.pdantiscia self.def_pdcustomer = self.pdcustomer = False self.pdcustomerlon = [0,0,0] self.def_pdcustomerlon = self.pdcustomerlon[:] self.pdcustomerlat = [0,0,0] self.def_pdcustomerlat = self.pdcustomerlat[:] self.def_pdcustomersouthern = self.pdcustomersouthern = False self.def_pdcustomer2 = self.pdcustomer2 = False self.pdcustomer2lon = [0,0,0] self.def_pdcustomer2lon = self.pdcustomer2lon[:] self.pdcustomer2lat = [0,0,0] self.def_pdcustomer2lat = self.pdcustomer2lat[:] self.def_pdcustomer2southern = self.pdcustomer2southern = False #PD-keys self.pdkeydyn = False self.def_pdkeydyn = self.pdkeydyn self.pdkeyd = primdirs.PrimDirs.TRUESOLAREQUATORIALARC self.def_pdkeyd = self.pdkeyd self.pdkeys = primdirs.PrimDirs.NAIBOD self.def_pdkeys = self.pdkeys self.pdkeydeg = 0 self.def_pdkeydeg = self.pdkeydeg self.pdkeymin = 0 self.def_pdkeymin = self.pdkeymin self.pdkeysec = 0 self.def_pdkeysec = self.pdkeysec self.useregressive = False self.def_useregressive = self.useregressive #Lot of Fortune self.lotoffortune = chart.Chart.LFMOONSUN self.def_lotoffortune = self.lotoffortune #Syzygy self.def_syzmoon = self.syzmoon = Options.MOON #Fixstars self.fixstars = {'etTau':1.5, 'alTau':1.5, 'bePer':1.5, 'ga-1And':1.5, 'alSco':1.5, 'alBoo':1.5, 'deCnc':1.5, 'gaCnc':1.5, 'etUMa':1.5, 'alOri':1.5, 'alCen':1.5, 'alCar':1.5, 'alGem':1.5, 'beLeo':1.5, 'alPsA':1.5, 'alCrB':1.5, 'alPeg':1.5, 'beAnd':1.5, 'alUMi':1.5, 'beGem':1.5, 'M44':1.5, 'alCMi':1.5, 'alLeo':1.5, 'beOri':1.5, 'alCMa':1.5, 'alVir':1.5, 'alSer':1.5, 'alLyr':1.5, 'al-2Lib':1.5, 'beLib':1.5} self.def_fixstars = self.fixstars.copy() #Profections self.def_zodprof = self.zodprof = True self.def_usezodprojsprof = self.usezodprojsprof = False #PDsInChart self.def_pdincharttyp = self.pdincharttyp = 0 self.def_pdinchartsecmotion = self.pdinchartsecmotion = False self.def_pdinchartterrsecmotion = self.pdinchartterrsecmotion = True #Languages self.def_langid = self.langid = 0 self.autosave = False self.def_autosave = self.autosave self.optionsfilestxt = ('appearance1.opt', 'appearance2.opt', 'symbols.opt', 'dignities.opt', 'triplicities.opt', 'terms.opt', 'decans.opt', 'almutenchart.opt', 'almutentopicalandparts.opt', 'ayanamsa.opt', 'colors.opt', 'housesystem.opt', 'nodes.opt', 'orbs.opt', 'primarydirs.opt', 'primarykeys.opt', 'fortune.opt', 'syzygy.opt', 'fixedstars.opt', 'profections.opt', 'pdsinchart.opt', 'languages.opt', 'autosave.opt') # set Options directory and create if does not exist optdir = wx.StandardPaths_Get().GetUserConfigDir() + 'Morinus/Opts' self.optsdirtxt = optdir if not os.path.exists(optdir): optdirparent = wx.StandardPaths_Get().GetUserConfigDir() + 'Morinus' if not os.path.exists(optdirparent): os.mkdir(optdirparent) os.mkdir(optdir) self.appearance1opt = os.path.join(self.optsdirtxt, self.optionsfilestxt[0]) self.appearance2opt = os.path.join(self.optsdirtxt, self.optionsfilestxt[1]) self.symbolsopt = os.path.join(self.optsdirtxt, self.optionsfilestxt[2]) self.dignitiesopt = os.path.join(self.optsdirtxt, self.optionsfilestxt[3]) self.triplicitiesopt = os.path.join(self.optsdirtxt, self.optionsfilestxt[4]) self.termsopt = os.path.join(self.optsdirtxt, self.optionsfilestxt[5]) self.decansopt = os.path.join(self.optsdirtxt, self.optionsfilestxt[6]) self.chartalmutenopt = os.path.join(self.optsdirtxt, self.optionsfilestxt[7]) self.topicalandpartsopt = os.path.join(self.optsdirtxt, self.optionsfilestxt[8]) self.ayanamsaopt = os.path.join(self.optsdirtxt, self.optionsfilestxt[9]) self.colorsopt = os.path.join(self.optsdirtxt, self.optionsfilestxt[10]) self.housesystemopt = os.path.join(self.optsdirtxt, self.optionsfilestxt[11]) self.nodesopt = os.path.join(self.optsdirtxt, self.optionsfilestxt[12]) self.orbsopt = os.path.join(self.optsdirtxt, self.optionsfilestxt[13]) self.primarydirsopt = os.path.join(self.optsdirtxt, self.optionsfilestxt[14]) self.primarykeysopt = os.path.join(self.optsdirtxt, self.optionsfilestxt[15]) self.fortuneopt = os.path.join(self.optsdirtxt, self.optionsfilestxt[16]) self.syzygyopt = os.path.join(self.optsdirtxt, self.optionsfilestxt[17]) self.fixstarsopt = os.path.join(self.optsdirtxt, self.optionsfilestxt[18]) self.profectionsopt = os.path.join(self.optsdirtxt, self.optionsfilestxt[19]) self.pdsinchartopt = os.path.join(self.optsdirtxt, self.optionsfilestxt[20]) self.languagesopt = os.path.join(self.optsdirtxt, self.optionsfilestxt[21]) self.autosaveopt = os.path.join(self.optsdirtxt, self.optionsfilestxt[22]) self.load()
def config_file(self): paths = wx.StandardPaths_Get() return os.path.join(paths.GetUserConfigDir(), 'GeoDaSpace.config')
def user_config_path(self, filename): filepath = os.path.join(wx.StandardPaths_Get().GetUserDataDir(), filename) if not os.path.exists(os.path.dirname(filepath)): os.mkdir(os.path.dirname(filepath)) return filepath
def CreateUserCfgDir(self, dirname): """Create a user config subdirectory""" path = wx.StandardPaths_Get().GetUserDataDir() path = os.path.join(path, dirname) if not os.path.exists(path): os.mkdir(path)
def share_path(self, filename): if os.path.exists('share'): return os.path.join('share', filename) return os.path.join(wx.StandardPaths_Get().GetInstallPrefix(), 'share', filename)
def system_config_path(self): path = os.path.join('share', 'default.ini') if os.path.exists(path): return path return os.path.join(wx.StandardPaths_Get().GetInstallPrefix(), 'share', 'default.ini')