Do not hide the frame if menushell is active.

This commit is contained in:
Marco Pesenti Gritti 2006-09-19 14:43:42 +02:00
parent 9ff192d0b3
commit ec0debdb30
2 changed files with 32 additions and 5 deletions

View File

@ -75,7 +75,9 @@ class Frame:
root = model.get_root_item()
grid = shell.get_grid()
menu_shell = MenuShell(grid)
self._menu_shell = MenuShell(grid)
self._menu_shell.connect('activated', self._menu_shell_activated_cb)
self._menu_shell.connect('deactivated', self._menu_shell_deactivated_cb)
bg = goocanvas.Rect(fill_color="#4f4f4f", line_width=0)
grid.set_constraints(bg, 0, 0, 80, 60)
@ -87,12 +89,12 @@ class Frame:
self._add_panel(model, 0, 55, 80, 5)
panel = TopPanel(shell, menu_shell)
panel = TopPanel(shell, self._menu_shell)
root.add_child(panel)
self._add_panel(model, 0, 0, 80, 5)
panel = RightPanel(shell, menu_shell)
panel = RightPanel(shell, self._menu_shell)
grid.set_constraints(panel, 75, 5)
root.add_child(panel)
@ -113,6 +115,12 @@ class Frame:
self._windows.append(panel_window)
def _menu_shell_activated_cb(self, menu_shell):
self._cancel_hide()
def _menu_shell_deactivated_cb(self, menu_shell):
self._hide_after(500)
def _enter_notify_cb(self, window, event):
self._cancel_hide()
@ -121,7 +129,8 @@ class Frame:
if event.state == gtk.gdk.BUTTON1_MASK:
return
self._hide_after(500)
if not self._menu_shell.is_active():
self._hide_after(500)
def _event_frame_hover_cb(self, event_frame):
self.show()

View File

@ -1,9 +1,27 @@
class MenuShell:
import gobject
class MenuShell(gobject.GObject):
__gsignals__ = {
'activated': (gobject.SIGNAL_RUN_FIRST,
gobject.TYPE_NONE, ([])),
'deactivated': (gobject.SIGNAL_RUN_FIRST,
gobject.TYPE_NONE, ([])),
}
def __init__(self, grid):
gobject.GObject.__init__(self)
self._menu_controller = None
self._grid = grid
def is_active(self):
return (self._menu_controller != None)
def set_active(self, controller):
if controller == None:
self.emit('deactivated')
else:
self.emit('activated')
if self._menu_controller:
self._menu_controller.popdown()
self._menu_controller = controller