from app.gui.page import Page from app.gui.gui import Gui from .register import register_page from .login import login home = Page("home", title="Accueil") home.append_item(register_page) home.append_item(login) #mode_select_page.set_next(main)
print("Impossible de mettre à jour la location") return False except: db.rollback() Page.wait_input() my_properties = Page("my_properties", title="Gérer mes biens") my_properties.set_main(my_properties_) my_properties.set_next(my_properties) pending_locations = Page("pending_rentals", title="Locations en attente") pending_locations.set_main(waiting_rentals) pending_locations.set_next(pending_locations) rentals_occuring_now = Page("rentals_occuring_now", title="Locations en cours") rentals_occuring_now.set_main(rentals_now) rentals_in_the_past = Page("past_rentals", title="Locations terminées") rentals_in_the_past.set_main(rentals_before) rentals_in_the_future = Page("future_rentals", title="Locations qui vont arriver") rentals_in_the_future.set_main(rentals_future) manage_properties = Page("manage_properties", title="Gérer mes propriétés") manage_properties.append_item(my_properties) manage_properties.append_item(pending_locations) manage_properties.append_item(rentals_occuring_now) manage_properties.append_item(rentals_in_the_past) manage_properties.append_item(rentals_in_the_future)
answers = inquirer.prompt(questions) if "genre" not in answers.keys(): return False fields = {k: v for k, v in answers.items() if v} if len(fields.keys()) <= 0: return False set_query = "SET " for k, v in fields.items(): set_query += "{} = '{}', ".format(k, v) query = "UPDATE personne {} WHERE id = {}".format(set_query[:-2], current_user.id) logging.debug("QUERY: %s", query) cursor = db.cursor() cursor.execute(query) db.commit() if cursor.rowcount > 0: print("Mot de passe mis à jour") else: print("Echec de la mise à jour") Page.wait_input() return True print("Mise à jour de vos donnée personnel effectué avec succès") Page.wait_input() profil_page.append_item(change_data, "Changer nom/prénom/genre ") profil_page.append_item(change_email, "Changer d'email") profil_page.append_item(change_password, "Changer de mot de passe") profil_page.set_next(profil_page)
from app.gui.page import Page from app.gui.gui import Gui from .main import main mode_select_page = Page("User type select") def set_user_mode(mode): g = Gui() g.user_type = mode return True mode_select_page.append_item(lambda : set_user_mode("proprietaire"), "Propriétaire") mode_select_page.append_item(lambda : set_user_mode("locataire"), "Locataire") mode_select_page.set_next(main)
from app.gui.page import Page from app.gui.gui import Gui from app.db.entity_manager import EntityManager from app.entities.personne import Personne from .past_rental import PastRental from .confirmed_rental import ConfirmedRental from .waiting_rental import WaitingRental RentalMenu = Page("MyRentals", title="Mes locations") RentalMenu.append_item(PastRental) RentalMenu.append_item(ConfirmedRental) RentalMenu.append_item(WaitingRental)