mirror of
https://github.com/dustinkirkland/byobu
synced 2025-08-24 15:16:20 -07:00
* screen-profiles-helper: add HOME, SHARE, DOC global variables and use
them where possible
This commit is contained in:
parent
95a4d8c3e3
commit
44c02072a5
2 changed files with 17 additions and 9 deletions
6
debian/changelog
vendored
6
debian/changelog
vendored
|
@ -4,7 +4,11 @@ screen-profiles (1.12) UNRELEASED; urgency=low
|
||||||
* profiles/common, select-screen-profile: add support for sourcing
|
* profiles/common, select-screen-profile: add support for sourcing
|
||||||
individual user's ~/.screenrc-keybindings file
|
individual user's ~/.screenrc-keybindings file
|
||||||
|
|
||||||
-- Dustin Kirkland <kirkland@ubuntu.com> Tue, 20 Jan 2009 15:51:27 -0600
|
[ Dustin Kirkland and Nicolas Barcet]
|
||||||
|
* screen-profiles-helper: add HOME, SHARE, DOC global variables and use
|
||||||
|
them where possible
|
||||||
|
|
||||||
|
-- Dustin Kirkland <kirkland@ubuntu.com> Tue, 20 Jan 2009 21:55:43 -0600
|
||||||
|
|
||||||
screen-profiles (1.11-0ubuntu1) jaunty; urgency=low
|
screen-profiles (1.11-0ubuntu1) jaunty; urgency=low
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,11 @@ import sys, os, os.path, time, string, commands, gettext
|
||||||
from ConfigParser import SafeConfigParser
|
from ConfigParser import SafeConfigParser
|
||||||
from snack import *
|
from snack import *
|
||||||
|
|
||||||
gettext.bindtextdomain('screen-profiles-helper', '/usr/share/screen-profiles/po')
|
HOME=os.getenv("HOME")
|
||||||
|
SHARE='/usr/share/screen-profiles'
|
||||||
|
DOC='/usr/share/doc/screen-profiles'
|
||||||
|
|
||||||
|
gettext.bindtextdomain('screen-profiles-helper', SHARE+'/po')
|
||||||
gettext.textdomain('screen-profiles-helper')
|
gettext.textdomain('screen-profiles-helper')
|
||||||
_ = gettext.gettext
|
_ = gettext.gettext
|
||||||
|
|
||||||
|
@ -94,7 +98,7 @@ def messagebox(screen, width, height, title, text, \
|
||||||
return bb.buttonPressed(g.runOnce())
|
return bb.buttonPressed(g.runOnce())
|
||||||
|
|
||||||
def help(screen, size, config):
|
def help(screen, size, config):
|
||||||
f=file('/usr/share/doc/screen-profiles/help.txt')
|
f=file(DOC+'/help.txt')
|
||||||
text=f.read()
|
text=f.read()
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
|
@ -129,7 +133,7 @@ def help(screen, size, config):
|
||||||
value = "off"
|
value = "off"
|
||||||
|
|
||||||
config.set('Defaults','help',value)
|
config.set('Defaults','help',value)
|
||||||
configfile=open(os.getenv("HOME")+'/.screen-profiles-helper', 'wb')
|
configfile=open(HOME+'/.screen-profiles-helper', 'wb')
|
||||||
try:
|
try:
|
||||||
config.write(configfile)
|
config.write(configfile)
|
||||||
finally:
|
finally:
|
||||||
|
@ -215,7 +219,7 @@ def newwindow(screen, size):
|
||||||
return 100
|
return 100
|
||||||
|
|
||||||
def appendwindow(win):
|
def appendwindow(win):
|
||||||
f=open(os.getenv("HOME")+'/.screenrc-windows', 'a')
|
f=open(HOME+'/.screenrc-windows', 'a')
|
||||||
try:
|
try:
|
||||||
f.write(win+"\n")
|
f.write(win+"\n")
|
||||||
|
|
||||||
|
@ -226,7 +230,7 @@ def appendwindow(win):
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
def readwindows():
|
def readwindows():
|
||||||
f=open(os.getenv("HOME")+'/.screenrc-windows', 'r')
|
f=open(HOME+'/.screenrc-windows', 'r')
|
||||||
try:
|
try:
|
||||||
li=[]
|
li=[]
|
||||||
for line in f.readlines():
|
for line in f.readlines():
|
||||||
|
@ -249,7 +253,7 @@ def readwindows():
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
def writewindows(winlist):
|
def writewindows(winlist):
|
||||||
f=open(os.getenv("HOME")+'/.screenrc-windows', 'w')
|
f=open(HOME+'/.screenrc-windows', 'w')
|
||||||
try:
|
try:
|
||||||
for win in winlist:
|
for win in winlist:
|
||||||
if win[0] == -1:
|
if win[0] == -1:
|
||||||
|
@ -330,7 +334,7 @@ def main():
|
||||||
|
|
||||||
config = SafeConfigParser()
|
config = SafeConfigParser()
|
||||||
try:
|
try:
|
||||||
config.read(os.getenv("HOME")+'/.screen-profiles-helper')
|
config.read(HOME+'/.screen-profiles-helper')
|
||||||
if config.has_option('Defaults', 'help'):
|
if config.has_option('Defaults', 'help'):
|
||||||
showhelp=config.get('Defaults', 'help')
|
showhelp=config.get('Defaults', 'help')
|
||||||
else:
|
else:
|
||||||
|
@ -338,7 +342,7 @@ def main():
|
||||||
except:
|
except:
|
||||||
showhelp="on"
|
showhelp="on"
|
||||||
|
|
||||||
isInstalled = (commands.getoutput('grep screen-launcher '+(os.getenv("HOME")+'/.bashrc')) != "")
|
isInstalled = (commands.getoutput('grep screen-launcher '+(HOME+'/.bashrc')) != "")
|
||||||
|
|
||||||
if showhelp == "on" :
|
if showhelp == "on" :
|
||||||
tag = help(screen, size, config)
|
tag = help(screen, size, config)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue