Exemplo n.º 1
0
    def apply(self, frame_item, composerWrapper, fromTemplate=False):

        if not isinstance(frame_item, QgsComposerFrame):
            return

        table_item = frame_item.multiFrame()
        #Get the table editor widget and configure widgets
        table_editor = composerWrapper.itemDock().widget()

        if not table_editor is None:
            self._configure_table_editor_properties(table_editor)

        if not fromTemplate:
            table_item.setComposerMap(None)
            text = '     Choose the data source of the table and ' \
                   'the link columns in the STDM item properties.'
            table_text = QApplication.translate('TabelFormatter', text)
            default_column = QgsComposerTableColumn(table_text)

            table_item.setColumns([default_column])

            #Create data properties editor and it to the dock widget
            table_data_source_editor = ComposerTableDataSourceEditor(
                composerWrapper, table_item)
            stdmDock = composerWrapper.stdmItemDock()
            stdmDock.setWidget(table_data_source_editor)

            #Add widget to the composer wrapper widget mapping collection
            composerWrapper.addWidgetMapping(frame_item.uuid(),
                                             table_data_source_editor)

            #Set ID to match UUID
            frame_item.setId(frame_item.uuid())
Exemplo n.º 2
0
    def _configure_table_editors(self, table_config_collection):
        """
        Creates widgets for editing table data sources.
        :param table_config_collection: TableConfigurationCollection instance.
        :type table_config_collection: TableConfigurationCollection
        """
        if self.stdmDataSourceDock().widget() is None:
            return

        for item_id, table_config in table_config_collection.mapping().iteritems():
            table_item = self.composition().getComposerItemById(item_id)

            if not table_item is None:
                table_editor = ComposerTableDataSourceEditor(self, table_item, self.composerView())
                table_editor.set_configuration(table_config)

                self.addWidgetMapping(table_item.uuid(), table_editor)
Exemplo n.º 3
0
    def _configure_table_editors(self, table_config_collection):
        """
        Creates widgets for editing table data sources.
        :param table_config_collection: TableConfigurationCollection instance.
        :type table_config_collection: TableConfigurationCollection
        """
        if self.stdmDataSourceDock().widget() is None:
            return

        for item_id, table_config in table_config_collection.mapping(
        ).iteritems():
            table_item = self.composition().getComposerItemById(item_id)

            if not table_item is None:
                table_editor = ComposerTableDataSourceEditor(
                    self, table_item, self.composerView())
                table_editor.set_configuration(table_config)

                self.addWidgetMapping(table_item.uuid(), table_editor)
Exemplo n.º 4
0
    def apply(self, frame_item, composerWrapper, fromTemplate=False):

        frame_item.blockSignals(True)

        if not isinstance(frame_item, QgsComposerFrame):
            return

        table_item = frame_item.multiFrame()
        #Get the table editor widget and configure widgets
        table_editor = composerWrapper.itemDock().widget()

        if table_editor is not None:
            self._configure_table_editor_properties(table_editor)

        if not fromTemplate:
            table_item.setComposerMap(None)
            text = '     Choose the data source of the table and ' \
                   'the link columns in the STDM item properties.'
            table_text = QApplication.translate('TabelFormatter', text)
            default_column = QgsComposerTableColumn(table_text)

            table_item.setColumns([default_column])

            #Create data properties editor and add it to the dock widget
            table_data_source_editor = ComposerTableDataSourceEditor(
                composerWrapper, table_item)

            ############################################################################################
            table_data_source_editor.ref_table.cbo_ref_table.currentIndexChanged[
                str].connect(table_data_source_editor.set_table_vector_layer)

            if composerWrapper.current_ref_table_index == -1:
                layer_name = self._current_layer_name(table_editor)
                idx = table_data_source_editor.ref_table.cbo_ref_table.findText(
                    layer_name)
                table_data_source_editor.ref_table.cbo_ref_table.setCurrentIndex(
                    idx)

            ############################################################################################

            stdmDock = composerWrapper.stdmItemDock()
            stdmDock.setWidget(table_data_source_editor)

            #Add widget to the composer wrapper widget mapping collection
            composerWrapper.addWidgetMapping(frame_item.uuid(),
                                             table_data_source_editor)

            #Set ID to match UUID
            frame_item.setId(frame_item.uuid())
Exemplo n.º 5
0
    def apply(self, table_item, composerWrapper, fromTemplate=False):
        if not isinstance(table_item, QgsComposerAttributeTable):
            return

        #Get the table editor widget and configure widgets
        table_editor = composerWrapper.itemDock().widget()
        if not table_editor is None:
            self._configure_table_editor_properties(table_editor)

        if not fromTemplate:
            table_item.setComposerMap(None)
            #Create data properties editor and it to the dock widget
            table_data_source_editor = ComposerTableDataSourceEditor(
                composerWrapper, table_item)
            stdmDock = composerWrapper.stdmItemDock()
            stdmDock.setWidget(table_data_source_editor)

            #Add widget to the composer wrapper widget mapping collection
            composerWrapper.addWidgetMapping(table_item.uuid(),
                                             table_data_source_editor)

        #Set ID to match UUID
        table_item.setId(table_item.uuid())