本文整理汇总了Python中pluginmanager.PluginManager类的典型用法代码示例。如果您正苦于以下问题:Python PluginManager类的具体用法?Python PluginManager怎么用?Python PluginManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PluginManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: showExportFormats
def showExportFormats(self):
PluginManager.instance().loadPlugins()
qWarning(self.tr("Export formats:"))
formats = PluginManager.objects()
for format in formats:
if format.hasCapabilities(MapFormat.Write):
qWarning(" " + format.nameFilter())
self.quit = True
示例2: main
def main():
manager = PluginManager()
manager.setPluginPaths(["plugins"])
manager.loadPlugins()
app = QApplication(sys.argv)
dialog = PluginDialog(manager)
dialog.show()
app.exec_()
示例3: Client
class Client(object):
def __init__(self):
self.pluginmanager = PluginManager()
self.pluginmanager.loadPlugins()
@classmethod
def loadFont(cls):
"""加载外部字体"""
path = os.path.join(Settings().dataDir, "fonts")
for font in os.listdir(path):
QFontDatabase.addApplicationFont(os.path.join(path, font))
示例4: __init__
def __init__(self, capabilities, initialFilter):
self.mFilter = initialFilter
self.mFormats = QList()
self.mFormatByNameFilter = QMap()
def t(self, format):
if (format.hasCapabilities(capabilities)):
nameFilter = format.nameFilter()
self.mFilter += ";;"
self.mFilter += nameFilter
self.mFormats.append(format)
self.mFormatByNameFilter.insert(nameFilter, format)
PluginManager.each(self, t)
示例5: __init__
class Collector:
""" Main command line interface """
def __init__(self):
""" Initialize the plugin manager """
self.__pluginmanager = PluginManager()
def parse_input(self):
""" Validates user input and delegates to the plugin manager """
if len(sys.argv) > 1:
print "The following plugins are available:\n"
self.__pluginmanager.help_all()
else:
# Call the command in the given plugin with the
# remaining arguments
return self.__pluginmanager.call()
示例6: __init__
def __init__(self, pluginManager=None, localBrowsingMode=True):
"""localBrowsingMode: not implemented yet"""
self.localBrowsingMode = localBrowsingMode
self.pluginManager = pluginManager
if self.pluginManager is None:
from pluginmanager import PluginManager
self.pluginManager = PluginManager()
self.data = {}
self.timestamp = datetime.datetime.today().strftime("%Y%m%d%H%M%S")
self.templatePath = None
self.htmlfilename = None
self.path_root = None
self.htmlfiletitle = None
self.title = None
self.exportMode = ExportSettings.PLAIN_SIMPLE
self._controls = None
self.coordsInWGS84 = False
self.canvas = None
self.mapSettings = None
self.baseExtent = None
self.crs = None
# cache
self._mapTo3d = None
self._quadtree = None
self._templateConfig = None
示例7: __init__
def __init__(self, configdir, file_to_open=None):
super().__init__(['kalpana'])
self.objects = create_objects(configdir)
self.objects['mainwindow'].create_ui(self.objects['chaptersidebar'],
self.objects['textarea'],
self.objects['terminal'])
# Plugins
self.pluginmanager = PluginManager(self.objects.copy())
self.objects['terminal'].update_commands(self.pluginmanager.plugin_commands)
# Signals
connect_others_signals(*self.objects.values())
self.connect_own_signals()
# Hotkeys
set_key_shortcuts(self.objects['mainwindow'], self.objects['textarea'],
self.objects['terminal'],
self.pluginmanager.get_compiled_hotkeys())
self.init_hotkeys()
# Load settings and get it oooon
self.objects['settingsmanager'].load_settings()
self.install_event_filter()
# Try to open a file and die if it doesn't work, or make a new file
if file_to_open:
if not self.objects['textarea'].open_file(file_to_open):
self.close()
else:
self.objects['textarea'].set_filename(new=True)
# FIN
self.objects['mainwindow'].show()
示例8: __init__
def __init__(self, configdir, file_to_open=None, silentmode=False):
super().__init__(['kalpana'])
self.objects = create_objects(configdir)
self.objects['mainwindow'].create_ui(self.objects['chaptersidebar'],
self.objects['textarea'],
self.objects['terminal'])
# Plugins
self.pluginmanager = PluginManager(self.objects.copy(), silentmode)
self.objects['terminal'].update_commands(self.pluginmanager.plugin_commands)
# Signals
connect_others_signals(*self.objects.values())
self.connect_own_signals()
# Hotkeys
set_key_shortcuts(self.objects['mainwindow'], self.objects['textarea'],
self.objects['terminal'],
self.pluginmanager.get_compiled_hotkeys())
self.init_hotkeys()
# Load settings and get it oooon
self.objects['settingsmanager'].load_settings()
self.install_event_filter()
# Try to open a file and die if it doesn't work, or make a new file
if file_to_open:
if os.path.exists(file_to_open):
if not self.objects['textarea'].open_file(file_to_open):
print('Bad encoding! Use utf-8 or latin1.')
self.close()
else:
# If the path doesn't exist, open a new file with the name
self.objects['textarea'].document().setModified(True)
self.objects['textarea'].set_filename(file_to_open)
else:
self.objects['textarea'].set_filename(new=True)
self.objects['textarea'].document().setModified(True)
# FIN
self.objects['mainwindow'].show()
示例9: load
def load(fileName, mapFormat = None):
error = ''
tmxMapFormat = TmxMapFormat()
if (not mapFormat and not tmxMapFormat.supportsFile(fileName)):
# Try to find a plugin that implements support for this format
formats = PluginManager.objects()
for format in formats:
if (format.supportsFile(fileName)):
mapFormat = format
break
map = None
errorString = ''
if mapFormat:
map = mapFormat.read(fileName)
errorString = mapFormat.errorString()
else:
map = tmxMapFormat.read(fileName)
errorString = tmxMapFormat.errorString()
if (not map):
error = errorString
return None, error
mapDocument = MapDocument(map, fileName)
if mapFormat:
mapDocument.setReaderFormat(mapFormat)
if mapFormat.hasCapabilities(MapFormat.Write):
mapDocument.setWriterFormat(mapFormat)
return mapDocument, error
示例10: __init__
def __init__ (self, view, viewcontrol, type):
Control.__init__ (self, view)
self.vc = viewcontrol
self.pm = PluginManager.getInstance()
if type in [WizardPlugin.T_INPUT, WizardPlugin.T_OUTPUT]:
self.type = type # TODO Parameter
else:
raise Exception("Invalid PluginType")
示例11: init
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()
示例12: __init__
class CLI:
""" Main command line interface. """
def __init__(self):
""" Initialize the plugin manager. """
self.__pluginmanager = PluginManager()
def parse_input(self):
""" Validates user input and delegates execution to the plugin manager. """
if len(sys.argv) < 2:
print "Usage: kahuna <plugin> <command> [<options>]"
print "The following plugins are available:\n"
self.__pluginmanager.help_all()
elif len(sys.argv) == 2:
print "Usage: kahuna <plugin> <command> [<options>]"
# Call the given pugin without command to print the help of the plugin
return self.__pluginmanager.call(sys.argv[1], None, None)
else:
# Call the command in the given plugin with the remaining of the arguments
return self.__pluginmanager.call(sys.argv[1], sys.argv[2], sys.argv[3:])
示例13: __init__
def __init__(self, bus_name, options, object_path="/org/wicd/daemon"):
''' Creates a new WicdDaemon object. '''
dbus.service.Object.__init__(self, bus_name=bus_name,
object_path=object_path)
self.options = options
self.interface_manager = InterfaceManager(self.StatusChange)
self.plugin_manager = PluginManager(self)
if not options.no_load_configuration:
self.LoadConfiguration()
self.plugin_manager.action('start')
示例14: Coffesploit
class Coffesploit(object):
"""Main Class"""
def __init__(self, basepath):
self.target = Target()
self.tool = None
self.pluginmanager = PluginManager()
self.helper = Help()
self.basepath = basepath
def set_target(self,rhost=None,url=None):
if url is not None:
self.target.seturl(url)
if rhost is not None:
self.target.setrhost(rhost)
def set(self, arg1, arg2):
self.pluginmanager.current_plugin.set_arg(arg1,arg2)
def show(self,arg):
if arg == "target":
print "ip:",self.target.getrhost(),"url:",self.target.geturl()
if arg == "status":
if self.pluginmanager.current_plugin is not None:
self.pluginmanager.plugin_status()
if arg == "version":
print "Currnt Version:",self.version()
def use(self,arg):
self.pluginmanager.load_plugin(arg)
def run(self):
self.pluginmanager.plugin_run()
self.pluginmanager.plugin_result()
def main_help (self):
return self.helper.main_help()
def main_list (self):
return self.pluginmanager.importer.get_plugins_list()
def help(self,arg):
"""show help info of t"""
if arg == "target":
self.helper.help_set_tartget()
if arg == "show":
self.helper.help_show()
if arg == "use":
self.helper.help_use()
def exit(self):
exit(0)
def version(self):
return __Version__
示例15: __init__
def __init__(self, parent = None):
super().__init__(parent)
self.setObjectName("ConsoleDock")
self.setWindowTitle(self.tr("Debug Console"))
widget = QWidget(self)
layout = QVBoxLayout(widget)
layout.setContentsMargins(5, 5, 5, 5)
self.plainTextEdit = QPlainTextEdit()
self.plainTextEdit.setReadOnly(True)
self.plainTextEdit.setStyleSheet(QString(
"QAbstractScrollArea {"
" background-color: black;"
" color:green;"
"}"
))
layout.addWidget(self.plainTextEdit)
for output in PluginManager.objects(LoggingInterface):
self.registerOutput(output)
PluginManager.instance().objectAdded.connect(self.onObjectAdded)
self.setWidget(widget)