Example #1
0
def processArguments():
	'''init processArguments '''
	parser = OptionParser(usage="Usage: %prog [options] [arg]", version="%prog v1.0")
	parser.add_option("-f", "--full", action="store_true", dest="fullscreen", help="Taking the fullscreen shot")
	parser.add_option("-w", "--window", action="store_true", dest="window", help="Taking the currently focused window")
	parser.add_option("-d", "--delay", dest="delay", type="int", help="wait NUM seconds before taking a shot", metavar="NUM")
	parser.add_option("-o", "--outfile", dest="outfile", help="output to file", metavar="OUTPUT")

	(options, args) = parser.parse_args()
	#print parser.parse_args()
	if options.fullscreen and options.window:
		parser.error("options -f and -w are mutually exclusive")
	elif options.fullscreen:
		if options.delay:
			countdownWindow(options.delay)
			openFileDialog()
		else:
			openFileDialog()
	elif options.window:
		if options.delay:
			countdownWindow(options.delay)
			openFileDialog(False)
		else:
			openFileDialog(False)
	elif options.fullscreen and options.window or options.delay:
		countdownWindow(options.delay)
		MainScrot(options.outfile)
	else:
		MainScrot(options.outfile)
Example #2
0
def processArguments():
    '''init processArguments '''
    parser = OptionParser(usage="Usage: %prog [options] [arg]", version="%prog v1.0")
    parser.add_option("-f", "--full", action="store_true", dest="fullscreen", help="Taking the fullscreen shot")
    parser.add_option("-w", "--window", action="store_true", dest="window", help="Taking the currently focused window")
    parser.add_option("-d", "--delay", dest="delay", type="int", help="wait NUM seconds before taking a shot", metavar="NUM")

    (options, args) = parser.parse_args()
    #print parser.parse_args()
    if options.fullscreen and options.window:
        parser.error("options -f and -w are mutually exclusive")
    elif options.fullscreen:
        if options.delay:
            countdownWindow(options.delay)
            openFileDialog()
        else:
            openFileDialog()
    elif options.window:
        if options.delay:
            countdownWindow(options.delay)
            openFileDialog(False)
        else:
            openFileDialog(False)
    elif options.fullscreen and options.window or options.delay:
        countdownWindow(options.delay)
        MainScrot()
    else:
         MainScrot()
Example #3
0
def processArguments():
    '''init processArguments '''
    parser = OptionParser(usage="Usage: %prog [options] [arg]",
                          version="%prog v1.0")
    parser.add_option("-f",
                      "--full",
                      action="store_true",
                      dest="fullscreen",
                      help="Taking the fullscreen shot")
    parser.add_option("-w",
                      "--window",
                      action="store_true",
                      dest="window",
                      help="Taking the currently focused window")
    parser.add_option("-d",
                      "--delay",
                      dest="delay",
                      type="int",
                      help="wait NUM seconds before taking a shot",
                      metavar="NUM")
    parser.add_option(
        "-o",
        "--outfile",
        dest="outfile",
        type="str",
        help=
        "Save the snapshot to a file, file type png,jepg and bmp are supported"
    )
    (options, args) = parser.parse_args()
    #print parser.parse_args()
    (fileName, saveFileType) = (None, "png")
    if options.outfile:
        (fileName, saveFileType) = getFileNameFileType(options.outfile)
        if fileName is None:
            sys.exit(-1)
    if options.fullscreen and options.window:
        parser.error("options -f and -w are mutually exclusive")
    elif options.fullscreen:
        if options.delay:
            countdownWindow(options.delay)
            saveToFile(True, fileName)


#            openFileDialog()
        else:
            saveToFile(True, fileName)
    elif options.window:
        if options.delay:
            countdownWindow(options.delay)
            saveToFile(False, fileName)
        else:
            saveToFile(False, fileName)
    elif options.fullscreen and options.window or options.delay:
        countdownWindow(options.delay)
        MainScrot(fileName, saveFileType)
    else:
        MainScrot(fileName, saveFileType)
Example #4
0
def processArguments():
    """init processArguments """
    parser = OptionParser(usage="Usage: %prog [options] [arg]", version="%prog v1.0")
    parser.add_option("-f", "--full", action="store_true", dest="fullscreen", help="Taking the fullscreen shot")
    parser.add_option("-w", "--window", action="store_true", dest="window", help="Taking the currently focused window")
    parser.add_option(
        "-d", "--delay", dest="delay", type="int", help="wait NUM seconds before taking a shot", metavar="NUM"
    )
    parser.add_option(
        "-o",
        "--outfile",
        dest="outfile",
        type="str",
        help="Save the snapshot to a file, file type png,jepg and bmp are supported",
    )
    (options, args) = parser.parse_args()
    # print parser.parse_args()
    (fileName, saveFileType) = (None, "png")
    if options.outfile:
        (fileName, saveFileType) = getFileNameFileType(options.outfile)
        if fileName is None:
            sys.exit(-1)
    if options.fullscreen and options.window:
        parser.error("options -f and -w are mutually exclusive")
    elif options.fullscreen:
        if options.delay:
            countdownWindow(options.delay)
            saveToFile(True, fileName)
        #            openFileDialog()
        else:
            saveToFile(True, fileName)
    elif options.window:
        if options.delay:
            countdownWindow(options.delay)
            saveToFile(False, fileName)
        else:
            saveToFile(False, fileName)
    elif options.fullscreen and options.window or options.delay:
        countdownWindow(options.delay)
        MainScrot(fileName, saveFileType)
    else:
        MainScrot(fileName, saveFileType)
def processArguments():
    '''init processArguments '''
    parser = OptionParser(usage="Usage: deepin-screenshot [options] [arg]", version="deepin-screenshot v2.1")
    parser.add_option("-f", "--full", action="store_true", dest="fullscreen", help="Taking the fullscreen shot")
    parser.add_option("-w", "--window", action="store_true", dest="window", help="Taking the currently focused window")
    parser.add_option("-d", "--delay", dest="delay", type="int", help="wait NUM seconds before taking a shot", metavar="NUM")
    parser.add_option("-s", "--save", dest="save_file", help="save screenshot to FILE", metavar="FILE")
    parser.add_option("-a", "--area", help="Grab an area of the screen instead of the entire screen", action="store_true")
    parser.add_option("-e", "--border-effect", action="store_true", dest="border_effect", help="Effect to add to the border")
    parser.add_option("-i", "--interactive", action="store_true" ,help="Interactively set options")
    parser.add_option("-b", "--include-border", action="store_true" ,help="Include the window border with the screenshot")
    parser.add_option("-B", "--remove-border", action="store_true" ,help="Remove the window border from the screenshot")
    parser.add_option("-c", "--clipboard", help="Send the grab directly to the clipboard",  action="store_true")
    parser.add_option("--display",  action="store_true")    
    
    
    
    (options, args) = parser.parse_args()

    if options.fullscreen and options.window:
        parser.error("options -f and -w are mutually exclusive")
    elif options.save_file:
        parserFile = parserPath(str(options.save_file))
        if options.fullscreen:
            if options.delay:
                countdownWindow(options.delay)
            pixbuf = getScreenshotPixbuf(True)
            pixbuf.save(parserFile[0], parserFile[1])
        elif options.window:
            if options.delay:
                countdownWindow(options.delay)
            pixbuf = getScreenshotPixbuf(False)
            pixbuf.save(parserFile[0], parserFile[1])
        else:    
            if options.delay:
                countdownWindow(options.delay)
            DeepinScreenshot(options.save_file)
    elif options.fullscreen:
        if options.delay:
            countdownWindow(options.delay)
            openFileDialog()
        else:
            openFileDialog()
    elif options.window:
        if options.delay:
            countdownWindow(options.delay)
            openFileDialog(False)
        else:
            openFileDialog(False)
    elif options.fullscreen and options.window or options.delay:
        countdownWindow(options.delay)
        DeepinScreenshot()
    else:
         DeepinScreenshot()
def processArguments():
    '''init processArguments '''
    parser = OptionParser(usage="Usage: deepin-screenshot [options] [arg]",
                          version="deepin-screenshot v2.1")
    parser.add_option("-f",
                      "--full",
                      action="store_true",
                      dest="fullscreen",
                      help="Taking the fullscreen shot")
    parser.add_option("-w",
                      "--window",
                      action="store_true",
                      dest="window",
                      help="Taking the currently focused window")
    parser.add_option("-d",
                      "--delay",
                      dest="delay",
                      type="int",
                      help="wait NUM seconds before taking a shot",
                      metavar="NUM")
    parser.add_option("-s",
                      "--save",
                      dest="save_file",
                      help="save screenshot to FILE",
                      metavar="FILE")
    parser.add_option(
        "-a",
        "--area",
        help="Grab an area of the screen instead of the entire screen",
        action="store_true")
    parser.add_option("-e",
                      "--border-effect",
                      action="store_true",
                      dest="border_effect",
                      help="Effect to add to the border")
    parser.add_option("-i",
                      "--interactive",
                      action="store_true",
                      help="Interactively set options")
    parser.add_option("-b",
                      "--include-border",
                      action="store_true",
                      help="Include the window border with the screenshot")
    parser.add_option("-B",
                      "--remove-border",
                      action="store_true",
                      help="Remove the window border from the screenshot")
    parser.add_option("-c",
                      "--clipboard",
                      help="Send the grab directly to the clipboard",
                      action="store_true")
    parser.add_option("--display", action="store_true")

    (options, args) = parser.parse_args()

    if options.fullscreen and options.window:
        parser.error("options -f and -w are mutually exclusive")
    elif options.save_file:
        parserFile = parserPath(str(options.save_file))
        if options.fullscreen:
            if options.delay:
                countdownWindow(options.delay)
            pixbuf = getScreenshotPixbuf(True)
            pixbuf.save(parserFile[0], parserFile[1])
        elif options.window:
            if options.delay:
                countdownWindow(options.delay)
            pixbuf = getScreenshotPixbuf(False)
            pixbuf.save(parserFile[0], parserFile[1])
        else:
            if options.delay:
                countdownWindow(options.delay)
            DeepinScreenshot(options.save_file)
    elif options.fullscreen:
        if options.delay:
            countdownWindow(options.delay)
            openFileDialog()
        else:
            openFileDialog()
    elif options.window:
        if options.delay:
            countdownWindow(options.delay)
            openFileDialog(False)
        else:
            openFileDialog(False)
    elif options.fullscreen and options.window or options.delay:
        countdownWindow(options.delay)
        DeepinScreenshot()
    else:
        DeepinScreenshot()