<s> import sys <EOL> from PyQt4 import QtGui , QtCore <EOL> import sip <EOL> from sqlalchemy . orm import sessionmaker <EOL> from gui . experiments_tab import ExperimentsTab <EOL> from gui . feasibility_tab import FeasibilityTab <EOL> from gui . plotter_tab import PlotterTab <EOL> import logging <EOL> from sqlalchemy import create_engine <EOL> from gui . settings_tab import SettingsTab <EOL> from lib . rq_result_processor import RqResultsProcessor <EOL> from models . racer import Racer <EOL> from models . trial import Trial <EOL> from models . experiment import Experiment <EOL> from lib . base import Base <EOL> progname = "<STR_LIT>" <EOL> progversion = "<STR_LIT>" <EOL> class ApplicationWindow ( QtGui . QMainWindow ) : <EOL> def __init__ ( self ) : <EOL> logger = logging . getLogger ( '<STR_LIT>' ) <EOL> logger . setLevel ( logging . DEBUG ) <EOL> ch = logging . StreamHandler ( ) <EOL> formatter = logging . Formatter ( '<STR_LIT>' ) <EOL> ch . setFormatter ( formatter ) <EOL> logger . addHandler ( ch ) <EOL> logger . info ( "<STR_LIT>" ) <EOL> self . engine = create_engine ( '<STR_LIT>' , connect_args = { '<STR_LIT>' : False } , echo = False ) <EOL> Base . metadata . create_all ( self . engine , checkfirst = True ) <EOL> Session = sessionmaker ( bind = self . engine ) <EOL> self . session = Session ( ) <EOL> self . processor = RqResultsProcessor ( ) <EOL> ThreadSession = sessionmaker ( bind = self . engine ) <EOL> self . processor . session = ThreadSession ( ) <EOL> self . processor . start ( ) <EOL> QtGui . QMainWindow . __init__ ( self ) <EOL> self . setAttribute ( QtCore . Qt . WA_DeleteOnClose ) <EOL> self . setWindowTitle ( "<STR_LIT>" ) <EOL> self . setWindowIcon ( QtGui . QIcon ( '<STR_LIT>' ) ) <EOL> self . file_menu = QtGui . QMenu ( '<STR_LIT>' , self ) <EOL> self . file_menu . addAction ( '<STR_LIT>' , self . fileQuit , <EOL> QtCore . Qt . CTRL + QtCore . Qt . Key_Q ) <EOL> self . menuBar ( ) . addMenu ( self . file_menu ) <EOL> self . help_menu = QtGui . QMenu ( '<STR_LIT>' , self ) <EOL> self . menuBar ( ) . addSeparator ( ) <EOL> self . menuBar ( ) . addMenu ( self . help_menu ) <EOL> self . help_menu . addAction ( '<STR_LIT>' , self . about ) <EOL> self . main_widget = QtGui . QWidget ( self ) <EOL> self . main_layout = QtGui . QGridLayout ( self . main_widget ) <EOL> self . tab_widget = QtGui . QTabWidget ( self . main_widget ) <EOL> self . main_layout . addWidget ( self . tab_widget , <NUM_LIT:0> , <NUM_LIT:0> ) <EOL> self . experiment_tab = ExperimentsTab ( session = self . session , parent = self . main_widget ) <EOL> QtCore . QObject . connect ( self . experiment_tab , <EOL> QtCore . SIGNAL ( "<STR_LIT>" ) , <EOL> self . shorter_trial_set ) <EOL> QtCore . QObject . connect ( self . experiment_tab , <EOL> QtCore . SIGNAL ( "<STR_LIT>" ) , <EOL> self . longer_trial_set ) <EOL> self . tab_widget . addTab ( self . experiment_tab , "<STR_LIT>" ) <EOL> self . feasibility_tab = FeasibilityTab ( session = self . session , parent = self . main_widget ) <EOL> self . tab_widget . addTab ( self . feasibility_tab , "<STR_LIT>" ) <EOL> self . settings_tab = SettingsTab ( self . main_widget , session = self . session ) <EOL> self . tab_widget . addTab ( self . settings_tab , "<STR_LIT>" ) <EOL> self . main_widget . setFocus ( ) <EOL> self . setCentralWidget ( self . main_widget ) <EOL> def shorter_trial_set ( self , trial ) : <EOL> self . feasibility_tab . set_shorter ( trial ) <EOL> def longer_trial_set ( self , trial ) : <EOL> self . feasibility_tab . set_longer ( trial ) <EOL> def fileQuit ( self ) : <EOL> self . close ( ) <EOL> def closeEvent ( self , ce ) : <EOL> self . session . close ( ) <EOL> self . processor . stop ( ) <EOL> self . processor . join ( ) <EOL> self . fileQuit ( ) <EOL> def about ( self ) : <EOL> QtGui . QMessageBox . about ( self , "<STR_LIT>" , """<STR_LIT>""" ) <EOL> sip . setdestroyonexit ( False ) <EOL> qApp = QtGui . QApplication ( sys . argv ) <EOL> qApp . setWindowIcon ( QtGui . QIcon ( '<STR_LIT>' ) ) <EOL> qApp . setApplicationName ( "<STR_LIT>" ) <EOL> aw = ApplicationWindow ( ) <EOL> aw . setWindowTitle ( "<STR_LIT:%s>" % progname ) <EOL> desktop = QtGui . QDesktopWidget ( ) <EOL> screen_size = desktop . availableGeometry ( ) <EOL> width = min ( screen_size . width ( ) * <NUM_LIT> , <NUM_LIT> ) <EOL> height = min ( screen_size . height ( ) * <NUM_LIT> , <NUM_LIT> ) <EOL> aw . setFixedSize ( QtCore . QSize ( width , height ) ) <EOL> aw . show ( ) <EOL> aw . raise_ ( ) <EOL> sys . exit ( qApp . exec_ ( ) ) </s>
