27 |
|
|
28 |
# Flags that can be passed to Gzz.py |
# Flags that can be passed to Gzz.py |
29 |
# (prefix with '--' on the command line) |
# (prefix with '--' on the command line) |
30 |
flagset = ['multiline', 'double-size', 'triple-size', 'lollipop'] |
flagset = ['multiline', 'double-size', 'triple-size', 'lollipop', |
31 |
|
'python-bindings', 'potion-bindings'] |
32 |
|
|
33 |
|
|
34 |
class Gzz(java.lang.Runnable): |
class Gzz(java.lang.Runnable): |
35 |
"""The main Gzz client class.""" |
"""The main Gzz client class.""" |
36 |
|
|
37 |
transient = 0 |
transient = 0 |
|
bindings_type = 'java' |
|
38 |
flags = [] |
flags = [] |
39 |
|
|
40 |
def run(self): |
def run(self): |
82 |
gzz.control.commander.AwtCommander(globals()) |
gzz.control.commander.AwtCommander(globals()) |
83 |
if o in ("-t", "--transient"): |
if o in ("-t", "--transient"): |
84 |
self.transient = 1 |
self.transient = 1 |
|
if o in ("-p", "--python-bindings"): |
|
|
self.bindings_type = 'python' |
|
85 |
if o[2:] in flagset: |
if o[2:] in flagset: |
86 |
self.flags.append(o[2:]) |
self.flags.append(o[2:]) |
87 |
|
|
93 |
|
|
94 |
|
|
95 |
def set_defaults(self): |
def set_defaults(self): |
96 |
if self.bindings_type == 'java': |
if 'python-bindings' in self.flags: |
|
self.binder = gzz.view.DefaultBinder() |
|
|
else: |
|
97 |
print "Using Python bindings" |
print "Using Python bindings" |
98 |
import bindings |
import bindings |
99 |
self.binder = gzz.client.pythonbinder.PythonBinder( |
self.binder = gzz.client.pythonbinder.PythonBinder( |
100 |
bindings.normal_mode, bindings.edit_mode, bindings.search_mode) |
bindings.normal_mode, bindings.edit_mode, bindings.search_mode) |
101 |
|
|
102 |
|
elif 'potion-bindings' in self.flags: |
103 |
|
arr = gzz.client.PotionFallbackBinder.Arrow |
104 |
|
bindings = java.util.HashMap() |
105 |
|
bindings.put('Up', arr(1,1,-1)) |
106 |
|
bindings.put('Down', arr(1,1,1)) |
107 |
|
bindings.put('Left', arr(1,0,-1)) |
108 |
|
bindings.put('Right', arr(1,0,1)) |
109 |
|
newCell = gzz.potion.potions.NewCell(); |
110 |
|
bindings.put('n', gzz.potion.CommandCall(newCell, [None])) |
111 |
|
self.binder = gzz.client.PotionFallbackBinder(bindings) |
112 |
|
else: |
113 |
|
self.binder = gzz.view.DefaultBinder() |
114 |
|
|
115 |
self.spanType = java.lang.System.getProperty("gzz.spanType") |
self.spanType = java.lang.System.getProperty("gzz.spanType") |
116 |
self.spaceType = java.lang.System.getProperty("gzz.spaceType") |
self.spaceType = java.lang.System.getProperty("gzz.spaceType") |