Skip to content

Commit

Permalink
Remove unused functions
Browse files Browse the repository at this point in the history
  • Loading branch information
daviderill committed Apr 16, 2018
1 parent 8ed7b3e commit a2bf805
Show file tree
Hide file tree
Showing 22 changed files with 94 additions and 184 deletions.
4 changes: 2 additions & 2 deletions __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@

# noinspection PyPep8Naming
def classFactory(iface): # pylint: disable=invalid-name
''' Load Giswater class from file giswater.
""" Load Giswater class from file giswater.
:param iface: A QGIS interface instance.
:type iface: QgsInterface
'''
"""
from giswater import Giswater
return Giswater(iface)
6 changes: 0 additions & 6 deletions actions/edit.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,6 @@ def edit_add_element(self):
def edit_add_file(self):
""" Button 34: Add document """
self.manage_document.manage_document()


def add_new_doc(self):
""" Call function of button Add document """
self.edit_add_file()


def edit_document(self):
Expand All @@ -70,4 +65,3 @@ def edit_end_feature(self):
""" Button 68: Edit end feature """
self.manage_workcat_end.manage_workcat_end()


16 changes: 1 addition & 15 deletions actions/manage_new_psector.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,10 +248,6 @@ def new_psector(self, psector_id=None, plan_om=None):
self.geom_type = "arc"
self.tab_feature_changed(table_object)

# Set QTableview columns from table config_client_forms
# self.set_table_columns(self.qtbl_arc, self.plan_om + "_psector_x_arc")
# self.set_table_columns(self.qtbl_node, self.plan_om + "_psector_x_node")

# Open dialog
self.open_dialog(self.dlg, maximize_button=False)

Expand Down Expand Up @@ -534,15 +530,6 @@ def enable_buttons(self, enabled):
self.dlg.btn_snapping.setEnabled(enabled)


def delete_feature_at_plan_psector(self, geom_type, list_id, plan_om):
""" Delete features_id to table plan_@geom_type_x_psector"""

value = utils_giswater.getWidgetText(self.dlg.psector_id)
sql = ("DELETE FROM " + self.schema_name + "." + plan_om + "_psector_x_" + geom_type + ""
" WHERE " + geom_type + "_id IN (" + list_id + ") AND psector_id = '" + str(value) + "'")
self.controller.execute_sql(sql)


def selection_init(self, table_object, query=True):
""" Set canvas map tool to an instance of class 'MultipleSelection' """

Expand Down Expand Up @@ -597,13 +584,12 @@ def check_tab_position(self):
self.insert_or_update_new_psector(tablename='v_edit_'+self.plan_om + '_psector', close_dlg=False)
self.update = True
if self.dlg.tabWidget.currentIndex() == 2:

tableleft = "v_price_compost"
tableright = "v_edit_" + self.plan_om + "_psector_x_other"
field_id_right = "price_id"
self.price_selector(self.dlg, tableleft, tableright, field_id_right)
self.update_total(self.dlg.selected_rows)
if self.dlg.tabWidget.currentIndex() == 3:
elif self.dlg.tabWidget.currentIndex() == 3:
self.populate_budget(utils_giswater.getWidgetText('psector_id'))

sql = ("SELECT other, gexpenses, vat"
Expand Down
6 changes: 3 additions & 3 deletions actions/mincut.py
Original file line number Diff line number Diff line change
Expand Up @@ -1046,7 +1046,7 @@ def reload_table_hydro(self, expr_filter=None):


def delete_records_connec(self):
''' Delete selected rows of the table '''
""" Delete selected rows of the table """

self.disconnect_signal_selection_changed()

Expand Down Expand Up @@ -1096,7 +1096,7 @@ def delete_records_connec(self):


def delete_records_hydro(self):
''' Delete selected rows of the table '''
""" Delete selected rows of the table """

# Get selected rows
widget = self.dlg_hydro.tbl_hydro
Expand Down Expand Up @@ -2108,7 +2108,7 @@ def address_zoom_portal(self, dialog):


def mincut_composer(self):
''' Open Composer '''
""" Open Composer """

# Set dialog add_connec
self.dlg_comp = MincutComposer()
Expand Down
4 changes: 2 additions & 2 deletions actions/multiple_selection.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
'''
"""
This file is part of Giswater 2.0
The program is free software: you can redistribute it and/or modify it under the terms of the GNU
General Public License as published by the Free Software Foundation, either version 3 of the License,
or (at your option) any later version.
'''
"""

# -*- coding: utf-8 -*-
from qgis.core import QgsFeatureRequest, QgsPoint, QgsRectangle, QGis
Expand Down
25 changes: 7 additions & 18 deletions actions/parent.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
class ParentAction(object):

def __init__(self, iface, settings, controller, plugin_dir):
''' Class constructor '''
""" Class constructor """

# Initialize instance attributes
self.giswater_version = "3.0"
Expand Down Expand Up @@ -52,7 +52,7 @@ def set_controller(self, controller):


def get_plugin_version(self):
''' Get plugin version from metadata.txt file '''
""" Get plugin version from metadata.txt file """

# Check if metadata file exists
metadata_file = os.path.join(self.plugin_dir, 'metadata.txt')
Expand All @@ -72,7 +72,7 @@ def get_plugin_version(self):


def get_giswater_jar(self):
''' Get executable Giswater file and build version from windows registry '''
""" Get executable Giswater file and build version from windows registry """

reg_hkey = "HKEY_LOCAL_MACHINE"
reg_path = "SOFTWARE\\Giswater\\"+self.giswater_version
Expand Down Expand Up @@ -126,7 +126,7 @@ def get_giswater_jar(self):


def get_java_exe(self):
''' Get executable Java file from windows registry '''
""" Get executable Java file from windows registry """

reg_hkey = "HKEY_LOCAL_MACHINE"
reg_path = "SOFTWARE\\JavaSoft\\Java Runtime Environment"
Expand Down Expand Up @@ -169,7 +169,7 @@ def get_java_exe(self):


def execute_giswater(self, parameter):
''' Executes giswater with selected parameter '''
""" Executes giswater with selected parameter """

if self.giswater_file_path is None or self.java_exe is None:
return
Expand Down Expand Up @@ -504,13 +504,6 @@ def fill_table_psector(self, widget, table_name, set_edit_strategy=QSqlTableMode
widget.setModel(self.model)


def update_combobox_values(self, widget, combo, x):
""" Insert combobox.currentText into widget (QTableView) """

index = widget.model().index(x, 4)
widget.model().setData(index, combo.currentText())


def fill_table(self, widget, table_name, set_edit_strategy=QSqlTableModel.OnManualSubmit):
""" Set a model with selected filter.
Attach that model to selected table """
Expand Down Expand Up @@ -595,11 +588,6 @@ def refresh_map_canvas(self, restore_cursor=False):
def set_cursor_wait(self):
""" Change cursor to 'WaitCursor' """
QApplication.setOverrideCursor(Qt.WaitCursor)


def set_cursor_arrow(self):
""" Change cursor to 'ArrowCursor' """
QApplication.setOverrideCursor(Qt.ArrowCursor)


def set_cursor_restore(self):
Expand Down Expand Up @@ -678,11 +666,12 @@ def disconnect_signal_selection_changed(self):


def set_label_current_psector(self):

sql = ("SELECT t1.name FROM " + self.schema_name + ".plan_psector AS t1 "
" INNER JOIN " + self.schema_name + ".config_param_user AS t2 ON t1.psector_id::text = t2.value "
" WHERE t2.parameter='psector_vdefault' AND cur_user = current_user")
row = self.controller.get_row(sql)
if not row:
return
utils_giswater.setWidgetText('lbl_vdefault_psector', row[0])

7 changes: 0 additions & 7 deletions actions/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -871,13 +871,6 @@ def write_csv(self, dialog, temp_tablename):
self.save_settings_values()


def get_data_from_combo(self, combo, position):

elem = combo.itemData(combo.currentIndex())
data = str(elem[position])
return data


def populate_combos(self, combo, field_id, fields, table_name, roles, allow_nulls=True):

if roles is None:
Expand Down
12 changes: 2 additions & 10 deletions dao/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,7 @@ def set_qgis_settings(self, qgis_settings):
self.qgis_settings = qgis_settings

def set_plugin_dir(self, plugin_dir):
self.plugin_dir = plugin_dir

def set_plugin_name(self, plugin_name):
self.plugin_name = plugin_name
self.plugin_dir = plugin_dir


def set_logger(self, logger_name):
Expand Down Expand Up @@ -105,12 +102,7 @@ def check_action(self, check=True, index=1):
key = str(index).zfill(2)
if key in self.actions:
action = self.actions[key]
action.setChecked(check)


def get_schema_name(self):
self.schema_name = self.plugin_settings_value('schema_name')
return self.schema_name
action.setChecked(check)


def set_database_connection(self):
Expand Down
Loading

0 comments on commit a2bf805

Please sign in to comment.