#!/usr/bin/env python
#######################################################################
#
# $Id: emGine.py,v 1.3 2008-02-07 05:45:15 lorenz Exp $
#
# Copyright (C) 2004-2008 Petr Lorenz
# All rights reserved.
#
# ##### BEGIN LICENSE BLOCK #####
#
# Version: MPL 1.1 / GPL 2.0 / LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License
# Version 1.1 (the "License"); you may not use this file except in
# compliance with the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
# 
# Software distributed under the License is distributed on an "AS IS"
# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
# License for the specific language governing rights and limitations
# under the License.
# 
# The Original Code is Petr Lorenz emGine Graphical User Interface (GUI).
# 
# The Initial Developer of the Original Code is Petr Lorenz.
# Portions created by the Initial Developer are Copyright (C) 2004-2008.
# All Rights Reserved.
# 
# Alternatively, the contents of this file may be used under the terms of
# either the GNU General Public License Version 2 or later (the  "GPL"), or the
# GNU Lesser General Public License Version 2.1 or later (the "LGPL"), in which
# case the provisions of the GPL or the LGPL are applicable instead of those
# above.  If you wish to allow use of your version of this file only under the
# terms of either the GPL or the LGPL and not to allow others to use your
# version of this file under the MPL, indicate your decision by deleting the
# provisions above and replace them with the notice and other provisions
# required by the GPL or LGPL.  If you do not delete the provisions above, a
# recipient may use your version of this file under the terms of any one of the
# MPL License, the GPL or the LGPL.
#
# ##### END LICENSE BLOCK #####
#
#######################################################################
# 
# $Log: emGine.py,v $
# Revision 1.3  2008-02-07 05:45:15  lorenz
# * Fixed 'Simulation Boundary View' check problem
#   when closing a project.
#
# * Fixed Bounding Box problems when moving/editing a geometry.
#
# Revision 1.2  2008-02-01 14:20:06  lorenz
# Relative path set to '.' when empty.
#
# Revision 1.1.1.1  2008-01-28 06:15:35  lorenz
# Import emGine GUI v. 0.7.1
#
# Revision 1.5  2007-07-02 06:36:59  lorenz
# Clean up of old code.
#
# Revision 1.4  2007-06-14 06:31:00  lorenz
# Added emGine settings
#
# Revision 1.3  2007-06-11 06:16:30  lorenz
# Added blank start
#
# Revision 1.2  2007-05-10 16:29:37  lorenz
# Changes in Copyright notice.
#
# Revision 1.1.1.1  2007-05-08 06:22:35  lorenz
# Initial Import
#
#######################################################################
#
from xml.dom.minidom import parse, parseString, Node

import sys, os
from emGineGUI import MainWindow


##############################
if __name__ == '__main__':
  #
  # quick & Dirty hack to avoid Segfault, due to
  # uninitialized xml.dom.minidom
  #
  # This segmentation fault occurs when vtkTkRenderWidget
  # is used on some configurations (e.g., Slackware Linux 10.1)!!!
  #
  # 13.02.2006, Petr Lorenz
  #
  dom_dummy = parseString("<dummy/>")

  print "emGine GUI, Copyright (C) 2004-2008 Petr Lorenz"
  print "All rights reserved."
  print ""

  print "This software is distributed on an \"AS IS\" basis,"
  print "WITHOUT WARRANTY OF ANY KIND, either express or implied."
  print "For details, see the LICENSE file."
  
  print ""
  print "Starting emGine GUI..."

  # Here we go, really
  args = sys.argv

  # change the working directory to the app directory
  rel_path = os.path.split(args[0])[0]
  if rel_path == "":
    rel_path = "."
  os.chdir(rel_path)

  main_window = MainWindow.MainWindow()

  if len(args) > 1:
    main_window.open_project_from_file(args[1])

  main_window.MainLoop()
