75 |
|
|
76 |
# storm pool directory and mindmap file |
# storm pool directory and mindmap file |
77 |
DIR = 'myFenfire/' |
DIR = 'myFenfire/' |
78 |
FILE = DIR+'mindmap.rdf' |
FILE = java.lang.System.getProperty("fenmm.file", DIR+"mindmap.rdf") |
79 |
|
POOLDIR = java.lang.System.getProperty("fenmm.pool", DIR) |
80 |
|
|
81 |
os.system('mkdir -p '+DIR) |
os.system('mkdir -p '+POOLDIR) |
82 |
pool = storm.impl.DirPool(java.io.File(DIR), java.util.HashSet()) |
|
83 |
|
pool = storm.impl.DirPool(java.io.File(POOLDIR), java.util.HashSet()) |
84 |
myalph = alph.impl.StormAlph(pool) |
myalph = alph.impl.StormAlph(pool) |
85 |
|
|
86 |
# set flag to load an old graph or creating new |
# set flag to load an old graph or creating new |
333 |
mindMouse.setListener(1, 0,'Moving the pan around or the node if accursed.', \ |
mindMouse.setListener(1, 0,'Moving the pan around or the node if accursed.', \ |
334 |
PanMover(context)) |
PanMover(context)) |
335 |
|
|
|
|
|
336 |
class VeryStupidBuoyManager: |
class VeryStupidBuoyManager: |
337 |
def __init__(self): |
def __init__(self): |
338 |
self.main = ff.view.lava.mindMapView2D.MindMapMainNode2D(context.home, mindView, |
self.main = ff.view.lava.mindMapView2D.MindMapMainNode2D(context.home, mindView, |
350 |
|
|
351 |
### custom controller support |
### custom controller support |
352 |
self.naxes = 0 |
self.naxes = 0 |
353 |
|
self.calibrating = 0 |
354 |
try: |
try: |
355 |
self.ps2 = vob.input.impl.PS2MouseDevice("/dev/input/mouse0", "main", |
self.ps2 = vob.input.impl.PS2MouseDevice("/dev/input/mouse0", "main", |
356 |
vob.input.impl.PS2MouseDevice.IMPS_PROTO) |
vob.input.impl.PS2MouseDevice.IMPS_PROTO) |
357 |
self.naxes = len(self.ps2.getAxes()) |
self.naxes = len(self.ps2.getAxes()) |
358 |
self.axes = [ |
if self.naxes > 3: self.naxes = 3 |
359 |
vob.input.impl.StandardBoundedFloatModel(0, 400, |
self.axes = [None, None, None] |
360 |
actionPerformed = lambda x: vob.AbstractUpdateManager.chg()) |
if self.naxes >= 1: |
361 |
for i in range(0,self.naxes)] |
self.axes[0] = vob.input.impl.StandardBoundedFloatModel(0.001, mindView.nodeScale*2, |
362 |
|
actionPerformed = lambda x: vob.AbstractUpdateManager.chg()) |
363 |
|
if self.naxes >= 2: |
364 |
|
self.axes[1] = vob.input.impl.StandardBoundedFloatModel(0.001, mindView.distanceScale*2, |
365 |
|
actionPerformed = lambda x: vob.AbstractUpdateManager.chg()) |
366 |
|
if self.naxes >= 3: |
367 |
|
self.axes[2] = vob.input.impl.WrappingBoundedFloatModel(0, Math.PI*2, |
368 |
|
actionPerformed = lambda x: vob.AbstractUpdateManager.chg()) |
369 |
|
|
370 |
for i in range(0,self.naxes): |
for i in range(0,self.naxes): |
371 |
self.ps2.getAxes()[i].setMainListener( |
self.ps2.getAxes()[i].setMainListener( |
372 |
vob.input.BoundedFloatLinearAbsoluteAdapter(self.axes[i])) |
vob.input.BoundedFloatLinearAbsoluteAdapter(self.axes[i])) |
381 |
|
|
382 |
|
|
383 |
# custom controller support |
# custom controller support |
384 |
if self.naxes >= 1: |
if self.naxes >= 1: mindView.nodeScale = self.axes[0].getValue() |
385 |
mindView.nodeScale = self.axes[0].getValue() / 10. + 1 |
if self.naxes >= 2: mindView.distanceScale = self.axes[1].getValue() |
386 |
if self.naxes >= 2: |
if self.naxes >= 3: mindView.rotation = -self.axes[2].getValue() |
|
mindView.distanceScale = self.axes[1].getValue() / 50. + 1 |
|
|
if self.naxes >= 3: |
|
|
mindView.rotation = self.axes[2].getValue() / -4 |
|
387 |
|
|
388 |
vs.put(background(context.bgcolor)) |
vs.put(background(context.bgcolor)) |
389 |
cs = vs.orthoBoxCS(0, "foo",0, 50,50, 1,1, 750,650) |
cs = vs.orthoBoxCS(0, "foo",0, 50,50, 1,1, 750,650) |
470 |
"""Move the cursor to the end of the text.""" |
"""Move the cursor to the end of the text.""" |
471 |
text = alphContent.getText(fen.graph, context.getAccursed()) |
text = alphContent.getText(fen.graph, context.getAccursed()) |
472 |
context.offset = len(text) |
context.offset = len(text) |
473 |
if key == "Ctrl-C": |
if key == "Ctrl-C" or "Ctrl-K": |
474 |
"""Copy the content of the node into the clipboard.""" |
"""Copy the content of the node into the clipboard.""" |
475 |
text = alphContent.getText(fen.graph, context.getAccursed()) |
text = alphContent.getText(fen.graph, context.getAccursed()) |
476 |
PUIClipboard.puiCopy(text) |
PUIClipboard.puiCopy(text) |
497 |
context.offset = normal_text.getPos(fen.graph, context.getAccursed(), xy[0], xy[1]) |
context.offset = normal_text.getPos(fen.graph, context.getAccursed(), xy[0], xy[1]) |
498 |
text = alphContent.getText(fen.graph, context.getAccursed()) |
text = alphContent.getText(fen.graph, context.getAccursed()) |
499 |
if context.offset < len(text): context.offset -= 1 |
if context.offset < len(text): context.offset -= 1 |
500 |
|
if key == "Ctrl-0": |
501 |
|
"""Set calibrating state of custom controller on / off.""" |
502 |
|
if self.calibrating and self.naxes: |
503 |
|
p("Custom controller calibrated.") |
504 |
|
self.calibrating = 0 |
505 |
|
for axe in self.ps2.getAxes(): |
506 |
|
axe.setState(vob.input.InputDeviceManager.STATE_NORMAL) |
507 |
|
elif self.naxes: |
508 |
|
p("Calibrate custom controller. Please, move axes to their extreme positions.") |
509 |
|
self.calibrating = 1 |
510 |
|
for axe in self.ps2.getAxes(): |
511 |
|
axe.setState(vob.input.InputDeviceManager.STATE_CALIBRATING) |
512 |
elif len(key) == 1: |
elif len(key) == 1: |
513 |
"""Enter a character into the cursor position.""" |
"""Enter a character into the cursor position.""" |
514 |
context.scale = 1 |
context.scale = 1 |
518 |
text = alphContent.getText(fen.graph, context.getAccursed()) |
text = alphContent.getText(fen.graph, context.getAccursed()) |
519 |
print text[0:context.offset], '[cursor]' |
print text[0:context.offset], '[cursor]' |
520 |
|
|
|
vob.AbstractUpdateManager.chg() |
|
|
|
|
521 |
|
|
522 |
currentScene = VeryStupidBuoyManager() |
currentScene = VeryStupidBuoyManager() |
523 |
vob.putil.demo.usingNormalBindings = 0 |
vob.putil.demo.usingNormalBindings = 0 |