Commit 3c82fac7 authored by Elisa Kanaki's avatar Elisa Kanaki

Expect user-defined SQL database configuration file in gepard.cfg

parent 26820431
......@@ -3,6 +3,8 @@
[Defaults]
# file path without "" !
file_path = .
# Path (including name) to configuration file for the SQL database (without "")
database_config_file = path/my_database_configuration_file
[Interface]
# possible values: SIMULATED_RAMAN_CONTROL, WITEC_CONTROL, RENISHAW_CONTROL, THERMO_FTIR
......@@ -15,11 +17,11 @@ magnification = 20
videoImageScaleFactor = 1.0
[Renishaw]
#information specific for renishaw control
#image micrometer sizes for bright and dark field camera, format: width*height
#please insert, as it would represent an image at 1x magnification
#if unavailable, export an image from the Renishaw Camera viewer. Export as jpeg (without axes) and, within Gepard, go to Tools->ConfigureInstrumentControl.
# Information specific for renishaw control
# Image micrometer sizes for bright and dark field camera, format: width*height
# Please insert, as it would represent an image at 1x magnification
# If unavailable, export an image from the Renishaw Camera viewer. Export as jpeg (without axes) and, within Gepard, go to Tools->ConfigureInstrumentControl.
img_size_BF = 9016.0*5748.0
img_size_DF = 4524.0*2874.0
#Path to measuring templates (*.wxm)
# Path to measuring templates (*.wxm)
measTemplatePath = C:\RamanData
\ No newline at end of file
......@@ -28,6 +28,7 @@ import os
import datetime
import json
from ..config import database_config_file
from . import DBAssignments as dbassignments
from .DBAssignments import DBAssignment
......@@ -50,11 +51,11 @@ class SQLExport(QtWidgets.QDialog):
self.log = []
self.dbAssignments = None
configfilename = os.path.join(os.path.split(__file__)[0], 'database_config.txt')
configfilename = os.path.normpath(database_config_file)
if not os.path.exists(configfilename):
QtWidgets.QMessageBox.warning(self, 'Warning!',
'No server credentials provided! Put a json file in gepard/analysis.',
'No server credentials provided! Have you provided the correct path in gepard.cfg?',
QtWidgets.QMessageBox.Ok, QtWidgets.QMessageBox.Ok)
self.config = None
else:
......
......@@ -9,4 +9,9 @@ config.read(os.path.join(defaultPath, 'gepard.cfg'))
try:
defaultPath = config["Defaults"]["file_path"]
except KeyError:
pass
\ No newline at end of file
pass
try:
database_config_file = config["Defaults"]["database_config_file"]
except KeyError:
pass
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment