Commit 3dc3f855 authored by VIGNET Pierre's avatar VIGNET Pierre
Browse files

[gui] Add escape shortcut to Char simulator; controler; solutions window; notes

parent 76fe47e4
......@@ -85,8 +85,7 @@ class ChartChecker(object):
# graphical interface
self.__main_window = gtk.Window()
self.__main_window.set_title("Property check: " + self.__emvc.model.name)
if self.__main_window:
self.__main_window.connect("destroy", self.__on_destroy)
self.__main_window.connect("destroy", self.__on_destroy)
self.__main_window.set_position(gtk.WIN_POS_CENTER)
self.__main_window.resize(600, 300)
......@@ -523,6 +522,8 @@ class SolutionWindow(object):
self.window.set_size_request(700, height)
# Ability to destroy opened ChartSimulControler
self.window.connect("destroy", self.on_destroy)
# Event on_escape key pressed
self.window.connect("key_press_event", self.on_escape)
# Info label: Set title
if title:
......@@ -628,6 +629,11 @@ class SolutionWindow(object):
if self.window:
self.window.destroy()
def on_escape(self, widget, event):
"""On ESC key_press_event, destroy this window."""
if gtk.gdk.keyval_name(event.keyval) == "Escape":
self.window.destroy()
def build_button_frame(self, state_list, group=None):
"""
???
......
......@@ -104,8 +104,9 @@ class ChartSimulControler(object):
# Get the Main Window, and connect the "destroy" event
self.main_window = self.wtree.get_widget("window1")
self.main_window.set_title("Simulation: "+self.model.name)
if (self.main_window):
self.main_window.connect("destroy", self.on_destroy)
self.main_window.connect("destroy", self.on_destroy)
# Event on_escape key pressed
self.main_window.connect("key_press_event", self.on_escape)
self.main_window.set_position(gtk.WIN_POS_CENTER)
self.main_window.set_keep_above(True)
......@@ -203,6 +204,11 @@ class ChartSimulControler(object):
"""
self.on_destroy(None)
def on_escape(self, widget, event):
"""On ESC key_press_event, destroy this window."""
if gtk.gdk.keyval_name(event.keyval) == "Escape":
self.destroy()
def on_step_simul(self, widget):
"""
callback for step by step simulation
......
......@@ -134,10 +134,11 @@ class Charter(object):
"chart_glade/charter.glade"
)
self.wtree = gtk.glade.XML(template)
# Get the Main Window, and connect the "destroy" event
# Get the Main Window
self.main_window = self.wtree.get_widget("TopModel")
if self.main_window:
self.main_window.connect("delete_event", self.on_destroy)
# connect the "destroy" event
self.main_window.connect("delete_event", self.on_destroy)
h_scr = screen_height()
w_scr = screen_width()
self.h_scr = int(h_scr)
......
......@@ -201,8 +201,7 @@ class BioSignalEditor:
# Get the Main Window, and connect the "destroy" event
self.main_window = self.wtree.get_widget("window1")
if self.main_window:
self.main_window.connect("delete_event", self.on_destroy)
self.main_window.connect("delete_event", self.on_destroy)
self.main_window.set_title(name)
self.main_window.set_default_size(800, 900)
self.main_window.set_position(gtk.WIN_POS_CENTER)
......
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