Exemple #1
0
	storage = permanence.localStorage()
	running = False
	def __init__(self,sM):
		self.running = False
		self.dir_opt = options = {}
		self.serverManager = sM
		self.paths = self.storage.read("paths")
		self.serverManager.grabStorage(self.storage)
		if (self.paths != []):
			self.serverManager.setPath(self.paths)
			print self.paths
			
		#update check on launch
		update = permanence.checkUpdate()
		if (update != False):
			if (tkMessageBox.askyesno("Download Update?",update[0])):
				webbrowser.open_new(update[1])
				
		#webbrowser.open_new('http://'+self.hostname+':8000/settings')
		thread = openBrowserThread(self.hostname)
		thread.start()
		#webbrowser.open('http://'+self.hostname+':8000/settings',new=1,autoraise=True)
		self.serverManager.run()
		print 'goodbye'
		
		
			

ServerLauncher(serverCore.serverManager())

	def onStop(self):
		if self.running:
			self.serverManager.stop()
			self.status_l1["text"] = "Server Stopped at:"
			self.status_l2["fg"] = "gray"
			self.button_stopServer["text"] = "Start Server"
			self.running = False
		else:
			if (self.path != " "*80):
				self.status_l1["text"] = "Server Running at:"
				self.status_l2["fg"] = "black"
				self.button_stopServer["text"] = "Stop Server"
				self.button_stopServer["state"] = tk.DISABLED
				self.button_refreshShows["state"] = tk.DISABLED
				self.button_directory["state"] = tk.DISABLED
				self.button_stopServer["fg"] = "red"
				self.running = True
				#self.master.wm_state('iconic')
				self.master.update_idletasks()
				time.sleep(4)
				self.master.iconify()
				self.serverManager.run()
			else:
				tkMessageBox.showinfo("No Path Set","Please set the location for your videos by clicking 'Browse'.")
	
#tkinter doesn't thread well...twisted doesn't thread well. Bugger.


root = ServerGUI(serverCore.serverManager())
root.master.title("VidiiU Streamer [Beta]")
root.mainloop()