Ticket #3267: reset.py

File reset.py, 1.1 KB (added by ignacio, 10 years ago)

This is a simple solution. Needs work. (Folder to put: /usr/share/sugar/extensions/globalkey)

Line 
1#!/usr/bin/env python
2# -*- coding: utf-8 -*-
3# Copyright (C) 2013 SomosAzucar
4# Ignacio Rodriguez <ignacio@somosazucar.org>
5#
6# This program is free software; you can redistribute it and/or modify
7# it under the terms of the GNU General Public License as published by
8# the Free Software Foundation; either version 2 of the License, or
9# (at your option) any later version.
10#
11# This program is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14# GNU General Public License for more details.
15#
16# You should have received a copy of the GNU General Public License
17# along with this program; if not, write to the Free Software
18# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19
20import subprocess
21import logging
22logger = logging.getLogger('reboot')
23logger.setLevel(logging.DEBUG)
24BOUND_KEYS = ['<control><alt>BackSpace']
25
26def restart_python():
27        logger.debug("Kill python - Sugar")
28        subprocess.call(['killall','python'])
29
30def handle_key_press(key):
31    logger.debug("Restarting python.....")
32    restart_python()
33
34
35