Пример #1
0
def capture():
    scripts_dir = os.path.abspath(os.path.dirname(__file__))
    screenshot_dir = os.path.abspath(
        os.path.join(os.path.dirname(__file__), "..", "..", "user",
                     "screenshots"))
    images = get_all_files(".jpg", screenshot_dir)
    general.clear_selection()
    if general.is_helpers_shown():
        general.toggle_helpers()
    # if general.get_viewport_size() == (3840, 2160):
    #     general.set_viewport_size(3840, 2160)
    if len(sys.argv) == 3:
        if sys.argv[2] == "--pink":
            general.set_position("icon_pink_screen", 992.4509, 1047.51,
                                 47.6817)
            general.set_position("icon_green_screen", 0, 0, 0)
    else:
        general.set_position("icon_green_screen", 992.4509, 1047.51, 47.6817)
        general.set_position("icon_pink_screen", 0, 0, 0)
    general.run_console("r_getScreenshot 1")
    obj = get_icon_object_in_scene()
    keys = obj.keys()
    embellishment_string = ""
    if u"embellishment_48" in keys:
        embellishment_string += "--embellishment_48 " + obj[
            "embellishment_48"] + " "
    if u"embellishment_200" in keys:
        embellishment_string += "--embellishment_200 " + obj[
            "embellishment_200"] + " "
    if u"embellishment_2048" in keys:
        embellishment_string += "--embellishment_2048 " + obj[
            "embellishment_2048"] + " "
    if u"embellishment_under" in keys:
        embellishment_string += "--embellishment_under"
    print(embellishment_string)
    if obj:
        # the object exists in our db
        # save it and overwrite the current version then execute_external_icon_exe the script
        execute_external_icon_exe(
            scripts_dir,
            save(obj["name"], overwrite=True),
            images,
            embellishments=embellishment_string,
        )
    else:
        # the objects does not exist in our db
        # Ask the user what it is and save it and then execute_external_icon_exe the script
        execute_external_icon_exe(scripts_dir,
                                  save(),
                                  images,
                                  embellishments=embellishment_string)
def cycleConsolV(mode, cycleList, ctrlFile):
	stateList = open(ctrlFile, 'r') 
	setState 	= [x for x in enumerate(stateList)] 
	blankCheck 	= [x for x in setState]
	getList = [x for x in stateList]
	
	if blankCheck == []:
		stateList = open(ctrlFile, 'w')
		stateList.write(''.join(str("%s,'%s'" % (mode, cycleList[0]))+'\n'))
		general.run_console(cycleList[0])
	else:
		stateList = open(ctrlFile, 'r')
		checkFor = str([x for x in stateList])
				
		if mode not in str(checkFor):
			stateList = open(ctrlFile, 'r')
			getList = [x for x in stateList] 
			getList.insert(1, str("%s,'%s'\n" % (mode, cycleList[0])))
			#print '%s' % cycleList[0]
			stateList = open(ctrlFile, 'w')
			stateList.write(''.join(getList))	
			general.run_console(cycleList[0])
			
		else:
			stateList = open(ctrlFile, 'r')
			for d in enumerate(stateList):
				stateList = open(ctrlFile, 'r')
				getList = [x for x in stateList] 
				values = d[1].split(',')

				if mode in values[0]:
					newValue = ''.join(values[1].split('\n'))
					cycleL = [e for e in enumerate(cycleList)]
					getDict = ''.join(values[1].split('\n'))
					
					for x in cycleL:

						if newValue in "'%s'" % x[1]:
							number = [n[0] for n in cycleL] 
							getMax = max(number)
							nextNum = x[0]+1
							
							if nextNum > getMax:
								getDict = '%s' % cycleList[0]
								joinStr = [mode,",","'",getDict,"'", '\n']
								newLine = ''.join(joinStr)
								getList[d[0]] = newLine
								print getDict
								stateList = open(ctrlFile, 'w')
								stateList.write(''.join(str(''.join(getList))))
								general.run_console(getDict)
							else:
								getDict = '%s' % cycleList[x[0]+1]
								joinStr = [mode,",","'",getDict,"'", '\n']
								newLine = ''.join(joinStr)
								getList[d[0]] = newLine
								print getDict
								stateList = open(ctrlFile, 'w')
								stateList.write(''.join(str(''.join(getList))))
								general.run_console(getDict)
Пример #3
0
def cycleConsolV(mode, cycleList, ctrlFile):
    stateList = open(ctrlFile, 'r')
    setState = [x for x in enumerate(stateList)]
    blankCheck = [x for x in setState]
    getList = [x for x in stateList]

    if blankCheck == []:
        stateList = open(ctrlFile, 'w')
        stateList.write(''.join(str("%s,'%s'" % (mode, cycleList[0])) + '\n'))
        general.run_console(cycleList[0])
    else:
        stateList = open(ctrlFile, 'r')
        checkFor = str([x for x in stateList])

        if mode not in str(checkFor):
            stateList = open(ctrlFile, 'r')
            getList = [x for x in stateList]
            getList.insert(1, str("%s,'%s'\n" % (mode, cycleList[0])))
            #print '%s' % cycleList[0]
            stateList = open(ctrlFile, 'w')
            stateList.write(''.join(getList))
            general.run_console(cycleList[0])

        else:
            stateList = open(ctrlFile, 'r')
            for d in enumerate(stateList):
                stateList = open(ctrlFile, 'r')
                getList = [x for x in stateList]
                values = d[1].split(',')

                if mode in values[0]:
                    newValue = ''.join(values[1].split('\n'))
                    cycleL = [e for e in enumerate(cycleList)]
                    getDict = ''.join(values[1].split('\n'))

                    for x in cycleL:

                        if newValue in "'%s'" % x[1]:
                            number = [n[0] for n in cycleL]
                            getMax = max(number)
                            nextNum = x[0] + 1

                            if nextNum > getMax:
                                getDict = '%s' % cycleList[0]
                                joinStr = [mode, ",", "'", getDict, "'", '\n']
                                newLine = ''.join(joinStr)
                                getList[d[0]] = newLine
                                print getDict
                                stateList = open(ctrlFile, 'w')
                                stateList.write(''.join(str(''.join(getList))))
                                general.run_console(getDict)
                            else:
                                getDict = '%s' % cycleList[x[0] + 1]
                                joinStr = [mode, ",", "'", getDict, "'", '\n']
                                newLine = ''.join(joinStr)
                                getList[d[0]] = newLine
                                print getDict
                                stateList = open(ctrlFile, 'w')
                                stateList.write(''.join(str(''.join(getList))))
                                general.run_console(getDict)
def toggleConsolV(mode, onValue, offValue):
	stateList = open(ctrlFile, 'r') 
	setState 	= [x for x in enumerate(stateList)] 
	blankCheck 	= [x for x in setState]
	getList = [x for x in stateList]
	onOffList = [onValue, offValue]
	
	if blankCheck == []:
		stateList = open(ctrlFile, 'w')
		stateList.write(''.join(str("%s,'%s'" % (mode, offValue))+'\n'))
		general.run_console(offValue)
	else:
		stateList = open(ctrlFile, 'r')
		checkFor = str([x for x in stateList])
		
		if mode not in str(checkFor):
			stateList = open(ctrlFile, 'r')
			getList = [x for x in stateList] 
			getList.insert(1, str("%s,'%s'\n" % (mode, offValue)))
			print str("{'%s': %s}\n" % (cVars , offValue))
			stateList = open(ctrlFile, 'w')
			stateList.write(''.join(getList))	
			general.run_console(onValue)
			
		else:
			stateList = open(ctrlFile, 'r')
			for d in enumerate(stateList):
			
				values = d[1].split(',')
				
				stateList = open(ctrlFile, 'r')
				getList = [x for x in stateList] 
			
				if mode in values[0]:
					getDict = values[1]
					off = ["'",str(offValue),"'", '\n']
					joinoff = ''.join(off)

					if values[1] == joinoff:
						getDict = onValue
						joinStr = [mode,",","'",getDict,"'", '\n']
						newLine = ''.join(joinStr)
						print getDict
						getList[d[0]] = str(newLine)							
						stateList = open(ctrlFile, 'w')
						stateList.write(''.join(str(''.join(getList))))
						general.run_console(onValue)
					else: 
						getDict = offValue
						joinStr = [mode,",","'",getDict,"'", '\n']
						newLine = ''.join(joinStr)
						print getDict
						getList[d[0]] = str(newLine)					
						stateList = open(ctrlFile, 'w')
						stateList.write(''.join(str(''.join(getList))))
						general.run_console(offValue)			
Пример #5
0
def toggleConsolV(mode, onValue, offValue):
    stateList = open(ctrlFile, 'r')
    setState = [x for x in enumerate(stateList)]
    blankCheck = [x for x in setState]
    getList = [x for x in stateList]
    onOffList = [onValue, offValue]

    if blankCheck == []:
        stateList = open(ctrlFile, 'w')
        stateList.write(''.join(str("%s,'%s'" % (mode, offValue)) + '\n'))
        general.run_console(offValue)
    else:
        stateList = open(ctrlFile, 'r')
        checkFor = str([x for x in stateList])

        if mode not in str(checkFor):
            stateList = open(ctrlFile, 'r')
            getList = [x for x in stateList]
            getList.insert(1, str("%s,'%s'\n" % (mode, offValue)))
            print str("{'%s': %s}\n" % (cVars, offValue))
            stateList = open(ctrlFile, 'w')
            stateList.write(''.join(getList))
            general.run_console(onValue)

        else:
            stateList = open(ctrlFile, 'r')
            for d in enumerate(stateList):

                values = d[1].split(',')

                stateList = open(ctrlFile, 'r')
                getList = [x for x in stateList]

                if mode in values[0]:
                    getDict = values[1]
                    off = ["'", str(offValue), "'", '\n']
                    joinoff = ''.join(off)

                    if values[1] == joinoff:
                        getDict = onValue
                        joinStr = [mode, ",", "'", getDict, "'", '\n']
                        newLine = ''.join(joinStr)
                        print getDict
                        getList[d[0]] = str(newLine)
                        stateList = open(ctrlFile, 'w')
                        stateList.write(''.join(str(''.join(getList))))
                        general.run_console(onValue)
                    else:
                        getDict = offValue
                        joinStr = [mode, ",", "'", getDict, "'", '\n']
                        newLine = ''.join(joinStr)
                        print getDict
                        getList[d[0]] = str(newLine)
                        stateList = open(ctrlFile, 'w')
                        stateList.write(''.join(str(''.join(getList))))
                        general.run_console(offValue)
Пример #6
0
def capture():
    scripts_dir = os.path.abspath(os.path.dirname(__file__))
    screenshot_dir = os.path.abspath(
        os.path.join(os.path.dirname(__file__), "..", "..", "user", "screenshots")
    )
    images = get_all_files(".jpg", screenshot_dir)
    general.clear_selection()
    if general.is_helpers_shown():
        general.toggle_helpers()
    # if general.get_viewport_size() == (3840, 2160):
    #     general.set_viewport_size(3840, 2160)
    if len(sys.argv) == 3:
        if sys.argv[2] == "--pink":
            general.set_position("icon_pink_screen", 992.4509, 1047.51, 47.6817)
            general.set_position("icon_green_screen", 0, 0, 0)
    else:
        general.set_position("icon_green_screen", 992.4509, 1047.51, 47.6817)
        general.set_position("icon_pink_screen", 0, 0, 0)
    general.run_console("r_getScreenshot 1")
    obj = get_icon_object_in_scene()
    keys = obj.keys()
    embellishment_string = ""
    if u"embellishment_48" in keys:
        embellishment_string += "--embellishment_48 " + obj["embellishment_48"] + " "
    if u"embellishment_200" in keys:
        embellishment_string += "--embellishment_200 " + obj["embellishment_200"] + " "
    if u"embellishment_2048" in keys:
        embellishment_string += "--embellishment_2048 " + obj["embellishment_2048"] + " "
    if u"embellishment_under" in keys:
        embellishment_string += "--embellishment_under"
    print(embellishment_string)
    if obj:
        # the object exists in our db
        # save it and overwrite the current version then execute_external_icon_exe the script
        execute_external_icon_exe(
            scripts_dir,
            save(obj["name"], overwrite=True),
            images,
            embellishments=embellishment_string,
        )
    else:
        # the objects does not exist in our db
        # Ask the user what it is and save it and then execute_external_icon_exe the script
        execute_external_icon_exe(
            scripts_dir, save(), images, embellishments=embellishment_string
        )
Пример #7
0
 def take_shot(self):
     # take screenshot
     time.sleep(0.05)
     general.run_console('r_getScreenshot 1')
Пример #8
0
 def take_shot(self):
     # take screenshot
     time.sleep(0.05)
     general.run_console('r_getScreenshot 1')