[new] added --reset_qsettings option to PyLoT in case of corrupted QSettings
This commit is contained in:
parent
02083e2bf8
commit
fb6ba83cc5
9
PyLoT.py
9
PyLoT.py
@ -111,7 +111,7 @@ class MainWindow(QMainWindow):
|
|||||||
__version__ = _getVersionString()
|
__version__ = _getVersionString()
|
||||||
closing = Signal()
|
closing = Signal()
|
||||||
|
|
||||||
def __init__(self, parent=None, infile=None):
|
def __init__(self, parent=None, infile=None, reset_qsettings=False):
|
||||||
super(MainWindow, self).__init__(parent)
|
super(MainWindow, self).__init__(parent)
|
||||||
|
|
||||||
self.init_config_files(infile)
|
self.init_config_files(infile)
|
||||||
@ -152,6 +152,8 @@ class MainWindow(QMainWindow):
|
|||||||
self.createAction = createAction
|
self.createAction = createAction
|
||||||
# read settings
|
# read settings
|
||||||
settings = QSettings()
|
settings = QSettings()
|
||||||
|
if reset_qsettings:
|
||||||
|
settings.clear()
|
||||||
self.recentfiles = settings.value("data/recentEvents", [])
|
self.recentfiles = settings.value("data/recentEvents", [])
|
||||||
self.dispComponent = str(settings.value("plotting/dispComponent", "Z"))
|
self.dispComponent = str(settings.value("plotting/dispComponent", "Z"))
|
||||||
|
|
||||||
@ -3909,6 +3911,7 @@ def main(args=None):
|
|||||||
project_filename = args.project_filename
|
project_filename = args.project_filename
|
||||||
if args.input_filename:
|
if args.input_filename:
|
||||||
pylot_infile = args.input_filename
|
pylot_infile = args.input_filename
|
||||||
|
reset_qsettings = args.reset_qsettings
|
||||||
|
|
||||||
# create the Qt application
|
# create the Qt application
|
||||||
pylot_app, app_created = create_window()
|
pylot_app, app_created = create_window()
|
||||||
@ -3921,7 +3924,7 @@ def main(args=None):
|
|||||||
app_icon.addPixmap(QPixmap(':/icons/pylot.png'))
|
app_icon.addPixmap(QPixmap(':/icons/pylot.png'))
|
||||||
|
|
||||||
# create the main window
|
# create the main window
|
||||||
pylot_form = MainWindow(infile=pylot_infile)
|
pylot_form = MainWindow(infile=pylot_infile, reset_qsettings=reset_qsettings)
|
||||||
pylot_form.setWindowIcon(app_icon)
|
pylot_form.setWindowIcon(app_icon)
|
||||||
pylot_form.setIconSize(QSize(60, 60))
|
pylot_form.setIconSize(QSize(60, 60))
|
||||||
|
|
||||||
@ -3954,5 +3957,7 @@ if __name__ == "__main__":
|
|||||||
default=None)
|
default=None)
|
||||||
parser.add_argument('-in', dest='input_filename', help='set pylot input file',
|
parser.add_argument('-in', dest='input_filename', help='set pylot input file',
|
||||||
default=None)
|
default=None)
|
||||||
|
parser.add_argument('--reset_qsettings', default=False, action='store_true',
|
||||||
|
help='reset qsettings (debug option)')
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
sys.exit(main(args))
|
sys.exit(main(args))
|
||||||
|
@ -4615,7 +4615,7 @@ class InputsTab(PropTab):
|
|||||||
for spinbox in [self.tstartBox, self.tstopBox]:
|
for spinbox in [self.tstartBox, self.tstopBox]:
|
||||||
spinbox.setRange(-99999, 99999)
|
spinbox.setRange(-99999, 99999)
|
||||||
self.tstartBox.setValue(float(settings.value('tstart')) if get_None(settings.value('tstart')) else 0)
|
self.tstartBox.setValue(float(settings.value('tstart')) if get_None(settings.value('tstart')) else 0)
|
||||||
self.tstopBox.setValue(float(settings.value('tstop')) if get_None(settings.value('tstop')) else 0)
|
self.tstopBox.setValue(float(settings.value('tstop')) if get_None(settings.value('tstop')) else 1e6)
|
||||||
self.cuttimesLayout.addWidget(self.tstartBox, 10)
|
self.cuttimesLayout.addWidget(self.tstartBox, 10)
|
||||||
self.cuttimesLayout.addWidget(QLabel('[s] and'), 0)
|
self.cuttimesLayout.addWidget(QLabel('[s] and'), 0)
|
||||||
self.cuttimesLayout.addWidget(self.tstopBox, 10)
|
self.cuttimesLayout.addWidget(self.tstopBox, 10)
|
||||||
@ -4685,7 +4685,7 @@ class InputsTab(PropTab):
|
|||||||
"user/FullName": self.fullNameEdit.text(),
|
"user/FullName": self.fullNameEdit.text(),
|
||||||
"data/Structure": self.structureSelect.setCurrentIndex(index),
|
"data/Structure": self.structureSelect.setCurrentIndex(index),
|
||||||
"tstart": self.tstartBox.setValue(0),
|
"tstart": self.tstartBox.setValue(0),
|
||||||
"tstop": self.tstopBox.setValue(10000.),
|
"tstop": self.tstopBox.setValue(1e6),
|
||||||
"autosaveXML": self.autosaveXML_checkbox.setChecked(True),}
|
"autosaveXML": self.autosaveXML_checkbox.setChecked(True),}
|
||||||
return values
|
return values
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user