Skip to content

Commit

Permalink
doc doc doc
Browse files Browse the repository at this point in the history
  • Loading branch information
JoschD committed Nov 17, 2023
1 parent 32020a6 commit d716aa3
Show file tree
Hide file tree
Showing 4 changed files with 195 additions and 106 deletions.
6 changes: 3 additions & 3 deletions omc3_gui/segment_by_segment/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def connect_signals(self):

@Slot()
def open_measurements(self):
LOGGER.debug("OpenButton Clicked. Asking for folder paths.")
LOGGER.debug("Opening new optics measurement. Asking for folder paths.")
filenames = OpenDirectoriesDialog(
parent=self._view,
caption="Select Optics Folders",
Expand All @@ -48,7 +48,7 @@ def open_measurements(self):
LOGGER.debug(f"User selected {len(filenames)} files.")
for filename in filenames:
self._last_selected_optics_path = filename.parent
LOGGER.debug(f"User selected: {filename}")
LOGGER.debug(f"adding: {filename}")
optics_measurement = OpticsMeasurement.from_path(filename)
try:
loaded_measurements.add_item(optics_measurement)
Expand All @@ -57,7 +57,7 @@ def open_measurements(self):

@Slot(OpticsMeasurement)
def edit_measurement(self, measurement: OpticsMeasurement):
LOGGER.debug("EditButton Clicked. Opening edit dialog.")
LOGGER.debug(f"Opening edit dialog for {measurement.display()}.")
dialog = OpticsMeasurementDialog(
parent=self._view,
optics_measurement=measurement,
Expand Down
2 changes: 1 addition & 1 deletion omc3_gui/segment_by_segment/measurement_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def display(self) -> str:
@classmethod
def get_label(cls, name: str) -> str:
try:
return cls.__dataclass_fields__[name].metadata["display"]
return cls.__dataclass_fields__[name].metadata["label"]
except KeyError:
return name

Expand Down
30 changes: 15 additions & 15 deletions omc3_gui/segment_by_segment/measurement_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from qtpy import QtWidgets

from omc3_gui.segment_by_segment.measurement_model import OpticsMeasurement
from omc3_gui.utils.dataclass_ui import DataClassUI, FieldUIDef, dataclass_ui_builder
from omc3_gui.utils.dataclass_ui import DataClassUI, FieldUIDef

TO_BE_DEFINED = Path("to_be_defined")

Expand Down Expand Up @@ -33,19 +33,19 @@ def __init__(self, parent=None, optics_measurement: OpticsMeasurement = None):
def _set_size(self, width: int = -1, height: int = -1):
# Set position to the center of the parent
parent = self.parent()
if parent is not None:
parent_geo = parent.geometry()
parent_pos = parent.mapToGlobal(parent.pos()) # multiscreen support
if width >= 0:
x = parent_pos.x() + parent_geo.width() / 2
else:
x = parent_pos.x() + (parent_geo.width() - width) / 2

if height >=0 :
y = parent_pos.y() + parent_geo.height() / 2
else:
y = parent_pos.y() + (parent_geo.height() - height) / 2
self.move(x, y)
# if parent is not None:
# parent_geo = parent.geometry()
# parent_pos = parent.mapToGlobal(parent.pos()) # multiscreen support
# if width >= 0:
# x = parent_pos.x() + parent_geo.width() / 2
# else:
# x = parent_pos.x() + (parent_geo.width() - width) / 2

# if height >=0 :
# y = parent_pos.y() + parent_geo.height() / 2
# else:
# y = parent_pos.y() + (parent_geo.height() - height) / 2
# self.move(x, y)

# Set size
self.resize(width, height)
Expand All @@ -58,7 +58,7 @@ def _build_gui(self):
# A little bit of coupling to the model here,
# so if field-names change or are added this needs to be adjusted.
# But it makes more sense to have this list here than in the model.
self._dataclass_ui = dataclass_ui_builder(
self._dataclass_ui = DataClassUI.build_dataclass_ui(
field_def=[
FieldUIDef(name="measurement_dir", editable=False),
*(FieldUIDef(name) for name in ("output_dir", "accel", "beam", "year", "ring"))
Expand Down
Loading

0 comments on commit d716aa3

Please sign in to comment.