2008-08-29 18:22:16 +00:00
|
|
|
#!/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
|
|
|
|
2008-02-12 22:06:19 +00:00
|
|
|
"""Terminator by Chris Jones <cmsj@tenshu.net>"""
|
2007-12-27 17:44:38 +00:00
|
|
|
|
2010-01-04 12:57:14 +00:00
|
|
|
import sys
|
2008-05-22 14:37:59 +00:00
|
|
|
|
2010-01-04 23:52:57 +00:00
|
|
|
# Check we have simple basics like Gtk+ and a valid $DISPLAY
|
2008-01-03 08:10:39 +00:00
|
|
|
try:
|
2010-01-04 23:52:57 +00:00
|
|
|
import pygtk
|
|
|
|
pygtk.require ("2.0")
|
2010-01-05 09:24:44 +00:00
|
|
|
# pylint: disable-msg=W0611
|
|
|
|
import gtk, pango, gobject
|
2010-01-04 23:52:57 +00:00
|
|
|
|
|
|
|
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-02 09:16:52 +00:00
|
|
|
|
2008-07-16 23:54:21 +00:00
|
|
|
except ImportError:
|
2010-01-04 23:52:57 +00:00
|
|
|
print('You need to install the python bindings for ' \
|
|
|
|
'gobject, gtk and pango to run Terminator.')
|
|
|
|
sys.exit(1)
|
2008-06-09 13:15:30 +00:00
|
|
|
|
2010-01-04 23:52:57 +00:00
|
|
|
import terminatorlib.optionparse
|
2010-01-11 20:11:35 +00:00
|
|
|
from terminatorlib.terminator import Terminator
|
2010-01-04 23:52:57 +00:00
|
|
|
from terminatorlib.factory import Factory
|
|
|
|
from terminatorlib.version import APP_NAME, APP_VERSION
|
|
|
|
from terminatorlib.util import dbg
|
2008-06-17 10:15:28 +00:00
|
|
|
|
2007-07-29 02:06:52 +00:00
|
|
|
if __name__ == '__main__':
|
2010-01-04 23:52:57 +00:00
|
|
|
dbg ("%s starting up, version %s" % (APP_NAME, APP_VERSION))
|
|
|
|
|
|
|
|
OPTIONS = terminatorlib.optionparse.parse_options()
|
2008-06-15 10:15:45 +00:00
|
|
|
|
2010-01-04 23:52:57 +00:00
|
|
|
MAKER = Factory()
|
|
|
|
TERMINATOR = Terminator()
|
2010-01-11 23:46:18 +00:00
|
|
|
TERMINATOR.reconfigure()
|
2010-01-11 20:56:30 +00:00
|
|
|
WINDOW = MAKER.make('Window')
|
2010-01-04 23:52:57 +00:00
|
|
|
TERMINAL = MAKER.make('Terminal')
|
2008-02-12 13:49:36 +00:00
|
|
|
|
2010-01-04 23:52:57 +00:00
|
|
|
WINDOW.add(TERMINAL)
|
|
|
|
WINDOW.show()
|
|
|
|
TERMINAL.spawn_child()
|
2008-07-16 23:43:55 +00:00
|
|
|
|
2010-01-14 13:15:05 +00:00
|
|
|
if OPTIONS.debug > 2:
|
2010-01-04 23:52:57 +00:00
|
|
|
import terminatorlib.debugserver as debugserver
|
|
|
|
# pylint: disable-msg=W0611
|
|
|
|
import threading
|
2008-02-12 13:49:36 +00:00
|
|
|
|
2010-01-04 23:52:57 +00:00
|
|
|
gtk.gdk.threads_init()
|
|
|
|
(DEBUGTHREAD, DEBUGSVR) = debugserver.spawn(locals())
|
|
|
|
TERMINATOR.debugaddress = DEBUGSVR.server_address
|
2008-07-16 23:43:55 +00:00
|
|
|
|
2008-06-17 00:58:41 +00:00
|
|
|
try:
|
2010-01-04 23:52:57 +00:00
|
|
|
gtk.main()
|
|
|
|
except KeyboardInterrupt:
|
|
|
|
pass
|
2006-11-10 05:18:31 +00:00
|
|
|
|