terminator/terminator

79 lines
2.5 KiB
Plaintext
Raw Normal View History

#!/usr/bin/env python
2007-07-28 01:33:48 +00:00
# Terminator - multiple gnome terminals in one window
2010-01-04 23:56:28 +00:00
# Copyright (C) 2006-2010 cmsj@tenshu.net
2007-07-28 01:33:48 +00:00
#
# 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, version 2 only.
#
# 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
2008-09-03 23:52:04 +00:00
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
# USA
2007-07-28 01:33:48 +00:00
"""Terminator by Chris Jones <cmsj@tenshu.net>"""
import sys
import os
ORIGCWD = os.getcwd()
# Check we have simple basics like Gtk+ and a valid $DISPLAY
try:
import pygtk
pygtk.require ("2.0")
# pylint: disable-msg=W0611
import gtk, pango, gobject
if gtk.gdk.display_get_default() == None:
print('You need to run terminator in an X environment. ' \
'Make sure $DISPLAY is properly set')
sys.exit(1)
2008-07-16 23:54:21 +00:00
except ImportError:
print('You need to install the python bindings for ' \
'gobject, gtk and pango to run Terminator.')
sys.exit(1)
import terminatorlib.optionparse
from terminatorlib.terminator import Terminator
from terminatorlib.factory import Factory
from terminatorlib.version import APP_NAME, APP_VERSION
from terminatorlib.util import dbg, err
if __name__ == '__main__':
dbg ("%s starting up, version %s" % (APP_NAME, APP_VERSION))
OPTIONS = terminatorlib.optionparse.parse_options()
MAKER = Factory()
TERMINATOR = Terminator()
TERMINATOR.origcwd = ORIGCWD
2010-01-11 23:46:18 +00:00
TERMINATOR.reconfigure()
2010-02-05 00:16:24 +00:00
try:
TERMINATOR.create_layout(OPTIONS.layout)
except (KeyError,ValueError), ex:
err('layout creation failed, creating a window ("%s")' % ex)
TERMINATOR.new_window()
finally:
TERMINATOR.layout_done()
if OPTIONS.debug > 2:
import terminatorlib.debugserver as debugserver
# pylint: disable-msg=W0611
import threading
gtk.gdk.threads_init()
(DEBUGTHREAD, DEBUGSVR) = debugserver.spawn(locals())
TERMINATOR.debugaddress = DEBUGSVR.server_address
try:
gtk.main()
except KeyboardInterrupt:
pass