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

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

Clean up and automate generation of UI and resources

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