示例#1
0
 def setting(self):
     from settingsdialog import SettingsDialog
     dialog = SettingsDialog(self.iface.mainWindow())
     dialog.show()
     if dialog.exec_():
         from pluginmanager import PluginManager
         self.pluginManager = PluginManager()
示例#2
0
    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
示例#3
0
def main():
    args = parser.parse_args()

    # Initialize the plugin manager by giving it the plugin directory path.
    # Then import all the plugins in the directory. You can also import individual plugins.
    plugin_manager = PluginManager(plugin_folder=args.plugin_dir)
    plugin_manager.import_plugin(args.plugin_name)

    # Plugin manager imports all plugins in the plugin at runtime. The user then tells it which plugin to use based
    # off of the file name of the plugin.
    plugin_module = plugin_manager.get_imported_plugin_module(args.plugin_name)
    class_ = getattr(plugin_module, "Plugin")
    current_plugin = class_()

    # Do a quick check to make sure the plugin exists and if it does execute it.
    if current_plugin:
        current_plugin.execute()
示例#4
0
    def run(self):
        from vectorobject import ObjectTypeManager
        from pluginmanager import PluginManager
        from qgis2threejsdialog import Qgis2threejsDialog

        if self.objectTypeManager is None:
            self.objectTypeManager = ObjectTypeManager()

        if self.pluginManager is None:
            self.pluginManager = PluginManager()

        # restore export settings
        proj_path = QgsProject.instance().fileName()
        settingsFilePath = proj_path + ".qto3settings" if proj_path else None

        if not self.exportSettings or settingsFilePath != self.settingsFilePath:
            if settingsFilePath and os.path.exists(settingsFilePath):
                self.loadExportSettings(settingsFilePath)
                logMessage(u"Restored export settings of this project: {0}".format(
                    os.path.basename(proj_path)))  # QgsProject.instance().title()

        dialog = Qgis2threejsDialog(
            self.iface,
            self.objectTypeManager,
            self.pluginManager,
            self.exportSettings,
            self.lastTreeItemData)

        # show dialog
        dialog.show()
        ret = dialog.exec_()

        self.exportSettings = dialog.settings(True)

        item = dialog.ui.treeWidget.currentItem()
        self.lastTreeItemData = item.data(0, Qt.UserRole) if item else None

        # if export succeeded, save export settings in the directory that
        # project file exists
        if ret and settingsFilePath:
            self.saveExportSettings(settingsFilePath)

        self.settingsFilePath = settingsFilePath
示例#5
0
class GtkUI(object):
    def __init__(self, args):
        self.daemon_bps = (0, 0, 0)
        # Setup signals
        try:
            import gnome.ui
            import gnome

            #Suppress: Warning: Attempt to add property GnomeProgram::*** after class was initialised
            original_filters = warnings.filters[:]
            warnings.simplefilter("ignore")
            try:
                self.gnome_prog = gnome.init("Deluge",
                                             deluge.common.get_version())
            finally:
                warnings.filters = original_filters

            self.gnome_client = gnome.ui.master_client()

            def on_die(*args):
                reactor.stop()

            self.gnome_client.connect("die", on_die)
            log.debug("GNOME session 'die' handler registered!")
        except Exception, e:
            log.warning(
                "Unable to register a 'die' handler with the GNOME session manager: %s",
                e)

        if deluge.common.windows_check():
            from win32api import SetConsoleCtrlHandler
            from win32con import CTRL_CLOSE_EVENT
            from win32con import CTRL_SHUTDOWN_EVENT

            def win_handler(ctrl_type):
                log.debug("ctrl_type: %s", ctrl_type)
                if ctrl_type in (CTRL_CLOSE_EVENT, CTRL_SHUTDOWN_EVENT):
                    reactor.stop()
                    return 1

            SetConsoleCtrlHandler(win_handler)

        if deluge.common.osx_check() and Gdk.WINDOWING == "quartz":
            import gtkosx_application
            self.osxapp = gtkosx_application.gtkosx_application_get()

            def on_die(*args):
                reactor.stop()

            self.osxapp.connect("NSApplicationWillTerminate", on_die)

        # Set process name again to fix gtk issue
        setproctitle(getproctitle())

        # Attempt to register a magnet URI handler with gconf, but do not overwrite
        # if already set by another program.
        common.associate_magnet_links(False)

        # Make sure gtkui.conf has at least the defaults set
        self.config = deluge.configmanager.ConfigManager(
            "gtkui.conf", DEFAULT_PREFS)

        # We need to check on exit if it was started in classic mode to ensure we
        # shutdown the daemon.
        self.started_in_classic = self.config["classic_mode"]

        # Start the IPC Interface before anything else.. Just in case we are
        # already running.
        self.queuedtorrents = QueuedTorrents()
        self.ipcinterface = IPCInterface(args)

        # Initialize gdk threading
        Gdk.threads_init()
        GObject.threads_init()

        # We make sure that the UI components start once we get a core URI
        client.set_disconnect_callback(self.__on_disconnect)

        self.trackericons = TrackerIcons()
        self.sessionproxy = SessionProxy()
        # Initialize various components of the gtkui
        self.mainwindow = MainWindow()
        self.menubar = MenuBar()
        self.toolbar = ToolBar()
        self.torrentview = TorrentView()
        self.torrentdetails = TorrentDetails()
        self.sidebar = SideBar()
        self.filtertreeview = FilterTreeView()
        self.preferences = Preferences()
        self.systemtray = SystemTray()
        self.statusbar = StatusBar()
        self.addtorrentdialog = AddTorrentDialog()

        if deluge.common.osx_check() and Gdk.WINDOWING == "quartz":

            def nsapp_open_file(osxapp, filename):
                # Will be raised at app launch (python opening main script)
                if filename.endswith('Deluge-bin'):
                    return True
                from deluge.ui.gtkui.ipcinterface import process_args
                process_args([filename])

            self.osxapp.connect("NSApplicationOpenFile", nsapp_open_file)
            from menubar_osx import menubar_osx
            menubar_osx(self, self.osxapp)
            self.osxapp.ready()

        # Initalize the plugins
        self.plugins = PluginManager()

        # Show the connection manager
        self.connectionmanager = ConnectionManager()

        from twisted.internet.task import LoopingCall
        rpc_stats = LoopingCall(self.print_rpc_stats)
        rpc_stats.start(10)

        reactor.callWhenRunning(self._on_reactor_start)
        # Start the gtk main loop
        Gdk.threads_enter()
        reactor.run()
        self.shutdown()
        Gdk.threads_leave()
示例#6
0
 def __init__(self):
     self.pluginmanager = PluginManager()
     self.pluginmanager.loadPlugins()
示例#7
0
 def show_plugin_manager(self):
     plugin_manager = PluginManager(self.data_singleton)
     plugin_manager.exec_()
示例#8
0
    def __init__(self, plugindir, logger):
        self.logger = WrapLogger(logger)
        self.pluginmanager = PluginManager(plugindir, self.logger)

        self.pluginmanager.loadPlugins(IMapiSpoolerPlugin)
示例#9
0
class ModRef:
    ''' helper class to store references to the global modules
	'''
    def __init__(self):
        self.server = None
        self.message_handler = None


def _(s):
    return s


logger = schnipsllogger.getLogger(__name__)

DirectoryMapper(
    os.path.abspath(os.path.dirname(__file__)), {
        'backup': 'volumes/backup',
        'runtime': 'volumes/runtime',
        'tmpfs': 'volumes/tmpfs',
        'videos': 'volumes/videos',
    })
modref = ModRef()  # create object to store all module instances
modref.message_handler = MessageHandler(modref)
modref.server = Webserver(modref)
plugin_manager = PluginManager(modref, 'plugins')

modref.server.run()

while (True):
    time.sleep(1)
示例#10
0
文件: gtkui.py 项目: orther/Deluge
class GtkUI(object):
    def __init__(self, args):
        self.daemon_bps = (0, 0, 0)
        # Setup signals
        try:
            import gnome.ui
            import gnome
            self.gnome_prog = gnome.init("Deluge", deluge.common.get_version())
            self.gnome_client = gnome.ui.master_client()

            def on_die(*args):
                reactor.stop()

            self.gnome_client.connect("die", on_die)
            log.debug("GNOME session 'die' handler registered!")
        except Exception, e:
            log.warning(
                "Unable to register a 'die' handler with the GNOME session manager: %s",
                e)

        if deluge.common.windows_check():
            from win32api import SetConsoleCtrlHandler
            from win32con import CTRL_CLOSE_EVENT
            from win32con import CTRL_SHUTDOWN_EVENT

            def win_handler(ctrl_type):
                log.debug("ctrl_type: %s", ctrl_type)
                if ctrl_type in (CTRL_CLOSE_EVENT, CTRL_SHUTDOWN_EVENT):
                    reactor.stop()
                    return 1

            SetConsoleCtrlHandler(win_handler)

        # Attempt to register a magnet URI handler with gconf, but do not overwrite
        # if already set by another program.
        common.associate_magnet_links(False)

        # Make sure gtkui.conf has at least the defaults set
        self.config = deluge.configmanager.ConfigManager(
            "gtkui.conf", DEFAULT_PREFS)

        # We need to check on exit if it was started in classic mode to ensure we
        # shutdown the daemon.
        self.started_in_classic = self.config["classic_mode"]

        # Start the IPC Interface before anything else.. Just in case we are
        # already running.
        self.queuedtorrents = QueuedTorrents()
        self.ipcinterface = IPCInterface(args)

        # Initialize gdk threading
        gtk.gdk.threads_init()

        # We make sure that the UI components start once we get a core URI
        client.set_disconnect_callback(self.__on_disconnect)

        self.trackericons = TrackerIcons()
        self.sessionproxy = SessionProxy()
        # Initialize various components of the gtkui
        self.mainwindow = MainWindow()
        self.menubar = MenuBar()
        self.toolbar = ToolBar()
        self.torrentview = TorrentView()
        self.torrentdetails = TorrentDetails()
        self.sidebar = SideBar()
        self.filtertreeview = FilterTreeView()
        self.preferences = Preferences()
        self.systemtray = SystemTray()
        self.statusbar = StatusBar()
        self.addtorrentdialog = AddTorrentDialog()

        # Initalize the plugins
        self.plugins = PluginManager()

        # Late import because of setting up translations
        from connectionmanager import ConnectionManager
        # Show the connection manager
        self.connectionmanager = ConnectionManager()

        from twisted.internet.task import LoopingCall
        rpc_stats = LoopingCall(self.print_rpc_stats)
        rpc_stats.start(10)

        reactor.callWhenRunning(self._on_reactor_start)

        # Initialize gdk threading
        gtk.gdk.threads_enter()
        reactor.run()
        self.shutdown()
        gtk.gdk.threads_leave()
示例#11
0
 def __init__(self):
     """ Initialize the plugin manager """
     self.__pluginmanager = PluginManager()
示例#12
0
 def __init__(self, token):
     super(Telegooby, self).__init__(token)
     for path in (Settings.cache_directory, Settings.logs_directory):
         path.mkdir(parents=True, exist_ok=True)
     self._plugin_manager = PluginManager(self)
示例#13
0
    def __init__(self, plugindir):
        self.logger = WrapLogger()
        self.pluginmanager = PluginManager(plugindir, self.logger)

        self.pluginmanager.loadPlugins(IMapiDAgentPlugin)
示例#14
0
def load_plugins_from_cfg(gctx):
    pluginmanager = PluginManager(gctx)
    gctx['pluginmanager'] = pluginmanager
    pluginmanager.load_plugins()
    gctx['hdl'] += [Handler(handle, callback) for handle, callback in pluginmanager.get_handlers()]
 def setUp(self):
     self.instance = InstanceClass()
     self.plugin_manager = PluginManager()
     self.plugin_manager.add_plugins(self.instance)
示例#16
0
 def __init__(self, plugdir):
     self.pm = PluginManager()
     if len(plugdir) > 0:
         self.pm.setPluginsDir(plugdir)
     self.__loadPluginId = None
     self.__plugin = None