Toggle console visibility

This commit is contained in:
Marco Pesenti Gritti 2007-01-10 17:12:23 +01:00
parent 84d3471613
commit 6e599ead06
3 changed files with 11 additions and 7 deletions

View File

@ -80,8 +80,12 @@ class Service(dbus.service.Object):
self._console = Console() self._console = Console()
@dbus.service.method(CONSOLE_IFACE) @dbus.service.method(CONSOLE_IFACE)
def show(self): def toggle_visibility(self):
self._console.window.present() window = self._console.window
if not window.props.visible:
window.present()
else:
window.hide()
bus = dbus.SessionBus() bus = dbus.SessionBus()
name = dbus.service.BusName(CONSOLE_BUS, bus) name = dbus.service.BusName(CONSOLE_BUS, bus)

View File

@ -138,7 +138,7 @@ class Shell(gobject.GObject):
elif key == '<alt>F8': elif key == '<alt>F8':
self._hw_manager.set_display_mode(HardwareManager.B_AND_W_MODE) self._hw_manager.set_display_mode(HardwareManager.B_AND_W_MODE)
elif key == '<alt>equal' or key == '<alt>0': elif key == '<alt>equal' or key == '<alt>0':
gobject.idle_add(self._show_console_cb) gobject.idle_add(self._toggle_console_visibility_cb)
elif key == '<alt>f': elif key == '<alt>f':
self._frame.notify_key_press() self._frame.notify_key_press()
elif key == '<alt>o': elif key == '<alt>o':
@ -158,12 +158,12 @@ class Shell(gobject.GObject):
box = self._home_window.get_home_box() box = self._home_window.get_home_box()
box.grab_and_rotate() box.grab_and_rotate()
def _show_console_cb(self): def _toggle_console_visibility_cb(self):
bus = dbus.SessionBus() bus = dbus.SessionBus()
proxy = bus.get_object('org.laptop.sugar.Console', proxy = bus.get_object('org.laptop.sugar.Console',
'/org/laptop/sugar/Console') '/org/laptop/sugar/Console')
mgr = dbus.Interface(proxy, 'org.laptop.sugar.Console') console = dbus.Interface(proxy, 'org.laptop.sugar.Console')
mgr.show() console.toggle_visibility()
def _shutdown(self): def _shutdown(self):
bus = dbus.SystemBus() bus = dbus.SystemBus()

View File

@ -1,6 +1,6 @@
VERSION=0.63 VERSION=0.63
DATE=`date +%Y%m%d` DATE=`date +%Y%m%d`
RELEASE=2.6 RELEASE=2.7
TARBALL=sugar-$VERSION-$RELEASE.${DATE}git.tar.bz2 TARBALL=sugar-$VERSION-$RELEASE.${DATE}git.tar.bz2
rm sugar-$VERSION.tar.bz2 rm sugar-$VERSION.tar.bz2