split toggle
This commit is contained in:
parent
4d19d295e0
commit
a266c0b014
|
@ -225,6 +225,7 @@ class LinearSpline(Spline):
|
|||
class GUI(Animation):
|
||||
|
||||
B_DUPLICATE, B_WRITE, B_DELETE, B_LINEAR, B_CUBIC, B_SPLIT = range(6)
|
||||
S_NONE, S_LEFT, S_RIGHT = range(3)
|
||||
|
||||
def __init__(self, parent):
|
||||
Animation.__init__(self, parent, unfiltered=True)
|
||||
|
@ -233,7 +234,7 @@ class GUI(Animation):
|
|||
self.display_surface = self.get_display_surface()
|
||||
self.time_filter = self.get_game().time_filter
|
||||
self.delegate = self.get_delegate()
|
||||
self.split = False
|
||||
self.split = self.S_NONE
|
||||
self.success_indicator_active = True
|
||||
self.success_indicator_blink_count = 0
|
||||
self.load_configuration()
|
||||
|
@ -302,7 +303,7 @@ class GUI(Animation):
|
|||
|
||||
def set_buttons(self):
|
||||
self.buttons = buttons = []
|
||||
text = "Duplicate", "Write", "Delete", "Linear", "Cubic", "[---]"
|
||||
text = "Duplicate", "Write", "Delete", "Linear", "Cubic", "Split: No"
|
||||
x = 0
|
||||
for instruction in text:
|
||||
buttons.append(Button(self, instruction, x))
|
||||
|
@ -364,7 +365,7 @@ class GUI(Animation):
|
|||
return x, y
|
||||
|
||||
def adjust_for_split(self, y_range, nodeset):
|
||||
middle = nodeset[0].y
|
||||
middle = nodeset[0].y if self.split == self.S_LEFT else nodeset[-1].y
|
||||
below, above = middle - y_range[0], y_range[1] - middle
|
||||
if below > above:
|
||||
y_range[1] += below - above
|
||||
|
@ -467,7 +468,7 @@ class GUI(Animation):
|
|||
self.store_in_configuration()
|
||||
redraw = True
|
||||
elif bi == self.B_SPLIT:
|
||||
self.split = not self.split
|
||||
self.toggle_split()
|
||||
redraw = True
|
||||
elif plot_rect.collidepoint(pos) and \
|
||||
not self.collide_markers(pos):
|
||||
|
@ -540,6 +541,13 @@ class GUI(Animation):
|
|||
config.add_section(section)
|
||||
config.set(section, nodeset.name, code)
|
||||
|
||||
def toggle_split(self):
|
||||
self.split += 1
|
||||
if self.split > self.S_RIGHT:
|
||||
self.split = self.S_NONE
|
||||
self.buttons[self.B_SPLIT].set_frame(["Split: no", "Split: L",
|
||||
"Split: R"][self.split])
|
||||
|
||||
def add_nodeset(self, name):
|
||||
nodeset = self.get_nodeset()
|
||||
self.set_nodeset_index(index=self.parent.add_nodeset(\
|
||||
|
@ -668,6 +676,7 @@ class Button(Sprite):
|
|||
self.get_display_surface().get_rect().bottom
|
||||
|
||||
def set_frame(self, text):
|
||||
self.clear_frames()
|
||||
self.add_frame(self.parent.font.render(text, True, (0, 0, 0),
|
||||
(255, 255, 255)))
|
||||
|
||||
|
|
Loading…
Reference in New Issue