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: Fix saving project location when project is saved on another drive than that where GWHAT is installed #290

Merged
merged 4 commits into from
Jun 11, 2019
Merged
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
19 changes: 15 additions & 4 deletions gwhat/mainwindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ class WHATPref(object):
of graphs).
"""

def __init__(self, parent=None): # =======================================
def __init__(self, parent=None):

self.projectfile = os.path.join(
'..', 'Projects', 'Example', 'Example.gwt')
Expand All @@ -306,14 +306,25 @@ def __init__(self, parent=None): # =======================================
self.load_pref_file()

def save_pref_file(self):
print('\nSaving WHAT preferences to file...')
fcontent = [['Project File:', os.path.relpath(self.projectfile)],
"""
Save the GWHAT user preferences to file.
"""
print('\n\rSaving WHAT preferences to file...', end=' ')
try:
fpath = osp.relpath(self.projectfile)
except ValueError:
# This probably means that the gwhat project is not saved on the
# same drive as the one where GHWAT is installed.
# See jnsebgosselin/gwhat#289.
fpath = osp.abspath(self.projectfile)

fcontent = [['Project File:', fpath],
['Language:', self.language],
['Font-Size-General:', self.fontsize_general],
['Font-Size-Console:', self.fontsize_console],
['Font-Size-Menubar:', self.fontsize_menubar]]
save_content_to_csv('WHAT.pref', fcontent)
print('WHAT preferences saved.')
print('done')

def load_pref_file(self, circloop=False):

Expand Down