/usr/share/sugar/extensions/deviceicon/frame.py is in sugar-session-0.98 0.98.8-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | # 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):
return
# Disable the option for now, as manual invocation
# of the OSK has many unresolved corner cases, see
# http://dev.laptop.org/ticket/12281
if _HAS_MALIIT:
tray.add_device(DeviceView())
|