import gtk

import sys
import os
import time



from widget.fenetre_prin import fenetreprincipal
from Lanceur import lanceur

class umitprincipal(fenetreprincipal):
	def __init__(self):
		fenetreprincipal.__init__(self)
		self.vbox  = gtk.VBox()
class main(umitprincipal):
	def __init__(self):

                imgdebut = lanceur()


		umitprincipal.__init__(self)
                
		self.set_title("clauzan pentesting")
		self.set_default_size(600,650)
		self.set_position(gtk.WIN_POS_CENTER)
		imgdebut.status(("lancement..."))
		time.sleep(1)
		self.add(self.vbox)

		imgdebut.status(("creation du menu..."))
		time.sleep(1)
		imgdebut.status(("verification du systeme"))
		time.sleep(1)
		self.menu()

		imgdebut.status(("initialisation des outils"))
		time.sleep(1)

                imgdebut.status(("configuration terminee. enjoy"))
		time.sleep(1)
		self.notebook()
		self.connect('delete_event',self.quitter)
	

		self.show_all()
		imgdebut.destroy()
	        gtk.main()
	
	def menu(self):
		menu = gtk.MenuBar()

		itemenu = gtk.Menu()
		itemenu1 = gtk.Menu()
		nomitem = gtk.MenuItem("aide")
		nomitem1 = gtk.MenuItem("outils")
		nomitem.set_submenu(itemenu)
		nomitem1.set_submenu(itemenu1)

		agr = gtk.AccelGroup()
		self.add_accel_group(agr)

		exit = gtk.ImageMenuItem(gtk.STOCK_ABOUT,agr)
		key, mod = gtk.accelerator_parse("<control>Q")
		exit.add_accelerator("activate",agr,key,mod,gtk.ACCEL_VISIBLE)
		exit.connect("activate",self.apropos)
	        aide = gtk.MenuItem("sommaire")
		manuel = gtk.MenuItem("manuel utilisateur")
		
                  
		itemenu.append(aide)
		itemenu.append(manuel)


		itemenu.append(exit)

	        menu.append(nomitem1)
		menu.append(nomitem)

		self.vbox.pack_start(menu,False,False,0)
		menu.show_all()
	def apropos(self,widget):
		img = gtk.gdk.pixbuf_new_from_file("clauzanpentest.png")
		boite  = gtk.AboutDialog()
		boite.set_icon_from_file("clauzanpentest.png")
		boite.set_name("clauzan Pentesting")
		boite.set_version("1.0")
		boite.set_copyright("copyright 2014, tous droits reserves")
		boite.set_comments(boite.get_name() + " " +
		boite.get_version() +" est un logiciel de pentesting " )
		boite.set_license("copyright 2014 \n ce programme est un logiciel libre;\n vous pouvez le redistribuer et le modifier selon les termes dela licence\n GNU General Public License publie par le Free software Foundation version 2 \n de cette license")
		auteur = ["EMBANOHO MANENG SINCLAIR ERC\n sinclaireric60@yahoo.fr\n+23776013924"]
		boite.set_authors(auteur)
		boite.set_logo(img)
		reponse = boite.run()
		boite.destroy()

	def notebook(self):
		table = gtk.Table(3,6,False)
		self.vbox.pack_start(table,False,False,0)

		notebook = gtk.Notebook()
		notebook.set_tab_pos(gtk.POS_TOP)
		table.attach(notebook,0,6,0,1)
		notebook.show()
		show_tabs = True
		show_border = True

		onglet1 = "scan de machines"
		frame1 = gtk.Frame(onglet1)
		bouton = gtk.Button("voir")
		bouton.show()
                nom = "scanning"

		frame1.set_border_width(16)
		frame1.set_size_request(100,75)
		frame1.show()

		label1 = gtk.Label(nom)

		onglet2 = "wireless hack"
		frame2 = gtk.Frame(onglet2)
                nom1 = "wireless "

		frame2.set_border_width(16)
		frame2.set_size_request(100,75)
		frame2.show()

		label2 = gtk.Label(nom1)

	
		

		notebook.append_page(bouton,label1)
                notebook.append_page(frame2,label2)
		notebook.set_current_page(0)
	
	def quitter(self,widget,event,data=None):

		msg =("voulez vous vraiment quitter?")
		dlg = gtk.MessageDialog(None,gtk.DIALOG_MODAL,gtk.MESSAGE_QUESTION,gtk.BUTTONS_YES_NO, msg)
		opt =dlg.run()
		dlg.destroy()

		if opt != gtk.RESPONSE_YES:
			return True
		if opt == gtk.RESPONSE_YES:
			gtk.main_quit()
		

		

if __name__ == '__main__':
	w = main()

