本文整理汇总了Python中exe.engine.path.Path.expand方法的典型用法代码示例。如果您正苦于以下问题:Python Path.expand方法的具体用法?Python Path.expand怎么用?Python Path.expand使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类exe.engine.path.Path
的用法示例。
在下文中一共展示了Path.expand方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Config
# 需要导入模块: from exe.engine.path import Path [as 别名]
# 或者: from exe.engine.path.Path import expand [as 别名]
#.........这里部分代码省略.........
return getattr(self, option)
self.configParser.defaultValue = defVal
self.upgradeFile()
# System Section
if self.configParser.has_section('system'):
system = self.configParser.system
self.port = int(system.port)
self.browser = None if system.browser == u"None" else system.browser
if not G.application.portable:
self.dataDir = Path(system.dataDir)
self.configDir = Path(system.configDir)
self.webDir = Path(system.webDir)
self.stylesDir = Path(self.configDir)/'style'
self.jsDir = Path(system.jsDir)
else:
self.stylesDir = Path(self.webDir/'style').abspath()
self.assumeMediaPlugins = False;
if self.configParser.has_option('system', \
'assumeMediaPlugins'):
value = system.assumeMediaPlugins.strip().lower()
if value == "1" or value == "yes" or value == "true" or \
value == "on":
self.assumeMediaPlugins = True;
# If the dataDir points to some other dir, fix it
if not self.dataDir.isdir():
self.dataDir = tempfile.gettempdir()
# make the webDir absolute, to hide path joins of relative paths
self.webDir = self.webDir.expand().abspath()
# If the configDir doesn't exist (as it may be a default setting with a
# new installation) create it
if not self.configDir.exists():
self.configDir.mkdir()
if not G.application.standalone:
#FM: Copy styles
if not os.path.exists(self.stylesDir) or not os.listdir(self.stylesDir):
self.copyStyles()
else:
self.updateStyles()
else:
if G.application.portable:
if os.name == 'posix':
self.stylesDir = Path(self.webDir/'..'/'..'/'..'/'style')
else:
self.stylesDir = Path(self.webDir/'..'/'style')
if not os.path.exists(self.stylesDir) or not os.listdir(self.stylesDir):
self.copyStyles()
else:
self.stylesDir = Path(self.webDir/'style').abspath()
# Get the list of recently opened projects
self.recentProjects = []
if self.configParser.has_section('recent_projects'):
recentProjectsSection = self.configParser.recent_projects
# recentProjectsSection.items() is in the wrong order, keys are alright.
# Sorting list by key before adding to self.recentProjects, to avoid wrong ordering
# in Recent Projects menu list
recentProjectsItems = recentProjectsSection.items();
recentProjectsItems.sort()
示例2: __init__
# 需要导入模块: from exe.engine.path import Path [as 别名]
# 或者: from exe.engine.path.Path import expand [as 别名]
#.........这里部分代码省略.........
system.configDir = self.configDir
del system.appDataDir
if system.has_option('greDir'):
del system.greDir
def loadSettings(self):
"""
Loads the settings from the exe.conf file.
Overrides the defaults set in __init__
"""
def defVal(dummy, option):
"""If something is not in the config file, just use the default in
'self'"""
return getattr(self, option)
self.configParser.defaultValue = defVal
self.upgradeFile()
if self.configParser.has_section('system'):
system = self.configParser.system
self.webDir = Path(system.webDir)
self.xulDir = Path(system.xulDir)
self.localeDir = Path(system.localeDir)
self.port = int(system.port)
self.browserPath = Path(system.browserPath)
self.dataDir = Path(system.dataDir)
self.configDir = Path(system.configDir)
self.assumeMediaPlugins = False;
if self.configParser.has_option('system', \
'assumeMediaPlugins'):
value = system.assumeMediaPlugins.strip().lower()
if value == "1" or value == "yes" or value == "true" or \
value == "on":
self.assumeMediaPlugins = True;
if not self.dataDir.isdir():
self.dataDir = tempfile.gettempdir()
self.webDir = self.webDir.expand().abspath()
if not self.configDir.exists():
self.configDir.mkdir()
self.recentProjects = []
if self.configParser.has_section('recent_projects'):
recentProjectsSection = self.configParser.recent_projects
for key, path in recentProjectsSection.items():
self.recentProjects.append(path)
self.hiddeniDevices = []
if self.configParser.has_section('idevices'):
idevicesSection = self.configParser.idevices
for key,value in idevicesSection.items():
value = value.strip().lower()
if value == "0" or value == "no" or value == "false" or \
value == "off":
self.hiddeniDevices.append(key.lower())
if self.configParser.has_section('deprecated'):
deprecatedSection = self.configParser.deprecated
for key,value in deprecatedSection.items():
value = value.strip().lower()
if value == "1" or value == "yes" or value == "true" or \
value == "on":
if key.lower() in self.deprecatediDevices:
self.deprecatediDevices.remove(key.lower())
if self.configParser.has_section('user'):
if self.configParser.user.has_option('locale'):
self.locale = self.configParser.user.locale
return
self.locale = chooseDefaultLocale(self.localeDir)
def onWrite(self, configParser):
"""
Called just before the config file is written.
We use it to fill out any settings that are stored here and
示例3: __init__
# 需要导入模块: from exe.engine.path import Path [as 别名]
# 或者: from exe.engine.path.Path import expand [as 别名]
#.........这里部分代码省略.........
Overrides the defaults set in __init__
"""
# Set up the parser so that if a certain value is not in the config
# file, it will use the value from our default values
def defVal(dummy, option):
"""If something is not in the config file, just use the default in
'self'"""
return getattr(self, option)
self.configParser.defaultValue = defVal
self.upgradeFile()
# System Section
if self.configParser.has_section('system'):
system = self.configParser.system
self.webDir = Path(system.webDir)
self.xulDir = Path(system.xulDir)
self.localeDir = Path(system.localeDir)
self.port = int(system.port)
self.browserPath = Path(system.browserPath)
self.dataDir = Path(system.dataDir)
self.configDir = Path(system.configDir)
self.assumeMediaPlugins = False;
if self.configParser.has_option('system', \
'assumeMediaPlugins'):
value = system.assumeMediaPlugins.strip().lower()
if value == "1" or value == "yes" or value == "true" or \
value == "on":
self.assumeMediaPlugins = True;
# If the dataDir points to some other dir, fix it
if not self.dataDir.isdir():
self.dataDir = tempfile.gettempdir()
# make the webDir absolute, to hide path joins of relative paths
self.webDir = self.webDir.expand().abspath()
# If the configDir doesn't exist (as it may be a default setting with a
# new installation) create it
if not self.configDir.exists():
self.configDir.mkdir()
# Get the list of recently opened projects
self.recentProjects = []
if self.configParser.has_section('recent_projects'):
recentProjectsSection = self.configParser.recent_projects
for key, path in recentProjectsSection.items():
self.recentProjects.append(path)
# Load the list of "hidden" iDevices
self.hiddeniDevices = []
if self.configParser.has_section('idevices'):
idevicesSection = self.configParser.idevices
for key,value in idevicesSection.items():
# emulate standard library's getboolean()
value = value.strip().lower()
if value == "0" or value == "no" or value == "false" or \
value == "off":
self.hiddeniDevices.append(key.lower())
#self.deprecatediDevices = [ "flash with text", "flash movie", ...]
# and UN-Load from the list of "deprecated" iDevices
if self.configParser.has_section('deprecated'):
deprecatedSection = self.configParser.deprecated
for key,value in deprecatedSection.items():
# emulate standard library's getboolean()
value = value.strip().lower()
if value == "1" or value == "yes" or value == "true" or \
value == "on":