Esempio n. 1
0
    def __init__(self, rows, columns):

        QWidget.__init__(self)

        self.table = QTableWidget(rows, columns, self)

        for column in range(columns):

            for row in range(rows):

                item = QTableWidgetItem('Text%d' % row)

                if row % 2:

                    item.setFlags(Qt.ItemIsUserCheckable | Qt.ItemIsEnabled)

                    item.setCheckState(Qt.Unchecked)

                self.table.setItem(row, column, item)

        self.table.itemClicked.connect(self.handleItemClicked)

        layout = QVBoxLayout(self)

        layout.addWidget(self.table)

        self._list = []
Esempio n. 2
0
    def clear_table(self):

        self.need_to_update_graph = False
        for r in range(self.table.rowCount()):
            self.table.setItem(r, 0, QTableWidgetItem(None))
            self.table.setItem(r, 1, QTableWidgetItem(None))

        for row in range(self.rows_nr):
            for col in range(self.cols_nr):
                if self.edit_type == self.edit_patterns:
                    if col == 0:
                        item = QTableWidgetItem(str(row))
                        self.table.setItem(row, col, item)
                        item.setFlags(QtCore.Qt.ItemIsSelectable)
                    # elif col == 1 and row == 0:
                    #     item = QTableWidgetItem(str(1))
                    #     self.table.setItem(row, col, item)
                    #     item.setFlags(QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)

                # elif self.edit_type == self.edit_curves:
                # if row == 0:
                # item = QTableWidgetItem(str(0))
                # self.table.setItem(row, 0, item)
                # item = QTableWidgetItem(str(1))
                # self.table.setItem(row, 1, item)
                # item.setFlags(QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
        self.need_to_update_graph = True
Esempio n. 3
0
    def setTableContent(self):
        params = self._alg.parameters
        outputs = self._alg.outputs
        visibleParams = [p for p in params if not p.hidden]
        visibleOutputs = [p for o in outputs if not o.hidden]
        self.tableWidget.setRowCount(len(visibleParams) + len(visibleOutputs))

        for i, param in visibleParams:
            item = QTableWidgetItem(param.description)
            item.setFlags(Qt.ItemIsEnabled)
            self.tableWidget.setItem(i, 0, item)
            item = self.getWidgetFromParameter(param)
            self.valueItems[param.name] = item
            self.tableWidget.setCellWidget(i, 1, item)
            self.tableWidget.setRowHeight(i, 22)

        for i, output in visibleOutputs:
            item = QTableWidgetItem(output.description + '<'
                                    + output.__module__.split('.')[-1] + '>')
            item.setFlags(Qt.ItemIsEnabled)
            self.tableWidget.setItem(i, 0, item)
            item = QLineEdit()
            if hasattr(item, 'setPlaceholderText'):
                item.setPlaceholderText(ModelerParametersDialog.ENTER_NAME)
            self.valueItems[output.name] = item
            self.tableWidget.setCellWidget(i, 1, item)
            self.tableWidget.setRowHeight(i, 22)
Esempio n. 4
0
    def _refresh_defects_list(self):
        if self.layer is None:
            return
        self._clear_defects_list()

        excluded_fields = self._get_excluded_columns_list()

        fields = []
        for f in self.layer.fields():
            if not f.name() in excluded_fields:
                fields.append(f.name())

        labels = [self.layer.attributeAlias(i) for i in range(len(fields))]
        self.defects_list.setColumnCount(len(fields))
        self.defects_list.setHorizontalHeaderLabels(labels)

        row = 0
        for feature in self._get_features():
            self.defects_list.insertRow(row)
            column = 0
            for field in fields:
                if type(feature[field]) is QDateTime:
                    item = QTableWidgetItem(feature[field].toString())
                elif type(feature[field]) is long \
                        or type(feature[field]) is int:
                    item = QCustomTableWidgetItem(str(feature[field]))
                else:
                    item = QTableWidgetItem(str(feature[field]))
                item.setData(Qt.UserRole, feature.id())
                item.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)
                self.defects_list.setItem(row, column, item)
                column += 1
            row += 1
        self.defects_list.resizeColumnsToContents()
Esempio n. 5
0
    def setTableContent(self):
        numOutputs = 0
        for output in self.alg.outputs:
            if isinstance(output, (OutputVector, OutputRaster)):
                if not output.flags() & QgsProcessingParameterDefinition.FlagHidden:
                    numOutputs += 1
        self.tblStyles.setRowCount(numOutputs)

        i = 0
        for output in self.alg.outputs:
            if isinstance(output, (OutputVector, OutputRaster)):
                if not output.flags() & QgsProcessingParameterDefinition.FlagHidden:
                    item = QTableWidgetItem(output.description() + '<' +
                                            output.__class__.__name__ + '>')
                    item.setFlags(Qt.ItemIsEnabled)
                    self.tblStyles.setItem(i, 0, item)
                    item = RenderingStyleFilePanel()
                    style = \
                        RenderingStyles.getStyle(self.alg.id(),
                                                 output.name())
                    if style:
                        item.setText(str(style))
                    self.valueItems[output.name()] = item
                    self.tblStyles.setCellWidget(i, 1, item)
                    self.tblStyles.setRowHeight(i, 22)
            i += 1
Esempio n. 6
0
    def __init__(self, title=None, data=None):
        super(FactorInputDialog, self).__init__(None)
        self.setupUi(self)
        if not title:
            title = self.tr("Enter values")
        self.title = title
        self.combinationValue = None  # Combine formula
        self.rasterMatrixValue = None  # Rasters involved
        self.data = data  # data to populate the selected raster table
        # table widget Setup
        rNum = len(data)
        self.tableWidget.setRowCount(rNum)

        # Populate the widget table with the selected rasters
        row = 0

        for tup in self.data:
            col = 0
            for item in tup:
                cellinfo = QTableWidgetItem(item)
                if col == 1 or col == 2:
                    cellinfo.setFlags(QtCore.Qt.ItemIsEnabled)
                #cellinfo.setFlags(QtCore.Qt.ItemIsEditable | QtCore.Qt.ItemIsEnabled)  # make cell not editable
                self.tableWidget.setItem(row, col, cellinfo)
                col += 1
            row += 1
Esempio n. 7
0
 def drawDataTable(
         self,
         tab):  # Called when user switches tabWidget to the Table Preview
     if tab != 1 or self.needsRedraw == False: return
     fields = self.fields
     self.dataTable.clear()
     self.repaint()
     self.dataTable.setColumnCount(len(fields))
     self.dataTable.setRowCount(self.provider.featureCount())
     header = []
     for i in fields.values():
         header.append(i.name())
     self.dataTable.setHorizontalHeaderLabels(header)
     self.progressBar.setRange(0, len(self.data) + 1)
     self.progressBar.setFormat(self.tr('Drawing table') + ': %p%')
     formatting = True
     if formatting:  # slower procedure, with formatting the table items
         for i in range(len(self.data)):
             self.progressBar.setValue(i + 1)
             for j in range(len(self.data[i])):
                 item = QTableWidgetItem(unicode(self.data[i][j] or 'NULL'))
                 item.setFlags(Qt.ItemIsSelectable)
                 if fields[i].type() == 6 or fields[i].type() == 2:
                     item.setTextAlignment(Qt.AlignRight | Qt.AlignVCenter)
                 self.dataTable.setItem(j, i, item)
     else:  # about 25% faster procedure, without formatting
         for i in range(len(self.data)):
             self.progressBar.setValue(i + 1)
             for j in range(len(self.data[i])):
                 self.dataTable.setItem(
                     j, i,
                     QTableWidgetItem(unicode(self.data[i][j] or 'NULL')))
     self.dataTable.resizeColumnsToContents()
     self.needsRedraw = False
     self.progressBar.reset()
Esempio n. 8
0
    def setTableContent(self):
        numOutputs = 0
        for output in self.alg.outputs:
            if isinstance(output, (OutputVector, OutputRaster)):
                if not output.hidden:
                    numOutputs += 1
        self.tblStyles.setRowCount(numOutputs)

        i = 0
        for output in self.alg.outputs:
            if isinstance(output, (OutputVector, OutputRaster)):
                if not output.hidden:
                    item = QTableWidgetItem(output.description + '<' +
                                            output.__class__.__name__ + '>')
                    item.setFlags(Qt.ItemIsEnabled)
                    self.tblStyles.setItem(i, 0, item)
                    item = RenderingStyleFilePanel()
                    style = \
                        RenderingStyles.getStyle(self.alg.commandLineName(),
                                                 output.name)
                    if style:
                        item.setText(str(style))
                    self.valueItems[output.name] = item
                    self.tblStyles.setCellWidget(i, 1, item)
                    self.tblStyles.setRowHeight(i, 22)
            i += 1
Esempio n. 9
0
    def setTableContent(self):
        params = self._alg.parameters
        outputs = self._alg.outputs
        visibleParams = [p for p in params if not p.hidden]
        visibleOutputs = [p for o in outputs if not o.hidden]
        self.tableWidget.setRowCount(len(visibleParams) + len(visibleOutputs))

        for i, param in visibleParams:
            item = QTableWidgetItem(param.description)
            item.setFlags(Qt.ItemIsEnabled)
            self.tableWidget.setItem(i, 0, item)
            item = self.getWidgetFromParameter(param)
            self.valueItems[param.name] = item
            self.tableWidget.setCellWidget(i, 1, item)
            self.tableWidget.setRowHeight(i, 22)

        for i, output in visibleOutputs:
            item = QTableWidgetItem(output.description + '<' +
                                    output.__module__.split('.')[-1] + '>')
            item.setFlags(Qt.ItemIsEnabled)
            self.tableWidget.setItem(i, 0, item)
            item = QLineEdit()
            if hasattr(item, 'setPlaceholderText'):
                item.setPlaceholderText(ModelerParametersDialog.ENTER_NAME)
            self.valueItems[output.name] = item
            self.tableWidget.setCellWidget(i, 1, item)
            self.tableWidget.setRowHeight(i, 22)
Esempio n. 10
0
    def setTableContent(self):
        numOutputs = 0
        for output in self.alg.outputs:
            if isinstance(output, (OutputVector, OutputRaster)):
                if not output.hidden:
                    numOutputs += 1
        self.tblStyles.setRowCount(numOutputs)

        i = 0
        for output in self.alg.outputs:
            if isinstance(output, (OutputVector, OutputRaster)):
                if not output.hidden:
                    item = QTableWidgetItem(output.description + '<'
                                            + output.__class__.__name__ + '>')
                    item.setFlags(Qt.ItemIsEnabled)
                    self.tblStyles.setItem(i, 0, item)
                    item = RenderingStyleFilePanel()
                    style = \
                        RenderingStyles.getStyle(self.alg.commandLineName(),
                                                 output.name)
                    if style:
                        item.setText(unicode(style))
                    self.valueItems[output.name] = item
                    self.tblStyles.setCellWidget(i, 1, item)
                    self.tblStyles.setRowHeight(i, 22)
            i += 1
Esempio n. 11
0
    def addLayerFields(self, layer_source):
        layer = layer_source.layer

        if layer.type() != QgsMapLayer.VectorLayer:
            return

        for i, field in enumerate(layer.fields()):
            row = self.rowCount()
            ews = layer.editorWidgetSetup(i)

            if ews.type() == 'ExternalResource':
                # for later: if ews.config().get('DocumentViewer', QgsExternalResourceWidget.NoContent) == QgsExternalResourceWidget.Image:
                self.insertRow(row)
                item = QTableWidgetItem(layer.name())
                item.setData(Qt.UserRole, layer_source)
                item.setFlags(Qt.ItemIsEnabled)
                self.setItem(row, 0, item)
                item = QTableWidgetItem(field.name())
                item.setFlags(Qt.ItemIsEnabled)
                self.setItem(row, 1, item)
                ew = QgsFieldExpressionWidget()
                ew.setLayer(layer)
                expression = layer_source.photo_naming(field.name())
                ew.setExpression(expression)
                self.setCellWidget(row, 2, ew)

        self.resizeColumnsToContents()
Esempio n. 12
0
    def update_matrix_list(self):
        if self.matrix_count > 0:
            self.but_save_for_single_use.setEnabled(True)
            self.but_permanent_save.setEnabled(True)
        else:
            self.but_save_for_single_use.setEnabled(False)
            self.but_permanent_save.setEnabled(False)

        self.matrix_list_view.clearContents()
        self.matrix_list_view.setRowCount(self.matrix_count)

        self.matrix_list_view.blockSignals(True)
        i = 0
        for key, value in self.matrices.items():
            r = np.unique(value['from']).shape[0]
            c = np.unique(value['to']).shape[0]
            dimensions = "{:,}".format(r) + " x " + "{:,}".format(c)
            total = "{:,.2f}".format(float(value['flow'].sum()))
            item_1 = QTableWidgetItem(key)
            self.matrix_list_view.setItem(i, 0, item_1)

            item_2 = QTableWidgetItem(dimensions)
            item_2.setFlags(Qt.ItemIsEnabled | Qt.ItemIsSelectable)
            self.matrix_list_view.setItem(i, 1, item_2)

            item_3 = QTableWidgetItem(total)
            item_3.setFlags(Qt.ItemIsEnabled | Qt.ItemIsSelectable)
            self.matrix_list_view.setItem(i, 2, item_3)

            i += 1
        self.matrix_list_view.blockSignals(False)
Esempio n. 13
0
    def setTableContent(self):
        numOutputs = 0
        for output in self.alg.outputDefinitions():
            if isinstance(output, (QgsProcessingOutputVectorLayer,
                                   QgsProcessingOutputRasterLayer)):
                numOutputs += 1
        self.tblStyles.setRowCount(numOutputs)

        i = 0
        for output in self.alg.outputDefinitions():
            if isinstance(output, (QgsProcessingOutputVectorLayer,
                                   QgsProcessingOutputRasterLayer)):
                item = QTableWidgetItem(output.description() + '<' +
                                        output.__class__.__name__ + '>')
                item.setFlags(Qt.ItemIsEnabled)
                self.tblStyles.setItem(i, 0, item)
                item = RenderingStyleFilePanel()
                style = \
                    RenderingStyles.getStyle(self.alg.id(),
                                             output.name())
                if style:
                    item.setText(str(style))
                self.valueItems[output.name()] = item
                self.tblStyles.setCellWidget(i, 1, item)
                self.tblStyles.setRowHeight(i, 22)
            i += 1
Esempio n. 14
0
    def add_row(self):
        row_pos = self.table.rowCount()
        self.table.insertRow(row_pos)
        col = 0
        item = QTableWidgetItem(str(row_pos))

        if self.edit_type == self.edit_patterns:
            self.table.setItem(row_pos, col, item)
            item.setFlags(QtCore.Qt.ItemIsSelectable)
Esempio n. 15
0
 def set_value_widget(self, value, row):
     """
     Sets the property value into the given row of the job table.
     :param value: str: Property value of the row.
     :param row: int: Row number to but the value in
     """
     qitem = QTableWidgetItem(str(value))
     qitem.setFlags(QtCore.Qt.ItemIsEnabled)
     self.jobInfoTableWidget.setItem(row, 1, qitem)
Esempio n. 16
0
def create_checkbox():
    """
    Create a simple checkbox item
    :return: QTableWidgetItem - The item to insert
    """
    item = QTableWidgetItem()
    item.setFlags(Qt.ItemIsUserCheckable | Qt.ItemIsEnabled)
    item.setCheckState(Qt.Unchecked)
    return item
 def insertNewRow(self):
     self.tableWidget.insertRow(self.tableWidget.rowCount())
     for i in range(self.tableWidget.columnCount()):
         editItem = QTableWidgetItem('', 0)
         if i == 0:
             editItem.setFlags(self.defFlags | Qt.ItemIsUserCheckable)
             editItem.setCheckState(Qt.Checked)
         else:
             editItem.setFlags(self.defFlags)
         self.tableWidget.setItem(self.tableWidget.rowCount()-1, i, editItem)
Esempio n. 18
0
 def _set_checkbox_item(self):
     """
     Sets the checkbox item
     :return: Table widget item
     :rtype: Object
     """
     check_box = QTableWidgetItem()
     check_box.setCheckState(Qt.Checked)
     check_box.setFlags(Qt.ItemIsUserCheckable | Qt.ItemIsEnabled | Qt.ItemIsSelectable)
     return check_box
Esempio n. 19
0
def create_label(text):
    """
    Create a simple label item
    :param text: String - The text to insert inside the cell
    :return: QTableWidgetItem - The item to insert
    """
    item = QTableWidgetItem(text)
    item.setFlags(Qt.NoItemFlags)
    item.setTextAlignment(Qt.AlignCenter)
    return item
    def _getTextCell(self,
                     text: str,
                     enabled: bool = False) -> QTableWidgetItem:
        widget = QTableWidgetItem(text)
        widget.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)

        if not enabled:
            widget.setFlags(Qt.ItemIsEditable)

        return widget
    def refresh_jobs(self):
        """
        Refreshes the job table, so fetches all jobs of the user from the backend and lists them in the table.
        This method also generates the "Execute" and "Display" buttons.
        """
        jobs = self.connection.user_jobs()

        self.init_jobs()
        self.jobsTableWidget.setRowCount(len(jobs))
        row = 0
        for val in jobs:

            if "id" in val:
                qitem = QTableWidgetItem(val["id"])
                qitem.setFlags(QtCore.Qt.ItemIsEnabled)
                self.jobsTableWidget.setItem(row, 0, qitem)

            if "error" in val:
                if val["error"]:
                    if "message" in val["error"]:
                        qitem = QTableWidgetItem(val["error"]["message"])
                        qitem.setFlags(QtCore.Qt.ItemIsEnabled)
                        self.jobsTableWidget.setItem(row, 1, qitem)
            elif "description" in val:
                qitem = QTableWidgetItem(val["description"])
                qitem.setFlags(QtCore.Qt.ItemIsEnabled)
                self.jobsTableWidget.setItem(row, 1, qitem)

            if "submitted" in val:
                qitem = QTableWidgetItem(val["submitted"])
                qitem.setFlags(QtCore.Qt.ItemIsEnabled)
                self.jobsTableWidget.setItem(row, 2, qitem)

            execBtn = QPushButton(self.jobsTableWidget)
            execBtn.setText('Execute')

            if "status" in val:
                qitem = QTableWidgetItem(val["status"])
                qitem.setFlags(QtCore.Qt.ItemIsEnabled)
                self.jobsTableWidget.setItem(row, 3, qitem)

                if val["status"] == "finished":
                    dispBtn = QPushButton(self.jobsTableWidget)
                    dispBtn.setText('Display')
                    self.jobsTableWidget.setCellWidget(row, 5, dispBtn)
                    dispBtn.clicked.connect(
                        lambda *args, row=row: self.job_display(row))

            self.jobsTableWidget.setCellWidget(row, 4, execBtn)
            execBtn.clicked.connect(
                lambda *args, row=row: self.job_execute(row))

            row += 1
Esempio n. 22
0
    def new_process_to_table(self, process_id):
        """
        Gets called if a new process is selected at the "add process" combo box.
        It loads all arguments with their types into the process table.
        """
        self.processTableWidget.clear()
        self.cur_process = None
        self.cur_node = None
        self.cur_row = None

        # Set label with the process name and the bold font

        pr = self.backend.get_process(process_id)

        p_id = self.processIdText.text()

        self.processLabel.setText("New Process: {}".format(p_id))
        my_font = QtGui.QFont()
        my_font.setBold(True)
        self.processLabel.setFont(my_font)

        self.init_process_table()
        self.processTableWidget.setRowCount(len(pr.parameters))

        par_row = 0
        for param in pr.parameters:
            qitem = QTableWidgetItem(param.name)
            qitem.setFlags(QtCore.Qt.ItemIsEnabled)

            if not param.optional:
                bold_font = QFont()
                bold_font.setBold(True)
                qitem.setFont(bold_font)

            self.processTableWidget.setItem(par_row, 0, qitem)

            p_type = QTableWidgetItem(str(param.get_type()))
            p_type.setFlags(QtCore.Qt.ItemIsEnabled)
            self.processTableWidget.setItem(par_row, 1, p_type)

            val_item = QTableWidgetItem("")

            if "process-graph" in str(param.get_type()):
                val_item = QTableWidgetItem('{ "process_graph": {} }')

            self.processTableWidget.setItem(par_row, 2, val_item)
            self.set_complex_edit_element(param, process_id, "", par_row)

            par_row += 1

        self.resultCheckBox.setChecked(False)
        self.processTableWidget.resizeRowsToContents()
        self.cloneprocessButton.setEnabled(False)
Esempio n. 23
0
 def set_property_widget(self, prop, row):
     """
     Sets the property name into the given row of the job table.
     :param prop: str: Property name of the row.
     :param row: int: Row number to but the value in
     """
     qitem = QTableWidgetItem(str(prop))
     font = QFont()
     font.setBold(True)
     qitem.setFont(font)
     qitem.setFlags(QtCore.Qt.ItemIsEnabled)
     self.jobInfoTableWidget.setItem(row, 0, qitem)
    def process_selected(self):
        """
        Gets called if a new process is selected at the process combobox.
        It loads all agruments with their type and an example (if exist) into the value
        """
        self.processTableWidget.clear()
        for p in self.processes:
            if "id" in p:
                if p['id'] == str(self.processBox.currentText()):
                    process = p
                    if "parameters" in process:
                        #info(self.iface, "New Process {}".format(process['parameters']))
                        self.processTableWidget.setRowCount(
                            len(process['parameters']))
                        self.processTableWidget.setColumnCount(3)
                        self.processTableWidget.setHorizontalHeaderLabels(
                            ['Parameter', 'Type', 'Value'])
                        header = self.processTableWidget.horizontalHeader()
                        header.setSectionResizeMode(
                            0, QtWidgets.QHeaderView.ResizeToContents)
                        header.setSectionResizeMode(
                            1, QtWidgets.QHeaderView.ResizeToContents)
                        header.setSectionResizeMode(
                            2, QtWidgets.QHeaderView.Stretch)

                        counter = 0
                        for key, val in process['parameters'].items():
                            # if key != "data" and key != "imagery":
                            qitem = QTableWidgetItem(key)
                            qitem.setFlags(QtCore.Qt.ItemIsEnabled)
                            if "required" in val:
                                if val["required"]:
                                    boldFont = QtGui.QFont()
                                    boldFont.setBold(True)
                                    qitem.setFont(boldFont)

                            self.processTableWidget.setItem(counter, 0, qitem)
                            if "schema" in val:
                                if "type" in val["schema"]:
                                    type = QTableWidgetItem(
                                        str(val['schema']['type']))
                                    type.setFlags(QtCore.Qt.ItemIsEnabled)
                                    self.processTableWidget.setItem(
                                        counter, 1, type)
                                if "examples" in val["schema"]:
                                    example = QTableWidgetItem(
                                        str(val['schema']['examples'][0]))
                                    self.processTableWidget.setItem(
                                        counter, 2, example)
                            counter += 1
                        return
                    else:
                        info(self.iface, "New Process: Parameters not found")
Esempio n. 25
0
    def create_table(self):
        from AcATaMa.gui.acatama_dockwidget import AcATaMaDockWidget as AcATaMa

        header = ["Pix Val", "Color", "Select"]
        # get color table from raster
        thematic_table = {"color_table": get_color_table(
            AcATaMa.dockwidget.QCBox_ThematicRaster.currentLayer(),
            band=int(AcATaMa.dockwidget.QCBox_band_ThematicRaster.currentText()),
            nodata=int(AcATaMa.dockwidget.nodata_ThematicRaster.value()))}

        if not thematic_table["color_table"]:
            # clear table
            self.tableOfClasses.setRowCount(0)
            self.tableOfClasses.setColumnCount(0)
            return
        thematic_table["row_count"] = len(list(thematic_table["color_table"].values())[0])
        # init table
        self.tableOfClasses.setRowCount(thematic_table["row_count"])
        self.tableOfClasses.setColumnCount(3)
        # hidden row labels
        self.tableOfClasses.verticalHeader().setVisible(False)
        # add Header
        self.tableOfClasses.setHorizontalHeaderLabels(header)

        # insert items
        for n, h in enumerate(header):
            if h == "Pix Val":
                for m, item in enumerate(thematic_table["color_table"]["Pixel Value"]):
                    item_table = QTableWidgetItem(str(item))
                    item_table.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)
                    item_table.setTextAlignment(Qt.AlignCenter | Qt.AlignVCenter)
                    self.tableOfClasses.setItem(m, n, item_table)
            if h == "Color":
                for m in range(thematic_table["row_count"]):
                    item_table = QTableWidgetItem()
                    item_table.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)
                    item_table.setBackground(QColor(thematic_table["color_table"]["Red"][m],
                                                    thematic_table["color_table"]["Green"][m],
                                                    thematic_table["color_table"]["Blue"][m],
                                                    thematic_table["color_table"]["Alpha"][m]))
                    self.tableOfClasses.setItem(m, n, item_table)
            if h == "Select":
                for m in range(thematic_table["row_count"]):
                    item_table = QPushButton("Select this")
                    item_table.clicked.connect(self.select_clicked)
                    self.tableOfClasses.setCellWidget(m, n, item_table)

        # adjust size of Table
        self.tableOfClasses.resizeColumnsToContents()
        self.tableOfClasses.resizeRowsToContents()
        # adjust the dialog based on table content
        dialog_width = self.tableOfClasses.horizontalHeader().length() + 50
        self.resize(dialog_width, self.height())
Esempio n. 26
0
    def __init__(self, parent=None):
        settings = Settings()
        QDialog.__init__(self, parent)
        SettingDialog.__init__(self,
                               setting_manager=settings,
                               mode=UpdateMode.DialogAccept)
        self.setupUi(self)

        self.search_line_edit.textChanged.connect(self.filter_rows)
        self.select_all_button.pressed.connect(self.select_all)
        self.unselect_all_button.pressed.connect(
            lambda: self.select_all(False))
        self.keep_scale.toggled.connect(self.point_scale.setDisabled)
        self.keep_scale.toggled.connect(self.scale_label.setDisabled)

        self.skipped_dataproducts.setRowCount(len(DATA_PRODUCTS))
        self.skipped_dataproducts.setColumnCount(2)
        self.skipped_dataproducts.setHorizontalHeaderLabels(
            (self.tr('Name'), self.tr('ID')))
        self.skipped_dataproducts.setSelectionBehavior(
            QAbstractItemView.SelectRows)
        self.skipped_dataproducts.setSelectionMode(
            QAbstractItemView.SingleSelection)
        r = 0
        for _id, name in DATA_PRODUCTS.items():
            item = QTableWidgetItem(name)
            item.setData(Qt.UserRole, _id)
            item.setFlags(Qt.ItemIsEnabled | Qt.ItemIsUserCheckable)
            self.skipped_dataproducts.setItem(r, 0, item)
            self.skipped_dataproducts.setItem(r, 1, QTableWidgetItem(_id))
            r += 1
        self.skipped_dataproducts.horizontalHeader().setStretchLastSection(
            True)
        self.skipped_dataproducts.resizeColumnsToContents()

        self.settings = settings
        self.init_widgets()

        sd_widget: TableWidgetStringListWidget = self.setting_widget(
            'skipped_dataproducts')
        sd_widget.column = 0
        sd_widget.userdata = True
        sd_widget.invert = True

        self.setting_widget('wms_image_format').auto_populate()
        self.setting_widget('default_layer_loading_mode').auto_populate()

        self.pg_service.setPlaceholderText(DEFAULT_PG_SERVICE)
        self.pg_host.setPlaceholderText(DEFAULT_PG_HOST)
        self.service_url.setPlaceholderText(DEFAULT_BASE_URL)
        self.pg_host.setShowClearButton(True)
        self.service_url.setShowClearButton(True)
 def __init__(self, results, onlySymbology, geodataServer, metadataServer,
              parent):
     super(PublishReportDialog, self).__init__(parent)
     self.results = results
     self.setupUi(self)
     self.tableWidget.horizontalHeader().setSectionResizeMode(
         QHeaderView.Stretch)
     if geodataServer is not None:
         url = geodataServer.url
         self.labelUrlMapServer.setText('<a href="%s">%s</a>' % (url, url))
     else:
         self.labelUrlMapServer.setText("----")
     if metadataServer is not None:
         url = metadataServer.url
         self.labelUrlMetadataServer.setText('<a href="%s">%s</a>' %
                                             (url, url))
     else:
         self.labelUrlMetadataServer.setText("----")
     publishData = geodataServer is not None
     self.labelPublishMapData.setText(
         "ON" if publishData and not onlySymbology else "OFF")
     self.labelPublishSymbology.setText("ON" if publishData else "OFF")
     self.labelPublishMetadata.setText(
         "ON" if metadataServer is not None else "OFF")
     self.tableWidget.setRowCount(len(results))
     for i, name in enumerate(results.keys()):
         warnings, errors = results[name]
         item = QTableWidgetItem(name)
         item.setFlags(item.flags() ^ Qt.ItemIsEditable)
         self.tableWidget.setItem(i, 0, item)
         if geodataServer is not None:
             dataPublished = geodataServer.layerExists(name)
             stylePublished = geodataServer.styleExists(name)
         else:
             dataPublished = False
             stylePublished = False
         item = QTableWidgetItem("Yes" if dataPublished else "No")
         item.setFlags(item.flags() ^ Qt.ItemIsEditable)
         self.tableWidget.setItem(i, 1, item)
         item = QTableWidgetItem("Yes" if stylePublished else "No")
         item.setFlags(item.flags() ^ Qt.ItemIsEditable)
         self.tableWidget.setItem(i, 2, item)
         metadataPublished = metadataServer is not None
         item = QTableWidgetItem(
             self.tr("Yes") if metadataPublished else self.tr("No"))
         item.setFlags(item.flags() ^ Qt.ItemIsEditable)
         self.tableWidget.setItem(i, 3, item)
         txt = self.tr("warnings(%i), errors(%i)") % (len(warnings),
                                                      len(errors))
         widget = QWidget()
         button = QPushButton()
         button.setText(txt)
         button.clicked.connect(partial(self.openDetails, name))
         layout = QHBoxLayout(widget)
         layout.addWidget(button)
         layout.setAlignment(Qt.AlignCenter)
         layout.setContentsMargins(0, 0, 0, 0)
         widget.setLayout(layout)
         self.tableWidget.setCellWidget(i, 4, widget)
Esempio n. 28
0
    def _populate_attributes(self, combination):
        """
        Populate the attributes
        """

        data = list(combination)

        self.tableWidget.setRowCount(len(data))

        for row_index, row in enumerate(data):
            for index in range(4):
                item = QTableWidgetItem(str(row[index]))
                if index == 0:
                    item.setFlags(QtCore.Qt.ItemIsEnabled)
                self.tableWidget.setItem(row_index, index, item)
        self.tableWidget.resizeColumnsToContents()
Esempio n. 29
0
 def drawFieldsTable(
         self
 ):  # Draws the fields table on startup and redraws it when changed
     fields = self.fields
     self.fieldsTable.setRowCount(0)
     for i in range(len(fields)):
         self.fieldsTable.setRowCount(i + 1)
         item = QTableWidgetItem(fields[i].name())
         item.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)
         item.setData(Qt.UserRole, i)  # set field index
         self.fieldsTable.setItem(i, 0, item)
         item = QTableWidgetItem(self.formatFieldType(fields[i]))
         item.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)
         self.fieldsTable.setItem(i, 1, item)
     self.fieldsTable.setColumnWidth(0, 128)
     self.fieldsTable.setColumnWidth(1, 96)
 def selectSource(self): 
     '''
     source feature selection procedure
     '''
     if self.layerHighlighted:
         self.resetSource()
     try:
         self.dock.tableWidget.itemChanged.disconnect(self.highLightCellOverride)
     except:
         pass
     #take first selected feature as source feature
     self.sourceFeat = self.selectedFeature
     #hightlight source feature with rubberband
     self.sourceEvid.setToGeometry(self.sourceFeat.geometry(),self.selectedLayer)
     #get current layer attributes labels list
     field_names = self.scanLayerFieldsNames(self.selectedLayer)
     field_types = self.scanLayerFieldsTypes(self.selectedLayer)
     self.sourceAttrsTab=[]
     self.dock.tableWidget.setRowCount(len(field_names))
     #loading attributes labels and values in QTableWidget
     for n in range(0,len(field_names)):
             item=QTableWidgetItem()
             item.setFlags(item.flags() | Qt.ItemIsUserCheckable)
             item.setCheckState(Qt.Unchecked)
             item.setText("")
             #set first column as checkbox
             self.dock.tableWidget.setItem(n,0,item)
             #set second colunm as attribute label as qcombobox widget
             self.dock.tableWidget.setCellWidget(n,1,self.setComboField(field_names[n],field_types[n],self.canvas.currentLayer()))
             #set third column as attribute value
             item = QTableWidgetItem()
             item.setData(Qt.DisplayRole,self.sourceFeat.attributes()[n])
             self.dock.tableWidget.setItem(n,2,item)
     #resize table to contents
     self.dock.tableWidget.resizeColumnsToContents()
     self.dock.tableWidget.horizontalHeader().setStretchLastSection(True)
     #procedure to recover same field selection if current source feature has the same layer of the precedent one
     if self.selectedLayer.id() != self.activeLayer:
         self.sourceAttrs={}
         self.activeLayer = self.selectedLayer.id()
     else:
         for Attr in self.sourceAttrs:
             self.dock.tableWidget.item(Attr,0).setCheckState(Qt.Checked)
     #Enable button to apply or reset
     self.dock.ResetSource.setEnabled(True)
     self.dock.tableWidget.itemChanged.connect(self.highLightCellOverride)
     self.checkOnLayerChange(self.canvas.currentLayer())
 def populateLayerFields(self):
     if self.currentLayer.type() == self.currentLayer.VectorLayer:
         fields = [f.name() for f in self.currentLayer.fields()]
         self.tabLayerInfo.setTabEnabled(1, True)
         self.tableFields.setRowCount(len(fields))
         for i, field in enumerate(fields):
             item = QTableWidgetItem()
             item.setFlags(item.flags() ^ Qt.ItemIsEditable)
             check = Qt.Checked if self.fieldsToPublish[
                 self.currentLayer][field] else Qt.Unchecked
             item.setCheckState(check)
             self.tableFields.setItem(i, 0, item)
             item = QTableWidgetItem(field)
             item.setFlags(item.flags() ^ Qt.ItemIsEditable)
             self.tableFields.setItem(i, 1, item)
     else:
         self.tabLayerInfo.setTabEnabled(1, False)
    def onAdd(self, qgs_type_storage: str = "file"):
        """Add a new line to the table.

        :param qgs_type_storage: project storage type, defaults to "file"
        :type qgs_type_storage: str, optional
        """
        row = self.tableWidget.rowCount()
        self.tableWidget.setRowCount(row + 1)

        # edit button
        self.addEditButton(row, qgs_type_storage)

        # project name
        itemName = QTableWidgetItem()
        itemName.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)
        self.tableWidget.setItem(row, self.cols.name, itemName)
        name_lineedit = QLineEdit()
        name_lineedit.setPlaceholderText(self.tr("Use project title"))
        self.tableWidget.setCellWidget(row, self.cols.name, name_lineedit)

        # project storage type
        self.tableWidget.setCellWidget(
            row, self.cols.type_storage,
            self.mk_prj_storage_icon(qgs_type_storage))

        # menu location
        location_combo = QComboBox()
        for pk in self.LOCATIONS:
            if not (pk == "merge" and row == 0):
                location_combo.addItem(self.LOCATIONS[pk]["label"], pk)

        location_combo.setCurrentIndex(0)
        self.tableWidget.setCellWidget(row, self.cols.type_menu_location,
                                       location_combo)

        # project file path
        itemFile = QTableWidgetItem()
        itemFile.setData(Qt.UserRole, qgs_type_storage)
        itemFile.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)
        self.tableWidget.setItem(row, self.cols.uri, itemFile)
        filepath_lineedit = QLineEdit()
        filepath_lineedit.textChanged.connect(self.onTextChanged)
        self.tableWidget.setCellWidget(row, self.cols.uri, filepath_lineedit)

        # apply table styling
        self.tableTunning()
Esempio n. 33
0
    def populate_function_table_1(self):
        """Populate the tblFunctions1 table with available functions."""
        hazards = deepcopy(hazard_all)
        exposures = exposure_all

        self.lblAvailableFunctions1.clear()
        self.tblFunctions1.clear()
        self.tblFunctions1.setColumnCount(len(hazards))
        self.tblFunctions1.setRowCount(len(exposures))
        for i in range(len(hazards)):
            hazard = hazards[i]
            item = QTableWidgetItem()
            item.setIcon(QIcon(get_image_path(hazard)))
            item.setText(hazard['name'].capitalize())
            item.setTextAlignment(Qt.AlignLeft)
            self.tblFunctions1.setHorizontalHeaderItem(i, item)
        for i in range(len(exposures)):
            exposure = exposures[i]
            item = QTableWidgetItem()
            item.setIcon(QIcon(get_image_path(exposure)))
            item.setText(exposure['name'].capitalize())
            self.tblFunctions1.setVerticalHeaderItem(i, item)
        developer_mode = setting('developer_mode', False, bool)
        for hazard in hazards:
            for exposure in exposures:
                item = QTableWidgetItem()
                if (exposure in hazard['disabled_exposures'] and not
                        developer_mode):
                    background_colour = unavailable_option_color
                    # Set it disable and un-selectable
                    item.setFlags(
                        item.flags() & ~
                        Qt.ItemIsEnabled & ~
                        Qt.ItemIsSelectable
                    )
                else:
                    background_colour = available_option_color
                item.setBackground(QBrush(background_colour))
                item.setFont(big_font)
                item.setTextAlignment(Qt.AlignCenter | Qt.AlignHCenter)
                item.setData(RoleHazard, hazard)
                item.setData(RoleExposure, exposure)
                self.tblFunctions1.setItem(
                    exposures.index(exposure), hazards.index(hazard), item)
        self.parent.pbnNext.setEnabled(False)
Esempio n. 34
0
    def populate_function_table_1(self):
        """Populate the tblFunctions1 table with available functions."""
        hazards = deepcopy(hazard_all)
        exposures = exposure_all

        self.lblAvailableFunctions1.clear()
        self.tblFunctions1.clear()
        self.tblFunctions1.setColumnCount(len(hazards))
        self.tblFunctions1.setRowCount(len(exposures))
        for i in range(len(hazards)):
            hazard = hazards[i]
            item = QTableWidgetItem()
            item.setIcon(QIcon(get_image_path(hazard)))
            item.setText(hazard['name'].capitalize())
            item.setTextAlignment(Qt.AlignLeft)
            self.tblFunctions1.setHorizontalHeaderItem(i, item)
        for i in range(len(exposures)):
            exposure = exposures[i]
            item = QTableWidgetItem()
            item.setIcon(QIcon(get_image_path(exposure)))
            item.setText(exposure['name'].capitalize())
            self.tblFunctions1.setVerticalHeaderItem(i, item)
        developer_mode = setting('developer_mode', False, bool)
        for hazard in hazards:
            for exposure in exposures:
                item = QTableWidgetItem()
                if (exposure in hazard['disabled_exposures'] and not
                        developer_mode):
                    background_colour = unavailable_option_color
                    # Set it disable and un-selectable
                    item.setFlags(
                        item.flags() & ~
                        Qt.ItemIsEnabled & ~
                        Qt.ItemIsSelectable
                    )
                else:
                    background_colour = available_option_color
                item.setBackground(QBrush(background_colour))
                item.setFont(big_font)
                item.setTextAlignment(Qt.AlignCenter | Qt.AlignHCenter)
                item.setData(RoleHazard, hazard)
                item.setData(RoleExposure, exposure)
                self.tblFunctions1.setItem(
                    exposures.index(exposure), hazards.index(hazard), item)
        self.parent.pbnNext.setEnabled(False)
Esempio n. 35
0
 def addCoord(self, lat, lon, label):
     '''Add a coordinate to the list.'''
     if self.numcoord >= self.maxResults:
         return
     self.resultsTable.insertRow(self.numcoord)
     self.llitems.append(LatLonItem(lat, lon, label))
     self.resultsTable.blockSignals(True)
     self.resultsTable.setItem(self.numcoord, 2, QTableWidgetItem(label))
     item = QTableWidgetItem(str(lat))
     item.setFlags(item.flags() & ~Qt.ItemIsEditable)
     self.resultsTable.setItem(self.numcoord, 0, item)
     item = QTableWidgetItem(str(lon))
     item.setFlags(item.flags() & ~Qt.ItemIsEditable)
     self.resultsTable.setItem(self.numcoord, 1, item)
     self.resultsTable.blockSignals(False)
     self.numcoord += 1
     if self.showAllCheckBox.checkState():
         self.showAllChange()
Esempio n. 36
0
 def addNewRow(self, row=None):
     """
     Adds a new row of items and fill it into table.
     :param row: (int) position to add the new row.
     """
     row = row if row is not None else self.rowCount()
     self.tableWidget.insertRow(row)
     for col, properties in self.headers.items():
         if properties["type"] == "item":
             item = QTableWidgetItem()
             # it "flips" current state, which, by default, is "editable"
             if not properties["editable"]:
                 item.setFlags(Qt.ItemIsEditable)
             self.tableWidget.setItem(row, col, item)
         else:
             self.tableWidget.setCellWidget(row, col,
                                            properties["widget"]())
     self.rowAdded.emit(row)
    def setTableContent(self):
        self.table.clear()
        self.table.setColumnCount(2)
        self.table.setColumnWidth(0, 200)
        self.table.setColumnWidth(1, 200)
        self.table.setHorizontalHeaderLabels(["Name", "URL"])
        self.table.horizontalHeader().setResizeMode(QHeaderView.Stretch)
        self.table.setRowCount(len(self.remotes))
        for i, name in enumerate(self.remotes):
            url = self.remotes[name]
            self.table.setRowHeight(i, 22)
            item = QTableWidgetItem(name, 0)
            item.setFlags(Qt.ItemIsEnabled | Qt.ItemIsSelectable)
            self.table.setItem(i, 0, item)
            item = QTableWidgetItem(url, 0)
            item.setFlags(Qt.ItemIsEnabled | Qt.ItemIsSelectable)
            self.table.setItem(i, 1, item)

        self.table.itemSelectionChanged.connect(self.selectionChanged)
    def restoreState(self,layer,table):
        if layer.id() in self.states.keys():
            table.blockSignals(True)
            #clear dock widget
            while table.rowCount()>0:
                table.removeRow(0)
            #add rows
            table.setRowCount(len(self.states[layer.id()]))
            for n in range(0, len(self.states[layer.id()])):
                row = self.states[layer.id()][n]
                #set first column as checkbox
                item=QTableWidgetItem()
                item.setFlags(item.flags() | Qt.ItemIsUserCheckable)
                if row[0]:
                    item.setCheckState(Qt.Checked)
                else:
                    item.setCheckState(Qt.Unchecked)
                item.setText("")
                table.setItem(n,0,item)
                #set second column as combobox
                combo = QComboBox();
                combo.addItems(row[1])
                #print (row[1],row[2])
                combo.setCurrentIndex(row[2])
                table.setCellWidget(n,1,combo)
                #set third column as attribute value
                item = QTableWidgetItem(row[3])
                item.setData(Qt.DisplayRole,row[4])
                if row[5]:
                    item.setForeground(QBrush(QColor(0,0,0)))
                else:
                    item.setForeground(QBrush(QColor(130,130,130)))
                if row[6]:
                    item.setBackground(QBrush(QColor(183,213,225)))
                table.setItem(n,2,item)

            table.blockSignals(False)
            return True

        else:
            return None
 def addCoord(self, lat, lon, label='', data=[]):
     '''Add a coordinate to the list.'''
     rowcnt = self.resultsTable.rowCount()
     if rowcnt >= self.maxResults:
         return
     self.resultsTable.blockSignals(True)
     self.resultsTable.insertRow(rowcnt)
     item = QTableWidgetItem(str(lat))
     item.setData(Qt.UserRole, LatLonItem(lat, lon, label, data))
     item.setFlags(item.flags() & ~Qt.ItemIsEditable)
     self.resultsTable.setItem(rowcnt, 0, item)
     item = QTableWidgetItem(str(lon))
     item.setFlags(item.flags() & ~Qt.ItemIsEditable)
     self.resultsTable.setItem(rowcnt, 1, item)
     self.resultsTable.setItem(rowcnt, 2, QTableWidgetItem(label))
     if self.numCol > 3 and len(data) > 0:
         for i in range( min(self.numCol-3, len(data))):
             self.resultsTable.setItem(rowcnt, i+3, QTableWidgetItem(data[i]))
         
     self.resultsTable.blockSignals(False)
     return(rowcnt)
 def readConfiguration(self, filePath=None):
     
     if filePath is None:
         filePath = self.configFilePath
     
     # Clear the QTableWidget in case it contains any old data
     self.tableWidget.clear()
     self.tableWidget.setRowCount(0)
     
     # First set up the TableWidget
     self.tableWidget.setColumnCount(6)
     
     labels = ['Constraint',
               'Schema',
               'Table',
               'Geometry Column',
               'Search Distance',
               'Columns For Reporting']
     self.tableWidget.setHorizontalHeaderLabels(labels)
     
     # Read the config
     
     config = configparser.ConfigParser()
     config.read(filePath)
     
     i = 0
     for section in config.sections():
         self.tableWidget.insertRow(i)
         
         editItem = QTableWidgetItem(section, 0)
         editItem.setFlags(self.defFlags | Qt.ItemIsUserCheckable)
         include = config.get(section, 'include')
         if include.lower() == 't':
             editItem.setCheckState(Qt.Checked)
         else:
             editItem.setCheckState(Qt.Unchecked)
         self.tableWidget.setItem(i, 0, editItem)
         
         schema = config.get(section, 'schema')
         editItem = QTableWidgetItem(schema, 0)
         editItem.setFlags(self.defFlags)
         self.tableWidget.setItem(i, 1, editItem)
         
         table = config.get(section, 'table')
         editItem = QTableWidgetItem(table, 0)
         editItem.setFlags(self.defFlags)
         self.tableWidget.setItem(i, 2, editItem)
         
         geom_col = config.get(section, 'geom_column')
         editItem = QTableWidgetItem(geom_col, 0)
         editItem.setFlags(self.defFlags)
         self.tableWidget.setItem(i, 3, editItem)
         
         buffer_distance = config.get(section, 'buffer_distance')
         editItem = QTableWidgetItem(buffer_distance, 0)
         editItem.setFlags(self.defFlags)
         self.tableWidget.setItem(i, 4, editItem)
         
         columns = config.get(section, 'columns')
         editItem = QTableWidgetItem(columns, 0)
         editItem.setFlags(self.defFlags)
         self.tableWidget.setItem(i, 5, editItem)
         
         i += 1
     
     self.tableWidget.resizeColumnsToContents()
     self.tableWidget.setSelectionBehavior(QAbstractItemView.SelectRows)
    def update_local_data_sources(self, local_layers,  local_raster_layers):
        # update table names lookup
        local_layers += local_raster_layers
        self.update_data_sources_table_names()
        
        self.local_data_sources.update_local_data_sources(local_layers)

        # update GUI
        self.ui.tblLocalLayers.setRowCount(0)
        
        schema_list = []
        if self.ui.cbUploadDatabase.count() == 1:
            schema_list = self.fetch_schemas(self.ui.cbUploadDatabase.currentText())
        elif self.ui.cbUploadDatabase.currentIndex() > 0:
            schema_list = self.fetch_schemas(self.ui.cbUploadDatabase.currentText())

        for data_source, layers in list(self.local_data_sources.iteritems()):
            layer_names = []
            for layer in layers:
                layer_names.append(str(layer.name()))
            layers_item = QTableWidgetItem(", ".join(layer_names))
            layers_item.setToolTip("\n".join(layer_names))
            data_source_item = QTableWidgetItem(data_source)
            data_source_item.setToolTip(data_source)            

            # find a better table name if there are multiple layers with same
            # data source?
            table_name = layers[0].name()
            if data_source in self.data_sources_table_names:
                # use current table name if available to keep changes by user
                table_name = self.data_sources_table_names[data_source]
            
            table_name_item = QTableWidgetItem(self.launder_pg_name(table_name))
        
            if layers[0].providerType() == 'gdal':
                geometry_type_item = QTableWidgetItem('Raster')
            else:
                wkbType = layers[0].wkbType()
                
                if wkbType not in self.GEOMETRY_TYPES:
                    QMessageBox.warning(self.iface.mainWindow(), self.tr("Unsupported geometry type"), self.tr(
                        "Unsupported geometry type '{type}' in layer '{layer}'").format(type=self.__wkbTypeString(wkbType), layer=layers[0].name()))
                    continue
                geometry_type_item = QTableWidgetItem(self.GEOMETRY_TYPES[wkbType])
                if layers[0].providerType() == "ogr":
                    geometry_type_item.setToolTip(
                        self.tr("Note: OGR features will be converted to MULTI-type"))
                        
            srid_item = QTableWidgetItem(layers[0].crs().authid())

            row = self.ui.tblLocalLayers.rowCount()
            self.ui.tblLocalLayers.insertRow(row)
            layers_item.setFlags( Qt.ItemIsSelectable |  Qt.ItemIsEnabled )
            self.ui.tblLocalLayers.setItem(
                row, self.COLUMN_LAYERS, layers_item)
            data_source_item.setFlags( Qt.ItemIsSelectable |  Qt.ItemIsEnabled )
            self.ui.tblLocalLayers.setItem(
                row, self.COLUMN_DATA_SOURCE, data_source_item)                
                
# create combo box in schema column filled with all schema names of the selected database               
            cmb_schema = QComboBox()
            cmb_schema.setEditable(True)
            cmb_schema.addItems(schema_list)
            self.ui.tblLocalLayers.setCellWidget(row, self.COLUMN_SCHEMA_NAME, cmb_schema)

            table_name_item.setFlags( Qt.ItemIsSelectable | Qt.ItemIsEditable | Qt.ItemIsEnabled )
            self.ui.tblLocalLayers.setItem(
                row, self.COLUMN_TABLE_NAME, table_name_item)

            geometry_type_item.setFlags( Qt.ItemIsSelectable |  Qt.ItemIsEnabled )
            self.ui.tblLocalLayers.setItem(
                row, self.COLUMN_GEOMETRY_TYPE, geometry_type_item)
                
            srid_item.setFlags( Qt.ItemIsSelectable |  Qt.ItemIsEnabled )
            self.ui.tblLocalLayers.setItem(row, self.COLUMN_SRID, srid_item)

        if self.local_data_sources.count() > 0:
            self.ui.tblLocalLayers.resizeColumnsToContents()
            self.ui.tblLocalLayers.setColumnWidth(self.COLUMN_LAYERS, 100)
            self.ui.tblLocalLayers.setColumnWidth(self.COLUMN_DATA_SOURCE, 100)
            self.ui.tblLocalLayers.sortItems(self.COLUMN_DATA_SOURCE)
            self.ui.tblLocalLayers.setSortingEnabled(False)
        else:
            self.ui.btnUploadData.setEnabled(False)

        self.statusBar().showMessage(self.tr("Updated local data sources"))