Skip to content
Snippets Groups Projects
Commit 6bc82fe4 authored by Petter Sagvold's avatar Petter Sagvold
Browse files

#134 En del if-setninger til elif

parent 77f07e73
No related branches found
No related tags found
1 merge request!76#134 Sort endret i oppsett
Pipeline #83563 failed
......@@ -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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment