Changeset 0cd8612 in sasview for src/sas/qtgui/GuiManager.py


Ignore:
Timestamp:
Jul 8, 2016 10:13:41 AM (8 years ago)
Author:
Piotr Rozyczko <piotr.rozyczko@…>
Branches:
ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc
Children:
a95260d
Parents:
e540cd2
Message:

output console + logging

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/qtgui/GuiManager.py

    re540cd2 r0cd8612  
    11import sys 
     2import os 
    23import subprocess 
    34import logging 
     
    1516from sas.sasgui.guiframe.proxy import Connection 
    1617 
     18from SasviewLogger import XStream 
     19 
    1720import LocalConfig 
    18 from GuiUtils import * 
     21import GuiUtils 
    1922from UI.AcknowledgementsUI import Acknowledgements 
    2023from AboutBox import AboutBox 
     
    3437        """ 
    3538        """ 
    36  
    3739        self._workspace = mainWindow 
    3840        self._parent = parent 
     
    5860        # Widgets 
    5961        # 
    60         # Add FileDialog widget as docked 
    61         self.filesWidget = DataExplorerWindow(parent, self) 
    62  
    63         self.dockedFilesWidget = QtGui.QDockWidget("Data explorer", self._workspace) 
    64         self.dockedFilesWidget.setWidget(self.filesWidget) 
    65         self.dockedFilesWidget.setFeatures(QtGui.QDockWidget.NoDockWidgetFeatures) 
    66         self._workspace.addDockWidget(QtCore.Qt.DockWidgetArea(1), self.dockedFilesWidget) 
    67  
    68         self.ackWidget = Acknowledgements() 
    69         self.aboutWidget = AboutBox() 
     62        self.addWidgets() 
     63 
     64        # Fork off logging messages to the Log Window 
     65        XStream.stdout().messageWritten.connect( self.listWidget.insertPlainText  ) 
     66        XStream.stderr().messageWritten.connect( self.listWidget.insertPlainText  ) 
     67 
     68        # Log the start of the session 
     69        logging.info(" --- SasView session started ---") 
     70        # Log the python version 
     71        logging.info("Python: %s" % sys.version) 
    7072 
    7173        # Set up the status bar 
     
    9496        # Default perspective 
    9597        self._current_perspective = self.invariantWidget 
     98 
     99    def addWidgets(self): 
     100        """ 
     101        Populate the main window with widgets 
     102 
     103        TODO: overwrite close() on Log and DR widgets so they can be hidden/shown 
     104        on request 
     105        """ 
     106        # Add FileDialog widget as docked 
     107        self.filesWidget = DataExplorerWindow(self._parent, self) 
     108 
     109        self.dockedFilesWidget = QtGui.QDockWidget("Data Explorer", self._workspace) 
     110        self.dockedFilesWidget.setWidget(self.filesWidget) 
     111        # Disable maximize/minimize and close buttons 
     112        self.dockedFilesWidget.setFeatures(QtGui.QDockWidget.NoDockWidgetFeatures) 
     113        self._workspace.addDockWidget(QtCore.Qt.LeftDockWidgetArea, 
     114                                      self.dockedFilesWidget) 
     115 
     116        # Add the console window as another docked widget 
     117        self.logDockWidget = QtGui.QDockWidget("Log Explorer", self._workspace) 
     118        self.logDockWidget.setObjectName("LogDockWidget") 
     119        self.listWidget = QtGui.QTextBrowser() 
     120        self.logDockWidget.setWidget(self.listWidget) 
     121        self._workspace.addDockWidget(QtCore.Qt.BottomDockWidgetArea, 
     122                                      self.logDockWidget) 
     123 
     124        # Add other, minor widgets 
     125        self.ackWidget = Acknowledgements() 
     126        self.aboutWidget = AboutBox() 
    96127 
    97128    def statusBarSetup(self): 
     
    266297        Method defining all signal connections for the gui manager 
    267298        """ 
    268         self.communicate = Communicate() 
     299        self.communicate = GuiUtils.Communicate() 
    269300        self.communicate.fileDataReceivedSignal.connect(self.fileRead) 
    270301        self.communicate.statusBarUpdateSignal.connect(self.updateStatusBar) 
     
    411442        """ 
    412443        """ 
    413         print("actionReset TRIGGERED") 
     444        logging.warning(" *** actionOpen_Analysis logging *******") 
     445        print("actionReset print TRIGGERED") 
     446        sys.stderr.write("STDERR - TRIGGERED") 
    414447        pass 
    415448 
Note: See TracChangeset for help on using the changeset viewer.