From 877a4b4118f3b3eca24f360d4fced36e19d8c98c Mon Sep 17 00:00:00 2001
From: Petter <pettsag@stud.ntnu.no>
Date: Tue, 24 Mar 2020 13:35:34 +0100
Subject: [PATCH] =?UTF-8?q?#46=20Docstrings=20ferdig,=20lagre/avbryt/hent?=
 =?UTF-8?q?=20ogs=C3=A5?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 soitool/setup_settings.py | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/soitool/setup_settings.py b/soitool/setup_settings.py
index 2a2ad84..0463e44 100644
--- a/soitool/setup_settings.py
+++ b/soitool/setup_settings.py
@@ -44,13 +44,13 @@ class Setup(QDialog):  # pylint: disable = R0902
         self.group_algorithm_pack = QGroupBox()
         self.group_algorithm_sort = QGroupBox()
 
-        # labels for headings
+        # labels for mainheadings
         self.label_header = QLabel("Headerdata")
         self.label_paper_orientation = QLabel("Papirretning")
         self.label_algorithm = QLabel("Plasseringsalgoritmer")
         self.label_module_placement = QLabel("Modulplassering")
 
-        # headerdata and edits
+        # headerdata
         self.layout_setup.addWidget(self.label_header)
         self.label_title = QLabel("Tittel:")
         self.label_description = QLabel("Beskrivelse:")
@@ -135,7 +135,7 @@ class Setup(QDialog):  # pylint: disable = R0902
         self.layout_setup.addWidget(self.group_algorithm_pack)
         self.layout_setup.addWidget(self.group_algorithm_sort)
 
-        # exit-buttons
+        # save and cancel
         self.button_cancel = QPushButton("Avbryt")
         self.button_save = QPushButton("Lagre")
         self.layout_buttons.addWidget(self.button_cancel)
@@ -148,10 +148,11 @@ class Setup(QDialog):  # pylint: disable = R0902
         self.button_save.clicked.connect(self.save)  # enter-key (default)
 
     def cancel(self):
+        """Close the dialog and nothing is saved."""
         self.reject()
 
     def save(self):
-        # data sendes fra oppsett og oppdaterer soi
+        """Save and update the SOI with the given changes."""
         self.soi.title = self.edit_title.text()
         self.soi.description = self.edit_description.text()
         self.soi.version = self.edit_version.text()
@@ -160,6 +161,7 @@ class Setup(QDialog):  # pylint: disable = R0902
         self.soi.valid_to = self.edit_valid_to.text()
         self.soi.classification = self.edit_classification.currentText()
 
+        # finds which radiobutton that is checked
         if self.rbutton_landscape.isChecked():
             self.soi.orientation = "landscape"
         else:
@@ -170,6 +172,7 @@ class Setup(QDialog):  # pylint: disable = R0902
         else:
             self.soi.placement_strategy = "manual"
 
+        # loops through groupbox to find checked radiobuttons
         for i in self.group_algorithm_bin.findChildren(QRadioButton):
             if i.isChecked():
                 self.soi.algorithm_bin = i.text()
@@ -185,7 +188,7 @@ class Setup(QDialog):  # pylint: disable = R0902
         self.accept()
 
     def get_from_soi(self):
-        # data hentes fra soi og settes inn i oppsett
+        """Get the data from the SOI and updates the dialog with the data."""
         self.edit_title.setText(self.soi.title)
         self.edit_description.setText(self.soi.description)
         self.edit_version.setText(self.soi.version)
-- 
GitLab