本文整理汇总了Python中pluginmanager.PluginManager.getPluginClassList方法的典型用法代码示例。如果您正苦于以下问题:Python PluginManager.getPluginClassList方法的具体用法?Python PluginManager.getPluginClassList怎么用?Python PluginManager.getPluginClassList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pluginmanager.PluginManager
的用法示例。
在下文中一共展示了PluginManager.getPluginClassList方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Multimobilewidget
# 需要导入模块: from pluginmanager import PluginManager [as 别名]
# 或者: from pluginmanager.PluginManager import getPluginClassList [as 别名]
class Multimobilewidget(plasmascript.Applet):
def __init__(self, parent, args=None):
plasmascript.Applet.__init__(self, parent)
def init(self):
self.setHasConfigurationInterface(False)
self.setAspectRatioMode(Plasma.Square)
self.theme = Plasma.Svg(self)
self.setBackgroundHints(Plasma.Applet.DefaultBackground)
self.layout = QGraphicsLinearLayout(Qt.Vertical, self.applet)
self.getLogin()
self.setHasConfigurationInterface(True)
self.label = Plasma.Label(self.applet)
self.label.setText(i18n("Welcome to the Multimobilewidget"))
nrlabel = Plasma.Label(self.applet)
nrlabel.setText(i18n("Phonenr(s)"))
self.messagelabel = Plasma.Label(self.applet)
self.messagelabel.setText(i18n("Message - 0 signs used"))
self.nrfield = Plasma.LineEdit()
self.messageText = Plasma.TextEdit(self.applet)
self.messageText.nativeWidget()
sendButton = Plasma.PushButton(self.applet)
sendButton.setText(i18n("Send the SMS!"))
sendButton.resize(20, 40)
configButton = Plasma.PushButton(self.applet)
configButton.setText("Config")
configButton.resize(20, 40)
self.layout.addItem(self.label)
self.layout.addItem(nrlabel)
self.layout.addItem(self.nrfield)
self.layout.addItem(self.messagelabel)
self.layout.addItem(self.messageText)
self.layout.addItem(sendButton)
self.layout.addItem(configButton)
self.applet.setLayout(self.layout)
self.connect(sendButton, SIGNAL("clicked()"), self.onSendClick)
self.connect(configButton, SIGNAL("clicked()"), self.onConfigClick)
self.connect(self.messageText, SIGNAL("textChanged()"), self.onTextChanged)
fullPath = str(self.package().path())
self.providerPluginManager = PluginManager("multimobilewidget/contents/code/providerplugins/","", providerplugins.Provider.Provider)
self.providerpluginlist = self.providerPluginManager.getPluginClassList()
for provider in self.providerpluginlist:
self.ui.providerList.addItem(provider.getObjectname())
print provider.getObjectname()
self.ui.providerList.setCurrentRow(0)
self.adressplugins = PluginManager("multimobilewidget/contents/code/adressplugins/","", adressplugins.AdressPlugin.AdressPlugin)
self.adresspluginlist = self.adressplugins.getPluginClassList()
self.adressList = list()
def onConfigClick(self):
from config import config
self.startAssistant = config(self.providerPluginManager, self.adressplugins)
self.startAssistant.show()
self.connect(self.startAssistant, SIGNAL("finished(int)"), self.getLogin)
def connectToAkonadi(self):
self.akonadiEngine = Plasma.DataEngine()
self.akonadiEngine.setName("akonadi")
def onSendClick(self):
for provider in self.providerpluginlist:
if(provider.getObjectname() == self.ui.providerList.selectedItems()[0].text()):
sms = provider
if self.ui.smstext.toPlainText() != "":
if self.ui.phonenr.text() != "":
self.getLogin()
try:
sms.setConfig(self.config)
except Exception:
self.onConfigClick()
return
sms.clearNrs()
for nr in re.findall("(\+\d*)", self.ui.phonenr.text()):
sms.addNr(nr)
sms.setText(self.ui.smstext.toPlainText())
savenr = self.ui.phonenr.text()
try:
sms.execute()
# self.notification.setText(i18n("Wurde erfolgreich an <i>%1</i> geschickt!").arg(savenr ))
# self.notification.setTitle("Erfolg!")
# self.notification.sendEvent()
KMessageBox.information(None, i18n("SMS sendet successfully to " + savenr + ". Service: "+sms.getProvidername()), i18n("Success!"))
except Exception, error:
KMessageBox.error(None, i18n(error.message), i18n("Sendproblems"))
self.ui.phonenr.clear()
self.ui.smstext.clear()
else:
KMessageBox.error(None, i18n("Please fill in a phonenr"), i18n("Please fill in a phonenr"))
else:
示例2: standalone
# 需要导入模块: from pluginmanager import PluginManager [as 别名]
# 或者: from pluginmanager.PluginManager import getPluginClassList [as 别名]
class standalone(KMainWindow):
def __init__(self, parent=None):
# QWidget.__init__(sip.simplewrapper)
KMainWindow.__init__(self, parent)
self.ui = Ui_MainWindow()
self.ui.setupUi(self)
self.providerPluginManager = PluginManager("providerplugins","providerplugins", providerplugins.Provider.Provider)
self.providerpluginlist = self.providerPluginManager.getPluginClassList()
for provider in self.providerpluginlist:
self.ui.providerList.addItem(provider.getObjectname())
self.ui.providerList.setCurrentRow(0)
self.adressplugins = PluginManager("adressplugins","adressplugins", adressplugins.AdressPlugin.AdressPlugin)
self.adresspluginlist = self.adressplugins.getPluginClassList()
self.adressList = list()
for adressplugin in self.adresspluginlist:
for adress in adressplugin.getAdressList():
self.adressList.append(adress)
self.co = akonadi.Akonadi.Collection()
self.collectfetch = akonadi.Akonadi.CollectionFetchJob(akonadi.Akonadi.Collection().root(), akonadi.Akonadi.CollectionFetchJob.Recursive)
self.collectionFetcherScope = akonadi.Akonadi.CollectionFetchScope()
self.collectionFetcherScope.setContentMimeTypes(QStringList("text/directory"))
self.collectfetch.setFetchScope(self.collectionFetcherScope)
self.itemfetch = akonadi.Akonadi.ItemFetchJob(akonadi.Akonadi.Collection().root())
completion = KCompletion()
completion.setItems(self.adressList)
completion.setCompletionMode(KGlobalSettings.CompletionPopupAuto)
completion.setParent(self.ui.phonenr)
self.ui.phonenr.setCompletionObject(completion)
self.ui.contactList2.addItems(self.adressList)
self.aboutData = KAboutData (
"Multimobilewidget",
"blubb",
ki18n("Multimobilewidget"),
"0.1.0",
ki18n("Sends sms over the multimobileservice"),
KAboutData.License_GPL,
ki18n("(c) 2010"),
ki18n("This is a app could send sms over the multimobileservices. It's (should be) fully integrated in the kde-world!"),
"http://puzzle.ch",
"[email protected]"
)
self.aboutData.addAuthor(ki18n("Vinzenz Hersche"), ki18n(""), "[email protected]", "http://death-head.ch")
self.aboutData.addCredit(ki18n("#pyqt, #akonadi in freenode"), ki18n("Help on several beginnerproblems - thank you!"))
self.aboutData.addCredit(ki18n("Tschan Daniel"), ki18n("Helps on a akonadi-related signal/slot-question"))
self.ui.actionAbout.triggered.connect(self.onAboutClick)
self.ui.actionSettings.triggered.connect(self.onConfigClick)
self.ui.sendbutton.clicked.connect(self.onSendClick)
self.ui.smstext.textChanged.connect(self.onTextChanged)
self.itemfetch.result.connect(self.itemFetched)
self.collectfetch.collectionsReceived.connect(self.collectionFetched)
#self.connect(self.ui.actionAbout, SIGNAL("triggered()"), self.onAboutClick)
#self.connect(self.ui.actionSettings, SIGNAL("triggered()"), self.onConfigClick)
#self.connect(self.ui.sendbutton, SIGNAL("clicked()"), self.onSendClick)
#self.connect(self.ui.smstext, SIGNAL("textChanged()"), self.onTextChanged)
#self.connect(self.itemfetch, SIGNAL("result(KJob*)"), self.itemFetched)
#self.connect(self.collectfetch, SIGNAL("collectionsReceived(const Akonadi::Collection::List&)"), self.collectionFetched)
self.getLogin()
self.itemfetch.fetchScope().fetchFullPayload()
def itemFetched(self, blubb):
for item in blubb.items():
print str(item.mimeType())
def collectionFetched(self, thelist):
self.itemfetch.setCollection(thelist[0])
self.itemfetch.doStart()
def onConfigClick(self):
from config import config
self.startAssistant = config(self.providerPluginManager, self.adressplugins)
self.startAssistant.show()
self.connect(self.startAssistant, SIGNAL("finished(int)"), self.getLogin)
def onAboutClick(self):
self.kaboutUi = KAboutApplicationDialog(self.aboutData)
self.kaboutUi.show()
def onSendClick(self):
for provider in self.providerpluginlist:
if(provider.getObjectname() == self.ui.providerList.selectedItems()[0].text()):
sms = provider
if self.ui.smstext.toPlainText() != "":
if self.ui.phonenr.text() != "":
self.getLogin()
try:
sms.setConfig(self.config)
except Exception:
self.onConfigClick()
return
sms.clearNrs()
for nr in re.findall("(\+\d*)", self.ui.phonenr.text()):
sms.addNr(nr)
sms.setText(self.ui.smstext.toPlainText())
savenr = self.ui.phonenr.text()
try:
#.........这里部分代码省略.........