-
Notifications
You must be signed in to change notification settings - Fork 1
/
ProcessMRI.py
62 lines (54 loc) · 1.66 KB
/
ProcessMRI.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
from src.maincontroller import MainController
from src.mainview import Ui_MainView
from PyQt5 import QtCore
from PyQt5.QtWidgets import QApplication, QMainWindow, QWidget, QGridLayout
from PyQt5.QtGui import QIcon
import sys
import configparser
import os
# For high DPI screens
if hasattr(QtCore.Qt, 'AA_EnableHighDpiScaling'):
QApplication.setAttribute(QtCore.Qt.AA_EnableHighDpiScaling, True)
if hasattr(QtCore.Qt, 'AA_UseHighDpiPixmaps'):
QApplication.setAttribute(QtCore.Qt.AA_UseHighDpiPixmaps, True)
class AppWindow(QMainWindow):
"""
Main window class
Sets up the main widget
"""
def __init__(self):
super().__init__()
self.ui = Ui_MainView()
self.ui.setupUi(self)
self.gridLayout = QGridLayout(self.ui.centralwidget)
self.gridLayout.addLayout(self.ui.gridLayout, 0, 0, 1, 1)
self.setWindowIcon(QIcon('ProcessMRI.ico'))
self.show()
def init_configuration():
"""
Initialisation of the configuration:
storage preferences
Parameters
----------
None.
Returns
----------
configparser.ConfigParser:
configuration preferences
"""
config = configparser.ConfigParser()
config.read('config.ini')
if 'default' not in config:
config['default'] = {}
if 'NifTiDir' not in config['default']:
config['default']['NifTiDir'] = os.getcwd()
return config
if __name__=='__main__':
app = QApplication.instance()
if not app:
app = QApplication(sys.argv)
main_window = AppWindow()
config = init_configuration()
main_controller = MainController(app, main_window, config)
main_window.show()
app.exec_()