def fill_geomcat_id(self):
     
     catalog_id = utils_giswater.getWidgetText(self.dlg_cat.id)
     self.close_dialog(self.dlg_cat)
     utils_giswater.setDialog(self.dlg)
     utils_giswater.setWidgetEnabled(self.dlg.node_nodecat_id, True)
     utils_giswater.setWidgetText(self.dlg.node_nodecat_id, catalog_id)        
示例#2
0
    def check_url(self):
        """ Check URL. Enable/Disable button that opens it """

        selected_list = self.tbl_hydrometer.selectionModel().selectedRows()
        if len(selected_list) == 0:
            message = "Any record selected"
            self.controller.show_warning(message)
            return

        row = selected_list[0].row()
        url = self.tbl_hydrometer.model().record(row).value("hydrometer_link")
        if url != '':
            self.url = url
            utils_giswater.setWidgetEnabled("open_link")
        else:
            utils_giswater.setWidgetEnabled("open_link", False)
示例#3
0
    def edit_change_elem_type_get_value(self, index):
        """ Just select item to 'real' combo 'nodecat_id' (that is hidden) """

        if index == -1:
            return

        # Get selected value from 2nd combobox
        node_node_type_new = utils_giswater.getWidgetText("node_node_type_new")

        # When value is selected, enabled 3rd combo box
        if node_node_type_new != 'null':
            # Fill 3rd combo_box-catalog_id
            utils_giswater.setWidgetEnabled(self.dlg.node_nodecat_id, True)
            sql = ("SELECT DISTINCT(id)"
                   " FROM " + self.schema_name + ".cat_node"
                   " WHERE nodetype_id = '" + str(node_node_type_new) + "'")
            rows = self.controller.get_rows(sql)
            utils_giswater.fillComboBox(self.dlg.node_nodecat_id, rows)
示例#4
0
 def enable_linetext(self, widget1, widget2, text):
     """ Enable or disable txt """
     if utils_giswater.getWidgetText(widget1) == text:
         utils_giswater.setWidgetEnabled(widget2, False)
     else:
         utils_giswater.setWidgetEnabled(widget2, True)
示例#5
0
    def init_config_form(self):
        """ Custom form initial configuration """

        # Define class variables
        self.field_id = "connec_id"
        self.id = utils_giswater.getWidgetText(self.field_id, False)
        self.filter = self.field_id + " = '" + str(self.id) + "'"
        self.connecat_id = self.dialog.findChild(QLineEdit, 'connecat_id')
        self.connec_type = self.dialog.findChild(QComboBox, 'connec_type')

        # Get widget controls
        self.tab_main = self.dialog.findChild(QTabWidget, "tab_main")
        self.tbl_element = self.dialog.findChild(QTableView, "tbl_element")
        self.tbl_document = self.dialog.findChild(QTableView, "tbl_document")
        self.tbl_event = self.dialog.findChild(QTableView, "tbl_event_connec")
        self.tbl_hydrometer = self.dialog.findChild(QTableView,
                                                    "tbl_hydrometer")
        self.tbl_hydrometer_value = self.dialog.findChild(
            QTableView, "tbl_hydrometer_value")
        self.tbl_hydrometer.setSelectionBehavior(QAbstractItemView.SelectRows)
        self.tbl_hydrometer.clicked.connect(self.check_url)

        # Manage custom fields
        connectype_id = self.dialog.findChild(QLineEdit, "connectype_id")
        self.feature_cat_id = connectype_id.text()
        tab_custom_fields = 4
        self.manage_custom_fields(self.feature_cat_id, tab_custom_fields)

        # Manage tab visibility
        self.set_tabs_visibility(tab_custom_fields - 1)

        self.dialog.findChild(QPushButton, "btn_catalog").clicked.connect(
            partial(self.catalog, 'ws', 'connec'))

        open_link = self.dialog.findChild(QPushButton, "open_link")
        utils_giswater.setWidgetEnabled("open_link", False)
        open_link.clicked.connect(self.open_url)

        feature = self.feature
        layer = self.iface.activeLayer()

        # Toolbar actions
        action = self.dialog.findChild(QAction, "actionEnabled")
        action.setChecked(layer.isEditable())
        self.dialog.findChild(QAction, "actionZoom").triggered.connect(
            partial(self.action_zoom_in, feature, self.canvas, layer))
        self.dialog.findChild(QAction, "actionCentered").triggered.connect(
            partial(self.action_centered, feature, self.canvas, layer))
        self.dialog.findChild(QAction, "actionEnabled").triggered.connect(
            partial(self.action_enabled, action, layer))
        self.dialog.findChild(QAction, "actionZoomOut").triggered.connect(
            partial(self.action_zoom_out, feature, self.canvas, layer))
        self.dialog.findChild(QAction, "actionLink").triggered.connect(
            partial(self.check_link, True))

        # Manage tab signal
        self.tab_hydrometer_loaded = False
        self.tab_element_loaded = False
        self.tab_document_loaded = False
        self.tab_om_loaded = False
        self.tab_main.currentChanged.connect(self.tab_activation)
    def init_config_form(self):
        """ Custom form initial configuration """

        # Define class variables
        self.filter = self.field_id + " = '" + str(self.id) + "'"
        self.connecat_id = self.dialog.findChild(QLineEdit, 'connecat_id')
        self.connec_type = self.dialog.findChild(QComboBox, 'connec_type')

        # Get widget controls
        self.tab_main = self.dialog.findChild(QTabWidget, "tab_main")
        self.tbl_element = self.dialog.findChild(QTableView, "tbl_element")
        self.tbl_document = self.dialog.findChild(QTableView, "tbl_document")
        self.tbl_event = self.dialog.findChild(QTableView, "tbl_event_connec")
        self.tbl_hydrometer = self.dialog.findChild(QTableView,
                                                    "tbl_hydrometer")
        self.tbl_hydrometer_value = self.dialog.findChild(
            QTableView, "tbl_hydrometer_value")
        state_type = self.dialog.findChild(QComboBox, 'state_type')
        dma_id = self.dialog.findChild(QComboBox, 'dma_id')
        presszonecat_id = self.dialog.findChild(QComboBox, 'presszonecat_id')

        self.tbl_hydrometer.setSelectionBehavior(QAbstractItemView.SelectRows)
        self.tbl_hydrometer.clicked.connect(self.check_url)

        # Manage custom fields
        connectype_id = self.dialog.findChild(QLineEdit, "connectype_id")
        cat_feature_id = utils_giswater.getWidgetText(connectype_id)
        tab_custom_fields = 1
        self.manage_custom_fields(cat_feature_id, tab_custom_fields)

        # Check if exist URL from field 'link' in main tab
        self.check_link()

        self.dialog.findChild(QPushButton, "btn_catalog").clicked.connect(
            partial(self.catalog, 'ws', 'connec'))

        open_link = self.dialog.findChild(QPushButton, "open_link")
        utils_giswater.setWidgetEnabled("open_link", False)
        open_link.clicked.connect(self.open_url)

        feature = self.feature
        layer = self.iface.activeLayer()

        # Toolbar actions
        action = self.dialog.findChild(QAction, "actionEnabled")
        action.setChecked(layer.isEditable())
        self.dialog.findChild(QAction, "actionZoom").triggered.connect(
            partial(self.action_zoom_in, feature, self.canvas, layer))
        self.dialog.findChild(QAction, "actionCentered").triggered.connect(
            partial(self.action_centered, feature, self.canvas, layer))
        self.dialog.findChild(QAction, "actionEnabled").triggered.connect(
            partial(self.action_enabled, action, layer))
        self.dialog.findChild(QAction, "actionZoomOut").triggered.connect(
            partial(self.action_zoom_out, feature, self.canvas, layer))
        self.dialog.findChild(QAction, "actionLink").triggered.connect(
            partial(self.check_link, True))

        # Manage tab signal
        self.tab_hydrometer_loaded = False
        self.tab_element_loaded = False
        self.tab_document_loaded = False
        self.tab_om_loaded = False
        self.tab_main.currentChanged.connect(self.tab_activation)

        # Load default settings
        widget_id = self.dialog.findChild(QLineEdit, 'connec_id')
        if utils_giswater.getWidgetText(widget_id).lower() == 'null':
            self.load_default()
            cat_id = self.controller.get_layer_source_table_name(layer)
            cat_id = cat_id.replace('v_edit_man_', '')
            cat_id += 'cat_vdefault'
            self.load_type_default("connecat_id", cat_id)

        self.load_state_type(state_type, self.geom_type)
        self.load_dma(dma_id, self.geom_type)
        self.load_pressure_zone(presszonecat_id, self.geom_type)