def __init__(self): super().__init__() self.counter = 1 self.config = config.Config() self.plugin_manager = plugin.PluginManager() self.command_prefix = self.config["command_prefix"]
def OnInit(self): self.pmgr = plugin.PluginManager() # Bare minimum profile bootstrap profiler.Profile_Set('ICONS', 'Tango') return True
def __init__(self, *args, **kargs): """Initialize that main app and its attributes @postcondition: application is created and ready to be run in mainloop """ wx.App.__init__(self, *args, **kargs) events.AppEventHandlerMixin.__init__(self) # Attributes self._log = dev_tool.DEBUGP self._lock = False self._windows = dict() # Setup Locale locale.setlocale(locale.LC_ALL, '') self.locale = wx.Locale(ed_i18n.GetLangId( profiler.Profile_Get('LANG'))) if self.locale.GetCanonicalName() in ed_i18n.GetAvailLocales(): self.locale.AddCatalogLookupPathPrefix(ed_glob.CONFIG['LANG_DIR']) self.locale.AddCatalog(ed_glob.PROG_NAME) else: del self.locale self.locale = None # Setup Plugins after locale as they may have resource that need to # be loaded. self._pluginmgr = plugin.PluginManager() self._log("[app][info] Registering Editra's ArtProvider") wx.ArtProvider.PushProvider(ed_art.EditraArt())
def OnInit(self): self.pmgr = plugin.PluginManager() # Bare minimum profile bootstrap profiler.Profile_Set('ENCODING', locale.getpreferredencoding()) profiler.Profile_Set('ICONS', 'Tango') return True
def _initTools(self): """ Initializes tools """ if self._options.plugin_dir is not None: sys.path.append(os.path.abspath(self._options.plugin_dir)) self._pluginmanager = plugin.PluginManager(self.getSettings(), self._options.plugin_dir) self._filemanager = FileManager() self._toolbar.adaptLayout() self._mapeditor = MapEditor()
def main(): interactive = True advanced_enabled = True plugin_name = None if os.geteuid() != 0: fatal("confconsole needs root privileges to run") try: l_opts = ["help", "usage", "nointeractive", "plugin="] opts, args = getopt.gnu_getopt(sys.argv[1:], "hn", l_opts) except getopt.GetoptError as e: usage(e) for opt, val in opts: if opt in ("-h", "--help"): usage() elif opt == "--usage": advanced_enabled = False elif opt == "--nointeractive": interactive = False elif opt == "--plugin": plugin_name = val else: usage() em = plugin.EventManager() pm = plugin.PluginManager(PLUGIN_PATH, { 'eventManager': em, 'interactive': interactive }) if plugin_name: ps = filter(lambda x: isinstance(x, plugin.Plugin), pm.getByName(plugin_name)) if len(ps) > 1: fatal('plugin name ambiguous, matches all of %s' % ps) elif len(ps) == 1: p = ps[0] if interactive: tc = TurnkeyConsole(pm, em, advanced_enabled) tc.loop(dialog=p.path) # calls .run() else: p.module.run() else: fatal('no such plugin') else: tc = TurnkeyConsole(pm, em, advanced_enabled) tc.loop()
def __init__(self, app_settings): pool_size = app_settings.get('dispatcher_pool_size', 100) logging_enabled = app_settings.get('enable_logging', False) dispatcher = DispatcherEngine( d.MessageDispatcher(), enable_logging=logging_enabled, size=pool_size) super(DefaultKaarmeBotApp, self).__init__( network_client_provider=NetworkClientGreenlet, dispatcher=dispatcher, concurrency_manager=pool.Group(), message_parser=irc.parse_message, plugin_manager=pl.PluginManager(dispatcher), logger=logger, app_settings=app_settings)
def __init__(self, *args, **kargs): """Initialize that main app and its attributes @postcondition: application is created and ready to be run in mainloop" """ wx.App.__init__(self, *args, **kargs) events.AppEventHandlerMixin.__init__(self) # Attributes self._log = dev_tool.DEBUGP self._lock = False self._windows = dict() self._pluginmgr = plugin.PluginManager() self._log("[app][info] Registering Editra's ArtProvider") wx.ArtProvider.PushProvider(ed_art.EditraArt())
class SnapshotManager(threading.Thread): def __init__(self, bus): # Used to wake up the run() method prematurely in the event # of a SIGHUP/SMF refresh self._conditionLock = threading.Condition(threading.RLock()) # Used when schedules are being rebuilt or examined. self._refreshLock = threading.Lock() # Indicates that cleanup is in progress when locked self._cleanupLock = threading.Lock() self._datasets = zfs.Datasets() # Indicates that schedules need to be rebuilt from scratch self._stale = True self._lastCleanupCheck = 0; self._zpools = [] self._poolstatus = {} self._destroyedsnaps = [] # This is also checked during the refresh() method but we need # to know it sooner for instantiation of the PluginManager self._smf = timeslidersmf.TimeSliderSMF() try: self.verbose = self._smf.get_verbose() except RuntimeError,message: sys.stderr.write("Error determing whether debugging is enabled\n") self.verbose = False self._dbus = dbussvc.AutoSnap(bus, '/org/opensolaris/TimeSlider/autosnap', self) self._plugin = plugin.PluginManager(self.verbose) self.exitCode = smf.SMF_EXIT_OK self.refresh() # Seems we're up and running OK. # Signal our parent so we can daemonise os.kill(os.getppid(), signal.SIGUSR1) # SMF/svc.startd sends SIGHUP to force a # a refresh of the daemon signal.signal(signal.SIGHUP, self._signalled) # Init done. Now initiaslise threading. threading.Thread.__init__ (self) self.setDaemon(True)
def setup_env(): global env, config env = Environment({ 'dir': { 'path': '~/.voltron', 'create': True, 'mode': 448 # 0700 }, 'files': { 'config': { 'type': 'config', 'default': { 'path': 'config/default.cfg', 'rel_to': 'pkg', 'pkg': 'voltron' }, 'read': True }, 'sock': { 'name': '{basename}.sock', 'type': 'raw', 'var': 'VOLTRON_SOCKET' }, 'history': { 'type': 'raw', 'var': 'VOLTRON_HISTORY' }, 'local_plugins': { 'type': 'plugin_dir', 'name': 'plugins', 'create': True }, 'internal_plugins': { 'type': 'plugin_dir', 'name': 'plugins', 'rel_to': 'pkg', 'pkg': 'voltron' } }, 'basename': 'voltron' }) config = env['config'] # create shared instance of plugin manager plugin.pm = plugin.PluginManager()
def setup_env(): global env, config env = Environment({ 'dir': { 'path': '~/.cloutron', 'create': True, 'mode': 448 # 0700 }, 'files': { 'config': { 'type': 'config', 'default': { 'path': 'config/default.cfg', 'rel_to': 'pkg', 'pkg': 'cloutron' }, 'read': True }, 'local_plugins': { 'type': 'plugin_dir', 'name': 'plugins', 'create': True }, 'internal_plugins': { 'type': 'plugin_dir', 'name': 'plugins', 'rel_to': 'pkg', 'pkg': 'cloutron' } }, 'basename': 'cloutron' }) config = env['config'] # create shared instance of plugin manager plugin.pm = plugin.PluginManager()
profiler.Profile().Write(path) try: self._server = ed_ipc.EdIpcServer( self, profiler.Profile_Get('SESSION_KEY')) self._server.start() except Exception, msg: self._log("[app][err] Failed to start ipc server") self._log("[app][err] %s" % str(msg)) self._server = None self._isfirst = True else: self._isfirst = True # Setup Plugins after locale as they may have resource that need to # be loaded. self._pluginmgr = plugin.PluginManager() self._log("[app][info] Registering Editra's ArtProvider") wx.ArtProvider.PushProvider(ed_art.EditraArt()) def AddMessageCatalog(self, name, path): """Add a catalog lookup path to the app @param name: name of catalog (i.e 'projects') @param path: catalog lookup path """ if self.locale is not None: path = resource_filename(path, 'locale') self.locale.AddCatalogLookupPathPrefix(path) self.locale.AddCatalog(name)
def get_all_plugins(): '''load all spec2nexus plugin modules''' import plugin manager = plugin.PluginManager() manager.load_plugins() return manager
usage(e) for opt, val in opts: if opt in ("-h", "--help"): usage() elif opt == "--usage": advanced_enabled = False elif opt == "--nointeractive": interactive = False elif opt == "--plugin": plugin_name = val else: usage() em = plugin.EventManager() pm = plugin.PluginManager(PLUGIN_PATH, {'eventManager': em, 'interactive': interactive}) if plugin_name: ps = filter(lambda x: isinstance(x, plugin.Plugin), pm.getByName(plugin_name)) if len(ps) > 1: fatal('plugin name ambiguous, matches all of %s' % ps) elif len(ps) == 1: p = ps[0] if interactive: tc = TurnkeyConsole(pm, em, advanced_enabled) tc.loop(dialog=p.path) # calls .run() else: p.module.run()