move the first config read into a method

This commit is contained in:
Andreas Zweili 2019-01-26 11:25:26 +01:00
parent 41eb500132
commit 258d978a02
2 changed files with 13 additions and 6 deletions

View File

@ -4,16 +4,12 @@ from PyQt5.QtWidgets import QApplication
import sys
from main_window import MainWindow
from helper import BorgException, show_error
if __name__ == "__main__":
app = QApplication(sys.argv)
window = MainWindow()
window.show()
try:
window.config.read()
except BorgException as e:
show_error(e)
sys.exit(1)
window.start()
sys.exit(app.exec_())

View File

@ -1,10 +1,12 @@
import os
import sys
from PyQt5 import uic
from PyQt5.QtCore import QCoreApplication
from PyQt5.QtWidgets import QMainWindow
from config import Config
from helper import BorgException, show_error
class MainWindow(QMainWindow):
@ -20,6 +22,15 @@ class MainWindow(QMainWindow):
self.action_settings.triggered.connect(self.show_settings)
def start(self):
try:
self.config.read()
self.config._set_environment_variables()
except BorgException as e:
show_error(e)
sys.exit(1)
def show_settings(self):
self.config.set_form_values()
self.config.exec_()