示例#1
0
    def create_rule_tab(self, rule_id, rule):
        """
        Create a tab in the Rule tab. The tab is added to the left.

        Args:
            (int) rule_id: The id of the rule.
            (list) rule: A list of tuples containing the attributes
                                  of the rule.
        """
        tab = QWidget()
        layout = QVBoxLayout(tab)
        tab.setLayout(layout)

        label_field = QLabel(tab)
        label_field.setGeometry(10, 10, 300, 21)
        label_field.setText("Measure variable: {}".format(rule[4]))

        label_field = QLabel(tab)
        label_field.setGeometry(10, 40, 300, 21)
        operator = ""
        if rule[1] == ">":
            operator = "Bottom up"
        elif rule[1] == "<":
            operator = "Top down"
        label_field.setText("Operator: {}".format(operator))

        label_field = QLabel(tab)
        label_field.setGeometry(310, 10, 300, 21)
        structure_type = ""
        if rule[3] == "v2_culvert":
            structure_type = "culvert"
        elif rule[3] == "v2_pumpstation":
            structure_type = "pumpstation"
        elif rule[3] == "v2_orifice":
            structure_type = "orifice"
        elif rule[3] == "v2_weir":
            structure_type = "weir"
        label_field.setText("Structure type: {}".format(structure_type))

        label_field = QLabel(tab)
        label_field.setGeometry(310, 40, 300, 21)
        label_field.setText("Structure id: {}".format(rule[2]))

        label_field = QLabel(tab)
        label_field.setGeometry(310, 70, 741, 21)
        label_field.setText("Action type: {}".format(rule[5]))

        table_control_table = QTableWidget(tab)
        table_control_table.setGeometry(10, 100, 741, 181)
        table_control_table.insertColumn(0)
        table_control_table.setHorizontalHeaderItem(
            0, QTableWidgetItem("measuring_value"))
        table_control_table.insertColumn(1)
        table_control_table.setHorizontalHeaderItem(
            1, QTableWidgetItem("action_value"))
        table_control_table.setEditTriggers(QAbstractItemView.NoEditTriggers)
        self.dockwidget_controlled_structures.table_control_view = table_control_table

        self.dockwidget_controlled_structures.tab_table_control_view.insertTab(
            0, tab, "Table control: {}".format(str(rule_id)))
示例#2
0
 def show_drawing_analysis(self, planfall=True):
     '''
     open shares of ground cover in dialog with table
     '''
     shares = self.analyse_shares(planfall)
     l = 'Planfall' if planfall else 'Nullfall'
     dialog = Dialog(title='Flächenanteile der Bodenbedeckung in '
                     f'der Zeichnung für den {l}')
     layout = QVBoxLayout()
     dialog.setLayout(layout)
     table_widget = QTableWidget()
     layout.addWidget(table_widget)
     table_widget.setColumnCount(2)
     table_widget.setHorizontalHeaderItem(
         0, QTableWidgetItem('Bodenbedeckungstyp'))
     table_widget.setHorizontalHeaderItem(1, QTableWidgetItem('Anteil'))
     types = self.bb_types.features()
     table_widget.setRowCount(len(types))
     for i, bb_typ in enumerate(types):
         share = shares.get(bb_typ.IDBodenbedeckung) or 0
         table_widget.setItem(i, 0, QTableWidgetItem(bb_typ.name))
         table_widget.setItem(i, 1, QTableWidgetItem(f'{share}%'))
     table_widget.setSizeAdjustPolicy(QAbstractScrollArea.AdjustToContents)
     table_widget.resizeColumnsToContents()
     dialog.showEvent = lambda e: dialog.adjustSize()
     dialog.show()
示例#3
0
    def add_table_control_tab_dockwidget(self):
        """
        Create a tab for the measure group within the Rule group tab
        in the dockwidget.
        """
        tab = QWidget()
        layout = QVBoxLayout(tab)
        tab.setLayout(layout)

        label_field = QLabel(tab)
        label_field.setGeometry(10, 10, 300, 21)
        label_field.setText("Measure variable: {}".format(
            self.combobox_input_rule_measure_variable.currentText()))

        label_field = QLabel(tab)
        label_field.setGeometry(10, 40, 300, 21)
        label_field.setText("Operator: {}".format(
            self.combobox_input_rule_operator.currentText()))

        label_field = QLabel(tab)
        label_field.setGeometry(310, 10, 300, 21)
        label_field.setText("Structure type: {}".format(
            self.combobox_input_structure_table.currentText()))

        label_field = QLabel(tab)
        label_field.setGeometry(310, 40, 300, 21)
        label_field.setText("Structure id: {}".format(
            self.combobox_input_structure_id.currentText()))

        label_field = QLabel(tab)
        label_field.setGeometry(310, 70, 741, 21)
        label_field.setText("Action type: {}".format(
            self.combobox_input_action_type.currentText()))

        table_control_table = QTableWidget(tab)
        table_control_table.setGeometry(10, 100, 741, 181)
        table_control_table.insertColumn(0)
        table_control_table.setHorizontalHeaderItem(
            0, QTableWidgetItem("measuring_value"))
        table_control_table.insertColumn(1)
        table_control_table.setHorizontalHeaderItem(
            1, QTableWidgetItem("action_value"))
        table_control_table.setEditTriggers(QAbstractItemView.NoEditTriggers)
        self.dockwidget_controlled_structures.table_control_view = table_control_table

        self.dockwidget_controlled_structures.tab_table_control_view.insertTab(
            0, tab, "Table control: {}".format(str(self.table_control_id)))
示例#4
0
    def create_control_group_tab(self, control_group_id, control_group):
        """
        Create a tab in the Control group tab. The tab is added to the left.

        Args:
            (int) control_group_id: The id of the control group.
            (list) control_group: A list of tuples containing the attributes
                                  of the control group.
        """
        tab = QWidget()
        layout = QVBoxLayout(tab)
        tab.setLayout(layout)

        label_field = QLabel(tab)
        label_field.setGeometry(10, 10, 741, 21)
        label_field.setText("Name: {}".format(control_group[2]))

        label_field = QLabel(tab)
        label_field.setGeometry(10, 40, 741, 51)
        label_field.setText("Description: {}".format(control_group[0]))

        control_group_table = QTableWidget(tab)
        control_group_table.setGeometry(10, 100, 741, 181)
        control_group_table.insertColumn(0)
        control_group_table.setHorizontalHeaderItem(
            0, QTableWidgetItem("measuring_group_id"))
        control_group_table.insertColumn(1)
        control_group_table.setHorizontalHeaderItem(
            1, QTableWidgetItem("rule_type"))
        control_group_table.insertColumn(2)
        control_group_table.setHorizontalHeaderItem(
            2, QTableWidgetItem("rule_id"))
        control_group_table.insertColumn(3)
        control_group_table.setHorizontalHeaderItem(
            3, QTableWidgetItem("structure"))
        control_group_table.insertColumn(4)
        control_group_table.setHorizontalHeaderItem(
            4, QTableWidgetItem("structure_id"))
        control_group_table.setEditTriggers(QAbstractItemView.NoEditTriggers)
        # Add the tab to the tabwidget in the dockwidget
        self.dockwidget_controlled_structures.control_group_table = control_group_table
        self.dockwidget_controlled_structures.tab_control_view.insertTab(
            0, tab, "Control group: {}".format(str(control_group_id)))
示例#5
0
    def add_control_group_tab_dockwidget(self):
        """
        Create a tab for the measure group within the Measure group tab
        in the dockwidget.
        """
        tab = QWidget()
        layout = QVBoxLayout(tab)
        tab.setLayout(layout)

        label_field = QLabel(tab)
        label_field.setGeometry(10, 10, 741, 21)
        label_field.setText("Name: {}".format(
            self.lineedit_input_control_name.text()))

        label_field = QLabel(tab)
        label_field.setGeometry(10, 40, 741, 51)
        label_field.setText("Description: {}".format(
            self.textedit_input_control_description.toPlainText()))

        control_group_table = QTableWidget(tab)
        control_group_table.setGeometry(10, 100, 741, 181)
        control_group_table.insertColumn(0)
        control_group_table.setHorizontalHeaderItem(
            0, QTableWidgetItem("measuring_group_id"))
        control_group_table.insertColumn(1)
        control_group_table.setHorizontalHeaderItem(
            1, QTableWidgetItem("rule_type"))
        control_group_table.insertColumn(2)
        control_group_table.setHorizontalHeaderItem(
            2, QTableWidgetItem("rule_id"))
        control_group_table.insertColumn(3)
        control_group_table.setHorizontalHeaderItem(
            3, QTableWidgetItem("structure"))
        control_group_table.insertColumn(4)
        control_group_table.setHorizontalHeaderItem(
            4, QTableWidgetItem("structure_id"))
        control_group_table.setEditTriggers(QAbstractItemView.NoEditTriggers)
        # Add the tab to the tabwidget in the dockwidget
        self.dockwidget_controlled_structures.control_group_table = control_group_table

        self.dockwidget_controlled_structures.tab_control_view.insertTab(
            0, tab, "Control group: {}".format(str(self.control_group_id)))
示例#6
0
    def create_measuring_group_tab(self, measuring_group_id):
        """
        Create a new measuring group in te Measuring group tab.
        The new tab is added to the left.
        """
        tab = QWidget()
        layout = QVBoxLayout(tab)
        tab.setLayout(layout)

        table_measuring_group = QTableWidget(tab)
        table_measuring_group.setGeometry(10, 10, 741, 266)
        table_measuring_group.insertColumn(0)
        table_measuring_group.setHorizontalHeaderItem(
            0, QTableWidgetItem("table"))
        table_measuring_group.insertColumn(1)
        table_measuring_group.setHorizontalHeaderItem(
            1, QTableWidgetItem("table_id"))
        table_measuring_group.insertColumn(2)
        table_measuring_group.setHorizontalHeaderItem(
            2, QTableWidgetItem("weight"))
        table_measuring_group.setEditTriggers(QAbstractItemView.NoEditTriggers)
        self.dockwidget_controlled_structures.table_measuring_group = (
            table_measuring_group)
        # Set the new tab as the first tab
        self.dockwidget_controlled_structures.tab_measuring_group_view_2.insertTab(
            0, tab, "Group: {}".format(str(measuring_group_id)))
示例#7
0
    def add_measuring_group_tab_dockwidget(self):
        """
        Create a tab for the measure group within the Measure group tab
        in the dockwidget.
        """
        tab = QWidget()
        layout = QVBoxLayout(tab)
        tab.setLayout(layout)

        table_measuring_group = QTableWidget(tab)
        table_measuring_group.setGeometry(10, 10, 741, 266)
        table_measuring_group.insertColumn(0)
        table_measuring_group.setHorizontalHeaderItem(0, QTableWidgetItem("table"))
        table_measuring_group.insertColumn(1)
        table_measuring_group.setHorizontalHeaderItem(1, QTableWidgetItem("table_id"))
        table_measuring_group.insertColumn(2)
        table_measuring_group.setHorizontalHeaderItem(2, QTableWidgetItem("weight"))
        table_measuring_group.setEditTriggers(QAbstractItemView.NoEditTriggers)
        self.dockwidget_controlled_structures.table_measuring_group = (
            table_measuring_group
        )
        # Add the tab to the left
        self.dockwidget_controlled_structures.tab_measuring_group_view_2.insertTab(
            0, tab, "Group: {}".format(str(self.label_measuring_group_id_info.text()))
        )