Beispiel #1
0
    def exec(self):
        """
        Execute the dialog. This method sets everything back to its initial
        values.
        """
        self.import_as_new_button.setEnabled(False)
        self.update_existing_button.setEnabled(False)
        # check our credentials and connection to the PlanningCenter server
        organization = self.planning_center_api.check_credentials()
        if len(organization) == 0:
            QtWidgets.QMessageBox.warning(
                self.parent(), "Authentication Failed",
                "Authentiation Failed.  Check your \
                credentials in OpenLP Settings", QtWidgets.QMessageBox.Ok)
            return
        # set the Service Type Dropdown Box from PCO
        service_types_list = self.planning_center_api.get_service_type_list()
        self.service_type_combo_box.clear()
        for service_type in service_types_list:
            self.service_type_combo_box.addItem(
                service_type['attributes']['name'], service_type['id'])
        self.service_type_combo_box.setCurrentIndex(0)
        self.on_plan_selection_combobox_changed()
        # Set the 2 lists of themes
        theme_manager = Registry().get('theme_manager')
        for theme in theme_manager.get_theme_names():
            self.song_theme_selection_combo_box.addItem(theme)
            self.slide_theme_selection_combo_box.addItem(theme)

        return QtWidgets.QDialog.exec(self)