def action(self): if self.points is None: messagebox.showerror( title="No points", message="No points loaded! Please load points first.") return loading_screen = LoadingScreen(self.window, "Inserting to database", "Initializing...") loading_screen.set_message( "Inserting points to relational database...") relational_data = rp_repository.insert_points(self.points) loading_screen.set_message("Points inserted to relational database.") loading_screen.set_progress_value(33.33) loading_screen.set_message( "Inserting points to spatial Core database...") spatial_core_data = scp_repository.insert_points(self.points) loading_screen.set_message("Points inserted to spatial Core database.") loading_screen.set_progress_value(66.66) loading_screen.set_message( "Inserting points to spatial PostGIS database...") spatial_postgis_data = spp_repository.insert_points(self.points) loading_screen.set_message( "Points inserted to spatial PostGIS database.") loading_screen.set_progress_value(100.0) loading_screen.set_message("Done.") loading_screen.close() self.change_active_dataset() self.show_statistics(self.title, relational_data, spatial_core_data, spatial_postgis_data)
def action(self): try: bottom_left_corner = (float(self.x_var.get()), float(self.y_var.get())) width = float(self.width_var.get()) height = float(self.height_var.get()) angle = float(self.angle_var.get()) step = float(self.step_var.get()) except InvalidInputException as e: messagebox.showerror(title="Invalid input", message=str(e)) self.reset_inputs() return except Exception: messagebox.showerror( title="Invalid input", message= "'x', 'y', 'width', 'height', 'angle' and 'step' must be floats" ) self.reset_inputs() return loading_screen = LoadingScreen(self.window, "Updating database", "Initializing...") loading_screen.set_message("Updating points in relational database...") relational_data = rp_repository.update_points_in_rotated_rectangle( bottom_left_corner, width, height, angle, step) loading_screen.set_message("Points updated in relational database.") loading_screen.set_progress_value(33.33) loading_screen.set_message( "Updating points in spatial Core database...") spatial_core_data = scp_repository.update_points_in_rotated_rectangle( bottom_left_corner, width, height, angle, step) loading_screen.set_message("Points updated in spatial Core database.") loading_screen.set_progress_value(66.66) loading_screen.set_message( "Updating points in spatial PostGIS database...") spatial_postgis_data = spp_repository.update_points_in_rotated_rectangle( bottom_left_corner, width, height, angle, step) loading_screen.set_message( "Points updated in spatial PostGIS database.") loading_screen.set_progress_value(100.0) loading_screen.set_message("Done.") loading_screen.close() self.show_statistics(self.title, relational_data, spatial_core_data, spatial_postgis_data)
def action(self): try: center = (float(self.center_x_var.get()), float(self.center_y_var.get())) radius = float(self.radius_var.get()) except InvalidInputException as e: messagebox.showerror(title="Invalid input", message=str(e)) self.reset_inputs() return except Exception: messagebox.showerror( title="Invalid input", message="'center x', 'center y' and 'radius' must be floats") self.reset_inputs() return loading_screen = LoadingScreen(self.window, "Deleting from database", "Initializing...") loading_screen.set_message( "Deleting points from relational database...") relational_data = rp_repository.delete_points_in_circle(center, radius) loading_screen.set_message("Points deleted from relational database.") loading_screen.set_progress_value(33.33) loading_screen.set_message( "Deleting points from spatial Core database...") spatial_core_data = scp_repository.delete_points_in_circle( center, radius) loading_screen.set_message( "Points deleted from spatial Core database.") loading_screen.set_progress_value(66.66) loading_screen.set_message( "Deleting points from spatial PostGIS database...") spatial_postgis_data = spp_repository.delete_points_in_circle( center, radius) loading_screen.set_message( "Points deleted from spatial PostGIS database.") loading_screen.set_progress_value(100.0) loading_screen.set_message("Done.") loading_screen.close() self.show_statistics(self.title, relational_data, spatial_core_data, spatial_postgis_data)