def Create_box_modification(self): sev = DB.Convert_Data(self.DB.GET_severity()) typ = DB.Convert_Data(self.DB.GET_type()) tim = DB.Convert_Data(self.DB.GET_timezone()) air = DB.Convert_Data(self.DB.GET_airport()) self.StartTime = tk.Entry(self.window) self.EndTime = tk.Entry(self.window) self.col_severity = ttk.Combobox(self.window, values=sev) self.col_typ = ttk.Combobox(self.window, values=typ) self.col_tim = ttk.Combobox(self.window, values=tim) self.col_air = ttk.Combobox(self.window, values=air) self.StartTime.insert(0, str(self.info[0])) self.EndTime.insert(0, str(self.info[1])) self.col_severity.current(int(self.info[6])) self.col_typ.current(int(self.info[7])) self.col_tim.current(int(self.info[8])) self.col_air.current(int(self.info[9])) self.StartTime.grid(row=1, column=2) self.EndTime.grid(row=2, column=2) self.col_tim.grid(row=3, column=2) self.col_severity.grid(row=4, column=2) self.col_typ.grid(row=5, column=2) self.col_air.grid(row=6, column=2) tk.Button(self.window, text='Modification', command=self.MODIFY).grid(row=8, column=1, sticky=tk.W, pady=4)
def Create_Box(self): # Import Data Categorie sev = DB.Convert_Data(self.DB.GET_severity()) typ = DB.Convert_Data(self.DB.GET_type()) tim = DB.Convert_Data(self.DB.GET_timezone()) air = DB.Convert_Data(self.DB.GET_airport()) # Create Boxes self.StartTime = tk.Entry(self.window) self.EndTime = tk.Entry(self.window) self.col_severity = ttk.Combobox(self.window, values=sev) self.col_typ = ttk.Combobox(self.window, values=typ) self.col_tim = ttk.Combobox(self.window, values=tim) self.col_air = ttk.Combobox(self.window, values=air)
def Ploter(): Lat_Long = [] for i in DB.DATABASE().GET_airport(): Lat_Long.append(i[1:4]) Data = pandas.DataFrame(numpy.array(Lat_Long), columns=['Code', 'Lat', 'Lng']) fig = go.Figure() fig.add_trace( go.Scattergeo(locationmode='USA-states', lon=Data['Lng'], lat=Data['Lat'], hoverinfo='text', text=Data['Code'], mode='markers', marker=dict(size=5, color='rgb(255, 0, 0)'))) fig.update_layout(title_text=' Visualisation des Airoports ', showlegend=True, geo=dict( scope='usa', showland=True, landcolor='rgb(0, 0, 0)', countrycolor='rgb(204, 204, 204)', )) fig.show() fig.write_image("plot.png")
def MODIFY(self): if DB.Validation_Date( self.StartTime.get()) == 1 and DB.Validation_Date( self.EndTime.get()): ST = DB.Correction_Date(self.StartTime.get()) ET = DB.Correction_Date(self.EndTime.get()) query = " UPDATE Event_ SET StartTime = '" + str( ST) + "' , EndTime = '" + str(ET) + "' , SeverityID = '" + str( self.col_severity.current()) + "' ,TypeID = '" + str( self.col_typ.current()) + "' ,TimeZoneID = '" + str( self.col_tim.current() ) + "' ,AirportID = '" + str(self.col_air.current( )) + "' where EventID = " + str(self.ID) + ";" self.DB.Run_Query(query) self.CALL_Principal() else: tk.messagebox.showinfo(" Echec ", " La Date saisie est erronée ")
def Insertion_DB(self): if DB.Validation_Date( self.StartTime.get()) == 1 and DB.Validation_Date( self.EndTime.get()): ST = DB.Correction_Date(self.StartTime.get()) ET = DB.Correction_Date(self.EndTime.get()) new_id = self.DB.GET_new_index_event() query = "INSERT INTO Event_(EventID , StartTime , EndTime , SeverityID , TypeID ,TimeZoneID ,AirportID ) VALUES (" + str( new_id) + ", '" + str(ST) + "', '" + str(ET) + "', '" + str( self.col_severity.current()) + "', '" + str( self.col_typ.current()) + "','" + str( self.col_tim.current()) + "','" + str( self.col_air.current()) + "');" self.DB.Run_Query(query) self.window.destroy() new_window = tk.Tk() Modif(new_window, new_id) else: tk.messagebox.showinfo(" Echec", " La Date saisie est erronée ")
def __init__(self, fenetre, ID): self.window = fenetre self.window.geometry("500x200") self.window.title(' Projet GLPOO') self.DB = DB.DATABASE() self.ID = ID self.info = self.DB.GET_data_by_ID(self.ID)[0] self.Tableau() self.Print_Ligne() self.Create_BOX_Delete() self.Create_box_modification()
def __init__(self, fenetre): self.window = fenetre self.window.geometry("400x200") self.window.title(' Projet GLPOO') self.DB = DB.DATABASE() self.Create_Label() self.Create_Box() self.Select() self.GRID() tk.Button(self.window, text='Insertion', command=self.Insertion_DB).grid(row=8, column=1, sticky=tk.W, pady=4)