Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Schampijer <simon@schampijer.de>2012-08-13 13:53:09 (GMT)
committer Simon Schampijer <simon@laptop.org>2012-10-04 23:06:56 (GMT)
commitb7997ef33011283690c9a3d24d54fb7050316e5c (patch)
tree0605b42a468735bb5d38a3b90737e0aa9b4a6074
parentd6e3fe411ee22dc4308cd06f54e2b5e0bd1d27ab (diff)
Frame: add a device icon to reveal the OSK manually, SL #3982
This adds a device icon to reveal the OSK manually. We add a soft dependency on Maliit, if it is not available the icon is not added to the Frame. When the OSK is revealed using the button the Frame hides. Signed-off-by: Simon Schampijer <simon@laptop.org> Acked-by: Manuel QuiƱones <manuq@laptop.org>
-rw-r--r--data/icons/module-keyboard.svg154
-rw-r--r--extensions/deviceicon/Makefile.am1
-rw-r--r--extensions/deviceicon/frame.py69
3 files changed, 91 insertions, 133 deletions
diff --git a/data/icons/module-keyboard.svg b/data/icons/module-keyboard.svg
index 43bbc57..4b82236 100644
--- a/data/icons/module-keyboard.svg
+++ b/data/icons/module-keyboard.svg
@@ -1,134 +1,22 @@
-<?xml version="1.0" ?><!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd' [
- <!ENTITY stroke_color "#666666">
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
+ <!ENTITY stroke_color "#010101">
<!ENTITY fill_color "#ffffff">
-]><svg enable-background="new 0 0 55 55" height="55px" id="Layer_1" version="1.1" viewBox="0 0 55 55" width="55px" x="0px" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" y="0px"><g display="block" id="module-keyboard">
- <rect display="inline" fill="&fill_color;" height="23.326" width="54" x="0.5" y="15.837"/>
- <g display="inline">
- <path d="M52.61,28.081c0,0.55-0.45,1-1,1h-5.443c-0.55,0-1-0.45-1-1v-5.444c0-0.55,0.45-1,1-1h5.443c0.55,0,1,0.45,1,1V28.081z"/>
- </g>
- <g display="inline">
- <path d="M52.61,19.941c0,0.55-0.45,1-1,1h-5.412c-0.55,0-1-0.45-1-1v-1.368c0-0.55,0.45-1,1-1h5.412c0.55,0,1,0.45,1,1V19.941z"/>
- </g>
- <g display="inline">
- <path d="M52.61,32.267c0,0.55-0.45,1-1,1h-5.412c-0.55,0-1-0.45-1-1v-1.367c0-0.55,0.45-1,1-1h5.412c0.55,0,1,0.45,1,1V32.267z"/>
- </g>
- <g display="inline">
- <path d="M39.11,36.403c0,0.55-0.45,1-1,1H13.176c-0.55,0-1-0.45-1-1v-1.366c0-0.55,0.45-1,1-1H38.11c0.55,0,1,0.45,1,1V36.403z"/>
- </g>
- <g display="inline">
- <g>
- <path d="M5.889,19.977c0,0.55-0.45,1-1,1H3.549c-0.55,0-1-0.45-1-1v-1.339c0-0.55,0.45-1,1-1h1.339c0.55,0,1,0.45,1,1V19.977z"/>
- </g>
- <g>
- <path d="M10.65,19.977c0,0.55-0.45,1-1,1H8.311c-0.55,0-1-0.45-1-1v-1.339c0-0.55,0.45-1,1-1H9.65c0.55,0,1,0.45,1,1V19.977z"/>
- </g>
- <g>
- <path d="M15.411,19.977c0,0.55-0.45,1-1,1h-1.339c-0.55,0-1-0.45-1-1v-1.339c0-0.55,0.45-1,1-1h1.339c0.55,0,1,0.45,1,1V19.977z"/>
- </g>
- <g>
- <path d="M20.173,19.978c0,0.55-0.45,1-1,1h-1.34c-0.55,0-1-0.45-1-1v-1.34c0-0.55,0.45-1,1-1h1.34c0.55,0,1,0.45,1,1V19.978z"/>
- </g>
- <g>
- <path d="M24.934,19.977c0,0.55-0.45,1-1,1h-1.34c-0.55,0-1-0.45-1-1v-1.339c0-0.55,0.45-1,1-1h1.34c0.55,0,1,0.45,1,1V19.977z"/>
- </g>
- <g>
- <path d="M29.695,19.978c0,0.55-0.45,1-1,1h-1.34c-0.55,0-1-0.45-1-1v-1.34c0-0.55,0.45-1,1-1h1.34c0.55,0,1,0.45,1,1V19.978z"/>
- </g>
- <g>
- <path d="M34.457,19.977c0,0.55-0.45,1-1,1h-1.341c-0.55,0-1-0.45-1-1v-1.339c0-0.55,0.45-1,1-1h1.341c0.55,0,1,0.45,1,1V19.977z"/>
- </g>
- <g>
- <path d="M39.218,19.977c0,0.55-0.45,1-1,1h-1.341c-0.55,0-1-0.45-1-1v-1.339c0-0.55,0.45-1,1-1h1.341c0.55,0,1,0.45,1,1V19.977z"/>
- </g>
- <g>
- <path d="M43.979,19.977c0,0.55-0.45,1-1,1h-1.341c-0.55,0-1-0.45-1-1v-1.339c0-0.55,0.45-1,1-1h1.341c0.55,0,1,0.45,1,1V19.977z"/>
- </g>
- </g>
- <g display="inline">
- <g>
- <path d="M5.889,24.038c0,0.55-0.45,1-1,1H3.549c-0.55,0-1-0.45-1-1v-1.339c0-0.55,0.45-1,1-1h1.339c0.55,0,1,0.45,1,1V24.038z"/>
- </g>
- <g>
- <path d="M10.65,24.038c0,0.55-0.45,1-1,1H8.311c-0.55,0-1-0.45-1-1v-1.339c0-0.55,0.45-1,1-1H9.65c0.55,0,1,0.45,1,1V24.038z"/>
- </g>
- <g>
- <path d="M15.411,24.038c0,0.55-0.45,1-1,1h-1.339c-0.55,0-1-0.45-1-1v-1.339c0-0.55,0.45-1,1-1h1.339c0.55,0,1,0.45,1,1V24.038z"/>
- </g>
- <g>
- <path d="M20.173,24.038c0,0.55-0.45,1-1,1h-1.34c-0.55,0-1-0.45-1-1v-1.34c0-0.55,0.45-1,1-1h1.34c0.55,0,1,0.45,1,1V24.038z"/>
- </g>
- <g>
- <path d="M24.934,24.038c0,0.55-0.45,1-1,1h-1.34c-0.55,0-1-0.45-1-1v-1.339c0-0.55,0.45-1,1-1h1.34c0.55,0,1,0.45,1,1V24.038z"/>
- </g>
- <g>
- <path d="M29.695,24.038c0,0.55-0.45,1-1,1h-1.34c-0.55,0-1-0.45-1-1v-1.34c0-0.55,0.45-1,1-1h1.34c0.55,0,1,0.45,1,1V24.038z"/>
- </g>
- <g>
- <path d="M34.457,24.038c0,0.55-0.45,1-1,1h-1.341c-0.55,0-1-0.45-1-1v-1.339c0-0.55,0.45-1,1-1h1.341c0.55,0,1,0.45,1,1V24.038z"/>
- </g>
- <g>
- <path d="M39.218,24.038c0,0.55-0.45,1-1,1h-1.341c-0.55,0-1-0.45-1-1v-1.339c0-0.55,0.45-1,1-1h1.341c0.55,0,1,0.45,1,1V24.038z"/>
- </g>
- <g>
- <path d="M43.979,24.038c0,0.55-0.45,1-1,1h-1.341c-0.55,0-1-0.45-1-1v-1.339c0-0.55,0.45-1,1-1h1.341c0.55,0,1,0.45,1,1V24.038z"/>
- </g>
- </g>
- <g display="inline">
- <g>
- <path d="M5.889,28.099c0,0.55-0.45,1-1,1.001H3.549c-0.55,0.001-1-0.449-1-0.999V26.76c0-0.55,0.45-1,1-1h1.339 c0.55,0,1,0.45,1,1V28.099z"/>
- </g>
- <g>
- <path d="M10.65,28.099c0,0.55-0.45,1-1,1.001H8.311c-0.55,0.001-1-0.449-1-0.999V26.76c0-0.55,0.45-1,1-1H9.65c0.55,0,1,0.45,1,1 V28.099z"/>
- </g>
- <g>
- <path d="M15.411,28.099c0,0.55-0.45,1-1,1L13.072,29.1c-0.55,0-1-0.45-1-1v-1.34c0-0.55,0.45-1,1-1h1.339c0.55,0,1,0.45,1,1 V28.099z"/>
- </g>
- <g>
- <path d="M20.173,28.099c0,0.55-0.45,1-1,1l-1.34,0.001c-0.55,0-1-0.45-1-1v-1.34c0-0.55,0.45-1,1-1h1.34c0.55,0,1,0.45,1,1 V28.099z"/>
- </g>
- <g>
- <path d="M24.934,28.099c0,0.55-0.45,1-1,1l-1.34,0.001c-0.55,0-1-0.45-1-1v-1.34c0-0.55,0.45-1,1-1h1.34c0.55,0,1,0.45,1,1 V28.099z"/>
- </g>
- <g>
- <path d="M29.695,28.099c0,0.55-0.45,1-1,1l-1.34,0.001c-0.55,0-1-0.45-1-1v-1.34c0-0.55,0.45-1,1-1h1.34c0.55,0,1,0.45,1,1 V28.099z"/>
- </g>
- <g>
- <path d="M34.457,28.099c0,0.55-0.45,1-1,1L32.116,29.1c-0.55,0-1-0.45-1-1v-1.34c0-0.55,0.45-1,1-1h1.341c0.55,0,1,0.45,1,1 V28.099z"/>
- </g>
- <g>
- <path d="M39.218,28.099c0,0.55-0.45,1-1,1h-1.341c-0.55,0-1-0.45-1-1V26.76c0-0.55,0.45-1,1-1h1.341c0.55,0,1,0.45,1,1V28.099z"/>
- </g>
- <g>
- <path d="M43.979,28.099c0,0.55-0.45,1-1,1h-1.341c-0.55,0-1-0.45-1-1V26.76c0-0.55,0.45-1,1-1h1.341c0.55,0,1,0.45,1,1V28.099z"/>
- </g>
- </g>
- <g display="inline">
- <g>
- <path d="M5.889,32.161c0,0.55-0.45,1-1,1H3.549c-0.55,0-1-0.45-1-1v-1.34c0-0.55,0.45-1,1-1h1.339c0.55,0,1,0.45,1,1V32.161z"/>
- </g>
- <g>
- <path d="M10.65,32.161c0,0.55-0.45,1-1,1H8.311c-0.55,0-1-0.45-1-1v-1.34c0-0.55,0.45-1,1-1H9.65c0.55,0,1,0.45,1,1V32.161z"/>
- </g>
- <g>
- <path d="M15.411,32.161c0,0.55-0.45,1-1,1h-1.339c-0.55,0-1-0.45-1-1v-1.34c0-0.55,0.45-1,1-1h1.339c0.55,0,1,0.45,1,1V32.161z"/>
- </g>
- <g>
- <path d="M20.173,32.161c0,0.55-0.45,1-1,1h-1.34c-0.55,0-1-0.45-1-1v-1.34c0-0.55,0.45-1,1-1h1.34c0.55,0,1,0.45,1,1V32.161z"/>
- </g>
- <g>
- <path d="M24.934,32.161c0,0.55-0.45,1-1,1h-1.34c-0.55,0-1-0.45-1-1v-1.34c0-0.55,0.45-1,1-1h1.34c0.55,0,1,0.45,1,1V32.161z"/>
- </g>
- <g>
- <path d="M29.695,32.161c0,0.55-0.45,1-1,1h-1.34c-0.55,0-1-0.45-1-1v-1.34c0-0.55,0.45-1,1-1h1.34c0.55,0,1,0.45,1,1V32.161z"/>
- </g>
- <g>
- <path d="M34.457,32.161c0,0.55-0.45,1-1,1h-1.341c-0.55,0-1-0.45-1-1v-1.34c0-0.55,0.45-1,1-1h1.341c0.55,0,1,0.45,1,1V32.161z"/>
- </g>
- <g>
- <path d="M39.218,32.161c0,0.55-0.45,1-1,1h-1.341c-0.55,0-1-0.45-1-1v-1.34c0-0.55,0.45-1,1-1h1.341c0.55,0,1,0.45,1,1V32.161z"/>
- </g>
- <g>
- <path d="M43.979,32.161c0,0.55-0.45,1-1,1h-1.341c-0.55,0-1-0.45-1-1v-1.34c0-0.55,0.45-1,1-1h1.341c0.55,0,1,0.45,1,1V32.161z"/>
- </g>
- </g>
-</g></svg> \ No newline at end of file
+]>
+<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="55" height="55" viewBox="0, 0, 55, 55">
+ <g id="module-keyboard">
+ <g>
+ <path d="M6.331,40.69 C5.872,40.69 5.5,40.171 5.5,39.53 L5.5,15.47 C5.5,14.829 5.872,14.31 6.331,14.31 L48.669,14.31 C49.128,14.31 49.5,14.829 49.5,15.47 L49.5,39.53 C49.5,40.171 49.128,40.69 48.669,40.69 z" fill="&stroke_color;"/>
+ <path d="M6.331,40.69 C5.872,40.69 5.5,40.171 5.5,39.53 L5.5,15.47 C5.5,14.829 5.872,14.31 6.331,14.31 L48.669,14.31 C49.128,14.31 49.5,14.829 49.5,15.47 L49.5,39.53 C49.5,40.171 49.128,40.69 48.669,40.69 z" fill-opacity="0" stroke="&fill_color;" stroke-width="3.5"/>
+ </g>
+ <path d="M12.834,23.257 C12.281,23.257 11.834,22.81 11.834,22.257 L11.834,20.34 C11.834,19.788 12.281,19.34 12.834,19.34 L16.538,19.34 C17.09,19.34 17.538,19.788 17.538,20.34 L17.538,22.257 C17.538,22.81 17.09,23.257 16.538,23.257 z M12.834,23.257" fill="&fill_color;"/>
+ <path d="M21.376,23.257 C20.824,23.257 20.376,22.81 20.376,22.257 L20.376,20.34 C20.376,19.788 20.824,19.34 21.376,19.34 L25.081,19.34 C25.633,19.34 26.081,19.788 26.081,20.34 L26.081,22.257 C26.081,22.81 25.633,23.257 25.081,23.257 z M21.376,23.257" fill="&fill_color;"/>
+ <path d="M29.919,23.257 C29.367,23.257 28.919,22.81 28.919,22.257 L28.919,20.34 C28.919,19.788 29.367,19.34 29.919,19.34 L33.624,19.34 C34.176,19.34 34.624,19.788 34.624,20.34 L34.624,22.257 C34.624,22.81 34.176,23.257 33.624,23.257 z M29.919,23.257" fill="&fill_color;"/>
+ <path d="M38.462,23.257 C37.91,23.257 37.462,22.81 37.462,22.257 L37.462,20.34 C37.462,19.788 37.91,19.34 38.462,19.34 L42.166,19.34 C42.719,19.34 43.166,19.788 43.166,20.34 L43.166,22.257 C43.166,22.81 42.719,23.257 42.166,23.257 z M38.462,23.257" fill="&fill_color;"/>
+ <path d="M25.658,29.444 C25.105,29.444 24.658,28.996 24.658,28.444 L24.658,26.527 C24.658,25.975 25.105,25.527 25.658,25.527 L29.362,25.527 C29.915,25.527 30.362,25.975 30.362,26.527 L30.362,28.444 C30.362,28.996 29.915,29.444 29.362,29.444 z M25.658,29.444" fill="&fill_color;"/>
+ <path d="M34.672,25.527 L42.165,25.527 C42.718,25.527 43.166,25.991 43.166,26.563 L43.166,28.408 C43.166,28.98 42.718,29.444 42.165,29.444 L34.672,29.444 C34.119,29.444 33.67,28.98 33.67,28.408 L33.67,26.563 C33.67,25.991 34.119,25.527 34.672,25.527 z" fill="&fill_color;"/>
+ <path d="M18.252,31.714 L36.748,31.714 C37.578,31.714 38.251,32.155 38.251,32.699 L38.251,34.645 C38.251,35.189 37.578,35.631 36.748,35.631 L18.252,35.631 C17.422,35.631 16.749,35.189 16.749,34.645 L16.749,32.699 C16.749,32.155 17.422,31.714 18.252,31.714 z" fill="&fill_color;"/>
+ <path d="M12.838,25.527 L20.346,25.527 C20.9,25.527 21.35,25.991 21.35,26.563 L21.35,28.408 C21.35,28.98 20.9,29.444 20.346,29.444 L12.838,29.444 C12.283,29.444 11.834,28.98 11.834,28.408 L11.834,26.563 C11.834,25.991 12.283,25.527 12.838,25.527 z" fill="&fill_color;"/>
+ </g>
+ <defs/>
+</svg>
diff --git a/extensions/deviceicon/Makefile.am b/extensions/deviceicon/Makefile.am
index 7ed1f77..96a1753 100644
--- a/extensions/deviceicon/Makefile.am
+++ b/extensions/deviceicon/Makefile.am
@@ -3,6 +3,7 @@ sugardir = $(pkgdatadir)/extensions/deviceicon
sugar_PYTHON = \
__init__.py \
battery.py \
+ frame.py \
network.py \
speaker.py \
speech.py \
diff --git a/extensions/deviceicon/frame.py b/extensions/deviceicon/frame.py
new file mode 100644
index 0000000..b4e76f5
--- /dev/null
+++ b/extensions/deviceicon/frame.py
@@ -0,0 +1,69 @@
+# Copyright (C) 2012, OLPC
+#
+# 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 logging
+from gettext import gettext as _
+
+from gi.repository import GConf
+
+from sugar3.graphics.tray import TrayIcon
+from sugar3.graphics.toolbutton import ToolButton
+from sugar3.graphics.palette import Palette
+from sugar3.graphics.xocolor import XoColor
+
+from jarabe.frame.frameinvoker import FrameWidgetInvoker
+import jarabe.frame
+
+_ICON_NAME = 'module-keyboard'
+_HAS_MALIIT = False
+
+try:
+ from gi.repository import Maliit
+except ImportError:
+ logging.debug('Frame: can not create OSK icon: Maliit is not installed.')
+ _HAS_MALIIT = False
+else:
+ _HAS_MALIIT = True
+
+
+class DeviceView(TrayIcon):
+
+ FRAME_POSITION_RELATIVE = 103
+
+ def __init__(self):
+ client = GConf.Client.get_default()
+ self._color = XoColor(client.get_string('/desktop/sugar/user/color'))
+
+ TrayIcon.__init__(self, icon_name=_ICON_NAME, xo_color=self._color)
+
+ self._input_method = Maliit.InputMethod()
+ self.connect('button-release-event', self.__button_release_event_cb)
+ self.set_palette_invoker(FrameWidgetInvoker(self))
+
+ def create_palette(self):
+ palette = Palette(_('Show my keyboard'))
+ palette.set_group_id('frame')
+ return palette
+
+ def __button_release_event_cb(self, widget, event):
+ self._input_method.show()
+ frame = jarabe.frame.get_view()
+ frame.hide()
+
+
+def setup(tray):
+ if _HAS_MALIIT:
+ tray.add_device(DeviceView())