diff options
author | Jon Lund Steffensen <jonlst@gmail.com> | 2010-02-11 22:06:12 +0100 |
---|---|---|
committer | Jon Lund Steffensen <jonlst@gmail.com> | 2010-02-11 22:06:12 +0100 |
commit | 739f806f195a9b6a699cd4c821f321970a916645 (patch) | |
tree | 3fc51094b6d67cca764e9de638de778e5ad9aa76 | |
parent | Update translations. (diff) | |
download | redshift-ng-739f806f195a9b6a699cd4c821f321970a916645.tar.gz redshift-ng-739f806f195a9b6a699cd4c821f321970a916645.tar.bz2 redshift-ng-739f806f195a9b6a699cd4c821f321970a916645.tar.xz |
Turn gtk-redshift into a python module. A launcher script is installed
in bindir.
-rw-r--r-- | Makefile.am | 9 | ||||
-rw-r--r-- | configure.ac | 11 | ||||
-rw-r--r-- | po/POTFILES.in | 2 | ||||
-rw-r--r-- | src/gtk-redshift/__init__.py | 20 | ||||
-rw-r--r-- | src/gtk-redshift/gtk-redshift | 23 | ||||
-rw-r--r--[-rwxr-xr-x] | src/gtk-redshift/statusicon.py (renamed from src/gtk-redshift/gtk-redshift.py) | 6 |
6 files changed, 62 insertions, 9 deletions
diff --git a/Makefile.am b/Makefile.am index f492abe..e7ff3b9 100644 --- a/Makefile.am +++ b/Makefile.am @@ -40,8 +40,13 @@ endif # gtk-redshift Script if ENABLE_GTK -dist_bin_SCRIPTS = src/gtk-redshift/gtk-redshift.py -bin_SCRIPTS = src/gtk-redshift/defs.py +gtk_redshift_PYTHON = \ + src/gtk-redshift/__init__.py \ + src/gtk-redshift/statusicon.py \ + src/gtk-redshift/defs.py +gtk_redshiftdir = $(pythondir)/gtk_redshift + +dist_bin_SCRIPTS = src/gtk-redshift/gtk-redshift EXTRA_DIST += src/gtk-redshift/defs.py.in endif diff --git a/configure.ac b/configure.ac index 18e2855..5a743ac 100644 --- a/configure.ac +++ b/configure.ac @@ -78,10 +78,15 @@ AC_ARG_ENABLE([gtk], [AC_HELP_STRING([--enable-gtk], [enable GTK status icon])], [enable_gtk=$enableval],[enable_gtk=maybe]) AS_IF([test "x$enable_gtk" != xno], [ - AS_IF([test $have_python != yes], [ - AC_MSG_WARN([status icon script requires Python and PyGTK]) + AS_IF([test $have_python = yes], [ + AC_MSG_RESULT([yes]) + ], [ + AC_MSG_RESULT([missing dependencies]) + AS_IF([test "x$enable_gtk" = xyes], [ + AC_MSG_ERROR([status icon script requires Python 2.4]) + ]) + enable_gtk=no ]) - AC_MSG_RESULT([yes]) ], [ AC_MSG_RESULT([no]) ]) diff --git a/po/POTFILES.in b/po/POTFILES.in index ebb31b3..74ebfee 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -4,4 +4,4 @@ src/redshift.c src/randr.c src/vidmode.c -src/gtk-redshift/gtk-redshift.py +src/gtk-redshift/statusicon.py diff --git a/src/gtk-redshift/__init__.py b/src/gtk-redshift/__init__.py new file mode 100644 index 0000000..30205ca --- /dev/null +++ b/src/gtk-redshift/__init__.py @@ -0,0 +1,20 @@ +#!/usr/bin/env python +# __init__.py -- gtk-redshift package __init__ file +# This file is part of Redshift. + +# Redshift 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 3 of the License, or +# (at your option) any later version. + +# Redshift 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 Redshift. If not, see <http://www.gnu.org/licenses/>. + +# Copyright (c) 2010 Jon Lund Steffensen <jonlst@gmail.com> + +__all__ = ['statusicon'] diff --git a/src/gtk-redshift/gtk-redshift b/src/gtk-redshift/gtk-redshift new file mode 100644 index 0000000..f62c6f1 --- /dev/null +++ b/src/gtk-redshift/gtk-redshift @@ -0,0 +1,23 @@ +#!/usr/bin/env python +# gtk-redshift -- GTK+ Redshift launcher script +# This file is part of Redshift. + +# Redshift 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 3 of the License, or +# (at your option) any later version. + +# Redshift 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 Redshift. If not, see <http://www.gnu.org/licenses/>. + +# Copyright (c) 2010 Jon Lund Steffensen <jonlst@gmail.com> + + +if __name__ == '__main__': + from gtk_redshift.statusicon import run_statusicon + run_statusicon() diff --git a/src/gtk-redshift/gtk-redshift.py b/src/gtk-redshift/statusicon.py index a737154..ae05b5c 100755..100644 --- a/src/gtk-redshift/gtk-redshift.py +++ b/src/gtk-redshift/statusicon.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -# gtk-redshift -- GTK+ status icon source +# statusicon.py -- GTK+ status icon source # This file is part of Redshift. # Redshift is free software: you can redistribute it and/or modify @@ -18,7 +18,7 @@ # Copyright (c) 2010 Jon Lund Steffensen <jonlst@gmail.com> -import sys +import sys, os import subprocess, signal import gettext @@ -30,7 +30,7 @@ import gtk, glib import defs -if __name__ == '__main__': +def run_statusicon(): # Internationalisation gettext.bindtextdomain('redshift', defs.LOCALEDIR) gettext.textdomain('redshift') |