本文整理汇总了Python中Plugins类的典型用法代码示例。如果您正苦于以下问题:Python Plugins类的具体用法?Python Plugins怎么用?Python Plugins使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Plugins类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: open
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: submitForm
def submitForm(self):
elements=[]
for e in self.theFrame.findAllElements("*"):
el={}
el["type"] = str(e.localName())
if e.hasAttribute("id"):
el["id"]=str(e.attribute("id"))
if e.hasAttribute("name"):
el["name"]=str(e.attribute("name"))
val= e.evaluateJavaScript('this.value').toPyObject()
if val!=None:
el["value"]=val
elements.append(el)
if "#" in self.parent.current_text.split(" ")[0]:
plugins_list=[]
for p in Plugins.get_plugin_names():
if str(self.parent.current_text.split(" ")[0]).lower().replace("#","") in p:
plugins_list.append(p)
if plugins_list:
plugin_name=plugins_list[0]
pl=Plugins.getCurrentPluginModule(plugin_name)
try:
pl.onFormSubmit(elements)
except:
print("[Duck Launcher] No 'onFormSubmit()' method present in the plugin.")
示例3: showChooseIDELanguage
def showChooseIDELanguage(editor):
dlg = LanguageSelectDlg(editor, lang=Preferences.i18nLanguage,
boaLangs=langs)
try:
if dlg.ShowModal() == wx.ID_OK:
lang, ident = dlg.GetLanguageInfo()
Preferences.i18nLanguage = lang
Plugins.updateRcFile('prefs.rc.py', 'i18nLanguage', 'wx.'+ident)
finally:
dlg.Destroy()
示例4: sendData
def sendData(self, thing, value):
print "data : " , thing, value
if "#" in self.parent.current_text.split(" ")[0]:
plugins_list=[]
for p in Plugins.get_plugin_names():
if str(self.parent.current_text.split(" ")[0]).lower().replace("#","") in p:
plugins_list.append(p)
if plugins_list:
plugin_name=plugins_list[0]
pl=Plugins.getCurrentPluginModule(plugin_name)
try:
pl.onDataSent(thing, value)
except:
print("[Duck Launcher] No 'onDataSent()' method present in the plugin.")
示例5: changeOrder
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)
示例6: openList
def openList(self):
res = []
splitext = os.path.splitext
for filename, ordered, enabled in Plugins.buildPluginExecList():
if os.path.basename(filename) == '__init__.plug-in.py':
continue
name = splitext(splitext(os.path.basename(filename))[0])[0]
if not enabled:
name = splitext(name)[0]
status = _('Disabled')
imgIdx = EditorHelper.imgSystemObjDisabled
else:
fn = filename.lower()
if Preferences.failedPlugins.has_key(fn):
kind, msg = Preferences.failedPlugins[fn]
if kind == 'Skipped':
status = _('Skipped plug-in: %s')% msg
imgIdx = EditorHelper.imgSystemObjPending
else:
status = _('Broken plug-in: %s')% msg
imgIdx = EditorHelper.imgSystemObjBroken
elif fn in Preferences.installedPlugins:
if ordered:
status = _('Installed, ordered')
imgIdx = EditorHelper.imgSystemObjOrdered
else:
status = _('Installed')
imgIdx = EditorHelper.imgSystemObj
else:
status = _('Pending restart')
imgIdx = EditorHelper.imgSystemObjPending
res.append(PluginFileExplNode(name, enabled, status, filename, imgIdx))
return res
示例7: cbPluginList
def cbPluginList(self, widget):
text = Plugins.plugininfo()
msg = gtk.MessageDialog(None, gtk.DIALOG_MODAL,
gtk.MESSAGE_INFO, gtk.BUTTONS_CLOSE,
text)
msg.run()
msg.destroy()
示例8: initPalette
def initPalette(self, inspector, editor):
self.inspector = inspector
self.editor = editor
if Preferences.paletteStyle == 'menu':
mb = self.menuBar
else:
mb = None
# XXX Set these from class
if not hasattr(sys, 'cyclops'):
# 'New' page
palettePage = NewPalettePage(self.palette, PaletteStore.newPalette[0],
'Images/Palette/', self, self.widgetSet, self)
for modelName in PaletteStore.paletteLists['New']:
palettePage.addButton2(modelName,
PaletteStore.newControllers[modelName],
wx.lib.buttons.GenBitmapButton)
if mb: mb.Append(menu=palettePage.menu, title=PaletteStore.newPalette[0])
self.palettePages.append(palettePage)
# Normal control pages
for palette in PaletteStore.palette:
palettePage = PalettePage(self.palette, palette[0],
'Images/Palette/', self, self.widgetSet,
self.componentSB, self)
palettePage.addToggleBitmaps(palette[2], None, None)
self.palettePages.append(palettePage)
if mb: mb.Append(menu=palettePage.menu, title=palette[0])
# Dialog page
## if PaletteStore.dialogPalette[2]:
## self.dialogPalettePage = PanelPalettePage(self.palette,
## PaletteStore.dialogPalette[0],
## 'Images/Palette/', self, self.widgetSet,
## self.componentSB, self)
## for dialog in PaletteStore.dialogPalette[2]:
## self.dialogPalettePage.addButton(
## PaletteStore.compInfo[dialog][0],
## dialog, PaletteStore.compInfo[dialog][1],
## self.OnDialogPaletteClick, None, None,
## wx.lib.buttons.GenBitmapButton)
## self.palettePages.append(self.dialogPalettePage)
## if mb: mb.Append(menu=self.dialogPalettePage.menu,
## title=PaletteStore.dialogPalette[0])
# Zope page
if Plugins.transportInstalled('ZopeLib.ZopeExplorer'):
self.zopePalettePage = ZopePalettePage(self.palette,
PaletteStore.zopePalette[0], 'Images/Palette/',
self, self.widgetSet, self.componentSB, self)
self.zopePalettePage.addToggleBitmaps(
PaletteStore.zopePalette[2], None, None)
self.palettePages.append(self.zopePalettePage)
if mb: mb.Append(menu=self.zopePalettePage.menu,
title=PaletteStore.zopePalette[0])
else:
palettePage = None
示例9: __init__
def __init__(self):
ConfigWrapper.__init__(self, Keys.Plugin.main_dir)
self.__plugins = self.client.get_list(Keys.Plugin.pluginlist, gconf.VALUE_STRING)
for plugin in self.__plugins:
try:
p = Plugins.load(plugin, self)
p.init()
except ImportError, e:
print "Unable to load plugin", plugin
示例10: histograma
def histograma():
# Verifica se existe apenas uma pena selecionada no Dataset Analysis.
if len(ep.EpmDatasetPens.SelectedPens) != 1:
ep.showMsgBox("EPM - Histograma",
"Execute a consulta do Dataset Analysis \n e selecione uma pena antes de aplicar a funcao.",
"Warning")
return 0
# Passa para a variavel 'epm_tag' a variavel selecionada.
epm_tag = ep.EpmDatasetPens.SelectedPens[0].Values
x = epm_tag["Value"]
mu = epm_tag["Value"].mean() # Mediana da amostra
sigma = epm_tag["Value"].std() # Desvio padrao da amostra
# Quantidade de valores que desejamos agrupar. (barras verdes)
num_bins = 20
# Gera o histograma
n, bins, ignore = plt.hist(x, num_bins, normed=1, facecolor='green', alpha=0.5)
# Adiciona uma linha indicando a curva de normalidade (vermelha tracejada)
y = mlab.normpdf(bins, mu, sigma)
plt.plot(bins, y, 'r--')
plt.title("Histograma \n $\mu=" + "{:.3f}".format(mu) + "$, $\sigma=" + "{:.3f}".format(sigma) + "$")
# Mostra na tela o gráfico
plt.subplots_adjust(left=0.15)
plt.show()
示例11: windSpeedPowerChart
def windSpeedPowerChart():
"""Grafico de potencia com a velocidade do vento
Apresenta um grafico de dispersao da potencia com a velocidade do vento e calcula a curva que melhor o representa
"""
if len(ep.EpmDatasetPens.SelectedPens) != 2:
ep.showMsgBox('EPM Python Plugin - Demo Tools', 'Please select two interpolated pens before applying this function!', 'Warning')
return 0
global minSpeed
global nominalPower
runDialogMinSpeedNomPower()
minSpeed = float(minSpeed)
nominalPower = float(nominalPower)
rawSpeed, rawPower = getSpeedPowerValues(ep.EpmDatasetPens.SelectedPens[0], ep.EpmDatasetPens.SelectedPens[1])
speed, power = cleanSpeedPowerData(rawSpeed, rawPower, minSpeed, nominalPower )
xm, ym = windPowerAverage(speed, power)
par0 = [1.0, 1.0, 1500.0, 1.0]
binSpeed = 0.5
parest,cov,infodict,mesg,ier = optimize.leastsq(residualsSPPn4, par0, args=(xm, ym), full_output=True)
xEst = np.arange(xm.min(), xm.max(), binSpeed)
yEst = powerFitPn4(parest, xEst)
posAbove = np.argwhere(yEst > nominalPower)
yEst[posAbove] = nominalPower
fig1 = plt.figure()
ax1 = fig1.add_subplot(1, 1, 1)
ax1.set_ylim(0, 1.05*nominalPower)
ax1.set_xlim(minSpeed-1, 1.1*speed.max())
ax1.set_xlabel(r'$Speed (m/s)$')
ax1.set_ylabel(r'$Power (KW)$')
ax1.scatter(speed, power)
ax1.plot(xEst, yEst, color='r', linewidth=3)
plt.show()
示例12: removeoutlier
def removeoutlier():
if len(ep.EpmDatasetPens.SelectedPens) != 1:
ep.showMsgBox("EPM - Histograma",
"Execute a consulta do Dataset Analysis \n e selecione uma pena antes de aplicar a funcao.",
"Warning")
return 0
epm_tag = ep.EpmDatasetPens.SelectedPens[0].Values
FATOR = 1.5
values = epm_tag["Value"]
q3, q1 = np.percentile(values, [75, 25])
iqr = q3 - q1
lowpass = q1 - (iqr * FATOR)
highpass = q3 + (iqr * FATOR)
epmarray = np.dtype([('Value','>f8'),('Timestamp','object'),('Quality','object')])
print data
ep.plotValues('No_Outliers',values)
示例13: windDirectionPieChart
def windDirectionPieChart():
"""Grafico de pizza da direcao do vento
Apresenta um grafico de pizza baseado no percentual de tempo da direcao do vento
"""
if len(ep.EpmDatasetPens.SelectedPens) != 1:
ep.showMsgBox('EPM Python Plugin - Demo Tools', 'Please select one pen before applying this function!', 'Warning')
return 0
rawDirection = ep.EpmDatasetPens.SelectedPens[0]
nodesPercents, nodesLabels = percentTimeIn(rawDirection.Values)
colors = ['blue','yellowgreen', 'cyan', 'gold', 'lightskyblue', 'magenta', 'green', 'lightcoral']
plt.pie(nodesPercents[:,1], labels=nodesLabels, colors=colors,autopct='%1.1f%%', shadow=False, startangle=90)
plt.axis('equal')
plt.show()
示例14: PolarScatterWindDirection
def PolarScatterWindDirection():
"""Grafico polar de dispersao da direcaodo vento
Apresenta um grafico polar de dispersao com a direcao do vento
"""
if len(ep.EpmDatasetPens.SelectedPens) != 2:
ep.showMsgBox('EPM Python Plugin - Demo Tools', 'Please select 2 interpolated pens before applying this function!', 'Warning')
return 0
speed, direction = getSpeedDirectionValues(ep.EpmDatasetPens.SelectedPens[0], ep.EpmDatasetPens.SelectedPens[1])
ax1 = plt.subplot(111, polar=True)
ax1.set_theta_zero_location('N')
ax1.set_theta_direction(-1)
ax1.grid(True)
ax1.xaxis.set_ticklabels(['N',r"$45^{o}$",'E',r"$135^{o}$",'S',r"$225^{o}$",'W', r"$315^{o}$"])
ax1.set_title("Wind direction", va='bottom')
ax1.plot(direction, speed, 'bo')
plt.show()
示例15: PolarScatterAreaWind
def PolarScatterAreaWind():
"""Grafico polar de dispersao-area da direcao, velocidade e potencia do vento
Apresenta um grafico polar de dispersao com a direcao, a velocidade e potencia do vento
"""
if len(ep.EpmDatasetPens.SelectedPens) != 3:
ep.showMsgBox('EPM Python Plugin - Demo Tools', 'Please select 3 interpolated pens before applying this function!', 'Warning')
return 0
speed, direction, power = getSpeedPowerDirectionValues(ep.EpmDatasetPens.SelectedPens[0], ep.EpmDatasetPens.SelectedPens[1],
ep.EpmDatasetPens.SelectedPens[2])
colors = power/1000.
area = np.pi * speed**2
ax1 = plt.subplot(111, polar=True)
ax1.set_theta_zero_location('N')
ax1.set_theta_direction(-1)
ax1.xaxis.set_ticklabels(['N',r"$45^{o}$",'E',r"$135^{o}$",'S',r"$225^{o}$",'W', r"$315^{o}$"])
c = plt.scatter(direction, speed, c=colors, s=area, cmap=plt.cm.hsv)
c.set_alpha(0.75)
plt.show()