~jocave/checkbox/hybrid-amd-gpu-mods

« back to all changes in this revision

Viewing changes to plugins/intro_prompt.py

  • Committer: Zygmunt Krynicki
  • Date: 2013-05-17 13:54:25 UTC
  • mto: This revision was merged to the branch mainline in revision 2130.
  • Revision ID: zygmunt.krynicki@canonical.com-20130517135425-cxcenxx5t0qrtbxd
checkbox-ng: add CheckBoxNG sub-project

CheckBoxNG (or lowercase as checkbox-ng, pypi:checkbox-ng) is a clean
implementation of CheckBox on top of PlainBox. It provides a new
executable, 'checkbox' that has some of the same commands that were
previously implemented in the plainbox package.

In particular CheckBoxNG comes with the 'checkbox sru' command
(the same one as in plainbox). Later on this sub-command will be removed
from plainbox.

CheckBoxNG depends on plainbox >= 0.3

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#
 
2
# This file is part of Checkbox.
 
3
#
 
4
# Copyright 2008 Canonical Ltd.
 
5
#
 
6
# Checkbox 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 3 of the License, or
 
9
# (at your option) any later version.
 
10
#
 
11
# Checkbox 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 Checkbox.  If not, see <http://www.gnu.org/licenses/>.
 
18
#
 
19
from gettext import gettext as _
 
20
 
 
21
from checkbox.plugin import Plugin
 
22
from checkbox.properties import String
 
23
from checkbox.user_interface import PREV
 
24
 
 
25
 
 
26
class IntroPrompt(Plugin):
 
27
 
 
28
    welcome_text = String(default=_("""\
 
29
Welcome to System Testing!
 
30
 
 
31
Checkbox provides tests to confirm that your system is working \
 
32
properly. Once you are finished running the tests, you can view \
 
33
a summary report for your system.""") + _("""
 
34
 
 
35
Warning: Some tests could cause your system to freeze \
 
36
or become unresponsive. Please save all your work \
 
37
and close all other running applications before \
 
38
beginning the testing process."""))
 
39
 
 
40
    def register(self, manager):
 
41
        super(IntroPrompt, self).register(manager)
 
42
 
 
43
        self._recover = False
 
44
 
 
45
        self._manager.reactor.call_on("begin-recover", self.begin_recover)
 
46
 
 
47
        # Introduction should be prompted last
 
48
        self._manager.reactor.call_on("prompt-begin", self.prompt_begin, 100)
 
49
 
 
50
    def begin_recover(self, recover):
 
51
        self._recover = recover
 
52
 
 
53
    def prompt_begin(self, interface):
 
54
        if interface.direction == PREV or not self._recover:
 
55
            self._recover = False
 
56
            interface.show_text(self.welcome_text, previous="")
 
57
 
 
58
 
 
59
factory = IntroPrompt