def package_list_name(): pluginDict = utils.list_plugin_name() pluginName = [] shortName = [] latestRelease = [] description = [] for p in pluginDict.keys(): if utils.check_download(utils.URL + "/" + utils.RUDDER_VERSION + "/" + str(pluginDict[p][0])): pluginName.append(str(p)) shortName.append(str(pluginDict[p][0])) description.append(str(pluginDict[p][1])) pkgs = plugin.Plugin(p) pkgs.getAvailablePackages() try: latestVersion = pkgs.getLatestCompatibleRelease( None).version.pluginLongVersion except: latestVersion = "" latestRelease.append(latestVersion) table = [{ "title": "Plugin Name", "value": pluginName }, { "title": "Plugin Short Name", "value": shortName }, { "title": "Description", "value": description }, { "title": "Latest release", "value": latestRelease }] print(utils.dictToAsciiTable(table))
def __init__(self, options, config): """Initializes all of the submodules bitHopper uses""" #Logging logging.basicConfig(stream=sys.stdout, format="%(asctime)s|%(module)s: %(message)s", datefmt="%H:%M:%S", level = logging.INFO) self.options = options self.config = config altercoins = ConfigParser.ConfigParser() altercoins.read(os.path.join(sys.path[0], "whatevercoin.cfg")) self.altercoins = {} for coin in altercoins.sections(): self.altercoins[coin] = dict(altercoins.items(coin)) self.altercoins[coin]['recent_difficulty'] = float(self.altercoins[coin]['recent_difficulty']) self.scheduler = None self.lp_callback = lp_callback.LP_Callback(self) self.difficulty = diff.Difficulty(self) self.exchange = exchange.Exchange(self) self.pool = None self.db = database.Database(self) self.pool = pool.Pool_Parse(self) self.api = api.API(self) self.pool.setup(self) self.work = work.Work(self) self.speed = speed.Speed() self.getwork_store = getwork_store.Getwork_store(self) self.data = data.Data(self) self.lp = lp.LongPoll(self) self.auth = None self.website = website.bitSite(self) self.pile = greenpool.GreenPool() self.plugin = plugin.Plugin(self) self.pile.spawn_n(self.delag_server)
def package_search(name): utils.readConf() pkgs = plugin.Plugin(name[0]) pkgs.getAvailablePackages() pluginName = [] releaseMode = [] version = [] compatible = [] for iRpkg in sorted(pkgs.packagesInfo): data = iRpkg.toTabulate() pluginName.append(data[0]) releaseMode.append(data[1]) version.append(data[2]) compatible.append(data[3]) table = [ { "title": "Plugin Name", "value": pluginName }, { "title": "Release Mode", "value": releaseMode }, { "title": "Version", "value": version }, { "title": "Compatible", "value": compatible }, ] print(utils.dictToAsciiTable(table))
def upgrade_all(mode, version): for p in utils.DB["plugins"].keys(): currentVersion = rpkg.PluginVersion(utils.DB["plugins"][p]["version"]) latestVersion = currentVersion pkgs = plugin.Plugin(p) pkgs.getAvailablePackages() if mode == "nightly": latest_packages = pkgs.getLatestCompatibleNightly(version) if (latest_packages is None): logger.debug( "No newer nightly %s compatible versions found for the plugin %s" % (mode, p)) else: latestVersion = latest_packages.version else: latest_packages = pkgs.getLatestCompatibleRelease(version) if (latest_packages is None): logger.debug( "No newer release %s compatible versions found for the plugin %s" % (mode, p)) else: latestVersion = latest_packages.version if currentVersion < latestVersion: logger.info( "The plugin %s is installed in version %s. The version %s %s is available, the plugin will be upgraded." % (p, currentVersion.pluginLongVersion, mode, latestVersion.pluginLongVersion)) package_install_latest([p], mode, version, exit_on_error=False) else: logger.info( "No newer %s compatible versions than %s found for the plugin %s." % (mode, currentVersion.pluginLongVersion, p))
def package_list_installed(): toPrint = [] printLatest = os.path.isfile(utils.INDEX_PATH) pluginName = [] version = [] latestRelease = [] for p in utils.DB["plugins"].keys(): pluginName.append(p) currentVersion = rpkg.PluginVersion(utils.DB["plugins"][p]["version"]) version.append(currentVersion.pluginLongVersion) extra = "" try: if printLatest: pkgs = plugin.Plugin(p) pkgs.getAvailablePackages() latestVersion = pkgs.getLatestCompatibleRelease().version if currentVersion < latestVersion: extra = "version %s is available"%(latestVersion.pluginLongVersion) latestRelease.append(latestVersion.pluginLongVersion + " " + extra) else: latestRelease.append("") except: latestRelease.append("") table = [ { "title": "Plugin Name", "value": pluginName }, { "title": "Version" , "value": version }, ] if printLatest: table.append({ "title": "Latest release", "value": latestRelease }) print(utils.dictToAsciiTable(table))
def _load_plugins(self): # Register Plugins/Filters plugins = plug.Plugin(PLUGIN_PATHS) for name in plugins.plugins: plugin = plugins.load_plugin(name) try: plugin.setup(self) except AttributeError: continue
def package_install_specific_version(name, longVersion, mode="release"): pkgs = plugin.Plugin(name[0]) pkgs.getAvailablePackages() rpkg = pkgs.getRpkgByLongVersion(longVersion, mode) if rpkg is not None: rpkgPath = utils.downloadByRpkg(rpkg) install_file([rpkgPath], None) else: utils.fail("Could not find any package for %s in version %s" % (name, longVersion))
def add_plugin_compose(name_first, name_remaining, plugin_to_add, parent): plugin_existing = parent.get_plugins(name_first) if plugin_existing is None: plugin_existing = plugin.Plugin() plugin_existing._name = name_first plugin_existing.__doc__ = '' parent.add_plugin(name_first, plugin_existing) add_plugin(name_remaining, plugin_to_add, plugin_existing)
def package_install_latest(name, mode="release"): utils.readConf() pkgs = plugin.Plugin(name[0]) pkgs.getAvailablePackages() if mode == "release": rpkg = pkgs.getLatestCompatibleRelease() else: rpkg = pkgs.getLatestCompatibleNightly() if rpkg is not None: rpkgPath = utils.downloadByRpkg(rpkg) install_file([rpkgPath]) utils.fail("Could not find any compatible %s for %s"%(mode, name))
def reloadPluginIfNeeded(self): modifiedTime = os.path.getmtime("plugin.py") if(modifiedTime > self.modifiedTime): if(self.plugin): try: self.plugin.stop() except: print("Exception occured") self.plugin = None reload(plugin) self.modifiedTime = modifiedTime self.plugin = plugin.Plugin(self.callbacks) self.plugin.start()
def package_show(name, version, mode): pkgs = plugin.Plugin(name[0]) pkgs.getAvailablePackages() if version != "": rpkg = pkgs.getRpkgByLongVersion(version, mode) else: if mode == "release": rpkg = pkgs.getLatestCompatibleRelease(None) else: rpkg = pkgs.getLatestCompatibleNightly(None) if rpkg is not None: rpkg.show_metadata() else: utils.fail("Could not find any package in %s for %s" % (mode, name))
def package_install_latest(name, mode="release", version=None, exit_on_error=True): pkgs = plugin.Plugin(name[0]) pkgs.getAvailablePackages() if mode == "release": rpkg = pkgs.getLatestCompatibleRelease(version) else: rpkg = pkgs.getLatestCompatibleNightly(version) if rpkg is not None: rpkgPath = utils.downloadByRpkg(rpkg) install_file([rpkgPath], version, exit_on_error=exit_on_error) else: utils.fail("Could not find any compatible %s for %s" % (mode, name), exit_on_error=exit_on_error)
def upgrade_all(mode, quiet=False): for p in utils.DB["plugins"].keys(): currentVersion = rpkg.PluginVersion(utils.DB["plugins"][p]["version"]) pkgs = plugin.Plugin(p) pkgs.getAvailablePackages() if mode == "nightly": latestVersion = pkgs.getLatestCompatibleNightly().version else: latestVersion = pkgs.getLatestCompatibleRelease().version if currentVersion < latestVersion: print( "The plugin %s is installed in version %s. The version %s %s is available, the plugin will be upgraded." % (p, currentVersion.pluginLongVersion, mode, latestVersion.pluginLongVersion)) package_install_latest([p], mode, quiet) else: print("No newer %s compatible versions found for the plugin %s" % (mode, p))
def install_pas_plugin(self): pas = self.acl_users if not plugin_name in pas.objectIds(): manager = plugin.Plugin(plugin_name, "SQLAlchemy user/group/prop store") pas._setObject(plugin_name, manager) provider = pas[plugin_name] provider.manage_activateInterfaces([ # 'IGroupsPlugin', # 'IGroupEnumerationPlugin', # 'IGroupIntrospection', # 'IGroupManagement', 'IAuthenticationPlugin', 'IUserEnumerationPlugin', 'IUserManagement', # 'IUserAdderPlugin', # 'IRolesPlugin', # 'IRoleAssignerPlugin', 'IPropertiesPlugin', 'IUpdatePlugin'])
def __init__(self, server): self.server = server self.port = 6667 self.ssl = None self.channels = [] self.connectedChannels = [] self.nick = 'default_nick' self.realName = 'default_nick default_nick' self.socket = None self.debugger = True self.allowedCommands = { 'ping': self.ping, 'privmsg': self.privmsg, 'invite': self.invite, 'join': self.join, '433': self.f433, '307': self.f307, '353': self.f353 } self.autoInvite = True self.plugins = plugin.Plugin(self.rawSend) self.userlist = {}
def __init__(self, host, pguser): self.host = host self.pguser = pguser # create the test database os.system(f"psql -h {host} -U {pguser} {dbname} -f {sql_file}") pg_conn_info = f"dbname={dbname} host={host} user={pguser}" pcon = psycopg2.connect(pg_conn_info) pcur = pcon.cursor() pcur.execute(""" INSERT INTO epanet.junctions (id, elevation, geom) VALUES (33, 30, ST_GeometryFromText('POINT(3 3)',2154)); """) pcur.execute(""" INSERT INTO epanet.junctions (id, elevation, geom) VALUES (44, 40, ST_GeometryFromText('POINT(4 4)',2154)); """) pcon.commit() pcon.close() # Initialize project layer_source = f"""host='{host}' dbname='{dbname}' user='******' srid=2154 table="epanet"."junctions" (geom) sql=""" j_layer = QgsVectorLayer(layer_source, "junctions", "postgres") assert (j_layer and j_layer.isValid() and j_layer.featureCount() == 4) assert (QgsProject.instance().addMapLayer(j_layer, False)) root = QgsProject.instance().layerTreeRoot() group = root.addGroup("epanet_group") group.addLayer(j_layer) self.versioning_plugin = plugin.Plugin(iface) self.versioning_plugin.current_layers = [j_layer] self.versioning_plugin.current_group = group self.historize()
def __init__(self, master, home): self.home = home #La vue se déclare auprès du modele self.home.model.listeners['commandPanel'] = self #creation des frames self.commandFrame = Frame(master, bg=ConstantFiles.lightGrey) self.commandFrame.pack(fill=BOTH, side=LEFT, pady=30, padx=30) self.layerOptionsFrame = LayerButtons(self.commandFrame, home) self.commandFrameGrid = Frame(self.commandFrame, bg=ConstantFiles.lightGrey) self.commandFrameGrid.pack() #titre title = Label(self.commandFrameGrid, text='Commands', font="Helvetica 16 bold", bg=ConstantFiles.lightGrey) title.grid(row=0, column=0, sticky=W, padx=40, pady=20) #creation des boutons #on utilise un Frame dans lequel on peut mettre un boutons, plus 2 boutons pour save et delete a droite du bouton principal b1Frame = Frame(self.commandFrameGrid, bg=ConstantFiles.lightGrey) #1ere ligne de boutons b1Frame.grid(row=1, column=0, sticky=W, padx=self.padLeft - 7, pady=10) b1 = ButtonPlus(b1Frame, text="Load 3D Image", command=(lambda: self.load3DImage())) b1.colors() #affiche les bonnes couleurs pour le bouton b1.grid(row=0, column=0, sticky=W, padx=7) b1Del = ButtonPlus(b1Frame, text="X", image=ConstantFiles.icoCross, command=(lambda: self.remove3DImage())) b1Del.colors() b1Del.grid(row=0, column=2, sticky=W, padx=0) b2Frame = Frame(self.commandFrameGrid, bg=ConstantFiles.lightGrey) #2eme ligne de boutons b2Frame.grid(row=2, column=0, sticky=W, padx=self.padLeft - 7, pady=10) b2 = ButtonPlus(b2Frame, text="Load Segmentation", command=(lambda: self.loadSegmentation())) b2.colors() b2.grid(row=0, column=0, sticky=W, padx=7) b2Save = ButtonPlus(b2Frame, text="S", image=ConstantFiles.icoSave, command=(lambda: self.saveSegmentation())) b2Save.colors() b2Save.grid(row=0, column=1, sticky=W, padx=0) b2Del = ButtonPlus(b2Frame, text="X", image=ConstantFiles.icoCross, command=(lambda: self.removeSegmentation())) b2Del.colors() b2Del.grid(row=0, column=2, sticky=W, padx=0) b3Frame = Frame(self.commandFrameGrid, bg=ConstantFiles.lightGrey) #3eme ligne de boutons b3Frame.grid(row=3, column=0, sticky=W, padx=self.padLeft - 7, pady=10) b3 = ButtonPlus(b3Frame, text="Load Graph", command=(lambda: self.loadGraph())) b3.colors() b3.grid(row=0, column=0, sticky=W, padx=7) b3Save = ButtonPlus(b3Frame, text="S", image=ConstantFiles.icoSave, command=(lambda: self.saveGraph())) b3Save.colors() b3Save.grid(row=0, column=1, sticky=W, padx=0) b3Del = ButtonPlus(b3Frame, text="X", image=ConstantFiles.icoCross, command=(lambda: self.removeGraph())) b3Del.colors() b3Del.grid(row=0, column=2, sticky=W, padx=0) #apres les 3 premieres lignes de boutons, s'ajoutent les boutons de plugin #on cree automatiquement un bouton en creant une instance de Plugin plugin.Plugin( 'Generate Segmentation', 4, self.home.model.segmentationPlugin, [ 'SLIC3D', 'WatershedGradient3D', 'WatershedMinima3D', 'Watervoxel3D' ], [['Number of segments (integer)', 'Sigma (decimal)'], [ 'Gradient Threshold (integer)', 'Gradien Size (integer)', 'Footprint Median (integer)' ], ['Footprint Gaussian (integer)', 'Sigma (decimal)'], [ 'a ∈ ]0,1[ (decimal)', 'Gradient Threshold (integer)', 'Gradient Size (integer)', 'Footprint Median (integer)', 'Footprint Gaussian (integer)', 'Sigma (decimal)' ]], [[5000, 0.01], [18, 5, 1], [20, 0.5], [0.9, 18, 5, 1, 25, 0.5]], self, self.home.model) plugin.Plugin('Generate Graph', 5, self.home.model.graphGenerationPlugin, ['Mean Color', 'Boundary'], [['Sigma (decimal)', 'Draw graph (0 if no)'], ['Sigma (decimal)', 'Draw graph (0 if no)']], [[2500, 1], [2500, 1]], self, self.home.model) plugin.Plugin('Generate Clusters', 6, self.home.model.graphClusteringPlugin, ['Louvain', 'Spectral Clustering'], [[], ['Number of clusters (int)']], [[], [80]], self, self.home.model) #dernier bouton, qui permet d'afficher les options de layer bX = ButtonPlus( self.commandFrameGrid, text="Layer Options", command=(lambda: self.layerOptionsFrame.showLayerOptions(bX))) bX.colors() #bX.grid(row=7,column=0, sticky=W, padx = self.padLeft, pady = 10) self.layerOptionsFrame.showLayerOptions(bX) #macOS version
def test_plugin(): pl = plugin.Plugin() pl.setSettings(0, SETTINGS) data = pl.exec(SENT) print(data) assert False
def run_plugin(): """ Runs Retrospect as a Video Add-On """ log_file = None try: from retroconfig import Config from helpers.sessionhelper import SessionHelper # get a logger up and running from logger import Logger # only append if there are no active sessions if not SessionHelper.is_session_active(): # first call in the session, so do not append the log append_log_file = False else: append_log_file = True log_file = Logger.create_logger( os.path.join(Config.profileDir, Config.logFileNameAddon), Config.appName, append=append_log_file, dual_logger=lambda x, y=4: xbmc.log(x, y)) from urihandler import UriHandler from addonsettings import AddonSettings AddonSettings.set_language() from textures import TextureHandler # update the loglevel Logger.instance().minLogLevel = AddonSettings.get_log_level() use_caching = AddonSettings.cache_http_responses() cache_dir = None if use_caching: cache_dir = Config.cacheDir ignore_ssl_errors = AddonSettings.ignore_ssl_errors() UriHandler.create_uri_handler(cache_dir=cache_dir, cookie_jar=os.path.join( Config.profileDir, "cookiejar.dat"), ignore_ssl_errors=ignore_ssl_errors) # start texture handler TextureHandler.set_texture_handler(Config, Logger.instance(), UriHandler.instance()) # run the plugin import plugin plugin.Plugin(sys.argv[0], sys.argv[2], sys.argv[1]) # make sure we leave no references behind AddonSettings.clear_cached_addon_settings_object() # close the log to prevent locking on next call Logger.instance().close_log() log_file = None except: if log_file: log_file.critical("Error running plugin", exc_info=True) log_file.close_log() raise
def package_list_installed(): toPrint = [] printLatest = os.path.isfile(utils.INDEX_PATH) pluginName = [] version = [] latestRelease = [] currentStatus = [] for p in utils.DB["plugins"].keys(): pluginName.append(p) # Get version currentVersion = rpkg.PluginVersion(utils.DB["plugins"][p]["version"]) version.append(currentVersion.pluginLongVersion) # Get status # Only plugin containing jars can be disabled status = "enabled" if not os.path.exists(utils.PLUGINS_CONTEXT_XML): return text = open(utils.PLUGINS_CONTEXT_XML).read() match = re.search(r'<Set name="extraClasspath">(.*?)</Set>', text) if match: enabled = match.group(1).split(',') metadata = utils.DB["plugins"][p] if 'jar-files' in metadata: for j in metadata['jar-files']: if j not in enabled: status = "disabled" currentStatus.append(status) # Get latest available version extra = "" try: if printLatest: pkgs = plugin.Plugin(p) pkgs.getAvailablePackages() latestVersion = pkgs.getLatestCompatibleRelease().version if currentVersion < latestVersion: extra = "version %s is available" % ( latestVersion.pluginLongVersion) latestRelease.append(latestVersion.pluginLongVersion + " " + extra) else: latestRelease.append("") except: latestRelease.append("") table = [ { "title": "Plugin Name", "value": pluginName }, { "title": "Version", "value": version }, { "title": "Status", "value": currentStatus }, ] if printLatest: table.insert(2, {"title": "Latest release", "value": latestRelease}) print(utils.dictToAsciiTable(table))
else: self.expander.set_expanded(False) def active(self): return self.switch.get_active() def processing(self, start): if start: self.switch.set_sensitive(False) # and we'll never turn it back to true? # would like some kind of feedback here ... # bigger issue is that the plugins are running in the GUI thread ... plugins = [name.Plugin(), deterministicgpg.Plugin(), plugin.Plugin("Bar", "Some longer descriptions that is multiple lines.\nSecond line ..."), plugin.Plugin('Foo Bar Baz', 'A description <b>with</b> markup, line wrapping, and even a <a href="http://google.com">hyperlink</a>! Wow!'), ] class MainWindow(Gtk.Window): def __init__(self): Gtk.Window.__init__(self, title="Deterministic ID") vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=6) vbox.props.margin = 12 self.add(vbox) # Add label describing what to do label = Gtk.Label("<b>Enter electrum seed:</b>", use_markup=True) label.props.halign = Gtk.Align.START label.props.valign = Gtk.Align.START
def RunPlugin(): """ Runs Retrospect as a Video Add-On """ logFile = None try: from config import Config from helpers.sessionhelper import SessionHelper # get a logger up and running from logger import Logger # only append if there are no active sessions if not SessionHelper.IsSessionActive(): # first call in the session, so do not append the log appendLogFile = False else: appendLogFile = True logFile = Logger.CreateLogger(os.path.join(Config.profileDir, Config.logFileNameAddon), Config.appName, append=appendLogFile, dualLogger=lambda x, y=4: xbmc.log(x, y)) from urihandler import UriHandler from addonsettings import AddonSettings from textures import TextureHandler # update the loglevel Logger.Instance().minLogLevel = AddonSettings.GetLogLevel() useCaching = AddonSettings.CacheHttpResponses() cacheDir = None if useCaching: cacheDir = Config.cacheDir # determine the platform from envcontroller import EnvController from environments import Environments maxFileNameLength = None if EnvController.IsPlatform(Environments.Xbox): maxFileNameLength = 42 ignoreSslErrors = AddonSettings.IgnoreSslErrors() UriHandler.CreateUriHandler(cacheDir=cacheDir, maxFileNameLength=maxFileNameLength, cookieJar=os.path.join( Config.profileDir, "cookiejar.dat"), ignoreSslErrors=ignoreSslErrors) # start texture handler TextureHandler.SetTextureHandler(Config, Logger.Instance(), UriHandler.Instance()) # run the plugin import plugin plugin.Plugin(sys.argv[0], sys.argv[2], sys.argv[1]) # close the log to prevent locking on next call Logger.Instance().CloseLog() logFile = None # make sure we leave no references behind AddonSettings.ClearCachedAddonSettingsObject() except: if logFile: logFile.Critical("Error running plugin", exc_info=True) raise
import os import sys import pathlib import plugin home = os.environ['HOME'] path = home + "/.config/zsh/" clone = "git clone " zshcache = home + "/.cache/zsh/" zshconfig = home + "/.config/zsh/" shell = os.environ['SHELL'] user = os.environ["USER"] plugins = [] plugins.append( plugin.Plugin("powerlevel10k", "--depth=1 https://github.com/romkatv/powerlevel10k.git")) plugins.append( plugin.Plugin("zsh-autosuggestions", "https://github.com/zsh-users/zsh-autosuggestions")) plugins.append( plugin.Plugin("zsh-history-substring-search", "https://github.com/zsh-users/zsh-history-substring-search")) plugins.append( plugin.Plugin("zsh-syntax-highlight", "https://github.com/zsh-users/zsh-syntax-highlighting.git")) # Install required packages pckgarr = ["zsh", "stow", "util-linux-user"] plugin.InstallPackages(pckgarr) # Change user default shell to zsh