Merge branch 'master' of git://dev.laptop.org/sugar

This commit is contained in:
Tomeu Vizoso 2006-11-10 11:58:11 +01:00
commit 028bf526f2
9 changed files with 77 additions and 7 deletions

5
README
View File

@ -24,5 +24,10 @@ F3 Friends zoom level
F4 Mesh zoom level
F5 Show the frame
F6 Open a terminal activity
F7 Toggle chat visibility
F8 Color mode (DCON)
F9 Black and white mode (DCON)
F10 Decrease brightness (DCON)
F11 Increase brightness (DCON)
F12 Open the log viewer
Ctrl+S Activate sketch mode in chat

View File

@ -1,4 +1,4 @@
AC_INIT([Sugar],[0.49],[],[sugar])
AC_INIT([Sugar],[0.51],[],[sugar])
AC_PREREQ([2.59])

View File

@ -378,9 +378,9 @@ gtk_entry_draw_text (GtkEntry *entry)
}
static void
_gtk_entry_get_borders (GtkEntry *entry,
gint *xborder,
gint *yborder)
sugar_address_entry_get_borders (GtkEntry *entry,
gint *xborder,
gint *yborder)
{
GtkWidget *widget = GTK_WIDGET (entry);
gint focus_width;
@ -422,7 +422,7 @@ get_text_area_size (GtkEntry *entry,
gtk_widget_get_child_requisition (widget, &requisition);
_gtk_entry_get_borders (entry, &xborder, &yborder);
sugar_address_entry_get_borders (entry, &xborder, &yborder);
if (x)
*x = xborder;

View File

@ -4,7 +4,8 @@ bin_SCRIPTS = \
sugar-activity \
sugar-activity-factory \
sugar-log-viewer \
sugar-shell
sugar-shell \
sugar-shutdown
sugardir = $(pkgdatadir)/shell
sugar_PYTHON = \

View File

@ -8,3 +8,4 @@
F12=!sugar-log-viewer
<Alt>q=!sugar-emulator-shutdown
<Alt><Shift>Escape=!sugar-shutdown

4
shell/sugar-shutdown Executable file
View File

@ -0,0 +1,4 @@
#!/bin/sh
dbus-send --system --print-reply --dest=org.freedesktop.Hal \
/org/freedesktop/Hal/devices/computer \
org.freedesktop.Hal.Device.SystemPowerManagement.Shutdown

View File

@ -11,4 +11,5 @@ sugar_PYTHON = \
ClipboardMenu.py \
OverlayWindow.py \
Shell.py \
dconmanager.py \
stylesheet.py

View File

@ -26,6 +26,7 @@ from view.ActivityHost import ActivityHost
from sugar.activity import ActivityFactory
from sugar.activity import Activity
from view.frame.Frame import Frame
from view.dconmanager import DCONManager
from _sugar import KeyGrabber
import sugar
@ -49,6 +50,8 @@ class Shell(gobject.GObject):
style.load_stylesheet(view.stylesheet)
self._dcon_manager = DCONManager()
self._key_grabber = KeyGrabber()
self._key_grabber.connect('key-pressed',
self.__global_key_pressed_cb)
@ -60,7 +63,11 @@ class Shell(gobject.GObject):
self._key_grabber.grab('F4')
self._key_grabber.grab('F5')
self._key_grabber.grab('F6')
self._key_grabber.grab('F7')
self._key_grabber.grab('F8')
self._key_grabber.grab('F9')
self._key_grabber.grab('F10')
self._key_grabber.grab('F11')
self._home_window = HomeWindow(self)
self._home_window.show()
@ -87,8 +94,16 @@ class Shell(gobject.GObject):
self._frame.notify_key_press()
elif key == 'F6':
self.start_activity('org.sugar.Terminal')
elif key == 'F9':
elif key == 'F7':
self.toggle_chat_visibility()
elif key == 'F8':
self._dcon_manager.set_mode(DCONManager.COLOR_MODE)
elif key == 'F9':
self._dcon_manager.set_mode(DCONManager.BLACK_AND_WHITE_MODE)
elif key == 'F10':
self._dcon_manager.decrease_brightness()
elif key == 'F11':
self._dcon_manager.increase_brightness()
def __global_key_released_cb(self, grabber, key):
if key == 'F5':

43
shell/view/dconmanager.py Normal file
View File

@ -0,0 +1,43 @@
# Copyright (C) 2006, Red Hat, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
import dbus
DCON_MANAGER_INTERFACE = 'org.laptop.DCONManager'
DCON_MANAGER_SERVICE = 'org.laptop.DCONManager'
DCON_MANAGER_OBJECT_PATH = '/org/laptop/DCONManager'
class DCONManager(object):
COLOR_MODE = 0
BLACK_AND_WHITE_MODE = 1
def __init__(self):
bus = dbus.SystemBus()
proxy = bus.get_object(DCON_MANAGER_SERVICE, DCON_MANAGER_OBJECT_PATH)
self._service = dbus.Interface(proxy, DCON_MANAGER_INTERFACE)
def set_mode(self, mode):
self._service.set_mode(mode)
def increase_brightness(self):
level = self._service.get_backlight_level()
if level >= 0:
self._service.set_backlight_level(level + 1)
def decrease_brightness(self):
level = self._service.get_backlight_level()
if level >= 0:
self._service.set_backlight_level(level - 1)