source: sasview/src/sas/qtgui/MainWindow.py @ 0cd8612

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 0cd8612 was 0cd8612, checked in by Piotr Rozyczko <piotr.rozyczko@…>, 8 years ago

output console + logging

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