Merged in oblogout-distutils r58-r68.
@@ -6,3 +6,4 @@ debian/oblogout
|
|||||||
debian/*.log
|
debian/*.log
|
||||||
debian/oblogout.*
|
debian/oblogout.*
|
||||||
debian/files
|
debian/files
|
||||||
|
python-build-stamp-2.5
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ import sys
|
|||||||
import getopt
|
import getopt
|
||||||
import logging
|
import logging
|
||||||
import logging.handlers
|
import logging.handlers
|
||||||
from openboxlogout import openboxlogout
|
from oblogout import oblogout
|
||||||
|
|
||||||
class Usage(Exception):
|
class Usage(Exception):
|
||||||
def __init__(self, msg):
|
def __init__(self, msg):
|
||||||
@@ -37,19 +37,21 @@ class Usage(Exception):
|
|||||||
def main(argv = None):
|
def main(argv = None):
|
||||||
|
|
||||||
# Start logger instace used by the OpenboxLogout class
|
# Start logger instace used by the OpenboxLogout class
|
||||||
logger = logging.getLogger('OpenboxLogout')
|
logger = logging.getLogger('oblogout')
|
||||||
logout = logging.StreamHandler(sys.stdout)
|
logout = logging.StreamHandler(sys.stdout)
|
||||||
logout.setFormatter(logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s"))
|
logout.setFormatter(logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s"))
|
||||||
logger.addHandler(logout)
|
logger.addHandler(logout)
|
||||||
|
|
||||||
verbose = None
|
verbose = None
|
||||||
config = None
|
config = None
|
||||||
|
local_mode = None
|
||||||
|
|
||||||
if argv is None:
|
if argv is None:
|
||||||
argv = sys.argv
|
argv = sys.argv
|
||||||
|
|
||||||
try:
|
try:
|
||||||
try:
|
try:
|
||||||
opts, args = getopt.getopt(argv[1:], "hvc:", ["help", "verbose", "config="])
|
opts, args = getopt.getopt(argv[1:], "hvc:l", ["help", "verbose", "config=", "local"])
|
||||||
except getopt.error, msg:
|
except getopt.error, msg:
|
||||||
raise Usage(msg)
|
raise Usage(msg)
|
||||||
# more code, unchanged
|
# more code, unchanged
|
||||||
@@ -66,10 +68,15 @@ def main(argv = None):
|
|||||||
verbose = True
|
verbose = True
|
||||||
elif o in ("-c", "--config"):
|
elif o in ("-c", "--config"):
|
||||||
config = a
|
config = a
|
||||||
|
elif o in ("-l", "--local"):
|
||||||
|
local_mode = True
|
||||||
|
|
||||||
if not config:
|
if not config:
|
||||||
config = '/etc/openbox-logout.conf'
|
if not local_mode:
|
||||||
|
config = '/etc/oblogout.conf'
|
||||||
|
else:
|
||||||
|
config = 'data/oblogout.conf'
|
||||||
|
|
||||||
# Check config in local path, if it exists pass it on
|
# Check config in local path, if it exists pass it on
|
||||||
if not os.path.exists(config):
|
if not os.path.exists(config):
|
||||||
logger.error("Invalid config file: %s" % config)
|
logger.error("Invalid config file: %s" % config)
|
||||||
@@ -82,7 +89,7 @@ def main(argv = None):
|
|||||||
logger.setLevel(logging.INFO)
|
logger.setLevel(logging.INFO)
|
||||||
|
|
||||||
# Start the application
|
# Start the application
|
||||||
app = openboxlogout.OpenboxLogout(config)
|
app = oblogout.OpenboxLogout(config, local_mode)
|
||||||
app.run_logout()
|
app.run_logout()
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 3.0 KiB |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.7 KiB |
|
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.3 KiB |
|
Before Width: | Height: | Size: 813 B After Width: | Height: | Size: 813 B |
|
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 3.0 KiB |
|
Before Width: | Height: | Size: 9.2 KiB After Width: | Height: | Size: 9.2 KiB |
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 8.8 KiB After Width: | Height: | Size: 8.8 KiB |
0
openboxlogout/themes/default/restart.png → data/themes/oxygen/oblogout/restart.png
Executable file → Normal file
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
0
openboxlogout/themes/default/shutdown.png → data/themes/oxygen/oblogout/shutdown.png
Executable file → Normal file
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 9.6 KiB After Width: | Height: | Size: 9.6 KiB |
2
debian/control
vendored
@@ -2,7 +2,7 @@ Source: oblogout
|
|||||||
Section: misc
|
Section: misc
|
||||||
Priority: extra
|
Priority: extra
|
||||||
Maintainer: Andrew Williams <andy@tensixtyone.com>
|
Maintainer: Andrew Williams <andy@tensixtyone.com>
|
||||||
Build-Depends: cdbs, debhelper (>= 7), python-central (>= 0.5.6)
|
Build-Depends: cdbs, debhelper (>= 7), python-central (>= 0.5.6), python-distutils-extra
|
||||||
XS-Python-Version: >= 2.5
|
XS-Python-Version: >= 2.5
|
||||||
Standards-Version: 3.7.3
|
Standards-Version: 3.7.3
|
||||||
Homepage: http://launchpad.net/oblogout/
|
Homepage: http://launchpad.net/oblogout/
|
||||||
|
|||||||
3
oblogout-dev.sh
Executable file
@@ -0,0 +1,3 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
OBLOGOUT_PATH=`dirname $0`
|
||||||
|
PYTHONPATH="$PYTHONPATH:$OBLOGOUT_PATH" python $OBLOGOUT_PATH/data/oblogout -l $*
|
||||||
@@ -56,11 +56,20 @@ except:
|
|||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
class OpenboxLogout():
|
class OpenboxLogout():
|
||||||
def __init__(self, config=None):
|
def __init__(self, config=None, local=None):
|
||||||
|
|
||||||
|
if local:
|
||||||
|
self.local_mode = True
|
||||||
|
else:
|
||||||
|
self.local_mode = False
|
||||||
|
|
||||||
# Start logger and gettext/i18n
|
# Start logger and gettext/i18n
|
||||||
self.logger = logging.getLogger('OpenboxLogout')
|
self.logger = logging.getLogger('oblogout')
|
||||||
gettext.install('oblogout', '%s/locale' % self.determine_path(), unicode=1)
|
|
||||||
|
if self.local_mode:
|
||||||
|
gettext.install('oblogout', 'mo', unicode=1)
|
||||||
|
else:
|
||||||
|
gettext.install('oblogout', '%s/share/locale' % sys.prefix, unicode=1)
|
||||||
|
|
||||||
# Start dbus interface
|
# Start dbus interface
|
||||||
bus = dbus.SystemBus()
|
bus = dbus.SystemBus()
|
||||||
@@ -151,9 +160,7 @@ class OpenboxLogout():
|
|||||||
self.window.set_app_paintable(True)
|
self.window.set_app_paintable(True)
|
||||||
self.window.resize(gtk.gdk.screen_width(), gtk.gdk.screen_height())
|
self.window.resize(gtk.gdk.screen_width(), gtk.gdk.screen_height())
|
||||||
self.window.realize()
|
self.window.realize()
|
||||||
|
|
||||||
print self.buttonpanel.get_allocation().width
|
|
||||||
|
|
||||||
if pixmap:
|
if pixmap:
|
||||||
self.window.window.set_back_pixmap(pixmap, False)
|
self.window.window.set_back_pixmap(pixmap, False)
|
||||||
self.window.move(0,0)
|
self.window.move(0,0)
|
||||||
@@ -174,7 +181,10 @@ class OpenboxLogout():
|
|||||||
""" Load the configuration file and parse entries, when encountering a issue
|
""" Load the configuration file and parse entries, when encountering a issue
|
||||||
change safe defaults """
|
change safe defaults """
|
||||||
|
|
||||||
self.img_path = "%s/themes" % self.determine_path()
|
if self.local_mode:
|
||||||
|
self.img_path = "data/themes"
|
||||||
|
else:
|
||||||
|
self.img_path = "%s/share/themes" % sys.prefix
|
||||||
|
|
||||||
self.parser = ConfigParser.SafeConfigParser()
|
self.parser = ConfigParser.SafeConfigParser()
|
||||||
self.parser.read(config)
|
self.parser.read(config)
|
||||||
@@ -213,9 +223,9 @@ class OpenboxLogout():
|
|||||||
self.img_path = "%s/.themes/%s/oblogout" % (os.environ['HOME'], self.button_theme)
|
self.img_path = "%s/.themes/%s/oblogout" % (os.environ['HOME'], self.button_theme)
|
||||||
self.logger.info("Using user theme at %s" % self.img_path)
|
self.logger.info("Using user theme at %s" % self.img_path)
|
||||||
else:
|
else:
|
||||||
if not os.path.exists('%s/%s/' % (self.img_path, self.button_theme)):
|
if not os.path.exists('%s/%s/oblogout/' % (self.img_path, self.button_theme)):
|
||||||
self.logger.warning("Button theme %s not found, reverting to default" % self.button_theme)
|
self.logger.warning("Button theme %s not found, reverting to default" % self.button_theme)
|
||||||
self.button_theme = 'default'
|
self.button_theme = 'foom'
|
||||||
|
|
||||||
|
|
||||||
# Load and parse button list
|
# Load and parse button list
|
||||||
@@ -305,7 +315,7 @@ class OpenboxLogout():
|
|||||||
box = gtk.VBox()
|
box = gtk.VBox()
|
||||||
|
|
||||||
image = gtk.Image()
|
image = gtk.Image()
|
||||||
image.set_from_file("%s/%s/%s.png" % (self.img_path, self.button_theme, name))
|
image.set_from_file("%s/%s/oblogout/%s.png" % (self.img_path, self.button_theme, name))
|
||||||
image.show()
|
image.show()
|
||||||
|
|
||||||
button = gtk.Button()
|
button = gtk.Button()
|
||||||
@@ -1 +0,0 @@
|
|||||||
openboxlogout.py
|
|
||||||
|
Before Width: | Height: | Size: 3.9 KiB |
|
Before Width: | Height: | Size: 9.3 KiB |
|
Before Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 11 KiB |
2
po/POTFILES.in
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
oblogout/oblogout.py
|
||||||
|
data/oblogout
|
||||||
@@ -8,7 +8,7 @@ msgid ""
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: PACKAGE VERSION\n"
|
"Project-Id-Version: PACKAGE VERSION\n"
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"POT-Creation-Date: 2009-01-17 23:39+0000\n"
|
"POT-Creation-Date: 2009-01-28 18:30+0000\n"
|
||||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||||
@@ -16,77 +16,72 @@ msgstr ""
|
|||||||
"Content-Type: text/plain; charset=CHARSET\n"
|
"Content-Type: text/plain; charset=CHARSET\n"
|
||||||
"Content-Transfer-Encoding: 8bit\n"
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
|
|
||||||
#: openboxlogout.py:209
|
#: ../oblogout/oblogout.py:88
|
||||||
#, python-format
|
msgid "Openbox Logout"
|
||||||
msgid "Button %s is not a valid button name, removing"
|
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: openboxlogout.py:218
|
#: ../oblogout/oblogout.py:178
|
||||||
msgid "Can't Hibernate, disabling button"
|
msgid "Unable to determin the module path, exiting..."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: openboxlogout.py:222
|
#: ../oblogout/oblogout.py:213
|
||||||
msgid "Can't Safe Suspend, disabling button"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: openboxlogout.py:214
|
|
||||||
msgid "Can't Suspend, disabling button"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: openboxlogout.py:187
|
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "Color %s is not a valid color, defaulting to black"
|
msgid "Color %s is not a valid color, defaulting to black"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: openboxlogout.py:226
|
#: ../oblogout/oblogout.py:235
|
||||||
msgid "No valid buttons found, resetting to defaults"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: openboxlogout.py:54
|
|
||||||
msgid "Openbox Logout"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: openboxlogout.py:142
|
|
||||||
msgid "Unable to determin the module path, exiting..."
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: openboxlogout.py:154
|
|
||||||
#, python-format
|
|
||||||
msgid "Unable to find config file %s"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: openboxlogout.py:192
|
|
||||||
msgid "cancel"
|
msgid "cancel"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: openboxlogout.py:192
|
#: ../oblogout/oblogout.py:235
|
||||||
msgid "hibernate"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: openboxlogout.py:192
|
|
||||||
msgid "lock"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: openboxlogout.py:192
|
|
||||||
msgid "logout"
|
msgid "logout"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: openboxlogout.py:192
|
#: ../oblogout/oblogout.py:235
|
||||||
msgid "restart"
|
msgid "restart"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: openboxlogout.py:192
|
#: ../oblogout/oblogout.py:235
|
||||||
msgid "safesuspend"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: openboxlogout.py:192
|
|
||||||
msgid "shutdown"
|
msgid "shutdown"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: openboxlogout.py:192
|
#: ../oblogout/oblogout.py:235
|
||||||
msgid "suspend"
|
msgid "suspend"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: openboxlogout.py:192
|
#: ../oblogout/oblogout.py:235
|
||||||
|
msgid "hibernate"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: ../oblogout/oblogout.py:235
|
||||||
|
msgid "safesuspend"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: ../oblogout/oblogout.py:235
|
||||||
|
msgid "lock"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: ../oblogout/oblogout.py:235
|
||||||
msgid "switch"
|
msgid "switch"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#: ../oblogout/oblogout.py:247
|
||||||
|
#, python-format
|
||||||
|
msgid "Button %s is not a valid button name, removing"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: ../oblogout/oblogout.py:252
|
||||||
|
msgid "Can't Suspend, disabling button"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: ../oblogout/oblogout.py:256
|
||||||
|
msgid "Can't Hibernate, disabling button"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: ../oblogout/oblogout.py:260
|
||||||
|
msgid "Can't Safe Suspend, disabling button"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: ../oblogout/oblogout.py:264
|
||||||
|
msgid "No valid buttons found, resetting to defaults"
|
||||||
|
msgstr ""
|
||||||
7
setup.cfg
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
[build]
|
||||||
|
icons=False
|
||||||
|
help=False
|
||||||
|
|
||||||
|
[build_i18n]
|
||||||
|
po-dir=po
|
||||||
|
|
||||||
86
setup.py
@@ -5,87 +5,25 @@ import os, sys, glob, fnmatch
|
|||||||
## Added 10 Jan 2008
|
## Added 10 Jan 2008
|
||||||
from distutils.core import setup, Extension
|
from distutils.core import setup, Extension
|
||||||
import distutils.command.install_data
|
import distutils.command.install_data
|
||||||
|
|
||||||
## Code borrowed from wxPython's setup and config files
|
|
||||||
## Thanks to Robin Dunn for the suggestion.
|
|
||||||
## I am not 100% sure what's going on, but it works!
|
|
||||||
def opj(*args):
|
|
||||||
path = os.path.join(*args)
|
|
||||||
return os.path.normpath(path)
|
|
||||||
|
|
||||||
## Added 10 Jan 2008
|
|
||||||
# Specializations of some distutils command classes
|
|
||||||
class wx_smart_install_data(distutils.command.install_data.install_data):
|
|
||||||
"""need to change self.install_dir to the actual library dir"""
|
|
||||||
def run(self):
|
|
||||||
install_cmd = self.get_finalized_command('install')
|
|
||||||
self.install_dir = getattr(install_cmd, 'install_lib')
|
|
||||||
return distutils.command.install_data.install_data.run(self)
|
|
||||||
|
|
||||||
def find_data_files(srcdir, *wildcards, **kw):
|
|
||||||
# get a list of all files under the srcdir matching wildcards,
|
|
||||||
# returned in a format to be used for install_data
|
|
||||||
def walk_helper(arg, dirname, files):
|
|
||||||
if '.svn' in dirname:
|
|
||||||
return
|
|
||||||
names = []
|
|
||||||
lst, wildcards = arg
|
|
||||||
for wc in wildcards:
|
|
||||||
wc_name = opj(dirname, wc)
|
|
||||||
for f in files:
|
|
||||||
filename = opj(dirname, f)
|
|
||||||
|
|
||||||
if fnmatch.fnmatch(filename, wc_name) and not os.path.isdir(filename):
|
|
||||||
names.append(filename)
|
|
||||||
if names:
|
|
||||||
lst.append( (dirname, names ) )
|
|
||||||
|
|
||||||
file_list = []
|
|
||||||
recursive = kw.get('recursive', True)
|
|
||||||
if recursive:
|
|
||||||
os.path.walk(srcdir, walk_helper, (file_list, wildcards))
|
|
||||||
else:
|
|
||||||
walk_helper((file_list, wildcards),
|
|
||||||
srcdir,
|
|
||||||
[os.path.basename(f) for f in glob.glob(opj(srcdir, '*'))])
|
|
||||||
return file_list
|
|
||||||
|
|
||||||
## This is a list of files to install, and where:
|
|
||||||
## Make sure the MANIFEST.in file points to all the right
|
|
||||||
## directories too.
|
|
||||||
files = find_data_files('openboxlogout/', '*.*')
|
|
||||||
|
|
||||||
# Extra entry for config file copied to /etc/
|
|
||||||
files.append(('/etc/', ['openbox-logout.conf']))
|
|
||||||
|
|
||||||
print files
|
|
||||||
|
|
||||||
from distutils.core import setup
|
from distutils.core import setup
|
||||||
|
from DistUtilsExtra.command import *
|
||||||
|
|
||||||
setup(name = "openboxlogout",
|
setup(name = "oblogout",
|
||||||
version = "0.2",
|
version = "0.2",
|
||||||
description = "Openbox Logout",
|
description = "Openbox Logout",
|
||||||
author = "Andrew Williams",
|
author = "Andrew Williams",
|
||||||
author_email = "andy@tensixtyone.com",
|
author_email = "andy@tensixtyone.com",
|
||||||
url = "http://bzr.tensixtyone.com/",
|
url = "http://launchpad.net/oblogout/",
|
||||||
#Name the folder where your packages live:
|
|
||||||
#(If you have other packages (dirs) or modules (py files) then
|
|
||||||
#put them into the package directory - they will be found
|
|
||||||
#recursively.)
|
|
||||||
packages = ['openboxlogout'],
|
|
||||||
|
|
||||||
data_files = files,
|
|
||||||
|
|
||||||
## Borrowed from wxPython too:
|
packages = ['oblogout'],
|
||||||
## Causes the data_files to be installed into the modules directory.
|
scripts = ["data/oblogout"],
|
||||||
## Override some of the default distutils command classes with my own.
|
data_files = [('share/themes/foom/oblogout', glob.glob('data/themes/foom/oblogout/*')),
|
||||||
cmdclass = { 'install_data': wx_smart_install_data },
|
('share/themes/oxygen/oblogout', glob.glob('data/themes/oxygen/oblogout/*')),
|
||||||
|
('/etc/', glob.glob('data/openbox-logout.conf'))],
|
||||||
|
|
||||||
|
cmdclass = { 'build' : build_extra.build_extra,
|
||||||
|
'build_i18n' : build_i18n.build_i18n },
|
||||||
|
|
||||||
|
|
||||||
#'runner' is in the root.
|
long_description = """Really long text here."""
|
||||||
scripts = ["oblogout"],
|
|
||||||
long_description = """Really long text here."""
|
|
||||||
#
|
|
||||||
#This next part it for the Cheese Shop, look a little down the page.
|
|
||||||
#classifiers = []
|
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,10 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
cd openboxlogout/
|
|
||||||
|
|
||||||
for file in ./pofiles/*.po; do
|
|
||||||
lang=`echo $file | cut -d "-" -f 2 - | cut -d "." -f 1`
|
|
||||||
|
|
||||||
mkdir -p locale/$lang/LC_MESSAGES
|
|
||||||
msgfmt --output-file="locale/$lang/LC_MESSAGES/oblogout.mo" "$file"
|
|
||||||
done
|
|
||||||