本文整理汇总了Python中Plugins.get_plugin_names方法的典型用法代码示例。如果您正苦于以下问题:Python Plugins.get_plugin_names方法的具体用法?Python Plugins.get_plugin_names怎么用?Python Plugins.get_plugin_names使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Plugins
的用法示例。
在下文中一共展示了Plugins.get_plugin_names方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: submitForm
# 需要导入模块: import Plugins [as 别名]
# 或者: from Plugins import get_plugin_names [as 别名]
def submitForm(self):
elements=[]
for e in self.webview.page().mainFrame().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.current_text.split(" ")[0]:
plugins_list=[]
for p in Plugins.get_plugin_names():
if str(self.current_text.split(" ")[0]).lower().replace("#","") in p:
plugins_list.append(p)
if plugins_list:
plugin_name=plugins_list[0]
pl=getCurrentPluginModule(plugin_name)
try:
pl.onFormSubmit(elements)
except:
print("[Duck Launcher] No 'onFormSubmit()' method present in the plugin.")
示例2: sendData
# 需要导入模块: import Plugins [as 别名]
# 或者: from Plugins import get_plugin_names [as 别名]
def sendData(self, thing, value):
print "data : " , thing, value
if "#" in self.current_text.split(" ")[0]:
plugins_list=[]
for p in Plugins.get_plugin_names():
if str(self.current_text.split(" ")[0]).lower().replace("#","") in p:
plugins_list.append(p)
if plugins_list:
plugin_name=plugins_list[0]
pl=getCurrentPluginModule(plugin_name)
try:
pl.onDataSent(thing, value)
except:
print("[Duck Launcher] No 'onDataSent()' method present in the plugin.")
示例3: paintEvent
# 需要导入模块: import Plugins [as 别名]
# 或者: from Plugins import get_plugin_names [as 别名]
def paintEvent(self,e):
qp=QtGui.QPainter(self)
qp.fillRect(e.rect(), QtCore.Qt.transparent)
qp.setRenderHints(QtGui.QPainter.Antialiasing | QtGui.QPainter.SmoothPixmapTransform)
####DRAW
qp.setPen(QtCore.Qt.NoPen)
qp.setBrush(QtGui.QColor(int(self.conf['r2']),int(self.conf['g2']),int(self.conf['b2']),int(self.conf["alpha"])))
qp.drawRect(0,0,self.pos_x+7,self.s_height)
qp.setPen(QtGui.QPen(QtGui.QColor(int(self.conf['r']),int(self.conf['g']),int(self.conf['b'])), 3, QtCore.Qt.SolidLine))
qp.drawRect(self.pos_x+5,0,2,self.s_height)
if self.current_state!="half_open":
qp.setPen(QtGui.QPen(QtGui.QColor(int(self.conf['r']),int(self.conf['g']),int(self.conf['b']),30), 2, QtCore.Qt.SolidLine))
qp.drawLine(self.pos_x-14,0,self.pos_x-14,self.s_height)
qp.setPen(QtGui.QPen(QtGui.QColor(int(self.conf['r']),int(self.conf['g']),int(self.conf['b'])), 4, QtCore.Qt.SolidLine))
qp.setBrush(QtGui.QBrush(QtGui.QColor(int(self.conf['r']),int(self.conf['g']),int(self.conf['b']))))
r_s=2
a=10
r = QtCore.QRectF(self.pos_x-7,self.s_height/2-r_s/2,r_s,r_s)
qp.drawEllipse(r)
r = QtCore.QRectF(self.pos_x-7,self.s_height/2-a-r_s/2,r_s,r_s)
qp.drawEllipse(r)
r = QtCore.QRectF(self.pos_x-7,self.s_height/2+a-r_s/2,r_s,r_s)
qp.drawEllipse(r)
##
###
if self.current_state == "half_open":
qp.setPen(QtGui.QPen(QtGui.QColor(0,0,0,0),1,QtCore.Qt.SolidLine))
qp.setBrush(QtGui.QColor(int(self.conf['r']),int(self.conf['g']),int(self.conf['b'])))
qp.drawRect(0,0,self.pos_x+7,self.OPEN_STATE_TOP)
rect = QtCore.QRectF(50,0,150,50)
####DRAW BUTTONS
###Apps
ICO_TOP=self.HALF_OPEN_POS-5
icon = QtGui.QIcon("/usr/share/duck-launcher/default-theme/apps.svg")
icon.paint(qp,5,ICO_TOP*0+5,ICO_TOP,ICO_TOP-6)
#Files
icon = QtGui.QIcon("/usr/share/duck-launcher/default-theme/file.svg")
##temp_file
icon.paint(qp,5,ICO_TOP*1+5,ICO_TOP,ICO_TOP-6)
#Settings
icon = QtGui.QIcon("/usr/share/duck-launcher/default-theme/settings.svg")
icon.paint(qp,5,ICO_TOP*2+5,ICO_TOP,ICO_TOP-6)
#Star
icon = QtGui.QIcon("/usr/share/duck-launcher/default-theme/star.svg")
icon.paint(qp,5,ICO_TOP*3+5,ICO_TOP,ICO_TOP-6)
#####
#Dock Apps
for i,a in enumerate(self.dock_apps):
try:
QtGui.QIcon(a['icon']).paint(qp,6,self.OPEN_STATE_TOP+ICO_TOP*i+10,ICO_TOP-5,ICO_TOP-5)
except KeyError:
print("[Duck Launcher] Error: Some apps could not be found ")
#Open Windows Button
qp.setPen(QtGui.QPen(QtGui.QColor(250,250,250), 2, QtCore.Qt.SolidLine))
icon = QtGui.QIcon("/usr/share/duck-launcher/default-theme/open-apps.svg")
#icon = QtGui.QIcon("test-1.svg")
icon.paint(qp,10,self.s_height-ICO_TOP*2-10,ICO_TOP-10,ICO_TOP-10)
#rect = QtCore.QRectF(10,self.s_height-ICO_TOP*2-10,ICO_TOP-10,ICO_TOP-10)
#qp.setFont(QtGui.QFont(self.conf["font"],self.HALF_OPEN_POS/3))
#qp.drawText(rect, QtCore.Qt.AlignCenter, str(len(self.open_windows)))
#System button
icon = QtGui.QIcon("/usr/share/duck-launcher/default-theme/sys.svg")
icon.paint(qp,10,self.s_height-self.HALF_OPEN_POS+8,self.HALF_OPEN_POS-15,self.HALF_OPEN_POS-15)
##
##
if self.current_state=="open":
close=QtGui.QIcon("/usr/share/duck-launcher/default-theme/remove.svg")
close.paint(qp,self.pos_x-13,self.s_height-13,13,13)
if self.activity=="apps":
#Current Text
qp.setPen(QtCore.Qt.NoPen)
qp.setFont(QtGui.QFont(self.conf["font"],10))
t_rect=QtCore.QRectF(20,20,self.s_width-36,20)
if self.current_text=='':
self.plugin=False
qp.setPen(QtGui.QPen(QtGui.QColor(250,250,250), 2, QtCore.Qt.SolidLine))
qp.drawText(t_rect, QtCore.Qt.AlignLeft, "Type to search")
else:
if "#" in self.current_text.split(" ")[0]:
plugins_list=[]
for p in Plugins.get_plugin_names():
if str(self.current_text.split(" ")[0]).lower().replace("#","") in p:
plugins_list.append(p)
if plugins_list:
what_in_text=str(self.current_text.split(" ")[0].replace("#","")).lower()
query_name=plugins_list[0]
fm=QtGui.QFontMetrics(QtGui.QFont(self.conf["font"],10))
whole_width=0
for i,s in enumerate("#{}".format(query_name)):
w = int(fm.charWidth("#{}".format(query_name),i))
whole_width+=w
if query_name==what_in_text:
qp.setBrush(QtGui.QColor(int(self.conf["r"]),int(self.conf["g"]),int(self.conf["b"]),150))
qp.drawRoundedRect(QtCore.QRectF(19,18,whole_width+4,20), 2,2)
else:pass
qp.setPen(QtGui.QPen(QtGui.QColor(255,255,255), 2, QtCore.Qt.SolidLine))
qp.drawText(t_rect, QtCore.Qt.AlignLeft,self.current_text)
else:
qp.setPen(QtGui.QPen(QtGui.QColor(255,255,255), 2, QtCore.Qt.SolidLine))
#.........这里部分代码省略.........
示例4: paintEvent
# 需要导入模块: import Plugins [as 别名]
# 或者: from Plugins import get_plugin_names [as 别名]
#.........这里部分代码省略.........
#font
font = QtGui.QFont(self.conf["font"],9)
font.setLetterSpacing(QtGui.QFont.PercentageSpacing,116)
font.setWeight(QtGui.QFont.Normal)
font.setHintingPreference(QtGui.QFont.PreferDefaultHinting)
qp.setFont(font)
qp.drawText(text_rect,QtCore.Qt.TextWordWrap |QtCore.Qt.AlignHCenter,self.tr(app["name"]).replace(u"Â", ""))
elif self.plugin==True:
qp.setPen(QtCore.Qt.NoPen)
qp.setBrush(QtGui.QColor(self.fg_color[0],self.fg_color[1],self.fg_color[2]))
pl_rect=QtCore.QRect(0,0,self.pl_rect_pos,self.s_height)
qp.drawRect(pl_rect)
#Current Text
qp.setPen(QtCore.Qt.NoPen)
font = QtGui.QFont(self.conf["font"],10)
font.setWeight(QtGui.QFont.Bold)
qp.setFont(font)
t_rect=QtCore.QRectF(20,18,self.s_width-36,20)
t_rect_pl=QtCore.QRectF(70,18,self.s_width-36,20)
if self.current_text=='':
font = QtGui.QFont(self.conf["font"],10)
font.setWeight(QtGui.QFont.Light)
font.setStyle(QtGui.QFont.StyleItalic)
qp.setFont(font)
self.plugin=False
qp.setPen(QtGui.QPen(QtGui.QColor(self.font_color[0],self.font_color[1],self.font_color[2],160), 1, QtCore.Qt.SolidLine))
qp.drawText(t_rect, QtCore.Qt.AlignLeft, "Type to search")
else:
font = QtGui.QFont(self.conf["font"],10)
#font.setWeight(QtGui.QFont.Light)
qp.setFont(font)
if "#" in self.current_text.split(" ")[0]:
plugins_list=[]
for p in Plugins.get_plugin_names():
if str(self.current_text.split(" ")[0]).lower().replace("#","") in p:
plugins_list.append(p)
if plugins_list:
what_in_text=str(self.current_text.split(" ")[0].replace("#","")).lower()
query_name=plugins_list[0]
font =QtGui.QFont(self.conf["font"],10)
fm=QtGui.QFontMetrics(QtGui.QFont(self.conf["font"],10))
whole_width=0
for i,s in enumerate("#{}".format(query_name)):
w = int(fm.charWidth("#{}".format(query_name),i))
whole_width+=w
if query_name==what_in_text:
if self.plugin==False:
qp.setBrush(QtGui.QColor(self.fg_color[0],self.fg_color[1],self.fg_color[2],255))
qp.drawRect(19,37,whole_width+4,3)
qp.setPen(QtGui.QPen(QtGui.QColor(self.font_color[0],self.font_color[1],self.font_color[2]),1, QtCore.Qt.SolidLine))
qp.drawText(t_rect, QtCore.Qt.AlignLeft,self.current_text)
else:
qp.setBrush(QtGui.QColor(self.font_color[0],self.font_color[1],self.font_color[2],255))
qp.drawRect(69,37,whole_width+4,3)
qp.setPen(QtGui.QPen(QtGui.QColor(self.font_color[0],self.font_color[1],self.font_color[2]),1, QtCore.Qt.SolidLine))
qp.drawText(t_rect_pl, QtCore.Qt.AlignLeft,self.current_text)
if self.pl_logo!=None:
ico = QtGui.QIcon(self.pl_logo)
ico.paint(qp,15,10,40,40)
else:
qp.setPen(QtGui.QPen(QtGui.QColor(self.font_color[0],self.font_color[1],self.font_color[2]),1, QtCore.Qt.SolidLine))
qp.drawText(t_rect, QtCore.Qt.AlignLeft,self.current_text)
else:
qp.setPen(QtGui.QPen(QtGui.QColor(self.font_color[0],self.font_color[1],self.font_color[2]), 2, QtCore.Qt.SolidLine))
qp.drawText(t_rect, QtCore.Qt.AlignLeft,self.current_text)
else: