diff --git a/actions/ed.py b/actions/ed.py index dbff62a0a..a023722be 100644 --- a/actions/ed.py +++ b/actions/ed.py @@ -57,8 +57,8 @@ def ed_search_plus(self): try: if self.search_plus is not None: self.search_plus.dlg.setVisible(True) - except RuntimeError as e: - print "Error ed_search_plus: "+str(e) + except RuntimeError : + pass def ed_check(self): diff --git a/actions/mg.py b/actions/mg.py index 776ded1a8..893c2743b 100644 --- a/actions/mg.py +++ b/actions/mg.py @@ -93,9 +93,7 @@ def mg_arc_topo_repair_accept(self): sql = "SELECT "+self.schema_name+".gw_fct_anl_node_sink();" self.controller.execute_sql(sql) - # Show message and close the dialog - #message = "Selected functions have been executed" - #self.controller.show_info(message, context_name='ui_message') + # Close the dialog self.close_dialog() # Refresh map canvas @@ -320,9 +318,7 @@ def mg_go2epa_accept(self): self.gsw_settings.setValue('FILE_RPT', self.file_rpt) self.gsw_settings.setValue('PROJECT_NAME', self.project_name) - # Show message and close form -# message = "Values has been updated" -# self.controller.show_info(message, context_name='ui_message') + # Close form self.close_dialog(self.dlg) @@ -550,7 +546,7 @@ def mg_change_elem_type_accept(self): message = "Node type has been update!" self.controller.show_info(message, context_name='ui_message' ) - # Close dialog + # Close form self.close_dialog() diff --git a/controller.py b/controller.py index 4c133ead3..45ba572c5 100644 --- a/controller.py +++ b/controller.py @@ -52,12 +52,9 @@ def check_action(self, check=True, index=1): key = index if type(index) is int: key = str(index).zfill(2) - print key if key in self.actions: action = self.actions[key] - action.setChecked(check) - else: - print "not found: "+str(index) + action.setChecked(check) def set_database_connection(self): diff --git a/giswater.py b/giswater.py index d774e63be..09463e29b 100644 --- a/giswater.py +++ b/giswater.py @@ -512,8 +512,6 @@ def set_map_tool(self, map_tool_name): map_tool.set_controller(self.controller) if map_tool_name == 'mg_extract_raster_value': map_tool.set_config_action(self.actions['99']) - else: - print "key not found: "+map_tool_name def set_search_plus(self): @@ -576,10 +574,10 @@ def current_layer_changed(self, layer): index_action = str(list_index_action) if index_action != '-1' and str(index_action) in self.actions: self.actions[index_action].setEnabled(True) - except AttributeError, e: - print "current_layer_changed: "+str(e) - except KeyError, e: - print "current_layer_changed: "+str(e) + except AttributeError: + pass + except KeyError: + pass def custom_enable_actions(self): diff --git a/map_tools/connec.py b/map_tools/connec.py index 2291d831f..e34fc886f 100644 --- a/map_tools/connec.py +++ b/map_tools/connec.py @@ -76,7 +76,6 @@ def canvasMoveEvent(self, event): # Plugin reloader bug, MapTool should be deactivated if not hasattr(Qt, 'LeftButton'): - print "Plugin loader bug" self.iface.actionPan().trigger() return @@ -100,7 +99,7 @@ def canvasMoveEvent(self, event): eventPoint = QPoint(x, y) # Snapping - (retval, result) = self.snapper.snapToBackgroundLayers(eventPoint) # @UnusedVariable + (retval, result) = self.snapper.snapToBackgroundLayers(eventPoint) #@UnusedVariable # That's the snapped point if result <> []: @@ -120,7 +119,7 @@ def canvasMoveEvent(self, event): break - def canvasPressEvent(self, event): + def canvasPressEvent(self, event): #@UnusedVariable self.selectRect.setRect(0, 0, 0, 0) self.rubberBand.reset() diff --git a/map_tools/delete_node.py b/map_tools/delete_node.py index 57925e6d8..257086b13 100644 --- a/map_tools/delete_node.py +++ b/map_tools/delete_node.py @@ -58,8 +58,7 @@ def canvasMoveEvent(self, event): # Plugin reloader bug, MapTool should be deactivated try: eventPoint = QPoint(x, y) - except(TypeError,KeyError) as e: - print "Plugin loader bug" + except(TypeError,KeyError): self.iface.actionPan().trigger() return @@ -106,11 +105,8 @@ def canvasReleaseEvent(self, event): if snapPoint.layer.name() == self.layer_node.name(): # Get the point - point = QgsPoint(result[0].snappedVertex) - - snappFeat = next( - result[0].layer.getFeatures(QgsFeatureRequest().setFilterFid(result[0].snappedAtGeometry))) - + point = QgsPoint(result[0].snappedVertex) #@UnusedVariable + snappFeat = next(result[0].layer.getFeatures(QgsFeatureRequest().setFilterFid(result[0].snappedAtGeometry))) break if snappFeat is not None: diff --git a/map_tools/extract_raster_value.py b/map_tools/extract_raster_value.py index 231e59a67..085f67a4a 100644 --- a/map_tools/extract_raster_value.py +++ b/map_tools/extract_raster_value.py @@ -84,10 +84,8 @@ def canvasMoveEvent(self, event): if self.vectorLayer is None: return - # Plugin reloader bug, MapTool should be deactivated if not hasattr(Qt, 'LeftButton'): - print "Plugin loader bug" self.iface.actionPan().trigger() return @@ -132,7 +130,7 @@ def canvasMoveEvent(self, event): break - def canvasPressEvent(self, event): + def canvasPressEvent(self, event): #@UnusedVariable self.selectRect.setRect(0, 0, 0, 0) self.rubberBand.reset() diff --git a/map_tools/flow_trace_flow_exit.py b/map_tools/flow_trace_flow_exit.py index c1ce67d9c..e37ed9244 100644 --- a/map_tools/flow_trace_flow_exit.py +++ b/map_tools/flow_trace_flow_exit.py @@ -57,17 +57,14 @@ def canvasMoveEvent(self, event): # Get the click x = event.pos().x() y = event.pos().y() - # Plugin reloader bug, MapTool should be deactivated try: eventPoint = QPoint(x, y) - except(TypeError,KeyError) as e: - print "Plugin loader bug" + except(TypeError,KeyError): self.iface.actionPan().trigger() return - # Snapping (retval,result) = self.snapper.snapToBackgroundLayers(eventPoint) #@UnusedVariable self.current_layer = None @@ -102,6 +99,7 @@ def canvasMoveEvent(self, event): def canvasReleaseEvent(self, event): ''' With left click the digitizing is finished ''' + if event.button() == Qt.LeftButton and self.current_layer is not None: # Get selected layer type: 'node' @@ -120,12 +118,10 @@ def canvasReleaseEvent(self, event): function_name = "gw_fct_flow_trace" sql = "SELECT "+self.schema_name+"."+function_name+"('"+str(elem_id)+"');" result = self.controller.execute_sql(sql) - print sql else: function_name = "gw_fct_flow_exit" sql = "SELECT "+self.schema_name+"."+function_name+"('"+str(elem_id)+"');" result = self.controller.execute_sql(sql) - print sql if result: # Get 'arc' and 'node' list and select them diff --git a/map_tools/line.py b/map_tools/line.py index fd1e60f7e..a5ca377f7 100644 --- a/map_tools/line.py +++ b/map_tools/line.py @@ -313,11 +313,9 @@ def sendGeometry(self): def createFeature(self, geom): - # layer = self.canvas.currentLayer() layer = self.iface.activeLayer() provider = layer.dataProvider() f = QgsFeature() - if (geom.isGeosValid()): f.setGeometry(geom) else: @@ -328,7 +326,6 @@ def createFeature(self, geom): f.setGeometry(geom) else: return False - # Add attribute fields to feature. fields = layer.pendingFields() diff --git a/map_tools/mincut.py b/map_tools/mincut.py index 8dbe66e84..ab88fa67a 100644 --- a/map_tools/mincut.py +++ b/map_tools/mincut.py @@ -61,8 +61,7 @@ def canvasMoveEvent(self, event): # Plugin reloader bug, MapTool should be deactivated try: eventPoint = QPoint(x, y) - except(TypeError,KeyError) as e: - print "Plugin loader bug" + except(TypeError,KeyError): self.iface.actionPan().trigger() return @@ -120,7 +119,6 @@ def canvasReleaseEvent(self, event): function_name = "gw_fct_mincut" sql = "SELECT "+self.schema_name+"."+function_name+"('"+str(elem_id)+"', '"+elem_type+"');" result = self.controller.execute_sql(sql) - print sql if result: # Get 'arc' and 'node' list and select them self.mg_flow_trace_select_features(self.layer_arc, 'arc') diff --git a/map_tools/move_node.py b/map_tools/move_node.py index 20a8b8a88..35d267e0f 100644 --- a/map_tools/move_node.py +++ b/map_tools/move_node.py @@ -165,8 +165,7 @@ def canvasMoveEvent(self, event): # Plugin reloader bug, MapTool should be deactivated try: eventPoint = QPoint(x, y) - except(TypeError,KeyError) as e: - print "Plugin loader bug" + except(TypeError,KeyError): self.iface.actionPan().trigger() return diff --git a/parent_init.py b/parent_init.py index 3a7cdebf8..bb55b1e06 100644 --- a/parent_init.py +++ b/parent_init.py @@ -10,7 +10,7 @@ import sys import utils_giswater -from controller import DaoController +from controller import DaoController #@UnresolvedImport class ParentDialog(object): diff --git a/search/search_plus.py b/search/search_plus.py index f06d08c6d..a544aca7b 100644 --- a/search/search_plus.py +++ b/search/search_plus.py @@ -146,26 +146,22 @@ def populate_dialog(self): status = self.populate_combo('hydrometer_layer', self.dlg.hydrometer_code, self.params['hydrometer_field_urban_propierties_code'], self.params['hydrometer_field_code']) if not status: - #print "Error populating Tab 'Hydrometer'" self.dlg.tab_main.removeTab(3) # Tab 'Address' status = self.address_populate('street_layer') if not status: - #print "Error populating Tab 'Address'" self.dlg.tab_main.removeTab(2) # Tab 'Ppoint' status = self.populate_combo('ppoint_layer', self.dlg.ppoint_field_zone, self.params['ppoint_field_zone']) status_2 = self.populate_combo('ppoint_layer', self.dlg.ppoint_number, self.params['ppoint_field_number']) if not status or not status_2: - #print "Error populating Tab 'Ppoint'" self.dlg.tab_main.removeTab(1) # Tab 'Urban Properties' status = self.urban_populate('urban_propierties_layer') if not status: - #print "Error populating Tab 'Urban Properties'" self.dlg.tab_main.removeTab(0) return True @@ -175,9 +171,7 @@ def address_populate(self, parameter): ''' Populate combo 'address_street' ''' # Check if we have this search option available - if not parameter in self.layers: - #message = "Layer '{}' not found in parameter '{}'".format(self.params[parameter], parameter) - #print message + if not parameter in self.layers: return False # Get layer features @@ -215,8 +209,7 @@ def address_get_numbers(self): # get selected street selected = self.dlg.adress_street.currentText() - if selected == '': - print "Any record selected" + if selected == '': return # get street code @@ -271,8 +264,7 @@ def address_zoom_street(self): # Get selected street selected = self.dlg.adress_street.currentText() - if selected == '': - print "Any record selected" + if selected == '': return data = self.dlg.adress_street.itemData(self.dlg.adress_street.currentIndex()) @@ -298,7 +290,6 @@ def address_zoom_portal(self): street = self.dlg.adress_street.currentText() civic = self.dlg.adress_number.currentText() if street == '' or civic == '': - print "Any record selected" return # Get selected portal @@ -346,7 +337,6 @@ def generic_zoom(self, fieldname, combo, field_index=0): # Get selected element from combo element = combo.currentText() if element.strip() == '': - print "Any record selected" return None elem = combo.itemData(combo.currentIndex()) @@ -583,8 +573,6 @@ def populate_combo(self, parameter, combo, fieldname, fieldname_2=None): # Check if we have this search option available if not parameter in self.layers: - message = "Layer '{}' not found in parameter '{}'".format(self.params[parameter], parameter) - print(message) return False # Fields management diff --git a/ud_arc_init.py b/ud_arc_init.py index d05c19a41..4d7c95f08 100644 --- a/ud_arc_init.py +++ b/ud_arc_init.py @@ -48,9 +48,6 @@ def init_config_form(self): # Manage i18n self.translate_form(context_name) - # Load data from related tables - #self.load_data() - #Set layer in editing mode self.layer.startEditing() diff --git a/ud_connec_init.py b/ud_connec_init.py index cbab060af..43a33c4d4 100644 --- a/ud_connec_init.py +++ b/ud_connec_init.py @@ -48,10 +48,7 @@ def init_config_form(self): # Manage i18n self.translate_form(context_name) - # Load data from related tables - #self.load_data() - - #Set layer in editing mode + #Set layer in editing mode self.layer.startEditing() # Fill the info table diff --git a/ud_gully_init.py b/ud_gully_init.py index 1c9a7648c..590b19b44 100644 --- a/ud_gully_init.py +++ b/ud_gully_init.py @@ -50,10 +50,7 @@ def init_config_form(self): # Manage i18n self.translate_form(context_name) - # Load data from related tables - #self.load_data() - - #Set layer in editing mode + # Set layer in editing mode self.layer.startEditing() # Fill the info table diff --git a/ud_node_init.py b/ud_node_init.py index 77347752c..eb0b9f351 100644 --- a/ud_node_init.py +++ b/ud_node_init.py @@ -48,10 +48,7 @@ def init_config_form(self): # Manage i18n self.translate_form(context_name) - # Load data from related tables - #self.load_data() - - #Set layer in editing mode + # Set layer in editing mode self.layer.startEditing() # Fill the info table diff --git a/utils_giswater.py b/utils_giswater.py index d4246aa4d..8927ab4c8 100644 --- a/utils_giswater.py +++ b/utils_giswater.py @@ -31,7 +31,6 @@ def fillComboBoxDict(widget, dict_object, dict_field, allow_nulls=True): if type(widget) is str: widget = _dialog.findChild(QComboBox, widget) if widget is None: - print "Combo not found: "+str(widget) return None # Populate combo with values stored in dictionary variable @@ -54,8 +53,7 @@ def getText(widget): if type(widget) is QLineEdit or type(widget) is QDoubleSpinBox: text = widget.text() elif type(widget) is QTextEdit: - text = widget.toPlainText() - print text + text = widget.toPlainText() if text: elem_text = text else: diff --git a/ws_arc_init.py b/ws_arc_init.py index 2bf383945..bc7005341 100644 --- a/ws_arc_init.py +++ b/ws_arc_init.py @@ -84,8 +84,8 @@ def init_config_form(self): # Load data from related tables self.load_data() - - #Set layer in editing mode + + # Set layer in editing mode self.layer.startEditing() # Fill the info table diff --git a/ws_connec_init.py b/ws_connec_init.py index 1bea7fd81..a31c222e5 100644 --- a/ws_connec_init.py +++ b/ws_connec_init.py @@ -87,8 +87,8 @@ def init_config_form(self): # Load data from related tables self.load_data() - - #Set layer in editing mode + + # Set layer in editing mode self.layer.startEditing() # Fill the info table @@ -295,8 +295,7 @@ def update_sum(self): self.tbl_dae_2.model().select() else: self.tbl_dae_2.model().database().rollback() - error = self.tbl_dae_2.model().lastError() - print str(error.text()) self.save() + \ No newline at end of file diff --git a/ws_node_init.py b/ws_node_init.py index 672fe0cd1..8a20829c3 100644 --- a/ws_node_init.py +++ b/ws_node_init.py @@ -87,8 +87,8 @@ def init_config_form(self): # Load data from related tables self.load_data() - - #Set layer in editing mode + + # Set layer in editing mode self.layer.startEditing() # Fill the info table