fix some pylint stuff
This commit is contained in:
parent
3fb661620a
commit
125c1a61ac
54
terminator
54
terminator
|
@ -13,7 +13,8 @@
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program; if not, write to the Free Software
|
# along with this program; if not, write to the Free Software
|
||||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
|
||||||
|
# USA
|
||||||
|
|
||||||
"""Terminator by Chris Jones <cmsj@tenshu.net>"""
|
"""Terminator by Chris Jones <cmsj@tenshu.net>"""
|
||||||
|
|
||||||
|
@ -23,6 +24,10 @@ from optparse import OptionParser, SUPPRESS_HELP
|
||||||
|
|
||||||
from terminatorlib.version import APP_NAME, APP_VERSION
|
from terminatorlib.version import APP_NAME, APP_VERSION
|
||||||
|
|
||||||
|
def _(**kwargs):
|
||||||
|
'''Dummy function'''
|
||||||
|
return (kwargs)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import gettext
|
import gettext
|
||||||
gettext.install (APP_NAME)
|
gettext.install (APP_NAME)
|
||||||
|
@ -49,31 +54,31 @@ except ImportError:
|
||||||
from terminatorlib.terminator import Terminator
|
from terminatorlib.terminator import Terminator
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
def execute_cb (option, opt, value, parser):
|
def execute_cb (option, opt, value, lparser):
|
||||||
"""Callback for use in parsing Terminator command line options"""
|
"""Callback for use in parsing Terminator command line options"""
|
||||||
assert value is None
|
assert value is None
|
||||||
value = []
|
value = []
|
||||||
while parser.rargs:
|
while lparser.rargs:
|
||||||
arg = parser.rargs[0]
|
arg = lparser.rargs[0]
|
||||||
value.append (arg)
|
value.append (arg)
|
||||||
del (parser.rargs[0])
|
del (lparser.rargs[0])
|
||||||
setattr(parser.values, option.dest, value)
|
setattr(lparser.values, option.dest, value)
|
||||||
|
|
||||||
def profile_cb (option, opt, value, parser):
|
def profile_cb (option, opt, value, lparser):
|
||||||
"""Callback for handling the profile name"""
|
"""Callback for handling the profile name"""
|
||||||
assert value is None
|
assert value is None
|
||||||
value = ''
|
value = ''
|
||||||
while parser.rargs:
|
while lparser.rargs:
|
||||||
arg = parser.rargs[0]
|
arg = lparser.rargs[0]
|
||||||
if arg[0] != '-':
|
if arg[0] != '-':
|
||||||
if len (value) > 0:
|
if len (value) > 0:
|
||||||
value = '%s %s' % (value, arg)
|
value = '%s %s' % (value, arg)
|
||||||
else:
|
else:
|
||||||
value = '%s' % arg
|
value = '%s' % arg
|
||||||
del (parser.rargs[0])
|
del (lparser.rargs[0])
|
||||||
else:
|
else:
|
||||||
break
|
break
|
||||||
setattr (parser.values, option.dest, value)
|
setattr (lparser.values, option.dest, value)
|
||||||
|
|
||||||
usage = "usage: %prog [options]"
|
usage = "usage: %prog [options]"
|
||||||
parser = OptionParser (usage)
|
parser = OptionParser (usage)
|
||||||
|
@ -83,10 +88,10 @@ if __name__ == '__main__':
|
||||||
help="Enable debugging information (twice for debug server)")
|
help="Enable debugging information (twice for debug server)")
|
||||||
parser.add_option ("-m", "--maximise", action="store_true", dest="maximise",
|
parser.add_option ("-m", "--maximise", action="store_true", dest="maximise",
|
||||||
help="Open the %s window maximised" % APP_NAME.capitalize())
|
help="Open the %s window maximised" % APP_NAME.capitalize())
|
||||||
parser.add_option ("-f", "--fullscreen", action="store_true", dest="fullscreen",
|
parser.add_option ("-f", "--fullscreen", action="store_true",
|
||||||
help="Set the window into fullscreen mode")
|
dest="fullscreen", help="Set the window into fullscreen mode")
|
||||||
parser.add_option ("-b", "--borderless", action="store_true", dest="borderless",
|
parser.add_option ("-b", "--borderless", action="store_true",
|
||||||
help="Turn off the window's borders")
|
dest="borderless", help="Turn off the window's borders")
|
||||||
parser.add_option ("-n", "--no-gconf", dest="no_gconf", action="store_true",
|
parser.add_option ("-n", "--no-gconf", dest="no_gconf", action="store_true",
|
||||||
help="ignore gnome-terminal gconf settings")
|
help="ignore gnome-terminal gconf settings")
|
||||||
parser.add_option ("-p", "--profile", dest="profile", action="callback",
|
parser.add_option ("-p", "--profile", dest="profile", action="callback",
|
||||||
|
@ -96,16 +101,18 @@ if __name__ == '__main__':
|
||||||
parser.add_option ("-e", "--command", dest="command",
|
parser.add_option ("-e", "--command", dest="command",
|
||||||
help="Execute the argument to this option inside the terminal")
|
help="Execute the argument to this option inside the terminal")
|
||||||
parser.add_option ("-x", "--execute", dest="execute", action="callback",
|
parser.add_option ("-x", "--execute", dest="execute", action="callback",
|
||||||
callback=execute_cb, help="Execute the remainder of the command line inside the terminal")
|
callback=execute_cb, help="Execute the remainder of the command line \
|
||||||
for opt in ['--sm-client-id', '--sm-config-prefix', '--screen']:
|
inside the terminal")
|
||||||
parser.add_option (opt, dest="dummy", action="store", help=SUPPRESS_HELP)
|
for item in ['--sm-client-id', '--sm-config-prefix', '--screen']:
|
||||||
|
parser.add_option (item, dest="dummy", action="store", help=SUPPRESS_HELP)
|
||||||
|
|
||||||
(options, args) = parser.parse_args ()
|
(options, args) = parser.parse_args ()
|
||||||
if len (args) != 0:
|
if len (args) != 0:
|
||||||
parser.error("Expecting zero additional arguments, found: %d" % len (args))
|
parser.error("Expecting zero additional arguments, found: %d" % len (args))
|
||||||
|
|
||||||
if options.no_gconf and options.profile:
|
if options.no_gconf and options.profile:
|
||||||
parser.error("using --no-gconf and defining a profile at the same time does not make sense")
|
parser.error("using --no-gconf and defining a profile at the same time \
|
||||||
|
does not make sense")
|
||||||
|
|
||||||
if options.version:
|
if options.version:
|
||||||
print "%s %s" % (APP_NAME, APP_VERSION)
|
print "%s %s" % (APP_NAME, APP_VERSION)
|
||||||
|
@ -130,8 +137,8 @@ if __name__ == '__main__':
|
||||||
except IOError:
|
except IOError:
|
||||||
try:
|
try:
|
||||||
open (os.path.expanduser ('~/.terminatorrc'))
|
open (os.path.expanduser ('~/.terminatorrc'))
|
||||||
error = gtk.MessageDialog (None, gtk.DIALOG_MODAL, gtk.MESSAGE_ERROR, gtk.BUTTONS_OK,
|
error = gtk.MessageDialog (None, gtk.DIALOG_MODAL, gtk.MESSAGE_ERROR,
|
||||||
('''You have a configuration file:
|
gtk.BUTTONS_OK, ('''You have a configuration file:
|
||||||
|
|
||||||
~/.terminatorrc.
|
~/.terminatorrc.
|
||||||
|
|
||||||
|
@ -148,8 +155,9 @@ See the following bug report for more details:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
dbg ('profile_cb: settled on profile: "%s"' % options.profile)
|
dbg ('profile_cb: settled on profile: "%s"' % options.profile)
|
||||||
term = Terminator (options.profile, command, options.fullscreen, options.maximise,
|
term = Terminator (options.profile, command, options.fullscreen,
|
||||||
options.borderless, options.no_gconf, options.geometry)
|
options.maximise, options.borderless, options.no_gconf,
|
||||||
|
options.geometry)
|
||||||
|
|
||||||
if options.debug > 1:
|
if options.debug > 1:
|
||||||
import terminatorlib.debugserver as debugserver
|
import terminatorlib.debugserver as debugserver
|
||||||
|
|
Loading…
Reference in New Issue