def setSectionSize(self, section):
     if self.isLinacSection:
         defaultSize = SettingsCloud.getParameter("linacSubsectionSize")
     else:
         defaultSize = SettingsCloud.getParameter("ringSubsectionSize")
     section.sizeEdit.setValue(defaultSize)
     self.updateSumOfSize(section)
 def setSectionSize(self, section):
     if self.isLinacSection:
         defaultSize = SettingsCloud.getParameter("linacSubsectionSize")
     else:
         defaultSize = SettingsCloud.getParameter("ringSubsectionSize")
     section.sizeEdit.setValue(defaultSize)
     self.updateSumOfSize(section)
 def setSectionColor(self, section):
     firstColor = SettingsCloud.getParameter("subsectionFirstColor")
     secondColor = SettingsCloud.getParameter("subsectionSecondColor")
     if subsectionContainerWidget.lastSectionColor == secondColor:
         section.colorLabel.setColor(firstColor)
         subsectionContainerWidget.lastSectionColor = firstColor
     else:
         section.colorLabel.setColor(secondColor)
         subsectionContainerWidget.lastSectionColor = secondColor
 def setSectionColor(self, section):
     firstColor = SettingsCloud.getParameter("sectionFirstColor")
     secondColor = SettingsCloud.getParameter("sectionSecondColor")
     if SectionWidget.lastSectionColor == secondColor:
         section.setColor(firstColor)
         SectionWidget.lastSectionColor = firstColor
     else:
         section.setColor(secondColor)
         SectionWidget.lastSectionColor = secondColor
 def setSectionColor(self, section):
     firstColor = SettingsCloud.getParameter("sectionFirstColor")
     secondColor = SettingsCloud.getParameter("sectionSecondColor")
     if SectionWidget.lastSectionColor == secondColor:
         section.setColor(firstColor)
         SectionWidget.lastSectionColor = firstColor
     else:
         section.setColor(secondColor)
         SectionWidget.lastSectionColor = secondColor
 def setSectionColor(self, section):
     firstColor = SettingsCloud.getParameter("subsectionFirstColor")
     secondColor = SettingsCloud.getParameter("subsectionSecondColor")
     if subsectionContainerWidget.lastSectionColor == secondColor:
         section.colorLabel.setColor(firstColor)
         subsectionContainerWidget.lastSectionColor = firstColor
     else:
         section.colorLabel.setColor(secondColor)
         subsectionContainerWidget.lastSectionColor = secondColor
    def saveSettings(self):
        sectionFirstColor = str(self.sectionColorChooser.getSelectedColor())
        sectionSecondColor = str(
            self.sectionSecondColorChooser.getSelectedColor())
        subsectionColor = str(self.subsectionColorChooser.getSelectedColor())
        subsectionSecondColor = str(
            self.subsectionSecondColorChooser.getSelectedColor())
        linacSectionSize = float(self.linacSectionSizeSpinBox.value())
        linacSubsectionSize = float(self.linacSubsectionSizeSpinBox.value())
        ringSectionSize = float(self.ringSectionSizeSpinBox.value())
        ringSubsectionSize = float(self.ringSubsectionSizeSpinBox.value())
        centerCoordinateX = float(self.centerCoordinatesEditX.text())
        centerCoordinateY = float(self.centerCoordinatesEditY.text())
        deviceCaptions = bool(self.showDeviceCaptionsCheckBox.isChecked())
        parametersFromDb = bool(self.useDbParametersCheckBox.isChecked())
        tangoHost = str(self.tangoHostEdit.text())

        SettingsCloud.setParameter("sectionFirstColor", sectionFirstColor)
        SettingsCloud.setParameter("sectionSecondColor", sectionSecondColor)
        SettingsCloud.setParameter("subsectionFirstColor", subsectionColor)
        SettingsCloud.setParameter("subsectionSecondColor",
                                   subsectionSecondColor)
        SettingsCloud.setParameter("linacSectionSize", linacSectionSize)
        SettingsCloud.setParameter("linacSubsectionSize", linacSubsectionSize)
        SettingsCloud.setParameter("ringSectionSize", ringSectionSize)
        SettingsCloud.setParameter("ringSubsectionSize", ringSubsectionSize)
        SettingsCloud.setParameter("centerCoordinateX", centerCoordinateX)
        SettingsCloud.setParameter("centerCoordinateY", centerCoordinateY)
        SettingsCloud.setParameter("deviceCaptions", deviceCaptions)
        SettingsCloud.setParameter("parameterFromDb", parametersFromDb)
        TangoDeviceManager.setTangoDatabaseAddress(tangoHost)
 def setUp(self):
     SettingsCloud.resetSettings()
 def tearDown(self):
     SettingsCloud.resetSettings()
 def testUpdateSettings(self):
     SettingsCloud.setParameter("size", "20")
     self.assertEqual(SettingsCloud.getParameter("size"), "20")
     SettingsCloud.setParameter("size", "153")
     self.assertEqual(SettingsCloud.getParameter("size"), "153")
 def testClearSettings(self):
     self.assertEqual(SettingsCloud.getParameter("color"), None)
     SettingsCloud.setParameter("color", "green")
     self.assertEqual(SettingsCloud.getParameter("color"), "green")
     SettingsCloud.resetSettings()
     self.assertEqual(SettingsCloud.getParameter("color"), None)
 def testSetGetValue(self):
     color = "red"
     SettingsCloud.setParameter("color", color)
     self.assertEqual(SettingsCloud.getParameter("color"), "red")
     self.assertEqual(SettingsCloud.getParameter("colour"), None)