예제 #1
0
    def update_flights_list(self):
        '''
            Met à jour la liste des avions par rapport aux fichiers contenu
            dans le dossier flightslog
        '''
        self.flights_list.clear()
        flights_path = []

        for flight_file in glob.glob('{}*{}'.format(config.flightslog_folder,
                                                    config.flights_ext)):
            flights_path.append(flight_file)

        for flight_doc in flights_path:
            flight = Flight()
            plane = Plane()

            flight.import_flight(flight_doc)

            total_hours = flight.calc_total_hours()

            # On vérifie que l'avion existe bien (bug remonté par WinXaito)
            if os.path.isfile(flight.plane):
                plane.import_plane(flight.plane)
                self.flights_list.append([flight.date, plane.matriculation,
                                         flight.type, total_hours])
            else:
                self.flights_list.append([flight.date, 'UKNOWN',
                                         flight.type, total_hours])
예제 #2
0
    def on_save_clicked(self, button):
        '''
            Enregistre toutes les valeurs
        '''
        values = []
        values.append(self.save_date(self.date))
        values.append(self.save_plane(self.plane_chooser))
        values.append(self.role.get_active_id())
        values.append(self.type.get_text())

        values.append(self.members_day.get_active())
        values.append(self.members_hours.get_value_as_int())
        values.append(self.members_minutes.get_value_as_int())

        values.append(self.single_day.get_active())
        values.append(self.single_double.get_active())
        values.append(self.single_hours.get_value_as_int())
        values.append(self.single_minutes.get_value_as_int())

        values.append(self.multi_day.get_active())
        values.append(self.multi_double.get_active())
        values.append(self.multi_captain.get_active())
        values.append(self.multi_hours.get_value_as_int())
        values.append(self.multi_minutes.get_value_as_int())

        values.append(self.ifr_double.get_active())
        values.append(self.ifr_hours.get_value_as_int())
        values.append(self.ifr_minutes.get_value_as_int())

        values.append(self.simu_hours.get_value_as_int())
        values.append(self.simu_minutes.get_value_as_int())

        values.append(self.ifr_arrivals.get_value_as_int())

        start_iter = self.observations.get_start_iter()
        end_iter = self.observations.get_end_iter()
        values.append(self.observations.get_text(start_iter, end_iter, True))

        values.append(self.takeoff.get_value_as_int())
        values.append(self.landing.get_value_as_int())
        values.append(self.departure.get_text())
        values.append(self.arrival.get_text())

        start_iter = self.comments.get_start_iter()
        end_iter = self.comments.get_end_iter()
        values.append(self.comments.get_text(start_iter, end_iter, True))

        flight = Flight(values)
        flight.save_flight()

        self.app_quit()
예제 #3
0
 def import_flightlog(self, flight_path):
     flight = Flight()
     flight.import_flight(flight_path)
예제 #4
0
    def import_flight(self, flight_path):
        '''
            Importe un vol dans la fenêtre
        '''
        flight = Flight()
        flight.import_flight(flight_path)

        year, month, day = flight.date.split('-')

        self.date.select_day(int(day))
        self.date.select_month(int(month) - 1, int(year))


        self.role.set_active_id(flight.role)

        # On vérifie que l'avion existe bien (bug remonté par WinXaito)
        if os.path.isfile(flight.plane):
            plane = Plane()
            plane.import_plane(flight.plane)
            self.plane_chooser.set_active_id(plane.matriculation)

        self.type.set_text(flight.type)

        # Membres d'équipage
        self.members_night.set_active(not flight.members_day)
        self.members_hours.set_value(flight.members_hours)
        self.members_minutes.set_value(flight.members_minutes)

        # Pilote monomoteur
        self.single_night.set_active(not flight.single_engine_day)
        self.single_captain.set_active(not flight.single_engine_double)
        self.single_hours.set_value(flight.single_engine_hours)
        self.single_minutes.set_value(flight.single_engine_minutes)

        # Pilote multimoteurs
        self.multi_night.set_active(not flight.multi_engines_day)
        if flight.multi_engines_double:
            self.multi_double.set_active(True)
        elif flight.multi_engines_captain:
            self.multi_captain.set_active(True)
        else:
            self.multi_copilot.set_active(True)
        self.multi_hours.set_value(flight.multi_engines_hours)
        self.multi_minutes.set_value(flight.multi_engines_minutes)

        # IFR
        self.ifr_captain.set_active(not flight.ifr_double)
        self.ifr_hours.set_value(flight.ifr_hours)
        self.ifr_minutes.set_value(flight.ifr_minutes)

        # Autres
        self.simu_hours.set_value(flight.simulation_hours)
        self.simu_minutes.set_value(flight.simulation_minutes)
        self.ifr_arrivals.set_value(flight.ifr_arrivals)

        # Commentaires
        self.observations.set_text(flight.observations)

        self.takeoff.set_value(flight.takeoff)
        self.landing.set_value(flight.landing)
        self.departure.set_text(flight.departure)
        self.arrival.set_text(flight.arrival)
        self.comments.set_text(flight.comments)

        self.dialog.set_title(text.edit_flight.format(day, month, year))