Skip to content

Commit

Permalink
Merge pull request #290 from jnsebgosselin/fix_project_location
Browse files Browse the repository at this point in the history
PR: Fix saving project location when project is saved on another drive than that where GWHAT is installed
  • Loading branch information
jnsebgosselin committed Jun 11, 2019
2 parents afa913c + c82c217 commit 1ca5339
Showing 1 changed file with 15 additions and 4 deletions.
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

0 comments on commit 1ca5339

Please sign in to comment.