def show_node_color(f): lookup = Lookup.getDefault().lookup pc = ProjectController(lookup) pc.newProject() workspace = pc.getCurrentWorkspace() graph_model = GraphController(lookup).getGraphModel() print(graph_model) preview_model = PreviewController(lookup) print(preview_model) import_controller = ImportController(lookup) print(import_controller) filter_controller = FilterController(lookup) print(filter_controller) appearance_controller = AppearanceController(lookup) print(appearance_controller) appearance_model = appearance_controller.getModel() print(appearance_model) try: print(File(f).length()) container = import_controller.importFile(File(f)) print(container) container.getLoader().setEdgeDefault( importer.EdgeDirectionDefault.DIRECTED) except Exception, err: print(err)
def __initialize(self): lookup = Lookup.getDefault().lookup self.lookup=lookup pc =ProjectController(lookup) pc.newProject() workspace = pc.getCurrentWorkspace() self.workspace=workspace graph_model = GraphController(lookup).getGraphModel() logging.info(graph_model) self.graph_model=graph_model self.preview_model = PreviewController(lookup).getModel() logging.info(self.preview_model) import_controller = ImportController(lookup) logging.info(import_controller) self.import_controller=import_controller filter_controller = FilterController(lookup) logging.info(filter_controller) appearance_controller = AppearanceController(lookup) logging.info(appearance_controller) appearance_model = appearance_controller.getModel() logging.info(appearance_model) ge = GraphicsEnvironment.getLocalGraphicsEnvironment() for f in ge.getAllFonts(): n=f.getName() if n=="Yu Gothic UI Regular": self.font=f
def headless(): lookup = Lookup.getDefault().lookup pc =ProjectController(lookup) pc.newProject() workspace = pc.getCurrentWorkspace() graph_model = GraphController(lookup).getGraphModel() print(graph_model) preview_model = PreviewController(lookup).getModel() print(preview_model) import_controller = ImportController(lookup) print(import_controller) filter_controller = FilterController(lookup) print(filter_controller) appearance_controller = AppearanceController(lookup) print(appearance_controller) appearance_model = appearance_controller.getModel() print(appearance_model) try: container = import_controller.importFile(File('resources/polblogs.gml')) container.getLoader().setEdgeDefault(importer.EdgeDirectionDefault.DIRECTED) except Exception,err: print(err)
def headless(): lookup = Lookup.getDefault().lookup pc = ProjectController(lookup) pc.newProject() workspace = pc.getCurrentWorkspace() graph_model = GraphController(lookup).getGraphModel() print(graph_model) preview_model = PreviewController(lookup).getModel() print(preview_model) import_controller = ImportController(lookup) print(import_controller) filter_controller = FilterController(lookup) print(filter_controller) appearance_controller = AppearanceController(lookup) print(appearance_controller) appearance_model = appearance_controller.getModel() print(appearance_model) try: container = import_controller.importFile( File('resources/polblogs.gml')) container.getLoader().setEdgeDefault( importer.EdgeDirectionDefault.DIRECTED) except Exception, err: print(err)
import org.openide.util.Lookup as Lookup import org.gephi.ranking.api.RankingController import org.gephi.ranking.api.Ranking as Ranking import org.gephi.ranking.api.Transformer as Transformer import java.awt.Color as Color rankingController = Lookup.getDefault().lookup(org.gephi.ranking.api.RankingController) # Set the color in function of the degree. degreeRanking = rankingController.getModel().getRanking(Ranking.NODE_ELEMENT, Ranking.DEGREE_RANKING); colorTransformer = rankingController.getModel().getTransformer(Ranking.NODE_ELEMENT, Transformer.RENDERABLE_COLOR) colorTransformer.setColors([Color.BLUE, Color.YELLOW]) rankingController.transform(degreeRanking, colorTransformer) # Set the size in function of the degree of the nodes. sizeTransformer = rankingController.getModel().getTransformer(Ranking.NODE_ELEMENT, Transformer.RENDERABLE_SIZE) sizeTransformer.setMinSize(3) sizeTransformer.setMaxSize(40) rankingController.transform(degreeRanking, sizeTransformer) ### Layout of the graph # Construction of a layout object import org.gephi.layout.plugin.forceAtlas2.ForceAtlas2Builder as ForceAtlas2Builder import org.gephi.layout.plugin.forceAtlas2.ForceAtlas2 as ForceAtlas2 fa2builder = ForceAtlas2Builder() fa2 = ForceAtlas2(fa2builder) # Setting the layout object
from com.microchip.mplab.nbide.embedded.makeproject import HotProject from org.netbeans.api.project import ProjectUtils from at.lcm.x2c.mplabscope.backend import ISymbolExternalInterface from at.lcm.x2c.mplabscope.backend import Backend import at.lcm.x2c.mplabscope from org.openide.windows import TopComponent from org.openide.modules import Modules from org.openide.windows import WindowManager from org.openide.util import Lookup print Lookup.getDefault().lookup(ISymbolExternalInterface) hotproject = HotProject.getProject() if hotproject is None: print "#ERROR: cannot get current project" else: print "Selected project:", ProjectUtils.getInformation( hotproject).getDisplayName() assemblyProvider = hotproject.getLookup() print assemblyProvider componentlooker = WindowManager.getDefault() print componentlooker.getRegistry() componentregistry = componentlooker.getRegistry() components = componentregistry.getOpened() for component in components:
#/usr/local/bin/jython import java import os, glob, sys import classpath; path = os.path.realpath(__file__) toolkit = os.path.join(os.path.dirname(path), 'gephi-toolkit.jar') classpath.addFile(toolkit) # TODO: need /Users/jason/Code/gephi/toolkit/gephi-toolkit/org-openide-util.jar? # necessary for save - there should be a less scattershot way to do this? #for j in glob.glob('/Users/jason/Code/gephi/platform/platform/modules/*.jar'): classpath.addFile(j) import org.openide.util.Lookup as Lookup Lookup = Lookup.getDefault().lookup RELAX_STEPS=1000#5000 def lookup(name, namespace='org.gephi.'): return Lookup(java.lang.Class.forName(namespace + name)) ProjectController = lookup('project.api.ProjectController') ExportController = lookup('io.exporter.api.ExportController') ImportController = lookup('io.importer.api.ImportController') GraphController = lookup('graph.api.GraphController') PreviewController = lookup('preview.api.PreviewController') """ http://pastebin.com/nFX0jHFV
def getLayoutBuilders(): import org.gephi.layout.spi.LayoutBuilder as LayoutBuilder return Lookup.getDefault().lookupAll(LayoutBuilder)
# This file defines wrapper methods that can be used as shortcuts in the # interpreter from the scripting console. import java.awt.Color as color from pawt.colors import * # # Setup Lookup and Controllers # import org.openide.util.Lookup as Lookup import org.gephi.io.exporter.api.ExportController ExportController = Lookup.getDefault().lookup(org.gephi.io.exporter.api.ExportController) import org.gephi.filters.api.FilterController FilterController = Lookup.getDefault().lookup(org.gephi.filters.api.FilterController) import org.gephi.io.importer.api.ImportController ImportController = Lookup.getDefault().lookup(org.gephi.io.importer.api.ImportController) import org.gephi.layout.api.LayoutController LayoutController = Lookup.getDefault().lookup(org.gephi.layout.api.LayoutController) import org.gephi.project.api.ProjectController ProjectController = Lookup.getDefault().lookup(org.gephi.project.api.ProjectController) import org.gephi.visualization.VizController VizController = Lookup.getDefault().lookup(org.gephi.visualization.VizController)
# Portions Copyrighted 2011 Gephi Consortium. # This file defines wrapper methods that can be used as shortcuts in the # interpreter from the scripting console. import java.awt.Color as color from pawt.colors import * # # Setup Lookup and Controllers # import org.openide.util.Lookup as Lookup import org.gephi.io.exporter.api.ExportController ExportController = Lookup.getDefault().lookup( org.gephi.io.exporter.api.ExportController) import org.gephi.filters.api.FilterController FilterController = Lookup.getDefault().lookup( org.gephi.filters.api.FilterController) import org.gephi.io.importer.api.ImportController ImportController = Lookup.getDefault().lookup( org.gephi.io.importer.api.ImportController) import org.gephi.layout.api.LayoutController LayoutController = Lookup.getDefault().lookup( org.gephi.layout.api.LayoutController) import org.gephi.project.api.ProjectController ProjectController = Lookup.getDefault().lookup(
def lookup(name, namespace='org.gephi.'): return Lookup(java.lang.Class.forName(namespace + name))
#/usr/local/bin/jython import java import os, glob, sys import classpath path = os.path.realpath(__file__) toolkit = os.path.join(os.path.dirname(path), 'gephi-toolkit.jar') classpath.addFile(toolkit) # TODO: need /Users/jason/Code/gephi/toolkit/gephi-toolkit/org-openide-util.jar? # necessary for save - there should be a less scattershot way to do this? #for j in glob.glob('/Users/jason/Code/gephi/platform/platform/modules/*.jar'): classpath.addFile(j) import org.openide.util.Lookup as Lookup Lookup = Lookup.getDefault().lookup def lookup(name, namespace='org.gephi.'): return Lookup(java.lang.Class.forName(namespace + name)) ProjectController = lookup('project.api.ProjectController') ExportController = lookup('io.exporter.api.ExportController') ImportController = lookup('io.importer.api.ImportController') GraphController = lookup('graph.api.GraphController') PreviewController = lookup('preview.api.PreviewController') """ http://pastebin.com/nFX0jHFV import org.gephi.project.api as project import org.gephi.data.attributes.api as attributes import org.gephi.filters.api as filters import org.gephi.graph.api as graph