source: sasview/src/sas/qtgui/MainWindow.py @ f721030

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

Initial commit of the main window prototype

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