From 61372f04c24ae09b721a915bfed253b08bfb13f2 Mon Sep 17 00:00:00 2001 From: AbnerErnaniADSFatec Date: Tue, 21 Jan 2025 17:17:34 -0300 Subject: [PATCH] =?UTF-8?q?Revis=C3=A3o=20da=20exporta=C3=A7=C3=A3o=20de?= =?UTF-8?q?=20arquivos=20e=20remo=C3=A7=C3=A3o=20da=20edi=C3=A7=C3=A3o=20d?= =?UTF-8?q?e=20endere=C3=A7o=20do=20servi=C3=A7o=20WTSS=20#103?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- wtss_plugin/controller/assets/save-icon.png | Bin 0 -> 1210 bytes .../controller/files_export/files_export.py | 4 + wtss_plugin/wtss_qgis.py | 55 +++----- wtss_plugin/wtss_qgis_dialog_base.ui | 126 +++++------------- 4 files changed, 58 insertions(+), 127 deletions(-) create mode 100644 wtss_plugin/controller/assets/save-icon.png diff --git a/wtss_plugin/controller/assets/save-icon.png b/wtss_plugin/controller/assets/save-icon.png new file mode 100644 index 0000000000000000000000000000000000000000..bbc5e744acf650793cc580a83c4e98bc831a4261 GIT binary patch literal 1210 zcmeAS@N?(olHy`uVBq!ia0vp^2_VeD1|%QND7OGojKx9jP7LeL$-HD>U@7r*aSW-5 zdpq~^YTrPK1NGNuEOZYPQsuGn(&Rc>ynsig-`?SgppvqW2%FOsqt7Q6t903Pxtway zNJ?<|G~>jP37wF4|FY7=%;&Sq3oFl;<>_BM|JV<)Fd-o3O2P7fc2!p~;RSqcf33iD4M zC`l-JWSBYI{({Da_~;|1@z%`e7+=RquMUVguad#?XN|yx3G2SOIIU<{dtl>)z)+p# zuZ5gg&aldb@+?`lJ9eso(gT$Zp2mx~o|XAJbu|1w(8T3*rEI4*P*Dw|Tb6t9#Xm2A z>?w2qwp{UfnXFYHIpf)l&J{vV30Hj^3jEa$vi!OIcCv>7BlGpS^SocQHf&NoUHGzB zEX?fLJTHycXA&0cG2e>XtYaq?dE7}a`Q1#G>F2iet>(#)W%=^vKn|0Y|Lk?=S%d@j z<^A;fkn~D4=8Nfc)fJJw{Ve*+;too3f3Q@mF#O7OF2-ShOStOlY2v}_6NEp^Zg?+r z=i+ou4SSAk|HHlx+>I0FuG`simf`>0GKV(K0H!O;W;5tIrtU*9>&lp>>}iXsdU~#@ zO~x^`-KRllf!SS_3{I`jzF3)?#SCO-aGqg!#_+iz@qq9H%@0Bqj5T3S@21RK+c5V) zS;8FVJBJU*weOfP;SGxqgC65%+swVJ*O<=Rem-?*vyei(_}y@~B~Sh@w)2ZS8a-*@ zpC{f5pHe4C+*WxI+v8-(xr1X(CyVd2g^?4pQa7^XGMsZ`x)!f?Ehwa#QMoJF)AGl$ zd(#-or@ChACj>tJ^KYI|(C#m}2MSZ)-r~N&EfeCDHN8&i#)>tu)r{fN-WRk~mz2Ha zZ~S@c)>iQkj1sF`uIT;MHt>qv{f+6KbzC0D!we>w6(^@J3%5Sf+G4{X)}~_i^hzDu z8>T)D#jW1!v{;2H(^a# zzWc>qelg=_WP0!WQSF$7+&;#~jqe4!Qk5O@Z0))ke7tnJD`HN%H8gCNHfny;82Fu` z-L@v_ajI8%*X)mc59^)n#Pp|3mHukDeZ^z`$`I=;cAFDF&a@df?1}o^?p}NS!ivZ1 zCowQ?*-_YB=k>8o`)9bF5!+72`~N34e=iN6#aI~0&GA6g_9%;s`>XH^EI&SW$>lOF zQvRwvBc>r{`O07UEI$;>`=_M`9pBOZ-?I6`-6vj4V>WJiThCN3#m}Yxl~Gv9VV>5F zN0&X^HmY~+x1ZB4qvTMx?#Z%Z?n>5m40%6!EL|F|tbgr4{l|vvUR(YX!nJYHD;P4D zyvaGRTG^C?FG+IB6&CI3^Nn6^sb4W~+hwi^eJA~Atzopr0RK1|V*mgE literal 0 HcmV?d00001 diff --git a/wtss_plugin/controller/files_export/files_export.py b/wtss_plugin/controller/files_export/files_export.py index d1649b3..91a5163 100644 --- a/wtss_plugin/controller/files_export/files_export.py +++ b/wtss_plugin/controller/files_export/files_export.py @@ -145,6 +145,10 @@ def __init__(self): """Set the default values for files format.""" self.files_format = FilesFormat() + def getExportOptions(self): + """Set options to export result.""" + return ["CSV", "JSON", "Python"] + def generateCode(self, file_name, attributes): """Generate a python code file filling WTSS blank spaces. diff --git a/wtss_plugin/wtss_qgis.py b/wtss_plugin/wtss_qgis.py index acd7109..afa86a9 100644 --- a/wtss_plugin/wtss_qgis.py +++ b/wtss_plugin/wtss_qgis.py @@ -217,6 +217,7 @@ def initControls(self): self.addCanvasControlPoint(self.enabled_click) self.dlg.input_longitude.valueChanged.connect(self.checkFilters) self.dlg.input_latitude.valueChanged.connect(self.checkFilters) + self.selectCoverage() def initLoadingControls(self): """Enable loading label.""" @@ -244,22 +245,25 @@ def initIcons(self): self.dlg.search_button.setIcon(icon) icon = QIcon(str(Path(Config.BASE_DIR) / 'assets' / 'zoom-icon.png')) self.dlg.zoom_selected_point.setIcon(icon) + icon = QIcon(str(Path(Config.BASE_DIR) / 'assets' / 'save-icon.png')) + self.dlg.export_result.setIcon(icon) self.points_layer_icon_path = str(Path(Config.BASE_DIR) / 'assets' / 'marker-icon.png') def initButtons(self): """Init the main buttons to manage services and the results.""" self.dlg.show_help_button.clicked.connect(self.showHelp) self.dlg.show_coverage_description.clicked.connect(self.showCoverageDescription) - self.dlg.export_as_json.clicked.connect(self.exportJSON) - self.dlg.export_as_json.setEnabled(False) - self.dlg.export_as_csv.clicked.connect(self.exportCSV) - self.dlg.export_as_csv.setEnabled(False) - self.dlg.export_as_python.clicked.connect(self.exportPython) - self.dlg.export_as_python.setEnabled(False) + self.dlg.export_result.clicked.connect(self.exportAsType) self.dlg.zoom_selected_point.clicked.connect(self.zoom_to_selected_point) self.dlg.zoom_selected_point.setEnabled(True) self.dlg.search_button.clicked.connect(self.getTimeSeriesButton) self.dlg.search_button.setEnabled(False) + self.initExportOptions() + self.enabledSearchButtons(False) + + def initExportOptions(self): + """Init the combo box select option to export""" + self.dlg.export_result_as_type.addItems(self.files_controls.getExportOptions()) def initHistory(self): """Init and update location history.""" @@ -279,28 +283,6 @@ def initRasterHistory(self): """Add a event listener when a layer is added to check the history of vrt layers.""" QgsProject.instance().layersAdded.connect(self.updateRasterHistory) - def initServices(self): - """Load the wtss server.""" - self.wtss_server_edit = False - self.dlg.wtss_server_label.setText(self.wtss_controls.getService()) - self.dlg.wtss_server_label.setEnabled(self.wtss_server_edit) - self.dlg.wtss_server_label_update.clicked.connect(self.updateService) - self.selectCoverage() - - def updateService(self): - """Edit the selected service.""" - self.wtss_server_edit = not self.wtss_server_edit - self.dlg.wtss_server_label.setEnabled(self.wtss_server_edit) - if self.wtss_server_edit: - self.dlg.coverage_selection.clear() - self.dlg.coverage_selection.setEnabled(False) - self.dlg.bands_scroll.setWidget(QWidget()) - self.dlg.search_button.setEnabled(False) - else: - self.wtss_controls.setService(self.dlg.wtss_server_label.text()) - self.dlg.coverage_selection.setEnabled(True) - self.selectCoverage() - def initRasterPathControls(self): """Init raster path location controls.""" self.enabled_output_path_raster_edit = False @@ -562,6 +544,16 @@ def plotTimeSeries(self): else: self.basic_controls.alert("error", "AttributeError", "The times series service returns empty, no data to show!") + def exportAsType(self): + """Export result based on combo box selection.""" + ext = self.dlg.export_result_as_type.currentText() + if ext == "CSV": + self.exportCSV() + elif ext == "JSON": + self.exportJSON() + elif ext == "Python": + self.exportPython() + def getLayers(self): """Storage the layers in QGIS project.""" self.layers = QgsProject.instance().layerTreeRoot().children() @@ -709,9 +701,8 @@ def addCanvasControlPoint(self, enable): def enabledSearchButtons(self, enable): """Enable the buttons to load time series.""" self.dlg.search_button.setEnabled(enable) - self.dlg.export_as_python.setEnabled(enable) - self.dlg.export_as_csv.setEnabled(enable) - self.dlg.export_as_json.setEnabled(enable) + self.dlg.export_result_as_type.setEnabled(enable) + self.dlg.export_result.setEnabled(enable) def checkFilters(self): """Check if lat lng are selected.""" @@ -755,8 +746,6 @@ def run(self): self.dlg = wtss_qgisDialog() # Init Controls self.initControls() - # Services - self.initServices() # Virtual Raster History self.initRasterHistory() # Output vrt path diff --git a/wtss_plugin/wtss_qgis_dialog_base.ui b/wtss_plugin/wtss_qgis_dialog_base.ui index a043496..1d672d4 100644 --- a/wtss_plugin/wtss_qgis_dialog_base.ui +++ b/wtss_plugin/wtss_qgis_dialog_base.ui @@ -6,8 +6,8 @@ 0 0 - 741 - 510 + 732 + 492 @@ -24,8 +24,8 @@ 0 0 - 741 - 511 + 731 + 491 @@ -45,7 +45,7 @@ 10 - 80 + 10 451 61 @@ -77,60 +77,24 @@ - - - - 10 - 10 - 451 - 61 - - - - Active Service - - - - - 10 - 30 - 331 - 27 - - - - - - - 350 - 30 - 91 - 25 - - - - Update - - - 480 - 410 - 251 + 390 + 241 61 Export result as - + - 90 + 200 30 - 71 + 31 25 @@ -140,44 +104,18 @@ - CSV + - + 10 30 - 71 - 25 - - - - - 9 - - - - JSON - - - - - - 170 - 30 - 71 - 25 + 181 + 27 - - - 9 - - - - Python - @@ -185,8 +123,8 @@ 480 10 - 251 - 391 + 241 + 371 @@ -197,8 +135,8 @@ 10 30 - 231 - 351 + 221 + 331 @@ -210,7 +148,7 @@ 20 - 300 + 280 201 51 @@ -246,9 +184,9 @@ 10 - 150 + 80 451 - 141 + 191 @@ -260,7 +198,7 @@ 10 30 431 - 101 + 151 @@ -272,7 +210,7 @@ 0 0 429 - 99 + 149 @@ -284,8 +222,8 @@ - 100 - 440 + 90 + 420 231 25 @@ -304,7 +242,7 @@ 10 - 360 + 340 451 71 @@ -379,8 +317,8 @@ - 340 - 440 + 330 + 420 31 25 @@ -393,7 +331,7 @@ 250 - 300 + 280 201 51 @@ -576,10 +514,10 @@ - -1 + 5 0 - 741 - 511 + 731 + 491