Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSimon Schampijer <simon@schampijer.de>2008-05-12 13:00:36 (GMT)
committer Simon Schampijer <simon@schampijer.de>2008-05-12 13:00:36 (GMT)
commit549211e2269151493c8f7446b09615e161adc018 (patch)
treecb825726383126bbb0b43873cd3dc58f03c72e22 /src
parentcde9f12829cb698af2627c4870bb16fe785b41ea (diff)
Add frame delay option to the cmd interface of the cp
Diffstat (limited to 'src')
-rw-r--r--src/controlpanel/model/Makefile.am3
-rw-r--r--src/controlpanel/model/frame.py42
-rw-r--r--src/view/frame/eventarea.py13
3 files changed, 52 insertions, 6 deletions
diff --git a/src/controlpanel/model/Makefile.am b/src/controlpanel/model/Makefile.am
index 4bc3264..8b490a3 100644
--- a/src/controlpanel/model/Makefile.am
+++ b/src/controlpanel/model/Makefile.am
@@ -5,4 +5,5 @@ sugar_PYTHON = \
aboutme.py \
language.py \
timezone.py \
- aboutxo.py
+ aboutxo.py \
+ frame.py \ No newline at end of file
diff --git a/src/controlpanel/model/frame.py b/src/controlpanel/model/frame.py
new file mode 100644
index 0000000..8519dc9
--- /dev/null
+++ b/src/controlpanel/model/frame.py
@@ -0,0 +1,42 @@
+# Copyright (C) 2008 One Laptop Per Child
+#
+# 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
+#
+
+from gettext import gettext as _
+
+from sugar import profile
+
+def get_delay():
+ pro = profile.get_profile()
+ return pro.frame_delay
+
+def print_delay():
+ print get_delay()
+
+def set_delay(value):
+ """Set a delay for the revealing of the frame. This can be in the range:
+ instantaneous: 0 (0 milliseconds)
+ delay: 100 (100 milliseconds)
+ never (disable the hot corners): -1
+ """
+ try:
+ int(value)
+ except ValueError:
+ raise ValueError(_("Value must be an integer."))
+ pro = profile.get_profile()
+ pro.frame_delay = int(value)
+ pro.save()
+ return 'RESTART'
diff --git a/src/view/frame/eventarea.py b/src/view/frame/eventarea.py
index 7716346..b7d0212 100644
--- a/src/view/frame/eventarea.py
+++ b/src/view/frame/eventarea.py
@@ -18,6 +18,8 @@ import gtk
import gobject
import wnck
+from sugar import profile
+
class EventArea(gobject.GObject):
__gsignals__ = {
'enter': (gobject.SIGNAL_RUN_FIRST,
@@ -32,7 +34,8 @@ class EventArea(gobject.GObject):
self._windows = []
self._hover = False
self._sids = {}
- self._timeout = 1000
+ pro = profile.get_profile()
+ self._delay = pro.frame_delay
right = gtk.gdk.screen_width() - 1
bottom = gtk.gdk.screen_height() -1
@@ -55,7 +58,7 @@ class EventArea(gobject.GObject):
def _create_invisible(self, x, y, width, height):
invisible = gtk.Invisible()
- if self._timeout >= 0:
+ if self._delay >= 0:
invisible.connect('enter-notify-event', self._enter_notify_cb)
invisible.connect('leave-notify-event', self._leave_notify_cb)
@@ -84,11 +87,11 @@ class EventArea(gobject.GObject):
def _enter_notify_cb(self, widget, event):
if widget in self._sids:
gobject.source_remove(self._sids[widget])
- self._sids[widget] = gobject.timeout_add(self._timeout,
- self.__timeout_cb,
+ self._sids[widget] = gobject.timeout_add(self._delay,
+ self.__delay_cb,
widget)
- def __timeout_cb(self, widget):
+ def __delay_cb(self, widget):
del self._sids[widget]
self._notify_enter()
return False