Beispiel #1
0
def fontMarkupCompletion(editor):
    fontList = []
    for k, v in FontManager().fonts.iteritems():
        if (k == "NanumGothicCoding"):
            continue
        fontList.append(k)
    editor.completionShow(QStringListModel(fontList))
Beispiel #2
0
def OpenLaucher(showAleart=False, discard=None):
    inst = ProjectController()
    if len(inst.path) == 0:
        return

    result = SceneScriptWindowManager.getInstance().reset()

    if not result:
        return

    BookmarkListWindow().hide()
    SceneMapWindow(NoriterMain()).hide()
    DefineSettingWindow().hide()
    ATLEditor().hide()
    FontManager().reset()

    m = NoriterMain()
    ret = m.close()

    if ret:

        def close():
            pass

        launcher = LauncherView(m)
        launcher.onClose = close
Beispiel #3
0
        def fontSize(self, text, size, font):
            font = os.path.splitext(font)[0]
            font = FontManager().FontName(font)

            strSize = str(size)
            if text in self.textSize:
                if strSize in self.textSize[text]:
                    if font in self.textSize[text][strSize]:
                        return self.textSize[text][strSize][font]

            f = QFont(font, size)
            f.setPixelSize(size + 1)
            b = QFontMetrics(f).boundingRect(text)
            w, h = b.width(), b.height()

            if w == 1:
                f = size / 10
                if f == 0:
                    f = 1
                w = (f * 2) - 1

            if not text in self.textSize:
                self.textSize[text] = {}
            if not strSize in self.textSize[text]:
                self.textSize[text][strSize] = {}
            if not font in self.textSize[text][strSize]:
                self.textSize[text][strSize][font] = None

            self.textSize[text][strSize][font] = [w, h]
            return self.textSize[text][strSize][font]
Beispiel #4
0
        def __init__(self, v):
            super(GraphicsProtocolObject.Label, self).__init__()
            font = FontManager().FontName(v.font)
            self.font = QFont(font, float(v.size))
            self.font.setPixelSize(float(v.size))

            self.text = v.text
            self.fontMetrics = QFontMetrics(self.font)
            b = self.fontMetrics.boundingRect(self.text)
            self.rect = QRect(-b.width() * v.anchorX,
                              -float(v.size) * v.anchorY, b.width(),
                              float(v.size))

            self.color = QColor(float(v.color[1]), float(v.color[2]),
                                float(v.color[3]))
            self.opacity = float(v.opacity)
            self.setRotation(v.rotate)
            self.scale(float(v.scaleX), float(v.scaleY))
            self.setPos(float(v.x), float(v.y))

            self.anchorX = v.anchorX
            self.anchorY = v.anchorY
Beispiel #5
0
	def paintEvent(self, e):
		qp = QPainter(self)
		qp.setFont(FontManager().FontName("NanumBarunGothic"))

		frameAreaGeometry = self.timelineKeyFrameArea.geometry()
		xoffset = frameAreaGeometry.x()
		yoffset = frameAreaGeometry.y()

		defaultNodeBrush = QBrush(QColor(90,50,50))
		pressedNodeBrush = QBrush(QColor(50,50,120))
		qp.setBrush(defaultNodeBrush)
		textPen = QPen(QColor(222,177,177))
		qp.setPen(textPen)

		frameLimit = self.maxFrameAddition + 10
		if frameLimit < self.currentFrameCount:
			frameLimit = self.currentFrameCount

		geoWidth = self._scroll.geometry().width()
		geoHeight = self._scroll.geometry().height()

		i = (-xoffset / self.frameFieldWidth) - 1
		while (i * self.frameFieldWidth) <= (-xoffset + geoWidth):
			if i < 0:
				i = i + 1
				continue
			if i >= frameLimit:
				break

			boundingBox=QRect(xoffset+self.nodeFieldWidth+self.frameFieldWidth*i,0,self.frameFieldWidth,self.timeFieldHeight-1)
			wordBoundingBox=QRect(-self.timeFieldHeight,xoffset+self.nodeFieldWidth+self.frameFieldWidth*i+2,self.timeFieldHeight,self.frameFieldWidth)
			qp.drawRect(boundingBox)
			qp.save()
			qp.rotate(-90)
			qp.drawText(wordBoundingBox,Qt.AlignCenter,str(i))
			qp.restore()

			i = i + 1

		i = (-yoffset / self.nodeFieldHeight) - 1
		while (i * self.nodeFieldHeight) <= (-yoffset + geoHeight):
			if i < 0:
				i = i + 1
				continue
			if i >= self.currentNodeCount:
				break

			if i == self.pressedNode:
				qp.setBrush(pressedNodeBrush)

			boundingBox=QRect(0,yoffset+self.timeFieldHeight+self.nodeFieldHeight*i,self.nodeFieldWidth-1,self.nodeFieldHeight)
			qp.drawRect(boundingBox)
			boundingBox=QRect(0,yoffset+self.timeFieldHeight+self.nodeFieldHeight*i+3,self.nodeFieldWidth,self.nodeFieldHeight)
			qp.drawText(boundingBox,Qt.AlignCenter,self._data[i]["name"])

			if i == self.pressedNode:
				qp.setBrush(defaultNodeBrush)

			i = i + 1

		qp.drawRect(0,0,self.nodeFieldWidth,self.timeFieldHeight)
Beispiel #6
0
	def paintEvent(self, e):
		qp = QPainter(self)
		qp.setFont(FontManager().FontName("NanumBarunGothic"))

		frameFieldWidth = self.timeline.frameFieldWidth
		nodeFieldHeight = self.timeline.nodeFieldHeight
		keyFrameEllipseDiameter = self.timeline.keyFrameEllipseDiameter

		keyFrameBrush = QBrush(QColor(70,100,100))

		pressedFrameBrush = QBrush(QColor(255,140,140))
		pressingFrameBrush = QBrush(QColor(100,100,255))

		noBrush = QBrush(Qt.NoBrush)

		highlightingBrush = QBrush(QColor(70,70,40))

		normalPen = QPen(QColor(85,85,85))
		normalPen.setStyle(Qt.DotLine)
		qp.setPen(normalPen)

		affPen = QPen(QColor(140,140,140))
		affPen.setStyle(Qt.DashLine)

		keyFramePen = QPen(QColor(140,200,200))
		keyFramePen.setStyle(Qt.SolidLine)

		whitePen = QPen(QColor(255,255,255))

		noPen = QPen(Qt.NoPen)

		currentFrameCount = self.timeline.currentFrameCount
		currentNodeCount = self.timeline.currentNodeCount

		frameLimit = self.timeline.maxFrameAddition + 10
		if currentFrameCount < frameLimit:
			currentFrameCount = frameLimit

		xoffset = self.geometry().left()
		yoffset = self.geometry().top()
		geoWidth = self.timeline._scroll.geometry().width()
		geoHeight = self.timeline._scroll.geometry().height()

		i = (-yoffset / nodeFieldHeight) - 1
		while (i * nodeFieldHeight) <= (-yoffset + geoHeight):
			if i < 0:
				i = i + 1
				continue
			if i >= currentNodeCount:
				break

			if len(self.timeline._data[i]) > 0:			
				#background highlighting
				qp.setPen(noPen)
				qp.setBrush(highlightingBrush)
				startFrame = self.timeline._data[i]["frames"][0][0]
				endFrame = self.timeline._data[i]["frames"][-1][0]

				startXCoor = frameFieldWidth * startFrame
				endXCoor = frameFieldWidth * (endFrame + 1)
				if startXCoor < -xoffset:
					startXCoor = -xoffset
				if endXCoor > -xoffset + geoWidth:
					endXCoor = -xoffset + geoWidth
				qp.drawRect(startXCoor,nodeFieldHeight*i,endXCoor-startXCoor,nodeFieldHeight)
		
			# draw holizontal line
			qp.setPen(normalPen)
			lineStart = QPoint(-xoffset,nodeFieldHeight*(i+1))
			lineEnd = QPoint(-xoffset+geoWidth,nodeFieldHeight*(i+1))
			qp.drawLine(lineStart,lineEnd)
			r=keyFrameEllipseDiameter/2

			# for drawing "SELECTING" point
			if self.pressingPoint != None:
				startNodeIndex = self.pressedPoint.y()/self.timeline.nodeFieldHeight
				endNodeIndex = self.pressingPoint.y()/self.timeline.nodeFieldHeight
				startFrameIndex = self.pressedPoint.x()/self.timeline.frameFieldWidth
				endFrameIndex = self.pressingPoint.x()/self.timeline.frameFieldWidth

				if startNodeIndex > endNodeIndex:
					startNodeIndex, endNodeIndex = endNodeIndex, startNodeIndex
				if startFrameIndex > endFrameIndex:
					startFrameIndex, endFrameIndex = endFrameIndex, startFrameIndex

			qp.setPen(keyFramePen)
			for frame,data in self.timeline._data[i]["frames"]:
				frameCenterPoint = QPoint(frameFieldWidth*frame+frameFieldWidth/2,nodeFieldHeight*(i)+nodeFieldHeight/2)
				if (frameCenterPoint.x() + r >= -xoffset) and (frameCenterPoint.x() - r <= -xoffset + geoWidth):
					qp.setBrush(keyFrameBrush)

					if self.pressingPoint != None:
						# if dragging for select
						if i >= startNodeIndex and i <= endNodeIndex:
							if frame >= startFrameIndex and frame <= endFrameIndex:
								qp.setBrush(pressedFrameBrush)

					qp.drawEllipse(frameCenterPoint,r,r)

					if len(data) > 1:
						# multidata in keyframe then, draw "+" icon
						qp.setPen(whitePen)
						qp.drawLine(frameCenterPoint.x()-2,frameCenterPoint.y(),frameCenterPoint.x()+2,frameCenterPoint.y())
						qp.drawLine(frameCenterPoint.x(),frameCenterPoint.y()-2,frameCenterPoint.x(),frameCenterPoint.y()+2)
						qp.setPen(keyFramePen)

			i = i + 1

		i = (-xoffset / frameFieldWidth) - 1
		while (i * frameFieldWidth) <= (-xoffset + geoWidth):
			if i < 0:
				i = i + 1
				continue
			if i >= currentFrameCount:
				break

			# draw vertical line
			if i % 5 == 0:
				qp.setPen(affPen)
			else:
				qp.setPen(normalPen)

			lineStart = QPoint(frameFieldWidth*(i+1),-yoffset)
			targetYPoint = nodeFieldHeight*currentNodeCount
			if targetYPoint > -yoffset+geoHeight:
				targetYPoint = -yoffset+geoHeight
			lineEnd = QPoint(frameFieldWidth*(i+1),targetYPoint)
			qp.drawLine(lineStart,lineEnd)

			i = i + 1


		if len(self.selectedKeyFrames) > 0:
			# if exist selected keyframes
			qp.setPen(keyFramePen)
			qp.setBrush(pressedFrameBrush)
			r=keyFrameEllipseDiameter/2
			for n, f, d in self.selectedKeyFrames:
				frameCenterPoint = QPoint(frameFieldWidth*f+frameFieldWidth/2,nodeFieldHeight*n+nodeFieldHeight/2)
				qp.drawEllipse(frameCenterPoint,r,r)

				if len(d) > 1:
					# multidata in keyframe then, draw "+" icon
					qp.setPen(whitePen)
					qp.drawLine(frameCenterPoint.x()-2,frameCenterPoint.y(),frameCenterPoint.x()+2,frameCenterPoint.y())
					qp.drawLine(frameCenterPoint.x(),frameCenterPoint.y()-2,frameCenterPoint.x(),frameCenterPoint.y()+2)
					qp.setPen(keyFramePen)	

		if self.pressedNode != -1:
			qp.setPen(keyFramePen)	
			qp.setBrush(pressedFrameBrush)

			frameCenterPoint = QPoint(frameFieldWidth*self.pressedFrame+frameFieldWidth/2,nodeFieldHeight*self.pressedNode+nodeFieldHeight/2)
			qp.drawEllipse(frameCenterPoint,keyFrameEllipseDiameter/2,keyFrameEllipseDiameter/2)

			if self.pressingFrame != -1:
				qp.setBrush(pressingFrameBrush)

				if len(self.selectedKeyFrames) < 1:
					frameCenterPoint = QPoint(frameFieldWidth*self.pressingFrame+frameFieldWidth/2,nodeFieldHeight*self.pressedNode+nodeFieldHeight/2)
					qp.drawEllipse(frameCenterPoint,keyFrameEllipseDiameter/2,keyFrameEllipseDiameter/2)
				else:
					offset = self.pressingFrame - self.pressedFrame

					r=keyFrameEllipseDiameter/2

					for n, f, d in self.selectedKeyFrames:
						frameCenterPoint = QPoint(frameFieldWidth*(f+offset)+frameFieldWidth/2,nodeFieldHeight*n+nodeFieldHeight/2)
						qp.drawEllipse(frameCenterPoint,r,r)

		if self.pressingPoint != None:
			qp.setPen(whitePen)
			qp.setBrush(noBrush)
			qp.drawRect(self.pressedPoint.x(),self.pressedPoint.y(),self.pressingPoint.x()-self.pressedPoint.x(),self.pressingPoint.y()-self.pressedPoint.y())
Beispiel #7
0
    def UpdateSuggestArgument():
        from view.AssetLibraryWindow import AssetLibraryWindow

        lua = ScriptGraphicsProtocol().lua.globals()
        a = lua._AUTO_

        img_path = ProjectController().path + QDir.separator(
        ) + "image" + QDir.separator()
        sound_path = ProjectController().path + QDir.separator(
        ) + "sound" + QDir.separator()

        _fi_sound = [
            v.replace(sound_path, "").replace("\\", "/")
            for v in AssetLibraryWindow().audio
        ]
        _fi_imgs = [
            v.replace(img_path, "").replace("\\", "/")
            for v in AssetLibraryWindow().images
        ]
        _fi_fonts = [
            v.replace(img_path, "").replace("\\", "/")
            for v in FontManager().fonts
        ]
        _fi_fonts.remove("NanumGothicCoding")

        _id_node = [v.id for k, v in sorted(lua.pini._regist_.Display.items())]
        _id_sound = [k for k, v in sorted(lua.pini._regist_.Sounds.items())]
        _id_timer = [
            k for k, v in sorted(lua.pini._regist_.Timers.items())
            if k[:4] != "PINI"
        ]
        _id_ineff = [k for k, v in sorted(lua.fs_imageEffect.items())]
        _id_outef = [k for k, v in sorted(lua.fs_imageDeleteEffect.items())]
        _id_anim = [k for k, v in sorted(lua.fs_animation.items())]

        _id_size = [k for k, v in sorted(lua.fs_size.items())]
        _id_pos = [k for k, v in sorted(lua.fs_position.items())]

        imgurl = [
            "img://" + v.replace("\\", "/")
            for v in AssetLibraryWindow().images
        ]

        a[u"노드아이디"] = zip(_id_node,
                          [u"현재 화면에 출력되고 있는 오브젝트의 아이디"] * len(_id_node))
        a[u"사운드아이디"] = zip(_id_sound,
                           [u"현재 출력되고 있는 사운드의 아이디"] * len(_id_sound))
        a[u"타이머아이디"] = zip(_id_timer,
                           [u"현재 실행되고 있는 타이머의 아이디"] * len(_id_timer))
        a[u"노드입장효과"] = zip(_id_ineff,
                           [u"노드 입장효과.. 정리해야함. TODO "] * len(_id_ineff))
        a[u"노드퇴장효과"] = zip(_id_outef,
                           [u"노드 퇴장효과.. 정리해야함. TODO "] * len(_id_outef))
        a[u"애니메이션타입"] = zip(_id_anim,
                            [u"애니메이션 타입.. 정리해야함. TODO "] * len(_id_anim))

        a[u"크기"] = zip(_id_size, [u"크기들.. 정리해야함. TODO"] * len(_id_size))
        a[u"위치"] = zip(_id_pos, [u"위치들.. 정리해야함. TODO"] * len(_id_pos))

        a[u"폰트파일"] = zip(_fi_fonts, [u"이 텍스트를 표기할 폰트"] * len(_fi_fonts))

        a[u"이미지파일"] = zip(_fi_imgs, imgurl)
        a[u"사운드파일"] = zip(_fi_sound, [""] * len(_fi_sound))

        cmds, expl = ScriptCommand.List()
        a[u"함수목록"] = zip(cmds, expl)