diff options
Diffstat (limited to 'scripts/lib/mic/3rdparty/pykickstart/commands/monitor.py')
| -rw-r--r-- | scripts/lib/mic/3rdparty/pykickstart/commands/monitor.py | 106 |
1 files changed, 106 insertions, 0 deletions
diff --git a/scripts/lib/mic/3rdparty/pykickstart/commands/monitor.py b/scripts/lib/mic/3rdparty/pykickstart/commands/monitor.py new file mode 100644 index 0000000000..8c8c2c4fc9 --- /dev/null +++ b/scripts/lib/mic/3rdparty/pykickstart/commands/monitor.py | |||
| @@ -0,0 +1,106 @@ | |||
| 1 | # | ||
| 2 | # Chris Lumens <clumens@redhat.com> | ||
| 3 | # | ||
| 4 | # Copyright 2005, 2006, 2007, 2008 Red Hat, Inc. | ||
| 5 | # | ||
| 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. | ||
| 12 | # | ||
| 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. | ||
| 19 | # | ||
| 20 | from pykickstart.base import * | ||
| 21 | from pykickstart.errors import * | ||
| 22 | from pykickstart.options import * | ||
| 23 | |||
| 24 | import gettext | ||
| 25 | _ = lambda x: gettext.ldgettext("pykickstart", x) | ||
| 26 | |||
| 27 | class FC3_Monitor(KickstartCommand): | ||
| 28 | removedKeywords = KickstartCommand.removedKeywords | ||
| 29 | removedAttrs = KickstartCommand.removedAttrs | ||
| 30 | |||
| 31 | def __init__(self, writePriority=0, *args, **kwargs): | ||
| 32 | KickstartCommand.__init__(self, writePriority, *args, **kwargs) | ||
| 33 | self.op = self._getParser() | ||
| 34 | |||
| 35 | self.hsync = kwargs.get("hsync", "") | ||
| 36 | self.monitor = kwargs.get("monitor", "") | ||
| 37 | self.vsync = kwargs.get("vsync", "") | ||
| 38 | |||
| 39 | def __str__(self): | ||
| 40 | retval = KickstartCommand.__str__(self) | ||
| 41 | retval += "monitor" | ||
| 42 | |||
| 43 | if self.hsync != "": | ||
| 44 | retval += " --hsync=%s" % self.hsync | ||
| 45 | if self.monitor != "": | ||
| 46 | retval += " --monitor=\"%s\"" % self.monitor | ||
| 47 | if self.vsync != "": | ||
| 48 | retval += " --vsync=%s" % self.vsync | ||
| 49 | |||
| 50 | if retval != "monitor": | ||
| 51 | return retval + "\n" | ||
| 52 | else: | ||
| 53 | return "" | ||
| 54 | |||
| 55 | def _getParser(self): | ||
| 56 | op = KSOptionParser() | ||
| 57 | op.add_option("--hsync") | ||
| 58 | op.add_option("--monitor") | ||
| 59 | op.add_option("--vsync") | ||
| 60 | return op | ||
| 61 | |||
| 62 | def parse(self, args): | ||
| 63 | (opts, extra) = self.op.parse_args(args=args, lineno=self.lineno) | ||
| 64 | |||
| 65 | if extra: | ||
| 66 | mapping = {"cmd": "monitor", "options": extra} | ||
| 67 | raise KickstartValueError, formatErrorMsg(self.lineno, msg=_("Unexpected arguments to %(cmd)s command: %(options)s") % mapping) | ||
| 68 | |||
| 69 | self._setToSelf(self.op, opts) | ||
| 70 | return self | ||
| 71 | |||
| 72 | class FC6_Monitor(FC3_Monitor): | ||
| 73 | removedKeywords = FC3_Monitor.removedKeywords | ||
| 74 | removedAttrs = FC3_Monitor.removedAttrs | ||
| 75 | |||
| 76 | def __init__(self, writePriority=0, *args, **kwargs): | ||
| 77 | FC3_Monitor.__init__(self, writePriority, *args, **kwargs) | ||
| 78 | self.probe = kwargs.get("probe", True) | ||
| 79 | |||
| 80 | def __str__(self): | ||
| 81 | retval = KickstartCommand.__str__(self) | ||
| 82 | retval += "monitor" | ||
| 83 | |||
| 84 | if self.hsync != "": | ||
| 85 | retval += " --hsync=%s" % self.hsync | ||
| 86 | if self.monitor != "": | ||
| 87 | retval += " --monitor=\"%s\"" % self.monitor | ||
| 88 | if not self.probe: | ||
| 89 | retval += " --noprobe" | ||
| 90 | if self.vsync != "": | ||
| 91 | retval += " --vsync=%s" % self.vsync | ||
| 92 | |||
| 93 | if retval != "monitor": | ||
| 94 | return retval + "\n" | ||
| 95 | else: | ||
| 96 | return "" | ||
| 97 | |||
| 98 | def _getParser(self): | ||
| 99 | op = FC3_Monitor._getParser(self) | ||
| 100 | op.add_option("--noprobe", dest="probe", action="store_false", | ||
| 101 | default=True) | ||
| 102 | return op | ||
| 103 | |||
| 104 | class F10_Monitor(DeprecatedCommand): | ||
| 105 | def __init__(self): | ||
| 106 | DeprecatedCommand.__init__(self) | ||
