Skip to content

Adds contrast tab to the project widget #63

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Apr 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,6 @@ extend-ignore-names = ['allKeys',
'showEvent',
'sizeHint',
'stepBy',
'supportedDropActions',
'textFromValue',
'valueFromText',]
'valueFromText',]
3 changes: 2 additions & 1 deletion rascal2/ui/view.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,8 @@ def setup_mdi(self):
def setup_mdi_widgets(self):
"""Performs setup of MDI widgets that relies on the Project existing."""
self.controls_widget.setup_controls()
self.project_widget.cancel_changes()
self.project_widget.update_project_view()
self.project_widget.show_project_view()
self.plot_widget.clear()
self.terminal_widget.clear()
self.terminal_widget.write_startup()
Expand Down
13 changes: 10 additions & 3 deletions rascal2/widgets/delegates.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,23 +113,30 @@ def setModelData(self, editor, model, index):
model.setData(index, data, QtCore.Qt.ItemDataRole.EditRole)


class ParametersDelegate(QtWidgets.QStyledItemDelegate):
class ProjectFieldDelegate(QtWidgets.QStyledItemDelegate):
"""Item delegate to choose from existing draft project parameters."""

def __init__(self, project_widget, parent, blank_option: bool = False):
def __init__(self, project_widget, field, parent, blank_option: bool = False):
super().__init__(parent)
self.field = field
self.project_widget = project_widget
self.blank_option = blank_option

def createEditor(self, parent, option, index):
widget = QtWidgets.QComboBox(parent)
parameters = self.project_widget.draft_project["parameters"]
parameters = self.project_widget.draft_project[self.field]
names = [p.name for p in parameters]
if self.blank_option:
names = [""] + names
widget.addItems(names)
widget.setCurrentText(index.data(QtCore.Qt.ItemDataRole.DisplayRole))

# make combobox searchable
widget.setEditable(True)
widget.setInsertPolicy(widget.InsertPolicy.NoInsert)
widget.setFrame(False)
widget.completer().setCompletionMode(QtWidgets.QCompleter.CompletionMode.PopupCompletion)

return widget

def setEditorData(self, editor: QtWidgets.QWidget, index):
Expand Down
Loading