Ejemplo n.º 1
0
def showOpts():
    """
    show: print values of command line options
    """
    print "debug", CmdLine.getFlag("debug")
    print "x", CmdLine.getInt("int-x")
    print "y", CmdLine.getInt("float-y")
Ejemplo n.º 2
0
def main():
    userStyle = '-style' in ' '.join(sys.argv)
    app = QtGui.QApplication(sys.argv)
    setModulePath()
    setupTranslator(app)  # must be before importing any treeline modules
    setLocalEncoding()

    import treedoc
    from cmdline import CmdLine
    import treecontrol
    import treemainwin

    if not treedoc.testXmlParser():
        QtGui.QMessageBox.critical(None, _('Error'),
                                   _('Error loading XML Parser\n'\
                                     'See TreeLine ReadMe file'), 1, 0)
        sys.exit(3)
    try:
        opts, args = getopt.gnu_getopt(sys.argv, CmdLine.options,
                                       CmdLine.longOptions)
    except getopt.GetoptError:
        import cmdline
        cmdline.printUsage()
        sys.exit(2)
    args = args[1:]

    treeControl = treecontrol.TreeControl(userStyle)

    if opts:
        CmdLine(opts, args)
    else:
        treeControl.firstWindow(args)
        signal.signal(signal.SIGINT, signal.SIG_IGN)
        app.exec_()
Ejemplo n.º 3
0
    def get_qemu_args(self):
        cmd = CmdLine("qemu-system-" + self.vm.get_property('arch'))
        cmd.opt_arg('-boot', self.get_bootdev())
        cmd.opt_arg('-cdrom', self.vm.get_disk_file('cdrom0'))
        cmd.opt_arg('-hda', self.vm.get_disk_file('disk0'))
        cmd.opt_arg('-m', self.vm.get_property('memory'))
        cmd.opt_arg('-kernel', self.vm.get_property('kernel'))
        cmd.opt_arg('-initrd', self.vm.get_property('initrd'))
        cmd.opt_arg('-append', self.vm.get_property('append'))
        cmd.opt_arg('-dtb', self.vm.get_property('dtb'))
        cmd.opt_arg('-k', self.vm.get_property('keymap'))
        cmd.opt_sw('-enable-kvm', self.vm.get_property_bool('kvm'))
        cmd.opt_sw(['-serial', 'mon:stdio', '-nographic'],
                   self.vm.get_property_bool('sercon'))

        return cmd.args
Ejemplo n.º 4
0
def blab():
    """
    blab: Blabbity blab blab blab
    """
    for i in range(5):
        print CmdLine.getString("blab")
Ejemplo n.º 5
0
#!/usr/bin/python
# Example of how to use the CmdLine library.

import os
import sys
from cmdline import CmdLine

CmdLine.intArg("x#int-x#set integer X")
CmdLine.floatArg("y#float-y#set float Y")
CmdLine.stringArg("b#blab#set a string that blabs", "blab")
CmdLine.flag("d#debug#enable debugging")
CmdLine.flag("L#very-very-very-long-command-line-option#does nothing")

@CmdLine.command
def blab():
    """
    blab: Blabbity blab blab blab
    """
    for i in range(5):
        print CmdLine.getString("blab")

@CmdLine.command
def snore():
    """
    snore: print "Zzzzzzzzzzzzz"
    """
    print "Zzzzzzzzzzzzz"

@CmdLine.command
def showOpts():
    """