Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PR: Update QFileDialog related code to the API changes introduced in qt5 to prevent GWHAT from crashing #103

Merged
merged 2 commits into from
Nov 29, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions gwhat/HydroCalc2.py
Original file line number Diff line number Diff line change
Expand Up @@ -664,9 +664,8 @@ def save_mrc_tofile(self):
# ---- get filename ----

dialog = QFileDialog()
dialog.setConfirmOverwrite(True)
filename, ftype = dialog.getSaveFileName(
caption="Save Results Summary", dir=filename, filter=('*.xlsx'))
self, "Save Results Summary", filename, '*.xlsx')

if not filename:
return
Expand Down
4 changes: 1 addition & 3 deletions gwhat/HydroPrint2.py
Original file line number Diff line number Diff line change
Expand Up @@ -747,10 +747,8 @@ def select_save_path(self):
'hydrograph_%s' % self.wldset['Well'])

dialog = QFileDialog()
dialog.setConfirmOverwrite(True)
fname, ftype = dialog.getSaveFileName(
caption="Save Figure", dir=dialog_dir,
filter=('*.pdf;;*.svg'))
self, "Save Figure", dialog_dir, '*.pdf;;*.svg')

if fname:
if fname[-4:] != ftype[1:]:
Expand Down
13 changes: 4 additions & 9 deletions gwhat/meteo/weather_viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,9 +236,8 @@ def save_graph(self):
ddir = os.path.join(self.save_fig_dir, defaultname)

dialog = QFileDialog()
dialog.setConfirmOverwrite(True)
filename, ftype = dialog.getSaveFileName(
caption='Save graph', dir=ddir, filter='*.pdf;;*.svg')
self, 'Save graph', ddir, '*.pdf;;*.svg')

if filename:
if filename[-4:] != ftype[1:]:
Expand All @@ -259,10 +258,8 @@ def save_normals(self):
ddir = os.path.join(self.save_fig_dir, defaultname)

dialog = QFileDialog()
dialog.setConfirmOverwrite(True)
filename, ftype = dialog.getSaveFileName(caption='Save normals',
dir=ddir,
filter='*.xlsx;;*.xls;;*.csv')
filename, ftype = dialog.getSaveFileName(
self, 'Save normals', ddir, '*.xlsx;;*.xls;;*.csv')

hheader = ['', 'JAN', 'FEB', 'MAR', 'APR', 'MAY', 'JUN', 'JUL',
'AUG', 'SEP', 'OCT', 'NOV', 'DEC', 'YEAR']
Expand Down Expand Up @@ -316,11 +313,9 @@ def select_export_file(self):

ddir = os.path.join(self.save_fig_dir, defaultname)
dialog = QFileDialog()
dialog.setConfirmOverwrite(True)

filename, ftype = dialog.getSaveFileName(
caption='Export %s' % time_frame, dir=ddir,
filter='*.xlsx;;*.xls;;*.csv')
self, 'Export %s' % time_frame, ddir, '*.xlsx;;*.xls;;*.csv')

if filename:
self.export_series_tofile(filename, time_frame)
Expand Down