#!/usr/bin/python
# -*- coding: utf8 -*-
#
# XSL - graphical interface for SL
# Copyright (C) 2007-2016 Devaev Maxim
#
# This file is part of XSL.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
#
# apps/xsl/src/pyqt4/xsl.py.  Generated from xsl.py.in by configure.


import sys
import getopt


#####
if __name__ == "__main__" :
	enable_psyco_flag = False
	no_splash_flag = False
	no_tray_icon_flag = False
	libs_dir = "/usr/lib/xsl/pyqt4"

	#####

	try :
		(opts_list, args_list) = getopt.getopt(sys.argv[1:], "hs:", ["enable-psyco", "no-splash", "no-tray-icon",
			"libs-dir=", "help", "session="])
	except Exception, err1 :
		print >> sys.stderr, "xsl: "+str(err1)
		print >> sys.stderr, "usage: xsl [ --enable-psyco | --no-splash | --no-tray-icon | --libs-dir=<dir> | -h | --help ]"
		sys.exit(1)

	for (opts_list_item, args_list_item) in opts_list :
		if opts_list_item in ("--enable-psyco") :
			enable_psyco_flag = True
		elif opts_list_item in ("--no-splash") :
			no_splash_flag = True
		elif opts_list_item in ("--no-tray-icon") :
			no_tray_icon_flag = True
		elif opts_list_item in ("--libs-dir") :
			libs_dir = args_list_item
		elif opts_list_item in ("-h", "--help") :
			print "usage: xsl [ --enable-psyco | --no-splash | --no-tray-icon | --libs-dir=<dir> | -h | --help ]"
			sys.exit(0)

	#####

	sys.path.append(libs_dir)
	import Main

	#####

	if enable_psyco_flag :
		try :
			import psyco
			psyco.full()
			print "xsl: experemetal \"psyco\" module is enabled"
		except :
			print >> sys.stderr, "xsl: cannot enable experemental \"psyco\" module: ignored"

	#####

	main = Main.Main(sys.argv, no_splash_flag, no_tray_icon_flag)
	main.run()

