source: sasview/src/sas/qtgui/MainWindow.py @ 7d077d1

ESS_GUIESS_GUI_DocsESS_GUI_batch_fittingESS_GUI_bumps_abstractionESS_GUI_iss1116ESS_GUI_iss879ESS_GUI_iss959ESS_GUI_openclESS_GUI_orderingESS_GUI_sync_sascalc
Last change on this file since 7d077d1 was 6fd4e36, checked in by Piotr Rozyczko <rozyczko@…>, 8 years ago

Chi2 display + minor refactoring

  • Property mode set to 100644
File size: 1.9 KB
Line 
1# UNLESS EXEPTIONALLY REQUIRED TRY TO AVOID IMPORTING ANY MODULES HERE
2# ESPECIALLY ANYTHING IN SAS, SASMODELS NAMESPACE
3from PyQt4 import QtGui
4
5# Local UI
6from UI.MainWindowUI import Ui_MainWindow
7
8# Initialize logging
9import SasviewLogger
10
11class MainSasViewWindow(QtGui.QMainWindow, Ui_MainWindow):
12    # Main window of the application
13    def __init__(self, parent=None):
14        super(MainSasViewWindow, self).__init__(parent)
15        self.setupUi(self)
16
17        # define workspace for dialogs.
18        self.workspace = QtGui.QWorkspace(self)
19        self.setCentralWidget(self.workspace)
20
21        # Create the gui manager
22        from GuiManager import GuiManager
23        self.guiManager = GuiManager(self)
24
25    def closeEvent(self, event):
26        if self.guiManager.quitApplication():
27            event.accept()
28        else:
29            event.ignore()
30
31
32def SplashScreen():
33    """
34    Displays splash screen as soon as humanely possible.
35    The screen will disappear as soon as the event loop starts.
36    """
37    # TODO: standardize path to images
38    pixmap = QtGui.QPixmap("src/sas/qtgui/images/SVwelcome_mini.png")
39    splashScreen = QtGui.QSplashScreen(pixmap)
40    return splashScreen
41
42def run():
43    app = QtGui.QApplication([])
44
45    # Main must have reference to the splash screen, so making it explicit
46    splash = SplashScreen()
47    splash.show()
48
49    # DO NOT move the following import to the top!
50    # (unless you know what you're doing)
51    import qt4reactor
52    # Using the Qt4 reactor wrapper from https://github.com/ghtdak/qtreactor
53    qt4reactor.install()
54
55    # DO NOT move the following import to the top!
56    from twisted.internet import reactor
57
58    # Show the main SV window
59    mainwindow = MainSasViewWindow()
60    mainwindow.showMaximized()
61
62    # no more splash screen
63    splash.finish(mainwindow)
64
65    # No need to .exec_ - the reactor takes care of it.
66    reactor.run()
67
68if __name__ == "__main__":
69    run()
Note: See TracBrowser for help on using the repository browser.