def __onPresetComboBoxCurrentIndexChanged(self, widget): presets = PresetManager().getPresets() try: preset = presets.getByIndex(self._view.presetComboBox.currentIndex()) self._model.preset.name = preset.getName() self.refreshView() except ValueError: Logger().exception("MainController.__onPresetComboBoxCurrentIndexChanged()", debug=True) pass
def refreshView(self): if self._model.mode == 'mosaic': self._view.tabWidget.setCurrentIndex(0) self._refreshMosaicPage() else: self._view.tabWidget.setCurrentIndex(1) flag = self._model.cameraOrientation != 'custom' and self._model.camera.lens.type_ != 'fisheye' self._view.tabWidget.setTabEnabled(0, flag) presets = PresetManager().getPresets() try: index = presets.nameToIndex(self._model.preset.name) except ValueError: Logger().warning("Previously selected '%s' preset not found" % self._model.preset.name) index = 0 self._model.preset.name = presets.getByIndex(index).getName() self._view.presetComboBox.setCurrentIndex(index) self._view.presetInfoPlainTextEdit.clear() preset = presets.getByIndex(index) tooltip = preset.getTooltip() self._view.presetInfoPlainTextEdit.setPlainText(tooltip) self._view.yawHeadPosLabel.setText("%.1f" % self.__yawPos) self._view.pitchHeadPosLabel.setText("%.1f" % self.__pitchPos)
def __populatePresetComboBox(self): """ Populate the preset combo box. """ self._view.presetComboBox.clear() presets = PresetManager().getPresets() i = 0 while True: try: preset = presets.getByIndex(i) name = preset.getName() self._view.presetComboBox.addItem(name) i += 1 except ValueError: #Logger().exception("MainController.__populatePresetComboBox()", debug=True) break