本文整理汇总了Python中puddlestuff.puddleobjects.PuddleConfig.filename方法的典型用法代码示例。如果您正苦于以下问题:Python PuddleConfig.filename方法的具体用法?Python PuddleConfig.filename怎么用?Python PuddleConfig.filename使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类puddlestuff.puddleobjects.PuddleConfig
的用法示例。
在下文中一共展示了PuddleConfig.filename方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: savesettings
# 需要导入模块: from puddlestuff.puddleobjects import PuddleConfig [as 别名]
# 或者: from puddlestuff.puddleobjects.PuddleConfig import filename [as 别名]
def savesettings(d, filepath=None):
settings = PuddleConfig()
if filepath:
settings.filename = filepath
else:
settings.filename = os.path.join(settings.savedir, 'tagpanel')
settings.set('panel', 'numrows', unicode(len(d)))
for row, rowtags in d.items():
settings.set(unicode(row), 'tags', [z[1] for z in rowtags])
settings.set(unicode(row), 'titles', [z[0] for z in rowtags])
示例2: connect_action_shortcuts
# 需要导入模块: from puddlestuff.puddleobjects import PuddleConfig [as 别名]
# 或者: from puddlestuff.puddleobjects.PuddleConfig import filename [as 别名]
def connect_action_shortcuts(actions):
cparser = PuddleConfig()
cparser.filename = ls.menu_path
for action in actions:
shortcut = cparser.get('shortcuts', unicode(action.text()), '')
if shortcut:
action.setShortcut(shortcut)
示例3: loadsets
# 需要导入模块: from puddlestuff.puddleobjects import PuddleConfig [as 别名]
# 或者: from puddlestuff.puddleobjects.PuddleConfig import filename [as 别名]
def loadsets():
algos = []
if not os.path.exists(DUPEDIR):
os.makedirs(DUPEDIR)
saveset(**DEFAULTSET)
files = [os.path.join(DUPEDIR, z) for z in os.listdir(DUPEDIR)]
sets = []
cparser = PuddleConfig()
for f in files:
cparser.filename = f
name = cparser.get('info', 'name', '')
disp = cparser.get('info', 'disp', [])
algos = []
for section in cparser.sections():
if section == 'info':
continue
tags = cparser.get(section, 'tags', [])
threshold = float(cparser.get(section, 'threshold', '0.85'))
func = cparser.get(section, 'func', '')
matchcase = cparser.get(section, 'matchcase', True)
maintag = cparser.get(section, 'maintag', 'artist')
algos.append(Algo(tags, threshold, func, matchcase))
sets.append([name, disp, algos, maintag])
return sets
示例4: load_gen_settings
# 需要导入模块: from puddlestuff.puddleobjects import PuddleConfig [as 别名]
# 或者: from puddlestuff.puddleobjects.PuddleConfig import filename [as 别名]
def load_gen_settings(setlist, extras=False):
settings = PuddleConfig()
settings.filename = os.path.join(settings.savedir, 'gensettings')
ret = []
for setting in setlist:
desc = setting[0]
default = setting[1]
ret.append([desc, settings.get(desc, 'value', default)])
return ret
示例5: create_tool_windows
# 需要导入模块: from puddlestuff.puddleobjects import PuddleConfig [as 别名]
# 或者: from puddlestuff.puddleobjects.PuddleConfig import filename [as 别名]
def create_tool_windows(parent, extra=None):
"""Creates the dock widgets for the main window (parent) using
the modules stored in puddlestuff/mainwin.
Returns (the toggleViewActions of the docks, the dockWidgets the
mselves)."""
actions = []
docks = []
cparser = PuddleConfig()
cparser.filename = ls.menu_path
widgets = (
mainwin.tagpanel,
mainwin.artwork,
mainwin.dirview,
mainwin.patterncombo,
mainwin.filterwin,
puddlestuff.webdb,
mainwin.storedtags,
mainwin.logdialog,
puddlestuff.masstag.dialogs,
)
controls = [z.control for z in widgets]
controls.extend(mainwin.action_dialogs.controls)
if extra:
controls.extend(extra)
for z in controls:
name = z[0]
try:
if not z[2]:
PuddleDock._controls[name] = z[1](status=status)
continue
except IndexError:
pass
p = PuddleDock(z[0], z[1], parent, status)
parent.addDockWidget(z[2], p)
try:
if z[4]:
p.setFloating(True)
p.move(parent.rect().center())
except IndexError:
pass
p.setVisible(z[3])
docks.append(p)
action = p.toggleViewAction()
action.setText(name)
scut = cparser.get("winshortcuts", name, "")
if scut:
action.setShortcut(scut)
actions.append(action)
return actions, docks
示例6: loadsettings
# 需要导入模块: from puddlestuff.puddleobjects import PuddleConfig [as 别名]
# 或者: from puddlestuff.puddleobjects.PuddleConfig import filename [as 别名]
def loadsettings(filepath = None):
settings = PuddleConfig()
if filepath:
settings.filename = filepath
else:
settings.filename = os.path.join(CONFIGDIR, 'tagpanel')
numrows = settings.get('panel','numrows',-1, True)
if numrows > -1:
sections = settings.sections()
d = {}
for row in xrange(numrows):
section = unicode(row)
tags = settings.get(section, 'tags', [''])
titles = settings.get(section, 'titles', [''])
d[row] = zip(titles, tags)
else:
titles = ['&Artist', '&Title', 'Al&bum', 'T&rack', u'&Year', "&Genre", '&Comment']
tags = ['artist', 'title', 'album', 'track', u'year', 'genre', 'comment']
newtags = zip(titles, tags)
d = {0:[newtags[0]], 1:[newtags[1]], 2: [newtags[2]],
3:[newtags[3], newtags[4], newtags[5]] ,
4:[newtags[6]]}
return d
示例7: saveset
# 需要导入模块: from puddlestuff.puddleobjects import PuddleConfig [as 别名]
# 或者: from puddlestuff.puddleobjects.PuddleConfig import filename [as 别名]
def saveset(setname, disp, algs, maintag):
cparser = PuddleConfig()
filename = os.path.join(DUPEDIR, setname)
open(filename, 'w').close() #I have to clear the file because if a previous
#set had more algos then the extra algos will get loaded.
cparser.filename = filename
algs = [{'tags': a.tags, 'threshold': a.threshold,
'func': a.func.__name__, 'matchcase': a.matchcase,
'maintag': maintag} for a in algs]
cparser.set('info', 'name', setname)
cparser.set('info', 'disp', disp)
for i, a in enumerate(algs):
setname = u'alg' + unicode(i)
for key, val in a.items():
cparser.set(setname, key, val)
示例8: save_gen_settings
# 需要导入模块: from puddlestuff.puddleobjects import PuddleConfig [as 别名]
# 或者: from puddlestuff.puddleobjects.PuddleConfig import filename [as 别名]
def save_gen_settings(setlist):
settings = PuddleConfig()
settings.filename = os.path.join(settings.savedir, 'gensettings')
for desc, value in setlist.items():
settings.set(desc, 'value', value)