Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bin/Makefile.am3
-rw-r--r--bin/sugar-ui-check26
-rw-r--r--bin/sugar-ui-check.in26
-rw-r--r--configure.ac1
-rw-r--r--src/Makefile.am3
-rw-r--r--src/uicheck.py83
6 files changed, 140 insertions, 2 deletions
diff --git a/bin/Makefile.am b/bin/Makefile.am
index ca6ddef..dbaaa2d 100644
--- a/bin/Makefile.am
+++ b/bin/Makefile.am
@@ -7,7 +7,8 @@ bin_SCRIPTS = \
sugar-install-bundle \
sugar-launch \
sugar-shell \
- sugar-shell-service
+ sugar-shell-service \
+ sugar-ui-check
EXTRA_DIST = $(bin_SCRIPTS) sugar.in
diff --git a/bin/sugar-ui-check b/bin/sugar-ui-check
new file mode 100644
index 0000000..8399872
--- /dev/null
+++ b/bin/sugar-ui-check
@@ -0,0 +1,26 @@
+#!/usr/bin/env python
+# Copyright (C) 2008, Red Hat, Inc.
+#
+# 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 sys
+
+sys.path.insert(0, '/home/marco/sugar-jhbuild/install/share/sugar/shell')
+
+import uicheck
+
+uicheck.main()
+
+
diff --git a/bin/sugar-ui-check.in b/bin/sugar-ui-check.in
new file mode 100644
index 0000000..03166ab
--- /dev/null
+++ b/bin/sugar-ui-check.in
@@ -0,0 +1,26 @@
+#!/usr/bin/env python
+# Copyright (C) 2008, Red Hat, Inc.
+#
+# 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 sys
+
+sys.path.insert(0, '@prefix@/share/sugar/shell')
+
+import uicheck
+
+uicheck.main()
+
+
diff --git a/configure.ac b/configure.ac
index 9e4f21b..44e3bcc 100644
--- a/configure.ac
+++ b/configure.ac
@@ -30,6 +30,7 @@ AC_CONFIG_FILES([
bin/sugar
bin/sugar-control-panel
bin/sugar-emulator
+bin/sugar-ui-check
bin/sugar-shell
bin/sugar-shell-service
service/config.py
diff --git a/src/Makefile.am b/src/Makefile.am
index daf31ae..48fb84f 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -7,6 +7,7 @@ sugar_PYTHON = \
logsmanager.py \
main.py \
session.py \
- shellservice.py
+ shellservice.py \
+ uicheck.py
EXTRA_DIST = $(bin_SCRIPTS) $(conf_DATA)
diff --git a/src/uicheck.py b/src/uicheck.py
new file mode 100644
index 0000000..41beed0
--- /dev/null
+++ b/src/uicheck.py
@@ -0,0 +1,83 @@
+# Copyright (C) 2008, Red Hat, Inc.
+#
+# 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 sys
+import time
+
+import gobject
+import gtk
+import wnck
+
+checks_queue = []
+checks_failed = []
+checks_succeeded = []
+
+class Check(object):
+ def __init__(self):
+ self.succeeded = False
+ self.start_time = None
+ self.max_time = None
+ self.timeout = None
+
+ def start(self):
+ self.start_time = time.time()
+
+ def get_failed(self):
+ if self.max_time and self.start_time:
+ if time.time() - self.start_time > self.max_time:
+ return True
+ return False
+
+ failed = property(get_failed)
+
+class ShellCheck(Check):
+ def start(self):
+ Check.start(self)
+
+ self.max_time = 3
+
+ screen = wnck.screen_get_default()
+ screen.connect('window-opened', self._window_opened_cb)
+
+ def _window_opened_cb(self, screen, window):
+ if window.get_window_type() == wnck.WINDOW_DESKTOP:
+ self.succeeded = True
+
+def _timeout_cb():
+ if checks_queue[0].failed:
+ checks_failed.append(checks_queue.pop(0))
+ elif checks_queue[0].succeeded:
+ checks_succeeded.append(checks_queue.pop(0))
+ else:
+ return True
+
+ if len(checks_queue) > 0:
+ checks_queue[0].start()
+ else:
+ gtk.main_quit()
+
+ return True
+
+def main():
+ checks_queue.append(ShellCheck())
+
+ checks_queue[0].start()
+ gobject.timeout_add(500, _timeout_cb)
+
+ gtk.main()
+
+ if len(checks_failed) > 0:
+ sys.exit(1)