<s> from __future__ import absolute_import <EOL> import logging <EOL> import os <EOL> import sys <EOL> from PySide import QtGui <EOL> from Motome . Controllers . MainWindow import MainWindow <EOL> from Motome . config import LOG_LEVEL , APP_DIR <EOL> logging . basicConfig ( filename = '<STR_LIT>' , <EOL> filemode = '<STR_LIT:a>' , <EOL> format = '<STR_LIT>' , <EOL> level = LOG_LEVEL ) <EOL> class App ( QtGui . QApplication ) : <EOL> def __init__ ( self , * args ) : <EOL> QtGui . QApplication . __init__ ( self , * args ) <EOL> if len ( args [ <NUM_LIT:0> ] ) > <NUM_LIT:1> and args [ <NUM_LIT:0> ] [ <NUM_LIT:1> ] == '<STR_LIT>' : <EOL> self . main = MainWindow ( portable = True ) <EOL> else : <EOL> self . main = MainWindow ( ) <EOL> self . font_database = QtGui . QFontDatabase ( ) <EOL> font_name_dirs = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> for name in font_name_dirs : <EOL> fontpath = os . path . join ( APP_DIR , '<STR_LIT>' , '<STR_LIT:default>' , '<STR_LIT>' , name ) <EOL> for f in os . listdir ( fontpath ) : <EOL> if f . endswith ( "<STR_LIT>" ) : <EOL> p = os . path . join ( fontpath , f ) <EOL> self . font_database . addApplicationFont ( p ) <EOL> self . lastWindowClosed . connect ( self . byebye ) <EOL> self . main . show ( ) <EOL> self . main . raise_ ( ) <EOL> def byebye ( self ) : <EOL> self . main . stop ( ) <EOL> self . exit ( <NUM_LIT:0> ) <EOL> def main ( ) : <EOL> global app <EOL> app = App ( sys . argv ) <EOL> app . exec_ ( ) <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> main ( ) </s>
