From 6bc82fe4273e90efa180b7da652ff221da816231 Mon Sep 17 00:00:00 2001 From: Petter <pettsag@stud.ntnu.no> Date: Tue, 28 Apr 2020 01:07:18 +0200 Subject: [PATCH] #134 En del if-setninger til elif --- soitool/setup_settings.py | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/soitool/setup_settings.py b/soitool/setup_settings.py index d8b90fb..f186cba 100644 --- a/soitool/setup_settings.py +++ b/soitool/setup_settings.py @@ -158,7 +158,7 @@ class Setup(AcceptRejectDialog): # pylint: disable = R0902 self.layout_content.addLayout(self.layout_setup) - def accept(self): # pylint: disable = R0912 + def accept(self): """Save and update the SOI with the given changes. Overriden to implement custom behavior on accept, executes superclass' @@ -201,23 +201,19 @@ class Setup(AcceptRejectDialog): # pylint: disable = R0902 for i in self.group_algorithm_sort.findChildren(QRadioButton): if i.isChecked() and i.text() == "Ingen": property_changes["algorithm_sort"] = "none" - break - if i.isChecked() and i.text() == "Areal": + elif i.isChecked() and i.text() == "Areal": property_changes["algorithm_sort"] = "area" - break - if i.isChecked() and i.text() == "Bredde": + elif i.isChecked() and i.text() == "Bredde": property_changes["algorithm_sort"] = "width" - break - if i.isChecked() and i.text() == "Høyde": + elif i.isChecked() and i.text() == "Høyde": property_changes["algorithm_sort"] = "height" - break # Pass changes as unpacked variable list self.soi.update_properties(**property_changes) super().accept() - def get_from_soi(self): # pylint: disable = R0912 + def get_from_soi(self): """Get data from the SOI and update the dialog with the data.""" self.edit_title.setText(self.soi.title) self.edit_description.setText(self.soi.description) @@ -252,13 +248,9 @@ class Setup(AcceptRejectDialog): # pylint: disable = R0902 for i in self.group_algorithm_sort.findChildren(QRadioButton): if i.text() == "Ingen" and self.soi.algorithm_sort == "none": i.setChecked(True) - break - if i.text() == "Areal" and self.soi.algorithm_sort == "area": + elif i.text() == "Areal" and self.soi.algorithm_sort == "area": i.setChecked(True) - break - if i.text() == "Bredde" and self.soi.algorithm_sort == "width": + elif i.text() == "Bredde" and self.soi.algorithm_sort == "width": i.setChecked(True) - break - if i.text() == "Høyde" and self.soi.algorithm_sort == "height": + elif i.text() == "Høyde" and self.soi.algorithm_sort == "height": i.setChecked(True) - break -- GitLab