Remove a FIXME. Stop failing on unfound config values, this is madness. Move options parsing callback into the __main__ handling. Formatting tweaks

This commit is contained in:
Chris Jones 2008-02-25 09:50:06 +00:00
parent 2ee1943b4c
commit d4f5e4362f
1 changed files with 15 additions and 16 deletions

View File

@ -64,7 +64,6 @@ def openurl (url):
class TerminatorTerm: class TerminatorTerm:
# Our settings # Our settings
# FIXME: Add commandline and/or gconf options to change these
defaults = { defaults = {
'gt_dir' : '/apps/gnome-terminal', 'gt_dir' : '/apps/gnome-terminal',
'_profile_dir' : '%s/profiles', '_profile_dir' : '%s/profiles',
@ -236,8 +235,8 @@ class TerminatorTerm:
if ret == None: if ret == None:
print >> sys.stderr, _('Unknown value requested. Unable to find in gconf profile or default settings: ') + property print >> sys.stderr, _('Unknown value requested. Unable to find in gconf profile or default settings: ') + property
sys.exit (1)
return ret return (ret)
def reconfigure_vte (self): def reconfigure_vte (self):
# Set our emulation # Set our emulation
@ -669,11 +668,13 @@ class Terminator:
parent.add (pane) parent.add (pane)
position = (vertical) and parent.allocation.height or parent.allocation.width position = (vertical) and parent.allocation.height \
or parent.allocation.width
if isinstance (parent, gtk.Paned): if isinstance (parent, gtk.Paned):
# We are inside a split term # We are inside a split term
position = (vertical) and widget.get_box().allocation.height or widget.get_box().allocation.width position = (vertical) and widget.get_box().allocation.height \
or widget.get_box().allocation.width
if (widget.get_box () == parent.get_child1 ()): if (widget.get_box () == parent.get_child1 ()):
widget.get_box ().reparent (pane) widget.get_box ().reparent (pane)
@ -815,19 +816,17 @@ class Terminator:
return parent return parent
return self.get_first_parent_paned(parent, vertical) return self.get_first_parent_paned(parent, vertical)
def execute_cb (option, opt, value, parser):
assert value is None
value = []
while parser.rargs:
arg = parser.rargs[0]
value.append (arg)
del (parser.rargs[0])
setattr(parser.values, option.dest, value)
if __name__ == '__main__': if __name__ == '__main__':
def execute_cb (option, opt, value, parser):
assert value is None
value = []
while parser.rargs:
arg = parser.rargs[0]
value.append (arg)
del (parser.rargs[0])
setattr(parser.values, option.dest, value)
usage = "usage: %prog [options]" usage = "usage: %prog [options]"
parser = OptionParser (usage) parser = OptionParser (usage)
parser.add_option ("-d", "--debug", action="store_true", dest="debug", help="Enable debugging information") parser.add_option ("-d", "--debug", action="store_true", dest="debug", help="Enable debugging information")