本文整理汇总了Python中Plugins.writePluginsState方法的典型用法代码示例。如果您正苦于以下问题:Python Plugins.writePluginsState方法的具体用法?Python Plugins.writePluginsState怎么用?Python Plugins.writePluginsState使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Plugins
的用法示例。
在下文中一共展示了Plugins.writePluginsState方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: open
# 需要导入模块: import Plugins [as 别名]
# 或者: from Plugins import writePluginsState [as 别名]
def open(self, editor):
""" """
if self.pluginEnabled:
msg = _('Disable')
else:
msg = _('Enable')
if wx.MessageBox('%s %s?'%(msg, self.name), _('Confirm Toggle Plug-in'),
wx.YES_NO | wx.ICON_QUESTION) == wx.YES:
section = getPluginSection(self.resourcepath)
ordered, disabled = Plugins.readPluginsState(section)
if self.pluginEnabled:
disabled.append(self.name)
else:
try:
disabled.remove(self.name)
except ValueError:
pass
#Plugins.writeInitPluginGlobals(initPluginPath, initPluginGlobals)
Plugins.writePluginsState(section, ordered, disabled)
editor.explorer.list.refreshCurrent()
return None, None
示例2: changeOrder
# 需要导入模块: import Plugins [as 别名]
# 或者: from Plugins import writePluginsState [as 别名]
def changeOrder(self, direction):
section = getPluginSection(self.resourcepath)
#initPluginPath = os.path.dirname(self.resourcepath)
ordered, disabled = Plugins.readPluginsState(section)
#ordered = initPluginGlobals['__ordered__']
try:
idx = ordered.index(self.name)
except ValueError:
idx = len(ordered)+1
else:
del ordered[idx]
idx = max(idx + direction, 0)
if idx <= len(ordered):
ordered.insert(idx, self.name)
#Plugins.writeInitPluginGlobals(initPluginPath, initPluginGlobals)
Plugins.writePluginsState(section, ordered, disabled)