本文整理汇总了Python中puddlestuff.puddleobjects.PuddleConfig.set方法的典型用法代码示例。如果您正苦于以下问题:Python PuddleConfig.set方法的具体用法?Python PuddleConfig.set怎么用?Python PuddleConfig.set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类puddlestuff.puddleobjects.PuddleConfig
的用法示例。
在下文中一共展示了PuddleConfig.set方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: applySettings
# 需要导入模块: from puddlestuff.puddleobjects import PuddleConfig [as 别名]
# 或者: from puddlestuff.puddleobjects.PuddleConfig import set [as 别名]
def applySettings(self, *args):
cparser = PuddleConfig(CONFIGPATH)
fields = self.getItems()
cparser.set('view_all_fields', 'fields', fields)
if state:
show_all_fields()
示例2: changeProfile
# 需要导入模块: from puddlestuff.puddleobjects import PuddleConfig [as 别名]
# 或者: from puddlestuff.puddleobjects.PuddleConfig import set [as 别名]
def changeProfile(self, index):
try:
self.profile = self.profiles[index]
except IndexError:
return
cparser = PuddleConfig()
cparser.set('masstagging', 'lastindex', index)
示例3: closeEvent
# 需要导入模块: from puddlestuff.puddleobjects import PuddleConfig [as 别名]
# 或者: from puddlestuff.puddleobjects.PuddleConfig import set [as 别名]
def closeEvent(self, e):
preview_msg = translate('Previews',
'Some files have uncommited previews. '
'These changes will be lost once you exit puddletag. <br />'
'Do you want to exit without writing those changes?<br />')
if tagmodel.has_previews(parent=self, msg=preview_msg):
e.ignore()
return False
controls = PuddleDock._controls
for control in PuddleDock._controls.values():
if hasattr(control, 'saveSettings'):
try:
control.saveSettings(self)
except TypeError:
control.saveSettings()
cparser = PuddleConfig()
settings = QSettings(constants.QT_CONFIG, QSettings.IniFormat)
if self._lastdir:
cparser.set('main', 'lastfolder', unicode(self._lastdir[0], 'utf8'))
cparser.set("main", "maximized", self.isMaximized())
settings.setValue('main/state', QVariant(self.saveState()))
headstate = self._table.horizontalHeader().saveState()
settings.setValue('table/header', QVariant(headstate))
genres.save_genres(status['genres'])
e.accept()
示例4: applyPrefs
# 需要导入模块: from puddlestuff.puddleobjects import PuddleConfig [as 别名]
# 或者: from puddlestuff.puddleobjects.PuddleConfig import set [as 别名]
def applyPrefs(self, values):
musicdir = values[0]
self.musicdir = musicdir
cparser = PuddleConfig()
cparser.set('exampletagsource', 'musicdir', musicdir)
self.preferences[0][2] = musicdir
isdir = os.path.isdir
join = os.path.join
musicdir = musicdir.encode('utf8')
self._dirs = [z for z in os.listdir(musicdir) if isdir(join(musicdir,z))]
示例5: applySettings
# 需要导入模块: from puddlestuff.puddleobjects import PuddleConfig [as 别名]
# 或者: from puddlestuff.puddleobjects.PuddleConfig import set [as 别名]
def applySettings(self, control=None):
cparser = PuddleConfig()
x = lambda c: c.getRgb()[:-1]
colors = [x(self.listbox.item(z,0).background().color())
for z in range(self.listbox.rowCount())]
cparser.set('table', 'selected_color', colors[0])
cparser.set('table', 'preview_color', colors[1])
cparser.set('extendedtags', 'add', colors[2])
cparser.set('extendedtags', 'edit', colors[3])
cparser.set('extendedtags', 'remove', colors[4])
control.model().selectionBackground = QColor.fromRgb(*colors[0])
control.model().previewBackground = QColor.fromRgb(*colors[1])
示例6: applySettings
# 需要导入模块: from puddlestuff.puddleobjects import PuddleConfig [as 别名]
# 或者: from puddlestuff.puddleobjects.PuddleConfig import set [as 别名]
def applySettings(self, control = None):
from puddlestuff.puddletag import remove_shortcuts, add_shortcuts
remove_shortcuts('&Actions', self._names)
f = open(FILENAME, 'w')
f.close()
cparser = PuddleConfig(FILENAME)
for i, item in enumerate(self._listbox.items()):
section = SHORTCUT_SECTION + unicode(i)
cparser.set(section, NAME, item.actionName)
cparser.set(section, FILENAMES, item.filenames)
from puddlestuff.mainwin.funcs import applyaction
shortcuts = create_action_shortcuts(applyaction, control)
for item, shortcut in zip(self._listbox.items(), shortcuts):
if item.shortcut:
shortcut.setShortcut(item.shortcut)
add_shortcuts('&Actions', shortcuts, save=True)
示例7: save
# 需要导入模块: from puddlestuff.puddleobjects import PuddleConfig [as 别名]
# 或者: from puddlestuff.puddleobjects.PuddleConfig import set [as 别名]
def save(filename=None, confirmations=None):
if filename is None:
filename = _filename
cparser = PuddleConfig(filename)
if confirmations is None:
confirmations = _confirmations
for i, name in enumerate(confirmations):
set_value = lambda k,v: cparser.set(SECTION + unicode(i), k, v)
set_value(NAME, name)
set_value(VALUE, confirmations[name][0])
set_value(DESC, confirmations[name][1])
示例8: savesettings
# 需要导入模块: from puddlestuff.puddleobjects import PuddleConfig [as 别名]
# 或者: from puddlestuff.puddleobjects.PuddleConfig import set [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])
示例9: saveset
# 需要导入模块: from puddlestuff.puddleobjects import PuddleConfig [as 别名]
# 或者: from puddlestuff.puddleobjects.PuddleConfig import set [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)
示例10: save_shortcut
# 需要导入模块: from puddlestuff.puddleobjects import PuddleConfig [as 别名]
# 或者: from puddlestuff.puddleobjects.PuddleConfig import set [as 别名]
def save_shortcut(name, filenames):
cparser = PuddleConfig(FILENAME)
section = SHORTCUT_SECTION + unicode(len(cparser.sections()))
cparser.set(section, NAME, name)
cparser.set(section, FILENAMES, filenames)
示例11: applySettings
# 需要导入模块: from puddlestuff.puddleobjects import PuddleConfig [as 别名]
# 或者: from puddlestuff.puddleobjects.PuddleConfig import set [as 别名]
def applySettings(self, control=None):
to_load = self.get_to_load()
cparser = PuddleConfig()
cparser.set('plugins', 'to_load', to_load)
示例12: save_mtp
# 需要导入模块: from puddlestuff.puddleobjects import PuddleConfig [as 别名]
# 或者: from puddlestuff.puddleobjects.PuddleConfig import set [as 别名]
def save_mtp(mtp, filename=CONFIG):
cparser = PuddleConfig(filename)
info_section = 'info'
cparser.set(info_section, NAME, mtp.name)
for key in ['name', 'desc', 'file_pattern', 'fields',
'jfdi', 'leave_existing']:
cparser.set(info_section, key, getattr(mtp, key))
for key in ['album_bound', 'track_bound']:
cparser.set(info_section, key, int(getattr(mtp, key) * 100))
cparser.set(info_section, 'numsources', len(mtp.profiles))
for num, tsp in enumerate(mtp.profiles):
section = 'config%s' % num
name = tsp.tag_source.name if tsp.tag_source else u''
cparser.set(section, 'source', name)
cparser.set(section, 'if_no_result', tsp.if_no_result)
cparser.set(section, 'fields', u','.join(tsp.fields))
cparser.set(section, 'replace_fields', u','.join(tsp.replace_fields))
示例13: saveSettings
# 需要导入模块: from puddlestuff.puddleobjects import PuddleConfig [as 别名]
# 或者: from puddlestuff.puddleobjects.PuddleConfig import set [as 别名]
def saveSettings(self, actions):
cparser = PuddleConfig(os.path.join(CONFIGDIR, 'user_shortcuts'))
for action in actions:
shortcut = unicode(action.shortcut().toString())
cparser.set('shortcuts', unicode(action.text()), shortcut)
示例14: save_gen_settings
# 需要导入模块: from puddlestuff.puddleobjects import PuddleConfig [as 别名]
# 或者: from puddlestuff.puddleobjects.PuddleConfig import set [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)
示例15: saveSettings
# 需要导入模块: from puddlestuff.puddleobjects import PuddleConfig [as 别名]
# 或者: from puddlestuff.puddleobjects.PuddleConfig import set [as 别名]
def saveSettings(self):
settings = PuddleConfig()
settings.set('editor', 'patterns', self.items())
settings.set('editor', 'index', self.currentIndex())