Esempio n. 1
0
    def on_release(self):
        app = App.get_running_app()
        Thread(target=app.data_manager.get_potential_collisions,
               args=(
                   app.data_manager.collision_forecaster.
                   get_potential_collisions_from_airport,
                   (self.lat, self.lon),
               )).start()

        airplane_status_message = f"ICAO Code:          {self.data[0]:>20}\n" \
                                  f"IATA Code:          {self.data[1] if self.data[1] is not None else 'None':>20}\n" \
                                  f"Airport Name:       {self.data[2] if self.data[2] is not None else 'None':>20}\n" \
                                  f"City/Town:          {self.data[4] if self.data[4] is not None else 'None':>20}\n" \
                                  f"Country:            {self.data[5] if self.data[5] is not None else 'None':>20}\n" \
                                  f"Latitude Degrees:   {self.data[6] if self.data[6] is not None else 'None':>20}\n" \
                                  f"Latitude Minutes:   {self.data[7] if self.data[7] is not None else 'None':>20}\n" \
                                  f"Latitude Seconds:   {self.data[8] if self.data[8] is not None else 'None':>20}\n" \
                                  f"Latitude Direction: {self.data[9] if self.data[9] is not None else 'None':>20}\n" \
                                  f"Longitude Degrees:  {self.data[10] if self.data[10] is not None else 'None':>20}\n" \
                                  f"Longitude Minutes:  {self.data[11] if self.data[11] is not None else 'None':>20}\n" \
                                  f"Longitude Seconds:  {self.data[12] if self.data[12] is not None else 'None':>20}\n" \
                                  f"Longitude Direction:{self.data[13] if self.data[13] is not None else 'None':>20}\n" \
                                  f"Altitude:           {self.data[14] if self.data[14] is not None else 'None':>20}\n" \
                                  f"Lat Decimal Degrees:{self.data[15] if self.data[15] is not None else 'None':>20}\n" \
                                  f"Lon Decimal Degrees:{self.data[16] if self.data[16] is not None else 'None':>20}\n"
        show_message_popup(airplane_status_message, height_hint=0.75)
    def on_release(self):
        app = App.get_running_app()
        Thread(target=app.data_manager.get_potential_collisions,
               args=(
                   app.data_manager.collision_forecaster.
                   get_potential_collisions_from_plane,
                   self.data[0],
               )).start()

        #potential_collisions = App.get_running_app().data_manager.collision_forecaster.get_potential_collisions_from_plane(
        #self.data[0])

        print(self.data[0])
        airplane_status_message =   f"ICAO 24:        {self.data[0]:>20}\n" \
                                    f"Baro Altitude:  {self.data[1] if self.data[1] is not None else 'None':>20}\n" \
                                    f"Call Sign:      {self.data[2] if self.data[2] is not None else 'None':>20}\n" \
                                    f"Geo Altitude:   {self.data[3] if self.data[3] is not None else 'None':>20}\n" \
                                    f"Heading:        {self.data[4] if self.data[4] is not None else 'None':>20}\n" \
                                    f"Last Contact:   {self.data[5] if self.data[5] is not None else 'None':>20}\n" \
                                    f"Latitude:       {self.data[6] if self.data[6] is not None else 'None':>20}\n" \
                                    f"Longitude:      {self.data[7] if self.data[7] is not None else 'None':>20}\n" \
                                    f"On Ground:      {self.data[8] if self.data[8] is not None else 'None':>20}\n" \
                                    f"Origin Country: {self.data[9] if self.data[9] is not None else 'None':>20}\n" \
                                    f"Position Source:{self.data[10] if self.data[10] is not None else 'None':>20}\n" \
                                    f"Sensors:        {self.data[11] if self.data[11] is not None else 'None':>20}\n" \
                                    f"SPI:            {self.data[12] if self.data[12] is not None else 'None':>20}\n" \
                                    f"Squawk:         {self.data[13] if self.data[13] is not None else 'None':>20}\n" \
                                    f"Time Position:  {self.data[14] if self.data[14] is not None else 'None':>20}\n" \
                                    f"Velocity:       {self.data[15] if self.data[15] is not None else 'None':>20}\n" \
                                    f"Vertical Rate:  {self.data[16] if self.data[16] is not None else 'None':>20}\n"
        show_message_popup(airplane_status_message, height_hint=0.75)
Esempio n. 3
0
 def on_release(self):
     # Open up the LocationsPopupMenu
     airplane_status_message = f"Collision ICAO 24:      {self.data[0]:>20}\n" \
                               f"Collision Latitude:     {self.data[1][0] if self.data[1][0] is not None else 'None':>20}\n" \
                               f"Collision Longitude:    {self.data[1][1] if self.data[1][1] is not None else 'None':>20}\n"
     show_message_popup(airplane_status_message,
                        height_hint=0.5,
                        width_hint=0.5)
 def toggle_airplanes(self):
     """
     Allows the application to add the airplanes found within the field of view.
     :return: None
     """
     if self.locations_map.show_airplanes:
         self.locations_map.show_airplanes = False
     else:
         if self.locations_map.zoom > 5:
             self.locations_map.show_airplanes = True
             self.locations_map.start_getting_locations_in_fov()
         else:
             self.btn_toggle_airplanes.state = 'normal'
             show_message_popup("Zoom level must be greater than 5.")
    def log_in(self):
        username = self.username_input.text
        password = self.password_input.text

        if username == '':
            show_message_popup('Username is required')
        else:
            BASE_DIR = os.path.dirname(os.path.abspath(__file__))

            db_path = os.path.join(BASE_DIR, "..", "DATA",
                                   "AIRCRAFT_COLLISION_FORECAST_SYSTEM.db")
            users_connection = sqlite3.connect(db_path)
            users_cursor = users_connection.cursor()
            query = f"SELECT PASSWORD FROM USER_CREDENTIALS WHERE USERNAME = '******'"
            users_cursor.execute(query)
            result = users_cursor.fetchall()
            users_connection.close()

            if result == []:
                show_message_popup('Invalid username')
            else:
                if password == result[0][0]:
                    self.login_window.dismiss()
                    self.app.data_manager = DataManager(
                        airport_id_index=2,
                        airplane_id_index=0,
                        username='******',
                        password='******')
                    Thread(target=self.app.data_manager.load_airports).start()
                else:
                    show_message_popup('Invalid password')