2 # Chris Lumens <clumens@redhat.com>
4 # Copyright 2005, 2006, 2007, 2008 Red Hat, Inc.
6 # This copyrighted material is made available to anyone wishing to use, modify,
7 # copy, or redistribute it subject to the terms and conditions of the GNU
8 # General Public License v.2. This program is distributed in the hope that it
9 # will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the
10 # implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11 # See the GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License along with
14 # this program; if not, write to the Free Software Foundation, Inc., 51
15 # Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Any Red Hat
16 # trademarks that are incorporated in the source code or documentation are not
17 # subject to the GNU General Public License and may only be used or replicated
18 # with the express permission of Red Hat, Inc.
20 from pykickstart
.base
import DeprecatedCommand
, KickstartCommand
21 from pykickstart
.errors
import KickstartValueError
, formatErrorMsg
22 from pykickstart
.options
import KSOptionParser
25 _
= lambda x
: gettext
.ldgettext("pykickstart", x
)
27 class FC3_Monitor(KickstartCommand
):
28 removedKeywords
= KickstartCommand
.removedKeywords
29 removedAttrs
= KickstartCommand
.removedAttrs
31 def __init__(self
, writePriority
=0, *args
, **kwargs
):
32 KickstartCommand
.__init
__(self
, writePriority
, *args
, **kwargs
)
33 self
.op
= self
._getParser
()
35 self
.hsync
= kwargs
.get("hsync", "")
36 self
.monitor
= kwargs
.get("monitor", "")
37 self
.vsync
= kwargs
.get("vsync", "")
40 retval
= KickstartCommand
.__str
__(self
)
44 retval
+= " --hsync=%s" % self
.hsync
45 if self
.monitor
!= "":
46 retval
+= " --monitor=\"%s\"" % self
.monitor
48 retval
+= " --vsync=%s" % self
.vsync
50 if retval
!= "monitor":
57 op
.add_option("--hsync")
58 op
.add_option("--monitor")
59 op
.add_option("--vsync")
62 def parse(self
, args
):
63 (opts
, extra
) = self
.op
.parse_args(args
=args
, lineno
=self
.lineno
)
66 mapping
= {"cmd": "monitor", "options": extra
}
67 raise KickstartValueError(formatErrorMsg(self
.lineno
, msg
=_("Unexpected arguments to %(cmd)s command: %(options)s") % mapping
))
69 self
._setToSelf
(self
.op
, opts
)
72 class FC6_Monitor(FC3_Monitor
):
73 removedKeywords
= FC3_Monitor
.removedKeywords
74 removedAttrs
= FC3_Monitor
.removedAttrs
76 def __init__(self
, writePriority
=0, *args
, **kwargs
):
77 FC3_Monitor
.__init
__(self
, writePriority
, *args
, **kwargs
)
78 self
.probe
= kwargs
.get("probe", True)
81 retval
= KickstartCommand
.__str
__(self
)
85 retval
+= " --hsync=%s" % self
.hsync
86 if self
.monitor
!= "":
87 retval
+= " --monitor=\"%s\"" % self
.monitor
89 retval
+= " --noprobe"
91 retval
+= " --vsync=%s" % self
.vsync
93 if retval
!= "monitor":
99 op
= FC3_Monitor
._getParser
(self
)
100 op
.add_option("--noprobe", dest
="probe", action
="store_false",
104 class F10_Monitor(DeprecatedCommand
):
106 DeprecatedCommand
.__init
__(self
)