summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKam Woods <kamwoods@gmail.com>2016-05-14 18:09:28 -0400
committerKam Woods <kamwoods@gmail.com>2016-05-14 18:09:28 -0400
commit4b842c4bcbc13ee412a5f72148b10263ce23f9ca (patch)
tree9e2375c95e5f73da67aaa4bbabdce73ff133de5a
parented04ea26a65a02275d0ad280a680b97c7183b888 (diff)
downloadDiskFormatID-4b842c4bcbc13ee412a5f72148b10263ce23f9ca.zip
DiskFormatID-4b842c4bcbc13ee412a5f72148b10263ce23f9ca.tar.gz
DiskFormatID-4b842c4bcbc13ee412a5f72148b10263ce23f9ca.tar.bz2
Fixed settings paths in chooseFormats and typo in diskIDMain
-rw-r--r--chooseFormats.py33
-rwxr-xr-xdiskIDMain4
2 files changed, 21 insertions, 16 deletions
diff --git a/chooseFormats.py b/chooseFormats.py
index 5777094..5a753bf 100644
--- a/chooseFormats.py
+++ b/chooseFormats.py
@@ -31,9 +31,12 @@ driveDensitiesRv = {"-dd0":"High","-dd1":"Low"}
outputTrackOrders = {"Side 0 descending":"-oo1","Side 1 descending":"-oo2","Side 1 then side 0":"-oo4","Side oriented":"-oo8"}
outputTrackOrdersRv = {'-oo1': 'Side 0 descending', '-oo8': 'Side oriented', '-oo2': 'Side 1 descending', '-oo4': 'Side 1 then side 0'}
+global spath
+spath = os.getenv("HOME") + '/.diskFormatID/settings.json'
class addTypes(QtGui.QMainWindow, chooseFormatsGUI.Ui_addTypes):
def __init__(self, parent=None):
+ global spath
super(addTypes, self).__init__(parent)
self.setupUi(self)
self.imageTypeCB.clear()
@@ -70,18 +73,18 @@ class addTypes(QtGui.QMainWindow, chooseFormatsGUI.Ui_addTypes):
self.resetTypes.clicked.connect(self.reset_types)
-#open the settings.json file for reading
- if os.stat('settings.json').st_size != 0:
+#open the spath file for reading
+ if os.stat(spath).st_size != 0:
self.updateTextBrowserFromJSON()
else:
#pass if file is empty
pass
def reset_types(self):
-
+ global spath
#open the json file and get the contents
- with open('settings.json' ,'r') as settings_file:
+ with open(spath ,'r') as settings_file:
settings = json.load(settings_file)
# try deleting the outputFormats element/key
@@ -91,7 +94,7 @@ class addTypes(QtGui.QMainWindow, chooseFormatsGUI.Ui_addTypes):
pass
#write back the remaining json
jsoutput = json.dumps(settings)
- outfile = open("settings.json", 'w')
+ outfile = open("spath", 'w')
outfile.write(jsoutput)
outfile.close()
@@ -102,13 +105,13 @@ class addTypes(QtGui.QMainWindow, chooseFormatsGUI.Ui_addTypes):
def save_and_add(self):
# this function adds what is in each setting to the json file
+ global spath
+#check to see if the spath file is empty
-#check to see if the settings.json file is empty
-
- if os.stat('settings.json').st_size != 0:
+ if os.stat(spath).st_size != 0:
# if it is not empty open it for reading
- with open('settings.json','r') as settings_file:
+ with open(spath,'r') as settings_file:
settings = json.load(settings_file)
#create a variable to store the current input in the image type comobo box
imgType = imageTypes[str(self.imageTypeCB.currentText())]
@@ -152,17 +155,17 @@ class addTypes(QtGui.QMainWindow, chooseFormatsGUI.Ui_addTypes):
settings["outputFormats"] = [diskSetting]
#Clear the json file and write back the updated json
jsoutput = json.dumps(settings)
- outfile = open("settings.json", 'w')
+ outfile = open("spath", 'w')
outfile.write(jsoutput)
outfile.close()
self.settingsDisplay.clear()
#clear the settings text browser in the GUI
-#open the settings.json file and print the contents to the text browser in the gui, one per format instance
+#open the spath file and print the contents to the text browser in the gui, one per format instance
self.updateTextBrowserFromJSON()
else:
-#if the settings.json file is empty you should put something into it
+#if the spath file is empty you should put something into it
#this is a hangover from earlier versions where I needed to id/process the imagetype ina a unique way
imgType = imageTypes[str(self.imageTypeCB.currentText())]
@@ -203,15 +206,17 @@ class addTypes(QtGui.QMainWindow, chooseFormatsGUI.Ui_addTypes):
#now write this all back
settings = {"outputFormats":[diskSetting]}
jsoutput = json.dumps(settings)
- outfile = open("settings.json", 'w')
+ outfile = open("spath", 'w')
outfile.write(jsoutput)
outfile.close()
self.settingsDisplay.clear()
self.updateTextBrowserFromJSON()
def updateTextBrowserFromJSON(self):
+
+ global spath
#used to update what is in the textbrowser box in the GUI from the JSON file
- with open('settings.json') as settings_file:
+ with open(spath) as settings_file:
num = 0
settings = json.load(settings_file)
# get all the formats already stored in the file
diff --git a/diskIDMain b/diskIDMain
index 5fbd513..ad57bf8 100755
--- a/diskIDMain
+++ b/diskIDMain
@@ -28,7 +28,7 @@ spath = os.getenv("HOME") + '/.diskFormatID/settings.json'
class kryoMain(QtGui.QMainWindow, diskIDMainGUI.Ui_kryoMain):
def __init__(self, parent=None):
- #don't really understand global variables well enough, but I think I need to ptu these here
+ #don't really understand global variables well enough, but I think I need to put these here
global inpDirLoc
global outDirLoc
@@ -47,7 +47,7 @@ class kryoMain(QtGui.QMainWindow, diskIDMainGUI.Ui_kryoMain):
if not os.path.exists(spath):
QtGui.QMessageBox.warning(self, "First run notice",
- "It looks like you're running the program for the first time as this user. I'm create a new default settings file for you in " + spath,
+ "It looks like you're running the program for the first time as this user. I'm creating a new default settings file for you in " + spath,
QtGui.QMessageBox.Ok, QtGui.QMessageBox.NoButton,
QtGui.QMessageBox.NoButton)