def main():
	f = Face.Face()
	f.ReadFromFile(os.path.join(scintillaIfacePath,"Scintilla.iface"))
	Regenerate(os.path.join(templatePath,"Scintilla_iface.cs"), "/* ", printLexCSFile(f))
	Regenerate(os.path.join(templatePath,"ScintillaGateway.cs"), "/* ", printLexGatewayFile(f))
	Regenerate(os.path.join(templatePath,"IScintillaGateway.cs"), "/* ", printLexIGatewayFile(f))
	Regenerate(os.path.join(templatePath,"GatewayDomain.cs"), "/* ", printEnumDefinitions(f))
示例#2
0
 def __init__(self):
     ap = argparse.ArgumentParser()
     ap.add_argument("-d",
                     "--display",
                     type=str,
                     default="no",
                     help="display image `yes` or `no`")
     ap.add_argument("-c",
                     "--cascade",
                     type=str,
                     default="hog",
                     required=True,
                     help="cascade path for opencv")
     ap.add_argument("-m",
                     "--model",
                     type=str,
                     default="model.tflite",
                     required=True,
                     help="lite model path for the face detection")
     self.args = vars(ap.parse_args())
     self.exit = False
     self.face_detector = Face(self.args["cascade"])
     self.init_model()
     self.init_webcam()
     self.fps = FPS().start()
示例#3
0
 def read_from_off(self, path):
     with open(path) as f:
         counter = 0
         h = 0
         n = 0
         m = 0
         for line in f:
             if counter == 0:
                 if line.split()[0] != 'OFF':
                     print('This is not an OFF file')
                     break
             elif counter == 1:
                 (n, m, mm) = map(int, line.split())
             elif counter < n + 2:
                 (x, y, z) = map(float, line.split())
                 self.vertices.append(Vertex(p=Vector3D(x, y, z), index=counter - 2))
             elif counter < n + m + 2:
                 indices = [int(x) for x in line.split()]
                 v = indices[0]
                 indices = indices[1:]
                 h = []
                 for i in range(v - 1):
                     h.append(self.find_edge(indices[i], indices[i+1]))
                 h.append(self.find_edge(indices[v - 1], indices[0]))
                 for i in range(v - 1):
                     h[i].nh = h[i + 1]
                     h[i + 1].ph = h[i]
                 h[v - 1].nh = h[0]
                 h[0].ph = h[v - 1]
                 face = Face(side=h[v - 1], n=v, index=len(self.faces))
                 self.faces.append(face)
                 for i in range(v):
                     h[i].polygon = face
             counter += 1
示例#4
0
    def __init__(self, test=""):
        self.face = Face.Face()
        self.face.ReadFromFile(
            os.path.join(scintillaIncludeDirectory, "Scintilla.iface"))

        self.titleDirty = True
        self.fullPath = ""
        self.test = test

        self.appName = "xite"

        self.cmds = {}
        self.windowName = "XiteWindow"
        self.wfunc = WFUNC(self.WndProc)
        RegisterClass(self.windowName, self.wfunc)
        user32.CreateWindowExW(0, self.windowName, self.appName, \
         WS_VISIBLE | WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN, \
         0, 0, 500, 700, 0, 0, hinst, 0)

        args = sys.argv[1:]
        self.SetMenus()
        if args:
            self.GrabFile(args[0])
            self.ed.FocusOn()
            self.ed.GotoPos(self.ed.Length)

        if self.test:
            print(self.test)
            for k in self.cmds:
                if self.cmds[k] == "Test":
                    user32.PostMessageW(self.win, msgs["WM_COMMAND"], k, 0)
示例#5
0
def faceDetectionDummy(img):

    # カスケード型識別器の読み込み
    cascade = cv2.CascadeClassifier(
        "haarcascades/haarcascade_frontalface_default.xml")

    # グレースケール変換
    gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)

    # 顔領域の探索
    face = cascade.detectMultiScale(gray,
                                    scaleFactor=1.1,
                                    minNeighbors=3,
                                    minSize=(30, 30))

    faces = []
    cnt = 0
    # 顔領域を赤色の矩形で囲む
    for (x, y, w, h) in face:
        faceData = Face.Face()
        faceData.x = x
        faceData.y = y
        faceData.width = max(w, h)
        faceData.id = cnt
        faces.append(faceData)
        cnt += 1
        #print(str(x) + "," + str(y) + " ... " + str(w) + "x" + str(h))
        #print(str(faceData.x) + "," + str(faceData.y) + " ... " + str(w) + "x" + str(h))
    #for f in faces:
    #    print(str(f.x) + " " + str(f.y) + " " + str(f.width) + " " + str(f.id))
    return faces
示例#6
0
    def recognize_users(self, file_path):
        try:
            response = self.rekognition.search_faces_by_image(
                CollectionId=self.collection_id,
                Image={'S3Object': {
                    'Bucket': self.bucket,
                    'Name': file_path
                }},
                FaceMatchThreshold=self.threshold,
                MaxFaces=self.max_faces)
        except ClientError:
            return []

        face_matches = response['FaceMatches']

        users = []
        for match in face_matches:
            face = Face(match['Face']['FaceId'], match['Similarity'],
                        match['Face']['ExternalImageId'])
            response = self.s3_client.get_object_tagging(Bucket=self.bucket,
                                                         Key=face.external_id)

            values = dict()
            for tag in response['TagSet']:
                values[tag['Key']] = tag['Value']

            if 'name' in values and 'user' in values:
                user = User(face, values["name"], values['user'])
                users.append(user)
        return users
示例#7
0
def RegenerateAll(root):
	f = Face.Face()
	f.ReadFromFile(root + "../scintilla/" + "include/Scintilla.iface")
	Regenerate(root + "src/ScintillaMessages.h", "//", HMessages(f))
	Regenerate(root + "src/ScintillaTypes.h", "//", HEnumerations(f), HConstants(f))
	Regenerate(root + "src/ScintillaCall.h", "//", HMethods(f))
	Regenerate(root + "src/ScintillaCall.cxx", "//", CXXMethods(f))
示例#8
0
def clip(face_list):
    new_face_list = []
    for index in range(0, len(face_list)):
        face = face_list[index]
        vertices = []
        for edge in face.get_edges():
            m = edge[0]
            n = edge[1]
            m_inside = is_inside(m)
            n_inside = is_inside(n)

            if m_inside and n_inside:
                vertices.append(n)
            elif m_inside and not n_inside:
                vertices.append(find_intersection((m, n)))
            elif not m_inside and n_inside:
                vertices.append(find_intersection((n, m)))
                vertices.append(n)

        if len(vertices) == 3:
            face.v1 = vertices[0]
            face.v2 = vertices[1]
            face.v3 = vertices[2]
            new_face_list.append(face)
        elif len(vertices) == 4:
            # TODO: change order to make phong shading work
            face.v1 = vertices[0]
            face.v2 = vertices[1]
            face.v3 = vertices[2]
            new_face_list.append(face)
            face2 = Face(vertices[0], vertices[2], vertices[3], face.rgb)
            new_face_list.append(face2)

    return new_face_list
示例#9
0
    def __selectDrawFrameByFaces(self):
        # 表情スコア計算用の辞書型リストを取得する
        emotionSumScores = Face.Face().emotionScores

        # 念の為、初期化する
        for emotionName in emotionSumScores.keys():
            emotionSumScores[emotionName] = 0.0

        # カメラから画像を取得する
        self.__readVideoCapture()

        # 顔を検出する
        self.__faces = self.__detectFaces()

        # 各顔の表情スコアを求める
        self.__faces = self.__computeFaceScores(self.__faces)

        # スコア別に合計を求める
        for face in self.__faces:
            for emotionName in face.emotionScores.keys():
                emotionSumScores[emotionName] += face.emotionScores[
                    emotionName]
                #print("!" + str(face.emotionScores[emotionName]) + "!")

        # スコアの合計が最大である表情の名称とそのスコアを取得する
        self.__maxScore = -1  # 最大スコア
        self.__curlikelyEmotionName = None  # 尤もらしい表情の名称
        for emotionName in emotionSumScores.keys():  # スコアが最大である表情の名称を検索する
            emotionScore = emotionSumScores[emotionName]  # 表情に対応するスコアを獲得する
            if emotionScore == 0:  # 表情スコアが0の場合は対象外
                continue
            if emotionScore > self.__maxScore:
                self.__maxScore = emotionScore
                self.__curlikelyEmotionName = emotionName
示例#10
0
 def __init__(self):
     self.face = Face()
     self.pid = Incremental_PID(1, 0, 0.0025)
     self.tcp_flag = False
     self.video_flag = True
     self.fece_id = False
     self.fece_recognition_flag = False
     self.image = ''
示例#11
0
def RegenerateAll(root, showMaxID):
    f = Face.Face()
    f.ReadFromFile(root / "include/Scintilla.iface")
    Regenerate(root / "include/Scintilla.h", "/* ", printHFile(f))
    if showMaxID:
        valueSet = set(int(x) for x in f.values if int(x) < 3000)
        maximumID = max(valueSet)
        print("Maximum ID is %d" % maximumID)
示例#12
0
    def render_scene(self, dimensions, image_name):
        to_canvas = TransformationFactory.to_canvas(dimensions)

        randy = Renderer(dimensions)  # initialize renderer

        print("Rendering...")

        # TO VIEW SPACE
        scene_edges = []
        scene_faces = []
        for model in self.scene.models:
            for face in model.faces:
                scene_faces.append(
                    Face(face.v1, face.v2, face.v3, random_color()))
        print("faces in scene: {}".format(len(scene_faces)))

        scene_faces = transform_faces(scene_faces, self.to_view_space)
        print("basis swap to camera complete")

        # RENDER BEFORE CULLING
        self.render_face_edges(scene_faces, dimensions,
                               image_name + "_beforeCulling",
                               [self.to_screen_space, to_canvas])

        # CULLING
        before_filter = len(scene_faces)
        culled_faces = []
        for face in scene_faces:
            if not face.should_cull():
                culled_faces.append(face)
        difference = before_filter - len(culled_faces)
        print(str(difference) + " FACES CULLED")

        # TO SCREEN SPACE
        scene_faces = transform_faces(culled_faces, self.to_screen_space)

        # RENDER AFTER CULLING
        self.render_face_edges(scene_faces, dimensions,
                               image_name + "_afterCulling", [to_canvas])

        # TODO: Clipping
        scene_faces = clip(scene_faces)

        self.render_face_edges(scene_faces, dimensions,
                               image_name + "_afterClipping", [to_canvas])

        # TODO: RENDER HERE
        scene_faces = transform_faces(scene_faces, to_canvas)
        for face in scene_faces:
            randy.rasterize(face)

        randy.save(image_name + "_afterRasterizing")

        # TODO: Rasterize

        # TODO: Z-Buffer

        print("image saved!")
示例#13
0
def RegenerateAll(root):
	HFacer.RegenerateAll(root, False)
	f = Face.Face()
	include = root / "include"
	f.ReadFromFile(include / "Scintilla.iface")
	FileGenerator.Regenerate(include / "ScintillaMessages.h", "//", HMessages(f))
	FileGenerator.Regenerate(include / "ScintillaTypes.h", "//", HEnumerations(f), HConstants(f))
	FileGenerator.Regenerate(include / "ScintillaCall.h", "//", HMethods(f))
	FileGenerator.Regenerate(root / "call" / "ScintillaCall.cxx", "//", CXXMethods(f))
示例#14
0
 def add_face(self):
     face = self.face
     top, bottom, left, right = face.top(), face.bottom(), face.left(
     ), face.right()
     # pt1, pt2 = (left, top), (right, bottom)
     # cv2.rectangle(self.img, pt1, pt2, (0, 0, 255))
     Points = np.array([[left, top], [right, bottom], [left, bottom],
                        [right, top]])
     self.Organs['face'] = Face(self.img, Points, 'face')
 def __init__(self, periodicity=30):  # 30 seconds
     self._periodicity = periodicity
     self._subscribers = {}
     self._currentPrefix = Name()
     self._needStopDiscovery = True
     self._scheduler = Scheduler()
     self._scheduler.start()
     self._timeouts = 0
     self._face = Face()
     self._eventLoop = Face.EventLoop(self._face)
示例#16
0
    def __build__(self):
        self.vertex.append([0,-self.height/2,0])
        self.vertex.append([0,self.height/2,0])

        d = (2.0*np.pi) / self.slices

        for i in range(self.slices):
            t = i*d
            x = self.rad*math.cos(t)
            y = -self.height/2
            z = self.rad*math.sin(t)
            self.vertex.append([x,y,z])
            self.normals.append([0,0,0])

        for i in range(self.slices):

            j = 2 + (i%self.slices)
            k = 2 + ((i+1)%self.slices)

            self.indexs.append(0)
            self.indexs.append(j)
            self.indexs.append(k)

            self.indexs.append(1)
            self.indexs.append(j)
            self.indexs.append(k)

            face = Face.Face(self.vertex[0], self.vertex[j], self.vertex[k])
            self.normals[0] = face.getNormal()
            self.normals[j] = face.getNormal()
            self.normals[k] = face.getNormal()

            face = Face.Face(self.vertex[1], self.vertex[j], self.vertex[k])
            self.normals.append(face.getNormal())

            self.normals[j] = face.getNormal()
            self.normals[k] = face.getNormal()


        self.normals[1] = [0,1,0]


        self.ebo = EBOGL.EBOGL(vertex=self.vertex, index=self.indexs, normals=self.normals)
示例#17
0
def create_constants_file(iface_file, out_file):
    import Face

    face = Face.Face()
    face.ReadFromFile(iface_file)

    out = open(out_file, 'w')
    out.write(header % (os.path.basename(sys.argv[0]), os.path.basename(iface_file)))
    lexers, states = find_scintilla_constants(face)
    write_scintilla_constants(out, lexers, states)
示例#18
0
def main(argv):
    name = ''
    left_eye = ''
    right_eye = ''
    nose = ''
    mouth = ''

    try:
        opts, args = getopt.getopt(argv, "hf:", ["face="])
    except getopt.GetoptError:
        usage()
        sys.exit(2)

    for opt, arg in opts:
        if (opt == "-h"):
            usage()
            sys.exit()
        elif opt in ("-f", "--face"):
            name = argv[1]
            left_eye = argv[2]
            right_eye = argv[3]
            nose = argv[4]
            mouth = argv[5]

    face = Face.Face(name, left_eye, right_eye, nose, mouth)
    print(face.toString())
    if (name == "Mike"):
        mike = Face.Face(name, left_eye, right_eye, nose, mouth)
        if (mike.isOneEye() == 1):
            print("Mike have One Eye")
    elif (name == "Boo"):
        if (face.isEyesUnbalanced() == 0):
            print(name + " " + "Eyes are Unequal")
        else:
            print("Eyes are Equal")
    elif (name == "Mike"):
        if (face.isOneEye() == 0):
            print(name + " " + "have only One Eye")
        else:
            print(name + " " + "have both Eyes")
    elif (name == "Hello Kitty"):
        face.setMouth(3)
        print(face.toString())
示例#19
0
def RegenerateAll():
    f = Face.Face()
    f.ReadFromFile(srcRoot + "/scintilla/include/Scintilla.iface")
    menuIDs = ReadMenuIDs(srcRoot + "/scite/src/SciTE.h")
    idsInOrder = idsFromDocumentation(srcRoot +
                                      "/scintilla/doc/ScintillaDoc.html")
    Regenerate(srcRoot + "/scite/src/IFaceTable.cxx", "//",
               printIFaceTableCXXFile([f, menuIDs]))
    Regenerate(srcRoot + "/scite/doc/PaneAPI.html", "<!--",
               printIFaceTableHTMLFile([f, menuIDs, idsInOrder]))
示例#20
0
    def build_dcel(self, points):
        size = len(points)

        face = Face()
        self.faces.append(face)

        prev_left_edge = None
        prev_right_edge = None

        for i in range(size):
            point = points[i]
            vertex = Vertex()
            left = HalfEdge()
            right = HalfEdge()

            left.face = face
            left.next_hedge = None
            left.origin = vertex
            left.twin = right

            right.face = None
            right.next_hedge = prev_right_edge
            right.origin = None
            right.twin = left

            self.hedges.append(left)
            self.hedges.append(right)

            vertex.incident_edge = left
            vertex.point = point

            self.vertices.append(vertex)

            if prev_left_edge is not None:
                prev_left_edge.next_hedge = left

            if prev_right_edge is not None:
                prev_right_edge.origin = vertex

            prev_left_edge = left
            prev_right_edge = right

        first_left_edge = self.hedges[0]
        prev_left_edge.next_hedge = first_left_edge

        first_right_edge = self.hedges[1]
        first_right_edge.next_hedge = prev_right_edge

        prev_right_edge.origin = self.vertices[0]

        face.wedge = first_left_edge

        for hedge in self.hedges:
            hedge.next_hedge.prev_hedge = hedge
示例#21
0
 def test_averageFaceCalc(self):
     iManip.WIDTH = 2
     iManip.HEIGHT = 3
     newPic1 = numpy.zeros((3, 2, 3), int)
     ##This block of code is just initializing two arrays that look like this:
     #(1 2 )     (3 0 )
     #(4 5 ) and (5 5 )
     #(6 10)     (2 20)
     for i in range(0, 3):
         newPic1[0][0][i] = 1
         newPic1[1][0][i] = 4
         newPic1[2][0][i] = 6
         newPic1[0][1][i] = 2
         newPic1[1][1][i] = 5
         newPic1[2][1][i] = 10
     newPic2 = numpy.zeros((3, 2, 3), int)
     for i in range(0, 3):
         newPic2[0][0][i] = 3
         newPic2[1][0][i] = 5
         newPic2[2][0][i] = 2
         newPic2[0][1][i] = 0
         newPic2[1][1][i] = 5
         newPic2[2][1][i] = 20
     newFace1 = Face.Face(0, newPic1, 0, 0, 2, 3)
     newFace2 = Face.Face(0, newPic2, 0, 0, 2, 3)
     faces = [newFace1, newFace2]
     #we then run the two faces through the avergae faces code
     result = iManip.averageFaces(faces)
     ##And them we make sure that the result is the average of the pictures
     #(2   1 )
     #(4.5 5 )
     #(4   15)
     for i in range(0, 3):
         self.assertEqual(result[0][0][i], 2)
         self.assertEqual(result[1][0][i],
                          4.5)  ##Should the meanface be a double?
         self.assertEqual(result[2][0][i], 4)
         self.assertEqual(result[0][1][i], 1)
         self.assertEqual(result[1][1][i], 5)
         self.assertEqual(result[2][1][i], 15)
     return
示例#22
0
    def __init__(self, test=""):
        self.face = Face.Face()
        self.face.ReadFromFile(
            os.path.join(scintillaIncludeDirectory, "Scintilla.iface"))
        try:
            faceLex = Face.Face()
            faceLex.ReadFromFile(
                os.path.join(lexillaIncludeDirectory, "LexicalStyles.iface"))
            self.face.features.update(faceLex.features)
        except FileNotFoundError:
            print("Can't find " + "LexicalStyles.iface")

        self.titleDirty = True
        self.fullPath = ""
        self.test = test

        self.appName = "xite"

        self.large = "-large" in sys.argv

        self.cmds = {}
        self.windowName = "XiteWindow"
        self.wfunc = WFUNC(self.WndProc)
        RegisterClass(self.windowName, self.wfunc)
        user32.CreateWindowExW(0, self.windowName, self.appName, \
         WS_VISIBLE | WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN, \
         0, 0, 500, 700, 0, 0, hinst, 0)

        args = [a for a in sys.argv[1:] if not a.startswith("-")]
        self.SetMenus()
        if args:
            self.GrabFile(args[0])
            self.FocusOnEditor()
            self.ed.GotoPos(self.ed.Length)

        if self.test:
            print(self.test)
            for k in self.cmds:
                if self.cmds[k] == "Test":
                    user32.PostMessageW(self.win, msgs["WM_COMMAND"], k, 0)
示例#23
0
def main():
    f = Face.Face()
    f.ReadFromFile(
        "../../../notepad-plus-plus/scintilla/include/Scintilla.iface")
    Regenerate(
        "../../Visual Studio Project Template C#/PluginInfrastructure/Scintilla_iface.cs",
        "/* ", printLexCSFile(f))
    Regenerate(
        "../../Visual Studio Project Template C#/PluginInfrastructure/ScintillaGateWay.cs",
        "/* ", printLexGatewayFile(f))
    Regenerate(
        "../../Visual Studio Project Template C#/PluginInfrastructure/IScintillaGateWay.cs",
        "/* ", printLexIGatewayFile(f))
示例#24
0
	def __init__(self, test=""):
		self.face = Face.Face()
		self.face.ReadFromFile(os.path.join(scintillaIncludeDirectory, "Scintilla.iface"))

		self.test = test

		self.form = Form()

		scifn = self.form.edit.send(int(self.face.features["GetDirectFunction"]["Value"]), 0, 0)
		sciptr = ctypes.c_char_p(self.form.edit.send(
			int(self.face.features["GetDirectPointer"]["Value"]), 0,0))

		self.ed = ScintillaCallable.ScintillaCallable(self.face, scifn, sciptr)
		self.form.show()
示例#25
0
def retrieveFeatures():
	face = Face.Face()
	face.ReadFromFile(pathIface)
	sciToFeature = {}
	sccToValue = { "true":"1", "false":"0", "EN_SETFOCUS":"256", "EN_KILLFOCUS":"512"}
	for name in face.order:
		v = face.features[name]
		if v["FeatureType"] in ["fun", "get", "set"]:
			featureDefineName = "SCI_" + name.upper()
			sciToFeature[featureDefineName] = name
		elif v["FeatureType"] in ["val"]:
			featureDefineName = name.upper()
			sccToValue[featureDefineName] = v["Value"]
		elif v["FeatureType"] in ["evt"]:
			featureDefineName = "SCN_" + name.upper()
			sccToValue[featureDefineName] = v["Value"]
	return (face, sciToFeature, sccToValue)
示例#26
0
 def __computeFaceScores(self, faces):
     maxSizeFace = Face.Face()
     maxSizeFace.width = 0
     for face in faces:
         if face.width > maxSizeFace.width:
             maxSizeFace = face
     for face in faces:
         cnt = 0
         pos = int(face.width / 25) % len(self.__emotionNames)
         for emotionName in face.emotionScores.keys():
             if cnt == pos:
                 face.emotionScores[emotionName] = 1.0
             else:
                 face.emotionScores[emotionName] = 0
             cnt += 1
             #print("<" + str(face.emotionScores[emotionName]) + ">")
     return faces
示例#27
0
def faceFeatures(out):
	out.write("<h2>Scintilla key commands</h2>\n")
	out.write("<table>\n")
	out.write("<thead>%s%s%s</thead>\n" % (cell("Command"), cell("Name"), cell("Explanation")))
	face = Face.Face()
	face.ReadFromFile(os.path.join(scintillaDirectory, "Scintilla.iface"))
	texts = []
	for name in face.features:
		#~ print name
		f = face.features[name]
		if f["FeatureType"] == "fun" and \
			f["ReturnType"] == "void" and \
			not (f["Param1Type"] or f["Param2Type"]):
			texts.append([name, f["Value"], " ".join(f["Comment"])])
	texts.sort()
	for t in texts:
		out.write("<tr>%s%s%s</tr>\n" % (cell(t[1]), cell(t[0]), cell(t[2])))
	out.write("</table>\n")
示例#28
0
    def __build__(self):
        scaleX = self.scale / self.xRange
        scaleZ = self.scale / self.yRange

        m = 3

        for i in range(0, self.xRange):
            for j in range(0, self.yRange):
                x = scaleX * i - scaleX * self.xRange / 2.0
                z = scaleZ * j - scaleZ * self.yRange / 2.0
                y = self.f.eval(x, z)
                self.points.append((x, y, z))

                self.coords.append([i * 0.5, j * 0.5])

                self.normals.append([0.0, 0.0, 0.0])

        for i in range(0, self.xRange - 1):
            for j in range(0, self.yRange - 1):
                a = i * self.yRange + j
                b = a + 1
                c = (i + 1) * (self.yRange) + j
                d = c + 1

                f = Face(self.points[a], self.points[b], self.points[c])
                self.normals[a] = f.getNormal()
                self.normals[b] = f.getNormal()
                self.normals[c] = f.getNormal()
                self.normals[d] = f.getNormal()

                self.indexs.append(a)
                self.indexs.append(b)
                self.indexs.append(c)

                self.indexs.append(b)
                self.indexs.append(c)
                self.indexs.append(d)

        #self.ebo = EBOGL.EBOGL(self.points, self.indexs, self.colors, self.coords)
        self.ebo = EBOGL.EBOGL(vertex=self.points,
                               index=self.indexs,
                               textCoords=self.coords,
                               normals=self.normals)
示例#29
0
    def __init__(self, name, nLets, category):
        '''
        Initialize the game by creating the Face and Brain objects and
        activating the game loop.
        name and category are meta data sent to the brain to store in the
        Memory database.
        nLets is passed to the Face to build the game and also to Brain to
        sort a list of possible words.
        '''
        self.name = name
        self.number_of_letters = nLets
        self.category = category

        self.brain = Brain.Brain(nLets)
        self.face = Face.Face(nLets)

        self.strikes = len(self.brain.previous_guesses)
        self.previous_guesses = self.brain.previous_guesses
        self.next_guess = self.brain.next_guess

        self.face.gameState(self.next_guess, self.previous_guesses,
                            self.strikes, [])
        self.requestResponse()
示例#30
0
    inText = contents(filename)
    tempname = "HFacer.tmp"
    out = open(tempname, "w")
    hfile = open(filename)
    CopyWithInsertion(hfile, out, genfn, definition)
    out.close()
    hfile.close()
    outText = contents(tempname)
    if inText == outText:
        os.unlink(tempname)
    else:
        os.unlink(filename)
        os.rename(tempname, filename)


f = Face.Face()
try:
    f.ReadFromFile("Scintilla.iface")
    findEnumValues(f)
    with open("ScintillaWrapperGenerated.cpp", 'w') as cpp:
        writeCppFile(f, cpp)

    Regenerate("ScintillaWrapper.h", writeHFile, f)
    Regenerate("ScintillaPython.cpp", writeBoostWrapFile, f)
    Regenerate("Enums.h", writeEnumsHFile, f)
    Regenerate("EnumsWrapper.cpp", writeEnumsWrapperFile, f)
    Regenerate(r"..\..\docs\source\scintilla.rst", writeScintillaDoc, f)
    Regenerate(r"..\..\docs\source\enums.rst", writeScintillaEnums, f)
    #Regenerate("SciLexer.h", printLexHFile, f)
    #print("Maximum ID is %s" % max([x for x in f.values if int(x) < 3000]))
except: