1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
| #!/usr/bin/python
# -*- coding: iso-8859-1 -*-
##### Librairies
import wx #Permet d'accéder au wxWidgets (Interface graphique)
import readstock #Permet d'ouvrir et de lire un fichier
import locate_PC #Permet de localiser un PC
import decrypt #Permet d'acceder à la fonction de decryptage
import openwrite #Permet d'ouvrir et de sauvegarder dans un fichier
import readstock #Permet de lire et stocker dans une variable a partir d'un fichier
import affichage #Permet d'afficher le résultat de la recherche
import autoscr #Permet d'avoir accés à la fonction pour resolution écran
import autoscrx #Permet d'avoir accés à la fonction pour resolution écran pour largeur ecran
import autoscry #Permet d'avoir accés à la fonction pour resolution écran pour hauteur ecran
#####
class MaFenetre(wx.Dialog):
def __init__(self, titre):
wx.Dialog.__init__(self, None, -1, title = titre, pos = (autoscrx.Screenauto(autoscrx.Screenauto(0)/2+100),autoscry.Screenauto(autoscry.Screenauto(0)/2+50)))
sizer0 = wx.BoxSizer(wx.VERTICAL)
sizer1 = wx.BoxSizer(wx.HORIZONTAL)
panneau = wx.Panel(self, -1)
# Zone de text et bouton définis
self.text = wx.TextCtrl(panneau, -1) # Entrer du nom réseau ou de l'adresse IP
bouton = wx.Button(panneau, -1, "Valider")
# Text statique
self.pretext = wx.StaticText(panneau, 1, " IP ou nom réseau : ", style = wx.ALIGN_CENTER)
# Placer graphique de ces zones
sizer1.Add(self.pretext, 0, wx.ALIGN_CENTER)
sizer1.Add(self.text, 0, wx.ALIGN_CENTER)
sizer1.Add(bouton, 0, wx.ALIGN_CENTER)
panneau.SetSizer(sizer1)
sizer0.Add(panneau, 0)
self.SetSizer(sizer0)
self.Fit()
self.Bind(wx.EVT_BUTTON, self.OnClick, bouton)
def OnClick(self, event):
adr = self.text.GetValue()
self.Destroy()
#Ici je voudrais réutilisé ma self2, ma self de la fenêtre de départ mais j'ai pas su faire.Est ce possible? D'ou mon essai avec deux codes.
####################################### Lecture et stockage des fichiers dans une variable
# password1 = readstock.gooff("vartemp.txt")
# password2 = readstock.gooff("vartemp2.txt")
#######################################
# password1 = decrypt.Decrypt(password1) #Decryptage du mdp
# password2 = decrypt.Decrypt(password2) #Decryptage du mdp
###################################### Lancement localisation d'un PC
# result = locate_PC.locate(adr_eq, password1, password2)
######################################
# openwrite.goon("Tempafffinal_locate_PC.txt",result)
######################################
# self2.count = self2.count +1 #Test
# self2.gauge.SetValue(self2.count) #Test
################ Affichage résultat
# affichage.Resul()
class MonApp2(wx.App):
def OnInit(self):
fen = MaFenetre("Adresse IP ou nom de l'equipement : ")
fen.Show(True)
self.SetTopWindow(fen)
return True
def dem(self2):
########## Bar de progression
self2.count = 0 #Test augmentation barre init bar
self2.pretext1 = wx.StaticText(self2.scrollPane, 1, "Barre de progression", pos = (0,autoscry.Screenauto(290)), style = wx.ALIGN_CENTER)
## Bar de prog sous total
self2.pretext2 = wx.StaticText(self2.scrollPane, 1, "Sous total :", pos = (0,autoscry.Screenauto(275)), style = wx.ALIGN_CENTER)
self2.gauge = wx.Gauge(self2.scrollPane, -1, pos = (0,autoscry.Screenauto(250)), size = (autoscrx.Screenauto(0),50))
##
## Bar de prog total
self2.pretext3 = wx.StaticText(self2.scrollPane, 1, "Total :", pos = (0,autoscry.Screenauto(175)), style = wx.ALIGN_CENTER)
self2.gauge2 = wx.Gauge(self2.scrollPane, -1, pos = (0,autoscry.Screenauto(150)), size = (autoscrx.Screenauto(0),50))
##########
##### Lancement fenêtre de demande IP
app = MonApp2()
app.MainLoop()
##### |
Partager