fix problem with screen-profiles-helper not starting with the config file

does not exist

release as 1.8
open 1.9 for development
This commit is contained in:
Dustin Kirkland 2009-01-12 09:11:42 -06:00
commit 87dd5a7cac
2 changed files with 26 additions and 13 deletions

13
debian/changelog vendored
View file

@ -1,9 +1,16 @@
screen-profiles (1.8) UNRELEASED; urgency=low screen-profiles (1.9) UNRELEASED; urgency=low
*
-- Dustin Kirkland <kirkland@ubuntu.com> Mon, 12 Jan 2009 09:11:30 -0600
screen-profiles (1.8-0ubuntu1) jaunty; urgency=low
[ Dustin Kirkland ] [ Dustin Kirkland ]
* profiles/common: source the system default /etc/screenrc * screen-profiles-helper: fix crash on startup, when
~/.screen-profiles-helper does not exist
-- Dustin Kirkland <kirkland@ubuntu.com> Mon, 12 Jan 2009 01:09:14 -0600 -- Dustin Kirkland <kirkland@ubuntu.com> Mon, 12 Jan 2009 09:11:15 -0600
screen-profiles (1.7-0ubuntu1) jaunty; urgency=low screen-profiles (1.7-0ubuntu1) jaunty; urgency=low

View file

@ -96,21 +96,24 @@ def help(screen, size, config):
t = Textbox(74, 19, text, scroll=1) t = Textbox(74, 19, text, scroll=1)
bb = ButtonBar(screen, (("Menu", "menu"), ("Exit", "exit")), compact = 1) bb = ButtonBar(screen, (("Menu", "menu"), ("Exit", "exit")), compact = 1)
if (config.get('Defaults', 'help') == "on"): try:
if (config.get('Defaults', 'help') == "on"):
cbOn = 1
else:
cbOn = 0
except:
cbOn = 1 cbOn = 1
else:
cbOn = 0
cb=Checkbox("Display this help on startup", isOn=cbOn) cb=Checkbox("Display this help on startup", isOn=cbOn)
g = GridForm(screen, "GNU Screen Profiles Help", 1, 3) g = GridForm(screen, "GNU Screen Profiles Help", 1, 3)
g.add(t, 0, 0, padding=(0,0,0,0)) g.add(t, 0, 0, padding=(0,0,0,0))
g.add(cb, 0, 1, padding=(1,0,0,0)) g.add(cb, 0, 1, padding=(1,0,0,0))
g.add(bb, 0, 2, padding=(1,1,0,0)) g.add(bb, 0, 2, padding=(1,1,0,0))
button = bb.buttonPressed(g.runOnce()) button = bb.buttonPressed(g.runOnce())
if cb.value() != cbOn: if cb.value() != cbOn:
#Check box value has change, write config file #Check box value has change, write config file
if not config.has_section('Defaults'): if not config.has_section('Defaults'):
@ -321,10 +324,13 @@ def main():
screen.pushHelpLine("<Tab>/<Alt-Tab> between elements | <Return> Validates") screen.pushHelpLine("<Tab>/<Alt-Tab> between elements | <Return> Validates")
config = SafeConfigParser() config = SafeConfigParser()
config.read(os.getenv("HOME")+'/.screen-profiles-helper') try:
if config.has_option('Defaults', 'help'): config.read(os.getenv("HOME")+'/.screen-profiles-helper')
showhelp=config.get('Defaults', 'help') if config.has_option('Defaults', 'help'):
else: showhelp=config.get('Defaults', 'help')
else:
showhelp="on"
except:
showhelp="on" showhelp="on"
isInstalled = (commands.getoutput('grep screen-launcher '+(os.getenv("HOME")+'/.bashrc')) != "") isInstalled = (commands.getoutput('grep screen-launcher '+(os.getenv("HOME")+'/.bashrc')) != "")