mirror of
https://github.com/dustinkirkland/byobu
synced 2025-08-21 14:03:18 -07:00
merge from Nick, toggles for help and launchper install
This commit is contained in:
commit
d668784e61
5 changed files with 94 additions and 30 deletions
8
debian/changelog
vendored
8
debian/changelog
vendored
|
@ -6,8 +6,14 @@ screen-profiles (1.6) UNRELEASED; urgency=low
|
||||||
* profiles/ubuntu: zero-fill the hour component of the timestamp
|
* profiles/ubuntu: zero-fill the hour component of the timestamp
|
||||||
* bin/updates-available: add some rudimentary caching mechanism for updates,
|
* bin/updates-available: add some rudimentary caching mechanism for updates,
|
||||||
will make screen launch *much* faster on <= Ubuntu 8.10
|
will make screen launch *much* faster on <= Ubuntu 8.10
|
||||||
|
* screen-install, screen-remove: renamed to screen-launcher-install,
|
||||||
|
screen-launcher-uninstall
|
||||||
|
|
||||||
-- Dustin Kirkland <kirkland@ubuntu.com> Sat, 10 Jan 2009 12:56:02 -0600
|
[ Nicolas Barcet ]
|
||||||
|
* Add toggles to fix bugs LP: #315884 and LP: #315885 for help screen and
|
||||||
|
install of screen by defaults
|
||||||
|
|
||||||
|
-- Dustin Kirkland <kirkland@ubuntu.com> Mon, 12 Jan 2009 00:39:25 -0600
|
||||||
|
|
||||||
screen-profiles (1.5-0ubuntu1) jaunty; urgency=low
|
screen-profiles (1.5-0ubuntu1) jaunty; urgency=low
|
||||||
|
|
||||||
|
|
3
debian/install
vendored
3
debian/install
vendored
|
@ -11,5 +11,6 @@ keybindings/common usr/share/screen-profiles/keybindings
|
||||||
windows/common usr/share/screen-profiles/windows
|
windows/common usr/share/screen-profiles/windows
|
||||||
select-screen-profile usr/bin
|
select-screen-profile usr/bin
|
||||||
screen-profiles-helper usr/bin
|
screen-profiles-helper usr/bin
|
||||||
screen-install usr/share/screen-profiles/
|
screen-launcher-install usr/share/screen-profiles/
|
||||||
|
screen-launcher-uninstall usr/share/screen-profiles/
|
||||||
screen-launcher usr/bin/
|
screen-launcher usr/bin/
|
||||||
|
|
31
screen-launcher-uninstall
Executable file
31
screen-launcher-uninstall
Executable file
|
@ -0,0 +1,31 @@
|
||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# GNU screen-profiles-helper
|
||||||
|
# Copyright (C) 2008 Canonical Ltd.
|
||||||
|
#
|
||||||
|
# Authors: Nick Barcet <nick.barcet@ubuntu.com>
|
||||||
|
# Dustin Kirkland <kirkland@canonical.com>
|
||||||
|
#
|
||||||
|
# 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; either version 2 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# 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 Foundation, Inc.,
|
||||||
|
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
|
||||||
|
|
||||||
|
remove_screen_launcher() {
|
||||||
|
dest=$1
|
||||||
|
sed -ibak '/^\/usr\/bin\/screen-launcher$/d' "$dest"
|
||||||
|
}
|
||||||
|
|
||||||
|
remove_screen_launcher "$HOME/.bashrc"
|
||||||
|
remove_screen_launcher "$HOME/.bash_profile"
|
||||||
|
|
|
@ -53,13 +53,19 @@ def terminal_size(): ### decide on *some* terminal size
|
||||||
cr = (25, 80)
|
cr = (25, 80)
|
||||||
return int(cr[1]-5), int(cr[0]-5) # reverse rows, cols
|
return int(cr[1]-5), int(cr[0]-5) # reverse rows, cols
|
||||||
|
|
||||||
def menu(screen, size):
|
def menu(screen, size, isInstalled):
|
||||||
|
if isInstalled:
|
||||||
|
installtext="Remove screen by default at login"
|
||||||
|
else:
|
||||||
|
installtext="Install screen by default at login"
|
||||||
|
|
||||||
|
|
||||||
li = Listbox(height = 5, width = 60, returnExit = 1)
|
li = Listbox(height = 5, width = 60, returnExit = 1)
|
||||||
li.append("Help", 1)
|
li.append("Help", 1)
|
||||||
li.append("Change screen profile", 2)
|
li.append("Change screen profile", 2)
|
||||||
li.append("Create new window(s)", 3)
|
li.append("Create new window(s)", 3)
|
||||||
li.append("Manage default windows", 4)
|
li.append("Manage default windows", 4)
|
||||||
li.append("Install screen by default at login", 5)
|
li.append(installtext, 5)
|
||||||
bb = ButtonBar(screen, (("Ok", "ok"), ("Exit", "exit")), compact = 1)
|
bb = ButtonBar(screen, (("Ok", "ok"), ("Exit", "exit")), compact = 1)
|
||||||
|
|
||||||
g = GridForm(screen, "GNU Screen Profiles Menu", 1, 2)
|
g = GridForm(screen, "GNU Screen Profiles Menu", 1, 2)
|
||||||
|
@ -83,7 +89,7 @@ def messagebox(screen, width, height, title, text, \
|
||||||
|
|
||||||
return bb.buttonPressed(g.runOnce())
|
return bb.buttonPressed(g.runOnce())
|
||||||
|
|
||||||
def help(screen, size, intro=0, config=None):
|
def help(screen, size, config):
|
||||||
f=file('/usr/share/doc/screen-profiles/help.txt')
|
f=file('/usr/share/doc/screen-profiles/help.txt')
|
||||||
text=f.read()
|
text=f.read()
|
||||||
f.close()
|
f.close()
|
||||||
|
@ -91,27 +97,31 @@ def help(screen, size, intro=0, config=None):
|
||||||
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 intro == 1:
|
if (config.get('Defaults', 'help') == "on"):
|
||||||
formlen=3
|
cbOn = 1
|
||||||
cb=Checkbox("Display this help on startup", isOn=1)
|
|
||||||
else:
|
else:
|
||||||
formlen=2
|
cbOn = 0
|
||||||
|
|
||||||
g = GridForm(screen, "GNU Screen Profiles Help", 1, formlen)
|
cb=Checkbox("Display this help on startup", isOn=cbOn)
|
||||||
|
|
||||||
|
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))
|
||||||
if intro == 1:
|
|
||||||
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))
|
||||||
else:
|
|
||||||
g.add(bb, 0, 1, padding=(1,1,0,0))
|
|
||||||
|
|
||||||
button = bb.buttonPressed(g.runOnce())
|
button = bb.buttonPressed(g.runOnce())
|
||||||
|
|
||||||
if intro == 1 and not cb.value():
|
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'):
|
||||||
config.add_section('Defaults')
|
config.add_section('Defaults')
|
||||||
config.set('Defaults','help','off')
|
|
||||||
|
if cb.value() == 1:
|
||||||
|
value = "on"
|
||||||
|
else:
|
||||||
|
value = "off"
|
||||||
|
|
||||||
|
config.set('Defaults','help',value)
|
||||||
configfile=open(os.getenv("HOME")+'/.screen-profiles-helper', 'wb')
|
configfile=open(os.getenv("HOME")+'/.screen-profiles-helper', 'wb')
|
||||||
try:
|
try:
|
||||||
config.write(configfile)
|
config.write(configfile)
|
||||||
|
@ -277,8 +287,9 @@ def defaultwindows(screen, size):
|
||||||
|
|
||||||
return 100
|
return 100
|
||||||
|
|
||||||
def install(screen, size):
|
def install(screen, size, isInstalled):
|
||||||
out = commands.getoutput("bash /usr/share/screen-profiles/screen-install")
|
if not isInstalled:
|
||||||
|
out = commands.getoutput("bash /usr/share/screen-profiles/screen-launcher-install")
|
||||||
if out == "":
|
if out == "":
|
||||||
out = "Screen will be launched automatically next time you login."
|
out = "Screen will be launched automatically next time you login."
|
||||||
|
|
||||||
|
@ -288,6 +299,18 @@ def install(screen, size):
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
return 100
|
return 100
|
||||||
|
else:
|
||||||
|
out = commands.getoutput("bash /usr/share/screen-profiles/screen-launcher-uninstall")
|
||||||
|
if out == "":
|
||||||
|
out = "Screen will not be used next time you login."
|
||||||
|
|
||||||
|
button = messagebox(screen, 60, 2, "Message", out, \
|
||||||
|
buttons=(("Ok","ok"), ("Exit", "exit")) )
|
||||||
|
if button == "exit":
|
||||||
|
return 0
|
||||||
|
|
||||||
|
return 101
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
"""This is the main loop of our screen helper.
|
"""This is the main loop of our screen helper.
|
||||||
|
@ -304,15 +327,17 @@ def main():
|
||||||
else:
|
else:
|
||||||
showhelp="on"
|
showhelp="on"
|
||||||
|
|
||||||
if showhelp == "on":
|
isInstalled = (commands.getoutput('grep screen-launcher '+(os.getenv("HOME")+'/.bashrc')) != "")
|
||||||
tag = help(screen, size, intro=1, config=config)
|
|
||||||
|
if showhelp == "on" :
|
||||||
|
tag = help(screen, size, config)
|
||||||
else:
|
else:
|
||||||
tag = 100
|
tag = 100
|
||||||
|
|
||||||
while tag > 0 :
|
while tag > 0 :
|
||||||
tag = menu(screen, size)
|
tag = menu(screen, size, isInstalled)
|
||||||
if tag == 1:
|
if tag == 1:
|
||||||
tag = help(screen, size)
|
tag = help(screen, size, config)
|
||||||
elif tag == 2:
|
elif tag == 2:
|
||||||
tag = profile(screen, size)
|
tag = profile(screen, size)
|
||||||
elif tag == 3:
|
elif tag == 3:
|
||||||
|
@ -320,7 +345,8 @@ def main():
|
||||||
elif tag == 4:
|
elif tag == 4:
|
||||||
tag = defaultwindows(screen, size)
|
tag = defaultwindows(screen, size)
|
||||||
elif tag == 5:
|
elif tag == 5:
|
||||||
tag = install(screen, size)
|
tag = install(screen, size, isInstalled)
|
||||||
|
isInstalled=(tag == 100)
|
||||||
|
|
||||||
screen.finish()
|
screen.finish()
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue