Make the console a slide-in window. Change keybinding to Ctrl-Down
This commit is contained in:
parent
a929dc0b46
commit
b6b50ff285
@ -48,6 +48,12 @@ class WindowManager:
|
|||||||
if wm._position == WindowManager.TOP:
|
if wm._position == WindowManager.TOP:
|
||||||
manager = wm
|
manager = wm
|
||||||
|
|
||||||
|
if event.keyval == gtk.keysyms.Down and \
|
||||||
|
event.state & gtk.gdk.CONTROL_MASK:
|
||||||
|
for wm in WindowManager.__managers_list:
|
||||||
|
if wm._position == WindowManager.BOTTOM:
|
||||||
|
manager = wm
|
||||||
|
|
||||||
if manager and manager._window.get_property('visible'):
|
if manager and manager._window.get_property('visible'):
|
||||||
manager.slide_window_out()
|
manager.slide_window_out()
|
||||||
elif manager:
|
elif manager:
|
||||||
@ -87,6 +93,9 @@ class WindowManager:
|
|||||||
elif self._position is WindowManager.TOP:
|
elif self._position is WindowManager.TOP:
|
||||||
self._x = int((screen_width - width) / 2)
|
self._x = int((screen_width - width) / 2)
|
||||||
self._y = - int((1.0 - self._sliding_pos) * height)
|
self._y = - int((1.0 - self._sliding_pos) * height)
|
||||||
|
elif self._position is WindowManager.BOTTOM:
|
||||||
|
self._x = int((screen_width - width) / 2)
|
||||||
|
self._y = screen_height - int(self._sliding_pos * height)
|
||||||
|
|
||||||
self._real_width = width
|
self._real_width = width
|
||||||
self._real_height = height
|
self._real_height = height
|
||||||
|
@ -458,26 +458,23 @@ class ConsoleLogger(dbus.service.Object):
|
|||||||
|
|
||||||
self._window = gtk.Window()
|
self._window = gtk.Window()
|
||||||
self._window.set_title("Console")
|
self._window.set_title("Console")
|
||||||
self._window.set_default_size(640, 480)
|
self._window.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_DOCK)
|
||||||
|
self._window.set_decorated(False)
|
||||||
|
self._window.set_skip_taskbar_hint(True)
|
||||||
self._window.connect("delete_event", lambda w, e: w.hide_on_delete())
|
self._window.connect("delete_event", lambda w, e: w.hide_on_delete())
|
||||||
|
|
||||||
self._nb = gtk.Notebook()
|
self._nb = gtk.Notebook()
|
||||||
self._window.add(self._nb)
|
self._window.add(self._nb)
|
||||||
self._nb.show()
|
self._nb.show()
|
||||||
|
|
||||||
self._consoles = {}
|
self._consoles = {}
|
||||||
|
|
||||||
def set_parent_window(self, window):
|
console_wm = WindowManager(self._window)
|
||||||
window.connect("key-press-event", self.__key_press_event_cb)
|
|
||||||
self._window.connect("key-press-event", self.__key_press_event_cb)
|
|
||||||
|
|
||||||
def __key_press_event_cb(self, window, event):
|
console_wm.set_width(0.7, WindowManager.SCREEN_RELATIVE)
|
||||||
if event.keyval == gtk.keysyms.d and \
|
console_wm.set_height(0.9, WindowManager.SCREEN_RELATIVE)
|
||||||
event.state & gtk.gdk.CONTROL_MASK:
|
console_wm.set_position(WindowManager.BOTTOM)
|
||||||
if self._window.get_property('visible'):
|
console_wm.manage()
|
||||||
self._window.hide()
|
|
||||||
else:
|
|
||||||
self._window.show()
|
|
||||||
|
|
||||||
def _create_console(self, application):
|
def _create_console(self, application):
|
||||||
sw = gtk.ScrolledWindow()
|
sw = gtk.ScrolledWindow()
|
||||||
@ -535,8 +532,6 @@ class Shell(gobject.GObject):
|
|||||||
wm.show()
|
wm.show()
|
||||||
wm.manage()
|
wm.manage()
|
||||||
|
|
||||||
console.set_parent_window(activity_container.window)
|
|
||||||
|
|
||||||
def __activity_container_destroy_cb(self, activity_container):
|
def __activity_container_destroy_cb(self, activity_container):
|
||||||
self.emit('close')
|
self.emit('close')
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@ else:
|
|||||||
add_to_python_path(os.path.join(sugar.env.get_data_dir(), 'shell'))
|
add_to_python_path(os.path.join(sugar.env.get_data_dir(), 'shell'))
|
||||||
print 'Running the installed sugar...'
|
print 'Running the installed sugar...'
|
||||||
|
|
||||||
print 'Redirecting output to the console, press ctrl+d to open it.'
|
print 'Redirecting output to the console, press Ctrl+Down to open it.'
|
||||||
|
|
||||||
from session.session import Session
|
from session.session import Session
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user