-
Notifications
You must be signed in to change notification settings - Fork 110
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
60 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
from .disk_space_widget import DiskSpaceWidget | ||
from .progress_widget import ProgressWidget | ||
from .realization import RealizationWidget | ||
from .update import UpdateWidget | ||
|
||
__all__ = ["ProgressWidget", "RealizationWidget", "UpdateWidget"] | ||
__all__ = ["DiskSpaceWidget", "ProgressWidget", "RealizationWidget", "UpdateWidget"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
from qtpy.QtCore import Qt | ||
from qtpy.QtWidgets import QHBoxLayout, QLabel, QProgressBar, QWidget | ||
|
||
from ert.shared.status.utils import disk_space_status | ||
|
||
|
||
class DiskSpaceWidget(QWidget): | ||
def __init__(self, parent=None): | ||
super().__init__(parent) | ||
|
||
layout = QHBoxLayout(self) | ||
layout.setContentsMargins(0, 0, 0, 0) | ||
layout.setSpacing(10) | ||
|
||
# Text label | ||
self.label = QLabel(self) | ||
|
||
# Progress bar | ||
self.progress_bar = QProgressBar(self) | ||
self.progress_bar.setRange(0, 100) | ||
self.progress_bar.setTextVisible(True) | ||
self.progress_bar.setFixedWidth(100) | ||
self.progress_bar.setAlignment(Qt.AlignCenter) | ||
|
||
# Add color styling based on usage | ||
self.progress_bar.setStyleSheet(""" | ||
QProgressBar { | ||
border: 1px solid #ccc; | ||
border-radius: 2px; | ||
text-align: center; | ||
} | ||
QProgressBar::chunk { | ||
background-color: qlineargradient( | ||
x1: 0, y1: 0.5, x2: 1, y2: 0.5, | ||
stop: 0 #2ecc71, | ||
stop: 0.7 #f1c40f, | ||
stop: 0.9 #e74c3c | ||
); | ||
} | ||
""") | ||
|
||
layout.addWidget(self.label) | ||
layout.addWidget(self.progress_bar) | ||
|
||
def update_status(self, run_path_mp): | ||
"""Update both the label and progress bar with current disk usage""" | ||
disk_usage = disk_space_status(run_path_mp) | ||
if disk_usage is not None: | ||
self.label.setText("Disk space used runpath:") | ||
self.progress_bar.setValue(int(disk_usage)) | ||
self.progress_bar.setFormat(f"{disk_usage:.1f}%") | ||
self.setVisible(True) | ||
else: | ||
self.setVisible(False) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters