示例#1
0
	def infopopup(self,event):
		index = int(self.listbox.curselection()[0])
		votearr = []
		parsevote.returnvotes(votearr,datadir)
		text1 = votearr[index].parl + '-' + votearr[index].ses + ' ' + votearr[index].vote + '\n'
		text2 = 'Title: ' + votearr[index].bill + ' ' + votearr[index].title + '\n'
		text3 = 'Description: ' + votearr[index].description + '\n'
		text4 = 'Decision: ' + votearr[index].decision

		self.mylabel.configure(text=text1+text2+text3+text4)
		self.top.geometry('+%d+%d' %(self.listbox.winfo_rootx()+50,self.listbox.winfo_rooty()-50))
		self.top.deiconify()
示例#2
0
	def refresh_list(self):
		"""
		Refresh the list of possible votes
		"""
		listarr = []
		parsevote.returnvotes(listarr,datadir)
		self.listbox.delete(0, Tkinter.END)
		#print listarr[1].vote

		for item in listarr:
			if item.bill is "":
				item.bill = "N/A"
			self.listbox.insert(Tkinter.END, item.vote+" - Bill "+item.bill)
示例#3
0
	def vote(self,myvote):
		votename = 'votes.dat'

		try:
#Need to catch exceptions here! Otherwise it will call parsevote.writevote with a bad index and KILL EVERYTHING
			index = int(self.listbox.curselection()[0])
#Use this index to pick out which of the sessions we're in
			votearr = []
			parsevote.returnvotes(votearr,datadir)
			parsevote.writevote(votearr[index],myvote,datadir,votename)
		except IndexError:
			pass

		self.refresh_list()
示例#4
0
	def launchVotes(self):
		index = int(self.listbox.curselection()[0])
		votearr = []
		parsevote.returnvotes(votearr,datadir)
		url = "http://openparliament.ca/bills/votes/%(parliamentnum)s-%(sessnum)s/%(votenum)s/" % {'parliamentnum' : votearr[index].parl, 'sessnum' : votearr[index].ses, 'votenum' : votearr[index].vote}
		webbrowser.open_new_tab(url)
示例#5
0
	def launchBill(self):
		index = int(self.listbox.curselection()[0])
		votearr = []
		parsevote.returnvotes(votearr,datadir)
		url = "http://www2.parl.gc.ca/HouseChamberBusiness/Chambervotedetail.aspx?Language=E&Mode=1&Parl=%(parliamentnum)s&Ses=%(sessnum)s&FltrParl=%(parliamentnum)s&FltrSes=%(sessnum)s&vote=%(votenum)s" % {'parliamentnum' : votearr[index].parl, 'sessnum' : votearr[index].ses, 'votenum' : votearr[index].vote}
		webbrowser.open_new_tab(url)