94
93
installtext=_("Byobu currently launches at login (toggle off)")
96
95
installtext=_("Byobu currently does not launch at login (toggle on)")
99
li = Listbox(height = 9, width = 60, returnExit = 1)
96
li = Listbox(height = 6, width = 60, returnExit = 1)
100
97
li.append(_("Help -- Quick Start Guide"), 1)
101
li.append(_("Change Byobu's background color"), 2)
102
li.append(_("Change Byobu's foreground color"), 3)
103
li.append(_("Toggle status notifications"), 4)
104
li.append(_("Change keybinding set"), 5)
105
li.append(_("Change escape sequence"), 6)
106
li.append(_("Create new windows"), 7)
107
li.append(_("Manage default windows"), 8)
108
li.append(installtext, 9)
98
li.append(_("Toggle status notifications"), 2)
99
li.append(_("Change escape sequence"), 3)
100
li.append(installtext, 4)
109
101
bb = ButtonBar(snackScreen, (("Exit", "exit", ESC),), compact=1)
111
102
g = GridForm(snackScreen, _(" Byobu Configuration Menu"), 1, 2)
112
103
g.add(li, 0, 0, padding=(4,2,4,2))
113
104
g.add(bb, 0, 1, padding=(1,1,0,0))
115
105
if bb.buttonPressed(g.runOnce()) == "exit":
120
110
def messagebox(snackScreen, width, height, title, text, scroll=0, \
121
111
buttons=((_("Okay"), "okay"),(_("Cancel"), "cancel", ESC)) ):
123
112
t = Textbox(width, height, text, scroll=scroll )
124
113
bb = ButtonBar(snackScreen, buttons, compact = 1)
125
114
g = GridForm(snackScreen, title, 1, 2)
126
115
g.add(t, 0, 0, padding=(0,0,0,0))
127
116
g.add(bb, 0, 1, padding=(1,1,0,0))
129
117
return bb.buttonPressed(g.runOnce())
131
119
def help(snackScreen, size, config):
132
f=file(DOC+'/help.txt')
120
f=file(DOC+'/help.'+BYOBU_BACKEND+'.txt')
136
123
text=text.replace("<esckey>", getesckey(), 1)
137
124
text=text.replace("_VER_", commands.getoutput("byobu -v | head -n1 | " + SED + " 's/.* //'"), 1)
139
t = Textbox(70, 14, text, scroll=0)
125
t = Textbox(67, 16, text, scroll=1, wrap=1)
140
126
bb = ButtonBar(snackScreen, ((_("Menu"), "menu", ESC),), compact = 1)
141
g = GridForm(snackScreen, _("Byobu Help"), 1, 3)
142
g.add(t, 0, 0, padding=(0,0,0,0))
143
g.add(bb, 0, 2, padding=(1,1,0,0))
127
g = GridForm(snackScreen, _("Byobu Help"), 2, 4)
129
g.add(bb, 1, 1, padding=(1,1,0,0))
145
130
button = bb.buttonPressed(g.runOnce())
149
def select_color(snackScreen, size, layer):
150
li = Listbox(height = 8, width = 60, scroll = 1, returnExit = 1)
152
for choice in commands.getoutput('byobu-select-profile -l').splitlines():
153
li.append(choice, choice)
155
bb = ButtonBar(snackScreen, ((_("Apply"), "apply"), (_("Cancel"), "cancel", ESC)), compact = 1)
157
if layer == "foreground":
158
g = GridForm(snackScreen, _("Choose a foreground color:"), 1, 2)
160
g = GridForm(snackScreen, _("Choose a background color:"), 1, 2)
162
g.add(li, 0, 0, padding=(4,2,4,2))
163
g.add(bb, 0, 1, padding=(1,1,0,0))
165
if bb.buttonPressed(g.runOnce()) != "cancel":
166
if layer == "foreground":
167
commands.getoutput('byobu-select-profile --foreground %s' % li.current())
169
commands.getoutput('byobu-select-profile --background %s' % li.current())
173
def keybindings(snackScreen, size):
174
li = Listbox(height = 6, width = 60, returnExit = 1)
175
for choice in commands.getoutput('ls '+SHARE+'/keybindings').splitlines():
176
if choice != "common" and choice != "none":
177
li.append(choice, choice)
178
li.append("none", "none")
179
bb = ButtonBar(snackScreen, ((_("Apply"), "apply"), (_("Cancel"), "cancel", ESC)), compact = 1)
180
g = GridForm(snackScreen, _("Which set of keybindings would you like to use?"), 1, 2)
181
g.add(li, 0, 0, padding=(4,2,4,2))
182
g.add(bb, 0, 1, padding=(1,1,0,0))
183
if bb.buttonPressed(g.runOnce()) != "cancel":
184
switch_keybindings(li.current())
188
def switch_keybindings(set):
189
commands.getoutput(SED + " -i -e 's:^source .*$:source "+SHARE+"/keybindings/"+set+":' "+BYOBU_CONFIG_DIR+"/keybindings")
191
def newwindow(snackScreen, size):
192
title=Entry(8, text="shell", returnExit=1)
193
titlel=Label(_("Title: "))
194
command=Entry(20, text="/bin/sh", returnExit=1)
195
commandl=Label(_("Command: "))
196
path=Entry(20, text="~", returnExit=1)
197
pathl=Label(_("Path: "))
199
rl=Label(_("Presets: "))
207
r=CheckboxTree(size, scroll=scroll)
210
r.append(cur[0], count)
213
cb=Checkbox(_("Add to default windows"))
215
bb = ButtonBar(snackScreen, ((_("Apply"), "apply"), (_("Cancel"), "cancel", ESC)), compact = 1)
217
g = GridForm(snackScreen, _("Create new window(s):"), 2, 6 )
218
g.add(titlel, 0, 0, anchorLeft=1,padding=(4,1,0,1))
219
g.add(title, 1, 0, anchorLeft=1)
220
g.add(commandl, 0, 1, anchorLeft=1, anchorTop=1,padding=(4,0,0,1))
221
g.add(command, 1, 1, anchorLeft=1)
222
g.add(pathl, 0, 2, anchorLeft=1, anchorTop=1,padding=(4,0,0,1))
223
g.add(path, 1, 2, anchorLeft=1)
224
g.add(rl, 0, 3, anchorLeft=1,padding=(4,0,0,1))
226
g.add(cb, 1, 4, padding=(4,1,0,1))
227
g.add(bb, 1, 5, padding=(4,1,0,0))
229
if bb.buttonPressed(g.runOnce()) != "cancel":
233
win='%s -t %s %s' % (BYOBU_BACKEND, cmd[s][1], cmd[s][2])
234
commands.getoutput(win)
238
cpath='%s -X setenv newpath %s' % (BYOBU_BACKEND, path.value())
239
win='%s -X eval \'chdir $newpath\' \"%s -t %s %s\"' % (BYOBU_BACKEND, BYOBU_BACKEND, title.value(), command.value())
240
commands.getoutput(cpath)
241
commands.getoutput(win)
243
cpath='chdir %s' % (path.value())
244
win='%s -t %s %s' % (BYOBU_BACKEND, title.value(), command.value())
250
def appendwindow(win):
251
f=open(BYOBU_CONFIG_DIR+'/windows', 'a')
262
if not os.path.isfile(BYOBU_CONFIG_DIR+'/windows'):
263
windowsfile=SHARE+'/windows/common'
264
elif os.path.getsize(BYOBU_CONFIG_DIR+'/windows') == 0:
265
windowsfile=SHARE+'/windows/common'
267
windowsfile=BYOBU_CONFIG_DIR+'/windows'
271
for line in f.readlines():
272
if line.startswith("# "):
275
elif line.startswith("#"):
276
# this is an inactive window
277
window=[0, line.lstrip("#")]
290
133
def readstatus():
370
213
reload_required()
373
def writewindows(winlist):
374
f=open(BYOBU_CONFIG_DIR+'/windows', 'w')
388
def defaultwindows(snackScreen, size):
389
winlist=readwindows()
391
rl=Label(_("Windows:"))
392
r=CheckboxTree(10, scroll=1)
396
r.append(win[1],count,selected=win[0])
399
bb = ButtonBar(snackScreen, ((_("Apply"), "apply"), (_("Cancel"), "cancel", ESC)), compact = 1)
401
g = GridForm(snackScreen, _("Select window(s) to create by default:"), 2, 4 )
402
g.add(rl, 0, 0, anchorLeft=1, anchorTop=1, padding=(4,0,0,1))
404
g.add(bb, 1, 1, padding=(4,1,0,0))
406
if bb.buttonPressed(g.runOnce()) != "cancel":
410
win[0] = r.getEntryValue(count)[1]
413
writewindows(winlist)
417
216
def install(snackScreen, size, isInstalled):
419
218
out = commands.getoutput("byobu-launcher-uninstall")
421
out = _("Byobu will not be used next time you login.")
220
out = _("Byobu will not be launched next time you login.")
422
221
button = messagebox(snackScreen, 60, 2, _("Message"), out, buttons=((_("Menu"), )))