diff --git a/README.md b/README.md index 6ffa57a..75e3589 100644 --- a/README.md +++ b/README.md @@ -59,17 +59,17 @@ python scripts/verify_installation.py ### 🖥️ **Running the Desktop Application** ```sh -python src/osbridgelcca/desktop/app.py +python src_web/osbridgelcca/desktop/app.py ``` ### 🌐 **Running the Web Application** #### **Start the Backend Server** ```sh -python src/osbridgelcca/backend/manage.py runserver +python src_web/osbridgelcca/backend/manage.py runserver ``` #### **Start the Frontend** ```sh -cd src/osbridgelcca/web +cd src_web/osbridgelcca/web npm install npm start ``` diff --git a/install.bat b/install.bat index 5a1a326..312ff7a 100644 --- a/install.bat +++ b/install.bat @@ -1,6 +1,13 @@ @echo off echo Creating and activating Conda environment... -call conda activate osbridgelcca || conda create -n osbridgelcca python=3.9 -y && conda activate osbridgelcca + +REM Try activating the environment +call conda activate osbridgelcca 2>nul +if errorlevel 1 ( + echo Environment not found. Creating it now... + call conda create -n osbridgelcca python=3.9 -y + call conda activate osbridgelcca +) echo Installing dependencies from pyproject.toml... pip install . diff --git a/scripts/verify_installation.py b/scripts/verify_installation.py index 9e6afe4..8ceaa8c 100644 --- a/scripts/verify_installation.py +++ b/scripts/verify_installation.py @@ -1,5 +1,6 @@ import importlib import sys +sys.stdout.reconfigure(encoding='utf-8') # List of required packages REQUIRED_PACKAGES = [ diff --git a/src/__init__.py b/src/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/src/osbridgelcca/backend/__init__.py b/src/osbridgelcca/backend/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/src/osbridgelcca/backend/config.py b/src/osbridgelcca/backend/config.py index 5aea750..3d78f4d 100644 --- a/src/osbridgelcca/backend/config.py +++ b/src/osbridgelcca/backend/config.py @@ -1 +1,22 @@ # Placeholder for app configuration + +import os +from pathlib import Path + +# Base directory of the project +BASE_DIR = Path(__file__).resolve().parent.parent.parent + +# Database configuration +DATABASE_URL = os.getenv('DATABASE_URL', f'sqlite:///{BASE_DIR}/data/lcca.db') + +# Create data directory if it doesn't exist +DATA_DIR = BASE_DIR / 'data' +DATA_DIR.mkdir(exist_ok=True) + +# Database configuration options +DB_CONFIG = { + 'pool_size': 5, + 'max_overflow': 10, + 'pool_timeout': 30, + 'pool_recycle': 1800 +} diff --git a/src/osbridgelcca/backend/database.py b/src/osbridgelcca/backend/database.py new file mode 100644 index 0000000..b239887 --- /dev/null +++ b/src/osbridgelcca/backend/database.py @@ -0,0 +1,28 @@ +import os +from sqlalchemy import create_engine +from sqlalchemy.orm import sessionmaker +from sqlalchemy.pool import QueuePool +from .models import Base +from .config import DATABASE_URL, DB_CONFIG + +# Create engine with connection pooling +engine = create_engine( + DATABASE_URL, + poolclass=QueuePool, + **DB_CONFIG +) + +# Create session factory +SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine) + +def get_db(): + """Get database session""" + db = SessionLocal() + try: + yield db + finally: + db.close() + +def init_database(): + """Initialize database tables""" + Base.metadata.create_all(bind=engine) \ No newline at end of file diff --git a/src/osbridgelcca/backend/main.py b/src/osbridgelcca/backend/main.py index daa4a22..d768a4c 100644 --- a/src/osbridgelcca/backend/main.py +++ b/src/osbridgelcca/backend/main.py @@ -1 +1,3 @@ -# Placeholder for Flask API entry point +from osbridgelcca.backend.database import init_database + +init_database() diff --git a/src/osbridgelcca/backend/models.py b/src/osbridgelcca/backend/models.py new file mode 100644 index 0000000..c99a675 --- /dev/null +++ b/src/osbridgelcca/backend/models.py @@ -0,0 +1,92 @@ +from sqlalchemy import create_engine, Column, Integer, Float, String, ForeignKey, DateTime, JSON +from sqlalchemy.ext.declarative import declarative_base +from sqlalchemy.orm import relationship +from datetime import datetime, UTC + +Base = declarative_base() + +class MaterialRate(Base): + """Regional schedule of rates for materials""" + __tablename__ = 'material_rates' + + id = Column(Integer, primary_key=True) + material_name = Column(String(100), nullable=False) + region = Column(String(50), nullable=False) + unit = Column(String(20), nullable=False) + rate = Column(Float, nullable=False) + currency = Column(String, nullable=False) + last_updated = Column(DateTime, default=lambda: datetime.now(UTC)) + +class ScrapValue(Base): + """Scrap values and recyclability percentages""" + __tablename__ = 'scrap_values' + + id = Column(Integer, primary_key=True) + material_name = Column(String(100), nullable=False) + scrap_value = Column(Float, nullable=False) + recyclability_percentage = Column(Float, nullable=False) + currency = Column(String, nullable=False) + last_updated = Column(DateTime, default=lambda: datetime.now(UTC)) + +class EnvironmentalImpact(Base): + """Environmental impact data from EPDs""" + __tablename__ = 'environmental_impacts' + + id = Column(Integer, primary_key=True) + material_name = Column(String(100), nullable=False) + epd_id = Column(String(50), nullable=False) + global_warming_potential = Column(Float, nullable=False) # kg CO2 eq + water_consumption = Column(Float) # m³ + energy_consumption = Column(Float) # MJ + waste_generation = Column(Float) # kg + last_updated = Column(DateTime, default=lambda: datetime.now(UTC)) + +class SocialCostOfCarbon(Base): + """Country-specific social cost of carbon""" + __tablename__ = 'social_cost_of_carbon' + + id = Column(Integer, primary_key=True) + country = Column(String(50), nullable=False) + year = Column(Integer, nullable=False) + cost_per_ton = Column(Float, nullable=False) # USD per ton CO2 + currency = Column(String, nullable=False) + last_updated = Column(DateTime, default=lambda: datetime.now(UTC)) + +class TransportEmissionFactor(Base): + """Road transport carbon emission factors""" + __tablename__ = 'transport_emission_factors' + + id = Column(Integer, primary_key=True) + vehicle_type = Column(String(50), nullable=False) + emission_factor = Column(Float, nullable=False) # kg CO2 per km + load_factor = Column(Float) # Average load factor + last_updated = Column(DateTime, default=lambda: datetime.now(UTC)) + +class VehicleOperationCost(Base): + """Vehicle operation costs""" + __tablename__ = 'vehicle_operation_costs' + + id = Column(Integer, primary_key=True) + vehicle_type = Column(String(50), nullable=False) + fuel_cost_per_km = Column(Float, nullable=False) + maintenance_cost_per_km = Column(Float, nullable=False) + insurance_cost_per_year = Column(Float, nullable=False) + currency = Column(String(3), nullable=False) + last_updated = Column(DateTime, default=lambda: datetime.now(UTC)) + +class UserAnalysis(Base): + """User analyses storage""" + __tablename__ = 'user_analyses' + + id = Column(Integer, primary_key=True) + user_id = Column(String(50), nullable=False) + analysis_name = Column(String(100), nullable=False) + analysis_data = Column(JSON, nullable=False) + created_at = Column(DateTime, default=lambda: datetime.now(UTC)) + updated_at = Column(DateTime, default=lambda: datetime.now(UTC), onupdate=lambda: datetime.now(UTC)) + +def init_db(db_url): + """Initialize the database""" + engine = create_engine(db_url) + Base.metadata.create_all(engine) + return engine \ No newline at end of file diff --git a/src/osbridgelcca/core/__init__.py b/src/osbridgelcca/core/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/src/osbridgelcca/core/bridge_lcc.py b/src/osbridgelcca/core/bridge_lcc.py index 4cb3716..1b9138c 100644 --- a/src/osbridgelcca/core/bridge_lcc.py +++ b/src/osbridgelcca/core/bridge_lcc.py @@ -1,26 +1,84 @@ +import pandas as pd +from input_data import Input +from cost_components import CostComponent +from src.osbridgelcca.core.cost_components import InitialConstructionCost, InitialCarbonEmissionCost, TimeCost, \ + RoadUserCost + + class BridgeLCC: """Main class for handling Life Cycle Cost Analysis of bridges.""" - - def __init__(self, project_name, inputs): + + def __init__(self, project_name: str, inputs: Input): self.project_name = project_name - self.inputs = inputs # Dictionary of user inputs - self.outputs = {} + self.inputs = inputs # Expecting an instance of Input class + self.outputs = {} # Initialize output storage def calculate_lcc(self): """Calculate the total life cycle cost based on input parameters.""" try: - material_cost = sum(self.inputs["bill_of_quantity"].values()) - maintenance_cost = self.inputs["maintenance_cost"] - operation_cost = self.inputs["vehicle_operating_cost"] - discount_rate = self.inputs["discount_rate"] + material_cost = self.inputs.material_data.quantity * self.inputs.material_data.unit_rate + maintenance_cost = self.inputs.maintenance_data.periodic_maintenance_rate + operation_cost = self.inputs.traffic_data.annual_traffic_increase * 5000 # Example formula + discount_rate = self.inputs.finance_data.discount_rate / 100 # Convert percentage to decimal # Simple NPV calculation total_cost = (material_cost + maintenance_cost + operation_cost) / (1 + discount_rate) self.outputs["total_lcc"] = total_cost return total_cost - except KeyError as e: + except AttributeError as e: raise ValueError(f"Missing input parameter: {e}") def get_outputs(self): """Return computed outputs.""" return self.outputs + + def tabulate_cost_components(self): + """Create a Pandas DataFrame for cost components.""" + data = { + "Sl. No.": list(range(1, 12)) + ["Total"], + "Cost Component": [ + "Initial costs", "Initial carbon emissions costs", "Time costs", + "Road user costs due to re-routing", "Carbon emission cost due to re-routing", + "Periodic maintenance costs", "Periodic maintenance carbon emissions costs", + "Annual routine inspection costs", "Repair and rehabilitation costs", + "Demolition and disposal costs", "Recycling costs", "Total life cycle cost" + ], + "Cost Amount": [InitialConstructionCost.amount, + InitialCarbonEmissionCost.amount, + TimeCost.amount, + RoadUserCost.amount, + 82.62, 19.36, 1.5, 17.68, 13.8, 0, 0.84, -2.67, 212.81], + "Life Cycle Stage": [ + "Initial", "Initial", "Initial", "Initial", "Initial", + "Use", "Use", "Use", "Use", + "End", "End", "Total" + ], + "Cost Type": [ + "Economic", "Environmental", "Social", "Social", "Environmental", + "Economic", "Environmental", "Economic", "Economic", + "Economic", "Economic", "Total" + ] + } + + df = pd.DataFrame(data) + return df + +# Example Usage +if __name__ == "__main__": + from input_data import MaterialData, FinanceData, TrafficData, MaintenanceData, RepairData, DemolitionData, RecycleData, CarbonEmissionData + + material = MaterialData("Steel", "Reinforcement bars", 5000, "kg", 60, "Govt Schedule", 32, 2.5, "EPD Source", 5, 90) + finance = FinanceData(5.0, 7.5, 1.2) + carbon = CarbonEmissionData("SSP2", "RCP6", 1200) + traffic = TrafficData(15, 4000, "Plain", "Urban", 10, {"Car": 50, "Truck": 30, "Bus": 20}) + maintenance = MaintenanceData(0.55, 1.0, 10, 5, 1) + repair = RepairData("Component-wise repair details") + demolition = DemolitionData(10) + recycle = RecycleData(80, 10000, 5000) + + project_input = Input(material, finance, carbon, traffic, maintenance, repair, demolition, recycle) + bridge = BridgeLCC("Bridge A", project_input) + + print("Total LCC:", bridge.calculate_lcc()) + print("\nCost Components Table:") + print(bridge.tabulate_cost_components()) diff --git a/src/osbridgelcca/core/cost_component.py b/src/osbridgelcca/core/cost_component.py deleted file mode 100644 index c839b93..0000000 --- a/src/osbridgelcca/core/cost_component.py +++ /dev/null @@ -1,176 +0,0 @@ -from abc import ABC, abstractmethod - -class CostComponent(ABC): - """Abstract Base Class for different cost components in Life Cycle Cost Analysis.""" - - def __init__(self, amount, category, is_initial, is_recurring, present_worth_factor): - """ - Initialize a generic cost component. - - :param amount: Cost amount in INR - :param category: Economic, Environmental, or Social - :param is_initial: True if an initial cost, False if future cost - :param is_recurring: True if recurring, False if one-time - :param present_worth_factor: Discounting factor for future costs (present_worth_factor) - """ - self.amount = amount - self.category = category - self.is_initial = is_initial - self.is_recurring = is_recurring - self.present_worth_factor = present_worth_factor - - @abstractmethod - def calculate_cost(self): - """Abstract method to be implemented by subclasses for cost calculation.""" - pass - - -class InitialConstructionCost(CostComponent): - """Covers material, labor, and equipment costs for bridge construction.""" - - def __init__(self, quantity, rate): - super().__init__(amount=quantity * rate, category="Economic", is_initial=True, is_recurring=False, present_worth_factor=1.00) - self.quantity = quantity - self.rate = rate - - def calculate_cost(self): - return self.quantity * self.rate * self.present_worth_factor - - -class InitialCarbonEmissionCost(CostComponent): - """Calculates initial carbon emissions from material production and transport.""" - - def __init__(self, material_quantity, carbon_emission_factor, carbon_cost): - super().__init__(amount=(material_quantity * carbon_emission_factor) * carbon_cost, category="Environmental", is_initial=True, is_recurring=False, present_worth_factor=1.00) - self.material_quantity = material_quantity - self.carbon_emission_factor = carbon_emission_factor - self.carbon_cost = carbon_cost - - def calculate_cost(self): - return (self.material_quantity * self.carbon_emission_factor) * self.carbon_cost * self.present_worth_factor - - -class TimeCost(CostComponent): - """Calculates economic losses due to construction delays.""" - - def __init__(self, construction_cost, interest_rate, time, investment_ratio): - cost = construction_cost * interest_rate * time * investment_ratio - super().__init__(amount=cost, category="Economic", is_initial=True, is_recurring=False, present_worth_factor=1.00) - self.construction_cost = construction_cost - self.interest_rate = interest_rate - self.time = time - self.investment_ratio = investment_ratio - - def calculate_cost(self): - return self.construction_cost * self.interest_rate * self.time * self.investment_ratio * self.present_worth_factor - - -class RoadUserCost(CostComponent): - """Evaluates economic impact on road users due to delays and detours.""" - - def __init__(self, vehicles_affected, vehicle_operation_cost, construction_time): - cost = vehicles_affected * vehicle_operation_cost * construction_time - super().__init__(amount=cost, category="Economic", is_initial=True, is_recurring=False, present_worth_factor=1.00) - self.vehicles_affected = vehicles_affected - self.vehicle_operation_cost = vehicle_operation_cost - self.construction_time = construction_time - - def calculate_cost(self): - return self.vehicles_affected * self.vehicle_operation_cost * self.construction_time * self.present_worth_factor - - -class AdditionalCarbonEmissionCost(CostComponent): - """Accounts for increased emissions from detoured traffic during bridge work.""" - - def __init__(self, vehicles_affected, reroute_distance, co2_emission_per_km, carbon_cost): - cost = vehicles_affected * reroute_distance * co2_emission_per_km * carbon_cost - super().__init__(amount=cost, category="Environmental", is_initial=True, is_recurring=False, present_worth_factor=1.00) - self.vehicles_affected = vehicles_affected - self.reroute_distance = reroute_distance - self.co2_emission_per_km = co2_emission_per_km - self.carbon_cost = carbon_cost - - def calculate_cost(self): - return self.vehicles_affected * self.reroute_distance * self.co2_emission_per_km * self.carbon_cost * self.present_worth_factor - - -class PeriodicMaintenanceCost(CostComponent): - """Includes expenses for routine maintenance activities.""" - - def __init__(self, maintenance_cost_rate, construction_cost, discount_rate, period, design_life): - pwf = sum(1 / ((1 + discount_rate) ** (i * period)) for i in range(1, int(design_life / period) + 1)) - cost = maintenance_cost_rate * construction_cost * pwf - super().__init__(amount=cost, category="Economic", is_initial=False, is_recurring=True, present_worth_factor=pwf) - self.maintenance_cost_rate = maintenance_cost_rate - self.construction_cost = construction_cost - self.discount_rate = discount_rate - self.period = period - self.design_life = design_life - - def calculate_cost(self): - return self.maintenance_cost_rate * self.construction_cost * self.present_worth_factor - - -class PeriodicMaintenanceCarbonCost(CostComponent): - """Calculates emissions from maintenance activities.""" - - def __init__(self, material_quantity, carbon_emission_factor, carbon_cost, discount_rate, period, design_life): - pwf = sum(1 / ((1 + discount_rate) ** (i * period)) for i in range(1, int(design_life / period) + 1)) - cost = material_quantity * carbon_emission_factor * carbon_cost * pwf - super().__init__(amount=cost, category="Environmental", is_initial=False, is_recurring=True, present_worth_factor=pwf) - self.material_quantity = material_quantity - self.carbon_emission_factor = carbon_emission_factor - self.carbon_cost = carbon_cost - - def calculate_cost(self): - return self.material_quantity * self.carbon_emission_factor * self.carbon_cost * self.present_worth_factor - - -class RoutineInspectionCost(CostComponent): - """Annual cost of inspections for structural integrity.""" - - def __init__(self, quantity, rate, discount_rate, design_life): - pwf = sum(1 / ((1 + discount_rate) ** i) for i in range(1, design_life + 1)) - cost = quantity * rate * pwf - super().__init__(amount=cost, category="Economic", is_initial=False, is_recurring=True, present_worth_factor=pwf) - self.quantity = quantity - self.rate = rate - - def calculate_cost(self): - return self.quantity * self.rate * self.present_worth_factor - - -class RepairAndRehabilitationCost(CostComponent): - """Covers major structural repairs and retrofitting.""" - - def __init__(self, repair_cost_rate, construction_cost, discount_rate, period, design_life): - pwf = sum(1 / ((1 + discount_rate) ** (i * period)) for i in range(1, int(design_life / period) + 1)) - cost = repair_cost_rate * construction_cost * pwf - super().__init__(amount=cost, category="Economic", is_initial=False, is_recurring=True, present_worth_factor=pwf) - - def calculate_cost(self): - return self.amount - - -class DemolitionCost(CostComponent): - """Costs incurred at the end of bridge life for demolition and disposal.""" - - def __init__(self, demolition_rate, construction_cost, discount_rate, design_life): - pwf = 1 / ((1 + discount_rate) ** design_life) - cost = demolition_rate * construction_cost * pwf - super().__init__(amount=cost, category="Economic", is_initial=False, is_recurring=False, present_worth_factor=pwf) - - def calculate_cost(self): - return self.amount - - -class RecyclingCost(CostComponent): - """Accounts for material salvage and repurposing costs.""" - - def __init__(self, scrap_value, quantity, discount_rate, design_life): - pwf = 1 / ((1 + discount_rate) ** design_life) - cost = scrap_value * quantity * pwf - super().__init__(amount=cost, category="Economic", is_initial=False, is_recurring=False, present_worth_factor=pwf) - - def calculate_cost(self): - return self.amount diff --git a/src/osbridgelcca/core/cost_components.py b/src/osbridgelcca/core/cost_components.py new file mode 100644 index 0000000..eb00fc6 --- /dev/null +++ b/src/osbridgelcca/core/cost_components.py @@ -0,0 +1,214 @@ +from abc import ABC, abstractmethod +import pandas as pd + + + +class CostComponent(ABC): + """Abstract Base Class for different cost components in Life Cycle Cost Analysis.""" + + def __init__(self): + self.amount = 0 # To be calculated in subclasses + self.category = None # Defined in subclass + self.is_initial = None # Defined in subclass + self.is_recurring = None # Defined in subclass + self.pwf = None # To be calculated in subclasses + + @abstractmethod + def calculate_cost(self): + """Abstract method to be implemented by subclasses for cost calculation.""" + pass + + def __str__(self): + return f"{self.__class__.__name__}: Amount = {self.amount:.2f}, Category = {self.category}" + + +def calculate_pwf(discount_rate=None, design_life=None, is_initial=False, is_recurring=True, interval=1, + future_year=None): + """ + Calculates the Present Worth Factor (PWF) based on cost type. + + :param discount_rate: Discount rate (decimal form, e.g., 0.05 for 5%). + :param design_life: Total design life in years. + :param is_initial: True for initial cost (PWF = 1). + :param is_recurring: True for recurring costs. + :param interval: Interval in years for recurring costs (default is 1). + :param future_year: Year when a non-recurring future cost occurs. + :return: Present Worth Factor (PWF). + """ + if is_initial: + return 1.0 # Initial cost has no discounting + elif not is_recurring: + if future_year is None: + raise ValueError("future_year must be provided for non-recurring future costs") + return 1 / ((1 + discount_rate) ** future_year) + else: + return sum(1 / ((1 + discount_rate) ** (i * interval)) for i in range(1, int(design_life / interval) + 1)) + + +class InitialConstructionCost(CostComponent): + def __init__(self, material_boq: pd.DataFrame): + super().__init__() + self.material_boq = material_boq + self.category = "Economic" + self.is_initial = True + self.is_recurring = False + self.pwf = calculate_pwf(is_initial=True) + self.amount = self.calculate_cost() + + def calculate_cost(self): + return (self.material_boq.iloc[:, 2] * self.material_boq.iloc[:, 3]).sum() + + +class InitialCarbonEmissionCost(CostComponent): + def __init__(self, material_boq: pd.DataFrame, carbon_cost): + super().__init__() + self.material_boq = material_boq + self.carbon_cost = carbon_cost + self.category = "Environmental" + self.is_initial = True + self.is_recurring = False + self.pwf = calculate_pwf(is_initial=True) + self.amount = self.calculate_cost() + + def calculate_cost(self): + return self.carbon_cost * (self.material_boq.iloc[:, 2] * self.material_boq.iloc[:, 4]).sum() + + +class TimeCost(CostComponent): + def __init__(self, construction_cost, interest_rate, construction_time, investment_ratio): + super().__init__() + self.construction_cost = construction_cost + self.interest_rate = interest_rate + self.construction_time = construction_time + self.investment_ratio = investment_ratio + self.category = "Economic" + self.is_initial = True + self.is_recurring = False + self.pwf = calculate_pwf(is_initial=True) + self.amount = self.calculate_cost() + + def calculate_cost(self): + return self.construction_cost * self.interest_rate * self.construction_time * self.investment_ratio + + +class RoadUserCost(CostComponent): + def __init__(self, vehicles_affected, vehicle_operation_cost, construction_time): + super().__init__() + self.vehicles_affected = vehicles_affected + self.vehicle_operation_cost = vehicle_operation_cost + self.construction_time = construction_time + self.delay_cost = 0.00 + self.category = "Economic" + self.is_initial = True + self.is_recurring = False + self.pwf = 1.0 + self.amount = self.calculate_cost() + + def calculate_cost(self): + return self.vehicles_affected * (self.vehicle_operation_cost + self.delay_cost) * self.construction_time + + +class ReroutingCarbonEmissionCost(CostComponent): + def __init__(self, vehicles_affected, reroute_distance, co2_emission_per_km, carbon_cost): + super().__init__() + self.vehicles_affected = vehicles_affected + self.reroute_distance = reroute_distance + self.co2_emission_per_km = co2_emission_per_km + self.carbon_cost = carbon_cost + self.category = "Environmental" + self.is_initial = True + self.is_recurring = False + self.pwf = 1.0 + self.amount = self.calculate_cost() + + def calculate_cost(self): + return self.vehicles_affected * self.reroute_distance * self.co2_emission_per_km * self.carbon_cost + + +class PeriodicMaintenanceCost(CostComponent): + def __init__(self, maintenance_cost_rate, construction_cost, discount_rate, interval, design_life): + super().__init__() + self.maintenance_cost_rate = maintenance_cost_rate + self.construction_cost = construction_cost + self.discount_rate = discount_rate + self.interval = interval + self.design_life = design_life + self.category = "Economic" + self.is_initial = False + self.is_recurring = True + self.pwf = calculate_pwf(discount_rate, design_life=self.design_life, is_recurring=self.is_recurring, + interval=interval) + self.amount = self.calculate_cost() + + def calculate_cost(self): + return self.maintenance_cost_rate * self.construction_cost * self.pwf + + +class PeriodicMaintenanceCarbonEmissionCost(CostComponent): + def __init__(self, material_quantity, carbon_emission_factor, carbon_cost, discount_rate, interval, design_life): + super().__init__() + self.material_quantity = material_quantity + self.carbon_emission_factor = carbon_emission_factor + self.carbon_cost = carbon_cost + self.discount_rate = discount_rate + self.interval = interval + self.design_life = design_life + self.category = "Environmental" + self.is_initial = False + self.is_recurring = True + self.pwf = calculate_pwf(discount_rate, design_life, is_recurring=True, interval=interval) + self.amount = self.calculate_cost() + + def calculate_cost(self): + return self.material_quantity * self.carbon_emission_factor * self.carbon_cost * self.pwf + + +class RoutineInspectionCost(CostComponent): + def __init__(self, quantity, rate, discount_rate, design_life): + super().__init__() + self.quantity = quantity + self.rate = rate + self.discount_rate = discount_rate + self.design_life = design_life + self.category = "Economic" + self.is_initial = False + self.is_recurring = True + self.pwf = calculate_pwf(discount_rate, design_life, is_recurring=True) + self.amount = self.calculate_cost() + + def calculate_cost(self): + return self.quantity * self.rate * self.pwf + + +class DemolitionCost(CostComponent): + def __init__(self, demolition_rate, construction_cost, discount_rate, design_life): + super().__init__() + self.demolition_rate = demolition_rate + self.construction_cost = construction_cost + self.discount_rate = discount_rate + self.design_life = design_life + self.category = "Economic" + self.is_initial = False + self.is_recurring = False + self.pwf = calculate_pwf(discount_rate, design_life, is_recurring=False, future_year=design_life) + self.amount = self.calculate_cost() + + def calculate_cost(self): + return self.demolition_rate * self.construction_cost * self.pwf + + +class RecyclingCost(CostComponent): + def __init__(self, scrap_value, quantity, discount_rate, design_life): + super().__init__() + self.scrap_value = scrap_value + self.quantity = quantity + self.discount_rate = discount_rate + self.design_life = design_life + self.category = "Economic" + self.is_initial = False + self.is_recurring = False + self.pwf = calculate_pwf(discount_rate, design_life, is_recurring=False, future_year=design_life) + self.amount = self.calculate_cost() + + def calculate_cost(self): + return self.scrap_value * self.quantity * self.pwf diff --git a/src/osbridgelcca/desktop_app/app.py b/src/osbridgelcca/desktop_app/app.py index 62e7ee9..2257fd7 100644 --- a/src/osbridgelcca/desktop_app/app.py +++ b/src/osbridgelcca/desktop_app/app.py @@ -1,3 +1,899 @@ +import sys +import csv +import json +from PyQt5 import QtWidgets +from ui.input_form import save_general_info +from ui.project_details_windows.ProjectDetails_BridgeANDTrafficData_Window import Ui_BridgeTraffic_Dialog +from ui.project_details_windows.ProjectDetails_Foundation_Window import Ui_Foundation_Dialog +from ui.project_details_windows.ProjectDetails_CarbonEmissionData_Window import Ui_CarbonEmission_Dialog +from ui.project_details_windows.ProjectDetails_DemolitionANDRecyclingData_Window import Ui_Demolition_Dialog +from ui.project_details_windows.ProjectDetails_FinancialData_Window import Ui_FinancialData_Dialog +from ui.project_details_windows.ProjectDetails_MaintenanceANDRepairData_Window import Ui_Maintenance_Dialog +from ui.project_details_windows.ProjectDetails_Miscellaneous_Window import Ui_Miscellaneous_Dialog +from ui.project_details_windows.ProjectDetails_SubStructure_Window import Ui_SubStructure_Dialog +from ui.project_details_windows.ProjectDetails_SuperStructure_Window import Ui_SuperStructure_Dialog +from PyQt5.QtWidgets import (QApplication, QMainWindow, QWidget, QVBoxLayout, + QHBoxLayout, QPushButton, QLabel, QTreeWidget, + QTreeWidgetItem, QTabBar, QFrame, QSplitter, + QToolBar, QAction, QGroupBox, QMenu, QLineEdit, + QComboBox, QMessageBox, QGridLayout) +from PyQt5.QtGui import QIcon, QFont +from PyQt5.QtCore import Qt, QSize + +class BICCAStudio(QMainWindow): + def openBridgeTrafficWindow(self): + self.window = QtWidgets.QDialog() + self.ui = Ui_BridgeTraffic_Dialog() + self.ui.setupUi(self.window) + self.window.show() + + def openFoundationWindow(self): + self.window = QtWidgets.QDialog() + self.ui = Ui_Foundation_Dialog() + self.ui.setupUi(self.window) + self.window.show() + + def openCarbonEmissionWindow(self): + self.window = QtWidgets.QDialog() + self.ui = Ui_CarbonEmission_Dialog() + self.ui.setupUi(self.window) + self.window.show() + + def openDemolitionWindow(self): + self.window = QtWidgets.QDialog() + self.ui = Ui_Demolition_Dialog() + self.ui.setupUi(self.window) + self.window.show() + + def openFinancialWindow(self): + self.window = QtWidgets.QDialog() + self.ui = Ui_FinancialData_Dialog() + self.ui.setupUi(self.window) + self.window.show() + + def openMaintenanceWindow(self): + self.window = QtWidgets.QDialog() + self.ui = Ui_Maintenance_Dialog() + self.ui.setupUi(self.window) + self.window.show() + + def openMiscellaneousWindow(self): + self.window = QtWidgets.QDialog() + self.ui = Ui_Miscellaneous_Dialog() + self.ui.setupUi(self.window) + self.window.show() + + def openSubStructureWindow(self): + self.window = QtWidgets.QDialog() + self.ui = Ui_SubStructure_Dialog() + self.ui.setupUi(self.window) + self.window.show() + + def openSuperStructureWindow(self): + self.window = QtWidgets.QDialog() + self.ui = Ui_SuperStructure_Dialog() + self.ui.setupUi(self.window) + self.window.show() + + def __init__(self): + super().__init__() + self.setWindowTitle(" - BICCA Studio 1.0.0") + self.setGeometry(100, 40, 1440, 900) + self.setStyleSheet("background-color: #f5f5f5;") + + # Initialize tutorial page counter + self.current_tutorial_page = 1 + self.total_tutorial_pages = 4 + + # Tutorial content + self.tutorial_pages = [ + { + "page_number": "1/4", + "title": "Welcome to\nBICCA Studio", + "content": """ + BICCA Studio has a lot of features to offer. In the next few minutes, you'll learn how to use BICCA Studio efficiently, from setting up and managing projects, to navigating the user interface. This tutorial will guide you through essential features, including customization options, shortcuts, and export capabilities, ensuring a seamless workflow. Whether you're a beginner or an advanced user, this guide will help you unlock the full potential of BICCA Studio and enhance your productivity. + """ + }, + { + "page_number": "2/4", + "title": "Welcome to\nBICCA Studio", + "content": """ + The Project General Information page is the foundation of your project setup, allowing you to input essential details for accurate documentation and streamlined management. Here, you will provide key information starting with the Company Name, which represents the organization behind the project. Next is the Project Title, a concise name that defines the scope of work. The Project Description further elaborates on the objectives and purpose of the project. Additionally, you will need to enter the Name of the Valuer responsible for the valuation, along with the Job Number for easy reference. The Client field identifies the primary stakeholder of the project, while the Country specifies the project's geographical location. Finally, the Base Year establishes a reference period for analysis and reports. + """ + }, + { + "page_number": "3/4", + "title": "Understanding\nInput Parameters", + "content": """ + Input Parameters are crucial for accurate analysis and results. This section allows you to define various technical specifications, economic factors, and operational variables that will influence your project outcomes. You can specify factors such as time periods, growth rates, discount rates, and other numerical inputs that the software will use for calculations. Each parameter can be customized according to your specific requirements, ensuring that the analysis reflects real-world conditions accurately. The intuitive interface makes it easy to adjust these parameters as needed, and you can save different parameter sets for future use or comparisons. + """ + }, + { + "page_number": "4/4", + "title": "Working with\nOutputs", + "content": """ + The Outputs section displays the results of your analysis based on the information and parameters you've entered. Here you can view comprehensive reports, charts, and visualizations that present your data in meaningful ways. You can customize the output format according to your preferences or your client's requirements. BICCA Studio allows you to export these outputs in various formats including PDF, Excel, or as image files for easy sharing and presentation. Additionally, you can compare different scenarios by adjusting your inputs and generating new outputs, providing valuable insights for decision-making processes. + """ + } + ] + + # Create the main layout + self.central_widget = QWidget() + self.setCentralWidget(self.central_widget) + self.main_layout = QVBoxLayout(self.central_widget) + self.main_layout.setContentsMargins(0, 0, 0, 0) + self.main_layout.setSpacing(0) + + # Create menu bar with dropdown menus + self.create_menu_bar() + + # Create toolbar + self.create_toolbar() + + # Create window tabs + self.create_window_tabs() + + # Create main content area + self.create_content_area() + self.show_tutorials_only() # Show only tutorials at launch + + # Add status bar with Data button + self.create_status_bar() + + # Initially hide dropdown menus + self.file_menu_widget = QWidget(self) + self.file_menu_widget.hide() + self.help_menu_widget = QWidget(self) + self.help_menu_widget.hide() + + # Update tutorial content to first page + self.update_tutorial_content() + + + def create_menu_bar(self): + menubar = self.menuBar() + menubar.setObjectName("menubar") + menubar.setStyleSheet(""" + QMenuBar { + background-color: #4C9141; + color: white; + } + QMenuBar::item { + background-color: white; + color: black; + padding: 5px 25px; + } + QMenuBar::item:selected { + background-color: #e0e0e0; + } + """) + + # File menu + self.menuFile = QMenu("File", self) + self.menuFile.setObjectName("menuFile") + menubar.addMenu(self.menuFile) + + # Home menu + self.menuHome = QMenu("Home", self) + self.menuHome.setObjectName("menuHome") + menubar.addMenu(self.menuHome) + + # Reports menu + self.menuReports = QMenu("Reports", self) + self.menuReports.setObjectName("menuReports") + menubar.addMenu(self.menuReports) + + # Help menu + self.menuHelp = QMenu("Help", self) + self.menuHelp.setObjectName("menuHelp") + menubar.addMenu(self.menuHelp) + + # Actions with icons (update icon paths as needed) + from PyQt5.QtGui import QIcon, QPixmap + + def icon(path): + return QIcon(QPixmap(path)) + + self.actionNew = QAction(icon("src/osbridgelcca/desktop_app/assets/MainWindow_icons/Vector.png"), "New", self) + self.actionOpen = QAction(icon("src/osbridgelcca/desktop_app/assets/MainWindow_icons/Vector (1).png"), "Open", self) + self.actionSave = QAction(icon("src/osbridgelcca/desktop_app/assets/MainWindow_icons/🦆 icon _save action floppy_.png"), "Save", self) + self.actionSave_As = QAction(icon("src/osbridgelcca/desktop_app/assets/MainWindow_icons/🦆 icon _document save as template_.png"), "Save As...", self) + self.actionCreate_a_Copy = QAction(icon("src/osbridgelcca/desktop_app/assets/MainWindow_icons/🦆 icon _file copy_.png"), "Create a Copy", self) + self.actionPrint = QAction(icon("src/osbridgelcca/desktop_app/assets/MainWindow_icons/Vector (2).png"), "Print", self) + self.actionRename = QAction(icon("src/osbridgelcca/desktop_app/assets/MainWindow_icons/Vector (3).png"), "Rename", self) + self.actionExport = QAction(icon("src/osbridgelcca/desktop_app/assets/MainWindow_icons/Export.png"), "Export", self) + self.actionVersion_History = QAction(icon("src/osbridgelcca/desktop_app/assets/MainWindow_icons/Vector (4).png"), "Version History", self) + self.actionInfo = QAction(icon("src/osbridgelcca/desktop_app/assets/MainWindow_icons/Alert Circle.png"), "Info", self) + self.actionContact_Us = QAction(icon("src/osbridgelcca/desktop_app/assets/MainWindow_icons/Contact.png"), "Contact Us", self) + self.actionFeedback = QAction(icon("src/osbridgelcca/desktop_app/assets/MainWindow_icons/🦆 icon _Person Feedback_.png"), "Feedback", self) + self.actionVideo_Tutorials = QAction(icon("src/osbridgelcca/desktop_app/assets/MainWindow_icons/🦆 icon _youtube_.png"), "Video Tutorials", self) + self.actionJoin_our_Community = QAction(icon("src/osbridgelcca/desktop_app/assets/MainWindow_icons/🦆 icon _People Community_.png"), "Join our Community", self) + self.actionEdit = QAction(icon("src/osbridgelcca/desktop_app/assets/MainWindow_icons/08b7798a84ffe0528bdec7dc8efe8fb1c89f77ae.png"), "Edit", self) + self.actionFile = QAction(icon("src/osbridgelcca/desktop_app/assets/MainWindow_icons/Icon.png"), "File", self) + self.actionOpen_File = QAction(icon("src/osbridgelcca/desktop_app/assets/MainWindow_icons/78ff94ca74c504343b797700f5d515a40ab72143.png"), "Open File", self) + + # Add actions to File menu + self.menuFile.addAction(self.actionNew) + self.menuFile.addAction(self.actionOpen) + self.menuFile.addAction(self.actionSave) + self.menuFile.addAction(self.actionSave_As) + self.menuFile.addAction(self.actionCreate_a_Copy) + self.menuFile.addAction(self.actionPrint) + self.menuFile.addAction(self.actionRename) + self.menuFile.addAction(self.actionExport) + self.menuFile.addAction(self.actionVersion_History) + self.menuFile.addAction(self.actionInfo) + + # Add actions to Help menu + self.menuHelp.addAction(self.actionContact_Us) + self.menuHelp.addAction(self.actionFeedback) + self.menuHelp.addAction(self.actionVideo_Tutorials) + self.menuHelp.addAction(self.actionJoin_our_Community) + + # Optionally, add actions to toolbar if you want + # self.addToolBar(Qt.LeftToolBarArea, QToolBar(self)).addAction(self.actionEdit) + # self.addToolBar(Qt.LeftToolBarArea, QToolBar(self)).addAction(self.actionFile) + # self.addToolBar(Qt.LeftToolBarArea, QToolBar(self)).addAction(self.actionOpen_File) + + def toggle_file_menu(self): + # Close help menu if it's open + self.help_menu_widget.hide() + + # Toggle file menu + if self.file_menu_widget.isVisible(): + self.file_menu_widget.hide() + else: + self.file_menu_widget.show() + self.file_menu_widget.raise_() + + def toggle_help_menu(self): + # Close file menu if it's open + self.file_menu_widget.hide() + + # Toggle help menu + if self.help_menu_widget.isVisible(): + self.help_menu_widget.hide() + else: + self.help_menu_widget.show() + self.help_menu_widget.raise_() + + def create_toolbar(self): + toolbar = QToolBar("Main Toolbar") + toolbar.setMovable(False) + toolbar.setIconSize(QSize(20, 20)) + self.addToolBar(Qt.LeftToolBarArea, toolbar) + + # Use the same icons as in MainWindow.py (update paths if needed) + from PyQt5.QtGui import QIcon, QPixmap + + def icon(path): + return QIcon(QPixmap(path)) + + self.actionEdit = QAction(icon("src/osbridgelcca/desktop_app/assets/MainWindow_icons/08b7798a84ffe0528bdec7dc8efe8fb1c89f77ae.png"), "Edit", self) + self.actionFile = QAction(icon("src/osbridgelcca/desktop_app/assets/MainWindow_icons/Icon.png"), "File", self) + self.actionOpen_File = QAction(icon("src/osbridgelcca/desktop_app/assets/MainWindow_icons/78ff94ca74c504343b797700f5d515a40ab72143.png"), "Open File", self) + + toolbar.addAction(self.actionEdit) + toolbar.addAction(self.actionFile) + toolbar.addAction(self.actionOpen_File) + toolbar.addSeparator() + + def create_window_tabs(self): + # Create a container widget for better alignment + window_tabs_container = QWidget() + container_layout = QHBoxLayout(window_tabs_container) + container_layout.setContentsMargins(0, 0, 0, 0) + + # Left spacer to push content to center + container_layout.addStretch(1) + + # Windows label with better spacing + windows_label = QLabel("Windows:") + windows_label.setStyleSheet("padding: 5px 10px 5px 0px;") + container_layout.addWidget(windows_label) + + # Store tab buttons for later use + self.tab_buttons = {} + + # Create tab buttons with better spacing + tabs = ["Tutorials", "Project Details", "Results", "Compare"] + for i, tab_name in enumerate(tabs): + tab_btn = QPushButton(tab_name) + tab_btn.setStyleSheet(""" + QPushButton { + background-color: #EEEEEE; + border: 1px solid #CCCCCC; + padding: 5px 10px; + margin: 0px 2px; + } + QPushButton:pressed { + background-color: #DDDDDD; + } + """) + container_layout.addWidget(tab_btn) + self.tab_buttons[tab_name] = tab_btn + # Connect each tab to its handler + if tab_name == "Tutorials": + tab_btn.clicked.connect(self.show_tutorials_only) + elif tab_name == "Project Details": + tab_btn.clicked.connect(self.show_project_details) + # Results and Compare can be connected later + + # Right spacer to push content to center + container_layout.addStretch(1) + + window_tabs_container.setFixedHeight(40) + self.main_layout.addWidget(window_tabs_container) + + def show_tutorials_only(self): + # Hide project details panel + self.project_panel.setVisible(False) + # Set tutorials panel max width to 771 + self.tutorials_panel.setMaximumWidth(771) + # Center the tutorials panel in the main window + self.splitter.setSizes([1, 0]) + # Optionally, expand tutorials to fill available space + self.tutorials_panel.setMinimumWidth(0) + self.tutorials_panel.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Preferred) + + def show_project_details(self): + # Show both panels + self.project_panel.setVisible(True) + # Restore tutorials panel max width to 244 + self.tutorials_panel.setMaximumWidth(244) + self.tutorials_panel.setMinimumWidth(0) + self.tutorials_panel.setSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred) + # Reset splitter sizes for normal layout + self.splitter.setSizes([200, 750]) + + def create_content_area(self): + def get_country_name(filename = "src//osbridgelcca//desktop_app//assets//country_abbreviations.csv"): + country_names_lst = [] + + with open(filename, newline='', encoding='utf-8') as csvfile: + reader = csv.reader(csvfile) + next(reader) # Skiping header row + for row in reader: + country_names_lst.append(row[1]) + return country_names_lst + + def get_base_year(filename = "src//osbridgelcca//desktop_app//assets//years_2000_to_2025.csv"): + base_years_lst = [] + + with open(filename, newline='', encoding='utf-8') as csvfile: + reader = csv.reader(csvfile) + next(reader) # Skiping header row + for row in reader: + base_years_lst.append(row[0]) + return base_years_lst + + + self.splitter = QSplitter(Qt.Horizontal) + + # Left side - Tutorials panel + self.tutorials_panel = QWidget() + self.tutorials_panel.setMaximumWidth(771) # Start with max 771 for launch + tutorials_layout = QVBoxLayout(self.tutorials_panel) + tutorials_layout.setContentsMargins(0, 0, 0, 0) + + # Tutorial header + tutorials_header = QWidget() + tutorials_header.setStyleSheet("background-color: #f0e6e6;") + tutorials_header_layout = QHBoxLayout(tutorials_header) + tutorials_header_layout.setContentsMargins(5, 5, 5, 5) + + tutorials_label = QLabel("Tutorials") + close_btn = QPushButton("×") + close_btn.setFixedSize(20, 20) + close_btn.setStyleSheet("border: none;") + close_btn.clicked.connect(self.close_tutorials) + + tutorials_header_layout.addWidget(tutorials_label) + tutorials_header_layout.addStretch() + tutorials_header_layout.addWidget(close_btn) + + # Tutorial content with light pink background + self.tutorials_content = QWidget() + self.tutorials_content.setStyleSheet("background-color: #f9f0f0;") + self.tutorials_content_layout = QVBoxLayout(self.tutorials_content) + + # Create labels that will be updated dynamically + self.page_label = QLabel() + self.page_label.setAlignment(Qt.AlignCenter) + self.page_label.setStyleSheet("font-weight: bold; padding: 5px; border-bottom: 1px solid #ddd;") + + self.welcome_label = QLabel() + self.welcome_label.setAlignment(Qt.AlignCenter) + self.welcome_label.setStyleSheet("font-weight: bold; padding: 10px; border-bottom: 1px solid #ddd;") + + self.description_label = QLabel() + self.description_label.setWordWrap(True) + self.description_label.setStyleSheet("padding: 10px;") + + self.tutorials_content_layout.addWidget(self.page_label) + self.tutorials_content_layout.addWidget(self.welcome_label) + self.tutorials_content_layout.addWidget(self.description_label) + self.tutorials_content_layout.addStretch() + + # Tutorial navigation buttons + nav_buttons = QWidget() + nav_buttons.setStyleSheet("background-color: #f9f0f0;") + nav_layout = QHBoxLayout(nav_buttons) + nav_layout.setContentsMargins(10, 5, 10, 5) + + back_btn = QPushButton("Back") + back_btn.setStyleSheet(""" + QPushButton { + background-color: #f0f0f0; + border: 1px solid #ddd; + padding: 5px 15px; + border-radius: 3px; + } + """) + back_btn.clicked.connect(self.tutorial_back) + + next_btn = QPushButton("Next") + next_btn.setStyleSheet(""" + QPushButton { + background-color: #f0f0f0; + border: 1px solid #ddd; + padding: 5px 15px; + border-radius: 3px; + } + """) + next_btn.clicked.connect(self.tutorial_next) + + nav_layout.addWidget(back_btn) + nav_layout.addWidget(next_btn) + + tutorials_layout.addWidget(tutorials_header) + tutorials_layout.addWidget(self.tutorials_content) + tutorials_layout.addWidget(nav_buttons) + + # Right side - Project Details panel + self.project_panel = QWidget() + self.project_panel.setMaximumWidth(771) + project_layout = QVBoxLayout(self.project_panel) + project_layout.setContentsMargins(0, 0, 0, 0) + + # Project header + project_header = QWidget() + project_header.setStyleSheet("background-color: #f0f0f0;") + project_header_layout = QHBoxLayout(project_header) + project_header_layout.setContentsMargins(5, 5, 5, 5) + + project_label = QLabel("Project Details Window") + project_close_btn = QPushButton("×") + project_close_btn.setFixedSize(20, 20) + project_close_btn.setStyleSheet("font-weight: bold; border: none;") + project_close_btn.clicked.connect(self.close_project_details) + + project_header_layout.addWidget(project_label) + project_header_layout.addStretch() + project_header_layout.addWidget(project_close_btn) + + # Create collapsible sections + project_content = QWidget() + project_content_layout = QVBoxLayout(project_content) + project_content_layout.setContentsMargins(10, 10, 10, 10) + + # General Information section (collapsible) + general_info_box = QGroupBox() + general_info_box.setStyleSheet(""" + QGroupBox { + background-color: #f0e6e6; + border-radius: 3px; + margin-bottom: 5px; + } + """) + general_info_layout = QVBoxLayout(general_info_box) + general_info_layout.setContentsMargins(10, 10, 10, 10) + + # Collapsible header + self.general_info_btn = QPushButton("► General Information") + self.general_info_btn.setCheckable(True) + self.general_info_btn.setChecked(False) + self.general_info_btn.setStyleSheet("font-weight: bold; text-align: left; background: none; border: none;") + general_info_layout.addWidget(self.general_info_btn) + + # Content widget + self.general_info_content = QWidget() + self.general_info_content.setStyleSheet("background-color: #fff9f9;") + form_layout = QGridLayout(self.general_info_content) + form_layout.setSpacing(10) + + # Company Name + company_label = QLabel("Company Name") + company_label.setFixedWidth(150) + company_label.setAlignment(Qt.AlignLeft | Qt.AlignVCenter) + company_edit = QLineEdit() + company_edit.setFixedWidth(483) + company_edit.setFixedHeight(25) + company_edit.setStyleSheet("background-color: #ffffff;") + + # Project Title + title_label = QLabel("Project Title") + title_label.setFixedWidth(150) + title_label.setAlignment(Qt.AlignLeft | Qt.AlignVCenter) + title_edit = QLineEdit() + title_edit.setFixedWidth(483) + title_edit.setFixedHeight(25) + title_edit.setStyleSheet("background-color: #ffffff;") + + # Project Description + desc_label = QLabel("Project Description") + desc_label.setFixedWidth(150) + desc_label.setAlignment(Qt.AlignLeft | Qt.AlignVCenter) + desc_edit = QLineEdit() + desc_edit.setFixedWidth(483) + desc_edit.setFixedHeight(125) + desc_edit.setStyleSheet("background-color: #ffffff;") + + # Name of Valuer + valuer_label = QLabel("Name of Valuer") + valuer_label.setFixedWidth(150) + valuer_label.setAlignment(Qt.AlignLeft | Qt.AlignVCenter) + valuer_combo = QComboBox() + valuer_combo.setFixedWidth(164) + valuer_combo.setFixedHeight(19) + valuer_combo.setStyleSheet("background-color: #ffffff;") + for valuer in get_country_name(): + valuer_combo.addItem(valuer) + + # Job Number + job_label = QLabel("Job Number") + job_label.setFixedWidth(150) + job_label.setAlignment(Qt.AlignLeft | Qt.AlignVCenter) + job_edit = QLineEdit() + job_edit.setFixedWidth(164) + job_edit.setFixedHeight(19) + job_edit.setStyleSheet("background-color: #ffffff;") + + # Client + client_label = QLabel("Client") + client_label.setFixedWidth(150) + client_label.setAlignment(Qt.AlignLeft | Qt.AlignVCenter) + client_edit = QLineEdit() + client_edit.setFixedWidth(164) + client_edit.setFixedHeight(19) + client_edit.setStyleSheet("background-color: #ffffff;") + + # Country + country_label = QLabel("Country") + country_label.setFixedWidth(150) + country_label.setAlignment(Qt.AlignLeft | Qt.AlignVCenter) + country_combo = QComboBox() + country_combo.setFixedWidth(164) + country_combo.setFixedHeight(19) + country_combo.setStyleSheet("background-color: #ffffff;") + for country in get_country_name(): + country_combo.addItem(country) + + # Base Year + year_label = QLabel("Base Year") + year_label.setFixedWidth(150) + year_label.setAlignment(Qt.AlignLeft | Qt.AlignVCenter) + year_combo = QComboBox() + year_combo.setFixedWidth(164) + year_combo.setFixedHeight(19) + year_combo.setStyleSheet("background-color: #ffffff;") + for year in get_base_year(): + year_combo.addItem(year) + + # Add widgets to grid layout (row, column) + form_layout.addWidget(company_label, 0, 0) + form_layout.addWidget(company_edit, 0, 1) + form_layout.addWidget(title_label, 1, 0) + form_layout.addWidget(title_edit, 1, 1) + form_layout.addWidget(desc_label, 2, 0) + form_layout.addWidget(desc_edit, 2, 1) + form_layout.addWidget(valuer_label, 3, 0) + form_layout.addWidget(valuer_combo, 3, 1) + form_layout.addWidget(job_label, 4, 0) + form_layout.addWidget(job_edit, 4, 1) + form_layout.addWidget(client_label, 5, 0) + form_layout.addWidget(client_edit, 5, 1) + form_layout.addWidget(country_label, 6, 0) + form_layout.addWidget(country_combo, 6, 1) + form_layout.addWidget(year_label, 7, 0) + form_layout.addWidget(year_combo, 7, 1) + + # Add Save button + save_btn = QPushButton("Save General Info") + save_btn.setStyleSheet("background-color: #4C9141; color: white; font-weight: bold; padding: 6px 18px;") + form_layout.addWidget(save_btn) + + # Store references to the input widgets for later access + self.company_edit = company_edit + self.title_edit = title_edit + self.desc_edit = desc_edit + self.valuer_combo = valuer_combo + self.job_edit = job_edit + self.client_edit = client_edit + self.country_combo = country_combo + self.year_combo = year_combo + + # Connect the save button + save_btn.clicked.connect(self.save_general_info_data) + + general_info_layout.addWidget(self.general_info_content) + + def toggle_general_info_content(checked): + self.general_info_content.setVisible(checked) + self.general_info_btn.setText("▼ General Information" if checked else "► General Information") + self.general_info_btn.toggled.connect(toggle_general_info_content) + + self.general_info_content.setVisible(False) + + # Input Parameters section (collapsible) + input_params_box = QGroupBox() + input_params_box.setStyleSheet(""" + QGroupBox { + background-color: #f0e6e6; + border-radius: 3px; + margin-bottom: 5px; + } + """) + input_params_layout = QVBoxLayout(input_params_box) + input_params_layout.setContentsMargins(10, 10, 10, 10) + + self.input_params_btn = QPushButton("► Input Parameters") + self.input_params_btn.setCheckable(True) + self.input_params_btn.setChecked(False) + self.input_params_btn.setStyleSheet("font-weight: bold; text-align: left; background: none; border: none;") + input_params_layout.addWidget(self.input_params_btn) + + self.input_params_content = QWidget() + self.input_params_content.setStyleSheet("background-color: rgb(240, 230, 230);") + input_params_content_layout = QVBoxLayout(self.input_params_content) + input_params_content_layout.setSpacing(10) + + # --- Begin: Copied from MainWindow.py's self.widget_5 --- + + # Structure Works Data (collapsible) + structure_box = QGroupBox() + structure_box.setStyleSheet("background-color: rgb(240,230,230); margin-bottom: 5px;") + structure_layout = QVBoxLayout(structure_box) + structure_layout.setContentsMargins(5, 5, 5, 5) + + self.structure_btn = QPushButton("► Structure Works Data") + self.structure_btn.setCheckable(True) + self.structure_btn.setChecked(False) + self.structure_btn.setStyleSheet("text-align: left; background: none; border: none;") + structure_layout.addWidget(self.structure_btn) + + self.structure_content = QWidget() + structure_content_layout = QVBoxLayout(self.structure_content) + structure_content_layout.setSpacing(6) + + # Foundation + foundation_btn = QPushButton(" Foundation") + foundation_btn.setIcon(QIcon("src/osbridgelcca/desktop_app/assets/MainWindow_icons/play_arrow_filled.png")) + foundation_btn.setStyleSheet("text-align: left;") + foundation_btn.clicked.connect(self.openFoundationWindow) + structure_content_layout.addWidget(foundation_btn) + + # Super-Structure + superstructure_btn = QPushButton(" Super-Structure") + superstructure_btn.setIcon(QIcon("src/osbridgelcca/desktop_app/assets/MainWindow_icons/play_arrow_filled.png")) + superstructure_btn.setStyleSheet("text-align: left;") + superstructure_btn.clicked.connect(self.openSuperStructureWindow) + structure_content_layout.addWidget(superstructure_btn) + + # Sub-Structure + substructure_btn = QPushButton(" Sub-Structure") + substructure_btn.setIcon(QIcon("src/osbridgelcca/desktop_app/assets/MainWindow_icons/play_arrow_filled.png")) + substructure_btn.setStyleSheet("text-align: left;") + substructure_btn.clicked.connect(self.openSubStructureWindow) + structure_content_layout.addWidget(substructure_btn) + + # Miscellaneous + misc_btn = QPushButton(" Miscellaneous") + misc_btn.setIcon(QIcon("src/osbridgelcca/desktop_app/assets/MainWindow_icons/play_arrow_filled.png")) + misc_btn.setStyleSheet("text-align: left;") + misc_btn.clicked.connect(self.openMiscellaneousWindow) + structure_content_layout.addWidget(misc_btn) + + self.structure_content.setVisible(False) + structure_layout.addWidget(self.structure_content) + + def toggle_structure_content(checked): + self.structure_content.setVisible(checked) + self.structure_btn.setText("▼ Structure Works Data" if checked else "► Structure Works Data") + self.structure_btn.toggled.connect(toggle_structure_content) + + self.input_params_content.setVisible(False) + input_params_content_layout.addWidget(structure_box) + + # Financial Data + financial_btn = QPushButton("► Financial Data") + financial_btn.setStyleSheet("text-align: left;") + financial_btn.clicked.connect(self.openFinancialWindow) + input_params_content_layout.addWidget(financial_btn) + + # Carbon Emission Data (collapsible) + carbon_box = QGroupBox() + carbon_box.setStyleSheet("background-color: rgb(240,230,230); margin-bottom: 5px;") + carbon_layout = QVBoxLayout(carbon_box) + carbon_layout.setContentsMargins(5, 5, 5, 5) + + self.carbon_btn = QPushButton("► Carbon Emission Data") + self.carbon_btn.setCheckable(True) + self.carbon_btn.setChecked(False) + self.carbon_btn.setStyleSheet(" text-align: left; background: none; border: none;") + carbon_layout.addWidget(self.carbon_btn) + + self.carbon_content = QWidget() + carbon_content_layout = QVBoxLayout(self.carbon_content) + carbon_content_layout.setSpacing(6) + + carbon_cost_btn = QPushButton(" Carbon Emission Cost Data") + carbon_cost_btn.setIcon(QIcon("src/osbridgelcca/desktop_app/assets/MainWindow_icons/play_arrow_filled.png")) + carbon_cost_btn.setStyleSheet("text-align: left;") + carbon_cost_btn.clicked.connect(self.openCarbonEmissionWindow) + carbon_content_layout.addWidget(carbon_cost_btn) + + self.carbon_content.setVisible(False) + carbon_layout.addWidget(self.carbon_content) + + def toggle_carbon_content(checked): + self.carbon_content.setVisible(checked) + self.carbon_btn.setText("▼ Carbon Emission Data" if checked else "► Carbon Emission Data") + self.carbon_btn.toggled.connect(toggle_carbon_content) + + input_params_content_layout.addWidget(carbon_box) + + # Bridge and Traffic Data + bridge_btn = QPushButton("► Bridge and Traffic Data") + bridge_btn.setStyleSheet("text-align: left;") + bridge_btn.clicked.connect(self.openBridgeTrafficWindow) + input_params_content_layout.addWidget(bridge_btn) + + # Maintenance and Repair + maintenance_btn = QPushButton("► Maintenance and Repair") + maintenance_btn.setStyleSheet("text-align: left;") + maintenance_btn.clicked.connect(self.openMaintenanceWindow) + input_params_content_layout.addWidget(maintenance_btn) + + # Disposal and Recycling + demolition_btn = QPushButton("► Disposal and Recycling") + demolition_btn.setStyleSheet("text-align: left;") + demolition_btn.clicked.connect(self.openDemolitionWindow) + input_params_content_layout.addWidget(demolition_btn) + + self.input_params_content.setVisible(False) + input_params_layout.addWidget(self.input_params_content) + + + def toggle_input_params_content(checked): + self.input_params_content.setVisible(checked) + self.input_params_btn.setText("▼ Input Parameters" if checked else "► Input Parameters") + self.input_params_btn.toggled.connect(toggle_input_params_content) + + # Outputs section (collapsible) + outputs_box = QGroupBox() + outputs_box.setStyleSheet(""" + QGroupBox { + background-color: #f0e6e6; + border-radius: 3px; + margin-bottom: 5px; + } + """) + outputs_layout = QVBoxLayout(outputs_box) + outputs_layout.setContentsMargins(10, 10, 10, 10) + + self.outputs_btn = QPushButton("► Outputs") + self.outputs_btn.setCheckable(True) + self.outputs_btn.setChecked(False) + self.outputs_btn.setStyleSheet("font-weight: bold; text-align: left; background: none; border: none;") + outputs_layout.addWidget(self.outputs_btn) + + self.outputs_content = QWidget() + outputs_content_layout = QVBoxLayout(self.outputs_content) + outputs_content_layout.setSpacing(10) + # Add your outputs widgets here, e.g.: + outputs_content_layout.addWidget(QLabel("Outputs fields go here...")) + self.outputs_content.setVisible(False) + outputs_layout.addWidget(self.outputs_content) + + def toggle_outputs_content(checked): + self.outputs_content.setVisible(checked) + self.outputs_btn.setText("▼ Outputs" if checked else "► Outputs") + self.outputs_btn.toggled.connect(toggle_outputs_content) + + # Add all sections to the project content + project_content_layout.addWidget(general_info_box) + project_content_layout.addWidget(input_params_box) + project_content_layout.addWidget(outputs_box) + + project_layout.addWidget(project_header) + project_layout.addWidget(project_content) + project_layout.addStretch() + + # Add both panels to the splitter + self.splitter.addWidget(self.tutorials_panel) + self.splitter.addWidget(self.project_panel) + self.main_layout.addWidget(self.splitter) + + def create_status_bar(self): + status_bar = self.statusBar() + + data_btn = QPushButton("▲ Data") + data_btn.setStyleSheet("padding: 5px 15px;") + + status_bar.addPermanentWidget(data_btn) + + def update_tutorial_content(self): + # Get current page data + page_data = self.tutorial_pages[self.current_tutorial_page - 1] + + # Update the tutorial content + self.page_label.setText(page_data["page_number"]) + self.welcome_label.setText(page_data["title"]) + self.description_label.setText(page_data["content"]) + + def tutorial_next(self): + if self.current_tutorial_page < self.total_tutorial_pages: + self.current_tutorial_page += 1 + self.update_tutorial_content() + elif self.current_tutorial_page == self.total_tutorial_pages: + # Simulate clicking the Project Details tab button + if "Project Details" in self.tab_buttons: + self.tab_buttons["Project Details"].click() + + def tutorial_back(self): + if self.current_tutorial_page > 1: + self.current_tutorial_page -= 1 + self.update_tutorial_content() + + def close_tutorials(self): + # Hide the tutorials panel (in a real app, you might want to remove or collapse it) + self.sender().parent().parent().hide() + + def close_project_details(self): + # Hide the project details panel + self.sender().parent().parent().hide() + + def mousePressEvent(self, event): + # Hide menus when clicking outside + if self.file_menu_widget.isVisible() and not self.file_menu_widget.geometry().contains(event.pos()): + self.file_menu_widget.hide() + + if self.help_menu_widget.isVisible() and not self.help_menu_widget.geometry().contains(event.pos()): + self.help_menu_widget.hide() + + super().mousePressEvent(event) + + def save_general_info_data(self): + data = { + "company_name": self.company_edit.text(), + "project_title": self.title_edit.text(), + "project_description": self.desc_edit.text(), + "name_of_valuer": self.valuer_combo.currentText(), + "job_number": self.job_edit.text(), + "client": self.client_edit.text(), + "country": self.country_combo.currentText(), + "base_year": self.year_combo.currentText(), + } + save_general_info(data) + QMessageBox.information(self, "Success", "Data has been saved.") + # self.confirm_button.setEnabled(False) + + def closeEvent(self, event): + # Clearing the general_info.json file + filename = "src//osbridgelcca//desktop_app//assets//general_info.json" + with open(filename, "w", encoding="utf-8") as f: + json.dump({}, f, indent=4) + super().closeEvent(event) + + +if __name__ == '__main__': + app = QApplication(sys.argv) + window = BICCAStudio() + window.show() + sys.exit(app.exec_()) +#Sampel code for a PyQt5 desktop application given by the user +''' from PyQt5.QtWidgets import QApplication, QMainWindow, QPushButton, QVBoxLayout, QWidget from desktop_app.logic.controller import Controller @@ -30,3 +926,4 @@ def run_analysis(self): window = MainWindow() window.show() app.exec_() +''' \ No newline at end of file diff --git a/src/osbridgelcca/desktop_app/assets/MainWindow_icons/08b7798a84ffe0528bdec7dc8efe8fb1c89f77ae.png b/src/osbridgelcca/desktop_app/assets/MainWindow_icons/08b7798a84ffe0528bdec7dc8efe8fb1c89f77ae.png new file mode 100644 index 0000000..93ce61c Binary files /dev/null and b/src/osbridgelcca/desktop_app/assets/MainWindow_icons/08b7798a84ffe0528bdec7dc8efe8fb1c89f77ae.png differ diff --git a/src/osbridgelcca/desktop_app/assets/MainWindow_icons/78ff94ca74c504343b797700f5d515a40ab72143.png b/src/osbridgelcca/desktop_app/assets/MainWindow_icons/78ff94ca74c504343b797700f5d515a40ab72143.png new file mode 100644 index 0000000..5669f8b Binary files /dev/null and b/src/osbridgelcca/desktop_app/assets/MainWindow_icons/78ff94ca74c504343b797700f5d515a40ab72143.png differ diff --git a/src/osbridgelcca/desktop_app/assets/MainWindow_icons/Alert Circle.png b/src/osbridgelcca/desktop_app/assets/MainWindow_icons/Alert Circle.png new file mode 100644 index 0000000..9b173a4 Binary files /dev/null and b/src/osbridgelcca/desktop_app/assets/MainWindow_icons/Alert Circle.png differ diff --git a/src/osbridgelcca/desktop_app/assets/MainWindow_icons/Contact.png b/src/osbridgelcca/desktop_app/assets/MainWindow_icons/Contact.png new file mode 100644 index 0000000..fe516c3 Binary files /dev/null and b/src/osbridgelcca/desktop_app/assets/MainWindow_icons/Contact.png differ diff --git a/src/osbridgelcca/desktop_app/assets/MainWindow_icons/Dismiss.png b/src/osbridgelcca/desktop_app/assets/MainWindow_icons/Dismiss.png new file mode 100644 index 0000000..10bf0fc Binary files /dev/null and b/src/osbridgelcca/desktop_app/assets/MainWindow_icons/Dismiss.png differ diff --git a/src/osbridgelcca/desktop_app/assets/MainWindow_icons/Export.png b/src/osbridgelcca/desktop_app/assets/MainWindow_icons/Export.png new file mode 100644 index 0000000..cf61752 Binary files /dev/null and b/src/osbridgelcca/desktop_app/assets/MainWindow_icons/Export.png differ diff --git a/src/osbridgelcca/desktop_app/assets/MainWindow_icons/Icon.png b/src/osbridgelcca/desktop_app/assets/MainWindow_icons/Icon.png new file mode 100644 index 0000000..56995f1 Binary files /dev/null and b/src/osbridgelcca/desktop_app/assets/MainWindow_icons/Icon.png differ diff --git a/src/osbridgelcca/desktop_app/assets/MainWindow_icons/Vector (1).png b/src/osbridgelcca/desktop_app/assets/MainWindow_icons/Vector (1).png new file mode 100644 index 0000000..e43d34c Binary files /dev/null and b/src/osbridgelcca/desktop_app/assets/MainWindow_icons/Vector (1).png differ diff --git a/src/osbridgelcca/desktop_app/assets/MainWindow_icons/Vector (2).png b/src/osbridgelcca/desktop_app/assets/MainWindow_icons/Vector (2).png new file mode 100644 index 0000000..008bc09 Binary files /dev/null and b/src/osbridgelcca/desktop_app/assets/MainWindow_icons/Vector (2).png differ diff --git a/src/osbridgelcca/desktop_app/assets/MainWindow_icons/Vector (3).png b/src/osbridgelcca/desktop_app/assets/MainWindow_icons/Vector (3).png new file mode 100644 index 0000000..0bf2be0 Binary files /dev/null and b/src/osbridgelcca/desktop_app/assets/MainWindow_icons/Vector (3).png differ diff --git a/src/osbridgelcca/desktop_app/assets/MainWindow_icons/Vector (4).png b/src/osbridgelcca/desktop_app/assets/MainWindow_icons/Vector (4).png new file mode 100644 index 0000000..c43d9af Binary files /dev/null and b/src/osbridgelcca/desktop_app/assets/MainWindow_icons/Vector (4).png differ diff --git a/src/osbridgelcca/desktop_app/assets/MainWindow_icons/Vector.png b/src/osbridgelcca/desktop_app/assets/MainWindow_icons/Vector.png new file mode 100644 index 0000000..718aa64 Binary files /dev/null and b/src/osbridgelcca/desktop_app/assets/MainWindow_icons/Vector.png differ diff --git a/src/osbridgelcca/desktop_app/assets/MainWindow_icons/play_arrow_filled (1).png b/src/osbridgelcca/desktop_app/assets/MainWindow_icons/play_arrow_filled (1).png new file mode 100644 index 0000000..8700d20 Binary files /dev/null and b/src/osbridgelcca/desktop_app/assets/MainWindow_icons/play_arrow_filled (1).png differ diff --git a/src/osbridgelcca/desktop_app/assets/MainWindow_icons/play_arrow_filled.png b/src/osbridgelcca/desktop_app/assets/MainWindow_icons/play_arrow_filled.png new file mode 100644 index 0000000..95b18c8 Binary files /dev/null and b/src/osbridgelcca/desktop_app/assets/MainWindow_icons/play_arrow_filled.png differ diff --git "a/src/osbridgelcca/desktop_app/assets/MainWindow_icons/\360\237\246\206 icon _People Community_ (1).png" "b/src/osbridgelcca/desktop_app/assets/MainWindow_icons/\360\237\246\206 icon _People Community_ (1).png" new file mode 100644 index 0000000..44420f6 Binary files /dev/null and "b/src/osbridgelcca/desktop_app/assets/MainWindow_icons/\360\237\246\206 icon _People Community_ (1).png" differ diff --git "a/src/osbridgelcca/desktop_app/assets/MainWindow_icons/\360\237\246\206 icon _People Community_.png" "b/src/osbridgelcca/desktop_app/assets/MainWindow_icons/\360\237\246\206 icon _People Community_.png" new file mode 100644 index 0000000..44420f6 Binary files /dev/null and "b/src/osbridgelcca/desktop_app/assets/MainWindow_icons/\360\237\246\206 icon _People Community_.png" differ diff --git "a/src/osbridgelcca/desktop_app/assets/MainWindow_icons/\360\237\246\206 icon _Person Feedback_.png" "b/src/osbridgelcca/desktop_app/assets/MainWindow_icons/\360\237\246\206 icon _Person Feedback_.png" new file mode 100644 index 0000000..f90d4fc Binary files /dev/null and "b/src/osbridgelcca/desktop_app/assets/MainWindow_icons/\360\237\246\206 icon _Person Feedback_.png" differ diff --git "a/src/osbridgelcca/desktop_app/assets/MainWindow_icons/\360\237\246\206 icon _document save as template_.png" "b/src/osbridgelcca/desktop_app/assets/MainWindow_icons/\360\237\246\206 icon _document save as template_.png" new file mode 100644 index 0000000..c6b4a57 Binary files /dev/null and "b/src/osbridgelcca/desktop_app/assets/MainWindow_icons/\360\237\246\206 icon _document save as template_.png" differ diff --git "a/src/osbridgelcca/desktop_app/assets/MainWindow_icons/\360\237\246\206 icon _file copy_.png" "b/src/osbridgelcca/desktop_app/assets/MainWindow_icons/\360\237\246\206 icon _file copy_.png" new file mode 100644 index 0000000..1b36a75 Binary files /dev/null and "b/src/osbridgelcca/desktop_app/assets/MainWindow_icons/\360\237\246\206 icon _file copy_.png" differ diff --git "a/src/osbridgelcca/desktop_app/assets/MainWindow_icons/\360\237\246\206 icon _save action floppy_.png" "b/src/osbridgelcca/desktop_app/assets/MainWindow_icons/\360\237\246\206 icon _save action floppy_.png" new file mode 100644 index 0000000..51f95b7 Binary files /dev/null and "b/src/osbridgelcca/desktop_app/assets/MainWindow_icons/\360\237\246\206 icon _save action floppy_.png" differ diff --git "a/src/osbridgelcca/desktop_app/assets/MainWindow_icons/\360\237\246\206 icon _youtube_.png" "b/src/osbridgelcca/desktop_app/assets/MainWindow_icons/\360\237\246\206 icon _youtube_.png" new file mode 100644 index 0000000..31a058e Binary files /dev/null and "b/src/osbridgelcca/desktop_app/assets/MainWindow_icons/\360\237\246\206 icon _youtube_.png" differ diff --git a/src/osbridgelcca/desktop_app/assets/country_abbreviations.csv b/src/osbridgelcca/desktop_app/assets/country_abbreviations.csv new file mode 100644 index 0000000..69ab06a --- /dev/null +++ b/src/osbridgelcca/desktop_app/assets/country_abbreviations.csv @@ -0,0 +1,171 @@ +Abbreviation,Country Name +AFG,Afghanistan +AGO,Angola +ALB,Albania +ARE,United Arab Emirates +ARG,Argentina +ARM,Armenia +AUS,Australia +AUT,Austria +AZE,Azerbaijan +BDI,Burundi +BEL,Belgium +BEN,Benin +BFA,Burkina Faso +BGD,Bangladesh +BGR,Bulgaria +BHS,Bahamas +BIH,Bosnia and Herzegovina +BLR,Belarus +BLZ,Belize +BOL,Bolivia +BRA,Brazil +BRN,Bahrain +BTN,Bhutan +BWA,Botswana +CAF,Central African Republic +CAN,Canada +CHE,Switzerland +CHL,Chile +CHN,China +CIV,Côte d'Ivoire +CMR,Cameroon +COD,Democratic Republic of the Congo +COG,Republic of the Congo +COL,Colombia +COM,Comoros +CPV,Cabo Verde +CRI,Costa Rica +CUB,Cuba +CYP,Cyprus +CZE,Czechia +DEU,Germany +DJI,Djibouti +DNK,Denmark +DOM,Dominican Republic +DZA,Algeria +ECU,Ecuador +EGY,Egypt +ERI,Eritrea +ESP,Spain +EST,Estonia +ETH,Ethiopia +FIN,Finland +FJI,Fiji +FRA,France +GAB,Gabon +GBR,United Kingdom +GEO,Georgia +GHA,Ghana +GIN,Guinea +GMB,Gambia +GNB,Guinea-Bissau +GNQ,Equatorial Guinea +GRC,Greece +GTM,Guatemala +GUY,Guyana +HND,Honduras +HRV,Croatia +HTI,Haiti +HUN,Hungary +IDN,Indonesia +IND,India +IRL,Ireland +IRN,Iran +IRQ,Iraq +ISL,Iceland +ISR,Israel +ITA,Italy +JAM,Jamaica +JOR,Jordan +JPN,Japan +KAZ,Kazakhstan +KEN,Kenya +KGZ,Kyrgyzstan +KHM,Cambodia +KOR,South Korea +KWT,Kuwait +LAO,Laos +LBN,Lebanon +LBR,Liberia +LBY,Libya +LKA,Sri Lanka +LSO,Lesotho +LTU,Lithuania +LUX,Luxembourg +LVA,Latvia +MAR,Morocco +MDA,Moldova +MDG,Madagascar +MEX,Mexico +MKD,North Macedonia +MLI,Mali +MMR,Myanmar +MNE,Montenegro +MNG,Mongolia +MOZ,Mozambique +MRT,Mauritania +MUS,Mauritius +MWI,Malawi +MYS,Malaysia +NAM,Namibia +NCL,New Caledonia +NER,Niger +NGA,Nigeria +NIC,Nicaragua +NLD,Netherlands +NOR,Norway +NPL,Nepal +NZL,New Zealand +OMN,Oman +PAK,Pakistan +PAN,Panama +PER,Peru +PHL,Philippines +PNG,Papua New Guinea +POL,Poland +PRT,Portugal +PRY,Paraguay +QAT,Qatar +ROU,Romania +RUS,Russia +RWA,Rwanda +SAU,Saudi Arabia +SDN,Sudan +SEN,Senegal +SLB,Solomon Islands +SLE,Sierra Leone +SLV,El Salvador +SOM,Somalia +SRB,Serbia +STP,São Tomé and Príncipe +SUR,Suriname +SVK,Slovakia +SVN,Slovenia +SWE,Sweden +SWZ,Eswatini +SYR,Syria +TCD,Chad +TGO,Togo +THA,Thailand +TJK,Tajikistan +TKM,Turkmenistan +TTO,Trinidad and Tobago +TUN,Tunisia +TUR,Turkey +TZA,Tanzania +UGA,Uganda +UKR,Ukraine +URY,Uruguay +USA,United States +UZB,Uzbekistan +VCT,Saint Vincent and the Grenadines +VEN,Venezuela +VNM,Vietnam +VUT,Vanuatu +WLD,World +WSM,Samoa +YEM,Yemen +ZAF,South Africa +ZMB,Zambia +ZWE,Zimbabwe diff --git a/src/osbridgelcca/desktop_app/assets/general_info.json b/src/osbridgelcca/desktop_app/assets/general_info.json new file mode 100644 index 0000000..9e26dfe --- /dev/null +++ b/src/osbridgelcca/desktop_app/assets/general_info.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/src/osbridgelcca/desktop_app/assets/years_2000_to_2025.csv b/src/osbridgelcca/desktop_app/assets/years_2000_to_2025.csv new file mode 100644 index 0000000..474db58 --- /dev/null +++ b/src/osbridgelcca/desktop_app/assets/years_2000_to_2025.csv @@ -0,0 +1,27 @@ +Year +2000 +2001 +2002 +2003 +2004 +2005 +2006 +2007 +2008 +2009 +2010 +2011 +2012 +2013 +2014 +2015 +2016 +2017 +2018 +2019 +2020 +2021 +2022 +2023 +2024 +2025 diff --git a/src/osbridgelcca/desktop_app/ui/input_form.py b/src/osbridgelcca/desktop_app/ui/input_form.py index 5516c75..29f7c9c 100644 --- a/src/osbridgelcca/desktop_app/ui/input_form.py +++ b/src/osbridgelcca/desktop_app/ui/input_form.py @@ -1 +1,7 @@ # Placeholder for input form UI +import json + +def save_general_info(data, filename="src//osbridgelcca//desktop_app//assets//general_info.json"): + """Save the general information dictionary to a JSON file.""" + with open(filename, "w", encoding="utf-8") as f: + json.dump(data, f, indent=4) \ No newline at end of file diff --git a/src/osbridgelcca/desktop_app/ui/project_details_windows/ProjectDetails_BridgeANDTrafficData_Window.py b/src/osbridgelcca/desktop_app/ui/project_details_windows/ProjectDetails_BridgeANDTrafficData_Window.py new file mode 100644 index 0000000..57381ea --- /dev/null +++ b/src/osbridgelcca/desktop_app/ui/project_details_windows/ProjectDetails_BridgeANDTrafficData_Window.py @@ -0,0 +1,675 @@ +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file 'C:\Users\saans\AppData\Local\Programs\Python\Python310\Lib\site-packages\qt5_applications\Qt\bin\ProjectDetails_Bridge&TrafficData_Window.ui' +# +# Created by: PyQt5 UI code generator 5.15.9 +# +# WARNING: Any manual changes made to this file will be lost when pyuic5 is +# run again. Do not edit this file unless you know what you are doing. + + +from PyQt5 import QtCore, QtGui, QtWidgets +from PyQt5.QtWidgets import QMessageBox + # Add this import at the top +#from ProjectDetails_BridgeANDTrafficData_Window import Ui_BridgeTraffic_Dialog + + + + + + + + + + +class Ui_BridgeTraffic_Dialog(object): + def openBridgeTrafficWindow(self): + self.window = QtWidgets.QDialog() + self.ui = Ui_BridgeTraffic_Dialog() + self.ui.setupUi(self.window) + self.window.show() + + def openFoundationWindow(self): + from ProjectDetails_Foundation_Window import Ui_Foundation_Dialog + self.window = QtWidgets.QDialog() + self.ui = Ui_Foundation_Dialog() + self.ui.setupUi(self.window) + self.window.show() + + def openCarbonEmissionWindow(self): + from ProjectDetails_CarbonEmissionData_Window import Ui_CarbonEmission_Dialog + self.window = QtWidgets.QDialog() + self.ui = Ui_CarbonEmission_Dialog() + self.ui.setupUi(self.window) + self.window.show() + + def openDemolitionWindow(self): + from ProjectDetails_DemolitionANDRecyclingData_Window import Ui_Demolition_Dialog + self.window = QtWidgets.QDialog() + self.ui = Ui_Demolition_Dialog() + self.ui.setupUi(self.window) + self.window.show() + + def openFinancialWindow(self): + from ProjectDetails_FinancialData_Window import Ui_FinancialData_Dialog + self.window = QtWidgets.QDialog() + self.ui = Ui_FinancialData_Dialog() + self.ui.setupUi(self.window) + self.window.show() + + def openMaintenanceWindow(self): + from ProjectDetails_MaintenanceANDRepairData_Window import Ui_Maintenance_Dialog + self.window = QtWidgets.QDialog() + self.ui = Ui_Maintenance_Dialog() + self.ui.setupUi(self.window) + self.window.show() + + def openMiscellaneousWindow(self): + from ProjectDetails_Miscellaneous_Window import Ui_Miscellaneous_Dialog + self.window = QtWidgets.QDialog() + self.ui = Ui_Miscellaneous_Dialog() + self.ui.setupUi(self.window) + self.window.show() + + def openSubStructureWindow(self): + from ProjectDetails_SubStructure_Window import Ui_SubStructure_Dialog + self.window = QtWidgets.QDialog() + self.ui = Ui_SubStructure_Dialog() + self.ui.setupUi(self.window) + self.window.show() + + def openSuperStructureWindow(self): + from ProjectDetails_SuperStructure_Window import Ui_SuperStructure_Dialog + self.window = QtWidgets.QDialog() + self.ui = Ui_SuperStructure_Dialog() + self.ui.setupUi(self.window) + self.window.show() + + def setupUi(self, BridgeTraffic_Dialog): + BridgeTraffic_Dialog.setObjectName("BridgeTraffic_Dialog") + BridgeTraffic_Dialog.resize(1440, 900) + BridgeTraffic_Dialog.setStyleSheet("background-color: #fafafa") + self.scrollArea = QtWidgets.QScrollArea(BridgeTraffic_Dialog) + self.scrollArea.setGeometry(QtCore.QRect(10, 50, 241, 681)) + self.scrollArea.setAutoFillBackground(False) + self.scrollArea.setStyleSheet("background-color: #fff9f9") + self.scrollArea.setWidgetResizable(True) + self.scrollArea.setObjectName("scrollArea") + self.scrollAreaWidgetContents_3 = QtWidgets.QWidget() + self.scrollAreaWidgetContents_3.setGeometry(QtCore.QRect(0, 0, 239, 679)) + self.scrollAreaWidgetContents_3.setObjectName("scrollAreaWidgetContents_3") + self.label_16 = QtWidgets.QLabel(self.scrollAreaWidgetContents_3) + self.label_16.setGeometry(QtCore.QRect(0, 0, 221, 31)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_16.setFont(font) + self.label_16.setStyleSheet("background-color: rgb(240,230,230)") + self.label_16.setAlignment(QtCore.Qt.AlignCenter) + self.label_16.setObjectName("label_16") + self.widget_3 = QtWidgets.QWidget(self.scrollAreaWidgetContents_3) + self.widget_3.setGeometry(QtCore.QRect(0, 30, 221, 357)) + self.widget_3.setStyleSheet("background-color: #fff9f9") + self.widget_3.setObjectName("widget_3") + self.verticalLayout_3 = QtWidgets.QVBoxLayout(self.widget_3) + self.verticalLayout_3.setContentsMargins(0, 0, 0, 0) + self.verticalLayout_3.setObjectName("verticalLayout_3") + self.pushButton_34 = QtWidgets.QPushButton(self.widget_3) + font = QtGui.QFont() + font.setPointSize(10) + self.pushButton_34.setFont(font) + icon = QtGui.QIcon() + icon.addPixmap(QtGui.QPixmap("C:\\Users\\saans\\AppData\\Local\\Programs\\Python\\Python310\\Lib\\site-packages\\qt5_applications\\Qt\\bin\\../../../../../../../../../../Downloads/play_arrow_filled.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) + icon.addPixmap(QtGui.QPixmap("C:\\Users\\saans\\AppData\\Local\\Programs\\Python\\Python310\\Lib\\site-packages\\qt5_applications\\Qt\\bin\\../../../../../../../../../../Downloads/play_arrow_filled (1).png"), QtGui.QIcon.Normal, QtGui.QIcon.On) + self.pushButton_34.setIcon(icon) + self.pushButton_34.setCheckable(True) + self.pushButton_34.setAutoDefault(True) + self.pushButton_34.setObjectName("pushButton_34") + self.verticalLayout_3.addWidget(self.pushButton_34) + self.widget_7 = QtWidgets.QWidget(self.widget_3) + self.widget_7.setObjectName("widget_7") + self.formLayout_3 = QtWidgets.QFormLayout(self.widget_7) + self.formLayout_3.setObjectName("formLayout_3") + self.pushButton_35 = QtWidgets.QPushButton(self.widget_7, clicked=lambda: self.openFoundationWindow()) + font = QtGui.QFont() + font.setPointSize(10) + font.setBold(False) + font.setWeight(50) + self.pushButton_35.setFont(font) + icon1 = QtGui.QIcon() + icon1.addPixmap(QtGui.QPixmap("C:\\Users\\saans\\AppData\\Local\\Programs\\Python\\Python310\\Lib\\site-packages\\qt5_applications\\Qt\\bin\\../../../../../../../../../../Downloads/play_arrow_filled.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) + self.pushButton_35.setIcon(icon1) + self.pushButton_35.setObjectName("pushButton_35") + self.formLayout_3.setWidget(0, QtWidgets.QFormLayout.LabelRole, self.pushButton_35) + self.pushButton_36 = QtWidgets.QPushButton(self.widget_7, clicked=lambda: self.openSuperStructureWindow()) + font = QtGui.QFont() + font.setPointSize(10) + font.setBold(False) + font.setWeight(50) + self.pushButton_36.setFont(font) + self.pushButton_36.setIcon(icon1) + self.pushButton_36.setObjectName("pushButton_36") + self.formLayout_3.setWidget(1, QtWidgets.QFormLayout.LabelRole, self.pushButton_36) + self.pushButton_37 = QtWidgets.QPushButton(self.widget_7, clicked=lambda: self.openSubStructureWindow()) + font = QtGui.QFont() + font.setPointSize(10) + font.setBold(False) + font.setWeight(50) + self.pushButton_37.setFont(font) + self.pushButton_37.setIcon(icon1) + self.pushButton_37.setObjectName("pushButton_37") + self.formLayout_3.setWidget(2, QtWidgets.QFormLayout.LabelRole, self.pushButton_37) + self.pushButton_38 = QtWidgets.QPushButton(self.widget_7, clicked=lambda: self.openMiscellaneousWindow()) + font = QtGui.QFont() + font.setPointSize(10) + font.setBold(False) + font.setWeight(50) + self.pushButton_38.setFont(font) + self.pushButton_38.setIcon(icon1) + self.pushButton_38.setObjectName("pushButton_38") + self.formLayout_3.setWidget(3, QtWidgets.QFormLayout.LabelRole, self.pushButton_38) + self.verticalLayout_3.addWidget(self.widget_7) + self.pushButton_39 = QtWidgets.QPushButton(self.widget_3, clicked=lambda: self.openFinancialWindow()) + font = QtGui.QFont() + font.setPointSize(10) + self.pushButton_39.setFont(font) + self.pushButton_39.setObjectName("pushButton_39") + self.verticalLayout_3.addWidget(self.pushButton_39) + self.pushButton_40 = QtWidgets.QPushButton(self.widget_3) + font = QtGui.QFont() + font.setPointSize(10) + self.pushButton_40.setFont(font) + self.pushButton_40.setIcon(icon) + self.pushButton_40.setCheckable(True) + self.pushButton_40.setObjectName("pushButton_40") + self.verticalLayout_3.addWidget(self.pushButton_40) + self.widget_10 = QtWidgets.QWidget(self.widget_3) + self.widget_10.setMinimumSize(QtCore.QSize(203, 21)) + self.widget_10.setMaximumSize(QtCore.QSize(281, 21)) + self.widget_10.setObjectName("widget_10") + self.pushButton_41 = QtWidgets.QPushButton(self.widget_10, clicked=lambda: self.openCarbonEmissionWindow()) + self.pushButton_41.setGeometry(QtCore.QRect(20, 0, 183, 21)) + font = QtGui.QFont() + font.setPointSize(10) + font.setBold(False) + font.setWeight(50) + self.pushButton_41.setFont(font) + self.pushButton_41.setIcon(icon1) + self.pushButton_41.setObjectName("pushButton_41") + self.verticalLayout_3.addWidget(self.widget_10) + self.pushButton_42 = QtWidgets.QPushButton(self.widget_3, clicked=lambda: self.openBridgeTrafficWindow()) + font = QtGui.QFont() + font.setPointSize(10) + self.pushButton_42.setFont(font) + self.pushButton_42.setObjectName("pushButton_42") + self.verticalLayout_3.addWidget(self.pushButton_42) + self.pushButton_43 = QtWidgets.QPushButton(self.widget_3, clicked=lambda: self.openMaintenanceWindow()) + font = QtGui.QFont() + font.setPointSize(10) + self.pushButton_43.setFont(font) + self.pushButton_43.setObjectName("pushButton_43") + self.verticalLayout_3.addWidget(self.pushButton_43) + self.pushButton_12 = QtWidgets.QPushButton(self.widget_3, clicked=lambda: self.openDemolitionWindow()) + font = QtGui.QFont() + font.setPointSize(10) + self.pushButton_12.setFont(font) + self.pushButton_12.setObjectName("pushButton_12") + self.verticalLayout_3.addWidget(self.pushButton_12) + self.label_17 = QtWidgets.QLabel(self.scrollAreaWidgetContents_3) + self.label_17.setGeometry(QtCore.QRect(0, 387, 221, 31)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_17.setFont(font) + self.label_17.setStyleSheet("background-color: rgb(240,230,230)") + self.label_17.setAlignment(QtCore.Qt.AlignCenter) + self.label_17.setObjectName("label_17") + self.textBrowser_3 = QtWidgets.QTextBrowser(self.scrollAreaWidgetContents_3) + self.textBrowser_3.setGeometry(QtCore.QRect(0, 418, 221, 221)) + self.textBrowser_3.setStyleSheet("background-color: #fff9f9") + self.textBrowser_3.setObjectName("textBrowser_3") + self.verticalScrollBar_3 = QtWidgets.QScrollBar(self.scrollAreaWidgetContents_3) + self.verticalScrollBar_3.setGeometry(QtCore.QRect(220, 0, 16, 641)) + self.verticalScrollBar_3.setStyleSheet("background-color: #F0F0F0") + self.verticalScrollBar_3.setOrientation(QtCore.Qt.Vertical) + self.verticalScrollBar_3.setObjectName("verticalScrollBar_3") + self.scrollArea.setWidget(self.scrollAreaWidgetContents_3) + self.widget_4 = QtWidgets.QWidget(BridgeTraffic_Dialog) + self.widget_4.setGeometry(QtCore.QRect(350, 45, 895, 561)) + self.widget_4.setStyleSheet("background-color: #fff9f9; border: 1px solid black;") + self.widget_4.setObjectName("widget_4") + self.label_18 = QtWidgets.QLabel(self.widget_4) + self.label_18.setGeometry(QtCore.QRect(20, 20, 141, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_18.setFont(font) + self.label_18.setStyleSheet("border: none;") + self.label_18.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter) + self.label_18.setObjectName("label_18") + self.label_19 = QtWidgets.QLabel(self.widget_4) + self.label_19.setGeometry(QtCore.QRect(20, 80, 161, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_19.setFont(font) + self.label_19.setStyleSheet("border: none;") + self.label_19.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter) + self.label_19.setObjectName("label_19") + self.label_20 = QtWidgets.QLabel(self.widget_4) + self.label_20.setGeometry(QtCore.QRect(20, 50, 201, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_20.setFont(font) + self.label_20.setStyleSheet("border: none;") + self.label_20.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter) + self.label_20.setObjectName("label_20") + self.label_29 = QtWidgets.QLabel(self.widget_4) + self.label_29.setGeometry(QtCore.QRect(20, 110, 151, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_29.setFont(font) + self.label_29.setStyleSheet("border: none;") + self.label_29.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter) + self.label_29.setObjectName("label_29") + self.label_30 = QtWidgets.QLabel(self.widget_4) + self.label_30.setGeometry(QtCore.QRect(20, 140, 221, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_30.setFont(font) + self.label_30.setStyleSheet("border: none;") + self.label_30.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter) + self.label_30.setObjectName("label_30") + self.comboBox_6 = QtWidgets.QComboBox(self.widget_4) + self.comboBox_6.setGeometry(QtCore.QRect(270, 80, 101, 22)) + self.comboBox_6.setStyleSheet("border:none;") + self.comboBox_6.setStyleSheet("background-color: #ffffff") + self.comboBox_6.setObjectName("comboBox_6") + self.comboBox_7 = QtWidgets.QComboBox(self.widget_4) + self.comboBox_7.setGeometry(QtCore.QRect(270, 20, 101, 22)) + self.comboBox_7.setStyleSheet("border:none;") + self.comboBox_7.setStyleSheet("background-color: #ffffff") + self.comboBox_7.setObjectName("comboBox_7") + self.lineEdit_9 = QtWidgets.QLineEdit(self.widget_4) + self.lineEdit_9.setGeometry(QtCore.QRect(270, 50, 101, 20)) + self.lineEdit_9.setStyleSheet("border:none;") + font = QtGui.QFont() + font.setPointSize(10) + self.lineEdit_9.setFont(font) + self.lineEdit_9.setStyleSheet("background-color: #ffffff") + self.lineEdit_9.setObjectName("lineEdit_9") + self.lineEdit_10 = QtWidgets.QLineEdit(self.widget_4) + self.lineEdit_10.setGeometry(QtCore.QRect(270, 110, 101, 20)) + self.lineEdit_10.setStyleSheet("border:none;") + font = QtGui.QFont() + font.setPointSize(10) + self.lineEdit_10.setFont(font) + self.lineEdit_10.setStyleSheet("background-color: #ffffff") + self.lineEdit_10.setObjectName("lineEdit_10") + self.buttonBox_4 = QtWidgets.QDialogButtonBox(self.widget_4) + self.buttonBox_4.accepted.connect(self.save_data) + self.buttonBox_4.setGeometry(QtCore.QRect(540, 520, 341, 32)) + self.buttonBox_4.setStyleSheet("border: none;") + self.buttonBox_4.setOrientation(QtCore.Qt.Horizontal) + self.buttonBox_4.setStandardButtons(QtWidgets.QDialogButtonBox.Close|QtWidgets.QDialogButtonBox.Save) + self.buttonBox_4.setObjectName("buttonBox_4") + self.label_31 = QtWidgets.QLabel(self.widget_4) + self.label_31.setGeometry(QtCore.QRect(390, 200, 51, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_31.setFont(font) + self.label_31.setStyleSheet("border: none;") + self.label_31.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter) + self.label_31.setObjectName("label_31") + self.label_32 = QtWidgets.QLabel(self.widget_4) + self.label_32.setGeometry(QtCore.QRect(390, 50, 51, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_32.setFont(font) + self.label_32.setStyleSheet("border: none;") + self.label_32.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter) + self.label_32.setObjectName("label_32") + self.label_33 = QtWidgets.QLabel(self.widget_4) + self.label_33.setGeometry(QtCore.QRect(390, 80, 61, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_33.setFont(font) + self.label_33.setStyleSheet("border: none;") + self.label_33.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter) + self.label_33.setObjectName("label_33") + self.label_34 = QtWidgets.QLabel(self.widget_4) + self.label_34.setGeometry(QtCore.QRect(390, 110, 61, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_34.setFont(font) + self.label_34.setStyleSheet("border: none;") + self.label_34.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter) + self.label_34.setObjectName("label_34") + self.textBrowser_4 = QtWidgets.QTextBrowser(self.widget_4) + self.textBrowser_4.setGeometry(QtCore.QRect(20, 180, 221, 61)) + self.textBrowser_4.setStyleSheet("boeder:none;") + self.textBrowser_4.setObjectName("textBrowser_4") + self.label_35 = QtWidgets.QLabel(self.widget_4) + self.label_35.setGeometry(QtCore.QRect(20, 260, 221, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_35.setFont(font) + self.label_35.setStyleSheet("border: none;") + self.label_35.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter) + self.label_35.setObjectName("label_35") + self.comboBox_8 = QtWidgets.QComboBox(self.widget_4) + self.comboBox_8.setGeometry(QtCore.QRect(270, 140, 101, 22)) + self.comboBox_8.setStyleSheet("border: none;") + self.comboBox_8.setStyleSheet("background-color: #ffffff") + self.comboBox_8.setObjectName("comboBox_8") + self.comboBox_9 = QtWidgets.QComboBox(self.widget_4) + self.comboBox_9.setGeometry(QtCore.QRect(270, 200, 101, 22)) + self.comboBox_9.setStyleSheet("border: none;") + self.comboBox_9.setStyleSheet("background-color: #ffffff") + self.comboBox_9.setObjectName("comboBox_9") + self.widget_11 = QtWidgets.QWidget(self.widget_4) + self.widget_11.setGeometry(QtCore.QRect(270, 260, 330, 216)) + self.widget_11.setStyleSheet("border: none;") + self.widget_11.setStyleSheet("background-color: #ffffff") + self.widget_11.setObjectName("widget_11") + self.label_40 = QtWidgets.QLabel(self.widget_11) + self.label_40.setGeometry(QtCore.QRect(10, 170, 80, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_40.setFont(font) + self.label_40.setStyleSheet("border: none;") + self.label_40.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter) + self.label_40.setObjectName("label_40") + self.label_36 = QtWidgets.QLabel(self.widget_11) + self.label_36.setGeometry(QtCore.QRect(10, 10, 80, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_36.setFont(font) + self.label_36.setStyleSheet("border: none;") + self.label_36.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter) + self.label_36.setObjectName("label_36") + self.label_37 = QtWidgets.QLabel(self.widget_11) + self.label_37.setGeometry(QtCore.QRect(10, 50, 80, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_37.setFont(font) + self.label_37.setStyleSheet("border: none;") + self.label_37.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter) + self.label_37.setObjectName("label_37") + self.label_39 = QtWidgets.QLabel(self.widget_11) + self.label_39.setGeometry(QtCore.QRect(10, 90, 80, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_39.setFont(font) + self.label_39.setStyleSheet("border: none;") + self.label_39.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter) + self.label_39.setObjectName("label_39") + self.label_38 = QtWidgets.QLabel(self.widget_11) + self.label_38.setGeometry(QtCore.QRect(10, 130, 80, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_38.setFont(font) + self.label_38.setStyleSheet("border: none;") + self.label_38.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter) + self.label_38.setObjectName("label_38") + self.lineEdit_11 = QtWidgets.QLineEdit(self.widget_11) + self.lineEdit_11.setGeometry(QtCore.QRect(110, 10, 171, 20)) + font = QtGui.QFont() + font.setPointSize(10) + self.lineEdit_11.setFont(font) + self.lineEdit_11.setStyleSheet("background-color: #ffffff") + self.lineEdit_11.setObjectName("lineEdit_11") + self.lineEdit_12 = QtWidgets.QLineEdit(self.widget_11) + self.lineEdit_12.setGeometry(QtCore.QRect(110, 50, 171, 20)) + font = QtGui.QFont() + font.setPointSize(10) + self.lineEdit_12.setFont(font) + self.lineEdit_12.setStyleSheet("background-color: #ffffff") + self.lineEdit_12.setObjectName("lineEdit_12") + self.lineEdit_15 = QtWidgets.QLineEdit(self.widget_11) + self.lineEdit_15.setGeometry(QtCore.QRect(110, 90, 171, 20)) + font = QtGui.QFont() + font.setPointSize(10) + self.lineEdit_15.setFont(font) + self.lineEdit_15.setStyleSheet("background-color: #ffffff") + self.lineEdit_15.setObjectName("lineEdit_15") + self.lineEdit_16 = QtWidgets.QLineEdit(self.widget_11) + self.lineEdit_16.setGeometry(QtCore.QRect(110, 130, 171, 20)) + font = QtGui.QFont() + font.setPointSize(10) + self.lineEdit_16.setFont(font) + self.lineEdit_16.setStyleSheet("background-color: #ffffff") + self.lineEdit_16.setObjectName("lineEdit_16") + self.lineEdit_17 = QtWidgets.QLineEdit(self.widget_11) + self.lineEdit_17.setGeometry(QtCore.QRect(110, 170, 171, 20)) + font = QtGui.QFont() + font.setPointSize(10) + self.lineEdit_17.setFont(font) + self.lineEdit_17.setStyleSheet("background-color: #ffffff") + self.lineEdit_17.setObjectName("lineEdit_17") + self.label_41 = QtWidgets.QLabel(self.widget_4) + self.label_41.setGeometry(QtCore.QRect(610, 350, 61, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_41.setFont(font) + self.label_41.setStyleSheet("border: none;") + self.label_41.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter) + self.label_41.setObjectName("label_41") + self.pushButton = QtWidgets.QPushButton(BridgeTraffic_Dialog) + self.pushButton.setGeometry(QtCore.QRect(10, 20, 188, 25)) + font = QtGui.QFont() + font.setPointSize(10) + self.pushButton.setFont(font) + self.pushButton.setFocusPolicy(QtCore.Qt.StrongFocus) + self.pushButton.setLayoutDirection(QtCore.Qt.RightToLeft) + self.pushButton.setStyleSheet("background-color: rgb(240,230,230)") + icon2 = QtGui.QIcon() + icon2.addPixmap(QtGui.QPixmap("C:\\Users\\saans\\AppData\\Local\\Programs\\Python\\Python310\\Lib\\site-packages\\qt5_applications\\Qt\\bin\\../../../../../../../../../../Downloads/Dismiss.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) + self.pushButton.setIcon(icon2) + self.pushButton.setAutoRepeat(False) + self.pushButton.setObjectName("pushButton") + self.pushButton_6 = QtWidgets.QPushButton(BridgeTraffic_Dialog) + self.pushButton_6.setGeometry(QtCore.QRect(350, 20, 188, 25)) + font = QtGui.QFont() + font.setPointSize(10) + font.setBold(True) + font.setWeight(75) + self.pushButton_6.setFont(font) + self.pushButton_6.setFocusPolicy(QtCore.Qt.StrongFocus) + self.pushButton_6.setLayoutDirection(QtCore.Qt.RightToLeft) + self.pushButton_6.setStyleSheet("background-color: rgb(240,230,230)") + self.pushButton_6.setIcon(icon2) + self.pushButton_6.setAutoRepeat(False) + self.pushButton_6.setObjectName("pushButton_6") + + # Add a Save and Close button + # self.buttonBox = QtWidgets.QDialogButtonBox(BridgeTraffic_Dialog) + # self.buttonBox.setGeometry(QtCore.QRect(540, 520, 341, 32)) + # self.buttonBox.setOrientation(QtCore.Qt.Horizontal) + # self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Close | QtWidgets.QDialogButtonBox.Save) + # self.buttonBox.setObjectName("buttonBox") + + # # Connect the Close button to the custom close method + # self.buttonBox.rejected.connect(self.show_warning) + + # Connect the Save button to the save_data method (if implemented) + # self.buttonBox.accepted.connect(self.save_data) + + self.retranslateUi(BridgeTraffic_Dialog) + self.buttonBox_4.accepted.connect(lambda: [self.save_data(), BridgeTraffic_Dialog.accept()]) # type: ignore + self.buttonBox_4.rejected.connect(lambda: self.show_warning(BridgeTraffic_Dialog)) # type: ignore + self.pushButton_34.toggled['bool'].connect(self.widget_7.setVisible) # type: ignore + self.pushButton_40.toggled['bool'].connect(self.widget_10.setVisible) # type: ignore + QtCore.QMetaObject.connectSlotsByName(BridgeTraffic_Dialog) + + def show_warning(self, dialog): + """ + Show a warning window when the Close button is pressed. + """ + warning_box = QMessageBox() + warning_box.setIcon(QMessageBox.Warning) + warning_box.setWindowTitle("Confirm Close") + warning_box.setText("Are you sure you want to close without saving?") + warning_box.setStandardButtons(QMessageBox.Yes | QMessageBox.No) + warning_box.setDefaultButton(QMessageBox.No) + + # Check the user's response + response = warning_box.exec_() + if response == QMessageBox.Yes: + dialog.reject() # Close the application + else: + pass # Do nothing, return to the dialog + + def retranslateUi(self, BridgeTraffic_Dialog): + _translate = QtCore.QCoreApplication.translate + BridgeTraffic_Dialog.setWindowTitle(_translate("BridgeTraffic_Dialog", "Bridge and Traffic Data")) + self.label_16.setText(_translate("BridgeTraffic_Dialog", "Input Parameters")) + self.pushButton_34.setText(_translate("BridgeTraffic_Dialog", "Structure Works Data")) + self.pushButton_35.setText(_translate("BridgeTraffic_Dialog", "Foundation")) + self.pushButton_36.setText(_translate("BridgeTraffic_Dialog", "Super-Structure")) + self.pushButton_37.setText(_translate("BridgeTraffic_Dialog", "Sub-Structure")) + self.pushButton_38.setText(_translate("BridgeTraffic_Dialog", "Miscellaneous")) + self.pushButton_39.setText(_translate("BridgeTraffic_Dialog", "Financial Data")) + self.pushButton_40.setText(_translate("BridgeTraffic_Dialog", "Carbon Emission Data")) + self.pushButton_41.setText(_translate("BridgeTraffic_Dialog", "Carbon Emission Cost Data")) + self.pushButton_42.setText(_translate("BridgeTraffic_Dialog", "Bridge and Traffic Data")) + self.pushButton_43.setText(_translate("BridgeTraffic_Dialog", "Maintenance and Repair")) + self.pushButton_12.setText(_translate("BridgeTraffic_Dialog", "Disposal and Recycling")) + self.label_17.setText(_translate("BridgeTraffic_Dialog", "Output")) + self.textBrowser_3.setHtml(_translate("BridgeTraffic_Dialog", "\n" +"\n" +"

Initial Construction Cost

\n" +"

Initial Carbon emission Cost

\n" +"

Time Cost

\n" +"

Road User Cost

\n" +"

Carbon Emission due to Re-Routing

\n" +"

Periodic Maintenance Costs

\n" +"

Maintenance Emission Costs

\n" +"

Routine Inspectection Costs

\n" +"

Repair & Rehabilitation Costs

\n" +"

Reconstruction Costs

\n" +"

Demolition & Disposal Cost

\n" +"

Recycling Cost

\n" +"

Total Life-Cycle Cost

")) + self.label_18.setText(_translate("BridgeTraffic_Dialog", "Number of Lanes")) + self.label_19.setText(_translate("BridgeTraffic_Dialog", "Road Roughness")) + self.label_20.setText(_translate("BridgeTraffic_Dialog", "Additional Re-Route Distance")) + self.label_29.setText(_translate("BridgeTraffic_Dialog", "Road Rise and Fall (RF)")) + self.label_30.setText(_translate("BridgeTraffic_Dialog", "Type of Road")) + self.label_31.setText(_translate("BridgeTraffic_Dialog", "(%)")) + self.label_32.setText(_translate("BridgeTraffic_Dialog", "(km)")) + self.label_33.setText(_translate("BridgeTraffic_Dialog", "(mm/km)")) + self.label_34.setText(_translate("BridgeTraffic_Dialog", "(m/km)")) + self.textBrowser_4.setHtml(_translate("BridgeTraffic_Dialog", "\n" +"\n" +"

Annual Increaase in Traffic if Re-Routing duration increases more than a year

")) + self.label_35.setText(_translate("BridgeTraffic_Dialog", "Composition of Various Vehicles")) + self.label_40.setText(_translate("BridgeTraffic_Dialog", "LCV:")) + self.label_36.setText(_translate("BridgeTraffic_Dialog", "Cars:")) + self.label_37.setText(_translate("BridgeTraffic_Dialog", "Buses:")) + self.label_39.setText(_translate("BridgeTraffic_Dialog", "HCV:")) + self.label_38.setText(_translate("BridgeTraffic_Dialog", "MCV:")) + self.label_41.setText(_translate("BridgeTraffic_Dialog", "(PCU/D)")) + self.pushButton.setText(_translate("BridgeTraffic_Dialog", "Project Details Window ")) + self.pushButton_6.setText(_translate("BridgeTraffic_Dialog", "Bridge and Traffic Data ")) + + + def validate_data(self): + """Validate input data before saving""" + try: + # Check numeric fields + float(self.lineEdit_9.text()) # Additional re-route distance + float(self.lineEdit_10.text()) # Road rise and fall + + # Check vehicle composition percentages + vehicle_fields = [ + self.lineEdit_11.text(), # Cars + self.lineEdit_12.text(), # Buses + self.lineEdit_15.text(), # HCV + self.lineEdit_16.text(), # MCV + self.lineEdit_17.text() # LCV + ] + + total = sum(float(x) for x in vehicle_fields if x) + if total > 100: + QMessageBox.warning( + None, + "Validation Error", + "Vehicle composition percentages cannot exceed 100%", + QMessageBox.Ok + ) + return False + + return True + + except ValueError: + QMessageBox.warning( + None, + "Validation Error", + "Please enter valid numbers in all fields", + QMessageBox.Ok + ) + return False + + def save_data(self): + """Collect all input data and save it to a JSON file""" + if not self.validate_data(): + return + + data = { + # Bridge and Traffic Data + "number_of_lanes": self.comboBox_7.currentText(), + "additional_reroute_distance": self.lineEdit_9.text(), + "road_roughness": self.comboBox_6.currentText(), + "road_rise_and_fall": self.lineEdit_10.text(), + "type_of_road": self.comboBox_8.currentText(), + "annual_traffic_increase": self.comboBox_9.currentText(), + + # Vehicle Composition + "cars": self.lineEdit_11.text(), + "buses": self.lineEdit_12.text(), + "hcv": self.lineEdit_15.text(), + "mcv": self.lineEdit_16.text(), + "lcv": self.lineEdit_17.text(), + } + + # Save to JSON file + try: + import json + from datetime import datetime + + # Create filename with timestamp + timestamp = datetime.now().strftime("%Y%m%d_%H%M%S") + filename = "src//osbridgelcca//desktop_app//assets//"+f"bridge_traffic_data_{timestamp}.json" + + with open(filename, 'w') as f: + json.dump(data, f, indent=4) + + # Show success message + QMessageBox.information( + None, + "Success", + f"Data saved successfully to {filename}", + QMessageBox.Ok + ) + + return True + + except Exception as e: + QMessageBox.critical( + None, + "Error", + f"Failed to save data: {str(e)}", + QMessageBox.Ok + ) + return False + + +if __name__ == "__main__": + import sys + app = QtWidgets.QApplication(sys.argv) + BridgeTraffic_Dialog = QtWidgets.QDialog() + ui = Ui_BridgeTraffic_Dialog() + ui.setupUi(BridgeTraffic_Dialog) + BridgeTraffic_Dialog.show() + sys.exit(app.exec_()) diff --git a/src/osbridgelcca/desktop_app/ui/project_details_windows/ProjectDetails_CarbonEmissionData_Window.py b/src/osbridgelcca/desktop_app/ui/project_details_windows/ProjectDetails_CarbonEmissionData_Window.py new file mode 100644 index 0000000..7892205 --- /dev/null +++ b/src/osbridgelcca/desktop_app/ui/project_details_windows/ProjectDetails_CarbonEmissionData_Window.py @@ -0,0 +1,987 @@ +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file 'C:\Users\saans\AppData\Local\Programs\Python\Python310\Lib\site-packages\qt5_applications\Qt\bin\ProjectDetails_CarbonEmissionData_Window.ui' +# +# Created by: PyQt5 UI code generator 5.15.9 +# +# WARNING: Any manual changes made to this file will be lost when pyuic5 is +# run again. Do not edit this file unless you know what you are doing. + + +from PyQt5 import QtCore, QtGui, QtWidgets +from PyQt5.QtWidgets import QMessageBox + # Add this import at the top + + +#from ProjectDetails_CarbonEmissionData_Window import Ui_CarbonEmission_Dialog + + + + + + + + +class Ui_CarbonEmission_Dialog(object): + def openBridgeTrafficWindow(self): + self.window = QtWidgets.QDialog() + from ProjectDetails_BridgeANDTrafficData_Window import Ui_BridgeTraffic_Dialog + self.ui = Ui_BridgeTraffic_Dialog() + self.ui.setupUi(self.window) + self.window.show() + + def openFoundationWindow(self): + from ProjectDetails_Foundation_Window import Ui_Foundation_Dialog + self.window = QtWidgets.QDialog() + self.ui = Ui_Foundation_Dialog() + self.ui.setupUi(self.window) + self.window.show() + + def openCarbonEmissionWindow(self): + self.window = QtWidgets.QDialog() + self.ui = Ui_CarbonEmission_Dialog() + self.ui.setupUi(self.window) + self.window.show() + + def openDemolitionWindow(self): + from ProjectDetails_DemolitionANDRecyclingData_Window import Ui_Demolition_Dialog + self.window = QtWidgets.QDialog() + self.ui = Ui_Demolition_Dialog() + self.ui.setupUi(self.window) + self.window.show() + + def openFinancialWindow(self): + from ProjectDetails_FinancialData_Window import Ui_FinancialData_Dialog + self.window = QtWidgets.QDialog() + self.ui = Ui_FinancialData_Dialog() + self.ui.setupUi(self.window) + self.window.show() + + def openMaintenanceWindow(self): + from ProjectDetails_MaintenanceANDRepairData_Window import Ui_Maintenance_Dialog + self.window = QtWidgets.QDialog() + self.ui = Ui_Maintenance_Dialog() + self.ui.setupUi(self.window) + self.window.show() + + def openMiscellaneousWindow(self): + from ProjectDetails_Miscellaneous_Window import Ui_Miscellaneous_Dialog + self.window = QtWidgets.QDialog() + self.ui = Ui_Miscellaneous_Dialog() + self.ui.setupUi(self.window) + self.window.show() + + def openSubStructureWindow(self): + from ProjectDetails_SubStructure_Window import Ui_SubStructure_Dialog + self.window = QtWidgets.QDialog() + self.ui = Ui_SubStructure_Dialog() + self.ui.setupUi(self.window) + self.window.show() + + def openSuperStructureWindow(self): + from ProjectDetails_SuperStructure_Window import Ui_SuperStructure_Dialog + self.window = QtWidgets.QDialog() + self.ui = Ui_SuperStructure_Dialog() + self.ui.setupUi(self.window) + self.window.show() + + def setupUi(self, CarbonEmission_Dialog): + CarbonEmission_Dialog.setObjectName("CarbonEmission_Dialog") + CarbonEmission_Dialog.resize(1440, 900) + self.buttonBox = QtWidgets.QDialogButtonBox(CarbonEmission_Dialog) + self.buttonBox.setGeometry(QtCore.QRect(540, 690, 341, 32)) + self.buttonBox.setOrientation(QtCore.Qt.Horizontal) + self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Close | QtWidgets.QDialogButtonBox.Save) + self.buttonBox.setObjectName("buttonBox") + self.label = QtWidgets.QLabel(CarbonEmission_Dialog) + self.label.setGeometry(QtCore.QRect(10, 60, 244, 691)) + font = QtGui.QFont() + font.setPointSize(10) + self.label.setFont(font) + self.label.setStyleSheet("background-color: rgb(240,230,230)") + self.label.setText("") + self.label.setObjectName("label") + self.pushButton = QtWidgets.QPushButton(CarbonEmission_Dialog) + self.pushButton.setGeometry(QtCore.QRect(10, 35, 188, 25)) + font = QtGui.QFont() + font.setPointSize(10) + self.pushButton.setFont(font) + self.pushButton.setFocusPolicy(QtCore.Qt.StrongFocus) + self.pushButton.setLayoutDirection(QtCore.Qt.RightToLeft) + self.pushButton.setStyleSheet("background-color: rgb(240,230,230)") + icon = QtGui.QIcon() + icon.addPixmap(QtGui.QPixmap("C:\\Users\\saans\\AppData\\Local\\Programs\\Python\\Python310\\Lib\\site-packages\\qt5_applications\\Qt\\bin\\../../../../../../../../../../Downloads/Dismiss.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) + self.pushButton.setIcon(icon) + self.pushButton.setAutoRepeat(False) + self.pushButton.setObjectName("pushButton") + self.widget_2 = QtWidgets.QWidget(CarbonEmission_Dialog) + self.widget_2.setGeometry(QtCore.QRect(350, 60, 778, 708)) + self.widget_2.setStyleSheet("background-color: #fff9f9") + self.widget_2.setObjectName("widget_2") + self.label_56 = QtWidgets.QLabel(self.widget_2) + self.label_56.setGeometry(QtCore.QRect(20, 10, 91, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_56.setFont(font) + self.label_56.setObjectName("label_56") + self.comboBox_19 = QtWidgets.QComboBox(self.widget_2) + self.comboBox_19.setGeometry(QtCore.QRect(140, 10, 190, 22)) + font = QtGui.QFont() + font.setPointSize(10) + self.comboBox_19.setFont(font) + self.comboBox_19.setStyleSheet("background-color: #ffffff") + self.comboBox_19.setObjectName("comboBox_19") + self.comboBox_19.addItem("") + self.comboBox_19.addItem("") + self.label_57 = QtWidgets.QLabel(self.widget_2) + self.label_57.setGeometry(QtCore.QRect(20, 70, 161, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_57.setFont(font) + self.label_57.setAlignment(QtCore.Qt.AlignCenter) + self.label_57.setObjectName("label_57") + self.label_58 = QtWidgets.QLabel(self.widget_2) + self.label_58.setGeometry(QtCore.QRect(601, 70, 140, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_58.setFont(font) + self.label_58.setAlignment(QtCore.Qt.AlignCenter) + self.label_58.setObjectName("label_58") + self.label_59 = QtWidgets.QLabel(self.widget_2) + self.label_59.setGeometry(QtCore.QRect(191, 70, 110, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_59.setFont(font) + self.label_59.setAlignment(QtCore.Qt.AlignCenter) + self.label_59.setObjectName("label_59") + self.label_60 = QtWidgets.QLabel(self.widget_2) + self.label_60.setGeometry(QtCore.QRect(311, 70, 110, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_60.setFont(font) + self.label_60.setAlignment(QtCore.Qt.AlignCenter) + self.label_60.setObjectName("label_60") + self.label_61 = QtWidgets.QLabel(self.widget_2) + self.label_61.setGeometry(QtCore.QRect(440, 70, 151, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_61.setFont(font) + self.label_61.setAlignment(QtCore.Qt.AlignCenter) + self.label_61.setObjectName("label_61") + self.comboBox_20 = QtWidgets.QComboBox(self.widget_2) + self.comboBox_20.setGeometry(QtCore.QRect(30, 100, 140, 22)) + self.comboBox_20.setStyleSheet("background-color: #ffffff") + self.comboBox_20.setObjectName("comboBox_20") + self.comboBox_20.addItem("") + self.comboBox_20.addItem("") + self.comboBox_21 = QtWidgets.QComboBox(self.widget_2) + self.comboBox_21.setGeometry(QtCore.QRect(30, 130, 140, 22)) + self.comboBox_21.setStyleSheet("background-color: #ffffff") + self.comboBox_21.setObjectName("comboBox_21") + self.comboBox_21.addItem("") + self.comboBox_21.addItem("") + self.lineEdit_37 = QtWidgets.QLineEdit(self.widget_2) + self.lineEdit_37.setGeometry(QtCore.QRect(210, 100, 81, 20)) + font = QtGui.QFont() + font.setPointSize(10) + self.lineEdit_37.setFont(font) + self.lineEdit_37.setStyleSheet("background-color: #ffffff") + self.lineEdit_37.setObjectName("lineEdit_37") + self.lineEdit_38 = QtWidgets.QLineEdit(self.widget_2) + self.lineEdit_38.setGeometry(QtCore.QRect(210, 130, 81, 20)) + font = QtGui.QFont() + font.setPointSize(10) + self.lineEdit_38.setFont(font) + self.lineEdit_38.setStyleSheet("background-color: #ffffff") + self.lineEdit_38.setObjectName("lineEdit_38") + self.label_62 = QtWidgets.QLabel(self.widget_2) + self.label_62.setGeometry(QtCore.QRect(340, 100, 51, 20)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_62.setFont(font) + self.label_62.setStyleSheet("background-color: #ffffff") + self.label_62.setAlignment(QtCore.Qt.AlignCenter) + self.label_62.setObjectName("label_62") + self.label_63 = QtWidgets.QLabel(self.widget_2) + self.label_63.setGeometry(QtCore.QRect(340, 130, 51, 20)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_63.setFont(font) + self.label_63.setStyleSheet("background-color: #ffffff") + self.label_63.setAlignment(QtCore.Qt.AlignCenter) + self.label_63.setObjectName("label_63") + self.lineEdit_39 = QtWidgets.QLineEdit(self.widget_2) + self.lineEdit_39.setGeometry(QtCore.QRect(450, 100, 81, 20)) + font = QtGui.QFont() + font.setPointSize(10) + self.lineEdit_39.setFont(font) + self.lineEdit_39.setStyleSheet("background-color: #ffffff") + self.lineEdit_39.setObjectName("lineEdit_39") + self.lineEdit_40 = QtWidgets.QLineEdit(self.widget_2) + self.lineEdit_40.setGeometry(QtCore.QRect(450, 130, 81, 20)) + font = QtGui.QFont() + font.setPointSize(10) + self.lineEdit_40.setFont(font) + self.lineEdit_40.setStyleSheet("background-color: #ffffff") + self.lineEdit_40.setObjectName("lineEdit_40") + self.lineEdit_41 = QtWidgets.QLineEdit(self.widget_2) + self.lineEdit_41.setGeometry(QtCore.QRect(610, 100, 81, 20)) + font = QtGui.QFont() + font.setPointSize(10) + self.lineEdit_41.setFont(font) + self.lineEdit_41.setStyleSheet("background-color: #ffffff") + self.lineEdit_41.setObjectName("lineEdit_41") + self.lineEdit_42 = QtWidgets.QLineEdit(self.widget_2) + self.lineEdit_42.setGeometry(QtCore.QRect(610, 130, 81, 20)) + font = QtGui.QFont() + font.setPointSize(10) + self.lineEdit_42.setFont(font) + self.lineEdit_42.setStyleSheet("background-color: #ffffff") + self.lineEdit_42.setObjectName("lineEdit_42") + # self.pushButton_13 = QtWidgets.QPushButton(self.widget_2) + # self.pushButton_13.setGeometry(QtCore.QRect(300, 200, 190, 23)) + # self.pushButton_13.setStyleSheet("background-color: #ffffff") + # self.pushButton_13.setObjectName("pushButton_13") + # self.pushButton_49 = QtWidgets.QPushButton(self.widget_2) + # self.pushButton_49.setGeometry(QtCore.QRect(310, 440, 190, 23)) + # self.pushButton_49.setStyleSheet("background-color: #ffffff") + # self.pushButton_49.setObjectName("pushButton_49") + self.buttonBox_5 = QtWidgets.QDialogButtonBox(self.widget_2) + self.buttonBox_5.setGeometry(QtCore.QRect(430, 670, 341, 32)) + self.buttonBox_5.setOrientation(QtCore.Qt.Horizontal) + self.buttonBox_5.setStandardButtons(QtWidgets.QDialogButtonBox.Close|QtWidgets.QDialogButtonBox.Save) + self.buttonBox_5.setCenterButtons(False) + self.buttonBox_5.setObjectName("buttonBox_5") + self.line_7 = QtWidgets.QFrame(self.widget_2) + self.line_7.setGeometry(QtCore.QRect(10, 230, 761, 16)) + self.line_7.setContextMenuPolicy(QtCore.Qt.DefaultContextMenu) + self.line_7.setFrameShadow(QtWidgets.QFrame.Sunken) + self.line_7.setLineWidth(2) + self.line_7.setMidLineWidth(2) + self.line_7.setFrameShape(QtWidgets.QFrame.HLine) + self.line_7.setObjectName("line_7") + self.line_8 = QtWidgets.QFrame(self.widget_2) + self.line_8.setGeometry(QtCore.QRect(10, 470, 761, 16)) + self.line_8.setContextMenuPolicy(QtCore.Qt.DefaultContextMenu) + self.line_8.setFrameShadow(QtWidgets.QFrame.Sunken) + self.line_8.setLineWidth(2) + self.line_8.setMidLineWidth(2) + self.line_8.setFrameShape(QtWidgets.QFrame.HLine) + self.line_8.setObjectName("line_8") + self.label_74 = QtWidgets.QLabel(self.widget_2) + self.label_74.setGeometry(QtCore.QRect(540, 100, 51, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_74.setFont(font) + self.label_74.setAlignment(QtCore.Qt.AlignCenter) + self.label_74.setObjectName("label_74") + self.label_75 = QtWidgets.QLabel(self.widget_2) + self.label_75.setGeometry(QtCore.QRect(540, 130, 51, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_75.setFont(font) + self.label_75.setAlignment(QtCore.Qt.AlignCenter) + self.label_75.setObjectName("label_75") + self.label_76 = QtWidgets.QLabel(self.widget_2) + self.label_76.setGeometry(QtCore.QRect(700, 100, 71, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_76.setFont(font) + self.label_76.setAlignment(QtCore.Qt.AlignCenter) + self.label_76.setObjectName("label_76") + self.label_77 = QtWidgets.QLabel(self.widget_2) + self.label_77.setGeometry(QtCore.QRect(700, 130, 71, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_77.setFont(font) + self.label_77.setAlignment(QtCore.Qt.AlignCenter) + self.label_77.setObjectName("label_77") + self.label_78 = QtWidgets.QLabel(self.widget_2) + self.label_78.setGeometry(QtCore.QRect(539, 340, 51, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_78.setFont(font) + self.label_78.setAlignment(QtCore.Qt.AlignCenter) + self.label_78.setObjectName("label_78") + self.label_79 = QtWidgets.QLabel(self.widget_2) + self.label_79.setGeometry(QtCore.QRect(699, 370, 71, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_79.setFont(font) + self.label_79.setAlignment(QtCore.Qt.AlignCenter) + self.label_79.setObjectName("label_79") + self.label_64 = QtWidgets.QLabel(self.widget_2) + self.label_64.setGeometry(QtCore.QRect(339, 340, 51, 20)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_64.setFont(font) + self.label_64.setStyleSheet("background-color: #ffffff") + self.label_64.setAlignment(QtCore.Qt.AlignCenter) + self.label_64.setObjectName("label_64") + self.label_65 = QtWidgets.QLabel(self.widget_2) + self.label_65.setGeometry(QtCore.QRect(339, 370, 51, 20)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_65.setFont(font) + self.label_65.setStyleSheet("background-color: #ffffff") + self.label_65.setAlignment(QtCore.Qt.AlignCenter) + self.label_65.setObjectName("label_65") + self.lineEdit_43 = QtWidgets.QLineEdit(self.widget_2) + self.lineEdit_43.setGeometry(QtCore.QRect(609, 370, 81, 20)) + font = QtGui.QFont() + font.setPointSize(10) + self.lineEdit_43.setFont(font) + self.lineEdit_43.setStyleSheet("background-color: #ffffff") + self.lineEdit_43.setObjectName("lineEdit_43") + self.lineEdit_44 = QtWidgets.QLineEdit(self.widget_2) + self.lineEdit_44.setGeometry(QtCore.QRect(209, 370, 81, 20)) + font = QtGui.QFont() + font.setPointSize(10) + self.lineEdit_44.setFont(font) + self.lineEdit_44.setStyleSheet("background-color: #ffffff") + self.lineEdit_44.setObjectName("lineEdit_44") + self.label_80 = QtWidgets.QLabel(self.widget_2) + self.label_80.setGeometry(QtCore.QRect(699, 340, 71, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_80.setFont(font) + self.label_80.setAlignment(QtCore.Qt.AlignCenter) + self.label_80.setObjectName("label_80") + self.label_66 = QtWidgets.QLabel(self.widget_2) + self.label_66.setGeometry(QtCore.QRect(19, 250, 91, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_66.setFont(font) + self.label_66.setObjectName("label_66") + self.lineEdit_45 = QtWidgets.QLineEdit(self.widget_2) + self.lineEdit_45.setGeometry(QtCore.QRect(449, 370, 81, 20)) + font = QtGui.QFont() + font.setPointSize(10) + self.lineEdit_45.setFont(font) + self.lineEdit_45.setStyleSheet("background-color: #ffffff") + self.lineEdit_45.setObjectName("lineEdit_45") + self.label_67 = QtWidgets.QLabel(self.widget_2) + self.label_67.setGeometry(QtCore.QRect(19, 310, 161, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_67.setFont(font) + self.label_67.setAlignment(QtCore.Qt.AlignCenter) + self.label_67.setObjectName("label_67") + self.label_81 = QtWidgets.QLabel(self.widget_2) + self.label_81.setGeometry(QtCore.QRect(539, 370, 51, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_81.setFont(font) + self.label_81.setAlignment(QtCore.Qt.AlignCenter) + self.label_81.setObjectName("label_81") + self.label_68 = QtWidgets.QLabel(self.widget_2) + self.label_68.setGeometry(QtCore.QRect(600, 310, 140, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_68.setFont(font) + self.label_68.setAlignment(QtCore.Qt.AlignCenter) + self.label_68.setObjectName("label_68") + self.label_69 = QtWidgets.QLabel(self.widget_2) + self.label_69.setGeometry(QtCore.QRect(190, 310, 110, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_69.setFont(font) + self.label_69.setAlignment(QtCore.Qt.AlignCenter) + self.label_69.setObjectName("label_69") + self.comboBox_22 = QtWidgets.QComboBox(self.widget_2) + self.comboBox_22.setGeometry(QtCore.QRect(29, 340, 140, 22)) + self.comboBox_22.setStyleSheet("background-color: #ffffff") + self.comboBox_22.setObjectName("comboBox_22") + self.comboBox_22.addItem("") + self.comboBox_22.addItem("") + self.label_70 = QtWidgets.QLabel(self.widget_2) + self.label_70.setGeometry(QtCore.QRect(439, 310, 151, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_70.setFont(font) + self.label_70.setAlignment(QtCore.Qt.AlignCenter) + self.label_70.setObjectName("label_70") + self.lineEdit_46 = QtWidgets.QLineEdit(self.widget_2) + self.lineEdit_46.setGeometry(QtCore.QRect(449, 340, 81, 20)) + font = QtGui.QFont() + font.setPointSize(10) + self.lineEdit_46.setFont(font) + self.lineEdit_46.setStyleSheet("background-color: #ffffff") + self.lineEdit_46.setObjectName("lineEdit_46") + self.comboBox_23 = QtWidgets.QComboBox(self.widget_2) + self.comboBox_23.setGeometry(QtCore.QRect(29, 370, 140, 22)) + self.comboBox_23.setStyleSheet("background-color: #ffffff") + self.comboBox_23.setObjectName("comboBox_23") + self.comboBox_23.addItem("") + self.comboBox_23.addItem("") + self.comboBox_24 = QtWidgets.QComboBox(self.widget_2) + self.comboBox_24.setGeometry(QtCore.QRect(139, 250, 190, 22)) + font = QtGui.QFont() + font.setPointSize(10) + self.comboBox_24.setFont(font) + self.comboBox_24.setStyleSheet("background-color: #ffffff") + self.comboBox_24.setObjectName("comboBox_24") + self.comboBox_24.addItem("") + self.comboBox_24.addItem("") + self.lineEdit_47 = QtWidgets.QLineEdit(self.widget_2) + self.lineEdit_47.setGeometry(QtCore.QRect(609, 340, 81, 20)) + font = QtGui.QFont() + font.setPointSize(10) + self.lineEdit_47.setFont(font) + self.lineEdit_47.setStyleSheet("background-color: #ffffff") + self.lineEdit_47.setObjectName("lineEdit_47") + self.lineEdit_48 = QtWidgets.QLineEdit(self.widget_2) + self.lineEdit_48.setGeometry(QtCore.QRect(209, 340, 81, 20)) + font = QtGui.QFont() + font.setPointSize(10) + self.lineEdit_48.setFont(font) + self.lineEdit_48.setStyleSheet("background-color: #ffffff") + self.lineEdit_48.setObjectName("lineEdit_48") + self.label_71 = QtWidgets.QLabel(self.widget_2) + self.label_71.setGeometry(QtCore.QRect(310, 310, 110, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_71.setFont(font) + self.label_71.setAlignment(QtCore.Qt.AlignCenter) + self.label_71.setObjectName("label_71") + self.label_82 = QtWidgets.QLabel(self.widget_2) + self.label_82.setGeometry(QtCore.QRect(539, 580, 51, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_82.setFont(font) + self.label_82.setAlignment(QtCore.Qt.AlignCenter) + self.label_82.setObjectName("label_82") + self.label_83 = QtWidgets.QLabel(self.widget_2) + self.label_83.setGeometry(QtCore.QRect(699, 610, 71, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_83.setFont(font) + self.label_83.setAlignment(QtCore.Qt.AlignCenter) + self.label_83.setObjectName("label_83") + self.label_84 = QtWidgets.QLabel(self.widget_2) + self.label_84.setGeometry(QtCore.QRect(339, 580, 51, 20)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_84.setFont(font) + self.label_84.setStyleSheet("background-color: #ffffff") + self.label_84.setAlignment(QtCore.Qt.AlignCenter) + self.label_84.setObjectName("label_84") + self.label_85 = QtWidgets.QLabel(self.widget_2) + self.label_85.setGeometry(QtCore.QRect(339, 610, 51, 20)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_85.setFont(font) + self.label_85.setStyleSheet("background-color: #ffffff") + self.label_85.setAlignment(QtCore.Qt.AlignCenter) + self.label_85.setObjectName("label_85") + self.lineEdit_49 = QtWidgets.QLineEdit(self.widget_2) + self.lineEdit_49.setGeometry(QtCore.QRect(609, 610, 81, 20)) + font = QtGui.QFont() + font.setPointSize(10) + self.lineEdit_49.setFont(font) + self.lineEdit_49.setStyleSheet("background-color: #ffffff") + self.lineEdit_49.setObjectName("lineEdit_49") + self.lineEdit_50 = QtWidgets.QLineEdit(self.widget_2) + self.lineEdit_50.setGeometry(QtCore.QRect(209, 610, 81, 20)) + font = QtGui.QFont() + font.setPointSize(10) + self.lineEdit_50.setFont(font) + self.lineEdit_50.setStyleSheet("background-color: #ffffff") + self.lineEdit_50.setObjectName("lineEdit_50") + self.label_86 = QtWidgets.QLabel(self.widget_2) + self.label_86.setGeometry(QtCore.QRect(699, 580, 71, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_86.setFont(font) + self.label_86.setAlignment(QtCore.Qt.AlignCenter) + self.label_86.setObjectName("label_86") + self.label_87 = QtWidgets.QLabel(self.widget_2) + self.label_87.setGeometry(QtCore.QRect(19, 490, 91, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_87.setFont(font) + self.label_87.setObjectName("label_87") + self.lineEdit_51 = QtWidgets.QLineEdit(self.widget_2) + self.lineEdit_51.setGeometry(QtCore.QRect(449, 610, 81, 20)) + font = QtGui.QFont() + font.setPointSize(10) + self.lineEdit_51.setFont(font) + self.lineEdit_51.setStyleSheet("background-color: #ffffff") + self.lineEdit_51.setObjectName("lineEdit_51") + self.label_88 = QtWidgets.QLabel(self.widget_2) + self.label_88.setGeometry(QtCore.QRect(19, 550, 161, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_88.setFont(font) + self.label_88.setAlignment(QtCore.Qt.AlignCenter) + self.label_88.setObjectName("label_88") + self.label_89 = QtWidgets.QLabel(self.widget_2) + self.label_89.setGeometry(QtCore.QRect(539, 610, 51, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_89.setFont(font) + self.label_89.setAlignment(QtCore.Qt.AlignCenter) + self.label_89.setObjectName("label_89") + self.label_90 = QtWidgets.QLabel(self.widget_2) + self.label_90.setGeometry(QtCore.QRect(600, 550, 140, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_90.setFont(font) + self.label_90.setAlignment(QtCore.Qt.AlignCenter) + self.label_90.setObjectName("label_90") + self.label_91 = QtWidgets.QLabel(self.widget_2) + self.label_91.setGeometry(QtCore.QRect(190, 550, 110, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_91.setFont(font) + self.label_91.setAlignment(QtCore.Qt.AlignCenter) + self.label_91.setObjectName("label_91") + self.comboBox_25 = QtWidgets.QComboBox(self.widget_2) + self.comboBox_25.setGeometry(QtCore.QRect(29, 580, 140, 22)) + self.comboBox_25.setStyleSheet("background-color: #ffffff") + self.comboBox_25.setObjectName("comboBox_25") + self.comboBox_25.addItem("") + self.comboBox_25.addItem("") + self.label_92 = QtWidgets.QLabel(self.widget_2) + self.label_92.setGeometry(QtCore.QRect(439, 550, 151, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_92.setFont(font) + self.label_92.setAlignment(QtCore.Qt.AlignCenter) + self.label_92.setObjectName("label_92") + self.lineEdit_52 = QtWidgets.QLineEdit(self.widget_2) + self.lineEdit_52.setGeometry(QtCore.QRect(449, 580, 81, 20)) + font = QtGui.QFont() + font.setPointSize(10) + self.lineEdit_52.setFont(font) + self.lineEdit_52.setStyleSheet("background-color: #ffffff") + self.lineEdit_52.setObjectName("lineEdit_52") + self.comboBox_26 = QtWidgets.QComboBox(self.widget_2) + self.comboBox_26.setGeometry(QtCore.QRect(29, 610, 140, 22)) + self.comboBox_26.setStyleSheet("background-color: #ffffff") + self.comboBox_26.setObjectName("comboBox_26") + self.comboBox_26.addItem("") + self.comboBox_26.addItem("") + self.comboBox_27 = QtWidgets.QComboBox(self.widget_2) + self.comboBox_27.setGeometry(QtCore.QRect(139, 490, 190, 22)) + font = QtGui.QFont() + font.setPointSize(10) + self.comboBox_27.setFont(font) + self.comboBox_27.setStyleSheet("background-color: #ffffff") + self.comboBox_27.setObjectName("comboBox_27") + self.comboBox_27.addItem("") + self.comboBox_27.addItem("") + self.lineEdit_53 = QtWidgets.QLineEdit(self.widget_2) + self.lineEdit_53.setGeometry(QtCore.QRect(609, 580, 81, 20)) + font = QtGui.QFont() + font.setPointSize(10) + self.lineEdit_53.setFont(font) + self.lineEdit_53.setStyleSheet("background-color: #ffffff") + self.lineEdit_53.setObjectName("lineEdit_53") + self.lineEdit_54 = QtWidgets.QLineEdit(self.widget_2) + self.lineEdit_54.setGeometry(QtCore.QRect(209, 580, 81, 20)) + font = QtGui.QFont() + font.setPointSize(10) + self.lineEdit_54.setFont(font) + self.lineEdit_54.setStyleSheet("background-color: #ffffff") + self.lineEdit_54.setObjectName("lineEdit_54") + self.label_93 = QtWidgets.QLabel(self.widget_2) + self.label_93.setGeometry(QtCore.QRect(310, 550, 110, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_93.setFont(font) + self.label_93.setAlignment(QtCore.Qt.AlignCenter) + self.label_93.setObjectName("label_93") + self.pushButton_50 = QtWidgets.QPushButton(self.widget_2) + self.pushButton_50.setGeometry(QtCore.QRect(310, 670, 190, 23)) + self.pushButton_50.setStyleSheet("background-color: #ffffff") + self.pushButton_50.setObjectName("pushButton_50") + self.scrollArea = QtWidgets.QScrollArea(CarbonEmission_Dialog) + self.scrollArea.setGeometry(QtCore.QRect(10, 65, 241, 681)) + self.scrollArea.setAutoFillBackground(False) + self.scrollArea.setStyleSheet("background-color: #fff9f9") + self.scrollArea.setWidgetResizable(True) + self.scrollArea.setObjectName("scrollArea") + self.scrollAreaWidgetContents_4 = QtWidgets.QWidget() + self.scrollAreaWidgetContents_4.setGeometry(QtCore.QRect(0, 0, 239, 679)) + self.scrollAreaWidgetContents_4.setObjectName("scrollAreaWidgetContents_4") + self.label_72 = QtWidgets.QLabel(self.scrollAreaWidgetContents_4) + self.label_72.setGeometry(QtCore.QRect(0, 0, 221, 31)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_72.setFont(font) + self.label_72.setStyleSheet("background-color: rgb(240,230,230)") + self.label_72.setAlignment(QtCore.Qt.AlignCenter) + self.label_72.setObjectName("label_72") + self.widget_11 = QtWidgets.QWidget(self.scrollAreaWidgetContents_4) + self.widget_11.setGeometry(QtCore.QRect(0, 30, 221, 357)) + self.widget_11.setStyleSheet("background-color: #fff9f9") + self.widget_11.setObjectName("widget_11") + self.verticalLayout_4 = QtWidgets.QVBoxLayout(self.widget_11) + self.verticalLayout_4.setContentsMargins(0, 0, 0, 0) + self.verticalLayout_4.setObjectName("verticalLayout_4") + self.pushButton_51 = QtWidgets.QPushButton(self.widget_11) + font = QtGui.QFont() + font.setPointSize(10) + self.pushButton_51.setFont(font) + icon1 = QtGui.QIcon() + icon1.addPixmap(QtGui.QPixmap("C:\\Users\\saans\\AppData\\Local\\Programs\\Python\\Python310\\Lib\\site-packages\\qt5_applications\\Qt\\bin\\../../../../../../../../../../Downloads/play_arrow_filled.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) + icon1.addPixmap(QtGui.QPixmap("C:\\Users\\saans\\AppData\\Local\\Programs\\Python\\Python310\\Lib\\site-packages\\qt5_applications\\Qt\\bin\\../../../../../../../../../../Downloads/play_arrow_filled (1).png"), QtGui.QIcon.Normal, QtGui.QIcon.On) + self.pushButton_51.setIcon(icon1) + self.pushButton_51.setCheckable(True) + self.pushButton_51.setAutoDefault(True) + self.pushButton_51.setObjectName("pushButton_51") + self.verticalLayout_4.addWidget(self.pushButton_51) + self.widget_12 = QtWidgets.QWidget(self.widget_11) + self.widget_12.setObjectName("widget_12") + self.formLayout_4 = QtWidgets.QFormLayout(self.widget_12) + self.formLayout_4.setObjectName("formLayout_4") + self.pushButton_52 = QtWidgets.QPushButton(self.widget_12, clicked=lambda: self.openFoundationWindow()) + font = QtGui.QFont() + font.setPointSize(10) + font.setBold(False) + font.setWeight(50) + self.pushButton_52.setFont(font) + icon2 = QtGui.QIcon() + icon2.addPixmap(QtGui.QPixmap("C:\\Users\\saans\\AppData\\Local\\Programs\\Python\\Python310\\Lib\\site-packages\\qt5_applications\\Qt\\bin\\../../../../../../../../../../Downloads/play_arrow_filled.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) + self.pushButton_52.setIcon(icon2) + self.pushButton_52.setObjectName("pushButton_52") + self.formLayout_4.setWidget(0, QtWidgets.QFormLayout.LabelRole, self.pushButton_52) + self.pushButton_53 = QtWidgets.QPushButton(self.widget_12, clicked=lambda: self.openSuperStructureWindow()) + font = QtGui.QFont() + font.setPointSize(10) + font.setBold(False) + font.setWeight(50) + self.pushButton_53.setFont(font) + self.pushButton_53.setIcon(icon2) + self.pushButton_53.setObjectName("pushButton_53") + self.formLayout_4.setWidget(1, QtWidgets.QFormLayout.LabelRole, self.pushButton_53) + self.pushButton_54 = QtWidgets.QPushButton(self.widget_12, clicked=lambda: self.openSubStructureWindow()) + font = QtGui.QFont() + font.setPointSize(10) + font.setBold(False) + font.setWeight(50) + self.pushButton_54.setFont(font) + self.pushButton_54.setIcon(icon2) + self.pushButton_54.setObjectName("pushButton_54") + self.formLayout_4.setWidget(2, QtWidgets.QFormLayout.LabelRole, self.pushButton_54) + self.pushButton_55 = QtWidgets.QPushButton(self.widget_12, clicked=lambda: self.openMiscellaneousWindow()) + font = QtGui.QFont() + font.setPointSize(10) + font.setBold(False) + font.setWeight(50) + self.pushButton_55.setFont(font) + self.pushButton_55.setIcon(icon2) + self.pushButton_55.setObjectName("pushButton_55") + self.formLayout_4.setWidget(3, QtWidgets.QFormLayout.LabelRole, self.pushButton_55) + self.verticalLayout_4.addWidget(self.widget_12) + self.pushButton_56 = QtWidgets.QPushButton(self.widget_11, clicked=lambda: self.openFinancialWindow()) + font = QtGui.QFont() + font.setPointSize(10) + self.pushButton_56.setFont(font) + self.pushButton_56.setObjectName("pushButton_56") + self.verticalLayout_4.addWidget(self.pushButton_56) + self.pushButton_57 = QtWidgets.QPushButton(self.widget_11) + font = QtGui.QFont() + font.setPointSize(10) + self.pushButton_57.setFont(font) + self.pushButton_57.setIcon(icon1) + self.pushButton_57.setCheckable(True) + self.pushButton_57.setObjectName("pushButton_57") + self.verticalLayout_4.addWidget(self.pushButton_57) + self.widget_13 = QtWidgets.QWidget(self.widget_11) + self.widget_13.setMinimumSize(QtCore.QSize(203, 21)) + self.widget_13.setMaximumSize(QtCore.QSize(281, 21)) + self.widget_13.setObjectName("widget_13") + self.pushButton_58 = QtWidgets.QPushButton(self.widget_13, clicked=lambda: self.openCarbonEmissionWindow()) + self.pushButton_58.setGeometry(QtCore.QRect(20, 0, 183, 21)) + font = QtGui.QFont() + font.setPointSize(10) + font.setBold(False) + font.setWeight(50) + self.pushButton_58.setFont(font) + self.pushButton_58.setIcon(icon2) + self.pushButton_58.setObjectName("pushButton_58") + self.verticalLayout_4.addWidget(self.widget_13) + self.pushButton_59 = QtWidgets.QPushButton(self.widget_11, clicked=lambda: self.openBridgeTrafficWindow()) + font = QtGui.QFont() + font.setPointSize(10) + self.pushButton_59.setFont(font) + self.pushButton_59.setObjectName("pushButton_59") + self.verticalLayout_4.addWidget(self.pushButton_59) + self.pushButton_60 = QtWidgets.QPushButton(self.widget_11, clicked=lambda: self.openMaintenanceWindow()) + font = QtGui.QFont() + font.setPointSize(10) + self.pushButton_60.setFont(font) + self.pushButton_60.setObjectName("pushButton_60") + self.verticalLayout_4.addWidget(self.pushButton_60) + self.pushButton_61 = QtWidgets.QPushButton(self.widget_11, clicked=lambda: self.openDemolitionWindow()) + font = QtGui.QFont() + font.setPointSize(10) + self.pushButton_61.setFont(font) + self.pushButton_61.setObjectName("pushButton_61") + self.verticalLayout_4.addWidget(self.pushButton_61) + self.label_73 = QtWidgets.QLabel(self.scrollAreaWidgetContents_4) + self.label_73.setGeometry(QtCore.QRect(0, 387, 221, 31)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_73.setFont(font) + self.label_73.setStyleSheet("background-color: rgb(240,230,230)") + self.label_73.setAlignment(QtCore.Qt.AlignCenter) + self.label_73.setObjectName("label_73") + self.textBrowser_4 = QtWidgets.QTextBrowser(self.scrollAreaWidgetContents_4) + self.textBrowser_4.setGeometry(QtCore.QRect(0, 418, 221, 221)) + self.textBrowser_4.setStyleSheet("background-color: #fff9f9") + self.textBrowser_4.setObjectName("textBrowser_4") + self.verticalScrollBar_4 = QtWidgets.QScrollBar(self.scrollAreaWidgetContents_4) + self.verticalScrollBar_4.setGeometry(QtCore.QRect(220, 0, 16, 641)) + self.verticalScrollBar_4.setStyleSheet("background-color: #F0F0F0") + self.verticalScrollBar_4.setOrientation(QtCore.Qt.Vertical) + self.verticalScrollBar_4.setObjectName("verticalScrollBar_4") + self.scrollArea.setWidget(self.scrollAreaWidgetContents_4) + self.pushButton_62 = QtWidgets.QPushButton(CarbonEmission_Dialog) + self.pushButton_62.setGeometry(QtCore.QRect(350, 35, 188, 25)) + font = QtGui.QFont() + font.setPointSize(10) + font.setBold(True) + font.setWeight(75) + self.pushButton_62.setFont(font) + self.pushButton_62.setFocusPolicy(QtCore.Qt.StrongFocus) + self.pushButton_62.setLayoutDirection(QtCore.Qt.RightToLeft) + self.pushButton_62.setStyleSheet("background-color: rgb(240,230,230)") + self.pushButton_62.setIcon(icon) + self.pushButton_62.setAutoRepeat(False) + self.pushButton_62.setObjectName("pushButton_62") + + self.retranslateUi(CarbonEmission_Dialog) + #self.buttonBox_5.accepted.connect(CarbonEmission_Dialog.accept) # type: ignore + self.buttonBox_5.accepted.connect(self.handle_save) + self.buttonBox.rejected.connect(lambda: self.show_warning(CarbonEmission_Dialog)) + self.buttonBox_5.rejected.connect(lambda: self.show_warning(CarbonEmission_Dialog)) # type: ignore + self.pushButton_51.toggled['bool'].connect(self.widget_12.setVisible) # type: ignore + self.pushButton_57.toggled['bool'].connect(self.widget_13.setVisible) # type: ignore + #self.buttonBox.rejected.connect(self.show_warning) # type: ignore + QtCore.QMetaObject.connectSlotsByName(CarbonEmission_Dialog) + + def show_warning(self, dialog): + """ + Show a warning window when the Close button is pressed. + """ + warning_box = QMessageBox() + warning_box.setIcon(QMessageBox.Warning) + warning_box.setWindowTitle("Confirm Close") + warning_box.setText("Are you sure you want to close without saving?") + warning_box.setStandardButtons(QMessageBox.Yes | QMessageBox.No) + warning_box.setDefaultButton(QMessageBox.No) + + # Check the user's response + response = warning_box.exec_() + if response == QMessageBox.Yes: + dialog.reject() # Close the application + else: + pass # Do nothing, return to the dialog + + def retranslateUi(self, CarbonEmission_Dialog): + _translate = QtCore.QCoreApplication.translate + CarbonEmission_Dialog.setWindowTitle(_translate("CarbonEmission_Dialog", "Carbon Emission Data")) + self.pushButton.setText(_translate("CarbonEmission_Dialog", "Project Details Window ")) + self.label_56.setText(_translate("CarbonEmission_Dialog", "Component:")) + self.comboBox_19.setItemText(0, _translate("CarbonEmission_Dialog", "Earthwork")) + self.comboBox_19.setItemText(1, _translate("CarbonEmission_Dialog", "RCC in Foundation")) + self.label_57.setText(_translate("CarbonEmission_Dialog", "Material Type and Grade")) + self.label_58.setText(_translate("CarbonEmission_Dialog", "Carbon Emission Factor")) + self.label_59.setText(_translate("CarbonEmission_Dialog", "Quantity")) + self.label_60.setText(_translate("CarbonEmission_Dialog", "Unit")) + self.label_61.setText(_translate("CarbonEmission_Dialog", "Emboided Carbon Energy")) + self.comboBox_20.setItemText(0, _translate("CarbonEmission_Dialog", "Concrete")) + self.comboBox_20.setItemText(1, _translate("CarbonEmission_Dialog", "Steel")) + self.comboBox_21.setItemText(0, _translate("CarbonEmission_Dialog", "Steel")) + self.comboBox_21.setItemText(1, _translate("CarbonEmission_Dialog", "Concrete")) + self.label_62.setText(_translate("CarbonEmission_Dialog", "

m3

")) + self.label_63.setText(_translate("CarbonEmission_Dialog", "kg")) + #self.pushButton_13.setText(_translate("CarbonEmission_Dialog", "+ Add Material")) + #self.pushButton_49.setText(_translate("CarbonEmission_Dialog", "+ Add Material")) + self.label_74.setText(_translate("CarbonEmission_Dialog", "(MJ/kg)")) + self.label_75.setText(_translate("CarbonEmission_Dialog", "(MJ/kg)")) + self.label_76.setText(_translate("CarbonEmission_Dialog", "kg C02e/kg")) + self.label_77.setText(_translate("CarbonEmission_Dialog", "kg C02e/kg")) + self.label_78.setText(_translate("CarbonEmission_Dialog", "(MJ/kg)")) + self.label_79.setText(_translate("CarbonEmission_Dialog", "kg C02e/kg")) + self.label_64.setText(_translate("CarbonEmission_Dialog", "

m3

")) + self.label_65.setText(_translate("CarbonEmission_Dialog", "kg")) + self.label_80.setText(_translate("CarbonEmission_Dialog", "kg C02e/kg")) + self.label_66.setText(_translate("CarbonEmission_Dialog", "Component:")) + self.label_67.setText(_translate("CarbonEmission_Dialog", "Material Type and Grade")) + self.label_81.setText(_translate("CarbonEmission_Dialog", "(MJ/kg)")) + self.label_68.setText(_translate("CarbonEmission_Dialog", "Carbon Emission Factor")) + self.label_69.setText(_translate("CarbonEmission_Dialog", "Quantity")) + self.comboBox_22.setItemText(0, _translate("CarbonEmission_Dialog", "Concrete")) + self.comboBox_22.setItemText(1, _translate("CarbonEmission_Dialog", "Steel")) + self.label_70.setText(_translate("CarbonEmission_Dialog", "Emboided Carbon Energy")) + self.comboBox_23.setItemText(0, _translate("CarbonEmission_Dialog", "Steel")) + self.comboBox_23.setItemText(1, _translate("CarbonEmission_Dialog", "Concrete")) + self.comboBox_24.setItemText(0, _translate("CarbonEmission_Dialog", "Earthwork")) + self.comboBox_24.setItemText(1, _translate("CarbonEmission_Dialog", "RCC in Foundation")) + self.label_71.setText(_translate("CarbonEmission_Dialog", "Unit")) + self.label_82.setText(_translate("CarbonEmission_Dialog", "(MJ/kg)")) + self.label_83.setText(_translate("CarbonEmission_Dialog", "kg C02e/kg")) + self.label_84.setText(_translate("CarbonEmission_Dialog", "

m3

")) + self.label_85.setText(_translate("CarbonEmission_Dialog", "kg")) + self.label_86.setText(_translate("CarbonEmission_Dialog", "kg C02e/kg")) + self.label_87.setText(_translate("CarbonEmission_Dialog", "Component:")) + self.label_88.setText(_translate("CarbonEmission_Dialog", "Material Type and Grade")) + self.label_89.setText(_translate("CarbonEmission_Dialog", "(MJ/kg)")) + self.label_90.setText(_translate("CarbonEmission_Dialog", "Carbon Emission Factor")) + self.label_91.setText(_translate("CarbonEmission_Dialog", "Quantity")) + self.comboBox_25.setItemText(0, _translate("CarbonEmission_Dialog", "Concrete")) + self.comboBox_25.setItemText(1, _translate("CarbonEmission_Dialog", "Steel")) + self.label_92.setText(_translate("CarbonEmission_Dialog", "Emboided Carbon Energy")) + self.comboBox_26.setItemText(0, _translate("CarbonEmission_Dialog", "Steel")) + self.comboBox_26.setItemText(1, _translate("CarbonEmission_Dialog", "Concrete")) + self.comboBox_27.setItemText(0, _translate("CarbonEmission_Dialog", "Earthwork")) + self.comboBox_27.setItemText(1, _translate("CarbonEmission_Dialog", "RCC in Foundation")) + self.label_93.setText(_translate("CarbonEmission_Dialog", "Unit")) + self.pushButton_50.setText(_translate("CarbonEmission_Dialog", "+ Add Material")) + self.label_72.setText(_translate("CarbonEmission_Dialog", "Input Parameters")) + self.pushButton_51.setText(_translate("CarbonEmission_Dialog", "Structure Works Data")) + self.pushButton_52.setText(_translate("CarbonEmission_Dialog", "Foundation")) + self.pushButton_53.setText(_translate("CarbonEmission_Dialog", "Super-Structure")) + self.pushButton_54.setText(_translate("CarbonEmission_Dialog", "Sub-Structure")) + self.pushButton_55.setText(_translate("CarbonEmission_Dialog", "Miscellaneous")) + self.pushButton_56.setText(_translate("CarbonEmission_Dialog", "Financial Data")) + self.pushButton_57.setText(_translate("CarbonEmission_Dialog", "Carbon Emission Data")) + self.pushButton_58.setText(_translate("CarbonEmission_Dialog", "Carbon Emission Cost Data")) + self.pushButton_59.setText(_translate("CarbonEmission_Dialog", "Bridge and Traffic Data")) + self.pushButton_60.setText(_translate("CarbonEmission_Dialog", "Maintenance and Repair")) + self.pushButton_61.setText(_translate("CarbonEmission_Dialog", "Disposal and Recycling")) + self.label_73.setText(_translate("CarbonEmission_Dialog", "Output")) + self.textBrowser_4.setHtml(_translate("CarbonEmission_Dialog", "\n" +"\n" +"

Initial Construction Cost

\n" +"

Initial Carbon emission Cost

\n" +"

Time Cost

\n" +"

Road User Cost

\n" +"

Carbon Emission due to Re-Routing

\n" +"

Periodic Maintenance Costs

\n" +"

Maintenance Emission Costs

\n" +"

Routine Inspectection Costs

\n" +"

Repair & Rehabilitation Costs

\n" +"

Reconstruction Costs

\n" +"

Demolition & Disposal Cost

\n" +"

Recycling Cost

\n" +"

Total Life-Cycle Cost

")) + self.pushButton_62.setText(_translate("CarbonEmission_Dialog", "Carbon Emission Data ")) + + def validate_data(self): + """Validate input data before saving""" + try: + # Validate numeric fields + float(self.lineEdit_37.text()) if self.lineEdit_37.text() else 0 + float(self.lineEdit_38.text()) if self.lineEdit_38.text() else 0 + float(self.lineEdit_39.text()) if self.lineEdit_39.text() else 0 + float(self.lineEdit_40.text()) if self.lineEdit_40.text() else 0 + float(self.lineEdit_41.text()) if self.lineEdit_41.text() else 0 + float(self.lineEdit_42.text()) if self.lineEdit_42.text() else 0 + float(self.lineEdit_48.text()) if self.lineEdit_48.text() else 0 + float(self.lineEdit_44.text()) if self.lineEdit_44.text() else 0 + float(self.lineEdit_46.text()) if self.lineEdit_46.text() else 0 + float(self.lineEdit_47.text()) if self.lineEdit_47.text() else 0 + float(self.lineEdit_45.text()) if self.lineEdit_45.text() else 0 + float(self.lineEdit_54.text()) if self.lineEdit_54.text() else 0 + float(self.lineEdit_50.text()) if self.lineEdit_50.text() else 0 + float(self.lineEdit_52.text()) if self.lineEdit_52.text() else 0 + float(self.lineEdit_53.text()) if self.lineEdit_53.text() else 0 + float(self.lineEdit_51.text()) if self.lineEdit_51.text() else 0 + float(self.lineEdit_49.text()) if self.lineEdit_49.text() else 0 + + return True + + except ValueError: + QMessageBox.warning( + None, + "Validation Error", + "Please enter valid numbers in all numeric fields", + QMessageBox.Ok + ) + return False + + def save_data(self): + """Collect all input data and save it to a JSON file""" + if not self.validate_data(): + return False + + data = { + # First component section + "component_1": self.comboBox_19.currentText(), + "material_type_1": self.comboBox_20.currentText(), + "material_grade_1": self.comboBox_21.currentText(), + "quantity_1": self.lineEdit_37.text(), + "unit_1": self.lineEdit_38.text(), + "embodied_carbon_energy_1": self.lineEdit_39.text(), + "carbon_emission_factor_1": self.lineEdit_41.text(), + + # Second component section + "component_2": self.comboBox_24.currentText(), + "material_type_2": self.comboBox_22.currentText(), + "material_grade_2": self.comboBox_23.currentText(), + "quantity_2": self.lineEdit_48.text(), + "unit_2": self.lineEdit_44.text(), + "embodied_carbon_energy_2": self.lineEdit_46.text(), + "carbon_emission_factor_2": self.lineEdit_47.text(), + + # Third component section + "component_3": self.comboBox_27.currentText(), + "material_type_3": self.comboBox_25.currentText(), + "material_grade_3": self.comboBox_26.currentText(), + "quantity_3": self.lineEdit_54.text(), + "unit_3": self.lineEdit_50.text(), + "embodied_carbon_energy_3": self.lineEdit_52.text(), + "carbon_emission_factor_3": self.lineEdit_53.text(), + } + + # Save to JSON file + try: + import json + from datetime import datetime + + # Create filename with timestamp + timestamp = datetime.now().strftime("%Y%m%d_%H%M%S") + filename = f"carbon_emission_data_{timestamp}.json" + + with open(filename, 'w') as f: + json.dump(data, f, indent=4) + + # Show success message + QMessageBox.information( + None, + "Success", + f"Carbon emission data saved successfully to {filename}", + QMessageBox.Ok + ) + + return True + + except Exception as e: + QMessageBox.critical( + None, + "Error", + f"Failed to save data: {str(e)}", + QMessageBox.Ok + ) + return False + + def handle_save(self): + """Handle the save operation and close the dialog if successful""" + if self.save_data(): # Only close if save was successful + CarbonEmission_Dialog.accept() + +if __name__ == "__main__": + import sys + app = QtWidgets.QApplication(sys.argv) + CarbonEmission_Dialog = QtWidgets.QDialog() + ui = Ui_CarbonEmission_Dialog() + ui.setupUi(CarbonEmission_Dialog) + CarbonEmission_Dialog.show() + sys.exit(app.exec_()) diff --git a/src/osbridgelcca/desktop_app/ui/project_details_windows/ProjectDetails_DemolitionANDRecyclingData_Window.py b/src/osbridgelcca/desktop_app/ui/project_details_windows/ProjectDetails_DemolitionANDRecyclingData_Window.py new file mode 100644 index 0000000..a9167b2 --- /dev/null +++ b/src/osbridgelcca/desktop_app/ui/project_details_windows/ProjectDetails_DemolitionANDRecyclingData_Window.py @@ -0,0 +1,486 @@ +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file 'C:\Users\saans\AppData\Local\Programs\Python\Python310\Lib\site-packages\qt5_applications\Qt\bin\ProjectDetails_Demolition&RecyclingData_Window.ui' +# +# Created by: PyQt5 UI code generator 5.15.9 +# +# WARNING: Any manual changes made to this file will be lost when pyuic5 is +# run again. Do not edit this file unless you know what you are doing. + + +from PyQt5 import QtCore, QtGui, QtWidgets +from PyQt5.QtWidgets import QMessageBox + + + +#from ProjectDetails_DemolitionANDRecyclingData_Window import Ui_Demolition_Dialog + + + + + + + +class Ui_Demolition_Dialog(object): + def openBridgeTrafficWindow(self): + from ProjectDetails_BridgeANDTrafficData_Window import Ui_BridgeTraffic_Dialog + self.window = QtWidgets.QDialog() + self.ui = Ui_BridgeTraffic_Dialog() + self.ui.setupUi(self.window) + self.window.show() + + def openFoundationWindow(self): + from ProjectDetails_Foundation_Window import Ui_Foundation_Dialog + self.window = QtWidgets.QDialog() + self.ui = Ui_Foundation_Dialog() + self.ui.setupUi(self.window) + self.window.show() + + def openCarbonEmissionWindow(self): + from ProjectDetails_CarbonEmissionData_Window import Ui_CarbonEmission_Dialog + self.window = QtWidgets.QDialog() + self.ui = Ui_CarbonEmission_Dialog() + self.ui.setupUi(self.window) + self.window.show() + + def openDemolitionWindow(self): + self.window = QtWidgets.QDialog() + self.ui = Ui_Demolition_Dialog() + self.ui.setupUi(self.window) + self.window.show() + + def openFinancialWindow(self): + from ProjectDetails_FinancialData_Window import Ui_FinancialData_Dialog + self.window = QtWidgets.QDialog() + self.ui = Ui_FinancialData_Dialog() + self.ui.setupUi(self.window) + self.window.show() + + def openMaintenanceWindow(self): + from ProjectDetails_MaintenanceANDRepairData_Window import Ui_Maintenance_Dialog + self.window = QtWidgets.QDialog() + self.ui = Ui_Maintenance_Dialog() + self.ui.setupUi(self.window) + self.window.show() + + def openMiscellaneousWindow(self): + from ProjectDetails_Miscellaneous_Window import Ui_Miscellaneous_Dialog + self.window = QtWidgets.QDialog() + self.ui = Ui_Miscellaneous_Dialog() + self.ui.setupUi(self.window) + self.window.show() + + def openSubStructureWindow(self): + from ProjectDetails_SubStructure_Window import Ui_SubStructure_Dialog + self.window = QtWidgets.QDialog() + self.ui = Ui_SubStructure_Dialog() + self.ui.setupUi(self.window) + self.window.show() + + def openSuperStructureWindow(self): + from ProjectDetails_SuperStructure_Window import Ui_SuperStructure_Dialog + self.window = QtWidgets.QDialog() + self.ui = Ui_SuperStructure_Dialog() + self.ui.setupUi(self.window) + self.window.show() + + def setupUi(self, Demolition_Dialog): + Demolition_Dialog.setObjectName("Demolition_Dialog") + Demolition_Dialog.resize(1440, 900) + Demolition_Dialog.setStyleSheet("background-color: #fafafa") + self.pushButton_6 = QtWidgets.QPushButton(Demolition_Dialog) + self.pushButton_6.setGeometry(QtCore.QRect(350, 30, 261, 25)) + font = QtGui.QFont() + font.setPointSize(10) + font.setBold(True) + font.setWeight(75) + self.pushButton_6.setFont(font) + self.pushButton_6.setFocusPolicy(QtCore.Qt.StrongFocus) + self.pushButton_6.setLayoutDirection(QtCore.Qt.RightToLeft) + self.pushButton_6.setStyleSheet("background-color: rgb(240,230,230)") + icon = QtGui.QIcon() + icon.addPixmap(QtGui.QPixmap("C:\\Users\\saans\\AppData\\Local\\Programs\\Python\\Python310\\Lib\\site-packages\\qt5_applications\\Qt\\bin\\../../../../../../../../../../Downloads/Dismiss.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) + self.pushButton_6.setIcon(icon) + self.pushButton_6.setAutoRepeat(False) + self.pushButton_6.setObjectName("pushButton_6") + self.label = QtWidgets.QLabel(Demolition_Dialog) + self.label.setGeometry(QtCore.QRect(10, 55, 244, 691)) + font = QtGui.QFont() + font.setPointSize(10) + self.label.setFont(font) + self.label.setStyleSheet("background-color: rgb(240,230,230)") + self.label.setText("") + self.label.setObjectName("label") + self.widget_2 = QtWidgets.QWidget(Demolition_Dialog) + self.widget_2.setGeometry(QtCore.QRect(350, 55, 692, 205)) + self.widget_2.setStyleSheet("background-color: #fff9f9") + self.widget_2.setObjectName("widget_2") + self.label_7 = QtWidgets.QLabel(self.widget_2) + self.label_7.setGeometry(QtCore.QRect(20, 110, 231, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_7.setFont(font) + self.label_7.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter) + self.label_7.setObjectName("label_7") + self.label_8 = QtWidgets.QLabel(self.widget_2) + self.label_8.setGeometry(QtCore.QRect(20, 140, 221, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_8.setFont(font) + self.label_8.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter) + self.label_8.setObjectName("label_8") + self.lineEdit_5 = QtWidgets.QLineEdit(self.widget_2) + self.lineEdit_5.setGeometry(QtCore.QRect(290, 30, 121, 20)) + font = QtGui.QFont() + font.setPointSize(10) + self.lineEdit_5.setFont(font) + self.lineEdit_5.setStyleSheet("background-color: #ffffff") + self.lineEdit_5.setObjectName("lineEdit_5") + self.lineEdit_6 = QtWidgets.QLineEdit(self.widget_2) + self.lineEdit_6.setGeometry(QtCore.QRect(290, 110, 121, 20)) + font = QtGui.QFont() + font.setPointSize(10) + self.lineEdit_6.setFont(font) + self.lineEdit_6.setStyleSheet("background-color: #ffffff") + self.lineEdit_6.setText("") + self.lineEdit_6.setObjectName("lineEdit_6") + self.buttonBox_2 = QtWidgets.QDialogButtonBox(self.widget_2) + self.buttonBox_2.setGeometry(QtCore.QRect(340, 170, 341, 32)) + self.buttonBox_2.setOrientation(QtCore.Qt.Horizontal) + self.buttonBox_2.setStandardButtons(QtWidgets.QDialogButtonBox.Close|QtWidgets.QDialogButtonBox.Save) + self.buttonBox_2.setObjectName("buttonBox_2") + self.lineEdit_13 = QtWidgets.QLineEdit(self.widget_2) + self.lineEdit_13.setGeometry(QtCore.QRect(290, 140, 121, 20)) + font = QtGui.QFont() + font.setPointSize(10) + self.lineEdit_13.setFont(font) + self.lineEdit_13.setStyleSheet("background-color: #ffffff") + self.lineEdit_13.setObjectName("lineEdit_13") + self.label_21 = QtWidgets.QLabel(self.widget_2) + self.label_21.setGeometry(QtCore.QRect(420, 30, 51, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_21.setFont(font) + self.label_21.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter) + self.label_21.setObjectName("label_21") + self.label_23 = QtWidgets.QLabel(self.widget_2) + self.label_23.setGeometry(QtCore.QRect(420, 110, 71, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_23.setFont(font) + self.label_23.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter) + self.label_23.setObjectName("label_23") + self.textBrowser_2 = QtWidgets.QTextBrowser(self.widget_2) + self.textBrowser_2.setGeometry(QtCore.QRect(20, 20, 256, 51)) + self.textBrowser_2.setObjectName("textBrowser_2") + self.label_22 = QtWidgets.QLabel(self.widget_2) + self.label_22.setGeometry(QtCore.QRect(420, 140, 51, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_22.setFont(font) + self.label_22.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter) + self.label_22.setObjectName("label_22") + self.pushButton = QtWidgets.QPushButton(Demolition_Dialog) + self.pushButton.setGeometry(QtCore.QRect(10, 30, 188, 25)) + font = QtGui.QFont() + font.setPointSize(10) + self.pushButton.setFont(font) + self.pushButton.setFocusPolicy(QtCore.Qt.StrongFocus) + self.pushButton.setLayoutDirection(QtCore.Qt.RightToLeft) + self.pushButton.setStyleSheet("background-color: rgb(240,230,230)") + self.pushButton.setIcon(icon) + self.pushButton.setAutoRepeat(False) + self.pushButton.setObjectName("pushButton") + self.scrollArea = QtWidgets.QScrollArea(Demolition_Dialog) + self.scrollArea.setGeometry(QtCore.QRect(10, 60, 241, 681)) + self.scrollArea.setAutoFillBackground(False) + self.scrollArea.setStyleSheet("background-color: #fff9f9") + self.scrollArea.setWidgetResizable(True) + self.scrollArea.setObjectName("scrollArea") + self.scrollAreaWidgetContents = QtWidgets.QWidget() + self.scrollAreaWidgetContents.setGeometry(QtCore.QRect(0, 0, 239, 679)) + self.scrollAreaWidgetContents.setObjectName("scrollAreaWidgetContents") + self.label_2 = QtWidgets.QLabel(self.scrollAreaWidgetContents) + self.label_2.setGeometry(QtCore.QRect(0, 0, 221, 31)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_2.setFont(font) + self.label_2.setStyleSheet("background-color: rgb(240,230,230)") + self.label_2.setAlignment(QtCore.Qt.AlignCenter) + self.label_2.setObjectName("label_2") + self.widget = QtWidgets.QWidget(self.scrollAreaWidgetContents) + self.widget.setGeometry(QtCore.QRect(0, 30, 221, 357)) + self.widget.setStyleSheet("background-color: #fff9f9") + self.widget.setObjectName("widget") + self.verticalLayout = QtWidgets.QVBoxLayout(self.widget) + self.verticalLayout.setContentsMargins(0, 0, 0, 0) + self.verticalLayout.setObjectName("verticalLayout") + self.pushButton_15 = QtWidgets.QPushButton(self.widget) + font = QtGui.QFont() + font.setPointSize(10) + self.pushButton_15.setFont(font) + icon1 = QtGui.QIcon() + icon1.addPixmap(QtGui.QPixmap("C:\\Users\\saans\\AppData\\Local\\Programs\\Python\\Python310\\Lib\\site-packages\\qt5_applications\\Qt\\bin\\../../../../../../../../../../Downloads/play_arrow_filled.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) + icon1.addPixmap(QtGui.QPixmap("C:\\Users\\saans\\AppData\\Local\\Programs\\Python\\Python310\\Lib\\site-packages\\qt5_applications\\Qt\\bin\\../../../../../../../../../../Downloads/play_arrow_filled (1).png"), QtGui.QIcon.Normal, QtGui.QIcon.On) + self.pushButton_15.setIcon(icon1) + self.pushButton_15.setCheckable(True) + self.pushButton_15.setAutoDefault(True) + self.pushButton_15.setObjectName("pushButton_15") + self.verticalLayout.addWidget(self.pushButton_15) + self.widget_5 = QtWidgets.QWidget(self.widget) + self.widget_5.setObjectName("widget_5") + self.formLayout = QtWidgets.QFormLayout(self.widget_5) + self.formLayout.setObjectName("formLayout") + self.pushButton_20 = QtWidgets.QPushButton(self.widget_5, clicked=lambda: self.openFoundationWindow()) + font = QtGui.QFont() + font.setPointSize(10) + font.setBold(False) + font.setWeight(50) + self.pushButton_20.setFont(font) + icon2 = QtGui.QIcon() + icon2.addPixmap(QtGui.QPixmap("C:\\Users\\saans\\AppData\\Local\\Programs\\Python\\Python310\\Lib\\site-packages\\qt5_applications\\Qt\\bin\\../../../../../../../../../../Downloads/play_arrow_filled.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) + self.pushButton_20.setIcon(icon2) + self.pushButton_20.setObjectName("pushButton_20") + self.formLayout.setWidget(0, QtWidgets.QFormLayout.LabelRole, self.pushButton_20) + self.pushButton_21 = QtWidgets.QPushButton(self.widget_5, clicked=lambda: self.openSuperStructureWindow()) + font = QtGui.QFont() + font.setPointSize(10) + font.setBold(False) + font.setWeight(50) + self.pushButton_21.setFont(font) + self.pushButton_21.setIcon(icon2) + self.pushButton_21.setObjectName("pushButton_21") + self.formLayout.setWidget(1, QtWidgets.QFormLayout.LabelRole, self.pushButton_21) + self.pushButton_22 = QtWidgets.QPushButton(self.widget_5, clicked=lambda: self.openSubStructureWindow()) + font = QtGui.QFont() + font.setPointSize(10) + font.setBold(False) + font.setWeight(50) + self.pushButton_22.setFont(font) + self.pushButton_22.setIcon(icon2) + self.pushButton_22.setObjectName("pushButton_22") + self.formLayout.setWidget(2, QtWidgets.QFormLayout.LabelRole, self.pushButton_22) + self.pushButton_23 = QtWidgets.QPushButton(self.widget_5, clicked=lambda: self.openMiscellaneousWindow()) + font = QtGui.QFont() + font.setPointSize(10) + font.setBold(False) + font.setWeight(50) + self.pushButton_23.setFont(font) + self.pushButton_23.setIcon(icon2) + self.pushButton_23.setObjectName("pushButton_23") + self.formLayout.setWidget(3, QtWidgets.QFormLayout.LabelRole, self.pushButton_23) + self.verticalLayout.addWidget(self.widget_5) + self.pushButton_19 = QtWidgets.QPushButton(self.widget, clicked=lambda: self.openFinancialWindow()) + font = QtGui.QFont() + font.setPointSize(10) + self.pushButton_19.setFont(font) + self.pushButton_19.setObjectName("pushButton_19") + self.verticalLayout.addWidget(self.pushButton_19) + self.pushButton_16 = QtWidgets.QPushButton(self.widget) + font = QtGui.QFont() + font.setPointSize(10) + self.pushButton_16.setFont(font) + self.pushButton_16.setIcon(icon1) + self.pushButton_16.setCheckable(True) + self.pushButton_16.setObjectName("pushButton_16") + self.verticalLayout.addWidget(self.pushButton_16) + self.widget_8 = QtWidgets.QWidget(self.widget) + self.widget_8.setMinimumSize(QtCore.QSize(203, 21)) + self.widget_8.setMaximumSize(QtCore.QSize(281, 21)) + self.widget_8.setObjectName("widget_8") + self.pushButton_14 = QtWidgets.QPushButton(self.widget_8, clicked=lambda: self.openCarbonEmissionWindow()) + self.pushButton_14.setGeometry(QtCore.QRect(20, 0, 183, 21)) + font = QtGui.QFont() + font.setPointSize(10) + font.setBold(False) + font.setWeight(50) + self.pushButton_14.setFont(font) + self.pushButton_14.setIcon(icon2) + self.pushButton_14.setObjectName("pushButton_14") + self.verticalLayout.addWidget(self.widget_8) + self.pushButton_17 = QtWidgets.QPushButton(self.widget, clicked=lambda: self.openBridgeTrafficWindow()) + font = QtGui.QFont() + font.setPointSize(10) + self.pushButton_17.setFont(font) + self.pushButton_17.setObjectName("pushButton_17") + self.verticalLayout.addWidget(self.pushButton_17) + self.pushButton_18 = QtWidgets.QPushButton(self.widget, clicked=lambda: self.openMaintenanceWindow()) + font = QtGui.QFont() + font.setPointSize(10) + self.pushButton_18.setFont(font) + self.pushButton_18.setObjectName("pushButton_18") + self.verticalLayout.addWidget(self.pushButton_18) + self.pushButton_10 = QtWidgets.QPushButton(self.widget, clicked=lambda: self.openDemolitionWindow()) + font = QtGui.QFont() + font.setPointSize(10) + self.pushButton_10.setFont(font) + self.pushButton_10.setObjectName("pushButton_10") + self.verticalLayout.addWidget(self.pushButton_10) + self.label_3 = QtWidgets.QLabel(self.scrollAreaWidgetContents) + self.label_3.setGeometry(QtCore.QRect(0, 387, 221, 31)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_3.setFont(font) + self.label_3.setStyleSheet("background-color: rgb(240,230,230)") + self.label_3.setAlignment(QtCore.Qt.AlignCenter) + self.label_3.setObjectName("label_3") + self.textBrowser = QtWidgets.QTextBrowser(self.scrollAreaWidgetContents) + self.textBrowser.setGeometry(QtCore.QRect(0, 418, 221, 221)) + self.textBrowser.setStyleSheet("background-color: #fff9f9") + self.textBrowser.setObjectName("textBrowser") + self.verticalScrollBar = QtWidgets.QScrollBar(self.scrollAreaWidgetContents) + self.verticalScrollBar.setGeometry(QtCore.QRect(220, 0, 16, 641)) + self.verticalScrollBar.setStyleSheet("background-color: #F0F0F0") + self.verticalScrollBar.setOrientation(QtCore.Qt.Vertical) + self.verticalScrollBar.setObjectName("verticalScrollBar") + self.widget.raise_() + self.label_2.raise_() + self.label_3.raise_() + self.textBrowser.raise_() + self.verticalScrollBar.raise_() + self.scrollArea.setWidget(self.scrollAreaWidgetContents) + + self.retranslateUi(Demolition_Dialog) + self.buttonBox_2.accepted.connect(self.handle_save) # type: ignore + self.buttonBox_2.rejected.connect(lambda: self.show_warning(Demolition_Dialog)) # type: ignore + self.pushButton_15.toggled['bool'].connect(self.widget_5.setVisible) # type: ignore + self.pushButton_16.toggled['bool'].connect(self.widget_8.setVisible) # type: ignore + QtCore.QMetaObject.connectSlotsByName(Demolition_Dialog) + + def show_warning(self, dialog): + """ + Show a warning window when the Close button is pressed. + """ + warning_box = QMessageBox() + warning_box.setIcon(QMessageBox.Warning) + warning_box.setWindowTitle("Confirm Close") + warning_box.setText("Are you sure you want to close without saving?") + warning_box.setStandardButtons(QMessageBox.Yes | QMessageBox.No) + warning_box.setDefaultButton(QMessageBox.No) + + # Check the user's response + response = warning_box.exec_() + if response == QMessageBox.Yes: + dialog.reject() # Close the application + else: + pass # Do nothing, return to the dialog + + def retranslateUi(self, Demolition_Dialog): + _translate = QtCore.QCoreApplication.translate + Demolition_Dialog.setWindowTitle(_translate("Demolition_Dialog", "Demolition and Recycling Data")) + self.pushButton_6.setText(_translate("Demolition_Dialog", "Demolition and Recycling Data ")) + self.label_7.setText(_translate("Demolition_Dialog", "Scrap Value of Structural Steel")) + self.label_8.setText(_translate("Demolition_Dialog", "Structural Steel Scrap")) + self.label_21.setText(_translate("Demolition_Dialog", "(%)")) + self.label_23.setText(_translate("Demolition_Dialog", "(INR/MT)")) + self.textBrowser_2.setHtml(_translate("Demolition_Dialog", "\n" +"\n" +"

Demolition Cost rate as percentage to total construction cost

")) + self.label_22.setText(_translate("Demolition_Dialog", "(%)")) + self.pushButton.setText(_translate("Demolition_Dialog", "Project Details Window ")) + self.label_2.setText(_translate("Demolition_Dialog", "Input Parameters")) + self.pushButton_15.setText(_translate("Demolition_Dialog", "Structure Works Data")) + self.pushButton_20.setText(_translate("Demolition_Dialog", "Foundation")) + self.pushButton_21.setText(_translate("Demolition_Dialog", "Super-Structure")) + self.pushButton_22.setText(_translate("Demolition_Dialog", "Sub-Structure")) + self.pushButton_23.setText(_translate("Demolition_Dialog", "Miscellaneous")) + self.pushButton_19.setText(_translate("Demolition_Dialog", "Financial Data")) + self.pushButton_16.setText(_translate("Demolition_Dialog", "Carbon Emission Data")) + self.pushButton_14.setText(_translate("Demolition_Dialog", "Carbon Emission Cost Data")) + self.pushButton_17.setText(_translate("Demolition_Dialog", "Bridge and Traffic Data")) + self.pushButton_18.setText(_translate("Demolition_Dialog", "Maintenance and Repair")) + self.pushButton_10.setText(_translate("Demolition_Dialog", "Disposal and Recycling")) + self.label_3.setText(_translate("Demolition_Dialog", "Output")) + self.textBrowser.setHtml(_translate("Demolition_Dialog", "\n" +"\n" +"

Initial Construction Cost

\n" +"

Initial Carbon emission Cost

\n" +"

Time Cost

\n" +"

Road User Cost

\n" +"

Carbon Emission due to Re-Routing

\n" +"

Periodic Maintenance Costs

\n" +"

Maintenance Emission Costs

\n" +"

Routine Inspectection Costs

\n" +"

Repair & Rehabilitation Costs

\n" +"

Reconstruction Costs

\n" +"

Demolition & Disposal Cost

\n" +"

Recycling Cost

\n" +"

Total Life-Cycle Cost

")) + + def validate_data(self): + """Validate input data before saving""" + try: + # Validate numeric fields + float(self.lineEdit_5.text()) if self.lineEdit_5.text() else 0 + float(self.lineEdit_6.text()) if self.lineEdit_6.text() else 0 + float(self.lineEdit_13.text()) if self.lineEdit_13.text() else 0 + return True + + except ValueError: + QMessageBox.warning( + None, + "Validation Error", + "Please enter valid numbers in all numeric fields", + QMessageBox.Ok + ) + return False + + def save_data(self): + """Collect all input data and save it to a JSON file""" + if not self.validate_data(): + return False + + data = { + "demolition_cost_rate": self.lineEdit_5.text(), + "scrap_value_structural_steel": self.lineEdit_6.text(), + "structural_steel_scrap": self.lineEdit_13.text(), + } + + # Save to JSON file + try: + import json + from datetime import datetime + + # Create filename with timestamp + timestamp = datetime.now().strftime("%Y%m%d_%H%M%S") + filename = f"demolition_data_{timestamp}.json" + + with open(filename, 'w') as f: + json.dump(data, f, indent=4) + + # Show success message + QMessageBox.information( + None, + "Success", + f"Demolition data saved successfully to {filename}", + QMessageBox.Ok + ) + + return True + + except Exception as e: + QMessageBox.critical( + None, + "Error", + f"Failed to save data: {str(e)}", + QMessageBox.Ok + ) + return False + + def handle_save(self): + """Handle the save operation and close the dialog if successful""" + if self.save_data(): # Only close if save was successful + Demolition_Dialog.accept() + +if __name__ == "__main__": + import sys + app = QtWidgets.QApplication(sys.argv) + Demolition_Dialog = QtWidgets.QDialog() + ui = Ui_Demolition_Dialog() + ui.setupUi(Demolition_Dialog) + Demolition_Dialog.show() + sys.exit(app.exec_()) diff --git a/src/osbridgelcca/desktop_app/ui/project_details_windows/ProjectDetails_FinancialData_Window.py b/src/osbridgelcca/desktop_app/ui/project_details_windows/ProjectDetails_FinancialData_Window.py new file mode 100644 index 0000000..713a0b8 --- /dev/null +++ b/src/osbridgelcca/desktop_app/ui/project_details_windows/ProjectDetails_FinancialData_Window.py @@ -0,0 +1,520 @@ +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file 'C:\Users\saans\AppData\Local\Programs\Python\Python310\Lib\site-packages\qt5_applications\Qt\bin\ProjectDetails_FinancialData_Window.ui' +# +# Created by: PyQt5 UI code generator 5.15.9 +# +# WARNING: Any manual changes made to this file will be lost when pyuic5 is +# run again. Do not edit this file unless you know what you are doing. + + +from PyQt5 import QtCore, QtGui, QtWidgets +from PyQt5.QtWidgets import QMessageBox + + + +#from ProjectDetails_FinancialData_Window import Ui_FinancialData_Dialog + + + + + + +class Ui_FinancialData_Dialog(object): + def openBridgeTrafficWindow(self): + from ProjectDetails_BridgeANDTrafficData_Window import Ui_BridgeTraffic_Dialog + self.window = QtWidgets.QDialog() + self.ui = Ui_BridgeTraffic_Dialog() + self.ui.setupUi(self.window) + self.window.show() + + def openFoundationWindow(self): + from ProjectDetails_Foundation_Window import Ui_Foundation_Dialog + self.window = QtWidgets.QDialog() + self.ui = Ui_Foundation_Dialog() + self.ui.setupUi(self.window) + self.window.show() + + def openCarbonEmissionWindow(self): + from ProjectDetails_CarbonEmissionData_Window import Ui_CarbonEmission_Dialog + self.window = QtWidgets.QDialog() + self.ui = Ui_CarbonEmission_Dialog() + self.ui.setupUi(self.window) + self.window.show() + + def openDemolitionWindow(self): + from ProjectDetails_DemolitionANDRecyclingData_Window import Ui_Demolition_Dialog + self.window = QtWidgets.QDialog() + self.ui = Ui_Demolition_Dialog() + self.ui.setupUi(self.window) + self.window.show() + + def openFinancialWindow(self): + self.window = QtWidgets.QDialog() + self.ui = Ui_FinancialData_Dialog() + self.ui.setupUi(self.window) + self.window.show() + + def openMaintenanceWindow(self): + from ProjectDetails_MaintenanceANDRepairData_Window import Ui_Maintenance_Dialog + self.window = QtWidgets.QDialog() + self.ui = Ui_Maintenance_Dialog() + self.ui.setupUi(self.window) + self.window.show() + + def openMiscellaneousWindow(self): + from ProjectDetails_Miscellaneous_Window import Ui_Miscellaneous_Dialog + self.window = QtWidgets.QDialog() + self.ui = Ui_Miscellaneous_Dialog() + self.ui.setupUi(self.window) + self.window.show() + + def openSubStructureWindow(self): + from ProjectDetails_SubStructure_Window import Ui_SubStructure_Dialog + self.window = QtWidgets.QDialog() + self.ui = Ui_SubStructure_Dialog() + self.ui.setupUi(self.window) + self.window.show() + + def openSuperStructureWindow(self): + from ProjectDetails_SuperStructure_Window import Ui_SuperStructure_Dialog + self.window = QtWidgets.QDialog() + self.ui = Ui_SuperStructure_Dialog() + self.ui.setupUi(self.window) + self.window.show() + + def setupUi(self, FinancialData_Dialog): + FinancialData_Dialog.setObjectName("FinancialData_Dialog") + FinancialData_Dialog.resize(1440, 900) + FinancialData_Dialog.setStyleSheet("background-color:#FAFAFA") + self.label = QtWidgets.QLabel(FinancialData_Dialog) + self.label.setGeometry(QtCore.QRect(10, 65, 244, 691)) + font = QtGui.QFont() + font.setPointSize(10) + self.label.setFont(font) + self.label.setStyleSheet("background-color: rgb(240,230,230)") + self.label.setText("") + self.label.setObjectName("label") + self.pushButton = QtWidgets.QPushButton(FinancialData_Dialog) + self.pushButton.setGeometry(QtCore.QRect(10, 40, 188, 25)) + font = QtGui.QFont() + font.setPointSize(10) + self.pushButton.setFont(font) + self.pushButton.setFocusPolicy(QtCore.Qt.StrongFocus) + self.pushButton.setLayoutDirection(QtCore.Qt.RightToLeft) + self.pushButton.setStyleSheet("background-color: rgb(240,230,230)") + icon = QtGui.QIcon() + icon.addPixmap(QtGui.QPixmap("C:\\Users\\saans\\AppData\\Local\\Programs\\Python\\Python310\\Lib\\site-packages\\qt5_applications\\Qt\\bin\\../../../../../../../../../../Downloads/Dismiss.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) + self.pushButton.setIcon(icon) + self.pushButton.setAutoRepeat(False) + self.pushButton.setObjectName("pushButton") + self.widget_2 = QtWidgets.QWidget(FinancialData_Dialog) + self.widget_2.setGeometry(QtCore.QRect(350, 65, 736, 249)) + self.widget_2.setStyleSheet("background-color: #fff9f9") + self.widget_2.setObjectName("widget_2") + self.label_4 = QtWidgets.QLabel(self.widget_2) + self.label_4.setGeometry(QtCore.QRect(20, 20, 141, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_4.setFont(font) + self.label_4.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter) + self.label_4.setObjectName("label_4") + self.label_5 = QtWidgets.QLabel(self.widget_2) + self.label_5.setGeometry(QtCore.QRect(20, 80, 161, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_5.setFont(font) + self.label_5.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter) + self.label_5.setObjectName("label_5") + self.label_6 = QtWidgets.QLabel(self.widget_2) + self.label_6.setGeometry(QtCore.QRect(20, 50, 140, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_6.setFont(font) + self.label_6.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter) + self.label_6.setObjectName("label_6") + self.label_7 = QtWidgets.QLabel(self.widget_2) + self.label_7.setGeometry(QtCore.QRect(20, 110, 110, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_7.setFont(font) + self.label_7.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter) + self.label_7.setObjectName("label_7") + self.label_8 = QtWidgets.QLabel(self.widget_2) + self.label_8.setGeometry(QtCore.QRect(20, 140, 221, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_8.setFont(font) + self.label_8.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter) + self.label_8.setObjectName("label_8") + self.comboBox_2 = QtWidgets.QComboBox(self.widget_2) + self.comboBox_2.setGeometry(QtCore.QRect(270, 80, 101, 22)) + self.comboBox_2.setStyleSheet("background-color: #ffffff") + self.comboBox_2.setObjectName("comboBox_2") + self.comboBox_3 = QtWidgets.QComboBox(self.widget_2) + self.comboBox_3.setGeometry(QtCore.QRect(270, 50, 101, 22)) + self.comboBox_3.setStyleSheet("background-color: #ffffff") + self.comboBox_3.setObjectName("comboBox_3") + self.lineEdit_5 = QtWidgets.QLineEdit(self.widget_2) + self.lineEdit_5.setGeometry(QtCore.QRect(270, 20, 101, 20)) + font = QtGui.QFont() + font.setPointSize(10) + self.lineEdit_5.setFont(font) + self.lineEdit_5.setStyleSheet("background-color: #ffffff") + self.lineEdit_5.setObjectName("lineEdit_5") + self.lineEdit_6 = QtWidgets.QLineEdit(self.widget_2) + self.lineEdit_6.setGeometry(QtCore.QRect(270, 110, 101, 20)) + font = QtGui.QFont() + font.setPointSize(10) + self.lineEdit_6.setFont(font) + self.lineEdit_6.setStyleSheet("background-color: #ffffff") + self.lineEdit_6.setObjectName("lineEdit_6") + self.buttonBox_2 = QtWidgets.QDialogButtonBox(self.widget_2) + self.buttonBox_2.setGeometry(QtCore.QRect(380, 210, 341, 32)) + self.buttonBox_2.setOrientation(QtCore.Qt.Horizontal) + self.buttonBox_2.setStandardButtons(QtWidgets.QDialogButtonBox.Close|QtWidgets.QDialogButtonBox.Save) + self.buttonBox_2.setObjectName("buttonBox_2") + self.lineEdit_13 = QtWidgets.QLineEdit(self.widget_2) + self.lineEdit_13.setGeometry(QtCore.QRect(270, 140, 101, 20)) + font = QtGui.QFont() + font.setPointSize(10) + self.lineEdit_13.setFont(font) + self.lineEdit_13.setStyleSheet("background-color: #ffffff") + self.lineEdit_13.setObjectName("lineEdit_13") + self.label_21 = QtWidgets.QLabel(self.widget_2) + self.label_21.setGeometry(QtCore.QRect(390, 20, 51, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_21.setFont(font) + self.label_21.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter) + self.label_21.setObjectName("label_21") + self.label_22 = QtWidgets.QLabel(self.widget_2) + self.label_22.setGeometry(QtCore.QRect(390, 50, 51, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_22.setFont(font) + self.label_22.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter) + self.label_22.setObjectName("label_22") + self.label_23 = QtWidgets.QLabel(self.widget_2) + self.label_23.setGeometry(QtCore.QRect(390, 110, 51, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_23.setFont(font) + self.label_23.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter) + self.label_23.setObjectName("label_23") + self.label_24 = QtWidgets.QLabel(self.widget_2) + self.label_24.setGeometry(QtCore.QRect(390, 140, 51, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_24.setFont(font) + self.label_24.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter) + self.label_24.setObjectName("label_24") + self.scrollArea = QtWidgets.QScrollArea(FinancialData_Dialog) + self.scrollArea.setGeometry(QtCore.QRect(10, 70, 241, 681)) + self.scrollArea.setAutoFillBackground(False) + self.scrollArea.setStyleSheet("background-color: #fff9f9") + self.scrollArea.setWidgetResizable(True) + self.scrollArea.setObjectName("scrollArea") + self.scrollAreaWidgetContents = QtWidgets.QWidget() + self.scrollAreaWidgetContents.setGeometry(QtCore.QRect(0, 0, 239, 679)) + self.scrollAreaWidgetContents.setObjectName("scrollAreaWidgetContents") + self.label_2 = QtWidgets.QLabel(self.scrollAreaWidgetContents) + self.label_2.setGeometry(QtCore.QRect(0, 0, 221, 31)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_2.setFont(font) + self.label_2.setStyleSheet("background-color: rgb(240,230,230)") + self.label_2.setAlignment(QtCore.Qt.AlignCenter) + self.label_2.setObjectName("label_2") + self.widget = QtWidgets.QWidget(self.scrollAreaWidgetContents) + self.widget.setGeometry(QtCore.QRect(0, 30, 221, 357)) + self.widget.setStyleSheet("background-color: #fff9f9") + self.widget.setObjectName("widget") + self.verticalLayout = QtWidgets.QVBoxLayout(self.widget) + self.verticalLayout.setContentsMargins(0, 0, 0, 0) + self.verticalLayout.setObjectName("verticalLayout") + self.pushButton_15 = QtWidgets.QPushButton(self.widget) + font = QtGui.QFont() + font.setPointSize(10) + self.pushButton_15.setFont(font) + icon1 = QtGui.QIcon() + icon1.addPixmap(QtGui.QPixmap("C:\\Users\\saans\\AppData\\Local\\Programs\\Python\\Python310\\Lib\\site-packages\\qt5_applications\\Qt\\bin\\../../../../../../../../../../Downloads/play_arrow_filled.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) + icon1.addPixmap(QtGui.QPixmap("C:\\Users\\saans\\AppData\\Local\\Programs\\Python\\Python310\\Lib\\site-packages\\qt5_applications\\Qt\\bin\\../../../../../../../../../../Downloads/play_arrow_filled (1).png"), QtGui.QIcon.Normal, QtGui.QIcon.On) + self.pushButton_15.setIcon(icon1) + self.pushButton_15.setCheckable(True) + self.pushButton_15.setAutoDefault(True) + self.pushButton_15.setObjectName("pushButton_15") + self.verticalLayout.addWidget(self.pushButton_15) + self.widget_5 = QtWidgets.QWidget(self.widget) + self.widget_5.setObjectName("widget_5") + self.formLayout = QtWidgets.QFormLayout(self.widget_5) + self.formLayout.setObjectName("formLayout") + self.pushButton_20 = QtWidgets.QPushButton(self.widget_5, clicked=lambda: self.openFoundationWindow()) + font = QtGui.QFont() + font.setPointSize(10) + font.setBold(False) + font.setWeight(50) + self.pushButton_20.setFont(font) + icon2 = QtGui.QIcon() + icon2.addPixmap(QtGui.QPixmap("C:\\Users\\saans\\AppData\\Local\\Programs\\Python\\Python310\\Lib\\site-packages\\qt5_applications\\Qt\\bin\\../../../../../../../../../../Downloads/play_arrow_filled.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) + self.pushButton_20.setIcon(icon2) + self.pushButton_20.setObjectName("pushButton_20") + self.formLayout.setWidget(0, QtWidgets.QFormLayout.LabelRole, self.pushButton_20) + self.pushButton_21 = QtWidgets.QPushButton(self.widget_5, clicked=lambda: self.openSuperStructureWindow()) + font = QtGui.QFont() + font.setPointSize(10) + font.setBold(False) + font.setWeight(50) + self.pushButton_21.setFont(font) + self.pushButton_21.setIcon(icon2) + self.pushButton_21.setObjectName("pushButton_21") + self.formLayout.setWidget(1, QtWidgets.QFormLayout.LabelRole, self.pushButton_21) + self.pushButton_22 = QtWidgets.QPushButton(self.widget_5, clicked=lambda: self.openSubStructureWindow()) + font = QtGui.QFont() + font.setPointSize(10) + font.setBold(False) + font.setWeight(50) + self.pushButton_22.setFont(font) + self.pushButton_22.setIcon(icon2) + self.pushButton_22.setObjectName("pushButton_22") + self.formLayout.setWidget(2, QtWidgets.QFormLayout.LabelRole, self.pushButton_22) + self.pushButton_23 = QtWidgets.QPushButton(self.widget_5, clicked=lambda: self.openMiscellaneousWindow()) + font = QtGui.QFont() + font.setPointSize(10) + font.setBold(False) + font.setWeight(50) + self.pushButton_23.setFont(font) + self.pushButton_23.setIcon(icon2) + self.pushButton_23.setObjectName("pushButton_23") + self.formLayout.setWidget(3, QtWidgets.QFormLayout.LabelRole, self.pushButton_23) + self.verticalLayout.addWidget(self.widget_5) + self.pushButton_19 = QtWidgets.QPushButton(self.widget, clicked=lambda: self.openFinancialWindow()) + font = QtGui.QFont() + font.setPointSize(10) + self.pushButton_19.setFont(font) + self.pushButton_19.setObjectName("pushButton_19") + self.verticalLayout.addWidget(self.pushButton_19) + self.pushButton_16 = QtWidgets.QPushButton(self.widget) + font = QtGui.QFont() + font.setPointSize(10) + self.pushButton_16.setFont(font) + self.pushButton_16.setIcon(icon1) + self.pushButton_16.setCheckable(True) + self.pushButton_16.setObjectName("pushButton_16") + self.verticalLayout.addWidget(self.pushButton_16) + self.widget_8 = QtWidgets.QWidget(self.widget) + self.widget_8.setMinimumSize(QtCore.QSize(203, 21)) + self.widget_8.setMaximumSize(QtCore.QSize(281, 21)) + self.widget_8.setObjectName("widget_8") + self.pushButton_14 = QtWidgets.QPushButton(self.widget_8, clicked=lambda: self.openCarbonEmissionWindow()) + self.pushButton_14.setGeometry(QtCore.QRect(20, 0, 183, 21)) + font = QtGui.QFont() + font.setPointSize(10) + font.setBold(False) + font.setWeight(50) + self.pushButton_14.setFont(font) + self.pushButton_14.setIcon(icon2) + self.pushButton_14.setObjectName("pushButton_14") + self.verticalLayout.addWidget(self.widget_8) + self.pushButton_17 = QtWidgets.QPushButton(self.widget, clicked=lambda: self.openBridgeTrafficWindow()) + font = QtGui.QFont() + font.setPointSize(10) + self.pushButton_17.setFont(font) + self.pushButton_17.setObjectName("pushButton_17") + self.verticalLayout.addWidget(self.pushButton_17) + self.pushButton_18 = QtWidgets.QPushButton(self.widget, clicked=lambda: self.openMaintenanceWindow()) + font = QtGui.QFont() + font.setPointSize(10) + self.pushButton_18.setFont(font) + self.pushButton_18.setObjectName("pushButton_18") + self.verticalLayout.addWidget(self.pushButton_18) + self.pushButton_10 = QtWidgets.QPushButton(self.widget, clicked=lambda: self.openDemolitionWindow()) + font = QtGui.QFont() + font.setPointSize(10) + self.pushButton_10.setFont(font) + self.pushButton_10.setObjectName("pushButton_10") + self.verticalLayout.addWidget(self.pushButton_10) + self.label_3 = QtWidgets.QLabel(self.scrollAreaWidgetContents) + self.label_3.setGeometry(QtCore.QRect(0, 387, 221, 31)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_3.setFont(font) + self.label_3.setStyleSheet("background-color: rgb(240,230,230)") + self.label_3.setAlignment(QtCore.Qt.AlignCenter) + self.label_3.setObjectName("label_3") + self.textBrowser = QtWidgets.QTextBrowser(self.scrollAreaWidgetContents) + self.textBrowser.setGeometry(QtCore.QRect(0, 418, 221, 221)) + self.textBrowser.setStyleSheet("background-color: #fff9f9") + self.textBrowser.setObjectName("textBrowser") + self.verticalScrollBar = QtWidgets.QScrollBar(self.scrollAreaWidgetContents) + self.verticalScrollBar.setGeometry(QtCore.QRect(220, 0, 16, 641)) + self.verticalScrollBar.setStyleSheet("background-color: #F0F0F0") + self.verticalScrollBar.setOrientation(QtCore.Qt.Vertical) + self.verticalScrollBar.setObjectName("verticalScrollBar") + self.widget.raise_() + self.label_2.raise_() + self.label_3.raise_() + self.textBrowser.raise_() + self.verticalScrollBar.raise_() + self.scrollArea.setWidget(self.scrollAreaWidgetContents) + self.pushButton_6 = QtWidgets.QPushButton(FinancialData_Dialog) + self.pushButton_6.setGeometry(QtCore.QRect(350, 40, 188, 25)) + font = QtGui.QFont() + font.setPointSize(10) + font.setBold(True) + font.setWeight(75) + self.pushButton_6.setFont(font) + self.pushButton_6.setFocusPolicy(QtCore.Qt.StrongFocus) + self.pushButton_6.setLayoutDirection(QtCore.Qt.RightToLeft) + self.pushButton_6.setStyleSheet("background-color: rgb(240,230,230)") + self.pushButton_6.setIcon(icon) + self.pushButton_6.setAutoRepeat(False) + self.pushButton_6.setObjectName("pushButton_6") + + self.retranslateUi(FinancialData_Dialog) + self.buttonBox_2.accepted.connect(self.handle_save) # type: ignore + self.buttonBox_2.rejected.connect(lambda: self.show_warning(FinancialData_Dialog)) # type: ignore + self.pushButton_15.toggled['bool'].connect(self.widget_5.setVisible) # type: ignore + self.pushButton_16.toggled['bool'].connect(self.widget_8.setVisible) # type: ignore + QtCore.QMetaObject.connectSlotsByName(FinancialData_Dialog) + + def show_warning(self, dialog): + """ + Show a warning window when the Close button is pressed. + """ + warning_box = QMessageBox() + warning_box.setIcon(QMessageBox.Warning) + warning_box.setWindowTitle("Confirm Close") + warning_box.setText("Are you sure you want to close without saving?") + warning_box.setStandardButtons(QMessageBox.Yes | QMessageBox.No) + warning_box.setDefaultButton(QMessageBox.No) + + # Check the user's response + response = warning_box.exec_() + if response == QMessageBox.Yes: + dialog.reject() # Close the application + else: + pass # Do nothing, return to the dialog + + def retranslateUi(self, FinancialData_Dialog): + _translate = QtCore.QCoreApplication.translate + FinancialData_Dialog.setWindowTitle(_translate("FinancialData_Dialog", "Dialog")) + self.pushButton.setText(_translate("FinancialData_Dialog", "Project Details Window ")) + self.label_4.setText(_translate("FinancialData_Dialog", "Real Discount Rate")) + self.label_5.setText(_translate("FinancialData_Dialog", "Investment Ratio")) + self.label_6.setText(_translate("FinancialData_Dialog", "Interest Rate")) + self.label_7.setText(_translate("FinancialData_Dialog", "Duration of Study ")) + self.label_8.setText(_translate("FinancialData_Dialog", "Time for construction of Base Project")) + self.label_21.setText(_translate("FinancialData_Dialog", "(%)")) + self.label_22.setText(_translate("FinancialData_Dialog", "(%)")) + self.label_23.setText(_translate("FinancialData_Dialog", "(years)")) + self.label_24.setText(_translate("FinancialData_Dialog", "(years)")) + self.label_2.setText(_translate("FinancialData_Dialog", "Input Parameters")) + self.pushButton_15.setText(_translate("FinancialData_Dialog", "Structure Works Data")) + self.pushButton_20.setText(_translate("FinancialData_Dialog", "Foundation")) + self.pushButton_21.setText(_translate("FinancialData_Dialog", "Super-Structure")) + self.pushButton_22.setText(_translate("FinancialData_Dialog", "Sub-Structure")) + self.pushButton_23.setText(_translate("FinancialData_Dialog", "Miscellaneous")) + self.pushButton_19.setText(_translate("FinancialData_Dialog", "Financial Data")) + self.pushButton_16.setText(_translate("FinancialData_Dialog", "Carbon Emission Data")) + self.pushButton_14.setText(_translate("FinancialData_Dialog", "Carbon Emission Cost Data")) + self.pushButton_17.setText(_translate("FinancialData_Dialog", "Bridge and Traffic Data")) + self.pushButton_18.setText(_translate("FinancialData_Dialog", "Maintenance and Repair")) + self.pushButton_10.setText(_translate("FinancialData_Dialog", "Disposal and Recycling")) + self.label_3.setText(_translate("FinancialData_Dialog", "Output")) + self.textBrowser.setHtml(_translate("FinancialData_Dialog", "\n" +"\n" +"

Initial Construction Cost

\n" +"

Initial Carbon emission Cost

\n" +"

Time Cost

\n" +"

Road User Cost

\n" +"

Carbon Emission due to Re-Routing

\n" +"

Periodic Maintenance Costs

\n" +"

Maintenance Emission Costs

\n" +"

Routine Inspectection Costs

\n" +"

Repair & Rehabilitation Costs

\n" +"

Reconstruction Costs

\n" +"

Demolition & Disposal Cost

\n" +"

Recycling Cost

\n" +"

Total Life-Cycle Cost

")) + self.pushButton_6.setText(_translate("FinancialData_Dialog", "Financial Data ")) + + def validate_data(self): + """Validate input data before saving""" + try: + # Validate numeric fields + float(self.lineEdit_5.text()) if self.lineEdit_5.text() else 0 # Real Discount Rate + float(self.comboBox_3.currentText()) if self.comboBox_3.currentText() else 0 # Interest Rate + float(self.comboBox_2.currentText()) if self.comboBox_2.currentText() else 0 # Investment Ratio + float(self.lineEdit_6.text()) if self.lineEdit_6.text() else 0 # Duration of Study + float(self.lineEdit_13.text()) if self.lineEdit_13.text() else 0 # Time for construction + return True + + except ValueError: + QMessageBox.warning( + None, + "Validation Error", + "Please enter valid numbers in all numeric fields", + QMessageBox.Ok + ) + return False + + def save_data(self): + """Collect all input data and save it to a JSON file""" + if not self.validate_data(): + return False + + data = { + "real_discount_rate": self.lineEdit_5.text(), + "interest_rate": self.comboBox_3.currentText(), + "investment_ratio": self.comboBox_2.currentText(), + "duration_of_study": self.lineEdit_6.text(), + "construction_time_base_project": self.lineEdit_13.text(), + } + + # Save to JSON file + try: + import json + from datetime import datetime + + # Create filename with timestamp + timestamp = datetime.now().strftime("%Y%m%d_%H%M%S") + filename = f"financial_data_{timestamp}.json" + + with open(filename, 'w') as f: + json.dump(data, f, indent=4) + + # Show success message + QMessageBox.information( + None, + "Success", + f"Financial data saved successfully to {filename}", + QMessageBox.Ok + ) + + return True + + except Exception as e: + QMessageBox.critical( + None, + "Error", + f"Failed to save data: {str(e)}", + QMessageBox.Ok + ) + return False + + def handle_save(self): + """Handle the save operation and close the dialog if successful""" + if self.save_data(): # Only close if save was successful + FinancialData_Dialog.accept() + +if __name__ == "__main__": + import sys + app = QtWidgets.QApplication(sys.argv) + FinancialData_Dialog = QtWidgets.QDialog() + ui = Ui_FinancialData_Dialog() + ui.setupUi(FinancialData_Dialog) + FinancialData_Dialog.show() + sys.exit(app.exec_()) diff --git a/src/osbridgelcca/desktop_app/ui/project_details_windows/ProjectDetails_Foundation_Window.py b/src/osbridgelcca/desktop_app/ui/project_details_windows/ProjectDetails_Foundation_Window.py new file mode 100644 index 0000000..69a8792 --- /dev/null +++ b/src/osbridgelcca/desktop_app/ui/project_details_windows/ProjectDetails_Foundation_Window.py @@ -0,0 +1,764 @@ +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file 'C:\Users\saans\AppData\Local\Programs\Python\Python310\Lib\site-packages\qt5_applications\Qt\bin\ProjectDetails_Foundation_Window.ui' +# +# Created by: PyQt5 UI code generator 5.15.9 +# +# WARNING: Any manual changes made to this file will be lost when pyuic5 is +# run again. Do not edit this file unless you know what you are doing. + + +from PyQt5 import QtCore, QtGui, QtWidgets +#from form_data_storage import save_form_data +from PyQt5.QtWidgets import QMessageBox + +#from ProjectDetails_Foundation_Window import Ui_Foundation_Dialog + + + + + + + + + +class Ui_Foundation_Dialog(object): + def openBridgeTrafficWindow(self): + from ProjectDetails_BridgeANDTrafficData_Window import Ui_BridgeTraffic_Dialog + self.window = QtWidgets.QDialog() + self.ui = Ui_BridgeTraffic_Dialog() + self.ui.setupUi(self.window) + self.window.show() + + def openFoundationWindow(self): + self.window = QtWidgets.QDialog() + self.ui = Ui_Foundation_Dialog() + self.ui.setupUi(self.window) + self.window.show() + + def openCarbonEmissionWindow(self): + from ProjectDetails_CarbonEmissionData_Window import Ui_CarbonEmission_Dialog + self.window = QtWidgets.QDialog() + self.ui = Ui_CarbonEmission_Dialog() + self.ui.setupUi(self.window) + self.window.show() + + def openDemolitionWindow(self): + from ProjectDetails_DemolitionANDRecyclingData_Window import Ui_Demolition_Dialog + self.window = QtWidgets.QDialog() + self.ui = Ui_Demolition_Dialog() + self.ui.setupUi(self.window) + self.window.show() + + def openFinancialWindow(self): + from ProjectDetails_FinancialData_Window import Ui_FinancialData_Dialog + self.window = QtWidgets.QDialog() + self.ui = Ui_FinancialData_Dialog() + self.ui.setupUi(self.window) + self.window.show() + + def openMaintenanceWindow(self): + from ProjectDetails_MaintenanceANDRepairData_Window import Ui_Maintenance_Dialog + self.window = QtWidgets.QDialog() + self.ui = Ui_Maintenance_Dialog() + self.ui.setupUi(self.window) + self.window.show() + + def openMiscellaneousWindow(self): + from ProjectDetails_Miscellaneous_Window import Ui_Miscellaneous_Dialog + self.window = QtWidgets.QDialog() + self.ui = Ui_Miscellaneous_Dialog() + self.ui.setupUi(self.window) + self.window.show() + + def openSubStructureWindow(self): + from ProjectDetails_SubStructure_Window import Ui_SubStructure_Dialog + self.window = QtWidgets.QDialog() + self.ui = Ui_SubStructure_Dialog() + self.ui.setupUi(self.window) + self.window.show() + + def openSuperStructureWindow(self): + from ProjectDetails_SuperStructure_Window import Ui_SuperStructure_Dialog + self.window = QtWidgets.QDialog() + self.ui = Ui_SuperStructure_Dialog() + self.ui.setupUi(self.window) + self.window.show() + + def setupUi(self, Foundation_Dialog): + Foundation_Dialog.setObjectName("Foundation_Dialog") + Foundation_Dialog.resize(1440, 900) + Foundation_Dialog.setAutoFillBackground(False) + Foundation_Dialog.setStyleSheet("background-color:#FAFAFA") + self.label = QtWidgets.QLabel(Foundation_Dialog) + self.label.setGeometry(QtCore.QRect(10, 50, 244, 691)) + font = QtGui.QFont() + font.setPointSize(10) + self.label.setFont(font) + self.label.setStyleSheet("background-color: rgb(240,230,230)") + self.label.setText("") + self.label.setObjectName("label") + self.pushButton = QtWidgets.QPushButton(Foundation_Dialog) + self.pushButton.setGeometry(QtCore.QRect(10, 25, 188, 25)) + font = QtGui.QFont() + font.setPointSize(10) + self.pushButton.setFont(font) + self.pushButton.setFocusPolicy(QtCore.Qt.StrongFocus) + self.pushButton.setLayoutDirection(QtCore.Qt.RightToLeft) + self.pushButton.setStyleSheet("background-color: rgb(240,230,230)") + icon = QtGui.QIcon() + icon.addPixmap(QtGui.QPixmap("C:\\Users\\saans\\AppData\\Local\\Programs\\Python\\Python310\\Lib\\site-packages\\qt5_applications\\Qt\\bin\\../../../../../../../../../../Downloads/Dismiss.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) + self.pushButton.setIcon(icon) + self.pushButton.setAutoRepeat(False) + self.pushButton.setObjectName("pushButton") + self.scrollArea = QtWidgets.QScrollArea(Foundation_Dialog) + self.scrollArea.setGeometry(QtCore.QRect(10, 55, 241, 681)) + self.scrollArea.setAutoFillBackground(False) + self.scrollArea.setStyleSheet("background-color: #fff9f9") + self.scrollArea.setWidgetResizable(True) + self.scrollArea.setObjectName("scrollArea") + self.scrollAreaWidgetContents = QtWidgets.QWidget() + self.scrollAreaWidgetContents.setGeometry(QtCore.QRect(0, 0, 239, 679)) + self.scrollAreaWidgetContents.setObjectName("scrollAreaWidgetContents") + self.label_2 = QtWidgets.QLabel(self.scrollAreaWidgetContents) + self.label_2.setGeometry(QtCore.QRect(0, 0, 221, 31)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_2.setFont(font) + self.label_2.setStyleSheet("background-color: rgb(240,230,230)") + self.label_2.setAlignment(QtCore.Qt.AlignCenter) + self.label_2.setObjectName("label_2") + self.widget = QtWidgets.QWidget(self.scrollAreaWidgetContents) + self.widget.setGeometry(QtCore.QRect(0, 30, 221, 357)) + self.widget.setStyleSheet("background-color: #fff9f9") + self.widget.setObjectName("widget") + self.verticalLayout = QtWidgets.QVBoxLayout(self.widget) + self.verticalLayout.setContentsMargins(0, 0, 0, 0) + self.verticalLayout.setObjectName("verticalLayout") + self.pushButton_15 = QtWidgets.QPushButton(self.widget) + font = QtGui.QFont() + font.setPointSize(10) + self.pushButton_15.setFont(font) + icon1 = QtGui.QIcon() + icon1.addPixmap(QtGui.QPixmap("C:\\Users\\saans\\AppData\\Local\\Programs\\Python\\Python310\\Lib\\site-packages\\qt5_applications\\Qt\\bin\\../../../../../../../../../../Downloads/play_arrow_filled.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) + icon1.addPixmap(QtGui.QPixmap("C:\\Users\\saans\\AppData\\Local\\Programs\\Python\\Python310\\Lib\\site-packages\\qt5_applications\\Qt\\bin\\../../../../../../../../../../Downloads/play_arrow_filled (1).png"), QtGui.QIcon.Normal, QtGui.QIcon.On) + self.pushButton_15.setIcon(icon1) + self.pushButton_15.setCheckable(True) + self.pushButton_15.setAutoDefault(True) + self.pushButton_15.setObjectName("pushButton_15") + self.verticalLayout.addWidget(self.pushButton_15) + self.widget_5 = QtWidgets.QWidget(self.widget) + self.widget_5.setObjectName("widget_5") + self.formLayout = QtWidgets.QFormLayout(self.widget_5) + self.formLayout.setObjectName("formLayout") + self.pushButton_20 = QtWidgets.QPushButton(self.widget_5, clicked=lambda: self.openFoundationWindow()) + font = QtGui.QFont() + font.setPointSize(10) + font.setBold(False) + font.setWeight(50) + self.pushButton_20.setFont(font) + icon2 = QtGui.QIcon() + icon2.addPixmap(QtGui.QPixmap("C:\\Users\\saans\\AppData\\Local\\Programs\\Python\\Python310\\Lib\\site-packages\\qt5_applications\\Qt\\bin\\../../../../../../../../../../Downloads/play_arrow_filled.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) + self.pushButton_20.setIcon(icon2) + self.pushButton_20.setObjectName("pushButton_20") + self.formLayout.setWidget(0, QtWidgets.QFormLayout.LabelRole, self.pushButton_20) + self.pushButton_21 = QtWidgets.QPushButton(self.widget_5, clicked=lambda: self.openSuperStructureWindow()) + font = QtGui.QFont() + font.setPointSize(10) + font.setBold(False) + font.setWeight(50) + self.pushButton_21.setFont(font) + self.pushButton_21.setIcon(icon2) + self.pushButton_21.setObjectName("pushButton_21") + self.formLayout.setWidget(1, QtWidgets.QFormLayout.LabelRole, self.pushButton_21) + self.pushButton_22 = QtWidgets.QPushButton(self.widget_5, clicked=lambda: self.openSubStructureWindow()) + font = QtGui.QFont() + font.setPointSize(10) + font.setBold(False) + font.setWeight(50) + self.pushButton_22.setFont(font) + self.pushButton_22.setIcon(icon2) + self.pushButton_22.setObjectName("pushButton_22") + self.formLayout.setWidget(2, QtWidgets.QFormLayout.LabelRole, self.pushButton_22) + self.pushButton_23 = QtWidgets.QPushButton(self.widget_5, clicked=lambda: self.openMiscellaneousWindow()) + font = QtGui.QFont() + font.setPointSize(10) + font.setBold(False) + font.setWeight(50) + self.pushButton_23.setFont(font) + self.pushButton_23.setIcon(icon2) + self.pushButton_23.setObjectName("pushButton_23") + self.formLayout.setWidget(3, QtWidgets.QFormLayout.LabelRole, self.pushButton_23) + self.verticalLayout.addWidget(self.widget_5) + self.pushButton_19 = QtWidgets.QPushButton(self.widget, clicked=lambda: self.openFinancialWindow()) + font = QtGui.QFont() + font.setPointSize(10) + self.pushButton_19.setFont(font) + self.pushButton_19.setObjectName("pushButton_19") + self.verticalLayout.addWidget(self.pushButton_19) + self.pushButton_16 = QtWidgets.QPushButton(self.widget) + font = QtGui.QFont() + font.setPointSize(10) + self.pushButton_16.setFont(font) + self.pushButton_16.setIcon(icon1) + self.pushButton_16.setCheckable(True) + self.pushButton_16.setObjectName("pushButton_16") + self.verticalLayout.addWidget(self.pushButton_16) + self.widget_8 = QtWidgets.QWidget(self.widget) + self.widget_8.setMinimumSize(QtCore.QSize(203, 21)) + self.widget_8.setMaximumSize(QtCore.QSize(281, 21)) + self.widget_8.setObjectName("widget_8") + self.pushButton_14 = QtWidgets.QPushButton(self.widget_8, clicked=lambda: self.openCarbonEmissionWindow()) + self.pushButton_14.setGeometry(QtCore.QRect(20, 0, 183, 21)) + font = QtGui.QFont() + font.setPointSize(10) + font.setBold(False) + font.setWeight(50) + self.pushButton_14.setFont(font) + self.pushButton_14.setIcon(icon2) + self.pushButton_14.setObjectName("pushButton_14") + self.verticalLayout.addWidget(self.widget_8) + self.pushButton_17 = QtWidgets.QPushButton(self.widget, clicked=lambda: self.openBridgeTrafficWindow()) + font = QtGui.QFont() + font.setPointSize(10) + self.pushButton_17.setFont(font) + self.pushButton_17.setObjectName("pushButton_17") + self.verticalLayout.addWidget(self.pushButton_17) + self.pushButton_18 = QtWidgets.QPushButton(self.widget, clicked=lambda: self.openMaintenanceWindow()) + font = QtGui.QFont() + font.setPointSize(10) + self.pushButton_18.setFont(font) + self.pushButton_18.setObjectName("pushButton_18") + self.verticalLayout.addWidget(self.pushButton_18) + self.pushButton_10 = QtWidgets.QPushButton(self.widget, clicked=lambda: self.openDemolitionWindow()) + font = QtGui.QFont() + font.setPointSize(10) + self.pushButton_10.setFont(font) + self.pushButton_10.setObjectName("pushButton_10") + self.verticalLayout.addWidget(self.pushButton_10) + self.label_3 = QtWidgets.QLabel(self.scrollAreaWidgetContents) + self.label_3.setGeometry(QtCore.QRect(0, 387, 221, 31)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_3.setFont(font) + self.label_3.setStyleSheet("background-color: rgb(240,230,230)") + self.label_3.setAlignment(QtCore.Qt.AlignCenter) + self.label_3.setObjectName("label_3") + self.textBrowser = QtWidgets.QTextBrowser(self.scrollAreaWidgetContents) + self.textBrowser.setGeometry(QtCore.QRect(0, 418, 221, 221)) + self.textBrowser.setStyleSheet("background-color: #fff9f9") + self.textBrowser.setObjectName("textBrowser") + self.verticalScrollBar = QtWidgets.QScrollBar(self.scrollAreaWidgetContents) + self.verticalScrollBar.setGeometry(QtCore.QRect(220, 0, 16, 641)) + self.verticalScrollBar.setStyleSheet("background-color: #F0F0F0") + self.verticalScrollBar.setOrientation(QtCore.Qt.Vertical) + self.verticalScrollBar.setObjectName("verticalScrollBar") + self.widget.raise_() + self.label_2.raise_() + self.label_3.raise_() + self.textBrowser.raise_() + self.verticalScrollBar.raise_() + self.scrollArea.setWidget(self.scrollAreaWidgetContents) + self.widget_2 = QtWidgets.QWidget(Foundation_Dialog) + self.widget_2.setGeometry(QtCore.QRect(350, 50, 778, 624)) + self.widget_2.setStyleSheet("background-color: #fff9f9") + self.widget_2.setObjectName("widget_2") + self.label_4 = QtWidgets.QLabel(self.widget_2) + self.label_4.setGeometry(QtCore.QRect(20, 10, 91, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_4.setFont(font) + self.label_4.setObjectName("label_4") + self.comboBox = QtWidgets.QComboBox(self.widget_2) + self.comboBox.setGeometry(QtCore.QRect(140, 10, 190, 22)) + font = QtGui.QFont() + font.setPointSize(10) + self.comboBox.setFont(font) + self.comboBox.setStyleSheet("background-color: #ffffff") + self.comboBox.setObjectName("comboBox") + self.comboBox.addItem("") + self.comboBox.addItem("") + self.pushButton_2 = QtWidgets.QPushButton(self.widget_2) + self.pushButton_2.setGeometry(QtCore.QRect(350, 10, 190, 23)) + self.pushButton_2.setStyleSheet("background-color: #ffffff") + self.pushButton_2.setObjectName("pushButton_2") + self.label_5 = QtWidgets.QLabel(self.widget_2) + self.label_5.setGeometry(QtCore.QRect(20, 70, 161, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_5.setFont(font) + self.label_5.setAlignment(QtCore.Qt.AlignCenter) + self.label_5.setObjectName("label_5") + self.label_6 = QtWidgets.QLabel(self.widget_2) + self.label_6.setGeometry(QtCore.QRect(551, 70, 140, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_6.setFont(font) + self.label_6.setAlignment(QtCore.Qt.AlignCenter) + self.label_6.setObjectName("label_6") + self.label_7 = QtWidgets.QLabel(self.widget_2) + self.label_7.setGeometry(QtCore.QRect(191, 70, 110, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_7.setFont(font) + self.label_7.setAlignment(QtCore.Qt.AlignCenter) + self.label_7.setObjectName("label_7") + self.label_8 = QtWidgets.QLabel(self.widget_2) + self.label_8.setGeometry(QtCore.QRect(311, 70, 110, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_8.setFont(font) + self.label_8.setAlignment(QtCore.Qt.AlignCenter) + self.label_8.setObjectName("label_8") + self.label_9 = QtWidgets.QLabel(self.widget_2) + self.label_9.setGeometry(QtCore.QRect(431, 70, 110, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_9.setFont(font) + self.label_9.setAlignment(QtCore.Qt.AlignCenter) + self.label_9.setObjectName("label_9") + self.comboBox_2 = QtWidgets.QComboBox(self.widget_2) + self.comboBox_2.setGeometry(QtCore.QRect(30, 100, 140, 22)) + self.comboBox_2.setStyleSheet("background-color: #ffffff") + self.comboBox_2.setObjectName("comboBox_2") + self.comboBox_3 = QtWidgets.QComboBox(self.widget_2) + self.comboBox_3.setGeometry(QtCore.QRect(30, 130, 140, 22)) + self.comboBox_3.setStyleSheet("background-color: #ffffff") + self.comboBox_3.setObjectName("comboBox_3") + self.lineEdit = QtWidgets.QLineEdit(self.widget_2) + self.lineEdit.setGeometry(QtCore.QRect(210, 100, 81, 20)) + font = QtGui.QFont() + font.setPointSize(10) + self.lineEdit.setFont(font) + self.lineEdit.setStyleSheet("background-color: #ffffff") + self.lineEdit.setObjectName("lineEdit") + self.lineEdit_2 = QtWidgets.QLineEdit(self.widget_2) + self.lineEdit_2.setGeometry(QtCore.QRect(210, 130, 81, 20)) + font = QtGui.QFont() + font.setPointSize(10) + self.lineEdit_2.setFont(font) + self.lineEdit_2.setStyleSheet("background-color: #ffffff") + self.lineEdit_2.setObjectName("lineEdit_2") + self.label_10 = QtWidgets.QLabel(self.widget_2) + self.label_10.setGeometry(QtCore.QRect(340, 100, 51, 20)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_10.setFont(font) + self.label_10.setStyleSheet("background-color: #ffffff") + self.label_10.setAlignment(QtCore.Qt.AlignCenter) + self.label_10.setObjectName("label_10") + self.label_11 = QtWidgets.QLabel(self.widget_2) + self.label_11.setGeometry(QtCore.QRect(340, 130, 51, 20)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_11.setFont(font) + self.label_11.setStyleSheet("background-color: #ffffff") + self.label_11.setAlignment(QtCore.Qt.AlignCenter) + self.label_11.setObjectName("label_11") + self.lineEdit_3 = QtWidgets.QLineEdit(self.widget_2) + self.lineEdit_3.setGeometry(QtCore.QRect(450, 100, 81, 20)) + font = QtGui.QFont() + font.setPointSize(10) + self.lineEdit_3.setFont(font) + self.lineEdit_3.setStyleSheet("background-color: #ffffff") + self.lineEdit_3.setObjectName("lineEdit_3") + self.lineEdit_4 = QtWidgets.QLineEdit(self.widget_2) + self.lineEdit_4.setGeometry(QtCore.QRect(450, 130, 81, 20)) + font = QtGui.QFont() + font.setPointSize(10) + self.lineEdit_4.setFont(font) + self.lineEdit_4.setStyleSheet("background-color: #ffffff") + self.lineEdit_4.setObjectName("lineEdit_4") + self.lineEdit_5 = QtWidgets.QLineEdit(self.widget_2) + self.lineEdit_5.setGeometry(QtCore.QRect(570, 100, 101, 20)) + font = QtGui.QFont() + font.setPointSize(10) + self.lineEdit_5.setFont(font) + self.lineEdit_5.setStyleSheet("background-color: #ffffff") + self.lineEdit_5.setObjectName("lineEdit_5") + self.lineEdit_6 = QtWidgets.QLineEdit(self.widget_2) + self.lineEdit_6.setGeometry(QtCore.QRect(570, 130, 101, 20)) + font = QtGui.QFont() + font.setPointSize(10) + self.lineEdit_6.setFont(font) + self.lineEdit_6.setStyleSheet("background-color: #ffffff") + self.lineEdit_6.setObjectName("lineEdit_6") + self.pushButton_3 = QtWidgets.QPushButton(self.widget_2) + self.pushButton_3.setGeometry(QtCore.QRect(300, 200, 190, 23)) + self.pushButton_3.setStyleSheet("background-color: #ffffff") + self.pushButton_3.setObjectName("pushButton_3") + self.label_12 = QtWidgets.QLabel(self.widget_2) + self.label_12.setGeometry(QtCore.QRect(30, 330, 161, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_12.setFont(font) + self.label_12.setAlignment(QtCore.Qt.AlignCenter) + self.label_12.setObjectName("label_12") + self.comboBox_4 = QtWidgets.QComboBox(self.widget_2) + self.comboBox_4.setGeometry(QtCore.QRect(150, 270, 190, 22)) + font = QtGui.QFont() + font.setPointSize(10) + self.comboBox_4.setFont(font) + self.comboBox_4.setStyleSheet("background-color: #ffffff") + self.comboBox_4.setObjectName("comboBox_4") + self.comboBox_4.addItem("") + self.comboBox_4.addItem("") + self.label_13 = QtWidgets.QLabel(self.widget_2) + self.label_13.setGeometry(QtCore.QRect(441, 330, 110, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_13.setFont(font) + self.label_13.setAlignment(QtCore.Qt.AlignCenter) + self.label_13.setObjectName("label_13") + self.label_14 = QtWidgets.QLabel(self.widget_2) + self.label_14.setGeometry(QtCore.QRect(350, 390, 51, 20)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_14.setFont(font) + self.label_14.setStyleSheet("background-color: #ffffff") + self.label_14.setAlignment(QtCore.Qt.AlignCenter) + self.label_14.setObjectName("label_14") + self.label_15 = QtWidgets.QLabel(self.widget_2) + self.label_15.setGeometry(QtCore.QRect(561, 330, 140, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_15.setFont(font) + self.label_15.setAlignment(QtCore.Qt.AlignCenter) + self.label_15.setObjectName("label_15") + self.label_16 = QtWidgets.QLabel(self.widget_2) + self.label_16.setGeometry(QtCore.QRect(350, 360, 51, 20)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_16.setFont(font) + self.label_16.setStyleSheet("background-color: #ffffff") + self.label_16.setAlignment(QtCore.Qt.AlignCenter) + self.label_16.setObjectName("label_16") + self.label_17 = QtWidgets.QLabel(self.widget_2) + self.label_17.setGeometry(QtCore.QRect(321, 330, 110, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_17.setFont(font) + self.label_17.setAlignment(QtCore.Qt.AlignCenter) + self.label_17.setObjectName("label_17") + self.lineEdit_7 = QtWidgets.QLineEdit(self.widget_2) + self.lineEdit_7.setGeometry(QtCore.QRect(220, 390, 81, 20)) + font = QtGui.QFont() + font.setPointSize(10) + self.lineEdit_7.setFont(font) + self.lineEdit_7.setStyleSheet("background-color: #ffffff") + self.lineEdit_7.setObjectName("lineEdit_7") + self.lineEdit_8 = QtWidgets.QLineEdit(self.widget_2) + self.lineEdit_8.setGeometry(QtCore.QRect(580, 360, 101, 20)) + font = QtGui.QFont() + font.setPointSize(10) + self.lineEdit_8.setFont(font) + self.lineEdit_8.setStyleSheet("background-color: #ffffff") + self.lineEdit_8.setObjectName("lineEdit_8") + self.label_18 = QtWidgets.QLabel(self.widget_2) + self.label_18.setGeometry(QtCore.QRect(201, 330, 110, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_18.setFont(font) + self.label_18.setAlignment(QtCore.Qt.AlignCenter) + self.label_18.setObjectName("label_18") + self.pushButton_4 = QtWidgets.QPushButton(self.widget_2) + self.pushButton_4.setGeometry(QtCore.QRect(310, 460, 190, 23)) + self.pushButton_4.setStyleSheet("background-color: #ffffff") + self.pushButton_4.setObjectName("pushButton_4") + self.lineEdit_9 = QtWidgets.QLineEdit(self.widget_2) + self.lineEdit_9.setGeometry(QtCore.QRect(220, 360, 81, 20)) + font = QtGui.QFont() + font.setPointSize(10) + self.lineEdit_9.setFont(font) + self.lineEdit_9.setStyleSheet("background-color: #ffffff") + self.lineEdit_9.setObjectName("lineEdit_9") + self.lineEdit_10 = QtWidgets.QLineEdit(self.widget_2) + self.lineEdit_10.setGeometry(QtCore.QRect(460, 360, 81, 20)) + font = QtGui.QFont() + font.setPointSize(10) + self.lineEdit_10.setFont(font) + self.lineEdit_10.setStyleSheet("background-color: #ffffff") + self.lineEdit_10.setObjectName("lineEdit_10") + self.lineEdit_11 = QtWidgets.QLineEdit(self.widget_2) + self.lineEdit_11.setGeometry(QtCore.QRect(460, 390, 81, 20)) + font = QtGui.QFont() + font.setPointSize(10) + self.lineEdit_11.setFont(font) + self.lineEdit_11.setStyleSheet("background-color: #ffffff") + self.lineEdit_11.setObjectName("lineEdit_11") + self.pushButton_5 = QtWidgets.QPushButton(self.widget_2) + self.pushButton_5.setGeometry(QtCore.QRect(360, 270, 190, 23)) + self.pushButton_5.setStyleSheet("background-color: #ffffff") + self.pushButton_5.setObjectName("pushButton_5") + self.label_19 = QtWidgets.QLabel(self.widget_2) + self.label_19.setGeometry(QtCore.QRect(30, 270, 91, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_19.setFont(font) + self.label_19.setObjectName("label_19") + self.lineEdit_12 = QtWidgets.QLineEdit(self.widget_2) + self.lineEdit_12.setGeometry(QtCore.QRect(580, 390, 101, 20)) + font = QtGui.QFont() + font.setPointSize(10) + self.lineEdit_12.setFont(font) + self.lineEdit_12.setStyleSheet("background-color: #ffffff") + self.lineEdit_12.setObjectName("lineEdit_12") + self.comboBox_5 = QtWidgets.QComboBox(self.widget_2) + self.comboBox_5.setGeometry(QtCore.QRect(40, 360, 140, 22)) + self.comboBox_5.setStyleSheet("background-color: #ffffff") + self.comboBox_5.setObjectName("comboBox_5") + self.comboBox_5.addItem("") + self.comboBox_5.addItem("") + self.comboBox_6 = QtWidgets.QComboBox(self.widget_2) + self.comboBox_6.setGeometry(QtCore.QRect(40, 390, 140, 22)) + self.comboBox_6.setStyleSheet("background-color: #ffffff") + self.comboBox_6.setObjectName("comboBox_6") + self.comboBox_6.addItem("") + self.comboBox_6.addItem("") + self.buttonBox = QtWidgets.QDialogButtonBox(self.widget_2) + self.buttonBox.setGeometry(QtCore.QRect(420, 580, 341, 32)) + self.buttonBox.setOrientation(QtCore.Qt.Horizontal) + self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Close|QtWidgets.QDialogButtonBox.Save) + self.buttonBox.setCenterButtons(False) + self.buttonBox.setObjectName("buttonBox") + self.line = QtWidgets.QFrame(self.widget_2) + self.line.setGeometry(QtCore.QRect(10, 250, 761, 16)) + self.line.setContextMenuPolicy(QtCore.Qt.DefaultContextMenu) + self.line.setFrameShadow(QtWidgets.QFrame.Sunken) + self.line.setLineWidth(2) + self.line.setMidLineWidth(2) + self.line.setFrameShape(QtWidgets.QFrame.HLine) + self.line.setObjectName("line") + self.line_2 = QtWidgets.QFrame(self.widget_2) + self.line_2.setGeometry(QtCore.QRect(10, 500, 761, 16)) + self.line_2.setContextMenuPolicy(QtCore.Qt.DefaultContextMenu) + self.line_2.setFrameShadow(QtWidgets.QFrame.Sunken) + self.line_2.setLineWidth(2) + self.line_2.setMidLineWidth(2) + self.line_2.setFrameShape(QtWidgets.QFrame.HLine) + self.line_2.setObjectName("line_2") + self.pushButton_6 = QtWidgets.QPushButton(Foundation_Dialog) + self.pushButton_6.setGeometry(QtCore.QRect(350, 25, 188, 25)) + font = QtGui.QFont() + font.setPointSize(10) + font.setBold(True) + font.setWeight(75) + self.pushButton_6.setFont(font) + self.pushButton_6.setFocusPolicy(QtCore.Qt.StrongFocus) + self.pushButton_6.setLayoutDirection(QtCore.Qt.RightToLeft) + self.pushButton_6.setStyleSheet("background-color: rgb(240,230,230)") + self.pushButton_6.setIcon(icon) + self.pushButton_6.setAutoRepeat(False) + self.pushButton_6.setObjectName("pushButton_6") + + self.retranslateUi(Foundation_Dialog) + self.buttonBox.accepted.connect(self.handle_save) # type: ignore + #self.buttonBox.accepted.connect(self.save_data) + self.buttonBox.rejected.connect(lambda: self.show_warning(Foundation_Dialog)) # type: ignore + self.pushButton_15.toggled['bool'].connect(self.widget_5.setVisible) # type: ignore + self.pushButton_16.toggled['bool'].connect(self.widget_8.setVisible) # type: ignore + + QtCore.QMetaObject.connectSlotsByName(Foundation_Dialog) + + def show_warning(self, dialog): + """ + Show a warning window when the Close button is pressed. + """ + warning_box = QMessageBox() + warning_box.setIcon(QMessageBox.Warning) + warning_box.setWindowTitle("Confirm Close") + warning_box.setText("Are you sure you want to close without saving?") + warning_box.setStandardButtons(QMessageBox.Yes | QMessageBox.No) + warning_box.setDefaultButton(QMessageBox.No) + + # Check the user's response + response = warning_box.exec_() + if response == QMessageBox.Yes: + dialog.reject() # Close the application + else: + pass # Do nothing, return to the dialog + + ''' + def save_data(self): + """ + Collect form data and save it to the global dictionary. + """ + data = { + "component": self.comboBox.currentText(), + "sub_component": self.comboBox_2.currentText(), + "quantity": self.lineEdit.text(), + "unit": self.label_10.text(), + "rate": self.lineEdit_3.text(), + "material_type": self.comboBox_4.currentText(), + } + save_form_data("Foundation_Dialog", data)''' + + def retranslateUi(self, Foundation_Dialog): + _translate = QtCore.QCoreApplication.translate + Foundation_Dialog.setWindowTitle(_translate("Foundation_Dialog", "Dialog")) + self.pushButton.setText(_translate("Foundation_Dialog", "Project Details Window ")) + self.label_2.setText(_translate("Foundation_Dialog", "Input Parameters")) + self.pushButton_15.setText(_translate("Foundation_Dialog", "Structure Works Data")) + self.pushButton_20.setText(_translate("Foundation_Dialog", "Foundation")) + self.pushButton_21.setText(_translate("Foundation_Dialog", "Super-Structure")) + self.pushButton_22.setText(_translate("Foundation_Dialog", "Sub-Structure")) + self.pushButton_23.setText(_translate("Foundation_Dialog", "Miscellaneous")) + self.pushButton_19.setText(_translate("Foundation_Dialog", "Financial Data")) + self.pushButton_16.setText(_translate("Foundation_Dialog", "Carbon Emission Data")) + self.pushButton_14.setText(_translate("Foundation_Dialog", "Carbon Emission Cost Data")) + self.pushButton_17.setText(_translate("Foundation_Dialog", "Bridge and Traffic Data")) + self.pushButton_18.setText(_translate("Foundation_Dialog", "Maintenance and Repair")) + self.pushButton_10.setText(_translate("Foundation_Dialog", "Disposal and Recycling")) + self.label_3.setText(_translate("Foundation_Dialog", "Output")) + self.textBrowser.setHtml(_translate("Foundation_Dialog", "\n" +"\n" +"

Initial Construction Cost

\n" +"

Initial Carbon emission Cost

\n" +"

Time Cost

\n" +"

Road User Cost

\n" +"

Carbon Emission due to Re-Routing

\n" +"

Periodic Maintenance Costs

\n" +"

Maintenance Emission Costs

\n" +"

Routine Inspectection Costs

\n" +"

Repair & Rehabilitation Costs

\n" +"

Reconstruction Costs

\n" +"

Demolition & Disposal Cost

\n" +"

Recycling Cost

\n" +"

Total Life-Cycle Cost

")) + self.label_4.setText(_translate("Foundation_Dialog", "Components:")) + self.comboBox.setItemText(0, _translate("Foundation_Dialog", "Earthwork")) + self.comboBox.setItemText(1, _translate("Foundation_Dialog", "RCC in Foundation")) + self.pushButton_2.setText(_translate("Foundation_Dialog", "+ Add Sub-Component")) + self.label_5.setText(_translate("Foundation_Dialog", "Material Type and Grade")) + self.label_6.setText(_translate("Foundation_Dialog", "Rate Data Source")) + self.label_7.setText(_translate("Foundation_Dialog", "Quantity")) + self.label_8.setText(_translate("Foundation_Dialog", "Unit")) + self.label_9.setText(_translate("Foundation_Dialog", "Rate")) + self.label_10.setText(_translate("Foundation_Dialog", "

m3

")) + self.label_11.setText(_translate("Foundation_Dialog", "kg")) + self.pushButton_3.setText(_translate("Foundation_Dialog", "+ Add Material")) + self.label_12.setText(_translate("Foundation_Dialog", "Material Type and Grade")) + self.comboBox_4.setItemText(0, _translate("Foundation_Dialog", "RCC in Foundation")) + self.comboBox_4.setItemText(1, _translate("Foundation_Dialog", "Earthwork")) + self.label_13.setText(_translate("Foundation_Dialog", "Rate")) + self.label_14.setText(_translate("Foundation_Dialog", "kg")) + self.label_15.setText(_translate("Foundation_Dialog", "Rate Data Source")) + self.label_16.setText(_translate("Foundation_Dialog", "

m3

")) + self.label_17.setText(_translate("Foundation_Dialog", "Unit")) + self.label_18.setText(_translate("Foundation_Dialog", "Quantity")) + self.pushButton_4.setText(_translate("Foundation_Dialog", "+ Add Material")) + self.pushButton_5.setText(_translate("Foundation_Dialog", "+ Add Sub-Component")) + self.label_19.setText(_translate("Foundation_Dialog", "Components:")) + self.comboBox_5.setItemText(0, _translate("Foundation_Dialog", "Concrete")) + self.comboBox_5.setItemText(1, _translate("Foundation_Dialog", "Steel")) + self.comboBox_6.setItemText(0, _translate("Foundation_Dialog", "Steel")) + self.comboBox_6.setItemText(1, _translate("Foundation_Dialog", "Concrete")) + self.pushButton_6.setText(_translate("Foundation_Dialog", "Foundation ")) + + def validate_data(self): + """Validate input data before saving""" + try: + # Validate numeric fields + float(self.lineEdit.text()) if self.lineEdit.text() else 0 # Quantity 1 + float(self.lineEdit_2.text()) if self.lineEdit_2.text() else 0 # Quantity 2 + float(self.lineEdit_3.text()) if self.lineEdit_3.text() else 0 # Rate 1 + float(self.lineEdit_4.text()) if self.lineEdit_4.text() else 0 # Rate 2 + float(self.lineEdit_5.text()) if self.lineEdit_5.text() else 0 # Rate Data Source 1 + float(self.lineEdit_6.text()) if self.lineEdit_6.text() else 0 # Rate Data Source 2 + float(self.lineEdit_7.text()) if self.lineEdit_7.text() else 0 # Quantity 3 + float(self.lineEdit_8.text()) if self.lineEdit_8.text() else 0 # Rate Data Source 3 + float(self.lineEdit_9.text()) if self.lineEdit_9.text() else 0 # Quantity 4 + float(self.lineEdit_10.text()) if self.lineEdit_10.text() else 0 # Rate 3 + float(self.lineEdit_11.text()) if self.lineEdit_11.text() else 0 # Rate 4 + float(self.lineEdit_12.text()) if self.lineEdit_12.text() else 0 # Rate Data Source 4 + return True + + except ValueError: + QMessageBox.warning( + None, + "Validation Error", + "Please enter valid numbers in all numeric fields", + QMessageBox.Ok + ) + return False + + def save_data(self): + """Collect all input data and save it to a JSON file""" + if not self.validate_data(): + return False + + data = { + "component_1": self.comboBox.currentText(), + "sub_component_1": self.comboBox_2.currentText(), + "material_type_1": self.comboBox_5.currentText(), + "material_grade_1": self.comboBox_6.currentText(), + "quantity_1": self.lineEdit.text(), + "unit_1": self.label_10.text(), + "rate_1": self.lineEdit_3.text(), + "rate_data_source_1": self.lineEdit_5.text(), + + "component_2": self.comboBox_4.currentText(), + "sub_component_2": self.comboBox_3.currentText(), + "material_type_2": self.comboBox_5.currentText(), + "material_grade_2": self.comboBox_6.currentText(), + "quantity_2": self.lineEdit_2.text(), + "unit_2": self.label_11.text(), + "rate_2": self.lineEdit_4.text(), + "rate_data_source_2": self.lineEdit_6.text(), + + "quantity_3": self.lineEdit_9.text(), + "unit_3": self.label_16.text(), + "rate_3": self.lineEdit_10.text(), + "quantity_4": self.lineEdit_7.text(), + "unit_4": self.label_14.text(), + "rate_4": self.lineEdit_11.text(), + "rate_data_source_3": self.lineEdit_8.text(), + "rate_data_source_4": self.lineEdit_12.text(), + } + + # Save to JSON file + try: + import json + from datetime import datetime + + # Create filename with timestamp + timestamp = datetime.now().strftime("%Y%m%d_%H%M%S") + filename = f"foundation_data_{timestamp}.json" + + with open(filename, 'w') as f: + json.dump(data, f, indent=4) + + # Show success message + QMessageBox.information( + None, + "Success", + f"Foundation data saved successfully to {filename}", + QMessageBox.Ok + ) + + return True + + except Exception as e: + QMessageBox.critical( + None, + "Error", + f"Failed to save data: {str(e)}", + QMessageBox.Ok + ) + return False + + def handle_save(self): + """Handle the save operation and close the dialog if successful""" + if self.save_data(): # Only close if save was successful + Foundation_Dialog.accept() + +if __name__ == "__main__": + import sys + app = QtWidgets.QApplication(sys.argv) + Foundation_Dialog = QtWidgets.QDialog() + ui = Ui_Foundation_Dialog() + ui.setupUi(Foundation_Dialog) + Foundation_Dialog.show() + sys.exit(app.exec_()) diff --git a/src/osbridgelcca/desktop_app/ui/project_details_windows/ProjectDetails_MaintenanceANDRepairData_Window.py b/src/osbridgelcca/desktop_app/ui/project_details_windows/ProjectDetails_MaintenanceANDRepairData_Window.py new file mode 100644 index 0000000..a36d92b --- /dev/null +++ b/src/osbridgelcca/desktop_app/ui/project_details_windows/ProjectDetails_MaintenanceANDRepairData_Window.py @@ -0,0 +1,571 @@ +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file 'C:\Users\saans\AppData\Local\Programs\Python\Python310\Lib\site-packages\qt5_applications\Qt\bin\ProjectDetails_Maintenance&RepairData_Window.ui' +# +# Created by: PyQt5 UI code generator 5.15.9 +# +# WARNING: Any manual changes made to this file will be lost when pyuic5 is +# run again. Do not edit this file unless you know what you are doing. + + +from PyQt5 import QtCore, QtGui, QtWidgets +from PyQt5.QtWidgets import QMessageBox + + + + + +#from ProjectDetails_MaintenanceANDRepairData_Window import Ui_Maintenance_Dialog + + + + + +class Ui_Maintenance_Dialog(object): + def openBridgeTrafficWindow(self): + from ProjectDetails_BridgeANDTrafficData_Window import Ui_BridgeTraffic_Dialog + self.window = QtWidgets.QDialog() + self.ui = Ui_BridgeTraffic_Dialog() + self.ui.setupUi(self.window) + self.window.show() + + def openFoundationWindow(self): + from ProjectDetails_Foundation_Window import Ui_Foundation_Dialog + self.window = QtWidgets.QDialog() + self.ui = Ui_Foundation_Dialog() + self.ui.setupUi(self.window) + self.window.show() + + def openCarbonEmissionWindow(self): + from ProjectDetails_CarbonEmissionData_Window import Ui_CarbonEmission_Dialog + self.window = QtWidgets.QDialog() + self.ui = Ui_CarbonEmission_Dialog() + self.ui.setupUi(self.window) + self.window.show() + + def openDemolitionWindow(self): + from ProjectDetails_DemolitionANDRecyclingData_Window import Ui_Demolition_Dialog + self.window = QtWidgets.QDialog() + self.ui = Ui_Demolition_Dialog() + self.ui.setupUi(self.window) + self.window.show() + + def openFinancialWindow(self): + from ProjectDetails_FinancialData_Window import Ui_FinancialData_Dialog + self.window = QtWidgets.QDialog() + self.ui = Ui_FinancialData_Dialog() + self.ui.setupUi(self.window) + self.window.show() + + def openMaintenanceWindow(self): + self.window = QtWidgets.QDialog() + self.ui = Ui_Maintenance_Dialog() + self.ui.setupUi(self.window) + self.window.show() + + def openMiscellaneousWindow(self): + from ProjectDetails_Miscellaneous_Window import Ui_Miscellaneous_Dialog + self.window = QtWidgets.QDialog() + self.ui = Ui_Miscellaneous_Dialog() + self.ui.setupUi(self.window) + self.window.show() + + def openSubStructureWindow(self): + from ProjectDetails_SubStructure_Window import Ui_SubStructure_Dialog + self.window = QtWidgets.QDialog() + self.ui = Ui_SubStructure_Dialog() + self.ui.setupUi(self.window) + self.window.show() + + def openSuperStructureWindow(self): + from ProjectDetails_SuperStructure_Window import Ui_SuperStructure_Dialog + self.window = QtWidgets.QDialog() + self.ui = Ui_SuperStructure_Dialog() + self.ui.setupUi(self.window) + self.window.show() + + def setupUi(self, Maintenance_Dialog): + Maintenance_Dialog.setObjectName("Maintenance_Dialog") + Maintenance_Dialog.resize(1440, 900) + Maintenance_Dialog.setStyleSheet("background-color: #fafafa") + self.pushButton_6 = QtWidgets.QPushButton(Maintenance_Dialog) + self.pushButton_6.setGeometry(QtCore.QRect(350, 35, 261, 25)) + font = QtGui.QFont() + font.setPointSize(10) + font.setBold(True) + font.setWeight(75) + self.pushButton_6.setFont(font) + self.pushButton_6.setFocusPolicy(QtCore.Qt.StrongFocus) + self.pushButton_6.setLayoutDirection(QtCore.Qt.RightToLeft) + self.pushButton_6.setStyleSheet("background-color: rgb(240,230,230)") + icon = QtGui.QIcon() + icon.addPixmap(QtGui.QPixmap("C:\\Users\\saans\\AppData\\Local\\Programs\\Python\\Python310\\Lib\\site-packages\\qt5_applications\\Qt\\bin\\../../../../../../../../../../Downloads/Dismiss.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) + self.pushButton_6.setIcon(icon) + self.pushButton_6.setAutoRepeat(False) + self.pushButton_6.setObjectName("pushButton_6") + self.label = QtWidgets.QLabel(Maintenance_Dialog) + self.label.setGeometry(QtCore.QRect(10, 60, 244, 691)) + font = QtGui.QFont() + font.setPointSize(10) + self.label.setFont(font) + self.label.setStyleSheet("background-color: rgb(240,230,230)") + self.label.setText("") + self.label.setObjectName("label") + self.widget_2 = QtWidgets.QWidget(Maintenance_Dialog) + self.widget_2.setGeometry(QtCore.QRect(350, 60, 784, 304)) + self.widget_2.setStyleSheet("background-color: #fff9f9") + self.widget_2.setObjectName("widget_2") + self.label_4 = QtWidgets.QLabel(self.widget_2) + self.label_4.setGeometry(QtCore.QRect(20, 240, 201, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_4.setFont(font) + self.label_4.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter) + self.label_4.setObjectName("label_4") + self.label_5 = QtWidgets.QLabel(self.widget_2) + self.label_5.setGeometry(QtCore.QRect(600, 60, 161, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_5.setFont(font) + self.label_5.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter) + self.label_5.setObjectName("label_5") + self.label_6 = QtWidgets.QLabel(self.widget_2) + self.label_6.setGeometry(QtCore.QRect(600, 30, 140, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_6.setFont(font) + self.label_6.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter) + self.label_6.setObjectName("label_6") + self.label_7 = QtWidgets.QLabel(self.widget_2) + self.label_7.setGeometry(QtCore.QRect(600, 90, 110, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_7.setFont(font) + self.label_7.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter) + self.label_7.setObjectName("label_7") + self.label_8 = QtWidgets.QLabel(self.widget_2) + self.label_8.setGeometry(QtCore.QRect(20, 200, 221, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_8.setFont(font) + self.label_8.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter) + self.label_8.setObjectName("label_8") + self.lineEdit_5 = QtWidgets.QLineEdit(self.widget_2) + self.lineEdit_5.setGeometry(QtCore.QRect(270, 30, 181, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.lineEdit_5.setFont(font) + self.lineEdit_5.setStyleSheet("background-color: #ffffff") + self.lineEdit_5.setObjectName("lineEdit_5") + self.buttonBox_2 = QtWidgets.QDialogButtonBox(self.widget_2) + self.buttonBox_2.setGeometry(QtCore.QRect(440, 270, 341, 32)) + self.buttonBox_2.setOrientation(QtCore.Qt.Horizontal) + self.buttonBox_2.setStandardButtons(QtWidgets.QDialogButtonBox.Close|QtWidgets.QDialogButtonBox.Save) + self.buttonBox_2.setObjectName("buttonBox_2") + self.label_21 = QtWidgets.QLabel(self.widget_2) + self.label_21.setGeometry(QtCore.QRect(470, 30, 51, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_21.setFont(font) + self.label_21.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter) + self.label_21.setObjectName("label_21") + self.label_22 = QtWidgets.QLabel(self.widget_2) + self.label_22.setGeometry(QtCore.QRect(470, 90, 51, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_22.setFont(font) + self.label_22.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter) + self.label_22.setObjectName("label_22") + self.label_23 = QtWidgets.QLabel(self.widget_2) + self.label_23.setGeometry(QtCore.QRect(470, 200, 51, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_23.setFont(font) + self.label_23.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter) + self.label_23.setObjectName("label_23") + self.label_24 = QtWidgets.QLabel(self.widget_2) + self.label_24.setGeometry(QtCore.QRect(470, 240, 51, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_24.setFont(font) + self.label_24.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter) + self.label_24.setObjectName("label_24") + self.textBrowser_2 = QtWidgets.QTextBrowser(self.widget_2) + self.textBrowser_2.setGeometry(QtCore.QRect(20, 10, 231, 51)) + self.textBrowser_2.setObjectName("textBrowser_2") + self.textBrowser_3 = QtWidgets.QTextBrowser(self.widget_2) + self.textBrowser_3.setGeometry(QtCore.QRect(20, 70, 231, 51)) + self.textBrowser_3.setObjectName("textBrowser_3") + self.textBrowser_4 = QtWidgets.QTextBrowser(self.widget_2) + self.textBrowser_4.setGeometry(QtCore.QRect(20, 130, 231, 51)) + self.textBrowser_4.setObjectName("textBrowser_4") + self.lineEdit_7 = QtWidgets.QLineEdit(self.widget_2) + self.lineEdit_7.setGeometry(QtCore.QRect(270, 90, 181, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.lineEdit_7.setFont(font) + self.lineEdit_7.setStyleSheet("background-color: #ffffff") + self.lineEdit_7.setObjectName("lineEdit_7") + self.lineEdit_8 = QtWidgets.QLineEdit(self.widget_2) + self.lineEdit_8.setGeometry(QtCore.QRect(270, 150, 181, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.lineEdit_8.setFont(font) + self.lineEdit_8.setStyleSheet("background-color: #ffffff") + self.lineEdit_8.setObjectName("lineEdit_8") + self.lineEdit_9 = QtWidgets.QLineEdit(self.widget_2) + self.lineEdit_9.setGeometry(QtCore.QRect(270, 200, 181, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.lineEdit_9.setFont(font) + self.lineEdit_9.setStyleSheet("background-color: #ffffff") + self.lineEdit_9.setObjectName("lineEdit_9") + self.lineEdit_10 = QtWidgets.QLineEdit(self.widget_2) + self.lineEdit_10.setGeometry(QtCore.QRect(270, 240, 181, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.lineEdit_10.setFont(font) + self.lineEdit_10.setStyleSheet("background-color: #ffffff") + self.lineEdit_10.setObjectName("lineEdit_10") + self.label_25 = QtWidgets.QLabel(self.widget_2) + self.label_25.setGeometry(QtCore.QRect(470, 150, 51, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_25.setFont(font) + self.label_25.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter) + self.label_25.setObjectName("label_25") + self.pushButton = QtWidgets.QPushButton(Maintenance_Dialog) + self.pushButton.setGeometry(QtCore.QRect(10, 35, 188, 25)) + font = QtGui.QFont() + font.setPointSize(10) + self.pushButton.setFont(font) + self.pushButton.setFocusPolicy(QtCore.Qt.StrongFocus) + self.pushButton.setLayoutDirection(QtCore.Qt.RightToLeft) + self.pushButton.setStyleSheet("background-color: rgb(240,230,230)") + self.pushButton.setIcon(icon) + self.pushButton.setAutoRepeat(False) + self.pushButton.setObjectName("pushButton") + self.scrollArea = QtWidgets.QScrollArea(Maintenance_Dialog) + self.scrollArea.setGeometry(QtCore.QRect(10, 65, 241, 681)) + self.scrollArea.setAutoFillBackground(False) + self.scrollArea.setStyleSheet("background-color: #fff9f9") + self.scrollArea.setWidgetResizable(True) + self.scrollArea.setObjectName("scrollArea") + self.scrollAreaWidgetContents = QtWidgets.QWidget() + self.scrollAreaWidgetContents.setGeometry(QtCore.QRect(0, 0, 239, 679)) + self.scrollAreaWidgetContents.setObjectName("scrollAreaWidgetContents") + self.label_2 = QtWidgets.QLabel(self.scrollAreaWidgetContents) + self.label_2.setGeometry(QtCore.QRect(0, 0, 221, 31)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_2.setFont(font) + self.label_2.setStyleSheet("background-color: rgb(240,230,230)") + self.label_2.setAlignment(QtCore.Qt.AlignCenter) + self.label_2.setObjectName("label_2") + self.widget = QtWidgets.QWidget(self.scrollAreaWidgetContents) + self.widget.setGeometry(QtCore.QRect(0, 30, 221, 357)) + self.widget.setStyleSheet("background-color: #fff9f9") + self.widget.setObjectName("widget") + self.verticalLayout = QtWidgets.QVBoxLayout(self.widget) + self.verticalLayout.setContentsMargins(0, 0, 0, 0) + self.verticalLayout.setObjectName("verticalLayout") + self.pushButton_15 = QtWidgets.QPushButton(self.widget) + font = QtGui.QFont() + font.setPointSize(10) + self.pushButton_15.setFont(font) + icon1 = QtGui.QIcon() + icon1.addPixmap(QtGui.QPixmap("C:\\Users\\saans\\AppData\\Local\\Programs\\Python\\Python310\\Lib\\site-packages\\qt5_applications\\Qt\\bin\\../../../../../../../../../../Downloads/play_arrow_filled.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) + icon1.addPixmap(QtGui.QPixmap("C:\\Users\\saans\\AppData\\Local\\Programs\\Python\\Python310\\Lib\\site-packages\\qt5_applications\\Qt\\bin\\../../../../../../../../../../Downloads/play_arrow_filled (1).png"), QtGui.QIcon.Normal, QtGui.QIcon.On) + self.pushButton_15.setIcon(icon1) + self.pushButton_15.setCheckable(True) + self.pushButton_15.setAutoDefault(True) + self.pushButton_15.setObjectName("pushButton_15") + self.verticalLayout.addWidget(self.pushButton_15) + self.widget_5 = QtWidgets.QWidget(self.widget) + self.widget_5.setObjectName("widget_5") + self.formLayout = QtWidgets.QFormLayout(self.widget_5) + self.formLayout.setObjectName("formLayout") + self.pushButton_20 = QtWidgets.QPushButton(self.widget_5, clicked=lambda: self.openFoundationWindow()) + font = QtGui.QFont() + font.setPointSize(10) + font.setBold(False) + font.setWeight(50) + self.pushButton_20.setFont(font) + icon2 = QtGui.QIcon() + icon2.addPixmap(QtGui.QPixmap("C:\\Users\\saans\\AppData\\Local\\Programs\\Python\\Python310\\Lib\\site-packages\\qt5_applications\\Qt\\bin\\../../../../../../../../../../Downloads/play_arrow_filled.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) + self.pushButton_20.setIcon(icon2) + self.pushButton_20.setObjectName("pushButton_20") + self.formLayout.setWidget(0, QtWidgets.QFormLayout.LabelRole, self.pushButton_20) + self.pushButton_21 = QtWidgets.QPushButton(self.widget_5, clicked=lambda: self.openSuperStructureWindow()) + font = QtGui.QFont() + font.setPointSize(10) + font.setBold(False) + font.setWeight(50) + self.pushButton_21.setFont(font) + self.pushButton_21.setIcon(icon2) + self.pushButton_21.setObjectName("pushButton_21") + self.formLayout.setWidget(1, QtWidgets.QFormLayout.LabelRole, self.pushButton_21) + self.pushButton_22 = QtWidgets.QPushButton(self.widget_5, clicked=lambda: self.openSubStructureWindow()) + font = QtGui.QFont() + font.setPointSize(10) + font.setBold(False) + font.setWeight(50) + self.pushButton_22.setFont(font) + self.pushButton_22.setIcon(icon2) + self.pushButton_22.setObjectName("pushButton_22") + self.formLayout.setWidget(2, QtWidgets.QFormLayout.LabelRole, self.pushButton_22) + self.pushButton_23 = QtWidgets.QPushButton(self.widget_5, clicked=lambda: self.openMiscellaneousWindow()) + font = QtGui.QFont() + font.setPointSize(10) + font.setBold(False) + font.setWeight(50) + self.pushButton_23.setFont(font) + self.pushButton_23.setIcon(icon2) + self.pushButton_23.setObjectName("pushButton_23") + self.formLayout.setWidget(3, QtWidgets.QFormLayout.LabelRole, self.pushButton_23) + self.verticalLayout.addWidget(self.widget_5) + self.pushButton_19 = QtWidgets.QPushButton(self.widget, clicked=lambda: self.openFinancialWindow()) + font = QtGui.QFont() + font.setPointSize(10) + self.pushButton_19.setFont(font) + self.pushButton_19.setObjectName("pushButton_19") + self.verticalLayout.addWidget(self.pushButton_19) + self.pushButton_16 = QtWidgets.QPushButton(self.widget) + font = QtGui.QFont() + font.setPointSize(10) + self.pushButton_16.setFont(font) + self.pushButton_16.setIcon(icon1) + self.pushButton_16.setCheckable(True) + self.pushButton_16.setObjectName("pushButton_16") + self.verticalLayout.addWidget(self.pushButton_16) + self.widget_8 = QtWidgets.QWidget(self.widget) + self.widget_8.setMinimumSize(QtCore.QSize(203, 21)) + self.widget_8.setMaximumSize(QtCore.QSize(281, 21)) + self.widget_8.setObjectName("widget_8") + self.pushButton_14 = QtWidgets.QPushButton(self.widget_8, clicked=lambda: self.openCarbonEmissionWindow()) + self.pushButton_14.setGeometry(QtCore.QRect(20, 0, 183, 21)) + font = QtGui.QFont() + font.setPointSize(10) + font.setBold(False) + font.setWeight(50) + self.pushButton_14.setFont(font) + self.pushButton_14.setIcon(icon2) + self.pushButton_14.setObjectName("pushButton_14") + self.verticalLayout.addWidget(self.widget_8) + self.pushButton_17 = QtWidgets.QPushButton(self.widget, clicked=lambda: self.openBridgeTrafficWindow()) + font = QtGui.QFont() + font.setPointSize(10) + self.pushButton_17.setFont(font) + self.pushButton_17.setObjectName("pushButton_17") + self.verticalLayout.addWidget(self.pushButton_17) + self.pushButton_18 = QtWidgets.QPushButton(self.widget, clicked=lambda: self.openMaintenanceWindow()) + font = QtGui.QFont() + font.setPointSize(10) + self.pushButton_18.setFont(font) + self.pushButton_18.setObjectName("pushButton_18") + self.verticalLayout.addWidget(self.pushButton_18) + self.pushButton_10 = QtWidgets.QPushButton(self.widget, clicked=lambda: self.openDemolitionWindow()) + font = QtGui.QFont() + font.setPointSize(10) + self.pushButton_10.setFont(font) + self.pushButton_10.setObjectName("pushButton_10") + self.verticalLayout.addWidget(self.pushButton_10) + self.label_3 = QtWidgets.QLabel(self.scrollAreaWidgetContents) + self.label_3.setGeometry(QtCore.QRect(0, 387, 221, 31)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_3.setFont(font) + self.label_3.setStyleSheet("background-color: rgb(240,230,230)") + self.label_3.setAlignment(QtCore.Qt.AlignCenter) + self.label_3.setObjectName("label_3") + self.textBrowser = QtWidgets.QTextBrowser(self.scrollAreaWidgetContents) + self.textBrowser.setGeometry(QtCore.QRect(0, 418, 221, 221)) + self.textBrowser.setStyleSheet("background-color: #fff9f9") + self.textBrowser.setObjectName("textBrowser") + self.verticalScrollBar = QtWidgets.QScrollBar(self.scrollAreaWidgetContents) + self.verticalScrollBar.setGeometry(QtCore.QRect(220, 0, 16, 641)) + self.verticalScrollBar.setStyleSheet("background-color: #F0F0F0") + self.verticalScrollBar.setOrientation(QtCore.Qt.Vertical) + self.verticalScrollBar.setObjectName("verticalScrollBar") + self.widget.raise_() + self.label_2.raise_() + self.label_3.raise_() + self.textBrowser.raise_() + self.verticalScrollBar.raise_() + self.scrollArea.setWidget(self.scrollAreaWidgetContents) + + self.retranslateUi(Maintenance_Dialog) + self.buttonBox_2.accepted.connect(self.handle_save) # type: ignore + self.buttonBox_2.rejected.connect(lambda: self.show_warning(Maintenance_Dialog)) # type: ignore + self.pushButton_15.toggled['bool'].connect(self.widget_5.setVisible) # type: ignore + self.pushButton_16.toggled['bool'].connect(self.widget_8.setVisible) # type: ignore + QtCore.QMetaObject.connectSlotsByName(Maintenance_Dialog) + + def show_warning(self, dialog): + """ + Show a warning window when the Close button is pressed. + """ + warning_box = QMessageBox() + warning_box.setIcon(QMessageBox.Warning) + warning_box.setWindowTitle("Confirm Close") + warning_box.setText("Are you sure you want to close without saving?") + warning_box.setStandardButtons(QMessageBox.Yes | QMessageBox.No) + warning_box.setDefaultButton(QMessageBox.No) + + # Check the user's response + response = warning_box.exec_() + if response == QMessageBox.Yes: + dialog.reject() # Close the application + else: + pass # Do nothing, return to the dialog + + def retranslateUi(self, Maintenance_Dialog): + _translate = QtCore.QCoreApplication.translate + Maintenance_Dialog.setWindowTitle(_translate("Maintenance_Dialog", "Maintenance and Repair Data")) + self.pushButton_6.setText(_translate("Maintenance_Dialog", "Maintenance and Repair Data ")) + self.label_4.setText(_translate("Maintenance_Dialog", "Frequency of Routine Inspection")) + self.label_5.setText(_translate("Maintenance_Dialog", "Investment Ratio")) + self.label_6.setText(_translate("Maintenance_Dialog", "Interest Rate")) + self.label_7.setText(_translate("Maintenance_Dialog", "Duration of Study ")) + self.label_8.setText(_translate("Maintenance_Dialog", "Frequency of Periodic Maintenance")) + self.label_21.setText(_translate("Maintenance_Dialog", "(%)")) + self.label_22.setText(_translate("Maintenance_Dialog", "(%)")) + self.label_23.setText(_translate("Maintenance_Dialog", "(years)")) + self.label_24.setText(_translate("Maintenance_Dialog", "(years)")) + self.textBrowser_2.setHtml(_translate("Maintenance_Dialog", "\n" +"\n" +"

Periodic Maintenance Cost rate as percentage to total construction cost

")) + self.textBrowser_3.setHtml(_translate("Maintenance_Dialog", "\n" +"\n" +"

Annual Routine Inspection cost rate as percentage of total construction cost

")) + self.textBrowser_4.setHtml(_translate("Maintenance_Dialog", "\n" +"\n" +"

Repair and Rehabilitation cost rate as
percentage of total construction cost

")) + self.label_25.setText(_translate("Maintenance_Dialog", "(%)")) + self.pushButton.setText(_translate("Maintenance_Dialog", "Project Details Window ")) + self.label_2.setText(_translate("Maintenance_Dialog", "Input Parameters")) + self.pushButton_15.setText(_translate("Maintenance_Dialog", "Structure Works Data")) + self.pushButton_20.setText(_translate("Maintenance_Dialog", "Foundation")) + self.pushButton_21.setText(_translate("Maintenance_Dialog", "Super-Structure")) + self.pushButton_22.setText(_translate("Maintenance_Dialog", "Sub-Structure")) + self.pushButton_23.setText(_translate("Maintenance_Dialog", "Miscellaneous")) + self.pushButton_19.setText(_translate("Maintenance_Dialog", "Financial Data")) + self.pushButton_16.setText(_translate("Maintenance_Dialog", "Carbon Emission Data")) + self.pushButton_14.setText(_translate("Maintenance_Dialog", "Carbon Emission Cost Data")) + self.pushButton_17.setText(_translate("Maintenance_Dialog", "Bridge and Traffic Data")) + self.pushButton_18.setText(_translate("Maintenance_Dialog", "Maintenance and Repair")) + self.pushButton_10.setText(_translate("Maintenance_Dialog", "Disposal and Recycling")) + self.label_3.setText(_translate("Maintenance_Dialog", "Output")) + self.textBrowser.setHtml(_translate("Maintenance_Dialog", "\n" +"\n" +"

Initial Construction Cost

\n" +"

Initial Carbon emission Cost

\n" +"

Time Cost

\n" +"

Road User Cost

\n" +"

Carbon Emission due to Re-Routing

\n" +"

Periodic Maintenance Costs

\n" +"

Maintenance Emission Costs

\n" +"

Routine Inspectection Costs

\n" +"

Repair & Rehabilitation Costs

\n" +"

Reconstruction Costs

\n" +"

Demolition & Disposal Cost

\n" +"

Recycling Cost

\n" +"

Total Life-Cycle Cost

")) + + def validate_data(self): + """Validate input data before saving""" + try: + # Validate all numeric fields + float(self.lineEdit_5.text()) if self.lineEdit_5.text() else 0 # Periodic Maintenance Cost Rate + float(self.lineEdit_7.text()) if self.lineEdit_7.text() else 0 # Annual Routine Inspection Cost Rate + float(self.lineEdit_8.text()) if self.lineEdit_8.text() else 0 # Repair Rehabilitation Cost Rate + float(self.lineEdit_9.text()) if self.lineEdit_9.text() else 0 # Frequency of Periodic Maintenance + float(self.lineEdit_10.text()) if self.lineEdit_10.text() else 0 # Frequency of Routine Inspection + return True + + except ValueError: + QMessageBox.warning( + None, + "Validation Error", + "Please enter valid numbers in all numeric fields", + QMessageBox.Ok + ) + return False + + def save_data(self): + """Collect all input data and save it to a JSON file""" + if not self.validate_data(): + return False + + data = { + "periodic_maintenance": { + "cost_rate": self.lineEdit_5.text(), + "description": "Periodic Maintenance Cost rate as percentage to total construction cost" + }, + "routine_inspection": { + "cost_rate": self.lineEdit_7.text(), + "frequency": self.lineEdit_10.text(), + "description": "Annual Routine Inspection cost rate as percentage of total construction cost" + }, + "repair_rehabilitation": { + "cost_rate": self.lineEdit_8.text(), + "description": "Repair and Rehabilitation cost rate as percentage of total construction cost" + }, + "periodic_maintenance_frequency": self.lineEdit_9.text(), + "financial_parameters": { + "interest_rate": self.label_6.text().replace("(%)", "").strip(), + "investment_ratio": self.label_5.text().replace("(%)", "").strip(), + "study_duration": self.label_7.text().replace("(years)", "").strip() + } + } + + # Save to JSON file + try: + import json + from datetime import datetime + timestamp = datetime.now().strftime("%Y%m%d_%H%M%S") + filename = f"maintenance_data_{timestamp}.json" + + with open(filename, 'w') as f: + json.dump(data, f, indent=4) + + # Show success message + QMessageBox.information( + None, + "Success", + f"Maintenance data saved successfully to {filename}", + QMessageBox.Ok + ) + + return True + + except Exception as e: + QMessageBox.critical( + None, + "Error", + f"Failed to save data: {str(e)}", + QMessageBox.Ok + ) + return False + + def handle_save(self): + """Handle the save operation and close the dialog if successful""" + if self.save_data(): # Only close if save was successful + Maintenance_Dialog.accept() + +if __name__ == "__main__": + import sys + app = QtWidgets.QApplication(sys.argv) + Maintenance_Dialog = QtWidgets.QDialog() + ui = Ui_Maintenance_Dialog() + ui.setupUi(Maintenance_Dialog) + Maintenance_Dialog.show() + sys.exit(app.exec_()) diff --git a/src/osbridgelcca/desktop_app/ui/project_details_windows/ProjectDetails_Miscellaneous_Window.py b/src/osbridgelcca/desktop_app/ui/project_details_windows/ProjectDetails_Miscellaneous_Window.py new file mode 100644 index 0000000..cfe53e2 --- /dev/null +++ b/src/osbridgelcca/desktop_app/ui/project_details_windows/ProjectDetails_Miscellaneous_Window.py @@ -0,0 +1,743 @@ +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file 'C:\Users\saans\AppData\Local\Programs\Python\Python310\Lib\site-packages\qt5_applications\Qt\bin\ProjectDetails_Miscellaneous_Window.ui' +# +# Created by: PyQt5 UI code generator 5.15.9 +# +# WARNING: Any manual changes made to this file will be lost when pyuic5 is +# run again. Do not edit this file unless you know what you are doing. + + +from PyQt5 import QtCore, QtGui, QtWidgets +from PyQt5.QtWidgets import QMessageBox + + + + + + +#from ProjectDetails_Miscellaneous_Window import Ui_Miscellaneous_Dialog + + + + +class Ui_Miscellaneous_Dialog(object): + def openBridgeTrafficWindow(self): + from ProjectDetails_BridgeANDTrafficData_Window import Ui_BridgeTraffic_Dialog + self.window = QtWidgets.QDialog() + self.ui = Ui_BridgeTraffic_Dialog() + self.ui.setupUi(self.window) + self.window.show() + + def openFoundationWindow(self): + from ProjectDetails_Foundation_Window import Ui_Foundation_Dialog + self.window = QtWidgets.QDialog() + self.ui = Ui_Foundation_Dialog() + self.ui.setupUi(self.window) + self.window.show() + + def openCarbonEmissionWindow(self): + from ProjectDetails_CarbonEmissionData_Window import Ui_CarbonEmission_Dialog + self.window = QtWidgets.QDialog() + self.ui = Ui_CarbonEmission_Dialog() + self.ui.setupUi(self.window) + self.window.show() + + def openDemolitionWindow(self): + from ProjectDetails_DemolitionANDRecyclingData_Window import Ui_Demolition_Dialog + self.window = QtWidgets.QDialog() + self.ui = Ui_Demolition_Dialog() + self.ui.setupUi(self.window) + self.window.show() + + def openFinancialWindow(self): + from ProjectDetails_FinancialData_Window import Ui_FinancialData_Dialog + self.window = QtWidgets.QDialog() + self.ui = Ui_FinancialData_Dialog() + self.ui.setupUi(self.window) + self.window.show() + + def openMaintenanceWindow(self): + from ProjectDetails_MaintenanceANDRepairData_Window import Ui_Maintenance_Dialog + self.window = QtWidgets.QDialog() + self.ui = Ui_Maintenance_Dialog() + self.ui.setupUi(self.window) + self.window.show() + + def openMiscellaneousWindow(self): + self.window = QtWidgets.QDialog() + self.ui = Ui_Miscellaneous_Dialog() + self.ui.setupUi(self.window) + self.window.show() + + def openSubStructureWindow(self): + from ProjectDetails_SubStructure_Window import Ui_SubStructure_Dialog + self.window = QtWidgets.QDialog() + self.ui = Ui_SubStructure_Dialog() + self.ui.setupUi(self.window) + self.window.show() + + def openSuperStructureWindow(self): + from ProjectDetails_SuperStructure_Window import Ui_SuperStructure_Dialog + self.window = QtWidgets.QDialog() + self.ui = Ui_SuperStructure_Dialog() + self.ui.setupUi(self.window) + self.window.show() + + def setupUi(self, Miscellaneous_Dialog): + Miscellaneous_Dialog.setObjectName("Miscellaneous_Dialog") + Miscellaneous_Dialog.resize(1440, 900) + Miscellaneous_Dialog.setStyleSheet("background-color:#FAFAFA") + self.pushButton = QtWidgets.QPushButton(Miscellaneous_Dialog) + self.pushButton.setGeometry(QtCore.QRect(10, 10, 188, 25)) + font = QtGui.QFont() + font.setPointSize(10) + self.pushButton.setFont(font) + self.pushButton.setFocusPolicy(QtCore.Qt.StrongFocus) + self.pushButton.setLayoutDirection(QtCore.Qt.RightToLeft) + self.pushButton.setStyleSheet("background-color: rgb(240,230,230)") + icon = QtGui.QIcon() + icon.addPixmap(QtGui.QPixmap("C:\\Users\\saans\\AppData\\Local\\Programs\\Python\\Python310\\Lib\\site-packages\\qt5_applications\\Qt\\bin\\../../../../../../../../../../Downloads/Dismiss.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) + self.pushButton.setIcon(icon) + self.pushButton.setAutoRepeat(False) + self.pushButton.setObjectName("pushButton") + self.widget_2 = QtWidgets.QWidget(Miscellaneous_Dialog) + self.widget_2.setGeometry(QtCore.QRect(350, 35, 778, 624)) + self.widget_2.setStyleSheet("background-color: #fff9f9") + self.widget_2.setObjectName("widget_2") + self.label_38 = QtWidgets.QLabel(self.widget_2) + self.label_38.setGeometry(QtCore.QRect(20, 10, 91, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_38.setFont(font) + self.label_38.setObjectName("label_38") + self.comboBox_13 = QtWidgets.QComboBox(self.widget_2) + self.comboBox_13.setGeometry(QtCore.QRect(140, 10, 190, 22)) + font = QtGui.QFont() + font.setPointSize(10) + self.comboBox_13.setFont(font) + self.comboBox_13.setStyleSheet("background-color: #ffffff") + self.comboBox_13.setObjectName("comboBox_13") + self.comboBox_13.addItem("") + self.pushButton_10 = QtWidgets.QPushButton(self.widget_2) + self.pushButton_10.setGeometry(QtCore.QRect(350, 10, 190, 23)) + self.pushButton_10.setStyleSheet("background-color: #ffffff") + self.pushButton_10.setObjectName("pushButton_10") + self.label_39 = QtWidgets.QLabel(self.widget_2) + self.label_39.setGeometry(QtCore.QRect(20, 70, 161, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_39.setFont(font) + self.label_39.setAlignment(QtCore.Qt.AlignCenter) + self.label_39.setObjectName("label_39") + self.label_40 = QtWidgets.QLabel(self.widget_2) + self.label_40.setGeometry(QtCore.QRect(551, 70, 140, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_40.setFont(font) + self.label_40.setAlignment(QtCore.Qt.AlignCenter) + self.label_40.setObjectName("label_40") + self.label_41 = QtWidgets.QLabel(self.widget_2) + self.label_41.setGeometry(QtCore.QRect(191, 70, 110, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_41.setFont(font) + self.label_41.setAlignment(QtCore.Qt.AlignCenter) + self.label_41.setObjectName("label_41") + self.label_42 = QtWidgets.QLabel(self.widget_2) + self.label_42.setGeometry(QtCore.QRect(311, 70, 110, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_42.setFont(font) + self.label_42.setAlignment(QtCore.Qt.AlignCenter) + self.label_42.setObjectName("label_42") + self.label_43 = QtWidgets.QLabel(self.widget_2) + self.label_43.setGeometry(QtCore.QRect(431, 70, 110, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_43.setFont(font) + self.label_43.setAlignment(QtCore.Qt.AlignCenter) + self.label_43.setObjectName("label_43") + self.comboBox_14 = QtWidgets.QComboBox(self.widget_2) + self.comboBox_14.setGeometry(QtCore.QRect(30, 100, 140, 22)) + self.comboBox_14.setStyleSheet("background-color: #ffffff") + self.comboBox_14.setObjectName("comboBox_14") + self.comboBox_15 = QtWidgets.QComboBox(self.widget_2) + self.comboBox_15.setGeometry(QtCore.QRect(30, 130, 140, 22)) + self.comboBox_15.setStyleSheet("background-color: #ffffff") + self.comboBox_15.setObjectName("comboBox_15") + self.lineEdit_25 = QtWidgets.QLineEdit(self.widget_2) + self.lineEdit_25.setGeometry(QtCore.QRect(210, 100, 81, 20)) + font = QtGui.QFont() + font.setPointSize(10) + self.lineEdit_25.setFont(font) + self.lineEdit_25.setStyleSheet("background-color: #ffffff") + self.lineEdit_25.setObjectName("lineEdit_25") + self.lineEdit_26 = QtWidgets.QLineEdit(self.widget_2) + self.lineEdit_26.setGeometry(QtCore.QRect(210, 130, 81, 20)) + font = QtGui.QFont() + font.setPointSize(10) + self.lineEdit_26.setFont(font) + self.lineEdit_26.setStyleSheet("background-color: #ffffff") + self.lineEdit_26.setObjectName("lineEdit_26") + self.label_44 = QtWidgets.QLabel(self.widget_2) + self.label_44.setGeometry(QtCore.QRect(340, 100, 51, 20)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_44.setFont(font) + self.label_44.setStyleSheet("background-color: #ffffff") + self.label_44.setAlignment(QtCore.Qt.AlignCenter) + self.label_44.setObjectName("label_44") + self.label_45 = QtWidgets.QLabel(self.widget_2) + self.label_45.setGeometry(QtCore.QRect(340, 130, 51, 20)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_45.setFont(font) + self.label_45.setStyleSheet("background-color: #ffffff") + self.label_45.setAlignment(QtCore.Qt.AlignCenter) + self.label_45.setObjectName("label_45") + self.lineEdit_27 = QtWidgets.QLineEdit(self.widget_2) + self.lineEdit_27.setGeometry(QtCore.QRect(450, 100, 81, 20)) + font = QtGui.QFont() + font.setPointSize(10) + self.lineEdit_27.setFont(font) + self.lineEdit_27.setStyleSheet("background-color: #ffffff") + self.lineEdit_27.setObjectName("lineEdit_27") + self.lineEdit_28 = QtWidgets.QLineEdit(self.widget_2) + self.lineEdit_28.setGeometry(QtCore.QRect(450, 130, 81, 20)) + font = QtGui.QFont() + font.setPointSize(10) + self.lineEdit_28.setFont(font) + self.lineEdit_28.setStyleSheet("background-color: #ffffff") + self.lineEdit_28.setObjectName("lineEdit_28") + self.lineEdit_29 = QtWidgets.QLineEdit(self.widget_2) + self.lineEdit_29.setGeometry(QtCore.QRect(570, 100, 101, 20)) + font = QtGui.QFont() + font.setPointSize(10) + self.lineEdit_29.setFont(font) + self.lineEdit_29.setStyleSheet("background-color: #ffffff") + self.lineEdit_29.setObjectName("lineEdit_29") + self.lineEdit_30 = QtWidgets.QLineEdit(self.widget_2) + self.lineEdit_30.setGeometry(QtCore.QRect(570, 130, 101, 20)) + font = QtGui.QFont() + font.setPointSize(10) + self.lineEdit_30.setFont(font) + self.lineEdit_30.setStyleSheet("background-color: #ffffff") + self.lineEdit_30.setObjectName("lineEdit_30") + self.pushButton_13 = QtWidgets.QPushButton(self.widget_2) + self.pushButton_13.setGeometry(QtCore.QRect(300, 200, 190, 23)) + self.pushButton_13.setStyleSheet("background-color: #ffffff") + self.pushButton_13.setObjectName("pushButton_13") + self.label_46 = QtWidgets.QLabel(self.widget_2) + self.label_46.setGeometry(QtCore.QRect(30, 330, 161, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_46.setFont(font) + self.label_46.setAlignment(QtCore.Qt.AlignCenter) + self.label_46.setObjectName("label_46") + self.comboBox_16 = QtWidgets.QComboBox(self.widget_2) + self.comboBox_16.setGeometry(QtCore.QRect(150, 270, 190, 22)) + font = QtGui.QFont() + font.setPointSize(10) + self.comboBox_16.setFont(font) + self.comboBox_16.setStyleSheet("background-color: #ffffff") + self.comboBox_16.setObjectName("comboBox_16") + self.comboBox_16.addItem("") + self.label_47 = QtWidgets.QLabel(self.widget_2) + self.label_47.setGeometry(QtCore.QRect(441, 330, 110, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_47.setFont(font) + self.label_47.setAlignment(QtCore.Qt.AlignCenter) + self.label_47.setObjectName("label_47") + self.label_48 = QtWidgets.QLabel(self.widget_2) + self.label_48.setGeometry(QtCore.QRect(350, 390, 51, 20)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_48.setFont(font) + self.label_48.setStyleSheet("background-color: #ffffff") + self.label_48.setAlignment(QtCore.Qt.AlignCenter) + self.label_48.setObjectName("label_48") + self.label_49 = QtWidgets.QLabel(self.widget_2) + self.label_49.setGeometry(QtCore.QRect(561, 330, 140, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_49.setFont(font) + self.label_49.setAlignment(QtCore.Qt.AlignCenter) + self.label_49.setObjectName("label_49") + self.label_50 = QtWidgets.QLabel(self.widget_2) + self.label_50.setGeometry(QtCore.QRect(350, 360, 51, 20)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_50.setFont(font) + self.label_50.setStyleSheet("background-color: #ffffff") + self.label_50.setAlignment(QtCore.Qt.AlignCenter) + self.label_50.setObjectName("label_50") + self.label_51 = QtWidgets.QLabel(self.widget_2) + self.label_51.setGeometry(QtCore.QRect(321, 330, 110, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_51.setFont(font) + self.label_51.setAlignment(QtCore.Qt.AlignCenter) + self.label_51.setObjectName("label_51") + self.lineEdit_31 = QtWidgets.QLineEdit(self.widget_2) + self.lineEdit_31.setGeometry(QtCore.QRect(220, 390, 81, 20)) + font = QtGui.QFont() + font.setPointSize(10) + self.lineEdit_31.setFont(font) + self.lineEdit_31.setStyleSheet("background-color: #ffffff") + self.lineEdit_31.setObjectName("lineEdit_31") + self.lineEdit_32 = QtWidgets.QLineEdit(self.widget_2) + self.lineEdit_32.setGeometry(QtCore.QRect(580, 360, 101, 20)) + font = QtGui.QFont() + font.setPointSize(10) + self.lineEdit_32.setFont(font) + self.lineEdit_32.setStyleSheet("background-color: #ffffff") + self.lineEdit_32.setObjectName("lineEdit_32") + self.label_52 = QtWidgets.QLabel(self.widget_2) + self.label_52.setGeometry(QtCore.QRect(201, 330, 110, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_52.setFont(font) + self.label_52.setAlignment(QtCore.Qt.AlignCenter) + self.label_52.setObjectName("label_52") + self.pushButton_14 = QtWidgets.QPushButton(self.widget_2) + self.pushButton_14.setGeometry(QtCore.QRect(310, 460, 190, 23)) + self.pushButton_14.setStyleSheet("background-color: #ffffff") + self.pushButton_14.setObjectName("pushButton_14") + self.lineEdit_33 = QtWidgets.QLineEdit(self.widget_2) + self.lineEdit_33.setGeometry(QtCore.QRect(220, 360, 81, 20)) + font = QtGui.QFont() + font.setPointSize(10) + self.lineEdit_33.setFont(font) + self.lineEdit_33.setStyleSheet("background-color: #ffffff") + self.lineEdit_33.setObjectName("lineEdit_33") + self.lineEdit_34 = QtWidgets.QLineEdit(self.widget_2) + self.lineEdit_34.setGeometry(QtCore.QRect(460, 360, 81, 20)) + font = QtGui.QFont() + font.setPointSize(10) + self.lineEdit_34.setFont(font) + self.lineEdit_34.setStyleSheet("background-color: #ffffff") + self.lineEdit_34.setObjectName("lineEdit_34") + self.lineEdit_35 = QtWidgets.QLineEdit(self.widget_2) + self.lineEdit_35.setGeometry(QtCore.QRect(460, 390, 81, 20)) + font = QtGui.QFont() + font.setPointSize(10) + self.lineEdit_35.setFont(font) + self.lineEdit_35.setStyleSheet("background-color: #ffffff") + self.lineEdit_35.setObjectName("lineEdit_35") + self.pushButton_15 = QtWidgets.QPushButton(self.widget_2) + self.pushButton_15.setGeometry(QtCore.QRect(360, 270, 190, 23)) + self.pushButton_15.setStyleSheet("background-color: #ffffff") + self.pushButton_15.setObjectName("pushButton_15") + self.label_53 = QtWidgets.QLabel(self.widget_2) + self.label_53.setGeometry(QtCore.QRect(30, 270, 91, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_53.setFont(font) + self.label_53.setObjectName("label_53") + self.lineEdit_36 = QtWidgets.QLineEdit(self.widget_2) + self.lineEdit_36.setGeometry(QtCore.QRect(580, 390, 101, 20)) + font = QtGui.QFont() + font.setPointSize(10) + self.lineEdit_36.setFont(font) + self.lineEdit_36.setStyleSheet("background-color: #ffffff") + self.lineEdit_36.setObjectName("lineEdit_36") + self.comboBox_17 = QtWidgets.QComboBox(self.widget_2) + self.comboBox_17.setGeometry(QtCore.QRect(40, 360, 140, 22)) + self.comboBox_17.setStyleSheet("background-color: #ffffff") + self.comboBox_17.setObjectName("comboBox_17") + self.comboBox_17.addItem("") + self.comboBox_17.addItem("") + self.comboBox_18 = QtWidgets.QComboBox(self.widget_2) + self.comboBox_18.setGeometry(QtCore.QRect(40, 390, 140, 22)) + self.comboBox_18.setStyleSheet("background-color: #ffffff") + self.comboBox_18.setObjectName("comboBox_18") + self.comboBox_18.addItem("") + self.comboBox_18.addItem("") + self.line_5 = QtWidgets.QFrame(self.widget_2) + self.line_5.setGeometry(QtCore.QRect(10, 250, 761, 16)) + self.line_5.setContextMenuPolicy(QtCore.Qt.DefaultContextMenu) + self.line_5.setFrameShadow(QtWidgets.QFrame.Sunken) + self.line_5.setLineWidth(2) + self.line_5.setMidLineWidth(2) + self.line_5.setFrameShape(QtWidgets.QFrame.HLine) + self.line_5.setObjectName("line_5") + self.line_6 = QtWidgets.QFrame(self.widget_2) + self.line_6.setGeometry(QtCore.QRect(10, 500, 761, 16)) + self.line_6.setContextMenuPolicy(QtCore.Qt.DefaultContextMenu) + self.line_6.setFrameShadow(QtWidgets.QFrame.Sunken) + self.line_6.setLineWidth(2) + self.line_6.setMidLineWidth(2) + self.line_6.setFrameShape(QtWidgets.QFrame.HLine) + self.line_6.setObjectName("line_6") + self.buttonBox = QtWidgets.QDialogButtonBox(self.widget_2) + self.buttonBox.setGeometry(QtCore.QRect(430, 590, 341, 32)) + self.buttonBox.setOrientation(QtCore.Qt.Horizontal) + self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Close|QtWidgets.QDialogButtonBox.Save) + self.buttonBox.setObjectName("buttonBox") + self.label = QtWidgets.QLabel(Miscellaneous_Dialog) + self.label.setGeometry(QtCore.QRect(10, 35, 244, 691)) + font = QtGui.QFont() + font.setPointSize(10) + self.label.setFont(font) + self.label.setStyleSheet("background-color: rgb(240,230,230)") + self.label.setText("") + self.label.setObjectName("label") + self.pushButton_6 = QtWidgets.QPushButton(Miscellaneous_Dialog) + self.pushButton_6.setGeometry(QtCore.QRect(350, 10, 188, 25)) + font = QtGui.QFont() + font.setPointSize(10) + font.setBold(True) + font.setWeight(75) + self.pushButton_6.setFont(font) + self.pushButton_6.setFocusPolicy(QtCore.Qt.StrongFocus) + self.pushButton_6.setLayoutDirection(QtCore.Qt.RightToLeft) + self.pushButton_6.setStyleSheet("background-color: rgb(240,230,230)") + self.pushButton_6.setIcon(icon) + self.pushButton_6.setAutoRepeat(False) + self.pushButton_6.setObjectName("pushButton_6") + self.scrollArea = QtWidgets.QScrollArea(Miscellaneous_Dialog) + self.scrollArea.setGeometry(QtCore.QRect(10, 40, 241, 681)) + self.scrollArea.setAutoFillBackground(False) + self.scrollArea.setStyleSheet("background-color: #fff9f9") + self.scrollArea.setWidgetResizable(True) + self.scrollArea.setObjectName("scrollArea") + self.scrollAreaWidgetContents_3 = QtWidgets.QWidget() + self.scrollAreaWidgetContents_3.setGeometry(QtCore.QRect(0, 0, 239, 679)) + self.scrollAreaWidgetContents_3.setObjectName("scrollAreaWidgetContents_3") + self.label_54 = QtWidgets.QLabel(self.scrollAreaWidgetContents_3) + self.label_54.setGeometry(QtCore.QRect(0, 0, 221, 31)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_54.setFont(font) + self.label_54.setStyleSheet("background-color: rgb(240,230,230)") + self.label_54.setAlignment(QtCore.Qt.AlignCenter) + self.label_54.setObjectName("label_54") + self.widget_4 = QtWidgets.QWidget(self.scrollAreaWidgetContents_3) + self.widget_4.setGeometry(QtCore.QRect(0, 30, 221, 357)) + self.widget_4.setStyleSheet("background-color: #fff9f9") + self.widget_4.setObjectName("widget_4") + self.verticalLayout_3 = QtWidgets.QVBoxLayout(self.widget_4) + self.verticalLayout_3.setContentsMargins(0, 0, 0, 0) + self.verticalLayout_3.setObjectName("verticalLayout_3") + self.pushButton_34 = QtWidgets.QPushButton(self.widget_4) + font = QtGui.QFont() + font.setPointSize(10) + self.pushButton_34.setFont(font) + icon1 = QtGui.QIcon() + icon1.addPixmap(QtGui.QPixmap("C:\\Users\\saans\\AppData\\Local\\Programs\\Python\\Python310\\Lib\\site-packages\\qt5_applications\\Qt\\bin\\../../../../../../../../../../Downloads/play_arrow_filled.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) + icon1.addPixmap(QtGui.QPixmap("C:\\Users\\saans\\AppData\\Local\\Programs\\Python\\Python310\\Lib\\site-packages\\qt5_applications\\Qt\\bin\\../../../../../../../../../../Downloads/play_arrow_filled (1).png"), QtGui.QIcon.Normal, QtGui.QIcon.On) + self.pushButton_34.setIcon(icon1) + self.pushButton_34.setCheckable(True) + self.pushButton_34.setAutoDefault(True) + self.pushButton_34.setObjectName("pushButton_34") + self.verticalLayout_3.addWidget(self.pushButton_34) + self.widget_7 = QtWidgets.QWidget(self.widget_4) + self.widget_7.setObjectName("widget_7") + self.formLayout_3 = QtWidgets.QFormLayout(self.widget_7) + self.formLayout_3.setObjectName("formLayout_3") + self.pushButton_35 = QtWidgets.QPushButton(self.widget_7, clicked=lambda: self.openFoundationWindow()) + font = QtGui.QFont() + font.setPointSize(10) + font.setBold(False) + font.setWeight(50) + self.pushButton_35.setFont(font) + icon2 = QtGui.QIcon() + icon2.addPixmap(QtGui.QPixmap("C:\\Users\\saans\\AppData\\Local\\Programs\\Python\\Python310\\Lib\\site-packages\\qt5_applications\\Qt\\bin\\../../../../../../../../../../Downloads/play_arrow_filled.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) + self.pushButton_35.setIcon(icon2) + self.pushButton_35.setObjectName("pushButton_35") + self.formLayout_3.setWidget(0, QtWidgets.QFormLayout.LabelRole, self.pushButton_35) + self.pushButton_36 = QtWidgets.QPushButton(self.widget_7, clicked=lambda: self.openSuperStructureWindow()) + font = QtGui.QFont() + font.setPointSize(10) + font.setBold(False) + font.setWeight(50) + self.pushButton_36.setFont(font) + self.pushButton_36.setIcon(icon2) + self.pushButton_36.setObjectName("pushButton_36") + self.formLayout_3.setWidget(1, QtWidgets.QFormLayout.LabelRole, self.pushButton_36) + self.pushButton_37 = QtWidgets.QPushButton(self.widget_7, clicked=lambda: self.openSubStructureWindow()) + font = QtGui.QFont() + font.setPointSize(10) + font.setBold(False) + font.setWeight(50) + self.pushButton_37.setFont(font) + self.pushButton_37.setIcon(icon2) + self.pushButton_37.setObjectName("pushButton_37") + self.formLayout_3.setWidget(2, QtWidgets.QFormLayout.LabelRole, self.pushButton_37) + self.pushButton_38 = QtWidgets.QPushButton(self.widget_7, clicked=lambda: self.openMiscellaneousWindow()) + font = QtGui.QFont() + font.setPointSize(10) + font.setBold(False) + font.setWeight(50) + self.pushButton_38.setFont(font) + self.pushButton_38.setIcon(icon2) + self.pushButton_38.setObjectName("pushButton_38") + self.formLayout_3.setWidget(3, QtWidgets.QFormLayout.LabelRole, self.pushButton_38) + self.verticalLayout_3.addWidget(self.widget_7) + self.pushButton_39 = QtWidgets.QPushButton(self.widget_4, clicked=lambda: self.openFinancialWindow()) + font = QtGui.QFont() + font.setPointSize(10) + self.pushButton_39.setFont(font) + self.pushButton_39.setObjectName("pushButton_39") + self.verticalLayout_3.addWidget(self.pushButton_39) + self.pushButton_40 = QtWidgets.QPushButton(self.widget_4) + font = QtGui.QFont() + font.setPointSize(10) + self.pushButton_40.setFont(font) + self.pushButton_40.setIcon(icon1) + self.pushButton_40.setCheckable(True) + self.pushButton_40.setObjectName("pushButton_40") + self.verticalLayout_3.addWidget(self.pushButton_40) + self.widget_10 = QtWidgets.QWidget(self.widget_4) + self.widget_10.setMinimumSize(QtCore.QSize(203, 21)) + self.widget_10.setMaximumSize(QtCore.QSize(281, 21)) + self.widget_10.setObjectName("widget_10") + self.pushButton_41 = QtWidgets.QPushButton(self.widget_10, clicked=lambda: self.openCarbonEmissionWindow()) + self.pushButton_41.setGeometry(QtCore.QRect(20, 0, 183, 21)) + font = QtGui.QFont() + font.setPointSize(10) + font.setBold(False) + font.setWeight(50) + self.pushButton_41.setFont(font) + self.pushButton_41.setIcon(icon2) + self.pushButton_41.setObjectName("pushButton_41") + self.verticalLayout_3.addWidget(self.widget_10) + self.pushButton_42 = QtWidgets.QPushButton(self.widget_4, clicked=lambda: self.openBridgeTrafficWindow()) + font = QtGui.QFont() + font.setPointSize(10) + self.pushButton_42.setFont(font) + self.pushButton_42.setObjectName("pushButton_42") + self.verticalLayout_3.addWidget(self.pushButton_42) + self.pushButton_43 = QtWidgets.QPushButton(self.widget_4, clicked=lambda: self.openMaintenanceWindow()) + font = QtGui.QFont() + font.setPointSize(10) + self.pushButton_43.setFont(font) + self.pushButton_43.setObjectName("pushButton_43") + self.verticalLayout_3.addWidget(self.pushButton_43) + self.pushButton_16 = QtWidgets.QPushButton(self.widget_4, clicked=lambda: self.openDemolitionWindow()) + font = QtGui.QFont() + font.setPointSize(10) + self.pushButton_16.setFont(font) + self.pushButton_16.setObjectName("pushButton_16") + self.verticalLayout_3.addWidget(self.pushButton_16) + self.label_55 = QtWidgets.QLabel(self.scrollAreaWidgetContents_3) + self.label_55.setGeometry(QtCore.QRect(0, 387, 221, 31)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_55.setFont(font) + self.label_55.setStyleSheet("background-color: rgb(240,230,230)") + self.label_55.setAlignment(QtCore.Qt.AlignCenter) + self.label_55.setObjectName("label_55") + self.textBrowser_3 = QtWidgets.QTextBrowser(self.scrollAreaWidgetContents_3) + self.textBrowser_3.setGeometry(QtCore.QRect(0, 418, 221, 221)) + self.textBrowser_3.setStyleSheet("background-color: #fff9f9") + self.textBrowser_3.setObjectName("textBrowser_3") + self.verticalScrollBar_3 = QtWidgets.QScrollBar(self.scrollAreaWidgetContents_3) + self.verticalScrollBar_3.setGeometry(QtCore.QRect(220, 0, 16, 641)) + self.verticalScrollBar_3.setStyleSheet("background-color: #F0F0F0") + self.verticalScrollBar_3.setOrientation(QtCore.Qt.Vertical) + self.verticalScrollBar_3.setObjectName("verticalScrollBar_3") + self.scrollArea.setWidget(self.scrollAreaWidgetContents_3) + + self.retranslateUi(Miscellaneous_Dialog) + self.buttonBox.accepted.connect(self.handle_save) # type: ignore + self.buttonBox.rejected.connect(lambda: self.show_warning(Miscellaneous_Dialog)) # type: ignore + QtCore.QMetaObject.connectSlotsByName(Miscellaneous_Dialog) + + def show_warning(self, dialog): + """ + Show a warning window when the Close button is pressed. + """ + warning_box = QMessageBox() + warning_box.setIcon(QMessageBox.Warning) + warning_box.setWindowTitle("Confirm Close") + warning_box.setText("Are you sure you want to close without saving?") + warning_box.setStandardButtons(QMessageBox.Yes | QMessageBox.No) + warning_box.setDefaultButton(QMessageBox.No) + + # Check the user's response + response = warning_box.exec_() + if response == QMessageBox.Yes: + dialog.reject() # Close the application + else: + pass # Do nothing, return to the dialog + + def retranslateUi(self, Miscellaneous_Dialog): + _translate = QtCore.QCoreApplication.translate + Miscellaneous_Dialog.setWindowTitle(_translate("Miscellaneous_Dialog", "Dialog")) + self.pushButton.setText(_translate("Miscellaneous_Dialog", "Project Details Window ")) + self.label_38.setText(_translate("Miscellaneous_Dialog", "Components:")) + self.comboBox_13.setItemText(0, _translate("Miscellaneous_Dialog", "Expansion Joint")) + self.pushButton_10.setText(_translate("Miscellaneous_Dialog", "+ Add Sub-Component")) + self.label_39.setText(_translate("Miscellaneous_Dialog", "Material Type and Grade")) + self.label_40.setText(_translate("Miscellaneous_Dialog", "Rate Data Source")) + self.label_41.setText(_translate("Miscellaneous_Dialog", "Quantity")) + self.label_42.setText(_translate("Miscellaneous_Dialog", "Unit")) + self.label_43.setText(_translate("Miscellaneous_Dialog", "Rate")) + self.label_44.setText(_translate("Miscellaneous_Dialog", "

m3

")) + self.label_45.setText(_translate("Miscellaneous_Dialog", "kg")) + self.pushButton_13.setText(_translate("Miscellaneous_Dialog", "+ Add Material")) + self.label_46.setText(_translate("Miscellaneous_Dialog", "Material Type and Grade")) + self.comboBox_16.setItemText(0, _translate("Miscellaneous_Dialog", "Bearing")) + self.label_47.setText(_translate("Miscellaneous_Dialog", "Rate")) + self.label_48.setText(_translate("Miscellaneous_Dialog", "kg")) + self.label_49.setText(_translate("Miscellaneous_Dialog", "Rate Data Source")) + self.label_50.setText(_translate("Miscellaneous_Dialog", "

m3

")) + self.label_51.setText(_translate("Miscellaneous_Dialog", "Unit")) + self.label_52.setText(_translate("Miscellaneous_Dialog", "Quantity")) + self.pushButton_14.setText(_translate("Miscellaneous_Dialog", "+ Add Material")) + self.pushButton_15.setText(_translate("Miscellaneous_Dialog", "+ Add Sub-Component")) + self.label_53.setText(_translate("Miscellaneous_Dialog", "Components:")) + self.comboBox_17.setItemText(0, _translate("Miscellaneous_Dialog", "Concrete")) + self.comboBox_17.setItemText(1, _translate("Miscellaneous_Dialog", "Steel")) + self.comboBox_18.setItemText(0, _translate("Miscellaneous_Dialog", "Steel")) + self.comboBox_18.setItemText(1, _translate("Miscellaneous_Dialog", "Concrete")) + self.pushButton_6.setText(_translate("Miscellaneous_Dialog", "Miscellaneous ")) + self.label_54.setText(_translate("Miscellaneous_Dialog", "Input Parameters")) + self.pushButton_34.setText(_translate("Miscellaneous_Dialog", "Structure Works Data")) + self.pushButton_35.setText(_translate("Miscellaneous_Dialog", "Foundation")) + self.pushButton_36.setText(_translate("Miscellaneous_Dialog", "Super-Structure")) + self.pushButton_37.setText(_translate("Miscellaneous_Dialog", "Sub-Structure")) + self.pushButton_38.setText(_translate("Miscellaneous_Dialog", "Miscellaneous")) + self.pushButton_39.setText(_translate("Miscellaneous_Dialog", "Financial Data")) + self.pushButton_40.setText(_translate("Miscellaneous_Dialog", "Carbon Emission Data")) + self.pushButton_41.setText(_translate("Miscellaneous_Dialog", "Carbon Emission Cost Data")) + self.pushButton_42.setText(_translate("Miscellaneous_Dialog", "Bridge and Traffic Data")) + self.pushButton_43.setText(_translate("Miscellaneous_Dialog", "Maintenance and Repair")) + self.pushButton_16.setText(_translate("Miscellaneous_Dialog", "Disposal and Recycling")) + self.label_55.setText(_translate("Miscellaneous_Dialog", "Output")) + self.textBrowser_3.setHtml(_translate("Miscellaneous_Dialog", "\n" +"\n" +"

Initial Construction Cost

\n" +"

Initial Carbon emission Cost

\n" +"

Time Cost

\n" +"

Road User Cost

\n" +"

Carbon Emission due to Re-Routing

\n" +"

Periodic Maintenance Costs

\n" +"

Maintenance Emission Costs

\n" +"

Routine Inspectection Costs

\n" +"

Repair & Rehabilitation Costs

\n" +"

Reconstruction Costs

\n" +"

Demolition & Disposal Cost

\n" +"

Recycling Cost

\n" +"

Total Life-Cycle Cost

")) + + def validate_data(self): + """Validate input data before saving""" + try: + # Validate all numeric fields + fields_to_validate = [ + self.lineEdit_25, self.lineEdit_26, self.lineEdit_27, + self.lineEdit_28, self.lineEdit_29, self.lineEdit_30, + self.lineEdit_31, self.lineEdit_32, self.lineEdit_33, + self.lineEdit_34, self.lineEdit_35, self.lineEdit_36 + ] + + for field in fields_to_validate: + if field.text(): # Only validate if field is not empty + float(field.text()) + + return True + + except ValueError: + QMessageBox.warning( + None, + "Validation Error", + "Please enter valid numbers in all numeric fields", + QMessageBox.Ok + ) + return False + + def save_data(self): + """Collect all input data and save it to a JSON file""" + if not self.validate_data(): + return False + + data = { + "expansion_joint": { + "component": self.comboBox_13.currentText(), + "materials": [ + { + "type_grade": self.comboBox_14.currentText(), + "quantity": self.lineEdit_25.text(), + "unit": self.label_44.text(), + "rate": self.lineEdit_27.text(), + "rate_source": self.lineEdit_29.text() + }, + { + "type_grade": self.comboBox_15.currentText(), + "quantity": self.lineEdit_26.text(), + "unit": self.label_45.text(), + "rate": self.lineEdit_28.text(), + "rate_source": self.lineEdit_30.text() + } + ] + }, + "bearing": { + "component": self.comboBox_16.currentText(), + "materials": [ + { + "type_grade": self.comboBox_17.currentText(), + "quantity": self.lineEdit_33.text(), + "unit": self.label_50.text(), + "rate": self.lineEdit_34.text(), + "rate_source": self.lineEdit_32.text() + }, + { + "type_grade": self.comboBox_18.currentText(), + "quantity": self.lineEdit_31.text(), + "unit": self.label_48.text(), + "rate": self.lineEdit_35.text(), + "rate_source": self.lineEdit_36.text() + } + ] + } + } + + # Save to JSON file + try: + import json + from datetime import datetime + timestamp = datetime.now().strftime("%Y%m%d_%H%M%S") + filename = f"miscellaneous_data_{timestamp}.json" + + with open(filename, 'w') as f: + json.dump(data, f, indent=4) + + # Show success message + QMessageBox.information( + None, + "Success", + f"Miscellaneous data saved successfully to {filename}", + QMessageBox.Ok + ) + + return True + + except Exception as e: + QMessageBox.critical( + None, + "Error", + f"Failed to save data: {str(e)}", + QMessageBox.Ok + ) + return False + + def handle_save(self): + """Handle the save operation and close the dialog if successful""" + if self.save_data(): # Only close if save was successful + Miscellaneous_Dialog.accept() + + +if __name__ == "__main__": + import sys + app = QtWidgets.QApplication(sys.argv) + Miscellaneous_Dialog = QtWidgets.QDialog() + ui = Ui_Miscellaneous_Dialog() + ui.setupUi(Miscellaneous_Dialog) + Miscellaneous_Dialog.show() + sys.exit(app.exec_()) diff --git a/src/osbridgelcca/desktop_app/ui/project_details_windows/ProjectDetails_SubStructure_Window.py b/src/osbridgelcca/desktop_app/ui/project_details_windows/ProjectDetails_SubStructure_Window.py new file mode 100644 index 0000000..62f1c04 --- /dev/null +++ b/src/osbridgelcca/desktop_app/ui/project_details_windows/ProjectDetails_SubStructure_Window.py @@ -0,0 +1,723 @@ +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file 'C:\Users\saans\AppData\Local\Programs\Python\Python310\Lib\site-packages\qt5_applications\Qt\bin\ProjectDetails_SubStructure_Window.ui' +# +# Created by: PyQt5 UI code generator 5.15.9 +# +# WARNING: Any manual changes made to this file will be lost when pyuic5 is +# run again. Do not edit this file unless you know what you are doing. + + +from PyQt5 import QtCore, QtGui, QtWidgets +from PyQt5.QtWidgets import QMessageBox +#from Warning_Window import Ui_Warning_Dialog + + + + + + + +#from ProjectDetails_SubStructure_Window import Ui_SubStructure_Dialog + + + +class Ui_SubStructure_Dialog(object): + def openBridgeTrafficWindow(self): + from ProjectDetails_BridgeANDTrafficData_Window import Ui_BridgeTraffic_Dialog + self.window = QtWidgets.QDialog() + self.ui = Ui_BridgeTraffic_Dialog() + self.ui.setupUi(self.window) + self.window.show() + + def openFoundationWindow(self): + from ProjectDetails_Foundation_Window import Ui_Foundation_Dialog + self.window = QtWidgets.QDialog() + self.ui = Ui_Foundation_Dialog() + self.ui.setupUi(self.window) + self.window.show() + + def openCarbonEmissionWindow(self): + from ProjectDetails_CarbonEmissionData_Window import Ui_CarbonEmission_Dialog + self.window = QtWidgets.QDialog() + self.ui = Ui_CarbonEmission_Dialog() + self.ui.setupUi(self.window) + self.window.show() + + def openDemolitionWindow(self): + from ProjectDetails_DemolitionANDRecyclingData_Window import Ui_Demolition_Dialog + self.window = QtWidgets.QDialog() + self.ui = Ui_Demolition_Dialog() + self.ui.setupUi(self.window) + self.window.show() + + def openFinancialWindow(self): + from ProjectDetails_FinancialData_Window import Ui_FinancialData_Dialog + self.window = QtWidgets.QDialog() + self.ui = Ui_FinancialData_Dialog() + self.ui.setupUi(self.window) + self.window.show() + + def openMaintenanceWindow(self): + from ProjectDetails_MaintenanceANDRepairData_Window import Ui_Maintenance_Dialog + self.window = QtWidgets.QDialog() + self.ui = Ui_Maintenance_Dialog() + self.ui.setupUi(self.window) + self.window.show() + + def openMiscellaneousWindow(self): + from ProjectDetails_Miscellaneous_Window import Ui_Miscellaneous_Dialog + self.window = QtWidgets.QDialog() + self.ui = Ui_Miscellaneous_Dialog() + self.ui.setupUi(self.window) + self.window.show() + + def openSubStructureWindow(self): + self.window = QtWidgets.QDialog() + self.ui = Ui_SubStructure_Dialog() + self.ui.setupUi(self.window) + self.window.show() + + def openSuperStructureWindow(self): + from ProjectDetails_SuperStructure_Window import Ui_SuperStructure_Dialog + self.window = QtWidgets.QDialog() + self.ui = Ui_SuperStructure_Dialog() + self.ui.setupUi(self.window) + self.window.show() + + def setupUi(self, SubStructure_Dialog): + SubStructure_Dialog.setObjectName("SubStructure_Dialog") + SubStructure_Dialog.resize(1440, 900) + SubStructure_Dialog.setStyleSheet("background-color:#FAFAFA") + self.label = QtWidgets.QLabel(SubStructure_Dialog) + self.label.setGeometry(QtCore.QRect(10, 35, 244, 691)) + font = QtGui.QFont() + font.setPointSize(10) + self.label.setFont(font) + self.label.setStyleSheet("background-color: rgb(240,230,230)") + self.label.setText("") + self.label.setObjectName("label") + self.pushButton = QtWidgets.QPushButton(SubStructure_Dialog) + self.pushButton.setGeometry(QtCore.QRect(10, 10, 188, 25)) + font = QtGui.QFont() + font.setPointSize(10) + self.pushButton.setFont(font) + self.pushButton.setFocusPolicy(QtCore.Qt.StrongFocus) + self.pushButton.setLayoutDirection(QtCore.Qt.RightToLeft) + self.pushButton.setStyleSheet("background-color: rgb(240,230,230)") + icon = QtGui.QIcon() + icon.addPixmap(QtGui.QPixmap("C:\\Users\\saans\\AppData\\Local\\Programs\\Python\\Python310\\Lib\\site-packages\\qt5_applications\\Qt\\bin\\../../../../../../../../../../Downloads/Dismiss.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) + self.pushButton.setIcon(icon) + self.pushButton.setAutoRepeat(False) + self.pushButton.setObjectName("pushButton") + self.widget_2 = QtWidgets.QWidget(SubStructure_Dialog) + self.widget_2.setGeometry(QtCore.QRect(350, 35, 778, 624)) + self.widget_2.setStyleSheet("background-color: #fff9f9") + self.widget_2.setObjectName("widget_2") + self.label_38 = QtWidgets.QLabel(self.widget_2) + self.label_38.setGeometry(QtCore.QRect(20, 10, 91, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_38.setFont(font) + self.label_38.setObjectName("label_38") + self.comboBox_13 = QtWidgets.QComboBox(self.widget_2) + self.comboBox_13.setGeometry(QtCore.QRect(140, 10, 190, 22)) + font = QtGui.QFont() + font.setPointSize(10) + self.comboBox_13.setFont(font) + self.comboBox_13.setStyleSheet("background-color: #ffffff") + self.comboBox_13.setObjectName("comboBox_13") + self.comboBox_13.addItem("") + self.pushButton_10 = QtWidgets.QPushButton(self.widget_2) + self.pushButton_10.setGeometry(QtCore.QRect(350, 10, 190, 23)) + self.pushButton_10.setStyleSheet("background-color: #ffffff") + self.pushButton_10.setObjectName("pushButton_10") + self.label_39 = QtWidgets.QLabel(self.widget_2) + self.label_39.setGeometry(QtCore.QRect(20, 70, 161, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_39.setFont(font) + self.label_39.setAlignment(QtCore.Qt.AlignCenter) + self.label_39.setObjectName("label_39") + self.label_40 = QtWidgets.QLabel(self.widget_2) + self.label_40.setGeometry(QtCore.QRect(551, 70, 140, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_40.setFont(font) + self.label_40.setAlignment(QtCore.Qt.AlignCenter) + self.label_40.setObjectName("label_40") + self.label_41 = QtWidgets.QLabel(self.widget_2) + self.label_41.setGeometry(QtCore.QRect(191, 70, 110, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_41.setFont(font) + self.label_41.setAlignment(QtCore.Qt.AlignCenter) + self.label_41.setObjectName("label_41") + self.label_42 = QtWidgets.QLabel(self.widget_2) + self.label_42.setGeometry(QtCore.QRect(311, 70, 110, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_42.setFont(font) + self.label_42.setAlignment(QtCore.Qt.AlignCenter) + self.label_42.setObjectName("label_42") + self.label_43 = QtWidgets.QLabel(self.widget_2) + self.label_43.setGeometry(QtCore.QRect(431, 70, 110, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_43.setFont(font) + self.label_43.setAlignment(QtCore.Qt.AlignCenter) + self.label_43.setObjectName("label_43") + self.comboBox_14 = QtWidgets.QComboBox(self.widget_2) + self.comboBox_14.setGeometry(QtCore.QRect(30, 100, 140, 22)) + self.comboBox_14.setStyleSheet("background-color: #ffffff") + self.comboBox_14.setObjectName("comboBox_14") + self.comboBox_15 = QtWidgets.QComboBox(self.widget_2) + self.comboBox_15.setGeometry(QtCore.QRect(30, 130, 140, 22)) + self.comboBox_15.setStyleSheet("background-color: #ffffff") + self.comboBox_15.setObjectName("comboBox_15") + self.lineEdit_25 = QtWidgets.QLineEdit(self.widget_2) + self.lineEdit_25.setGeometry(QtCore.QRect(210, 100, 81, 20)) + font = QtGui.QFont() + font.setPointSize(10) + self.lineEdit_25.setFont(font) + self.lineEdit_25.setStyleSheet("background-color: #ffffff") + self.lineEdit_25.setObjectName("lineEdit_25") + self.lineEdit_26 = QtWidgets.QLineEdit(self.widget_2) + self.lineEdit_26.setGeometry(QtCore.QRect(210, 130, 81, 20)) + font = QtGui.QFont() + font.setPointSize(10) + self.lineEdit_26.setFont(font) + self.lineEdit_26.setStyleSheet("background-color: #ffffff") + self.lineEdit_26.setObjectName("lineEdit_26") + self.label_44 = QtWidgets.QLabel(self.widget_2) + self.label_44.setGeometry(QtCore.QRect(340, 100, 51, 20)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_44.setFont(font) + self.label_44.setStyleSheet("background-color: #ffffff") + self.label_44.setAlignment(QtCore.Qt.AlignCenter) + self.label_44.setObjectName("label_44") + self.label_45 = QtWidgets.QLabel(self.widget_2) + self.label_45.setGeometry(QtCore.QRect(340, 130, 51, 20)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_45.setFont(font) + self.label_45.setStyleSheet("background-color: #ffffff") + self.label_45.setAlignment(QtCore.Qt.AlignCenter) + self.label_45.setObjectName("label_45") + self.lineEdit_27 = QtWidgets.QLineEdit(self.widget_2) + self.lineEdit_27.setGeometry(QtCore.QRect(450, 100, 81, 20)) + font = QtGui.QFont() + font.setPointSize(10) + self.lineEdit_27.setFont(font) + self.lineEdit_27.setStyleSheet("background-color: #ffffff") + self.lineEdit_27.setObjectName("lineEdit_27") + self.lineEdit_28 = QtWidgets.QLineEdit(self.widget_2) + self.lineEdit_28.setGeometry(QtCore.QRect(450, 130, 81, 20)) + font = QtGui.QFont() + font.setPointSize(10) + self.lineEdit_28.setFont(font) + self.lineEdit_28.setStyleSheet("background-color: #ffffff") + self.lineEdit_28.setObjectName("lineEdit_28") + self.lineEdit_29 = QtWidgets.QLineEdit(self.widget_2) + self.lineEdit_29.setGeometry(QtCore.QRect(570, 100, 101, 20)) + font = QtGui.QFont() + font.setPointSize(10) + self.lineEdit_29.setFont(font) + self.lineEdit_29.setStyleSheet("background-color: #ffffff") + self.lineEdit_29.setObjectName("lineEdit_29") + self.lineEdit_30 = QtWidgets.QLineEdit(self.widget_2) + self.lineEdit_30.setGeometry(QtCore.QRect(570, 130, 101, 20)) + font = QtGui.QFont() + font.setPointSize(10) + self.lineEdit_30.setFont(font) + self.lineEdit_30.setStyleSheet("background-color: #ffffff") + self.lineEdit_30.setObjectName("lineEdit_30") + self.pushButton_13 = QtWidgets.QPushButton(self.widget_2) + self.pushButton_13.setGeometry(QtCore.QRect(300, 200, 190, 23)) + self.pushButton_13.setStyleSheet("background-color: #ffffff") + self.pushButton_13.setObjectName("pushButton_13") + self.label_46 = QtWidgets.QLabel(self.widget_2) + self.label_46.setGeometry(QtCore.QRect(30, 330, 161, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_46.setFont(font) + self.label_46.setAlignment(QtCore.Qt.AlignCenter) + self.label_46.setObjectName("label_46") + self.comboBox_16 = QtWidgets.QComboBox(self.widget_2) + self.comboBox_16.setGeometry(QtCore.QRect(150, 270, 190, 22)) + font = QtGui.QFont() + font.setPointSize(10) + self.comboBox_16.setFont(font) + self.comboBox_16.setStyleSheet("background-color: #ffffff") + self.comboBox_16.setObjectName("comboBox_16") + self.comboBox_16.addItem("") + self.label_47 = QtWidgets.QLabel(self.widget_2) + self.label_47.setGeometry(QtCore.QRect(441, 330, 110, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_47.setFont(font) + self.label_47.setAlignment(QtCore.Qt.AlignCenter) + self.label_47.setObjectName("label_47") + self.label_48 = QtWidgets.QLabel(self.widget_2) + self.label_48.setGeometry(QtCore.QRect(350, 390, 51, 20)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_48.setFont(font) + self.label_48.setStyleSheet("background-color: #ffffff") + self.label_48.setAlignment(QtCore.Qt.AlignCenter) + self.label_48.setObjectName("label_48") + self.label_49 = QtWidgets.QLabel(self.widget_2) + self.label_49.setGeometry(QtCore.QRect(561, 330, 140, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_49.setFont(font) + self.label_49.setAlignment(QtCore.Qt.AlignCenter) + self.label_49.setObjectName("label_49") + self.label_50 = QtWidgets.QLabel(self.widget_2) + self.label_50.setGeometry(QtCore.QRect(350, 360, 51, 20)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_50.setFont(font) + self.label_50.setStyleSheet("background-color: #ffffff") + self.label_50.setAlignment(QtCore.Qt.AlignCenter) + self.label_50.setObjectName("label_50") + self.label_51 = QtWidgets.QLabel(self.widget_2) + self.label_51.setGeometry(QtCore.QRect(321, 330, 110, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_51.setFont(font) + self.label_51.setAlignment(QtCore.Qt.AlignCenter) + self.label_51.setObjectName("label_51") + self.lineEdit_31 = QtWidgets.QLineEdit(self.widget_2) + self.lineEdit_31.setGeometry(QtCore.QRect(220, 390, 81, 20)) + font = QtGui.QFont() + font.setPointSize(10) + self.lineEdit_31.setFont(font) + self.lineEdit_31.setStyleSheet("background-color: #ffffff") + self.lineEdit_31.setObjectName("lineEdit_31") + self.lineEdit_32 = QtWidgets.QLineEdit(self.widget_2) + self.lineEdit_32.setGeometry(QtCore.QRect(580, 360, 101, 20)) + font = QtGui.QFont() + font.setPointSize(10) + self.lineEdit_32.setFont(font) + self.lineEdit_32.setStyleSheet("background-color: #ffffff") + self.lineEdit_32.setObjectName("lineEdit_32") + self.label_52 = QtWidgets.QLabel(self.widget_2) + self.label_52.setGeometry(QtCore.QRect(201, 330, 110, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_52.setFont(font) + self.label_52.setAlignment(QtCore.Qt.AlignCenter) + self.label_52.setObjectName("label_52") + self.pushButton_14 = QtWidgets.QPushButton(self.widget_2) + self.pushButton_14.setGeometry(QtCore.QRect(310, 460, 190, 23)) + self.pushButton_14.setStyleSheet("background-color: #ffffff") + self.pushButton_14.setObjectName("pushButton_14") + self.pushButton_15 = QtWidgets.QPushButton(self.widget_2) + self.pushButton_15.setGeometry(QtCore.QRect(360, 270, 190, 23)) + self.pushButton_15.setStyleSheet("background-color: #ffffff") + self.pushButton_15.setObjectName("pushButton_15") + self.label_53 = QtWidgets.QLabel(self.widget_2) + self.label_53.setGeometry(QtCore.QRect(30, 270, 91, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_53.setFont(font) + self.label_53.setObjectName("label_53") + self.lineEdit_36 = QtWidgets.QLineEdit(self.widget_2) + self.lineEdit_36.setGeometry(QtCore.QRect(580, 390, 101, 20)) + font = QtGui.QFont() + font.setPointSize(10) + self.lineEdit_36.setFont(font) + self.lineEdit_36.setStyleSheet("background-color: #ffffff") + self.lineEdit_36.setObjectName("lineEdit_36") + self.comboBox_17 = QtWidgets.QComboBox(self.widget_2) + self.comboBox_17.setGeometry(QtCore.QRect(40, 360, 140, 22)) + self.comboBox_17.setStyleSheet("background-color: #ffffff") + self.comboBox_17.setObjectName("comboBox_17") + self.comboBox_17.addItem("") + self.comboBox_17.addItem("") + self.comboBox_18 = QtWidgets.QComboBox(self.widget_2) + self.comboBox_18.setGeometry(QtCore.QRect(40, 390, 140, 22)) + self.comboBox_18.setStyleSheet("background-color: #ffffff") + self.comboBox_18.setObjectName("comboBox_18") + self.comboBox_18.addItem("") + self.comboBox_18.addItem("") + self.line_5 = QtWidgets.QFrame(self.widget_2) + self.line_5.setGeometry(QtCore.QRect(10, 250, 761, 16)) + self.line_5.setContextMenuPolicy(QtCore.Qt.DefaultContextMenu) + self.line_5.setFrameShadow(QtWidgets.QFrame.Sunken) + self.line_5.setLineWidth(2) + self.line_5.setMidLineWidth(2) + self.line_5.setFrameShape(QtWidgets.QFrame.HLine) + self.line_5.setObjectName("line_5") + self.line_6 = QtWidgets.QFrame(self.widget_2) + self.line_6.setGeometry(QtCore.QRect(10, 500, 761, 16)) + self.line_6.setContextMenuPolicy(QtCore.Qt.DefaultContextMenu) + self.line_6.setFrameShadow(QtWidgets.QFrame.Sunken) + self.line_6.setLineWidth(2) + self.line_6.setMidLineWidth(2) + self.line_6.setFrameShape(QtWidgets.QFrame.HLine) + self.line_6.setObjectName("line_6") + self.buttonBox = QtWidgets.QDialogButtonBox(self.widget_2) + self.buttonBox.setGeometry(QtCore.QRect(430, 590, 341, 32)) + self.buttonBox.setOrientation(QtCore.Qt.Horizontal) + self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Close|QtWidgets.QDialogButtonBox.Save) + self.buttonBox.setObjectName("buttonBox") + self.pushButton_6 = QtWidgets.QPushButton(SubStructure_Dialog) + self.pushButton_6.setGeometry(QtCore.QRect(350, 10, 188, 25)) + font = QtGui.QFont() + font.setPointSize(10) + font.setBold(True) + font.setWeight(75) + self.pushButton_6.setFont(font) + self.pushButton_6.setFocusPolicy(QtCore.Qt.StrongFocus) + self.pushButton_6.setLayoutDirection(QtCore.Qt.RightToLeft) + self.pushButton_6.setStyleSheet("background-color: rgb(240,230,230)") + self.pushButton_6.setIcon(icon) + self.pushButton_6.setAutoRepeat(False) + self.pushButton_6.setObjectName("pushButton_6") + self.scrollArea = QtWidgets.QScrollArea(SubStructure_Dialog) + self.scrollArea.setGeometry(QtCore.QRect(10, 40, 241, 681)) + self.scrollArea.setAutoFillBackground(False) + self.scrollArea.setStyleSheet("background-color: #fff9f9") + self.scrollArea.setWidgetResizable(True) + self.scrollArea.setObjectName("scrollArea") + self.scrollAreaWidgetContents_3 = QtWidgets.QWidget() + self.scrollAreaWidgetContents_3.setGeometry(QtCore.QRect(0, 0, 239, 679)) + self.scrollAreaWidgetContents_3.setObjectName("scrollAreaWidgetContents_3") + self.label_54 = QtWidgets.QLabel(self.scrollAreaWidgetContents_3) + self.label_54.setGeometry(QtCore.QRect(0, 0, 221, 31)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_54.setFont(font) + self.label_54.setStyleSheet("background-color: rgb(240,230,230)") + self.label_54.setAlignment(QtCore.Qt.AlignCenter) + self.label_54.setObjectName("label_54") + self.widget_4 = QtWidgets.QWidget(self.scrollAreaWidgetContents_3) + self.widget_4.setGeometry(QtCore.QRect(0, 30, 221, 357)) + self.widget_4.setStyleSheet("background-color: #fff9f9") + self.widget_4.setObjectName("widget_4") + self.verticalLayout_3 = QtWidgets.QVBoxLayout(self.widget_4) + self.verticalLayout_3.setContentsMargins(0, 0, 0, 0) + self.verticalLayout_3.setObjectName("verticalLayout_3") + self.pushButton_34 = QtWidgets.QPushButton(self.widget_4) + font = QtGui.QFont() + font.setPointSize(10) + self.pushButton_34.setFont(font) + icon1 = QtGui.QIcon() + icon1.addPixmap(QtGui.QPixmap("C:\\Users\\saans\\AppData\\Local\\Programs\\Python\\Python310\\Lib\\site-packages\\qt5_applications\\Qt\\bin\\../../../../../../../../../../Downloads/play_arrow_filled.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) + icon1.addPixmap(QtGui.QPixmap("C:\\Users\\saans\\AppData\\Local\\Programs\\Python\\Python310\\Lib\\site-packages\\qt5_applications\\Qt\\bin\\../../../../../../../../../../Downloads/play_arrow_filled (1).png"), QtGui.QIcon.Normal, QtGui.QIcon.On) + self.pushButton_34.setIcon(icon1) + self.pushButton_34.setCheckable(True) + self.pushButton_34.setAutoDefault(True) + self.pushButton_34.setObjectName("pushButton_34") + self.verticalLayout_3.addWidget(self.pushButton_34) + self.widget_7 = QtWidgets.QWidget(self.widget_4) + self.widget_7.setObjectName("widget_7") + self.formLayout_3 = QtWidgets.QFormLayout(self.widget_7) + self.formLayout_3.setObjectName("formLayout_3") + self.pushButton_35 = QtWidgets.QPushButton(self.widget_7, clicked=lambda: self.openFoundationWindow()) + font = QtGui.QFont() + font.setPointSize(10) + font.setBold(False) + font.setWeight(50) + self.pushButton_35.setFont(font) + icon2 = QtGui.QIcon() + icon2.addPixmap(QtGui.QPixmap("C:\\Users\\saans\\AppData\\Local\\Programs\\Python\\Python310\\Lib\\site-packages\\qt5_applications\\Qt\\bin\\../../../../../../../../../../Downloads/play_arrow_filled.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) + self.pushButton_35.setIcon(icon2) + self.pushButton_35.setObjectName("pushButton_35") + self.formLayout_3.setWidget(0, QtWidgets.QFormLayout.LabelRole, self.pushButton_35) + self.pushButton_36 = QtWidgets.QPushButton(self.widget_7, clicked=lambda: self.openSuperStructureWindow()) + font = QtGui.QFont() + font.setPointSize(10) + font.setBold(False) + font.setWeight(50) + self.pushButton_36.setFont(font) + self.pushButton_36.setIcon(icon2) + self.pushButton_36.setObjectName("pushButton_36") + self.formLayout_3.setWidget(1, QtWidgets.QFormLayout.LabelRole, self.pushButton_36) + self.pushButton_37 = QtWidgets.QPushButton(self.widget_7, clicked=lambda: self.openSubStructureWindow()) + font = QtGui.QFont() + font.setPointSize(10) + font.setBold(False) + font.setWeight(50) + self.pushButton_37.setFont(font) + self.pushButton_37.setIcon(icon2) + self.pushButton_37.setObjectName("pushButton_37") + self.formLayout_3.setWidget(2, QtWidgets.QFormLayout.LabelRole, self.pushButton_37) + self.pushButton_38 = QtWidgets.QPushButton(self.widget_7, clicked=lambda: self.openMiscellaneousWindow()) + font = QtGui.QFont() + font.setPointSize(10) + font.setBold(False) + font.setWeight(50) + self.pushButton_38.setFont(font) + self.pushButton_38.setIcon(icon2) + self.pushButton_38.setObjectName("pushButton_38") + self.formLayout_3.setWidget(3, QtWidgets.QFormLayout.LabelRole, self.pushButton_38) + self.verticalLayout_3.addWidget(self.widget_7) + self.pushButton_39 = QtWidgets.QPushButton(self.widget_4, clicked=lambda: self.openFinancialWindow()) + font = QtGui.QFont() + font.setPointSize(10) + self.pushButton_39.setFont(font) + self.pushButton_39.setObjectName("pushButton_39") + self.verticalLayout_3.addWidget(self.pushButton_39) + self.pushButton_40 = QtWidgets.QPushButton(self.widget_4) + font = QtGui.QFont() + font.setPointSize(10) + self.pushButton_40.setFont(font) + self.pushButton_40.setIcon(icon1) + self.pushButton_40.setCheckable(True) + self.pushButton_40.setObjectName("pushButton_40") + self.verticalLayout_3.addWidget(self.pushButton_40) + self.widget_10 = QtWidgets.QWidget(self.widget_4) + self.widget_10.setMinimumSize(QtCore.QSize(203, 21)) + self.widget_10.setMaximumSize(QtCore.QSize(281, 21)) + self.widget_10.setObjectName("widget_10") + self.pushButton_41 = QtWidgets.QPushButton(self.widget_10, clicked=lambda: self.openCarbonEmissionWindow()) + self.pushButton_41.setGeometry(QtCore.QRect(20, 0, 183, 21)) + font = QtGui.QFont() + font.setPointSize(10) + font.setBold(False) + font.setWeight(50) + self.pushButton_41.setFont(font) + self.pushButton_41.setIcon(icon2) + self.pushButton_41.setObjectName("pushButton_41") + self.verticalLayout_3.addWidget(self.widget_10) + self.pushButton_42 = QtWidgets.QPushButton(self.widget_4, clicked=lambda: self.openBridgeTrafficWindow()) + font = QtGui.QFont() + font.setPointSize(10) + self.pushButton_42.setFont(font) + self.pushButton_42.setObjectName("pushButton_42") + self.verticalLayout_3.addWidget(self.pushButton_42) + self.pushButton_43 = QtWidgets.QPushButton(self.widget_4, clicked=lambda: self.openMaintenanceWindow()) + font = QtGui.QFont() + font.setPointSize(10) + self.pushButton_43.setFont(font) + self.pushButton_43.setObjectName("pushButton_43") + self.verticalLayout_3.addWidget(self.pushButton_43) + self.pushButton_16 = QtWidgets.QPushButton(self.widget_4, clicked=lambda: self.openDemolitionWindow()) + font = QtGui.QFont() + font.setPointSize(10) + self.pushButton_16.setFont(font) + self.pushButton_16.setObjectName("pushButton_16") + self.verticalLayout_3.addWidget(self.pushButton_16) + self.label_55 = QtWidgets.QLabel(self.scrollAreaWidgetContents_3) + self.label_55.setGeometry(QtCore.QRect(0, 387, 221, 31)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_55.setFont(font) + self.label_55.setStyleSheet("background-color: rgb(240,230,230)") + self.label_55.setAlignment(QtCore.Qt.AlignCenter) + self.label_55.setObjectName("label_55") + self.textBrowser_3 = QtWidgets.QTextBrowser(self.scrollAreaWidgetContents_3) + self.textBrowser_3.setGeometry(QtCore.QRect(0, 418, 221, 221)) + self.textBrowser_3.setStyleSheet("background-color: #fff9f9") + self.textBrowser_3.setObjectName("textBrowser_3") + self.verticalScrollBar_3 = QtWidgets.QScrollBar(self.scrollAreaWidgetContents_3) + self.verticalScrollBar_3.setGeometry(QtCore.QRect(220, 0, 16, 641)) + self.verticalScrollBar_3.setStyleSheet("background-color: #F0F0F0") + self.verticalScrollBar_3.setOrientation(QtCore.Qt.Vertical) + self.verticalScrollBar_3.setObjectName("verticalScrollBar_3") + self.scrollArea.setWidget(self.scrollAreaWidgetContents_3) + + self.retranslateUi(SubStructure_Dialog) + self.buttonBox.accepted.connect(self.handle_save) # type: ignore# type: ignore + self.buttonBox.rejected.connect(lambda: self.show_warning(SubStructure_Dialog)) # type: ignore + #self.buttonBox.rejected.connect(SubStructure_Dialog.reject) + QtCore.QMetaObject.connectSlotsByName(SubStructure_Dialog) + + def show_warning(self, dialog): + """ + Show a warning window when the Close button is pressed. + """ + warning_box = QMessageBox() + warning_box.setIcon(QMessageBox.Warning) + warning_box.setWindowTitle("Confirm Close") + warning_box.setText("Are you sure you want to close without saving?") + warning_box.setStandardButtons(QMessageBox.Yes | QMessageBox.No) + warning_box.setDefaultButton(QMessageBox.No) + + # Check the user's response + response = warning_box.exec_() + if response == QMessageBox.Yes: + dialog.reject() # Close the application + else: + pass # Do nothing, return to the dialog + + def retranslateUi(self, SubStructure_Dialog): + _translate = QtCore.QCoreApplication.translate + SubStructure_Dialog.setWindowTitle(_translate("SubStructure_Dialog", "Sub-Structure Dialog")) + self.pushButton.setText(_translate("SubStructure_Dialog", "Project Details Window ")) + self.label_38.setText(_translate("SubStructure_Dialog", "Components:")) + self.comboBox_13.setItemText(0, _translate("SubStructure_Dialog", "Piers")) + self.pushButton_10.setText(_translate("SubStructure_Dialog", "+ Add Sub-Component")) + self.label_39.setText(_translate("SubStructure_Dialog", "Material Type and Grade")) + self.label_40.setText(_translate("SubStructure_Dialog", "Rate Data Source")) + self.label_41.setText(_translate("SubStructure_Dialog", "Quantity")) + self.label_42.setText(_translate("SubStructure_Dialog", "Unit")) + self.label_43.setText(_translate("SubStructure_Dialog", "Rate")) + self.label_44.setText(_translate("SubStructure_Dialog", "

m3

")) + self.label_45.setText(_translate("SubStructure_Dialog", "kg")) + self.pushButton_13.setText(_translate("SubStructure_Dialog", "+ Add Material")) + self.label_46.setText(_translate("SubStructure_Dialog", "Material Type and Grade")) + self.comboBox_16.setItemText(0, _translate("SubStructure_Dialog", "Abutment")) + self.label_47.setText(_translate("SubStructure_Dialog", "Rate")) + self.label_48.setText(_translate("SubStructure_Dialog", "kg")) + self.label_49.setText(_translate("SubStructure_Dialog", "Rate Data Source")) + self.label_50.setText(_translate("SubStructure_Dialog", "

m3

")) + self.label_51.setText(_translate("SubStructure_Dialog", "Unit")) + self.label_52.setText(_translate("SubStructure_Dialog", "Quantity")) + self.pushButton_14.setText(_translate("SubStructure_Dialog", "+ Add Material")) + self.pushButton_15.setText(_translate("SubStructure_Dialog", "+ Add Sub-Component")) + self.label_53.setText(_translate("SubStructure_Dialog", "Components:")) + self.comboBox_17.setItemText(0, _translate("SubStructure_Dialog", "Concrete")) + self.comboBox_17.setItemText(1, _translate("SubStructure_Dialog", "Steel")) + self.comboBox_18.setItemText(0, _translate("SubStructure_Dialog", "Steel")) + self.comboBox_18.setItemText(1, _translate("SubStructure_Dialog", "Concrete")) + self.pushButton_6.setText(_translate("SubStructure_Dialog", "Sub-Structure ")) + self.label_54.setText(_translate("SubStructure_Dialog", "Input Parameters")) + self.pushButton_34.setText(_translate("SubStructure_Dialog", "Structure Works Data")) + self.pushButton_35.setText(_translate("SubStructure_Dialog", "Foundation")) + self.pushButton_36.setText(_translate("SubStructure_Dialog", "Super-Structure")) + self.pushButton_37.setText(_translate("SubStructure_Dialog", "Sub-Structure")) + self.pushButton_38.setText(_translate("SubStructure_Dialog", "Miscellaneous")) + self.pushButton_39.setText(_translate("SubStructure_Dialog", "Financial Data")) + self.pushButton_40.setText(_translate("SubStructure_Dialog", "Carbon Emission Data")) + self.pushButton_41.setText(_translate("SubStructure_Dialog", "Carbon Emission Cost Data")) + self.pushButton_42.setText(_translate("SubStructure_Dialog", "Bridge and Traffic Data")) + self.pushButton_43.setText(_translate("SubStructure_Dialog", "Maintenance and Repair")) + self.pushButton_16.setText(_translate("SubStructure_Dialog", "Disposal and Recycling")) + self.label_55.setText(_translate("SubStructure_Dialog", "Output")) + self.textBrowser_3.setHtml(_translate("SubStructure_Dialog", "\n" +"\n" +"

Initial Construction Cost

\n" +"

Initial Carbon emission Cost

\n" +"

Time Cost

\n" +"

Road User Cost

\n" +"

Carbon Emission due to Re-Routing

\n" +"

Periodic Maintenance Costs

\n" +"

Maintenance Emission Costs

\n" +"

Routine Inspectection Costs

\n" +"

Repair & Rehabilitation Costs

\n" +"

Reconstruction Costs

\n" +"

Demolition & Disposal Cost

\n" +"

Recycling Cost

\n" +"

Total Life-Cycle Cost

")) + + def validate_data(self): + """Validate input data before saving""" + try: + # Validate all numeric fields + fields_to_validate = [ + self.lineEdit_25, self.lineEdit_26, self.lineEdit_27, + self.lineEdit_28, self.lineEdit_29, self.lineEdit_30, + self.lineEdit_31, self.lineEdit_32, self.lineEdit_33, + self.lineEdit_34, self.lineEdit_35, self.lineEdit_36 + ] + + for field in fields_to_validate: + if field.text(): # Only validate if field is not empty + float(field.text()) + + return True + + except ValueError: + QMessageBox.warning( + None, + "Validation Error", + "Please enter valid numbers in all numeric fields", + QMessageBox.Ok + ) + return False + + def save_data(self): + """Collect all input data and save it to a JSON file""" + if not self.validate_data(): + return False + + data = { + "piers": { + "component": self.comboBox_13.currentText(), + "materials": [ + { + "type_grade": self.comboBox_14.currentText(), + "quantity": self.lineEdit_25.text(), + "unit": self.label_44.text(), + "rate": self.lineEdit_27.text(), + "rate_source": self.lineEdit_29.text() + }, + { + "type_grade": self.comboBox_15.currentText(), + "quantity": self.lineEdit_26.text(), + "unit": self.label_45.text(), + "rate": self.lineEdit_28.text(), + "rate_source": self.lineEdit_30.text() + } + ] + }, + "abutment": { + "component": self.comboBox_16.currentText(), + "materials": [ + { + "type_grade": self.comboBox_17.currentText(), + "quantity": self.lineEdit_33.text(), + "unit": self.label_50.text(), + "rate": self.lineEdit_34.text(), + "rate_source": self.lineEdit_32.text() + }, + { + "type_grade": self.comboBox_18.currentText(), + "quantity": self.lineEdit_31.text(), + "unit": self.label_48.text(), + "rate": self.lineEdit_35.text(), + "rate_source": self.lineEdit_36.text() + } + ] + } + } + + # Save to JSON file + try: + import json + from datetime import datetime + timestamp = datetime.now().strftime("%Y%m%d_%H%M%S") + filename = f"substructure_data_{timestamp}.json" + + with open(filename, 'w') as f: + json.dump(data, f, indent=4) + + # Show success message + QMessageBox.information( + None, + "Success", + f"Sub-structure data saved successfully to {filename}", + QMessageBox.Ok + ) + + return True + + except Exception as e: + QMessageBox.critical( + None, + "Error", + f"Failed to save data: {str(e)}", + QMessageBox.Ok + ) + return False + + def handle_save(self): + """Handle the save operation and close the dialog if successful""" + if self.save_data(): # Only close if save was successful + SubStructure_Dialog.accept() + +if __name__ == "__main__": + import sys + app = QtWidgets.QApplication(sys.argv) + SubStructure_Dialog = QtWidgets.QDialog() + ui = Ui_SubStructure_Dialog() + ui.setupUi(SubStructure_Dialog) + SubStructure_Dialog.show() + sys.exit(app.exec_()) diff --git a/src/osbridgelcca/desktop_app/ui/project_details_windows/ProjectDetails_SuperStructure_Window.py b/src/osbridgelcca/desktop_app/ui/project_details_windows/ProjectDetails_SuperStructure_Window.py new file mode 100644 index 0000000..d407f2d --- /dev/null +++ b/src/osbridgelcca/desktop_app/ui/project_details_windows/ProjectDetails_SuperStructure_Window.py @@ -0,0 +1,742 @@ +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file 'C:\Users\saans\AppData\Local\Programs\Python\Python310\Lib\site-packages\qt5_applications\Qt\bin\ProjectDetails_SuperStructure_Window.ui' +# +# Created by: PyQt5 UI code generator 5.15.9 +# +# WARNING: Any manual changes made to this file will be lost when pyuic5 is +# run again. Do not edit this file unless you know what you are doing. + + +from PyQt5 import QtCore, QtGui, QtWidgets +from PyQt5.QtWidgets import QMessageBox + + + + + + + + +#from ProjectDetails_SuperStructure_Window import Ui_SuperStructure_Dialog + + +class Ui_SuperStructure_Dialog(object): + def openBridgeTrafficWindow(self): + from ProjectDetails_BridgeANDTrafficData_Window import Ui_BridgeTraffic_Dialog + self.window = QtWidgets.QDialog() + self.ui = Ui_BridgeTraffic_Dialog() + self.ui.setupUi(self.window) + self.window.show() + + def openFoundationWindow(self): + from ProjectDetails_Foundation_Window import Ui_Foundation_Dialog + self.window = QtWidgets.QDialog() + self.ui = Ui_Foundation_Dialog() + self.ui.setupUi(self.window) + self.window.show() + + def openCarbonEmissionWindow(self): + from ProjectDetails_CarbonEmissionData_Window import Ui_CarbonEmission_Dialog + self.window = QtWidgets.QDialog() + self.ui = Ui_CarbonEmission_Dialog() + self.ui.setupUi(self.window) + self.window.show() + + def openDemolitionWindow(self): + from ProjectDetails_DemolitionANDRecyclingData_Window import Ui_Demolition_Dialog + self.window = QtWidgets.QDialog() + self.ui = Ui_Demolition_Dialog() + self.ui.setupUi(self.window) + self.window.show() + + def openFinancialWindow(self): + from ProjectDetails_FinancialData_Window import Ui_FinancialData_Dialog + self.window = QtWidgets.QDialog() + self.ui = Ui_FinancialData_Dialog() + self.ui.setupUi(self.window) + self.window.show() + + def openMaintenanceWindow(self): + from ProjectDetails_MaintenanceANDRepairData_Window import Ui_Maintenance_Dialog + self.window = QtWidgets.QDialog() + self.ui = Ui_Maintenance_Dialog() + self.ui.setupUi(self.window) + self.window.show() + + def openMiscellaneousWindow(self): + from ProjectDetails_Miscellaneous_Window import Ui_Miscellaneous_Dialog + self.window = QtWidgets.QDialog() + self.ui = Ui_Miscellaneous_Dialog() + self.ui.setupUi(self.window) + self.window.show() + + def openSubStructureWindow(self): + from ProjectDetails_SubStructure_Window import Ui_SubStructure_Dialog + self.window = QtWidgets.QDialog() + self.ui = Ui_SubStructure_Dialog() + self.ui.setupUi(self.window) + self.window.show() + + def openSuperStructureWindow(self): + self.window = QtWidgets.QDialog() + self.ui = Ui_SuperStructure_Dialog() + self.ui.setupUi(self.window) + self.window.show() + + def setupUi(self, SuperStructure_Dialog): + SuperStructure_Dialog.setObjectName("SuperStructure_Dialog") + SuperStructure_Dialog.resize(1440, 900) + SuperStructure_Dialog.setStyleSheet("background-color:#FAFAFA") + self.label = QtWidgets.QLabel(SuperStructure_Dialog) + self.label.setGeometry(QtCore.QRect(10, 35, 244, 691)) + font = QtGui.QFont() + font.setPointSize(10) + self.label.setFont(font) + self.label.setStyleSheet("background-color: rgb(240,230,230)") + self.label.setText("") + self.label.setObjectName("label") + self.pushButton_6 = QtWidgets.QPushButton(SuperStructure_Dialog) + self.pushButton_6.setGeometry(QtCore.QRect(350, 10, 188, 25)) + font = QtGui.QFont() + font.setPointSize(10) + font.setBold(True) + font.setWeight(75) + self.pushButton_6.setFont(font) + self.pushButton_6.setFocusPolicy(QtCore.Qt.StrongFocus) + self.pushButton_6.setLayoutDirection(QtCore.Qt.RightToLeft) + self.pushButton_6.setStyleSheet("background-color: rgb(240,230,230)") + icon = QtGui.QIcon() + icon.addPixmap(QtGui.QPixmap("C:\\Users\\saans\\AppData\\Local\\Programs\\Python\\Python310\\Lib\\site-packages\\qt5_applications\\Qt\\bin\\../../../../../../../../../../Downloads/Dismiss.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) + self.pushButton_6.setIcon(icon) + self.pushButton_6.setAutoRepeat(False) + self.pushButton_6.setObjectName("pushButton_6") + self.widget_2 = QtWidgets.QWidget(SuperStructure_Dialog) + self.widget_2.setGeometry(QtCore.QRect(350, 35, 778, 624)) + self.widget_2.setStyleSheet("background-color: #fff9f9") + self.widget_2.setObjectName("widget_2") + self.label_20 = QtWidgets.QLabel(self.widget_2) + self.label_20.setGeometry(QtCore.QRect(20, 10, 91, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_20.setFont(font) + self.label_20.setObjectName("label_20") + self.comboBox_7 = QtWidgets.QComboBox(self.widget_2) + self.comboBox_7.setGeometry(QtCore.QRect(140, 10, 190, 22)) + font = QtGui.QFont() + font.setPointSize(10) + self.comboBox_7.setFont(font) + self.comboBox_7.setStyleSheet("background-color: #ffffff") + self.comboBox_7.setObjectName("comboBox_7") + self.comboBox_7.addItem("") + self.pushButton_7 = QtWidgets.QPushButton(self.widget_2) + self.pushButton_7.setGeometry(QtCore.QRect(350, 10, 190, 23)) + self.pushButton_7.setStyleSheet("background-color: #ffffff") + self.pushButton_7.setObjectName("pushButton_7") + self.label_21 = QtWidgets.QLabel(self.widget_2) + self.label_21.setGeometry(QtCore.QRect(20, 70, 161, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_21.setFont(font) + self.label_21.setAlignment(QtCore.Qt.AlignCenter) + self.label_21.setObjectName("label_21") + self.label_22 = QtWidgets.QLabel(self.widget_2) + self.label_22.setGeometry(QtCore.QRect(551, 70, 140, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_22.setFont(font) + self.label_22.setAlignment(QtCore.Qt.AlignCenter) + self.label_22.setObjectName("label_22") + self.label_23 = QtWidgets.QLabel(self.widget_2) + self.label_23.setGeometry(QtCore.QRect(191, 70, 110, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_23.setFont(font) + self.label_23.setAlignment(QtCore.Qt.AlignCenter) + self.label_23.setObjectName("label_23") + self.label_24 = QtWidgets.QLabel(self.widget_2) + self.label_24.setGeometry(QtCore.QRect(311, 70, 110, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_24.setFont(font) + self.label_24.setAlignment(QtCore.Qt.AlignCenter) + self.label_24.setObjectName("label_24") + self.label_25 = QtWidgets.QLabel(self.widget_2) + self.label_25.setGeometry(QtCore.QRect(431, 70, 110, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_25.setFont(font) + self.label_25.setAlignment(QtCore.Qt.AlignCenter) + self.label_25.setObjectName("label_25") + self.comboBox_8 = QtWidgets.QComboBox(self.widget_2) + self.comboBox_8.setGeometry(QtCore.QRect(30, 100, 140, 22)) + self.comboBox_8.setStyleSheet("background-color: #ffffff") + self.comboBox_8.setObjectName("comboBox_8") + self.comboBox_9 = QtWidgets.QComboBox(self.widget_2) + self.comboBox_9.setGeometry(QtCore.QRect(30, 130, 140, 22)) + self.comboBox_9.setStyleSheet("background-color: #ffffff") + self.comboBox_9.setObjectName("comboBox_9") + self.lineEdit_13 = QtWidgets.QLineEdit(self.widget_2) + self.lineEdit_13.setGeometry(QtCore.QRect(210, 100, 81, 20)) + font = QtGui.QFont() + font.setPointSize(10) + self.lineEdit_13.setFont(font) + self.lineEdit_13.setStyleSheet("background-color: #ffffff") + self.lineEdit_13.setObjectName("lineEdit_13") + self.lineEdit_14 = QtWidgets.QLineEdit(self.widget_2) + self.lineEdit_14.setGeometry(QtCore.QRect(210, 130, 81, 20)) + font = QtGui.QFont() + font.setPointSize(10) + self.lineEdit_14.setFont(font) + self.lineEdit_14.setStyleSheet("background-color: #ffffff") + self.lineEdit_14.setObjectName("lineEdit_14") + self.label_26 = QtWidgets.QLabel(self.widget_2) + self.label_26.setGeometry(QtCore.QRect(340, 100, 51, 20)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_26.setFont(font) + self.label_26.setStyleSheet("background-color: #ffffff") + self.label_26.setAlignment(QtCore.Qt.AlignCenter) + self.label_26.setObjectName("label_26") + self.label_27 = QtWidgets.QLabel(self.widget_2) + self.label_27.setGeometry(QtCore.QRect(340, 130, 51, 20)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_27.setFont(font) + self.label_27.setStyleSheet("background-color: #ffffff") + self.label_27.setAlignment(QtCore.Qt.AlignCenter) + self.label_27.setObjectName("label_27") + self.lineEdit_15 = QtWidgets.QLineEdit(self.widget_2) + self.lineEdit_15.setGeometry(QtCore.QRect(450, 100, 81, 20)) + font = QtGui.QFont() + font.setPointSize(10) + self.lineEdit_15.setFont(font) + self.lineEdit_15.setStyleSheet("background-color: #ffffff") + self.lineEdit_15.setObjectName("lineEdit_15") + self.lineEdit_16 = QtWidgets.QLineEdit(self.widget_2) + self.lineEdit_16.setGeometry(QtCore.QRect(450, 130, 81, 20)) + font = QtGui.QFont() + font.setPointSize(10) + self.lineEdit_16.setFont(font) + self.lineEdit_16.setStyleSheet("background-color: #ffffff") + self.lineEdit_16.setObjectName("lineEdit_16") + self.lineEdit_17 = QtWidgets.QLineEdit(self.widget_2) + self.lineEdit_17.setGeometry(QtCore.QRect(570, 100, 101, 20)) + font = QtGui.QFont() + font.setPointSize(10) + self.lineEdit_17.setFont(font) + self.lineEdit_17.setStyleSheet("background-color: #ffffff") + self.lineEdit_17.setObjectName("lineEdit_17") + self.lineEdit_18 = QtWidgets.QLineEdit(self.widget_2) + self.lineEdit_18.setGeometry(QtCore.QRect(570, 130, 101, 20)) + font = QtGui.QFont() + font.setPointSize(10) + self.lineEdit_18.setFont(font) + self.lineEdit_18.setStyleSheet("background-color: #ffffff") + self.lineEdit_18.setObjectName("lineEdit_18") + self.pushButton_8 = QtWidgets.QPushButton(self.widget_2) + self.pushButton_8.setGeometry(QtCore.QRect(300, 200, 190, 23)) + self.pushButton_8.setStyleSheet("background-color: #ffffff") + self.pushButton_8.setObjectName("pushButton_8") + self.label_28 = QtWidgets.QLabel(self.widget_2) + self.label_28.setGeometry(QtCore.QRect(30, 330, 161, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_28.setFont(font) + self.label_28.setAlignment(QtCore.Qt.AlignCenter) + self.label_28.setObjectName("label_28") + self.comboBox_10 = QtWidgets.QComboBox(self.widget_2) + self.comboBox_10.setGeometry(QtCore.QRect(150, 270, 190, 22)) + font = QtGui.QFont() + font.setPointSize(10) + self.comboBox_10.setFont(font) + self.comboBox_10.setStyleSheet("background-color: #ffffff") + self.comboBox_10.setObjectName("comboBox_10") + self.comboBox_10.addItem("") + self.label_29 = QtWidgets.QLabel(self.widget_2) + self.label_29.setGeometry(QtCore.QRect(441, 330, 110, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_29.setFont(font) + self.label_29.setAlignment(QtCore.Qt.AlignCenter) + self.label_29.setObjectName("label_29") + self.label_30 = QtWidgets.QLabel(self.widget_2) + self.label_30.setGeometry(QtCore.QRect(350, 390, 51, 20)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_30.setFont(font) + self.label_30.setStyleSheet("background-color: #ffffff") + self.label_30.setAlignment(QtCore.Qt.AlignCenter) + self.label_30.setObjectName("label_30") + self.label_31 = QtWidgets.QLabel(self.widget_2) + self.label_31.setGeometry(QtCore.QRect(561, 330, 140, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_31.setFont(font) + self.label_31.setAlignment(QtCore.Qt.AlignCenter) + self.label_31.setObjectName("label_31") + self.label_32 = QtWidgets.QLabel(self.widget_2) + self.label_32.setGeometry(QtCore.QRect(350, 360, 51, 20)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_32.setFont(font) + self.label_32.setStyleSheet("background-color: #ffffff") + self.label_32.setAlignment(QtCore.Qt.AlignCenter) + self.label_32.setObjectName("label_32") + self.label_33 = QtWidgets.QLabel(self.widget_2) + self.label_33.setGeometry(QtCore.QRect(321, 330, 110, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_33.setFont(font) + self.label_33.setAlignment(QtCore.Qt.AlignCenter) + self.label_33.setObjectName("label_33") + self.lineEdit_19 = QtWidgets.QLineEdit(self.widget_2) + self.lineEdit_19.setGeometry(QtCore.QRect(220, 390, 81, 20)) + font = QtGui.QFont() + font.setPointSize(10) + self.lineEdit_19.setFont(font) + self.lineEdit_19.setStyleSheet("background-color: #ffffff") + self.lineEdit_19.setObjectName("lineEdit_19") + self.lineEdit_20 = QtWidgets.QLineEdit(self.widget_2) + self.lineEdit_20.setGeometry(QtCore.QRect(580, 360, 101, 20)) + font = QtGui.QFont() + font.setPointSize(10) + self.lineEdit_20.setFont(font) + self.lineEdit_20.setStyleSheet("background-color: #ffffff") + self.lineEdit_20.setObjectName("lineEdit_20") + self.label_34 = QtWidgets.QLabel(self.widget_2) + self.label_34.setGeometry(QtCore.QRect(201, 330, 110, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_34.setFont(font) + self.label_34.setAlignment(QtCore.Qt.AlignCenter) + self.label_34.setObjectName("label_34") + self.pushButton_9 = QtWidgets.QPushButton(self.widget_2) + self.pushButton_9.setGeometry(QtCore.QRect(310, 460, 190, 23)) + self.pushButton_9.setStyleSheet("background-color: #ffffff") + self.pushButton_9.setObjectName("pushButton_9") + self.lineEdit_21 = QtWidgets.QLineEdit(self.widget_2) + self.lineEdit_21.setGeometry(QtCore.QRect(220, 360, 81, 20)) + font = QtGui.QFont() + font.setPointSize(10) + self.lineEdit_21.setFont(font) + self.lineEdit_21.setStyleSheet("background-color: #ffffff") + self.lineEdit_21.setObjectName("lineEdit_21") + self.lineEdit_22 = QtWidgets.QLineEdit(self.widget_2) + self.lineEdit_22.setGeometry(QtCore.QRect(460, 360, 81, 20)) + font = QtGui.QFont() + font.setPointSize(10) + self.lineEdit_22.setFont(font) + self.lineEdit_22.setStyleSheet("background-color: #ffffff") + self.lineEdit_22.setObjectName("lineEdit_22") + self.lineEdit_23 = QtWidgets.QLineEdit(self.widget_2) + self.lineEdit_23.setGeometry(QtCore.QRect(460, 390, 81, 20)) + font = QtGui.QFont() + font.setPointSize(10) + self.lineEdit_23.setFont(font) + self.lineEdit_23.setStyleSheet("background-color: #ffffff") + self.lineEdit_23.setObjectName("lineEdit_23") + self.pushButton_11 = QtWidgets.QPushButton(self.widget_2) + self.pushButton_11.setGeometry(QtCore.QRect(360, 270, 190, 23)) + self.pushButton_11.setStyleSheet("background-color: #ffffff") + self.pushButton_11.setObjectName("pushButton_11") + self.label_35 = QtWidgets.QLabel(self.widget_2) + self.label_35.setGeometry(QtCore.QRect(30, 270, 91, 21)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_35.setFont(font) + self.label_35.setObjectName("label_35") + self.lineEdit_24 = QtWidgets.QLineEdit(self.widget_2) + self.lineEdit_24.setGeometry(QtCore.QRect(580, 390, 101, 20)) + font = QtGui.QFont() + font.setPointSize(10) + self.lineEdit_24.setFont(font) + self.lineEdit_24.setStyleSheet("background-color: #ffffff") + self.lineEdit_24.setObjectName("lineEdit_24") + self.comboBox_11 = QtWidgets.QComboBox(self.widget_2) + self.comboBox_11.setGeometry(QtCore.QRect(40, 360, 140, 22)) + self.comboBox_11.setStyleSheet("background-color: #ffffff") + self.comboBox_11.setObjectName("comboBox_11") + self.comboBox_11.addItem("") + self.comboBox_11.addItem("") + self.comboBox_12 = QtWidgets.QComboBox(self.widget_2) + self.comboBox_12.setGeometry(QtCore.QRect(40, 390, 140, 22)) + self.comboBox_12.setStyleSheet("background-color: #ffffff") + self.comboBox_12.setObjectName("comboBox_12") + self.comboBox_12.addItem("") + self.comboBox_12.addItem("") + self.line_3 = QtWidgets.QFrame(self.widget_2) + self.line_3.setGeometry(QtCore.QRect(10, 250, 761, 16)) + self.line_3.setContextMenuPolicy(QtCore.Qt.DefaultContextMenu) + self.line_3.setFrameShadow(QtWidgets.QFrame.Sunken) + self.line_3.setLineWidth(2) + self.line_3.setMidLineWidth(2) + self.line_3.setFrameShape(QtWidgets.QFrame.HLine) + self.line_3.setObjectName("line_3") + self.line_4 = QtWidgets.QFrame(self.widget_2) + self.line_4.setGeometry(QtCore.QRect(10, 500, 761, 16)) + self.line_4.setContextMenuPolicy(QtCore.Qt.DefaultContextMenu) + self.line_4.setFrameShadow(QtWidgets.QFrame.Sunken) + self.line_4.setLineWidth(2) + self.line_4.setMidLineWidth(2) + self.line_4.setFrameShape(QtWidgets.QFrame.HLine) + self.line_4.setObjectName("line_4") + self.buttonBox = QtWidgets.QDialogButtonBox(self.widget_2) + self.buttonBox.setGeometry(QtCore.QRect(430, 580, 341, 32)) + self.buttonBox.setOrientation(QtCore.Qt.Horizontal) + self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Close|QtWidgets.QDialogButtonBox.Save) + self.buttonBox.setObjectName("buttonBox") + self.scrollArea = QtWidgets.QScrollArea(SuperStructure_Dialog) + self.scrollArea.setGeometry(QtCore.QRect(10, 40, 241, 681)) + self.scrollArea.setAutoFillBackground(False) + self.scrollArea.setStyleSheet("background-color: #fff9f9") + self.scrollArea.setWidgetResizable(True) + self.scrollArea.setObjectName("scrollArea") + self.scrollAreaWidgetContents_2 = QtWidgets.QWidget() + self.scrollAreaWidgetContents_2.setGeometry(QtCore.QRect(0, 0, 239, 679)) + self.scrollAreaWidgetContents_2.setObjectName("scrollAreaWidgetContents_2") + self.label_36 = QtWidgets.QLabel(self.scrollAreaWidgetContents_2) + self.label_36.setGeometry(QtCore.QRect(0, 0, 221, 31)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_36.setFont(font) + self.label_36.setStyleSheet("background-color: rgb(240,230,230)") + self.label_36.setAlignment(QtCore.Qt.AlignCenter) + self.label_36.setObjectName("label_36") + self.widget_3 = QtWidgets.QWidget(self.scrollAreaWidgetContents_2) + self.widget_3.setGeometry(QtCore.QRect(0, 30, 221, 357)) + self.widget_3.setStyleSheet("background-color: #fff9f9") + self.widget_3.setObjectName("widget_3") + self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.widget_3) + self.verticalLayout_2.setContentsMargins(0, 0, 0, 0) + self.verticalLayout_2.setObjectName("verticalLayout_2") + self.pushButton_24 = QtWidgets.QPushButton(self.widget_3) + font = QtGui.QFont() + font.setPointSize(10) + self.pushButton_24.setFont(font) + icon1 = QtGui.QIcon() + icon1.addPixmap(QtGui.QPixmap("C:\\Users\\saans\\AppData\\Local\\Programs\\Python\\Python310\\Lib\\site-packages\\qt5_applications\\Qt\\bin\\../../../../../../../../../../Downloads/play_arrow_filled.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) + icon1.addPixmap(QtGui.QPixmap("C:\\Users\\saans\\AppData\\Local\\Programs\\Python\\Python310\\Lib\\site-packages\\qt5_applications\\Qt\\bin\\../../../../../../../../../../Downloads/play_arrow_filled (1).png"), QtGui.QIcon.Normal, QtGui.QIcon.On) + self.pushButton_24.setIcon(icon1) + self.pushButton_24.setCheckable(True) + self.pushButton_24.setAutoDefault(True) + self.pushButton_24.setObjectName("pushButton_24") + self.verticalLayout_2.addWidget(self.pushButton_24) + self.widget_6 = QtWidgets.QWidget(self.widget_3) + self.widget_6.setObjectName("widget_6") + self.formLayout_2 = QtWidgets.QFormLayout(self.widget_6) + self.formLayout_2.setObjectName("formLayout_2") + self.pushButton_25 = QtWidgets.QPushButton(self.widget_6, clicked=lambda: self.openFoundationWindow()) + font = QtGui.QFont() + font.setPointSize(10) + font.setBold(False) + font.setWeight(50) + self.pushButton_25.setFont(font) + icon2 = QtGui.QIcon() + icon2.addPixmap(QtGui.QPixmap("C:\\Users\\saans\\AppData\\Local\\Programs\\Python\\Python310\\Lib\\site-packages\\qt5_applications\\Qt\\bin\\../../../../../../../../../../Downloads/play_arrow_filled.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) + self.pushButton_25.setIcon(icon2) + self.pushButton_25.setObjectName("pushButton_25") + self.formLayout_2.setWidget(0, QtWidgets.QFormLayout.LabelRole, self.pushButton_25) + self.pushButton_26 = QtWidgets.QPushButton(self.widget_6, clicked=lambda: self.openSuperStructureWindow()) + font = QtGui.QFont() + font.setPointSize(10) + font.setBold(False) + font.setWeight(50) + self.pushButton_26.setFont(font) + self.pushButton_26.setIcon(icon2) + self.pushButton_26.setObjectName("pushButton_26") + self.formLayout_2.setWidget(1, QtWidgets.QFormLayout.LabelRole, self.pushButton_26) + self.pushButton_27 = QtWidgets.QPushButton(self.widget_6, clicked=lambda: self.openSubStructureWindow()) + font = QtGui.QFont() + font.setPointSize(10) + font.setBold(False) + font.setWeight(50) + self.pushButton_27.setFont(font) + self.pushButton_27.setIcon(icon2) + self.pushButton_27.setObjectName("pushButton_27") + self.formLayout_2.setWidget(2, QtWidgets.QFormLayout.LabelRole, self.pushButton_27) + self.pushButton_28 = QtWidgets.QPushButton(self.widget_6, clicked=lambda: self.openMiscellaneousWindow()) + font = QtGui.QFont() + font.setPointSize(10) + font.setBold(False) + font.setWeight(50) + self.pushButton_28.setFont(font) + self.pushButton_28.setIcon(icon2) + self.pushButton_28.setObjectName("pushButton_28") + self.formLayout_2.setWidget(3, QtWidgets.QFormLayout.LabelRole, self.pushButton_28) + self.verticalLayout_2.addWidget(self.widget_6) + self.pushButton_29 = QtWidgets.QPushButton(self.widget_3, clicked=lambda: self.openFinancialWindow()) + font = QtGui.QFont() + font.setPointSize(10) + self.pushButton_29.setFont(font) + self.pushButton_29.setObjectName("pushButton_29") + self.verticalLayout_2.addWidget(self.pushButton_29) + self.pushButton_30 = QtWidgets.QPushButton(self.widget_3) + font = QtGui.QFont() + font.setPointSize(10) + self.pushButton_30.setFont(font) + self.pushButton_30.setIcon(icon1) + self.pushButton_30.setCheckable(True) + self.pushButton_30.setObjectName("pushButton_30") + self.verticalLayout_2.addWidget(self.pushButton_30) + self.widget_9 = QtWidgets.QWidget(self.widget_3) + self.widget_9.setMinimumSize(QtCore.QSize(203, 21)) + self.widget_9.setMaximumSize(QtCore.QSize(281, 21)) + self.widget_9.setObjectName("widget_9") + self.pushButton_31 = QtWidgets.QPushButton(self.widget_9, clicked=lambda: self.openCarbonEmissionWindow()) + self.pushButton_31.setGeometry(QtCore.QRect(20, 0, 183, 21)) + font = QtGui.QFont() + font.setPointSize(10) + font.setBold(False) + font.setWeight(50) + self.pushButton_31.setFont(font) + self.pushButton_31.setIcon(icon2) + self.pushButton_31.setObjectName("pushButton_31") + self.verticalLayout_2.addWidget(self.widget_9) + self.pushButton_32 = QtWidgets.QPushButton(self.widget_3, clicked=lambda: self.openBridgeTrafficWindow()) + font = QtGui.QFont() + font.setPointSize(10) + self.pushButton_32.setFont(font) + self.pushButton_32.setObjectName("pushButton_32") + self.verticalLayout_2.addWidget(self.pushButton_32) + self.pushButton_33 = QtWidgets.QPushButton(self.widget_3, clicked=lambda: self.openMaintenanceWindow()) + font = QtGui.QFont() + font.setPointSize(10) + self.pushButton_33.setFont(font) + self.pushButton_33.setObjectName("pushButton_33") + self.verticalLayout_2.addWidget(self.pushButton_33) + self.pushButton_12 = QtWidgets.QPushButton(self.widget_3, clicked=lambda: self.openDemolitionWindow()) + font = QtGui.QFont() + font.setPointSize(10) + self.pushButton_12.setFont(font) + self.pushButton_12.setObjectName("pushButton_12") + self.verticalLayout_2.addWidget(self.pushButton_12) + self.label_37 = QtWidgets.QLabel(self.scrollAreaWidgetContents_2) + self.label_37.setGeometry(QtCore.QRect(0, 387, 221, 31)) + font = QtGui.QFont() + font.setPointSize(10) + self.label_37.setFont(font) + self.label_37.setStyleSheet("background-color: rgb(240,230,230)") + self.label_37.setAlignment(QtCore.Qt.AlignCenter) + self.label_37.setObjectName("label_37") + self.textBrowser_2 = QtWidgets.QTextBrowser(self.scrollAreaWidgetContents_2) + self.textBrowser_2.setGeometry(QtCore.QRect(0, 418, 221, 221)) + self.textBrowser_2.setStyleSheet("background-color: #fff9f9") + self.textBrowser_2.setObjectName("textBrowser_2") + self.verticalScrollBar_2 = QtWidgets.QScrollBar(self.scrollAreaWidgetContents_2) + self.verticalScrollBar_2.setGeometry(QtCore.QRect(220, 0, 16, 641)) + self.verticalScrollBar_2.setStyleSheet("background-color: #F0F0F0") + self.verticalScrollBar_2.setOrientation(QtCore.Qt.Vertical) + self.verticalScrollBar_2.setObjectName("verticalScrollBar_2") + self.scrollArea.setWidget(self.scrollAreaWidgetContents_2) + self.pushButton = QtWidgets.QPushButton(SuperStructure_Dialog) + self.pushButton.setGeometry(QtCore.QRect(10, 10, 188, 25)) + font = QtGui.QFont() + font.setPointSize(10) + self.pushButton.setFont(font) + self.pushButton.setFocusPolicy(QtCore.Qt.StrongFocus) + self.pushButton.setLayoutDirection(QtCore.Qt.RightToLeft) + self.pushButton.setStyleSheet("background-color: rgb(240,230,230)") + self.pushButton.setIcon(icon) + self.pushButton.setAutoRepeat(False) + self.pushButton.setObjectName("pushButton") + + self.retranslateUi(SuperStructure_Dialog) + self.buttonBox.accepted.connect(self.handle_save) # type: ignore + self.buttonBox.rejected.connect(lambda: self.show_warning(SuperStructure_Dialog)) # type: ignore + QtCore.QMetaObject.connectSlotsByName(SuperStructure_Dialog) + + def show_warning(self, dialog): + """ + Show a warning window when the Close button is pressed. + """ + warning_box = QMessageBox() + warning_box.setIcon(QMessageBox.Warning) + warning_box.setWindowTitle("Confirm Close") + warning_box.setText("Are you sure you want to close without saving?") + warning_box.setStandardButtons(QMessageBox.Yes | QMessageBox.No) + warning_box.setDefaultButton(QMessageBox.No) + + # Check the user's response + response = warning_box.exec_() + if response == QMessageBox.Yes: + dialog.reject() # Close the application + else: + pass # Do nothing, return to the dialog + + def retranslateUi(self, SuperStructure_Dialog): + _translate = QtCore.QCoreApplication.translate + SuperStructure_Dialog.setWindowTitle(_translate("SuperStructure_Dialog", "Dialog")) + self.pushButton_6.setText(_translate("SuperStructure_Dialog", "Super-Structure ")) + self.label_20.setText(_translate("SuperStructure_Dialog", "Components:")) + self.comboBox_7.setItemText(0, _translate("SuperStructure_Dialog", "Deck")) + self.pushButton_7.setText(_translate("SuperStructure_Dialog", "+ Add Sub-Component")) + self.label_21.setText(_translate("SuperStructure_Dialog", "Material Type and Grade")) + self.label_22.setText(_translate("SuperStructure_Dialog", "Rate Data Source")) + self.label_23.setText(_translate("SuperStructure_Dialog", "Quantity")) + self.label_24.setText(_translate("SuperStructure_Dialog", "Unit")) + self.label_25.setText(_translate("SuperStructure_Dialog", "Rate")) + self.label_26.setText(_translate("SuperStructure_Dialog", "

m3

")) + self.label_27.setText(_translate("SuperStructure_Dialog", "kg")) + self.pushButton_8.setText(_translate("SuperStructure_Dialog", "+ Add Material")) + self.label_28.setText(_translate("SuperStructure_Dialog", "Material Type and Grade")) + self.comboBox_10.setItemText(0, _translate("SuperStructure_Dialog", "Cables")) + self.label_29.setText(_translate("SuperStructure_Dialog", "Rate")) + self.label_30.setText(_translate("SuperStructure_Dialog", "kg")) + self.label_31.setText(_translate("SuperStructure_Dialog", "Rate Data Source")) + self.label_32.setText(_translate("SuperStructure_Dialog", "

m3

")) + self.label_33.setText(_translate("SuperStructure_Dialog", "Unit")) + self.label_34.setText(_translate("SuperStructure_Dialog", "Quantity")) + self.pushButton_9.setText(_translate("SuperStructure_Dialog", "+ Add Material")) + self.pushButton_11.setText(_translate("SuperStructure_Dialog", "+ Add Sub-Component")) + self.label_35.setText(_translate("SuperStructure_Dialog", "Components:")) + self.comboBox_11.setItemText(0, _translate("SuperStructure_Dialog", "Concrete")) + self.comboBox_11.setItemText(1, _translate("SuperStructure_Dialog", "Steel")) + self.comboBox_12.setItemText(0, _translate("SuperStructure_Dialog", "Steel")) + self.comboBox_12.setItemText(1, _translate("SuperStructure_Dialog", "Concrete")) + self.label_36.setText(_translate("SuperStructure_Dialog", "Input Parameters")) + self.pushButton_24.setText(_translate("SuperStructure_Dialog", "Structure Works Data")) + self.pushButton_25.setText(_translate("SuperStructure_Dialog", "Foundation")) + self.pushButton_26.setText(_translate("SuperStructure_Dialog", "Super-Structure")) + self.pushButton_27.setText(_translate("SuperStructure_Dialog", "Sub-Structure")) + self.pushButton_28.setText(_translate("SuperStructure_Dialog", "Miscellaneous")) + self.pushButton_29.setText(_translate("SuperStructure_Dialog", "Financial Data")) + self.pushButton_30.setText(_translate("SuperStructure_Dialog", "Carbon Emission Data")) + self.pushButton_31.setText(_translate("SuperStructure_Dialog", "Carbon Emission Cost Data")) + self.pushButton_32.setText(_translate("SuperStructure_Dialog", "Bridge and Traffic Data")) + self.pushButton_33.setText(_translate("SuperStructure_Dialog", "Maintenance and Repair")) + self.pushButton_12.setText(_translate("SuperStructure_Dialog", "Disposal and Recycling")) + self.label_37.setText(_translate("SuperStructure_Dialog", "Output")) + self.textBrowser_2.setHtml(_translate("SuperStructure_Dialog", "\n" +"\n" +"

Initial Construction Cost

\n" +"

Initial Carbon emission Cost

\n" +"

Time Cost

\n" +"

Road User Cost

\n" +"

Carbon Emission due to Re-Routing

\n" +"

Periodic Maintenance Costs

\n" +"

Maintenance Emission Costs

\n" +"

Routine Inspectection Costs

\n" +"

Repair & Rehabilitation Costs

\n" +"

Reconstruction Costs

\n" +"

Demolition & Disposal Cost

\n" +"

Recycling Cost

\n" +"

Total Life-Cycle Cost

")) + self.pushButton.setText(_translate("SuperStructure_Dialog", "Project Details Window ")) + + def validate_data(self): + """Validate input data before saving""" + try: + # Validate all numeric fields + fields_to_validate = [ + self.lineEdit_13, self.lineEdit_14, self.lineEdit_15, + self.lineEdit_16, self.lineEdit_17, self.lineEdit_18, + self.lineEdit_19, self.lineEdit_20, self.lineEdit_21, + self.lineEdit_22, self.lineEdit_23, self.lineEdit_24 + ] + + for field in fields_to_validate: + if field.text(): # Only validate if field is not empty + float(field.text()) + + return True + + except ValueError: + QMessageBox.warning( + None, + "Validation Error", + "Please enter valid numbers in all numeric fields", + QMessageBox.Ok + ) + return False + + def save_data(self): + """Collect all input data and save it to a JSON file""" + if not self.validate_data(): + return False + + data = { + "deck": { + "component": self.comboBox_7.currentText(), + "materials": [ + { + "type_grade": self.comboBox_8.currentText(), + "quantity": self.lineEdit_13.text(), + "unit": self.label_26.text(), + "rate": self.lineEdit_15.text(), + "rate_source": self.lineEdit_17.text() + }, + { + "type_grade": self.comboBox_9.currentText(), + "quantity": self.lineEdit_14.text(), + "unit": self.label_27.text(), + "rate": self.lineEdit_16.text(), + "rate_source": self.lineEdit_18.text() + } + ] + }, + "cables": { + "component": self.comboBox_10.currentText(), + "materials": [ + { + "type_grade": self.comboBox_11.currentText(), + "quantity": self.lineEdit_21.text(), + "unit": self.label_32.text(), + "rate": self.lineEdit_22.text(), + "rate_source": self.lineEdit_20.text() + }, + { + "type_grade": self.comboBox_12.currentText(), + "quantity": self.lineEdit_19.text(), + "unit": self.label_30.text(), + "rate": self.lineEdit_23.text(), + "rate_source": self.lineEdit_24.text() + } + ] + } + } + + # Save to JSON file + try: + import json + from datetime import datetime + timestamp = datetime.now().strftime("%Y%m%d_%H%M%S") + filename = f"superstructure_data_{timestamp}.json" + + with open(filename, 'w') as f: + json.dump(data, f, indent=4) + + # Show success message + QMessageBox.information( + None, + "Success", + f"Super-structure data saved successfully to {filename}", + QMessageBox.Ok + ) + + return True + + except Exception as e: + QMessageBox.critical( + None, + "Error", + f"Failed to save data: {str(e)}", + QMessageBox.Ok + ) + return False + + def handle_save(self): + """Handle the save operation and close the dialog if successful""" + if self.save_data(): # Only close if save was successful + SuperStructure_Dialog.accept() + +if __name__ == "__main__": + import sys + app = QtWidgets.QApplication(sys.argv) + SuperStructure_Dialog = QtWidgets.QDialog() + ui = Ui_SuperStructure_Dialog() + ui.setupUi(SuperStructure_Dialog) + SuperStructure_Dialog.show() + sys.exit(app.exec_()) diff --git a/src/osbridgelcca/web_app/src/components/InputForm.jsx b/src/osbridgelcca/web_app/src_web/components/InputForm.jsx similarity index 100% rename from src/osbridgelcca/web_app/src/components/InputForm.jsx rename to src/osbridgelcca/web_app/src_web/components/InputForm.jsx diff --git a/src/osbridgelcca/web_app/src/components/ResultsView.jsx b/src/osbridgelcca/web_app/src_web/components/ResultsView.jsx similarity index 100% rename from src/osbridgelcca/web_app/src/components/ResultsView.jsx rename to src/osbridgelcca/web_app/src_web/components/ResultsView.jsx diff --git a/src/osbridgelcca/web_app/src/services/api.js b/src/osbridgelcca/web_app/src_web/services/api.js similarity index 100% rename from src/osbridgelcca/web_app/src/services/api.js rename to src/osbridgelcca/web_app/src_web/services/api.js diff --git a/tests/unit_tests/conftest.py b/tests/unit_tests/conftest.py index a0993b8..afb922a 100644 --- a/tests/unit_tests/conftest.py +++ b/tests/unit_tests/conftest.py @@ -1,12 +1,5 @@ -import pytest -from backend.main import app as flask_app +import sys +import os -@pytest.fixture -def client(): - """Flask test client""" - return flask_app.test_client() - -@pytest.fixture -def sample_cost_data(): - """Sample cost data for testing""" - return {"quantity": 100, "rate": 500} +# Add the src_web directory to sys.path +sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '../../src_web'))) diff --git a/tests/unit_tests/test_cost_components.py b/tests/unit_tests/test_cost_components.py new file mode 100644 index 0000000..9f0fc0b --- /dev/null +++ b/tests/unit_tests/test_cost_components.py @@ -0,0 +1,58 @@ +import pytest +from src.osbridgelcca.core.cost_components import ( + InitialConstructionCost, + InitialCarbonEmissionCost, + TimeCost, + RoadUserCost, + ReroutingCarbonEmissionCost, + PeriodicMaintenanceCost, + PeriodicMaintenanceCarbonCost, + RoutineInspectionCost, + RepairAndRehabilitationCost, + DemolitionCost, + RecyclingCost, +) + +def test_initial_construction_cost(): + cost = InitialConstructionCost(quantity=100, rate=50) + assert cost.calculate_cost() == 5000 + +def test_initial_carbon_emission_cost(): + cost = InitialCarbonEmissionCost(material_quantity=100, carbon_emission_factor=2, carbon_cost=10) + assert cost.calculate_cost() == 2000 + +def test_time_cost(): + cost = TimeCost(construction_cost=10000, interest_rate=0.05, construction_time=2, investment_ratio=0.8) + assert cost.calculate_cost() == 800.0 + +def test_road_user_cost(): + cost = RoadUserCost(vehicles_affected=1000, vehicle_operation_cost=2, construction_time=5) + assert cost.calculate_cost() == 10000 + +def test_additional_carbon_emission_cost(): + cost = ReroutingCarbonEmissionCost(vehicles_affected=1000, reroute_distance=10, co2_emission_per_km=0.5, carbon_cost=20) + assert cost.calculate_cost() == 100000.0 + +def test_periodic_maintenance_cost(): + cost = PeriodicMaintenanceCost(maintenance_cost_rate=0.02, construction_cost=100000, discount_rate=0.03, period=5, design_life=50) + assert cost.calculate_cost() > 0 # Ensure cost is calculated + +def test_periodic_maintenance_carbon_cost(): + cost = PeriodicMaintenanceCarbonCost(material_quantity=500, carbon_emission_factor=1.5, carbon_cost=20, discount_rate=0.03, period=5, design_life=50) + assert cost.calculate_cost() > 0 + +def test_routine_inspection_cost(): + cost = RoutineInspectionCost(quantity=10, rate=1000, discount_rate=0.03, design_life=50) + assert cost.calculate_cost() > 0 + +def test_repair_and_rehabilitation_cost(): + cost = RepairAndRehabilitationCost(repair_cost_rate=0.1, construction_cost=100000, discount_rate=0.03, period=10, design_life=50) + assert cost.calculate_cost() > 0 + +def test_demolition_cost(): + cost = DemolitionCost(demolition_rate=0.05, construction_cost=100000, discount_rate=0.03, design_life=50) + assert cost.calculate_cost() > 0 + +def test_recycling_cost(): + cost = RecyclingCost(scrap_value=1000, quantity=10, discount_rate=0.03, design_life=50) + assert cost.calculate_cost() > 0