/usr/share/sugar/extensions/deviceicon/frame.py is in sugar-session 0.112-4.
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 | # 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 3 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, see <http://www.gnu.org/licenses/>.
import logging
from gettext import gettext as _
from sugar3 import profile
from sugar3.graphics.tray import TrayIcon
from sugar3.graphics.palette import Palette
from jarabe.frame.frameinvoker import FrameWidgetInvoker
import jarabe.frame
_ICON_NAME = 'module-keyboard'
_HAS_MALIIT = False
import gi
try:
gi.require_version('Maliit', '1.0')
from gi.repository import Maliit
except (ValueError, ImportError):
logging.debug('Frame: can not create OSK icon: Maliit is not installed.')
else:
_HAS_MALIIT = True
class DeviceView(TrayIcon):
FRAME_POSITION_RELATIVE = 103
def __init__(self):
self._color = profile.get_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())
|