Example #1
0
class StateDiaGen:
    def __init__(self, plan):
        self.es = StateDia()
        self.plan = plan
        self.entityes = plan.entityes

    def gen(self):
        for entity in self.entityes:
            id = entity.id
            name = entity.name
            e = self.es.entity(id, name)
            ds = entity.description
            for d in ds:
                e.add_desctiption(d)
            ds = entity.result
            for d in ds:
                e.add_desctiption(u"Результат: %s" % d)
            ds = entity.people
            for d in ds:
                e.add_desctiption(u"Исполнители: %s" % d)
            starttime = entity.starttime
            endtime = entity.endtime
            if starttime != None:
                e.add_desctiption(u"Срок выполнения: %s - %s" %
                                  (starttime, endtime))
            ds = entity.history
            if len(ds) > 0:
                e.add_desctiption(u"История выполнения:")
            for d in ds:
                e.add_desctiption(u"%s: %s" % (d.date, d.text))

            if entity.note != "":
                e.note = entity.note
        for entity in self.entityes:
            id = entity.id
            froms = entity.dfrom
            for d in froms:
                l = self.es.link(d.name, id)
                if l == None:
                    print "ERROR: Can't create link on '%s'" % entity.id
                    continue
                l.direction = d.direction
            toes = entity.dto
            for d in toes:
                l = self.es.link(id, d.name)
                if l == None:
                    print "ERROR: Can't create link on '%s'" % entity.id
                    continue
                l.direction = d.direction

    def output(self):
        self.gen()
        return self.es.plantuml().encode("utf8")

    def outfile(self, filename):
        f = open(filename, "w")
        f.write(self.output())
        f.close()
Example #2
0
class StateDiaGen:
	def __init__(self, plan):
		self.es = StateDia()
		self.plan = plan
		self.entityes = plan.entityes
	
	def gen(self):
		for entity in self.entityes:
			id = entity.id
			name = entity.name
			e = self.es.entity(id, name)
			ds = entity.description
			for d in ds:
				e.add_desctiption(d)
			ds = entity.result
			for d in ds:
				e.add_desctiption(u"Результат: %s" % d)
			ds = entity.people
			for d in ds:
				e.add_desctiption(u"Исполнители: %s" % d)
			starttime = entity.starttime
			endtime = entity.endtime
			if starttime != None :
				e.add_desctiption(u"Срок выполнения: %s - %s" % (starttime, endtime))
			ds = entity.history
			if len(ds) > 0 :
				e.add_desctiption(u"История выполнения:" )
			for d in ds:
				e.add_desctiption(u"%s: %s" % (d.date, d.text))

			if entity.note != "":
				e.note = entity.note
		for entity in self.entityes:
			id = entity.id
			froms = entity.dfrom
			for d in froms:
				l = self.es.link(d.name, id)
				if l == None:
					print "ERROR: Can't create link on '%s'" % entity.id
					continue
				l.direction = d.direction
			toes = entity.dto
			for d in toes:
				l = self.es.link(id, d.name)
				if l == None:
					print "ERROR: Can't create link on '%s'" % entity.id
					continue
				l.direction = d.direction

	def output(self):
		self.gen()
		return self.es.plantuml().encode("utf8")
	def outfile(self, filename):
		f = open(filename, "w")
		f.write(self.output())
		f.close()
Example #3
0
 def __init__(self, plan, peoples, project):
     self.es = StateDia()
     self.plan = plan
     self.entityes = plan.entityes
     self.peoples = peoples
     self.project = project
     self.gproject = None
     self.gen()
Example #4
0
	def __init__(self, plan):
		self.es = StateDia()
		self.plan = plan
		self.entityes = plan.entityes
Example #5
0
 def __init__(self, filename):
     self.es = StateDia()
     self.xml = ET.parse(filename).getroot()
     self.entityes = []
     self.parse()
Example #6
0
 def __init__(self, plan):
     self.es = StateDia()
     self.plan = plan
     self.entityes = plan.entityes