Skip to content

Commit

Permalink
Bug fix: manage curve_results values and fig_title on "shape to png"
Browse files Browse the repository at this point in the history
  • Loading branch information
edgarfuste committed Aug 4, 2023
1 parent aa9f3ae commit 4887c24
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 10 deletions.
32 changes: 23 additions & 9 deletions core/shared/nonvisual.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,18 +332,30 @@ def _exec_print(self):
sql = f"select ic.id as curve_id, ca.id as arccat_id, geom1, geom2 from {self.schema_name}.v_edit_inp_curve ic join {self.schema_name}.cat_arc ca on ca.curve_id = ic.id " \
f"WHERE ic.curve_type = 'SHAPE' and ca.shape = 'CUSTOM' and ic.id ILIKE '%{filter}%'"
curve_results = tools_db.get_rows(sql)
for curve in curve_results:
geom1 = curve[2]
geom2 = curve[3]
name = f"{curve[0]} - {curve[1]}"
self.get_print_curves(curve[0], path, name, geom1, geom2)
if curve_results is None:
msg = "There is no valid shape curve in the list"
tools_qgis.show_info(msg, dialog=self.manager_dlg)
else:
for curve in curve_results:
geom1 = curve[2]
geom2 = curve[3]
name = f"{curve[0]} - {curve[1]}"
self.get_print_curves(curve[0], path, name, geom1, geom2)
msg = "Export done succesfully"
tools_qgis.show_info(msg, dialog=self.manager_dlg)
else:
sql = f"select id as curve_id from {self.schema_name}.v_edit_inp_curve ic " \
f"WHERE ic.curve_type = 'SHAPE' and ic.id ILIKE '%{filter}%'"
curve_results = tools_db.get_rows(sql)
for curve in curve_results:
name = f"{curve[0]}"
self.get_print_curves(curve[0], path, name)
if curve_results is None:
msg = "There is no valid shape curve in the list"
tools_qgis.show_info(msg, dialog=self.manager_dlg)
else:
for curve in curve_results:
name = f"{curve[0]}"
self.get_print_curves(curve[0], path, name)
msg = "Export done succesfully"
tools_qgis.show_info(msg, dialog=self.manager_dlg)

tools_gw.close_dialog(self.dlg_print)

Expand Down Expand Up @@ -691,7 +703,9 @@ def _manage_curve_plot(self, dialog, table, plot_widget, file_name=None, geom1=N
plot_widget.axes.plot(aux_y_list, aux_x_list, color="grey", alpha=0.5, linestyle="dashed")

if file_name:
fig_title = f"{file_name} (S: {round(area*100, 2)} dm2 - {round(geom1, 2)} x {round(geom2, 2)})"
fig_title = f"{file_name}"
if area and geom1 and geom2:
fig_title = f"{fig_title} (S: {round(area*100, 2)} dm2 - {round(geom1, 2)} x {round(geom2, 2)})"
plot_widget.axes.text(min(y_list_inverted)*1.1, max(x_list)*1.07, f"{fig_title}", fontsize=8)
else:
plot_widget.axes.plot(x_list, y_list, color='indianred')
Expand Down
2 changes: 1 addition & 1 deletion core/ui/toolbars/epa/nonvisual_manager.ui
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
<item row="1" column="3">
<widget class="QPushButton" name="btn_print">
<property name="text">
<string>Print</string>
<string>Shape to PNG</string>
</property>
</widget>
</item>
Expand Down

0 comments on commit 4887c24

Please sign in to comment.