-
Notifications
You must be signed in to change notification settings - Fork 2
/
startup_script.py
71 lines (61 loc) · 2 KB
/
startup_script.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
##########################
#### NEW? begin here! ####
#### START-UP ####
##########################
# this will launch the whole protocol. to get an idea of the protocol structutre, look the code architecture.ppt
# 1): change mypath to your code folder
# 2) open in gephi the file.
# 2): COPY THE SCRIPT BELOW AND PASTE IT in the gephi script-console.
import sys
import os
jars = [
"core.jar",
"org-gephi-algorithms.jar",
"org-gephi-graph-api.jar",
"org-gephi-data-attributes.jar",
"org-gephi-data-attributes-api.jar",
"org-gephi-visualization-api.jar",
"org-gephi-project-api.jar",
"org-gephi-io-importer-api.jar",
]
def addpath(path):
if path not in sys.path:
sys.path.append(path)
def addpathjar(jarpath):
addpath(jarpath)
if jarpath not in os.environ['CLASSPATH']:
os.environ['CLASSPATH'] += ";"+jarpath
mypath="D:\\ELECTIVES\\SELF_ORGA\\new_code\\"
#mypath = "c:\\soa\\"
addpath(mypath)
def fixpaths():
global jars # BE KIND TO OTHERS: do not cancel out their mypath, just comment it :)
addpath(mypath)
#toolpath= mypath # for those who have the toolkit under the same folder
toolpath= "C:\\Users\\MangustaMegaMastar\\Downloads\\4gephi\\gephi-0.8.1-beta.sources\\gephi-0.8.1-beta.sources\\toolkit\\gephi-toolkit\\"
tk_path = toolpath+"gephi-toolkit\\"
for jar in jars:
addpathjar(tk_path+jar)
addpathjar(toolpath+"gephi-toolkit.jar")
def startup():
fixpaths()
sys.modules.clear()
print "go!"
import main
main.series(globals())
# then type:
startup()
def help(obj = None) :
"""
See help
"""
if obj == None :
print "Python console"
print "Available functions : "
print dir(sys.modules[__name__])
else :
try :
print obj.__doc__
except :
print "Object has no documentation"
#sys.path.append("C:\\Users\\MangustaMegaMastar\\Downloads\\4gephi\\gephi-0.8.1-beta.sources\\gephi-0.8.1-beta.sources\\toolkit\\gephi-toolkit.jar")