move the first config read into a method
This commit is contained in:
parent
41eb500132
commit
258d978a02
|
@ -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_())
|
||||
|
|
|
@ -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_()
|
||||
|
|
Loading…
Reference in New Issue