Exemplo n.º 1
0
	def BtnHandleClick(self, sender, e):
		#write file body		
		file=modFile.modFile()
		file.writefile("datedata.txt",re.sub(r" .*","",str(self._dtps.Value)))	
		
		#write file body		
		file=modFile.modFile()
		file.writefile("countdata.txt",str(self._cmbCount.Text))	
		
		self._pResult.Visible=True
		pass
    def loadtemplate(self, round="9", count="6"):
        # load file body
        file = modFile.modFile()
        result = file.readfile("template" + round + "-" + count + ".txt")

        # enum all result line to update to template
        line = result.split("\n")
        d = 0
        k = 0
        for v in line:
            v1 = re.sub(r"\d", "", v)
            if v1.strip() == "" and v.strip() != "":
                d = int(v)
                k = 0

                self.userinfo.field[0].date[d] = self.now
                self.now = self.next
                self.next = self.next + self.delta
            elif v.strip() != "":
                temp = v.split("-")
                self.userinfo.field[0].teamA[d][k] = self.userinfo.team[int(temp[0])].name
                self.userinfo.field[0].teamB[d][k] = self.userinfo.team[int(temp[1])].name
                k += 1

                # d is need skip.#
        self.maxd = d + 1
Exemplo n.º 3
0
	def BtnSavClick(self, sender, e):
		#load data from datagridview
		i=0
		fbody=""
		for v in self._dgvt.Rows:
			if i+1==self._dgvt.Rows.Count:
				break

			fbody+="team"
			fbody+=str(i)
			fbody+="="
			if v.Cells[0].Value==True:
				fbody+="1"
			elif v.Cells[0].Value==False:
				fbody+="0"
			fbody+=","
			fbody+=v.Cells[1].Value
			fbody+=","
			fbody+=v.Cells[2].Value
			fbody+=","
			fbody+=v.Cells[3].Value
			fbody+="-"
			if v.Cells[4].Value is None:
				fbody+=""
			else:
				fbody+=v.Cells[4].Value
			fbody+="\r\n"
			i+=1
		
		#write file body		
		file=modFile.modFile()
		file.writefile("teamdata.txt",fbody)
		
		pass
Exemplo n.º 4
0
	def BtnSavClick(self, sender, e):
		#load data from datagridview
		i=0
		fbody=""
		for v in self._dgvf.Rows:
			if i+1==self._dgvf.Rows.Count:
				break

			fbody+="field"
			fbody+=str(i)
			fbody+="="
			fbody+=v.Cells[0].Value
			fbody+="\r\n"
			i+=1
		
		#write file body		
		file=modFile.modFile()
		file.writefile("fielddata.txt",fbody)
		
		pass
Exemplo n.º 5
0
	def DgvtCellContentClick(self, sender, e):
		#that sure user is click configure button
		if self._dgvt.CurrentCell.ColumnIndex==5:
			#load data from datagridview
			i=0
			fbody=""
			for v in self._dgvt.Rows:
				if i+1==self._dgvt.Rows.Count:
					break
	
				fbody+="team"
				fbody+=str(i)
				fbody+="="
				if v.Cells[0].Value==True:
					fbody+="1"
				elif v.Cells[0].Value==False:
					fbody+="0"
				fbody+=","
				fbody+=v.Cells[1].Value
				fbody+=","
				fbody+=v.Cells[2].Value
				fbody+=","
				fbody+=v.Cells[3].Value
				fbody+="-"
				if v.Cells[4].Value is None:
					fbody+=""
				else:
					fbody+=v.Cells[4].Value
				fbody+="\r\n"
				i+=1
			
			#write file body		
			file=modFile.modFile()
			file.writefile("teamdata.txt",fbody)
			
			teamconfig=frmTeamConfig.frmTeamConfig(self._dgvt.CurrentRow.Index,self._dgvt.Rows[self._dgvt.CurrentRow.Index].Cells[4].Value)
			teamconfig.Show()
			self.Close()
		pass
Exemplo n.º 6
0
	def FrmFieldLoad(self, sender, e):
		#load file body
		file=modFile.modFile()
		result=file.readfile("fielddata.txt")
		
		#set data to datagridview
		i=0
		val=result.split("\r\n")
		for v in val:
			if v is None:
				break
			if v=="":
				break

			#make regexp to replace heaer name
			rev=re.sub(r"field.+=","",v)
			
			self._dgvf.Rows.Add()
			self._dgvf.Rows[i].Cells[0].Value=rev
			i+=1
		
		pass
	def BtnSavClick(self, sender, e):
		#load file body
		file=modFile.modFile()
		result=file.readfile("teamdata.txt")
		
		#add schedule date to origin data
		line=result.split("\r\n")
		fbody=""
		for v in line:
			if ("team"+str(self.teamindex)) in v:
				#only get data
				data=v.split("-")
				
				fbody+=data[0]
				fbody+=self._lblDate.Text
			else:
				fbody+=v
			fbody+="\r\n"
		
		#write file body		
		file.writefile("teamdata.txt",fbody)
		
		pass
Exemplo n.º 8
0
	def FrmTeamLoad(self, sender, e):
		#load file body
		file=modFile.modFile()
		result=file.readfile("teamdata.txt")
		
		#set data to datagridview
		i=0
		val=result.split("\r\n")
		for v in val:
			if v is None:
				break
			if v=="":
				break

			#make regexp to replace head, and formated data
			v=re.sub(r"team.+=","",v)
			vd=v.split('-')
			va0=vd[0].split(',')

			#add data to datagridview
			self._dgvt.Rows.Add()
			if va0[1]!="":
				for j in range(4):	
					if j==0:
						if va0[j]=="1":
							self._dgvt.Rows[i].Cells[j].Value=True
						elif va0[j]=="0":
							self._dgvt.Rows[i].Cells[j].Value=False
					else:
						self._dgvt.Rows[i].Cells[j].Value=va0[j]
			
				self._dgvt.Rows[i].Cells[4].Value=vd[1]
			
			i+=1
			
		pass
	def loadbaseinfo(self,type=0):
		#load file body
		file=modFile.modFile()
		result=file.readfile("fielddata.txt")
		
		#made field array
		self.field=range(100)
		for i in range(100):
			self.field[i]=modPublic.sfield()
			for j in range(100):
				self.field[i].teamA[j]=range(14)
				self.field[i].teamB[j]=range(14)
				
		#add field data to origin data
		line=result.split("\r\n")
		i=0
		for v in line:
			v=re.sub(r"field.+=","",v)
			self.field[i].name=v.encode("big5")
			if self.field[i].name!="":
				i+=1
		#if type is 0 then this is a all export
		#if type is 1 then this is a professional contest export
		#if type is 2 then this is a gernel contest export
		if type==0:
			self.field_count=i
		elif type==1:
			self.field_count=i-1
		elif type==2:
			self.field_count=1
			t=self.field[i-2].name
			self.field[0].name=self.field[i-2].name
			self.field[0].name=t
		elif type>=3:
			self.field_count=1
			t=self.field[0].name
			self.field[0].name=self.field[0].name
			self.field[0].name=t
		
		
		#load file body
		file=modFile.modFile()
		result=file.readfile("teamdata.txt")
		
		#made team struct and array
		self.team=range(100)
		for i in range(100):
			self.team[i]=modPublic.steam()
		
		#add team data to origin data
		line=result.split("\r\n")
		i=0
		for v in line:
			if v is None:
				break
			if v=="":
				break
			
			v=re.sub(r"team.+=","",v)
			vd=v.split('-')
			va0=vd[0].split(',')
			va1=vd[1].split(',')
			
			#class team
			if type==0 or (type==1 and (va0[2].encode("big5")=="龍組".encode("big5") or va0[2].encode("big5")=="馬組".encode("big5"))) or (type==2 and (va0[2].encode("big5")=="健康組".encode("big5") or va0[2].encode("big5")=="快樂組".encode("big5"))) or (type==3 and va0[2].encode("big5")=="龍組".encode("big5")) or (type==4 and va0[2].encode("big5")=="馬組".encode("big5")) or (type==5 and va0[2].encode("big5")=="健康組".encode("big5")) or (type==6 and va0[2].encode("big5")=="快樂組".encode("big5")):
				self.team[i].ingame=va0[0]
				self.team[i].name=va0[1].encode("big5")
				self.team[i].field=va0[2].encode("big5")
				self.team[i].good=va0[3].encode("big5")
				for j in range(100):
					if j<len(va1)-1:	#need subtract one, because date value will have one blank data.
						self.team[i].schedule[j]=va1[j]
					else:
						break
				i+=1
		self.team_count=i
		
		
		#load file body
		file=modFile.modFile()
		result=file.readfile("datedata.txt")
		
		v=result.split('/')
		self.begin_year=v[0]
		self.begin_month=v[1]
		self.begin_day=v[2]
		
		
		#load file body
		file=modFile.modFile()
		result=file.readfile("countdata.txt")
		
		self.count=int(result)