ProjectTab package

Project Tab Module

Project management tab with MVP architecture for CSV file editing and project tracking.

author:

Dipl.-Ing. (FH) Jonas Pfeiffer

class districtheatingsim.gui.ProjectTab.project_tab.ProjectModel[source]

Bases: object

Model for managing project data including CSV and GeoJSON file operations.

__init__()[source]
set_base_path(base_path)[source]

Set project base path.

Parameters:

base_path (str) – Project base path.

get_base_path()[source]

Get project base path.

Returns:

Current base path.

Return type:

str

load_csv(file_path)[source]

Load CSV file data.

Parameters:

file_path (str) – Path to CSV file.

Returns:

Headers and data lists.

Return type:

tuple

save_csv(file_path, headers, data)[source]

Save data to CSV file.

Parameters:
  • file_path (str) – Output file path.

  • headers (list) – Column headers.

  • data (list of lists) – Table data.

create_csv(file_path, headers, default_data)[source]

Create new CSV file with default data.

Parameters:
  • file_path (str) – Output file path.

  • headers (list) – Column headers.

  • default_data (list) – Default row data.

create_csv_from_geojson(geojson_file_path, output_file_path, default_values)[source]

Create CSV from GeoJSON data with default values.

Parameters:
  • geojson_file_path (str) – Input GeoJSON file path.

  • output_file_path (str) – Output CSV file path.

  • default_values (dict) – Default values for building parameters.

Returns:

Output file path.

Return type:

str

calculate_centroid(coordinates)[source]

Calculate centroid of coordinate array.

Parameters:

coordinates (list) – Coordinate array.

Returns:

Centroid coordinates (x, y).

Return type:

tuple

class districtheatingsim.gui.ProjectTab.project_tab.ProjectPresenter(model, view, folder_manager, data_manager, config_manager)[source]

Bases: object

Presenter managing interaction between ProjectModel and ProjectTabView.

__init__(model, view, folder_manager, data_manager, config_manager)[source]

Initialize project presenter.

Parameters:
connect_view_signals()[source]

Connect view signals after view is created.

on_variant_folder_changed(path)[source]

Handle project folder change.

Parameters:

path (str) – New project folder path.

on_tree_view_double_clicked(index)[source]

Handle double-click on file tree view.

Parameters:

index (QModelIndex) – Tree view index.

import_csv()[source]

Open file dialog to import existing CSV file.

load_csv(file_path)[source]

Load CSV file into table view.

Parameters:

file_path (str) – Path to CSV file.

save_csv(show_dialog=True)[source]

Save current table data to CSV file.

Parameters:

show_dialog (bool) – Show confirmation dialog if True.

add_row()[source]

Add new empty row to table.

del_row()[source]

Delete selected row from table.

create_csv(fname=None, show_dialog=True)[source]

Create new CSV file with default building data headers.

Parameters:
  • fname (str) – Optional file path.

  • show_dialog (bool) – Show file dialog if True.

create_csv_from_geojson()[source]

Create CSV from GeoJSON with user-defined building parameters.

on_geojson_conversion_progress(current, total, message)[source]

Handle progress updates from GeoJSON conversion thread.

Parameters:
  • current (int) – Current building number.

  • total (int) – Total number of buildings.

  • message (str) – Progress message.

on_geojson_conversion_done(output_file_path)[source]

Handle completion of GeoJSON conversion.

Parameters:

output_file_path (str) – Path to created CSV file.

on_geojson_conversion_error(error_message)[source]

Handle error during GeoJSON conversion.

Parameters:

error_message (str) – Error message.

geocode_current_csv()[source]

Geocode the currently loaded CSV file.

open_geocode_addresses_dialog()[source]

Open file dialog for geocoding CSV selection.

geocode_addresses(inputfilename)[source]

Start geocoding thread for address processing.

Parameters:

inputfilename (str) – Path to CSV file for geocoding.

on_geocode_done(fname)[source]

Handle geocoding completion.

Parameters:

fname (str) – Output filename.

on_geocode_error(error_message)[source]

Handle geocoding errors.

Parameters:

error_message (str) – Error message to display.

update_progress(progress, csv_status=None)[source]

Update progress bar value and CSV status label.

Parameters:
  • progress (float) – Progress percentage.

  • csv_status (str) – Status text for Quartier IST.csv.

check_csv_status(csv_file_path)[source]

Check detailed CSV status: missing, available without coordinates, or with coordinates.

Parameters:

csv_file_path (str) – Path to CSV file to check.

Returns:

Status: ‘fehlt’, ‘ist vorhanden’, or ‘mit Koordinaten’.

Return type:

str

check_network_dimensioned(network_file_path)[source]

Check if network GeoJSON has state set to “dimensioned”.

Parameters:

network_file_path (str) – Path to Wärmenetz.geojson file.

Returns:

True if network is dimensioned, False otherwise.

Return type:

bool

update_progress_tracker()[source]

Update project progress and CSV status label based on file existence and content.

class districtheatingsim.gui.ProjectTab.project_tab.ProjectTabView(presenter=None, parent=None)[source]

Bases: QWidget

View component for project tab UI with file browser and CSV editor.

__init__(presenter=None, parent=None)[source]

Initialize project tab view.

Parameters:
  • presenter (ProjectPresenter) – Presenter instance for signal connections.

  • parent (QWidget) – Parent widget.

initUI()[source]

Initialize user interface components.

update_tree_view(path)[source]

Update file tree view root path.

Parameters:

path (str) – New root path.

show_context_menu(position)[source]

Show table context menu.

Parameters:

position (QPoint) – Menu position.

add_row()[source]

Add new table row with input dialog.

delete_row()[source]

Delete selected table row.

duplicate_row()[source]

Duplicate selected table row.

get_selected_file_path(index)[source]

Get selected file path from tree view.

Parameters:

index (QModelIndex) – Tree view index.

Returns:

Selected file path.

Return type:

str

show_error_message(title, message)[source]

Display error message dialog.

Parameters:
  • title (str) – Dialog title.

  • message (str) – Error message.

update_progress(progress, csv_status=None)[source]

Update progress bar value and CSV status label with color-coded status.

Parameters:
  • progress (float) – Progress percentage.

  • csv_status (str) – Status text for Quartier IST.csv.

showDetailsDialog()[source]

Show process step details dialog.

set_process_steps(process_steps)[source]

Set process steps data for details dialog.

Parameters:

process_steps (list) – List of process step dictionaries.

show_message(title, message)[source]

Display information message dialog.

Parameters:
  • title (str) – Dialog title.

  • message (str) – Information message.

class districtheatingsim.gui.ProjectTab.project_tab.ProjectTab(folder_manager, data_manager, config_manager, parent=None)[source]

Bases: QMainWindow

Main project tab window integrating MVP components.

Note

Central interface for project management with file operations and progress tracking functionality.

__init__(folder_manager, data_manager, config_manager, parent=None)[source]

Initialize project tab with MVP architecture.

Parameters:
  • folder_manager (object) – Folder manager.

  • data_manager (object) – Data manager.

  • config_manager (object) – Configuration manager.

  • parent (QWidget) – Parent widget.

Project Tab Dialogs Module

Dialog windows for project tab functionality including data input and progress display.

author:

Dipl.-Ing. (FH) Jonas Pfeiffer

class districtheatingsim.gui.ProjectTab.project_tab_dialogs.RowInputDialog(headers, parent=None)[source]

Bases: QDialog

Dialog for adding new table rows with input fields.

__init__(headers, parent=None)[source]

Initialize row input dialog.

Parameters:
  • headers (list) – Column headers for input fields.

  • parent (QWidget) – Parent widget.

get_input_data()[source]

Get input data from dialog fields.

Returns:

Mapping of headers to input values.

Return type:

dict

class districtheatingsim.gui.ProjectTab.project_tab_dialogs.OSMImportDialog(parent=None, sample_utm_coords=None)[source]

Bases: QDialog

Dialog for OSM data import with default building parameters.

__init__(parent=None, sample_utm_coords=None)[source]

Initialize OSM import dialog.

Parameters:
  • parent (QWidget) – Parent widget.

  • sample_utm_coords (tuple) – Sample (UTM_X, UTM_Y) coordinates for reverse geocoding.

get_input_data()[source]

Get OSM import parameters.

Returns:

Mapping of parameters to input values.

Return type:

dict

class districtheatingsim.gui.ProjectTab.project_tab_dialogs.ProcessDetailsDialog(process_steps, parent=None)[source]

Bases: QDialog

Dialog displaying detailed project progress information.

__init__(process_steps, parent=None)[source]

Initialize process details dialog.

Parameters:
  • process_steps (list) – List of process step dictionaries with progress info.

  • parent (QWidget) – Parent widget.

get_step_progress(step)[source]

Calculate step completion percentage based on required files.

Parameters:

step (dict) – Process step information.

Returns:

Completion percentage (0-100).

Return type:

float

get_status_text(status)[source]

Get human-readable status text.

Parameters:

status (str) – Status code.

Returns:

Human-readable status text.

Return type:

str

get_status_color(status)[source]

Get color for status display.

Parameters:

status (str) – Status code.

Returns:

CSS color value.

Return type:

str

class districtheatingsim.gui.ProjectTab.project_tab_dialogs.BuildingCSVDialog(headers, data=None, parent=None)[source]

Bases: QDialog

Dialog for tabular input and editing of Quartier IST.csv building data.

__init__(headers, data=None, parent=None)[source]

Initialize dialog for building CSV creation/editing.

Parameters:
  • headers (list) – Column headers for table.

  • data (list of lists) – Initial table data.

  • parent (QWidget) – Parent widget.

initUI()[source]

Initialize user interface components.

add_row()[source]

Add new row to table.

del_row()[source]

Delete selected row from table.

get_table_data()[source]

Get table data as list of lists.

Returns:

Table data.

Return type:

list of lists