Commit f2431525 authored by VIGNET Pierre's avatar VIGNET Pierre
Browse files

Remove useless 'Select' button in GUI => replace by ESC key binding => more space in GUI

parent 15554f56
......@@ -122,6 +122,8 @@ class Charter(object):
self.my_accelerators = gtk.AccelGroup()
self.main_window.add_accel_group(self.my_accelerators)
self.main_window.connect('key_press_event', self.on_key_pressed)
# menu bar
menu_bar = self.wtree.get_widget("menubar1")
menu_bar.set_size_request(0, 25)
......@@ -261,9 +263,9 @@ class Charter(object):
self.button_handlers = dict()
c_box = self.wtree.get_widget("controler_box")
but = gtk.Button(label="Select")
c_box.add(but)
self.button_handlers["Select"] = (but, -1)
#but = gtk.Button(label="Select")
#c_box.add(but)
#self.button_handlers["Select"] = (but, -1)
but = gtk.Button(label="InputNode F1")
self.add_accelerator(but, "F1")
......@@ -324,10 +326,10 @@ class Charter(object):
Connect the buttons to the controler of the graphic view
Remember for each button the handler
"""
(but, bhan) = self.button_handlers["Select"]
bhan = but.connect("clicked",
self.current_edit_mvc.controler.set_action_select)
self.button_handlers["Select"] = (but, bhan)
#(but, bhan) = self.button_handlers["Select"]
#bhan = but.connect("clicked",
# self.current_edit_mvc.controler.set_action_select)
#self.button_handlers["Select"] = (but, bhan)
(but, bhan) = self.button_handlers["InputNode"]
bhan = but.connect("clicked",
......@@ -395,6 +397,16 @@ class Charter(object):
# image.set_from_file(template)
widget.set_image(image)
@check_curent_model
def on_key_pressed(self, widget, event):
"""On ESC key_press_event, send select event.
i.e: deselect any Node previously selected.
=> allow the move of elements on the graph.
"""
keyval_name = gtk.gdk.keyval_name(event.keyval)
if keyval_name == 'Escape':
self.current_edit_mvc.controler.set_action_select(None)
def add_accelerator(self, widget, accelerator, signal="activate"):
"""Adds a keyboard shortcut"""
if accelerator is not None:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment