Add python support in autotools
authorJulien Lavergne <julien.lavergne@gmail.com>
Fri, 18 Jun 2010 18:56:00 +0000 (20:56 +0200)
committerJulien Lavergne <julien.lavergne@gmail.com>
Fri, 18 Jun 2010 18:56:00 +0000 (20:56 +0200)
20 files changed:
configure.ac
data/ui/Makefile.am
data/ui/Makefile.in [deleted file]
data/ui/about.glade.in [deleted file]
src/fontconfig/Makefile.am
src/keyboardconf/Makefile.am
src/keyboardconf/keyboardconf [deleted file]
src/keyboardconf/keyboardconf.py [new file with mode: 0755]
src/lxcc/Makefile.am
src/lxcc/lxcc [deleted file]
src/lxcc/lxcc.py [new file with mode: 0755]
src/lxdmconf/Makefile.am
src/lxdmconf/lxdmconf [deleted file]
src/lxdmconf/lxdmconf.py [new file with mode: 0644]
src/lxproxy/Makefile.am
src/openbox-keyconf/Makefile.am
src/openbox-keyconf/openbox-keyconf [deleted file]
src/openbox-keyconf/openbox-keyconf.py [new file with mode: 0755]
src/screenshot/Makefile.am
src/services/Makefile.am

index c0325de..b30e24b 100644 (file)
@@ -25,14 +25,17 @@ AC_HEADER_STDC
 # intltool
 IT_PROG_INTLTOOL([0.40.0])
 
+# Python support
+AM_PATH_PYTHON([2.4])
+
 # PKG_CHECK_MODULES(XLIB, "x11")
 # AC_SUBST(XLIB_CFLAGS)
 # AC_SUBST(XLIB_LIBS)
 
-pkg_modules="gtk+-2.0 >= 2.12.0"
-PKG_CHECK_MODULES(GTK, [$pkg_modules])
-AC_SUBST(GTK_CFLAGS)
-AC_SUBST(GTK_LIBS)
+pkg_modules="gtk+-2.0 >= 2.12.0"
+PKG_CHECK_MODULES(GTK, [$pkg_modules])
+AC_SUBST(GTK_CFLAGS)
+AC_SUBST(GTK_LIBS)
 
 # gio_modules="gthread-2.0 gio-unix-2.0 glib-2.0 >= 2.18.0"
 # PKG_CHECK_MODULES(GIO, [$gio_modules])
@@ -75,11 +78,20 @@ AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Gettext package.])
 
 AC_CONFIG_FILES([
     Makefile
-    src/Makefile
     data/Makefile
     data/ui/Makefile
-    data/ui/about.glade
+    data/ui/media/Makefile
+    data/ui/lxproxy/Makefile
     po/Makefile.in
+    src/Makefile
+    src/fontconfig/Makefile
+    src/keyboardconf/Makefile
+    src/lxcc/Makefile
+    src/lxdmconf/Makefile
+    src/lxproxy/Makefile
+    src/openbox-keyconf/Makefile
+    src/screenshot/Makefile
+    src/services/Makefile
 ])
 
 AC_OUTPUT
index d13b02a..685e0e9 100644 (file)
@@ -1,21 +1,21 @@
 NULL=
 
 # GtkBuilder UI definition files
-uidir=$(datadir)/lxadmin/ui
-ui_in_files= \
-       about.glade \
-       $(NULL)
-ui_DATA = $(ui_in_files:.glade=.ui)
-
-CLEANFILES = \
-       $(ui_DATA) \
-       $(NULL)
+uidir=$(datadir)/lxadmin/ui
+#ui_in_files= \
+#      about.glade \
+#      $(NULL)
+ui_DATA = $(ui_in_files:.glade=.ui)
+#
+CLEANFILES = \
+#      $(ui_DATA) \
+#      $(NULL)
 
 # Purge GtkBuilder UI files
-%.ui: %.glade
-       cp $< $@
-       $(top_srcdir)/src/xml-purge $@
+%.ui: %.glade
+#      cp $< $@
+#      $(top_srcdir)/src/xml-purge $@
 
-EXTRA_DIST= \
-       $(ui_DATA) \
-       $(NULL)
+EXTRA_DIST= \
+#      $(ui_DATA) \
+#      $(NULL)
diff --git a/data/ui/Makefile.in b/data/ui/Makefile.in
deleted file mode 100644 (file)
index aff07e8..0000000
+++ /dev/null
@@ -1,413 +0,0 @@
-# Makefile.in generated by automake 1.11.1 from Makefile.am.
-# @configure_input@
-
-# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
-# Inc.
-# This Makefile.in is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
-# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-# PARTICULAR PURPOSE.
-
-@SET_MAKE@
-
-VPATH = @srcdir@
-pkgdatadir = $(datadir)/@PACKAGE@
-pkgincludedir = $(includedir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
-pkglibexecdir = $(libexecdir)/@PACKAGE@
-am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
-install_sh_DATA = $(install_sh) -c -m 644
-install_sh_PROGRAM = $(install_sh) -c
-install_sh_SCRIPT = $(install_sh) -c
-INSTALL_HEADER = $(INSTALL_DATA)
-transform = $(program_transform_name)
-NORMAL_INSTALL = :
-PRE_INSTALL = :
-POST_INSTALL = :
-NORMAL_UNINSTALL = :
-PRE_UNINSTALL = :
-POST_UNINSTALL = :
-subdir = data/ui
-DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
-       $(srcdir)/about.glade.in
-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/configure.ac
-am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
-       $(ACLOCAL_M4)
-mkinstalldirs = $(install_sh) -d
-CONFIG_HEADER = $(top_builddir)/config.h
-CONFIG_CLEAN_FILES = about.glade
-CONFIG_CLEAN_VPATH_FILES =
-SOURCES =
-DIST_SOURCES =
-am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
-am__vpath_adj = case $$p in \
-    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
-    *) f=$$p;; \
-  esac;
-am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
-am__install_max = 40
-am__nobase_strip_setup = \
-  srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
-am__nobase_strip = \
-  for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
-am__nobase_list = $(am__nobase_strip_setup); \
-  for p in $$list; do echo "$$p $$p"; done | \
-  sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
-  $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
-    if (++n[$$2] == $(am__install_max)) \
-      { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
-    END { for (dir in files) print dir, files[dir] }'
-am__base_list = \
-  sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
-  sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
-am__installdirs = "$(DESTDIR)$(uidir)"
-DATA = $(ui_DATA)
-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-ACLOCAL = @ACLOCAL@
-ALL_LINGUAS = @ALL_LINGUAS@
-AMTAR = @AMTAR@
-AUTOCONF = @AUTOCONF@
-AUTOHEADER = @AUTOHEADER@
-AUTOMAKE = @AUTOMAKE@
-AWK = @AWK@
-CATALOGS = @CATALOGS@
-CATOBJEXT = @CATOBJEXT@
-CC = @CC@
-CCDEPMODE = @CCDEPMODE@
-CFLAGS = @CFLAGS@
-CPP = @CPP@
-CPPFLAGS = @CPPFLAGS@
-CYGPATH_W = @CYGPATH_W@
-DATADIRNAME = @DATADIRNAME@
-DEFS = @DEFS@
-DEPDIR = @DEPDIR@
-ECHO_C = @ECHO_C@
-ECHO_N = @ECHO_N@
-ECHO_T = @ECHO_T@
-EGREP = @EGREP@
-EXEEXT = @EXEEXT@
-GETTEXT_PACKAGE = @GETTEXT_PACKAGE@
-GMOFILES = @GMOFILES@
-GMSGFMT = @GMSGFMT@
-GREP = @GREP@
-GTK_CFLAGS = @GTK_CFLAGS@
-GTK_LIBS = @GTK_LIBS@
-INSTALL = @INSTALL@
-INSTALL_DATA = @INSTALL_DATA@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_SCRIPT = @INSTALL_SCRIPT@
-INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
-INSTOBJEXT = @INSTOBJEXT@
-INTLLIBS = @INTLLIBS@
-INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@
-INTLTOOL_MERGE = @INTLTOOL_MERGE@
-INTLTOOL_PERL = @INTLTOOL_PERL@
-INTLTOOL_UPDATE = @INTLTOOL_UPDATE@
-LDFLAGS = @LDFLAGS@
-LIBOBJS = @LIBOBJS@
-LIBS = @LIBS@
-LTLIBOBJS = @LTLIBOBJS@
-MAKEINFO = @MAKEINFO@
-MKDIR_P = @MKDIR_P@
-MKINSTALLDIRS = @MKINSTALLDIRS@
-MSGFMT = @MSGFMT@
-MSGFMT_OPTS = @MSGFMT_OPTS@
-MSGMERGE = @MSGMERGE@
-OBJEXT = @OBJEXT@
-PACKAGE = @PACKAGE@
-PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
-PACKAGE_NAME = @PACKAGE_NAME@
-PACKAGE_STRING = @PACKAGE_STRING@
-PACKAGE_TARNAME = @PACKAGE_TARNAME@
-PACKAGE_URL = @PACKAGE_URL@
-PACKAGE_VERSION = @PACKAGE_VERSION@
-PATH_SEPARATOR = @PATH_SEPARATOR@
-PKG_CONFIG = @PKG_CONFIG@
-POFILES = @POFILES@
-POSUB = @POSUB@
-PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@
-PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@
-SET_MAKE = @SET_MAKE@
-SHELL = @SHELL@
-STRIP = @STRIP@
-USE_NLS = @USE_NLS@
-VERSION = @VERSION@
-XGETTEXT = @XGETTEXT@
-abs_builddir = @abs_builddir@
-abs_srcdir = @abs_srcdir@
-abs_top_builddir = @abs_top_builddir@
-abs_top_srcdir = @abs_top_srcdir@
-ac_ct_CC = @ac_ct_CC@
-am__include = @am__include@
-am__leading_dot = @am__leading_dot@
-am__quote = @am__quote@
-am__tar = @am__tar@
-am__untar = @am__untar@
-bindir = @bindir@
-build_alias = @build_alias@
-builddir = @builddir@
-datadir = @datadir@
-datarootdir = @datarootdir@
-docdir = @docdir@
-dvidir = @dvidir@
-exec_prefix = @exec_prefix@
-host_alias = @host_alias@
-htmldir = @htmldir@
-includedir = @includedir@
-infodir = @infodir@
-install_sh = @install_sh@
-libdir = @libdir@
-libexecdir = @libexecdir@
-localedir = @localedir@
-localstatedir = @localstatedir@
-mandir = @mandir@
-mkdir_p = @mkdir_p@
-oldincludedir = @oldincludedir@
-pdfdir = @pdfdir@
-prefix = @prefix@
-program_transform_name = @program_transform_name@
-psdir = @psdir@
-sbindir = @sbindir@
-sharedstatedir = @sharedstatedir@
-srcdir = @srcdir@
-sysconfdir = @sysconfdir@
-target_alias = @target_alias@
-top_build_prefix = @top_build_prefix@
-top_builddir = @top_builddir@
-top_srcdir = @top_srcdir@
-NULL = 
-
-# GtkBuilder UI definition files
-uidir = $(datadir)/lxadmin/ui
-ui_in_files = \
-       about.glade \
-       $(NULL)
-
-ui_DATA = $(ui_in_files:.glade=.ui)
-CLEANFILES = \
-       $(ui_DATA) \
-       $(NULL)
-
-EXTRA_DIST = \
-       $(ui_DATA) \
-       $(NULL)
-
-all: all-am
-
-.SUFFIXES:
-$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
-       @for dep in $?; do \
-         case '$(am__configure_deps)' in \
-           *$$dep*) \
-             ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
-               && { if test -f $@; then exit 0; else break; fi; }; \
-             exit 1;; \
-         esac; \
-       done; \
-       echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign data/ui/Makefile'; \
-       $(am__cd) $(top_srcdir) && \
-         $(AUTOMAKE) --foreign data/ui/Makefile
-.PRECIOUS: Makefile
-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
-       @case '$?' in \
-         *config.status*) \
-           cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
-         *) \
-           echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
-           cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
-       esac;
-
-$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
-       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-
-$(top_srcdir)/configure:  $(am__configure_deps)
-       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
-       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(am__aclocal_m4_deps):
-about.glade: $(top_builddir)/config.status $(srcdir)/about.glade.in
-       cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
-install-uiDATA: $(ui_DATA)
-       @$(NORMAL_INSTALL)
-       test -z "$(uidir)" || $(MKDIR_P) "$(DESTDIR)$(uidir)"
-       @list='$(ui_DATA)'; test -n "$(uidir)" || list=; \
-       for p in $$list; do \
-         if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
-         echo "$$d$$p"; \
-       done | $(am__base_list) | \
-       while read files; do \
-         echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(uidir)'"; \
-         $(INSTALL_DATA) $$files "$(DESTDIR)$(uidir)" || exit $$?; \
-       done
-
-uninstall-uiDATA:
-       @$(NORMAL_UNINSTALL)
-       @list='$(ui_DATA)'; test -n "$(uidir)" || list=; \
-       files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
-       test -n "$$files" || exit 0; \
-       echo " ( cd '$(DESTDIR)$(uidir)' && rm -f" $$files ")"; \
-       cd "$(DESTDIR)$(uidir)" && rm -f $$files
-tags: TAGS
-TAGS:
-
-ctags: CTAGS
-CTAGS:
-
-
-distdir: $(DISTFILES)
-       @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
-       topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
-       list='$(DISTFILES)'; \
-         dist_files=`for file in $$list; do echo $$file; done | \
-         sed -e "s|^$$srcdirstrip/||;t" \
-             -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
-       case $$dist_files in \
-         */*) $(MKDIR_P) `echo "$$dist_files" | \
-                          sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
-                          sort -u` ;; \
-       esac; \
-       for file in $$dist_files; do \
-         if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
-         if test -d $$d/$$file; then \
-           dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
-           if test -d "$(distdir)/$$file"; then \
-             find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
-           fi; \
-           if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
-             cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
-             find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
-           fi; \
-           cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
-         else \
-           test -f "$(distdir)/$$file" \
-           || cp -p $$d/$$file "$(distdir)/$$file" \
-           || exit 1; \
-         fi; \
-       done
-check-am: all-am
-check: check-am
-all-am: Makefile $(DATA)
-installdirs:
-       for dir in "$(DESTDIR)$(uidir)"; do \
-         test -z "$$dir" || $(MKDIR_P) "$$dir"; \
-       done
-install: install-am
-install-exec: install-exec-am
-install-data: install-data-am
-uninstall: uninstall-am
-
-install-am: all-am
-       @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
-
-installcheck: installcheck-am
-install-strip:
-       $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-         install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-         `test -z '$(STRIP)' || \
-           echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
-mostlyclean-generic:
-
-clean-generic:
-       -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
-
-distclean-generic:
-       -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-       -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
-
-maintainer-clean-generic:
-       @echo "This command is intended for maintainers to use"
-       @echo "it deletes files that may require special tools to rebuild."
-clean: clean-am
-
-clean-am: clean-generic mostlyclean-am
-
-distclean: distclean-am
-       -rm -f Makefile
-distclean-am: clean-am distclean-generic
-
-dvi: dvi-am
-
-dvi-am:
-
-html: html-am
-
-html-am:
-
-info: info-am
-
-info-am:
-
-install-data-am: install-uiDATA
-
-install-dvi: install-dvi-am
-
-install-dvi-am:
-
-install-exec-am:
-
-install-html: install-html-am
-
-install-html-am:
-
-install-info: install-info-am
-
-install-info-am:
-
-install-man:
-
-install-pdf: install-pdf-am
-
-install-pdf-am:
-
-install-ps: install-ps-am
-
-install-ps-am:
-
-installcheck-am:
-
-maintainer-clean: maintainer-clean-am
-       -rm -f Makefile
-maintainer-clean-am: distclean-am maintainer-clean-generic
-
-mostlyclean: mostlyclean-am
-
-mostlyclean-am: mostlyclean-generic
-
-pdf: pdf-am
-
-pdf-am:
-
-ps: ps-am
-
-ps-am:
-
-uninstall-am: uninstall-uiDATA
-
-.MAKE: install-am install-strip
-
-.PHONY: all all-am check check-am clean clean-generic distclean \
-       distclean-generic distdir dvi dvi-am html html-am info info-am \
-       install install-am install-data install-data-am install-dvi \
-       install-dvi-am install-exec install-exec-am install-html \
-       install-html-am install-info install-info-am install-man \
-       install-pdf install-pdf-am install-ps install-ps-am \
-       install-strip install-uiDATA installcheck installcheck-am \
-       installdirs maintainer-clean maintainer-clean-generic \
-       mostlyclean mostlyclean-generic pdf pdf-am ps ps-am uninstall \
-       uninstall-am uninstall-uiDATA
-
-
-# Purge GtkBuilder UI files
-%.ui: %.glade
-       cp $< $@
-       $(top_srcdir)/src/xml-purge $@
-
-# Tell versions [3.59,3.63) of GNU make to not export all variables.
-# Otherwise a system limit (for SysV at least) may be exceeded.
-.NOEXPORT:
diff --git a/data/ui/about.glade.in b/data/ui/about.glade.in
deleted file mode 100644 (file)
index ef2184e..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-<?xml version="1.0"?>
-<interface>
-  <!-- interface-requires gtk+ 2.12 -->
-  <!-- interface-naming-policy toplevel-contextual -->
-  <object class="GtkAboutDialog" id="dlg">
-    <property name="border_width">5</property>
-    <property name="window_position">center-on-parent</property>
-    <property name="type_hint">dialog</property>
-    <property name="has_separator">False</property>
-    <property name="program_name">LXAdmin</property>
-    <property name="version">@VERSION@</property>
-    <property name="copyright" translatable="yes">Copyright (C) 2010</property>
-    <property name="comments" translatable="yes">LXAdmin Description</property>
-    <property name="website">http://lxde.org/</property>
-    <property name="license">Copyright (C) 2010 LXDE Team
-
-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.</property>
-    <property name="authors">LXDE Team</property>
-    <property name="translator_credits" translatable="yes" comments="Please replace this line with your own names, one name per line. ">translator-credits</property>
-    <property name="artists"></property>
-    <property name="wrap_license">True</property>
-    <child internal-child="vbox">
-      <object class="GtkVBox" id="dialog-vbox1">
-        <property name="visible">True</property>
-        <property name="orientation">vertical</property>
-        <property name="spacing">2</property>
-        <child internal-child="action_area">
-          <object class="GtkHButtonBox" id="dialog-action_area1">
-            <property name="visible">True</property>
-            <property name="layout_style">end</property>
-          </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="pack_type">end</property>
-            <property name="position">0</property>
-          </packing>
-        </child>
-      </object>
-    </child>
-  </object>
-</interface>
index b21981d..8e3b547 100644 (file)
@@ -2,5 +2,12 @@ NULL=
 
 SUBDIRS=
 
-EXTRA_DIST = \
+bin_SCRIPTS = fontconfig.py
+
+fontconfigdir = $(prefix)/bin
+
+DISTCLEANFILES = $(bin_SCRIPTS)         
+
+EXTRA_DIST =  \
+    $(bin_SCRIPTS) \
        $(NULL)
index b21981d..8ba504e 100644 (file)
@@ -2,5 +2,12 @@ NULL=
 
 SUBDIRS=
 
-EXTRA_DIST = \
+bin_SCRIPTS = keyboardconf.py
+
+keyboardconfdir = $(prefix)/bin
+
+DISTCLEANFILES = $(bin_SCRIPTS)         
+
+EXTRA_DIST =  \
+    $(bin_SCRIPTS) \
        $(NULL)
diff --git a/src/keyboardconf/keyboardconf b/src/keyboardconf/keyboardconf
deleted file mode 100755 (executable)
index fb91bcf..0000000
+++ /dev/null
@@ -1,519 +0,0 @@
-#!/usr/bin/python
-# -*- coding: UTF-8 -*-
-#**************************************************************************
-#                                                                         *
-#   Copyright (c) 2009 by Elfriede Apfelkuchen                            *
-#                                                                         *
-#   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 3 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, see <http://www.gnu.org/licenses/>. *
-#                                                                         *
-#**************************************************************************
-import locale
-locale.setlocale(locale.LC_ALL, '')          #set locale from 'LANG'
-Xcodec=locale.getpreferredencoding(False)
-import os
-import sys
-import string
-import time
-import codecs
-import pygtk
-pygtk.require('2.0')
-import gtk
-import pango
-import gc
-
-sprachen={}
-sprachen['al']='Albanian'
-sprachen['ar']='Arabic'
-sprachen['am']='Armenian'
-sprachen['az']='Azerbaijani'
-sprachen['by']='Belarusian'
-sprachen['be']='Belgian'
-sprachen['ben']='Bengali'
-sprachen['bs']='Bosnian'
-sprachen['br']='Brazilian'
-sprachen['bg']='Bulgarian'
-sprachen['mm']='Burmese'
-sprachen['ca']='Canadian'
-#  sprachen['ca_enhanced']='French Canadian'
-sprachen['cn']='Chinese'
-sprachen['hr']='Croatian'
-#  sprachen['hr_US']='Croatian (US)'
-sprachen['cz']='Czech'
-sprachen['cz_qwerty']='Czech (qwerty)'
-sprachen['dk']='Danish'
-sprachen['nl']='Dutch'
-sprachen['dvorak']='Dvorak'
-sprachen['ee']='Estonian'
-sprachen['fi']='Finnish'
-sprachen['fr']='French'
-sprachen['ge']='Georgian'
-#  sprachen['ge_la']='Georgian (latin)'
-#  sprachen['ge_ru']='Georgian (russian)'
-sprachen['de']='German'
-sprachen['el']='Greek'
-sprachen['guj']='Gujarati'
-sprachen['gur']='Gurmukhi'
-sprachen['dev']='Hindi'
-sprachen['hu']='Hungarian'
-#  sprachen['hu_US']='Hungarian (US)'
-#  sprachen['hu_qwerty']='Hungarian (qwerty)'
-sprachen['is']='Icelandic'
-sprachen['iu']='Inuktitut'
-sprachen['ir']='Iranian'
-sprachen['iq']='Iraq'
-sprachen['ie']='Irish'
-sprachen['il']='Israeli'
-#  sprachen['il_phonetic']='Israeli (phonetic)'
-sprachen['it']='Italian'
-sprachen['jp']='Japanese'
-sprachen['kan']='Kannada'
-sprachen['lo']='Lao'
-sprachen['la']='Latin America'
-sprachen['lt']='Lithuanian'
-#  sprachen['lt_std']='Lithuanian azerty standard'
-sprachen['lv']='Latvian'
-sprachen['mk']='Macedonian'
-sprachen['ml']='Malayalam'
-sprachen['mt']='Maltese'
-# sprachen['mt_us']='Maltese (US layout)'
-sprachen['ma']='Morocco'
-sprachen['nl']='Netherlands'
-sprachen['mn']='Mongolian'
-sprachen['no']='Norwegian'
-sprachen['ogham']='Ogham'
-#  sprachen['ori']='Oriya'
-sprachen['pl']='Polish'
-#  sprachen['pl2']='Polish (qwertz)'
-sprachen['pt']='Portuguese'
-sprachen['ro']='Romanian'
-sprachen['ru']='Russian'
-#  sprachen['ru_yawerty']='Russian (cyrillic phonetic)'
-#  sprachen['se_FI']='Northern Saami (Finland)'
-#  sprachen['se_NO']='Northern Saami (Norway)'
-#  sprachen['se_SE']='Northern Saami (Sweden)'
-sprachen['sr']='Serbian'
-sprachen['si']='Slovenian'
-sprachen['sk']='Slovak'
-sprachen['kr']='South Korea'
-#  sprachen['sk_qwerty']='Slovak (qwerty)'
-sprachen['es']='Spanish'
-sprachen['se']='Swedish'
-sprachen['ch']='Swiss'
-#  sprachen['fr_CH']='Swiss French'
-#  sprachen['de_CH']='Swiss German'
-sprachen['sy']='Syria'
-sprachen['syr']='Syriac'
-sprachen['tj']='Tajik'
-sprachen['tml']='Tamil'
-sprachen['tel']='Telugu'
-sprachen['th']='Thai (Kedmanee)'
-#  sprachen['th_tis']='Thai (TIS-820.2538)'
-#  sprachen['th_pat']='Thai (Pattachote)'
-sprachen['tr']='Turkish' 
-#  sprachen['tr_f']='Turkish (F)'
-sprachen['us']='U.S. English'
-sprachen['en_US']='U.S. English w/ ISO9995-3'
-sprachen['us_intl']='U.S. English w/ deadkeys'
-sprachen['ua']='Ukrainian' 
-sprachen['gb']='United Kingdom'
-sprachen['vn']='Vietnamese'
-#  sprachen['yu']='Yugoslavian'
-
-
-garnix=[
-"2 2 2 1",
-"a c None",
-"b c #ffffff",
-"aa",
-"aa"]
-
-
-rot=[
-"16 16 4 1",
-". c #000000",
-"# c #ff4040",
-"a c None",
-"b c #ffffff",
-"aaaaa......aaaaa",
-"aaa........bbaaa",
-"aa...######bbbaa",
-"a..##########bba",
-"a..###bbb####bba",
-"..###bbb######bb",
-"..##bb########bb",
-"..##bb########bb",
-"..##b#########bb",
-"..############bb",
-"..############bb",
-"a..##########bba",
-"a..##########bba",
-"aa...######bbbaa",
-"aaa..bbbbbbbbaaa",
-"aaaaabbbbbbaaaaa"]
-
-gruen=[
-"16 16 4 1",
-". c #000000",
-"# c #00ff00",
-"a c None",
-"b c #ffffff",
-"aaaaa......aaaaa",
-"aaa........bbaaa",
-"aa...######bbbaa",
-"a..##########bba",
-"a..###bbb####bba",
-"..###bbb######bb",
-"..##bb########bb",
-"..##bb########bb",
-"..##b#########bb",
-"..############bb",
-"..############bb",
-"a..##########bba",
-"a..##########bba",
-"aa...######bbbaa",
-"aaa..bbbbbbbbaaa",
-"aaaaabbbbbbaaaaa"]
-
-
-
-I18N={}
-
-def i18n(text):
-    if I18N_ready:
-       if I18N.has_key(text): return I18N[text]
-       else: return text
-    else: return text
-
-def load_i18n(filename):
-     #lädt Internationalisierung.moo file
-     ready=False
-     lang=os.getenv('LANG')
-     if not lang: return ready
-     lang2='/usr/share/locale/'+lang[0:2] +'/LC_MESSAGES/'+filename
-     lang3='/usr/share/locale/'+lang[0:5] +'/LC_MESSAGES/'+filename
-     lang='no file'
-     if   os.access(lang3,os.R_OK): lang=lang3
-     elif os.access(lang2,os.R_OK): lang=lang2
-     if lang != 'no file':
-        f=codecs.open(lang,'r','utf_8')
-        if f:
-           lang=f.readlines()
-           f.close()
-           ready=True
-           for z in lang:
-               s=z.replace('\n','').split('=')
-               if s[0]=='': continue
-               I18N[s[0]]=s[1]
-     return ready
-
-
-def melke_xorg(langy):
-    #extrahiere keyboard varianten aus xorg fuer die angegebene Sprache
-    filename='/usr/share/X11/xkb/symbols/'+langy
-    try:
-       f=codecs.open(filename,'r','utf_8')
-       text=f.read()
-       f.close()
-    except:
-       text=[";standard"]
-       return text
-    text=text.split('\n')
-    key=-1
-    variants=[";standard"]
-    for line in text:
-        if line[0:11]=='xkb_symbols':
-           line2=line.split('"')
-           oldkey=key
-           key=line2[1]
-           if oldkey!=-1: variants.append(oldkey)
-           continue
-        if 'name[Group1]' in line:
-           line2=line.split('name[Group1]')
-           line3=line2[1].split('"')
-           if key!=-1: key=key+';'+line3[1]
-    if key!=-1: variants.append(key)  
-    return variants
-
-
-class startmenu:
-    def destroy(self, widget, data=None):
-        #wird beim beenden ausgeführt, oder Abbrechen wurde angeklickt
-        gtk.main_quit()
-
-
-    def save(self,data=None):
-        #Anwenden wurde angeklickt
-        Default=self.combobox.get_active_text()
-        text=Default[:]
-        for i in range(self.anzahl):
-            if self.liststore[i][0]==1:
-               text2=self.liststore[i][2]
-               if text2!=Default:
-                  text=text+','+text2
-        text+=' -variant '
-        for i in range(self.anzahl):          
-            if self.liststore[i][2]==Default: break
-        if self.liststore[i][2]==Default: text+=self.liststore[i][5]
-        for i in range(self.anzahl):
-            if self.liststore[i][0]==1:
-               text2=self.liststore[i][2]
-               if text2!=Default:
-                  text=text+','+self.liststore[i][5]
-
-        print "setxkbmap -model pc105 -layout",text
-        #Tastaturlayout wird umgeschaltet
-        os.system("setxkbmap -model pc105 -layout "+text)
-        os.system("lxpanelctl restart")
-        home=os.getenv('HOME')
-        namen = home + '/.language'
-        #save sprache in ~/.language
-        f=file(namen,'w')
-        if f:
-           f.write('%s' % text)
-           f.flush()
-           f.close()
-        #wenn Checkbox aktiviert ist, erzeuge xkeyboard.desktop in ~/.config/autostart
-        if self.xkeyboard.get_active():
-           os.system ('mkdir ~/.config/autostart 2>/dev/null')
-           f=file(home+'/.config/autostart/xkeyboard.desktop','w')
-           if f:
-              f.write('\n[Desktop Entry]\n')
-              f.write('Encoding=UTF-8\n')
-              f.write('Version=0.9.4\n')
-              f.write('Type=Application\n')
-              f.write('Icon=input-keyboard\n')
-              f.write('Name=X.org-keyboard-layout\n')
-              f.write('Comment=set the language layout for the keyboard\n')
-              f.write('Exec=bash -c "setxkbmap -model 105 -layout `cat ~/.language`"\n')
-              f.write('StartupNotify=false\n')
-              f.write('Terminal=false\n')
-              f.write('Hidden=false\n')
-              f.close()
-        gtk.main_quit()
-
-
-    def variant_changed(self,data):
-        #Die keyboardvariante in der combobox wurde geändert
-        if self.lock: return
-        try:
-           model = self.variant.get_model()
-           index = self.variant.get_active()
-           variant=model[index][0]
-        except:
-           return
-        text=variant.split(';')
-        if self.active_language!=-1:
-           self.liststore[self.active_language][5]=text[0]
-
-
-    def row_activate(self, treeview, path, column):
-        #Doppelklick auf eine Sprache, aktualisiere default combobox mit Sprachen
-        name=self.liststore[path][2]
-        state=self.liststore[path][0]
-        if state==1:                          #Sprache wird entfernt
-           self.liststore[path][0]=0
-           self.liststore[path][1]=Soff
-           print name,"= 0"
-           for i in range(self.comboanzahl): self.combobox.remove_text(0)
-           self.comboanzahl=0
-           for i in range(self.anzahl):
-               if self.liststore[i][0]==1:
-                  self.comboanzahl+=1
-                  self.combobox.append_text(self.liststore[i][2])
-           self.combobox.set_active(0)
-        else:                                 #Sprache wird hinzugefügt
-           self.liststore[path][0]=1
-           self.liststore[path][1]=Son
-           print name,"= 1"
-           for i in range(self.comboanzahl): self.combobox.remove_text(0)
-           self.comboanzahl=0
-           for i in range(self.anzahl):
-               if self.liststore[i][0]==1:
-                  self.comboanzahl+=1
-                  self.combobox.append_text(self.liststore[i][2])
-           self.combobox.set_active(0)
-        gc.collect()
-
-
-    def mouse(self, widget, event, data=None):
-        if event.button==1:
-           #eine Sprache wurde angeklickt, setze Variant combobox
-           pathinfo=self.treeview.get_path_at_pos(int(event.x),int(event.y)) 
-           if pathinfo==None: return False
-           pathnr=pathinfo[0][0]  
-           name=self.liststore[pathnr][2]
-           self.lock=True
-           self.active_language=pathnr
-           for i in range(self.variantanzahl): self.variant.remove_text(0)
-           self.variantanzahl=0
-           variants=melke_xorg(name)
-           for line in variants: 
-               self.variant.append_text(line)
-               self.variantanzahl+=1
-           self.lock=False
-
-
-    def __init__(self):
-        home=os.getenv('HOME')
-        lang=os.getenv('LANG')
-        lang=lang[0:2]
-        namen = home + '/.language'
-        window = gtk.Window(gtk.WINDOW_TOPLEVEL)
-        self.window=window
-        window.set_border_width(5)
-        window.set_title(i18n('DoubleClick Language'))
-        window.set_size_request(600,400)
-        vbox = gtk.VBox(False, 5)
-        window.add(vbox)
-        window.set_position(gtk.WIN_POS_CENTER_ALWAYS)
-        self.liststore=gtk.ListStore(int,gtk.gdk.Pixbuf,str,str,gtk.gdk.Pixbuf,str)
-        self.treeview=gtk.TreeView()
-        self.treeview.set_headers_visible(True)
-        self.treeview.set_model(self.liststore)
-        self.treeview.connect('row-activated', self.row_activate)
-        self.treeview.set_events(self.treeview.get_events() | gtk.gdk.BUTTON_PRESS_MASK)
-        self.treeview.connect("button-press-event", self.mouse)
-
-        self.cellpb = gtk.CellRendererPixbuf()
-        self.cell1 = gtk.CellRendererText()
-        self.cellf = gtk.CellRendererPixbuf()
-        self.cell2 = gtk.CellRendererText()
-        self.cellv = gtk.CellRendererText()
-        self.cellpb.set_property('cell-background','grey80')
-        self.cellf.set_property('cell-background', 'grey80')
-        self.cell1.set_property('cell-background', 'grey80')
-        self.spalte1 = gtk.TreeViewColumn(i18n('Language'))
-        self.spalte2 = gtk.TreeViewColumn(i18n('Description'))
-        self.spalte3 = gtk.TreeViewColumn(i18n('Variant'))
-        self.treeview.append_column(self.spalte1)
-        self.treeview.append_column(self.spalte2)
-        self.treeview.append_column(self.spalte3)
-        self.spalte1.pack_start(self.cellpb,False)
-        self.spalte1.pack_start(self.cell1,True)
-        self.spalte1.pack_start(self.cellf,False)
-        self.spalte2.pack_start(self.cell2,True)
-        self.spalte3.pack_start(self.cellv,True)
-        self.spalte1.set_attributes(self.cellpb, pixbuf=1)
-        self.spalte1.set_attributes(self.cell1, text=2)
-        self.spalte1.set_attributes(self.cellf, pixbuf=4)
-        self.spalte2.set_attributes(self.cell2, text=3)
-        self.spalte3.set_attributes(self.cellv, text=5)
-
-
-        sw = gtk.ScrolledWindow()
-        sw.set_shadow_type(gtk.SHADOW_ETCHED_IN)
-        sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
-        sw.add(self.treeview)
-        self.xkeyboard=gtk.CheckButton(i18n("install service:  ~/.config/autostart/xkeyboard"))
-        self.xkeyboard.set_active(True)
-        #vbox.pack_start(self.xkeyboard , False,False, 0)
-        vbox.pack_start(sw , True, True, 0)
-        window.connect("destroy", self.destroy)
-
-        hbox=gtk.HBox(False,10)
-        hbox2=gtk.HBox(False,10)
-        label4=gtk.Label(i18n("Default:"))
-        self.combobox = gtk.combo_box_new_text()
-        label5=gtk.Label(i18n("Variant:"))
-        self.variant = gtk.combo_box_new_text()
-        self.variant.connect('changed', self.variant_changed)
-        button1=gtk.Button(stock='gtk-apply')
-        button2=gtk.Button(stock='gtk-cancel')
-        hbox.pack_start(button1,False,False,0)
-        hbox.pack_start(label4,False,False,0)
-        hbox.pack_start(self.combobox,True,True, 0)
-        hbox2.pack_start(label5,False,False,0)
-        hbox2.pack_start(self.variant,True,True, 0)
-        hbox.pack_start(button2,False,False,0)
-        button1.connect('clicked',self.save)
-        button2.connect('clicked',self.destroy)
-        vbox.pack_start(hbox2 , False,False, 0)
-        vbox.pack_start(hbox , False,False, 0)
-        window.show_all()
-
-        try:
-             f=file(namen,'r')
-             layout0=f.read()
-             f.close()
-             layout0=layout0.replace('\n','')
-             layout1=layout0.split(' ')
-             layout=layout1[0].split(',')
-             if " -variant " in layout0:
-                layout2=layout0.split('-variant ')
-                vari=layout2[1].split(',')
-             else: vari=['','','','','','','','','','','','','','','','','','','','','']
-        except:         
-             layout=[ lang[0:2] ]
-             vari=['','','','']
-
-        self.lock=True
-        self.active_language=-1
-        self.variantanzahl=0
-        self.comboanzahl=0
-        for i in layout:
-            self.combobox.append_text(i)
-            self.comboanzahl+=1
-        self.combobox.set_active(0)
-
-        self.anzahl=len(sprachen.keys())
-        
-        for i in sprachen.keys():
-            try:
-               filename='/usr/share/sidux-lxde-common/Flaggen/'+i+'.png'  
-               flag=gtk.gdk.pixbuf_new_from_file(filename)
-            except:
-               flag=Snix
-            if flag==Snix:
-               try:
-                   filename='/usr/share/lxpanel/images/xkb-flags/'+i+'.png' 
-                   flag2=gtk.gdk.pixbuf_new_from_file(filename)
-                   flag=flag2.scale_simple(26,18,gtk.gdk.INTERP_HYPER)
-               except:
-                   flag=Snix
-
-            if i in layout:
-               for t in range(len(layout)):
-                   if layout[t]==i: break
-               try: 
-                  if layout[t]==i: myvariant=vari[t]
-                  else: myvariant=""
-               except:
-                  myvariant=""
-               self.liststore.append([1,Son,i,sprachen[i],flag,myvariant])
-            else:
-               self.liststore.append([0,Soff,i,sprachen[i],flag,''])
-
-        self.liststore.set_sort_column_id(3, gtk.SORT_ASCENDING)
-
-
-    def main(self):
-        # All PyGTK applications must have a gtk.main(). Control ends here
-        # and waits for an event to occur (like a key press or mouse event).
-        gtk.main()
-
-
-
-# If the program is run directly or passed as an argument to the python
-# interpreter then create a HelloWorld instance and show it
-if __name__ == "__main__":
-     codec1=Xcodec.lower().replace('iso-','iso').replace('-','_')
-     if 'ansi' in codec1: codec1='iso8859_1'  #Ansi is shit...
-     I18N_ready = load_i18n('keyboard-setup.moo')
-     Snix=gtk.gdk.pixbuf_new_from_xpm_data(garnix)
-     Soff=gtk.gdk.pixbuf_new_from_xpm_data(rot)
-     Son=gtk.gdk.pixbuf_new_from_xpm_data(gruen)
-     app=startmenu()
-     app.main() 
-
-
diff --git a/src/keyboardconf/keyboardconf.py b/src/keyboardconf/keyboardconf.py
new file mode 100755 (executable)
index 0000000..fb91bcf
--- /dev/null
@@ -0,0 +1,519 @@
+#!/usr/bin/python
+# -*- coding: UTF-8 -*-
+#**************************************************************************
+#                                                                         *
+#   Copyright (c) 2009 by Elfriede Apfelkuchen                            *
+#                                                                         *
+#   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 3 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, see <http://www.gnu.org/licenses/>. *
+#                                                                         *
+#**************************************************************************
+import locale
+locale.setlocale(locale.LC_ALL, '')          #set locale from 'LANG'
+Xcodec=locale.getpreferredencoding(False)
+import os
+import sys
+import string
+import time
+import codecs
+import pygtk
+pygtk.require('2.0')
+import gtk
+import pango
+import gc
+
+sprachen={}
+sprachen['al']='Albanian'
+sprachen['ar']='Arabic'
+sprachen['am']='Armenian'
+sprachen['az']='Azerbaijani'
+sprachen['by']='Belarusian'
+sprachen['be']='Belgian'
+sprachen['ben']='Bengali'
+sprachen['bs']='Bosnian'
+sprachen['br']='Brazilian'
+sprachen['bg']='Bulgarian'
+sprachen['mm']='Burmese'
+sprachen['ca']='Canadian'
+#  sprachen['ca_enhanced']='French Canadian'
+sprachen['cn']='Chinese'
+sprachen['hr']='Croatian'
+#  sprachen['hr_US']='Croatian (US)'
+sprachen['cz']='Czech'
+sprachen['cz_qwerty']='Czech (qwerty)'
+sprachen['dk']='Danish'
+sprachen['nl']='Dutch'
+sprachen['dvorak']='Dvorak'
+sprachen['ee']='Estonian'
+sprachen['fi']='Finnish'
+sprachen['fr']='French'
+sprachen['ge']='Georgian'
+#  sprachen['ge_la']='Georgian (latin)'
+#  sprachen['ge_ru']='Georgian (russian)'
+sprachen['de']='German'
+sprachen['el']='Greek'
+sprachen['guj']='Gujarati'
+sprachen['gur']='Gurmukhi'
+sprachen['dev']='Hindi'
+sprachen['hu']='Hungarian'
+#  sprachen['hu_US']='Hungarian (US)'
+#  sprachen['hu_qwerty']='Hungarian (qwerty)'
+sprachen['is']='Icelandic'
+sprachen['iu']='Inuktitut'
+sprachen['ir']='Iranian'
+sprachen['iq']='Iraq'
+sprachen['ie']='Irish'
+sprachen['il']='Israeli'
+#  sprachen['il_phonetic']='Israeli (phonetic)'
+sprachen['it']='Italian'
+sprachen['jp']='Japanese'
+sprachen['kan']='Kannada'
+sprachen['lo']='Lao'
+sprachen['la']='Latin America'
+sprachen['lt']='Lithuanian'
+#  sprachen['lt_std']='Lithuanian azerty standard'
+sprachen['lv']='Latvian'
+sprachen['mk']='Macedonian'
+sprachen['ml']='Malayalam'
+sprachen['mt']='Maltese'
+# sprachen['mt_us']='Maltese (US layout)'
+sprachen['ma']='Morocco'
+sprachen['nl']='Netherlands'
+sprachen['mn']='Mongolian'
+sprachen['no']='Norwegian'
+sprachen['ogham']='Ogham'
+#  sprachen['ori']='Oriya'
+sprachen['pl']='Polish'
+#  sprachen['pl2']='Polish (qwertz)'
+sprachen['pt']='Portuguese'
+sprachen['ro']='Romanian'
+sprachen['ru']='Russian'
+#  sprachen['ru_yawerty']='Russian (cyrillic phonetic)'
+#  sprachen['se_FI']='Northern Saami (Finland)'
+#  sprachen['se_NO']='Northern Saami (Norway)'
+#  sprachen['se_SE']='Northern Saami (Sweden)'
+sprachen['sr']='Serbian'
+sprachen['si']='Slovenian'
+sprachen['sk']='Slovak'
+sprachen['kr']='South Korea'
+#  sprachen['sk_qwerty']='Slovak (qwerty)'
+sprachen['es']='Spanish'
+sprachen['se']='Swedish'
+sprachen['ch']='Swiss'
+#  sprachen['fr_CH']='Swiss French'
+#  sprachen['de_CH']='Swiss German'
+sprachen['sy']='Syria'
+sprachen['syr']='Syriac'
+sprachen['tj']='Tajik'
+sprachen['tml']='Tamil'
+sprachen['tel']='Telugu'
+sprachen['th']='Thai (Kedmanee)'
+#  sprachen['th_tis']='Thai (TIS-820.2538)'
+#  sprachen['th_pat']='Thai (Pattachote)'
+sprachen['tr']='Turkish' 
+#  sprachen['tr_f']='Turkish (F)'
+sprachen['us']='U.S. English'
+sprachen['en_US']='U.S. English w/ ISO9995-3'
+sprachen['us_intl']='U.S. English w/ deadkeys'
+sprachen['ua']='Ukrainian' 
+sprachen['gb']='United Kingdom'
+sprachen['vn']='Vietnamese'
+#  sprachen['yu']='Yugoslavian'
+
+
+garnix=[
+"2 2 2 1",
+"a c None",
+"b c #ffffff",
+"aa",
+"aa"]
+
+
+rot=[
+"16 16 4 1",
+". c #000000",
+"# c #ff4040",
+"a c None",
+"b c #ffffff",
+"aaaaa......aaaaa",
+"aaa........bbaaa",
+"aa...######bbbaa",
+"a..##########bba",
+"a..###bbb####bba",
+"..###bbb######bb",
+"..##bb########bb",
+"..##bb########bb",
+"..##b#########bb",
+"..############bb",
+"..############bb",
+"a..##########bba",
+"a..##########bba",
+"aa...######bbbaa",
+"aaa..bbbbbbbbaaa",
+"aaaaabbbbbbaaaaa"]
+
+gruen=[
+"16 16 4 1",
+". c #000000",
+"# c #00ff00",
+"a c None",
+"b c #ffffff",
+"aaaaa......aaaaa",
+"aaa........bbaaa",
+"aa...######bbbaa",
+"a..##########bba",
+"a..###bbb####bba",
+"..###bbb######bb",
+"..##bb########bb",
+"..##bb########bb",
+"..##b#########bb",
+"..############bb",
+"..############bb",
+"a..##########bba",
+"a..##########bba",
+"aa...######bbbaa",
+"aaa..bbbbbbbbaaa",
+"aaaaabbbbbbaaaaa"]
+
+
+
+I18N={}
+
+def i18n(text):
+    if I18N_ready:
+       if I18N.has_key(text): return I18N[text]
+       else: return text
+    else: return text
+
+def load_i18n(filename):
+     #lädt Internationalisierung.moo file
+     ready=False
+     lang=os.getenv('LANG')
+     if not lang: return ready
+     lang2='/usr/share/locale/'+lang[0:2] +'/LC_MESSAGES/'+filename
+     lang3='/usr/share/locale/'+lang[0:5] +'/LC_MESSAGES/'+filename
+     lang='no file'
+     if   os.access(lang3,os.R_OK): lang=lang3
+     elif os.access(lang2,os.R_OK): lang=lang2
+     if lang != 'no file':
+        f=codecs.open(lang,'r','utf_8')
+        if f:
+           lang=f.readlines()
+           f.close()
+           ready=True
+           for z in lang:
+               s=z.replace('\n','').split('=')
+               if s[0]=='': continue
+               I18N[s[0]]=s[1]
+     return ready
+
+
+def melke_xorg(langy):
+    #extrahiere keyboard varianten aus xorg fuer die angegebene Sprache
+    filename='/usr/share/X11/xkb/symbols/'+langy
+    try:
+       f=codecs.open(filename,'r','utf_8')
+       text=f.read()
+       f.close()
+    except:
+       text=[";standard"]
+       return text
+    text=text.split('\n')
+    key=-1
+    variants=[";standard"]
+    for line in text:
+        if line[0:11]=='xkb_symbols':
+           line2=line.split('"')
+           oldkey=key
+           key=line2[1]
+           if oldkey!=-1: variants.append(oldkey)
+           continue
+        if 'name[Group1]' in line:
+           line2=line.split('name[Group1]')
+           line3=line2[1].split('"')
+           if key!=-1: key=key+';'+line3[1]
+    if key!=-1: variants.append(key)  
+    return variants
+
+
+class startmenu:
+    def destroy(self, widget, data=None):
+        #wird beim beenden ausgeführt, oder Abbrechen wurde angeklickt
+        gtk.main_quit()
+
+
+    def save(self,data=None):
+        #Anwenden wurde angeklickt
+        Default=self.combobox.get_active_text()
+        text=Default[:]
+        for i in range(self.anzahl):
+            if self.liststore[i][0]==1:
+               text2=self.liststore[i][2]
+               if text2!=Default:
+                  text=text+','+text2
+        text+=' -variant '
+        for i in range(self.anzahl):          
+            if self.liststore[i][2]==Default: break
+        if self.liststore[i][2]==Default: text+=self.liststore[i][5]
+        for i in range(self.anzahl):
+            if self.liststore[i][0]==1:
+               text2=self.liststore[i][2]
+               if text2!=Default:
+                  text=text+','+self.liststore[i][5]
+
+        print "setxkbmap -model pc105 -layout",text
+        #Tastaturlayout wird umgeschaltet
+        os.system("setxkbmap -model pc105 -layout "+text)
+        os.system("lxpanelctl restart")
+        home=os.getenv('HOME')
+        namen = home + '/.language'
+        #save sprache in ~/.language
+        f=file(namen,'w')
+        if f:
+           f.write('%s' % text)
+           f.flush()
+           f.close()
+        #wenn Checkbox aktiviert ist, erzeuge xkeyboard.desktop in ~/.config/autostart
+        if self.xkeyboard.get_active():
+           os.system ('mkdir ~/.config/autostart 2>/dev/null')
+           f=file(home+'/.config/autostart/xkeyboard.desktop','w')
+           if f:
+              f.write('\n[Desktop Entry]\n')
+              f.write('Encoding=UTF-8\n')
+              f.write('Version=0.9.4\n')
+              f.write('Type=Application\n')
+              f.write('Icon=input-keyboard\n')
+              f.write('Name=X.org-keyboard-layout\n')
+              f.write('Comment=set the language layout for the keyboard\n')
+              f.write('Exec=bash -c "setxkbmap -model 105 -layout `cat ~/.language`"\n')
+              f.write('StartupNotify=false\n')
+              f.write('Terminal=false\n')
+              f.write('Hidden=false\n')
+              f.close()
+        gtk.main_quit()
+
+
+    def variant_changed(self,data):
+        #Die keyboardvariante in der combobox wurde geändert
+        if self.lock: return
+        try:
+           model = self.variant.get_model()
+           index = self.variant.get_active()
+           variant=model[index][0]
+        except:
+           return
+        text=variant.split(';')
+        if self.active_language!=-1:
+           self.liststore[self.active_language][5]=text[0]
+
+
+    def row_activate(self, treeview, path, column):
+        #Doppelklick auf eine Sprache, aktualisiere default combobox mit Sprachen
+        name=self.liststore[path][2]
+        state=self.liststore[path][0]
+        if state==1:                          #Sprache wird entfernt
+           self.liststore[path][0]=0
+           self.liststore[path][1]=Soff
+           print name,"= 0"
+           for i in range(self.comboanzahl): self.combobox.remove_text(0)
+           self.comboanzahl=0
+           for i in range(self.anzahl):
+               if self.liststore[i][0]==1:
+                  self.comboanzahl+=1
+                  self.combobox.append_text(self.liststore[i][2])
+           self.combobox.set_active(0)
+        else:                                 #Sprache wird hinzugefügt
+           self.liststore[path][0]=1
+           self.liststore[path][1]=Son
+           print name,"= 1"
+           for i in range(self.comboanzahl): self.combobox.remove_text(0)
+           self.comboanzahl=0
+           for i in range(self.anzahl):
+               if self.liststore[i][0]==1:
+                  self.comboanzahl+=1
+                  self.combobox.append_text(self.liststore[i][2])
+           self.combobox.set_active(0)
+        gc.collect()
+
+
+    def mouse(self, widget, event, data=None):
+        if event.button==1:
+           #eine Sprache wurde angeklickt, setze Variant combobox
+           pathinfo=self.treeview.get_path_at_pos(int(event.x),int(event.y)) 
+           if pathinfo==None: return False
+           pathnr=pathinfo[0][0]  
+           name=self.liststore[pathnr][2]
+           self.lock=True
+           self.active_language=pathnr
+           for i in range(self.variantanzahl): self.variant.remove_text(0)
+           self.variantanzahl=0
+           variants=melke_xorg(name)
+           for line in variants: 
+               self.variant.append_text(line)
+               self.variantanzahl+=1
+           self.lock=False
+
+
+    def __init__(self):
+        home=os.getenv('HOME')
+        lang=os.getenv('LANG')
+        lang=lang[0:2]
+        namen = home + '/.language'
+        window = gtk.Window(gtk.WINDOW_TOPLEVEL)
+        self.window=window
+        window.set_border_width(5)
+        window.set_title(i18n('DoubleClick Language'))
+        window.set_size_request(600,400)
+        vbox = gtk.VBox(False, 5)
+        window.add(vbox)
+        window.set_position(gtk.WIN_POS_CENTER_ALWAYS)
+        self.liststore=gtk.ListStore(int,gtk.gdk.Pixbuf,str,str,gtk.gdk.Pixbuf,str)
+        self.treeview=gtk.TreeView()
+        self.treeview.set_headers_visible(True)
+        self.treeview.set_model(self.liststore)
+        self.treeview.connect('row-activated', self.row_activate)
+        self.treeview.set_events(self.treeview.get_events() | gtk.gdk.BUTTON_PRESS_MASK)
+        self.treeview.connect("button-press-event", self.mouse)
+
+        self.cellpb = gtk.CellRendererPixbuf()
+        self.cell1 = gtk.CellRendererText()
+        self.cellf = gtk.CellRendererPixbuf()
+        self.cell2 = gtk.CellRendererText()
+        self.cellv = gtk.CellRendererText()
+        self.cellpb.set_property('cell-background','grey80')
+        self.cellf.set_property('cell-background', 'grey80')
+        self.cell1.set_property('cell-background', 'grey80')
+        self.spalte1 = gtk.TreeViewColumn(i18n('Language'))
+        self.spalte2 = gtk.TreeViewColumn(i18n('Description'))
+        self.spalte3 = gtk.TreeViewColumn(i18n('Variant'))
+        self.treeview.append_column(self.spalte1)
+        self.treeview.append_column(self.spalte2)
+        self.treeview.append_column(self.spalte3)
+        self.spalte1.pack_start(self.cellpb,False)
+        self.spalte1.pack_start(self.cell1,True)
+        self.spalte1.pack_start(self.cellf,False)
+        self.spalte2.pack_start(self.cell2,True)
+        self.spalte3.pack_start(self.cellv,True)
+        self.spalte1.set_attributes(self.cellpb, pixbuf=1)
+        self.spalte1.set_attributes(self.cell1, text=2)
+        self.spalte1.set_attributes(self.cellf, pixbuf=4)
+        self.spalte2.set_attributes(self.cell2, text=3)
+        self.spalte3.set_attributes(self.cellv, text=5)
+
+
+        sw = gtk.ScrolledWindow()
+        sw.set_shadow_type(gtk.SHADOW_ETCHED_IN)
+        sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
+        sw.add(self.treeview)
+        self.xkeyboard=gtk.CheckButton(i18n("install service:  ~/.config/autostart/xkeyboard"))
+        self.xkeyboard.set_active(True)
+        #vbox.pack_start(self.xkeyboard , False,False, 0)
+        vbox.pack_start(sw , True, True, 0)
+        window.connect("destroy", self.destroy)
+
+        hbox=gtk.HBox(False,10)
+        hbox2=gtk.HBox(False,10)
+        label4=gtk.Label(i18n("Default:"))
+        self.combobox = gtk.combo_box_new_text()
+        label5=gtk.Label(i18n("Variant:"))
+        self.variant = gtk.combo_box_new_text()
+        self.variant.connect('changed', self.variant_changed)
+        button1=gtk.Button(stock='gtk-apply')
+        button2=gtk.Button(stock='gtk-cancel')
+        hbox.pack_start(button1,False,False,0)
+        hbox.pack_start(label4,False,False,0)
+        hbox.pack_start(self.combobox,True,True, 0)
+        hbox2.pack_start(label5,False,False,0)
+        hbox2.pack_start(self.variant,True,True, 0)
+        hbox.pack_start(button2,False,False,0)
+        button1.connect('clicked',self.save)
+        button2.connect('clicked',self.destroy)
+        vbox.pack_start(hbox2 , False,False, 0)
+        vbox.pack_start(hbox , False,False, 0)
+        window.show_all()
+
+        try:
+             f=file(namen,'r')
+             layout0=f.read()
+             f.close()
+             layout0=layout0.replace('\n','')
+             layout1=layout0.split(' ')
+             layout=layout1[0].split(',')
+             if " -variant " in layout0:
+                layout2=layout0.split('-variant ')
+                vari=layout2[1].split(',')
+             else: vari=['','','','','','','','','','','','','','','','','','','','','']
+        except:         
+             layout=[ lang[0:2] ]
+             vari=['','','','']
+
+        self.lock=True
+        self.active_language=-1
+        self.variantanzahl=0
+        self.comboanzahl=0
+        for i in layout:
+            self.combobox.append_text(i)
+            self.comboanzahl+=1
+        self.combobox.set_active(0)
+
+        self.anzahl=len(sprachen.keys())
+        
+        for i in sprachen.keys():
+            try:
+               filename='/usr/share/sidux-lxde-common/Flaggen/'+i+'.png'  
+               flag=gtk.gdk.pixbuf_new_from_file(filename)
+            except:
+               flag=Snix
+            if flag==Snix:
+               try:
+                   filename='/usr/share/lxpanel/images/xkb-flags/'+i+'.png' 
+                   flag2=gtk.gdk.pixbuf_new_from_file(filename)
+                   flag=flag2.scale_simple(26,18,gtk.gdk.INTERP_HYPER)
+               except:
+                   flag=Snix
+
+            if i in layout:
+               for t in range(len(layout)):
+                   if layout[t]==i: break
+               try: 
+                  if layout[t]==i: myvariant=vari[t]
+                  else: myvariant=""
+               except:
+                  myvariant=""
+               self.liststore.append([1,Son,i,sprachen[i],flag,myvariant])
+            else:
+               self.liststore.append([0,Soff,i,sprachen[i],flag,''])
+
+        self.liststore.set_sort_column_id(3, gtk.SORT_ASCENDING)
+
+
+    def main(self):
+        # All PyGTK applications must have a gtk.main(). Control ends here
+        # and waits for an event to occur (like a key press or mouse event).
+        gtk.main()
+
+
+
+# If the program is run directly or passed as an argument to the python
+# interpreter then create a HelloWorld instance and show it
+if __name__ == "__main__":
+     codec1=Xcodec.lower().replace('iso-','iso').replace('-','_')
+     if 'ansi' in codec1: codec1='iso8859_1'  #Ansi is shit...
+     I18N_ready = load_i18n('keyboard-setup.moo')
+     Snix=gtk.gdk.pixbuf_new_from_xpm_data(garnix)
+     Soff=gtk.gdk.pixbuf_new_from_xpm_data(rot)
+     Son=gtk.gdk.pixbuf_new_from_xpm_data(gruen)
+     app=startmenu()
+     app.main() 
+
+
index b21981d..52a738e 100644 (file)
@@ -2,5 +2,12 @@ NULL=
 
 SUBDIRS=
 
-EXTRA_DIST = \
+bin_SCRIPTS = lxcc.py
+
+lxccdir = $(prefix)/bin
+
+DISTCLEANFILES = $(bin_SCRIPTS)         
+
+EXTRA_DIST =  \
+    $(bin_SCRIPTS) \
        $(NULL)
diff --git a/src/lxcc/lxcc b/src/lxcc/lxcc
deleted file mode 100755 (executable)
index 5a1de5a..0000000
+++ /dev/null
@@ -1,164 +0,0 @@
-#!/usr/bin/python
-# -*- coding: UTF-8 -*-
-#**************************************************************************
-#                                                                         *
-#   Copyright (c) 2010 by Elfriede Apfelkuchen <elfriede@sidux.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 3 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, see <http://www.gnu.org/licenses/>. *
-#                                                                         *
-#**************************************************************************
-
-control_center_icons=[
-["name","icon","command"],
-["Login Screen","config-users",'su-to-root -X -c "/usr/bin/lxdmconf"'],
-["Configure Openbox","obconf",'obconf'],
-["Preferred Applications","applications-system",'libfm-pref-apps'],
-["Openbox Keyboard Shortcuts","input-keyboard",'openbox-keyconf'],
-["Keyboard Layout","input-keyboard",'keyboardconf'],
-["Mouse&Keyboard","input-keyboard",'lxinput'],
-["Set Wallpaper","desktop",'pcmanfm --desktop-pref'],
-["Screensaver Settings","xscreensaver",'xscreensaver-demo'],
-["Appearance","preferences-desktop-theme",'lxappearance'],
-["configure Fonts","format-text-bold",'fontconfig.py'],
-["PCManFM Settings","file-manager",'pcmanfm --show-pref=1'],
-["PCManFM Superuser Mode","file-manager",'su-to-root -X -c "pcmanfm --no-desktop"'],
-["Refresh Panel","gtk-refresh",'lxpanelctl restart'],
-["Search Software","search",'apt-leo'],
-["Session Settings","gnome-window-manager",'lxsession-edit'],
-["Monitor Settings","computer",'lxrandr'],
-]
-
-
-
-
-import locale
-locale.setlocale(locale.LC_ALL, '')   #set locale from 'LANG'
-Xcodec=locale.getpreferredencoding(False)
-import os
-import sys
-import string
-import pygtk
-pygtk.require('2.0')
-import gtk
-import codecs
-import pango
-
-I18N={}
-
-def i18n(text):
-    #liefert einen Internationialisierungstext zurück
-    if I18N_ready:
-       if I18N.has_key(text): return I18N[text]
-       else: return text
-    else: return text
-
-def load_i18n(filename):
-     #lädt das Internationalisierung.moo file
-     ready=False
-     lang=os.getenv('LANG')
-     if not lang: return ready
-     lang2='/usr/share/locale/'+lang[0:2] +'/LC_MESSAGES/'+filename
-     lang3='/usr/share/locale/'+lang[0:5] +'/LC_MESSAGES/'+filename
-     lang='no file'
-     if   os.access(lang3,os.R_OK): lang=lang3
-     elif os.access(lang2,os.R_OK): lang=lang2
-     if lang != 'no file':
-        f=codecs.open(lang,'r','utf_8')
-        if f:
-           lang=f.readlines()
-           f.close()
-           ready=True
-           for z in lang:
-               s=z.replace('\n','').split('=')
-               if s[0]=='': continue
-               I18N[s[0]]=s[1]
-     return ready
-
-
-class Simple:
-
-    def destroy(self, widget, data=None):
-        #wird beim beenden ausgeführt
-        gtk.main_quit()
-
-
-    def mouse(self, widget, event, data=None):
-        if event.button==1:
-           pathinfo=widget.get_path_at_pos(int(event.x),int(event.y)) 
-           if pathinfo==None: return False
-           pathnr=pathinfo[0]  
-           command=self.liststore[pathnr][2]
-           if command=='xscreensaver-demo':
-              if not os.path.exists('/usr/bin/xscreensaver-demo'):
-                 dialog = gtk.MessageDialog(self.window, gtk.DIALOG_MODAL,gtk.MESSAGE_INFO,gtk.BUTTONS_OK, "apt-get install xscreensaver")
-                 result = dialog.run()
-                 dialog.destroy()
-           os.system(command+' &') 
-           return True
-        return False
-
-
-    def __init__(self):
-        # create a new window
-        window = gtk.Window(gtk.WINDOW_TOPLEVEL)
-        self.window=window
-        window.set_title(i18n('LXDE-Control-Center'))
-        window.connect("destroy", self.destroy)
-        window.set_border_width(3)
-        window.set_position(gtk.WIN_POS_CENTER_ALWAYS)
-
-        it=gtk.icon_theme_get_default()
-        gtk.window_set_default_icon(it.load_icon("gtk-preferences",48,gtk.ICON_LOOKUP_FORCE_SVG))
-        window.resize(800,400)
-        self.liststore=gtk.ListStore(gtk.gdk.Pixbuf,str,str)
-        self.iv=gtk.IconView(self.liststore)
-        self.iv.set_pixbuf_column(0)
-        self.iv.set_text_column(1)
-        self.iv.set_events(self.iv.get_events() | gtk.gdk.BUTTON_PRESS_MASK)
-        self.iv.connect("button-press-event", self.mouse)
-        sw = gtk.ScrolledWindow()
-        sw.set_shadow_type(gtk.SHADOW_ETCHED_IN)
-        sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
-        sw.add(self.iv)
-        window.add(sw)
-
-        first=True
-        for line in control_center_icons:
-            if first:
-               first=False
-               continue  
-            try:
-               if '/' in line[1]:
-                  pixbuf=gtk.gdk.pixbuf_new_from_file(line[1])
-               else:
-                  pixbuf=it.load_icon(line[1],48,gtk.ICON_LOOKUP_FORCE_SVG)
-            except:
-               pixbuf=it.load_icon('gtk-stop',48,gtk.ICON_LOOKUP_FORCE_SVG)
-            namen=i18n(line[0])
-            self.liststore.append([ pixbuf,namen,line[2] ])
-        window.show_all()
-
-
-    def main(self):
-        # All PyGTK applications must have a gtk.main(). Control ends here
-        # and waits for an event to occur (like a key press or mouse event).
-        gtk.main()
-
-
-# If the program is run directly or passed as an argument to the python
-# interpreter then create a HelloWorld instance and show it
-if __name__ == "__main__":
-     I18N_ready = load_i18n('lxcc.moo')
-     app = Simple()
-     app.main()
diff --git a/src/lxcc/lxcc.py b/src/lxcc/lxcc.py
new file mode 100755 (executable)
index 0000000..5a1de5a
--- /dev/null
@@ -0,0 +1,164 @@
+#!/usr/bin/python
+# -*- coding: UTF-8 -*-
+#**************************************************************************
+#                                                                         *
+#   Copyright (c) 2010 by Elfriede Apfelkuchen <elfriede@sidux.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 3 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, see <http://www.gnu.org/licenses/>. *
+#                                                                         *
+#**************************************************************************
+
+control_center_icons=[
+["name","icon","command"],
+["Login Screen","config-users",'su-to-root -X -c "/usr/bin/lxdmconf"'],
+["Configure Openbox","obconf",'obconf'],
+["Preferred Applications","applications-system",'libfm-pref-apps'],
+["Openbox Keyboard Shortcuts","input-keyboard",'openbox-keyconf'],
+["Keyboard Layout","input-keyboard",'keyboardconf'],
+["Mouse&Keyboard","input-keyboard",'lxinput'],
+["Set Wallpaper","desktop",'pcmanfm --desktop-pref'],
+["Screensaver Settings","xscreensaver",'xscreensaver-demo'],
+["Appearance","preferences-desktop-theme",'lxappearance'],
+["configure Fonts","format-text-bold",'fontconfig.py'],
+["PCManFM Settings","file-manager",'pcmanfm --show-pref=1'],
+["PCManFM Superuser Mode","file-manager",'su-to-root -X -c "pcmanfm --no-desktop"'],
+["Refresh Panel","gtk-refresh",'lxpanelctl restart'],
+["Search Software","search",'apt-leo'],
+["Session Settings","gnome-window-manager",'lxsession-edit'],
+["Monitor Settings","computer",'lxrandr'],
+]
+
+
+
+
+import locale
+locale.setlocale(locale.LC_ALL, '')   #set locale from 'LANG'
+Xcodec=locale.getpreferredencoding(False)
+import os
+import sys
+import string
+import pygtk
+pygtk.require('2.0')
+import gtk
+import codecs
+import pango
+
+I18N={}
+
+def i18n(text):
+    #liefert einen Internationialisierungstext zurück
+    if I18N_ready:
+       if I18N.has_key(text): return I18N[text]
+       else: return text
+    else: return text
+
+def load_i18n(filename):
+     #lädt das Internationalisierung.moo file
+     ready=False
+     lang=os.getenv('LANG')
+     if not lang: return ready
+     lang2='/usr/share/locale/'+lang[0:2] +'/LC_MESSAGES/'+filename
+     lang3='/usr/share/locale/'+lang[0:5] +'/LC_MESSAGES/'+filename
+     lang='no file'
+     if   os.access(lang3,os.R_OK): lang=lang3
+     elif os.access(lang2,os.R_OK): lang=lang2
+     if lang != 'no file':
+        f=codecs.open(lang,'r','utf_8')
+        if f:
+           lang=f.readlines()
+           f.close()
+           ready=True
+           for z in lang:
+               s=z.replace('\n','').split('=')
+               if s[0]=='': continue
+               I18N[s[0]]=s[1]
+     return ready
+
+
+class Simple:
+
+    def destroy(self, widget, data=None):
+        #wird beim beenden ausgeführt
+        gtk.main_quit()
+
+
+    def mouse(self, widget, event, data=None):
+        if event.button==1:
+           pathinfo=widget.get_path_at_pos(int(event.x),int(event.y)) 
+           if pathinfo==None: return False
+           pathnr=pathinfo[0]  
+           command=self.liststore[pathnr][2]
+           if command=='xscreensaver-demo':
+              if not os.path.exists('/usr/bin/xscreensaver-demo'):
+                 dialog = gtk.MessageDialog(self.window, gtk.DIALOG_MODAL,gtk.MESSAGE_INFO,gtk.BUTTONS_OK, "apt-get install xscreensaver")
+                 result = dialog.run()
+                 dialog.destroy()
+           os.system(command+' &') 
+           return True
+        return False
+
+
+    def __init__(self):
+        # create a new window
+        window = gtk.Window(gtk.WINDOW_TOPLEVEL)
+        self.window=window
+        window.set_title(i18n('LXDE-Control-Center'))
+        window.connect("destroy", self.destroy)
+        window.set_border_width(3)
+        window.set_position(gtk.WIN_POS_CENTER_ALWAYS)
+
+        it=gtk.icon_theme_get_default()
+        gtk.window_set_default_icon(it.load_icon("gtk-preferences",48,gtk.ICON_LOOKUP_FORCE_SVG))
+        window.resize(800,400)
+        self.liststore=gtk.ListStore(gtk.gdk.Pixbuf,str,str)
+        self.iv=gtk.IconView(self.liststore)
+        self.iv.set_pixbuf_column(0)
+        self.iv.set_text_column(1)
+        self.iv.set_events(self.iv.get_events() | gtk.gdk.BUTTON_PRESS_MASK)
+        self.iv.connect("button-press-event", self.mouse)
+        sw = gtk.ScrolledWindow()
+        sw.set_shadow_type(gtk.SHADOW_ETCHED_IN)
+        sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
+        sw.add(self.iv)
+        window.add(sw)
+
+        first=True
+        for line in control_center_icons:
+            if first:
+               first=False
+               continue  
+            try:
+               if '/' in line[1]:
+                  pixbuf=gtk.gdk.pixbuf_new_from_file(line[1])
+               else:
+                  pixbuf=it.load_icon(line[1],48,gtk.ICON_LOOKUP_FORCE_SVG)
+            except:
+               pixbuf=it.load_icon('gtk-stop',48,gtk.ICON_LOOKUP_FORCE_SVG)
+            namen=i18n(line[0])
+            self.liststore.append([ pixbuf,namen,line[2] ])
+        window.show_all()
+
+
+    def main(self):
+        # All PyGTK applications must have a gtk.main(). Control ends here
+        # and waits for an event to occur (like a key press or mouse event).
+        gtk.main()
+
+
+# If the program is run directly or passed as an argument to the python
+# interpreter then create a HelloWorld instance and show it
+if __name__ == "__main__":
+     I18N_ready = load_i18n('lxcc.moo')
+     app = Simple()
+     app.main()
index b21981d..2827e52 100644 (file)
@@ -2,5 +2,12 @@ NULL=
 
 SUBDIRS=
 
-EXTRA_DIST = \
+bin_SCRIPTS = lxdmconf.py
+
+lxdmconfdir = $(prefix)/bin
+
+DISTCLEANFILES = $(bin_SCRIPTS)         
+
+EXTRA_DIST =  \
+    $(bin_SCRIPTS) \
        $(NULL)
diff --git a/src/lxdmconf/lxdmconf b/src/lxdmconf/lxdmconf
deleted file mode 100644 (file)
index ee49d2c..0000000
+++ /dev/null
@@ -1,548 +0,0 @@
-#!/usr/bin/python
-# -*- coding: UTF-8 -*-
-#**************************************************************************
-#                                                                         *
-#   Copyright (c) 2010 by Elfriede Apfelkuchen                            *
-#                                                                         *
-#   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 3 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, see <http://www.gnu.org/licenses/>. *
-#                                                                         *
-#**************************************************************************
-import locale
-locale.setlocale(locale.LC_ALL, '')           #set locale from 'LANG'
-Xcodec=locale.getpreferredencoding(False)
-import os
-import sys
-import time
-import string
-import codecs
-import pygtk
-pygtk.require('2.0')
-import gtk
-import pango
-import gc
-
-I18N={}
-
-def i18n(text):
-    if I18N_ready:
-       if I18N.has_key(text): return I18N[text]
-       else: return text
-    else: return text
-
-def load_i18n(filename):
-     #lädt Internationalisierung.moo file
-     ready=False
-     lang=os.getenv('LANG')
-     if not lang: return ready
-     lang2='/usr/share/locale/'+lang[0:2] +'/LC_MESSAGES/'+filename
-     lang3='/usr/share/locale/'+lang[0:5] +'/LC_MESSAGES/'+filename
-     lang='no file'
-     if   os.access(lang3,os.R_OK): lang=lang3
-     elif os.access(lang2,os.R_OK): lang=lang2
-     if lang != 'no file':
-        f=codecs.open(lang,'r','utf_8')
-        if f:
-           lang=f.readlines()
-           f.close()
-           ready=True
-           for z in lang:
-               s=z.replace('\n','').split('=')
-               if s[0]=='': continue
-               I18N[s[0]]=s[1]
-     return ready
-
-def finden(arg,dir,filenames):
-    #subprocess of os.path.walk: get filenames in directorys
-    global fileliste
-    for text in filenames: 
-        filename=dir+os.sep+text
-        if os.path.isdir(filename): continue
-        fileliste.append(filename)
-
-def get_themes(picturepath):
-    #get filenames of all pictures in picturepath
-    global fileliste
-    fileliste=[]
-    os.path.walk(picturepath,finden,True)
-    themes=[]
-    for line in fileliste:
-        if ('.jpg' in line) or ('.png' in line) or ('.gif' in line) or ('.JPG' in line):
-           themes.append(line)
-    return themes
-
-def get_gtk2_themes():
-    #give all gtk2 Themes as List back
-    themes=[]
-    for line in os.listdir('/usr/share/themes'):
-        if os.access('/usr/share/themes/'+line+'/gtk-2.0/gtkrc',os.R_OK):
-           themes.append(os.path.basename(line))
-    return themes
-
-def get_lxdm_themes():
-    #give all lxdm Themes as List back
-    themes=[]
-    try:
-       for line in os.listdir('/usr/share/lxdm/themes'):
-           if os.access('/usr/share/lxdm/themes/'+line+'/gtkrc',os.R_OK):
-              themes.append(os.path.basename(line))
-    except:
-       return ['off'] 
-    return themes
-
-def read_entry(config,confkey,keydefault):
-    #read a config entry
-    l=len(confkey)
-    antwort=keydefault
-    for line in config:
-        if len(line)<l: continue
-        if line[0:1]=='#': continue
-        if line[0:l]==confkey: antwort=line[l:]   
-    return antwort
-
-def write_entry(config,section,confkey,keyvalue):
-    #write a config entry into section
-    myconfig=[]
-    found=False
-    mysection='[Flag]'
-    l=len(confkey) 
-    print 'write'+section+':',confkey+keyvalue
-    for line in config:
-        if len(line)>2:
-           if line[0]=='[':
-              newsection=line.strip()
-              if mysection==section:
-                 if found==False: 
-                    myconfig.append(confkey+keyvalue)
-                    found=True
-              mysection=newsection
-              myconfig.append(line)
-              continue 
-        if len(line)<l:
-           myconfig.append(line)
-           continue
-        if (line[0:l]==confkey) and (mysection==section):
-           found=True
-           myconfig.append(confkey+keyvalue)
-           continue
-        myconfig.append(line)
-    if found==False: 
-       myconfig.append(confkey+keyvalue)
-    return myconfig
-
-def delete_entry(config,confkey):
-    #delete a config entry
-    myconfig=[]
-    found=False
-    l=len(confkey) 
-    for line in config:
-        if len(line)<l:
-           myconfig.append(line)
-           continue
-        if line[0:l]==confkey:
-           found=True
-           continue
-        myconfig.append(line)
-    return myconfig
-class Tool:
-
-    def delete_event(self, widget, event, data=None):
-        # If you return FALSE in the "delete_event" signal handler,
-        # GTK will emit the "destroy" signal. Returning TRUE means
-        # you don't want the window to be destroyed.
-        # This is useful for popping up 'are you sure you want to quit?'
-        # type dialogs.
-        # Change FALSE to TRUE and the main window will not be destroyed
-        # with a "delete_event".
-        windowsize=self.window.get_size()
-        windowpos=self.window.get_position()
-        home=os.getenv('HOME')
-        home=home+'/.lxdmconf'
-        f=file(home,'w')
-        if f:
-           f.write('x=%i\n'      % windowpos[0])
-           f.write('y=%i\n'      % windowpos[1])
-           f.write('width=%i\n'  % windowsize[0])
-           f.write('height=%i\n' % windowsize[1])
-           f.close()
-        return False
-
-    def destroy(self, widget, data=None):
-        #wird beim beenden ausgeführt
-        gtk.main_quit()
-
-    def goodbye(self,data=None):
-        #Cancel Button is clicked
-        if not self.delete_event(self.window,data):
-           gtk.main_quit()
-
-
-    def save(self,data=None):
-        #Apply Button is clicked
-        print '==================================='       
-        os.system('mkdir  /etc/lxdm.d  2>/dev/null')
-
-        if self.cb_numlock.get_active(): 
-           self.config=write_entry(self.config,'[base]','numlock=','1')
-        else:
-           self.config=write_entry(self.config,'[base]','numlock=','0')
-
-        if self.cb_lang.get_active(): 
-           self.config=write_entry(self.config,'[display]','lang=','1')
-        else:
-           self.config=write_entry(self.config,'[display]','lang=','0')
-
-        if self.cb_bottom.get_active(): 
-           self.config=write_entry(self.config,'[display]','bottom_pane=','1')
-        else:
-           self.config=write_entry(self.config,'[display]','bottom_pane=','0')
-
-        if self.cb_autologin.get_active(): 
-           a=self.entryuser.get_text()
-           a=a.strip()
-           self.config=write_entry(self.config,'[base]','autologin=',a)
-        else:
-           self.config=delete_entry(self.config,'autologin=')      
-
-        a=self.entrysession.get_text()
-        a=a.strip()
-        if self.cb_session.get_active():
-           self.config=write_entry(self.config,'[base]','session=',a)
-        else:
-           self.config=delete_entry(self.config,'session=')
-
-        model = self.combobox.get_model()
-        index = self.combobox.get_active()
-        theme=model[index][0]
-        self.config=write_entry(self.config,'[display]','bg=',theme)
-
-        model = self.comboboxLXDM.get_model()
-        index = self.comboboxLXDM.get_active()
-        theme=model[index][0]
-        self.config=write_entry(self.config,'[display]','theme=',theme)
-
-        model = self.comboboxGTK.get_model()
-        index = self.comboboxGTK.get_active()
-        theme=model[index][0]
-        self.config=write_entry(self.config,'[display]','gtk_theme=',theme)
-
-        f=codecs.open('/etc/lxdm/lxdm.conf','w','utf_8')
-        for line in self.config:
-            text=line+'\n'
-            f.write(text)
-        f.close()
-        #gtk.main_quit()
-        self.goodbye()
-
-
-    def read_config(self):
-        filename='/etc/lxdm.d/lxdm_custom.conf'
-        if not os.access(filename,os.R_OK): filename='/etc/lxdm/lxdm.conf'
-        f=codecs.open(filename,'r','utf_8')
-        text=f.read()
-        f.close()
-        self.config=text.split('\n')
-
-        a=read_entry(self.config,"numlock=","0")
-        a=a.replace('\t', ' ')
-        a=a.strip()
-        print 'numlock=',a
-        if a=='1': 
-           self.cb_numlock.set_active(True)
-
-        a=read_entry(self.config,"lang=","1")
-        a=a.replace('\t', ' ')
-        a=a.strip()
-        print 'lang=',a
-        if a=='1': 
-           self.cb_lang.set_active(True)
-
-        a=read_entry(self.config,"bottom_pane=","1")
-        a=a.replace('\t', ' ')
-        a=a.strip()
-        print 'bottom_pane=',a
-        if a=='1': 
-           self.cb_bottom.set_active(True)
-
-        myusers=os.listdir('/home')
-        if len(myusers)>0: 
-           try:
-              myuser=unicode(myusers[0],'utf_8')
-           except:
-              myuser=unicode(myusers[0],'iso8859_15')
-        a=read_entry(self.config,"autologin=","_OFF")
-        a=a.replace('\t', ' ')
-        a=a.strip()
-        print 'autologin=',a
-        if a!='_OFF': 
-           self.cb_autologin.set_active(True)
-           self.entryuser.set_text(a)
-        else:
-           if len(myusers)>0: self.entryuser.set_text(myuser)
-
-
-        a=read_entry(self.config,"session=","/usr/bin/startlxde")
-        a=a.replace('\t', ' ')
-        a=a.strip()
-        print 'session=',a
-        self.entrysession.set_text(a)
-        a=read_entry(self.config,"session=","_OFF")
-        if a!='_OFF': self.cb_session.set_active(True)
-
-        a=read_entry(self.config,"bg=","/usr/share/wallpapers/default.png")
-        a=a.replace('\t', ' ')
-        a=a.strip()
-        print 'bg=',a
-        i=1
-        themes=get_themes('/usr/share/wallpapers')
-        for theme in themes:
-            if theme==a: self.combobox.set_active(i)
-            i+=1
-
-        a=read_entry(self.config,"theme=","Industrial")
-        a=a.replace('\t', ' ')
-        a=a.strip()
-        print 'theme=',a
-        i=0
-        themes=get_lxdm_themes()
-        for theme in themes:
-            if theme==a: self.comboboxLXDM.set_active(i)
-            i+=1
-
-        a=read_entry(self.config,"gtk_theme=","Clearlooks")
-        a=a.replace('\t', ' ')
-        a=a.strip()
-        print 'gtk_theme=',a
-        i=0
-        themes=get_gtk2_themes()
-        for theme in themes:
-            if theme==a: self.comboboxGTK.set_active(i)
-            i+=1
-
-
-
-    def theme_changed(self,data):               #Background picture has changed
-        model = self.combobox.get_model()
-        index = self.combobox.get_active()
-        filename=model[index][0]
-        try:
-           self.err=0
-           bild=gtk.gdk.pixbuf_new_from_file(filename)
-           bildvorschau=bild.scale_simple(360,240,gtk.gdk.INTERP_BILINEAR)
-           del bild
-           self.image.set_from_pixbuf(bildvorschau)
-           gc.collect()
-        except:
-           self.err=1
-           self.image.set_from_stock('gtk-stop', gtk.ICON_SIZE_DIALOG)
-
-
-    def lxdm_theme_changed(self,data):
-        if self.err==1:
-           try: 
-                model = self.comboboxLXDM.get_model()
-                index = self.comboboxLXDM.get_active()
-                filename='/usr/share/lxdm/themes/' + model[index][0] + '/'
-                f=codecs.open(filename + 'gtkrc','r','utf_8')
-                text2=f.read()
-                f.close()
-                text=text2.split('\n')          
-                text2='' 
-                found=0
-                a=len('style "')
-                b=len('style "back"')
-                for line in text:
-                    c=len(line)
-                    if c>=a:               
-                       if line[0:a]=='style "': 
-                          found=0
-                    if c>=b:
-                       if line[0:b]=='style "back"': 
-                          found=1
-                    if found==1:
-                       if 'file="' in line:
-                          text2=line.replace('\t','') 
-                          text2=text2.strip()
-                          text2=text2[5:].replace('"','')
-                bild=gtk.gdk.pixbuf_new_from_file(filename+text2)
-                bildvorschau=bild.scale_simple(360,240,gtk.gdk.INTERP_BILINEAR)
-                del bild
-                self.image.set_from_pixbuf(bildvorschau)
-                gc.collect()
-           except:
-                self.image.set_from_stock('gtk-stop', gtk.ICON_SIZE_DIALOG)
-                 
-
-
-    def __init__(self):
-        home=os.getenv('HOME')
-        if not home: sys.exit(1)
-        home=home+'/.lxdmconf'
-        if not os.access(home,os.R_OK):
-           f=file(home,'w')
-           f.write('x=0\n')
-           f.write('y=0\n')
-           f.write('width=500\n')
-           f.write('height=400\n')
-           f.close()
-        f=file(home,'r')
-        s=f.readline()
-        while s !='':
-           s=s.replace('\n','')
-           z=s.split('=')
-           if z[0]=='x':       self.pos_x=int(z[1])
-           if z[0]=='y':       self.pos_y=int(z[1])
-           if z[0]=='width':   self.width=int(z[1])
-           if z[0]=='height':  self.height=int(z[1])
-           s=f.readline()
-        f.close()
-
-        window = gtk.Window(gtk.WINDOW_TOPLEVEL)
-        self.window=window
-        vbox = gtk.VBox(False, 0)
-        window.add(vbox)
-
-        # When the window is given the "delete_event" signal (this is given
-        # by the window manager, usually by the "close" option, or on the
-        # titlebar), we ask it to call the delete_event () function
-        # as defined above. The data passed to the callback
-        # function is NULL and is ignored in the callback function.
-        window.connect("delete_event", self.delete_event)
-    
-        # Here we connect the "destroy" event to a signal handler.  
-        # This event occurs when we call gtk_widget_destroy() on the window,
-        # or if we return FALSE in the "delete_event" callback.
-        window.connect("destroy", self.destroy)
-    
-        # Sets the border width of the window.
-        window.set_title(i18n('lxdm Login Configuration'))
-        window.set_size_request(400,200)
-        window.resize(self.width, self.height)
-        window.move(self.pos_x,self.pos_y)
-
-        vbox2=gtk.VBox(False,0)
-        self.cb_numlock=gtk.CheckButton(i18n("Numlock"))
-        self.cb_lang=gtk.CheckButton(i18n("choose Language"))
-        self.cb_bottom=gtk.CheckButton(i18n("Bottom Pane"))
-        self.cb_autologin=gtk.CheckButton(i18n("autologin") + '       ')
-        label1=gtk.Label(i18n("User") + ':')
-        label1spacer=gtk.Label("     ")
-        self.entryuser=gtk.Entry(max=0)
-        hbox2 = gtk.HBox(False, 0)
-        hbox2.pack_start(self.cb_autologin,False,False,0)
-        hbox2.pack_start(label1,False,False,0)
-        hbox2.pack_start(self.entryuser,True,True,0)
-        #hbox2.pack_start(label1spacer,False,False,0)
-        vbox2.pack_start(self.cb_numlock,False,False,0)
-        vbox2.pack_start(self.cb_lang,False,False,0)
-        vbox2.pack_start(self.cb_bottom,False,False,0)
-        vbox2.pack_start(hbox2,False,False,0)
-        hbox3 = gtk.HBox(False, 0)
-        self.cb_session=gtk.CheckButton(i18n("session") + ':')
-        labelhspacer=gtk.Label(' ')
-        label2spacer=gtk.Label(" ")
-        self.entrysession=gtk.Entry(max=0)
-        hbox3.pack_start(self.cb_session,False,False,0)
-        hbox3.pack_start(self.entrysession,True,True,0)
-        #hbox3.pack_start(label2spacer,False,False,0)
-        vbox2.set_border_width(20)
-        vbox2.pack_start(labelhspacer,True,True,0)
-        vbox2.pack_start(hbox3,False,False,0)
-
-        self.image=gtk.Image()
-        hbox5 = gtk.HBox(False, 0)
-        hbox4 = gtk.HBox(False, 0)
-        vbox4 = gtk.VBox(False, 0)
-        labeltext=i18n('Theme')
-        label2=gtk.Label(i18n('Background')+':')
-        label12=gtk.Label('  GTK2-'+labeltext+':')
-        label13=gtk.Label(labeltext+':')
-        self.comboboxGTK = gtk.combo_box_new_text()
-        themes=get_gtk2_themes()
-        for theme in themes:
-            self.comboboxGTK.append_text(theme)
-        self.comboboxLXDM = gtk.combo_box_new_text()
-        themes=get_lxdm_themes()
-        for theme in themes:
-            self.comboboxLXDM.append_text(theme)
-        self.combobox = gtk.combo_box_new_text()
-        self.combobox.connect( 'changed', self.theme_changed)
-        self.combobox.append_text(labeltext)
-        themes=get_themes('/usr/share/wallpapers')
-        for theme in themes:
-            self.combobox.append_text(theme)
-        self.combobox.set_active(0)
-        self.comboboxLXDM.connect( 'changed', self.lxdm_theme_changed)
-        hbox5.pack_start(label13,False,False,0)
-        hbox5.pack_start(self.comboboxLXDM,True,True,0)
-        hbox5.pack_start(label12,False,False,0)
-        hbox5.pack_start(self.comboboxGTK,True,True,0)
-        hbox4.pack_start(label2,False,False,0)
-        hbox4.pack_start(self.combobox,True,True,0)
-        vbox4.pack_start(hbox5,False,False,0)
-        vbox4.pack_start(hbox4,False,False,0)
-        vbox4.pack_start(self.image,True,True,0)
-        notebook = gtk.Notebook()
-        notebook.set_tab_pos(gtk.POS_TOP)
-        tab_label1=gtk.Label(i18n('General'))
-        tab_label2=gtk.Label(i18n('Themes'))
-        notebook.append_page(vbox2,tab_label1) 
-        notebook.append_page(vbox4,tab_label2) 
-
-        vbox.pack_start(notebook, True, True, 0)
-
-        hbox = gtk.HBox(False, 0)
-        button1=gtk.Button(stock='gtk-apply')
-        hiddenlabel=gtk.Label(' ')
-        button2=gtk.Button(stock='gtk-cancel')
-        hbox.pack_start(button1,False,False,0)
-        hbox.pack_start(hiddenlabel,True,True,0)
-        hbox.pack_start(button2,False,False,0)
-        button1.connect_object("clicked", self.save,None)
-        button2.connect_object("clicked", self.goodbye,None)
-        self.combobox.set_tooltip_text('/usr/share/wallpapers')
-
-        vbox.pack_end(hbox, False, False, 5)
-        window.set_border_width(2)
-        self.read_config()
-        window.show_all()
-        userid=os.getuid()
-        if userid!=0:
-               dialog = gtk.MessageDialog(self.window, gtk.DIALOG_MODAL,gtk.MESSAGE_ERROR,gtk.BUTTONS_OK, "ERROR: not root!")
-               result = dialog.run()
-               dialog.destroy()
-               sys.exit(1)
-
-
-    def main(self):
-        # All PyGTK applications must have a gtk.main(). Control ends here
-        # and waits for an event to occur (like a key press or mouse event).
-        gtk.main()
-
-
-
-# If the program is run directly or passed as an argument to the python
-# interpreter then create a HelloWorld instance and show it
-if __name__ == "__main__":
-     codec1=Xcodec.lower().replace('iso-','iso').replace('-','_')
-     if 'ansi' in codec1: codec1='iso8859_1'  #Ansi is shit...
-     I18N_ready = load_i18n('lxdmconf.moo')
-     Elfriede = Tool()
-     Elfriede.main()
-
-
-
diff --git a/src/lxdmconf/lxdmconf.py b/src/lxdmconf/lxdmconf.py
new file mode 100644 (file)
index 0000000..ee49d2c
--- /dev/null
@@ -0,0 +1,548 @@
+#!/usr/bin/python
+# -*- coding: UTF-8 -*-
+#**************************************************************************
+#                                                                         *
+#   Copyright (c) 2010 by Elfriede Apfelkuchen                            *
+#                                                                         *
+#   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 3 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, see <http://www.gnu.org/licenses/>. *
+#                                                                         *
+#**************************************************************************
+import locale
+locale.setlocale(locale.LC_ALL, '')           #set locale from 'LANG'
+Xcodec=locale.getpreferredencoding(False)
+import os
+import sys
+import time
+import string
+import codecs
+import pygtk
+pygtk.require('2.0')
+import gtk
+import pango
+import gc
+
+I18N={}
+
+def i18n(text):
+    if I18N_ready:
+       if I18N.has_key(text): return I18N[text]
+       else: return text
+    else: return text
+
+def load_i18n(filename):
+     #lädt Internationalisierung.moo file
+     ready=False
+     lang=os.getenv('LANG')
+     if not lang: return ready
+     lang2='/usr/share/locale/'+lang[0:2] +'/LC_MESSAGES/'+filename
+     lang3='/usr/share/locale/'+lang[0:5] +'/LC_MESSAGES/'+filename
+     lang='no file'
+     if   os.access(lang3,os.R_OK): lang=lang3
+     elif os.access(lang2,os.R_OK): lang=lang2
+     if lang != 'no file':
+        f=codecs.open(lang,'r','utf_8')
+        if f:
+           lang=f.readlines()
+           f.close()
+           ready=True
+           for z in lang:
+               s=z.replace('\n','').split('=')
+               if s[0]=='': continue
+               I18N[s[0]]=s[1]
+     return ready
+
+def finden(arg,dir,filenames):
+    #subprocess of os.path.walk: get filenames in directorys
+    global fileliste
+    for text in filenames: 
+        filename=dir+os.sep+text
+        if os.path.isdir(filename): continue
+        fileliste.append(filename)
+
+def get_themes(picturepath):
+    #get filenames of all pictures in picturepath
+    global fileliste
+    fileliste=[]
+    os.path.walk(picturepath,finden,True)
+    themes=[]
+    for line in fileliste:
+        if ('.jpg' in line) or ('.png' in line) or ('.gif' in line) or ('.JPG' in line):
+           themes.append(line)
+    return themes
+
+def get_gtk2_themes():
+    #give all gtk2 Themes as List back
+    themes=[]
+    for line in os.listdir('/usr/share/themes'):
+        if os.access('/usr/share/themes/'+line+'/gtk-2.0/gtkrc',os.R_OK):
+           themes.append(os.path.basename(line))
+    return themes
+
+def get_lxdm_themes():
+    #give all lxdm Themes as List back
+    themes=[]
+    try:
+       for line in os.listdir('/usr/share/lxdm/themes'):
+           if os.access('/usr/share/lxdm/themes/'+line+'/gtkrc',os.R_OK):
+              themes.append(os.path.basename(line))
+    except:
+       return ['off'] 
+    return themes
+
+def read_entry(config,confkey,keydefault):
+    #read a config entry
+    l=len(confkey)
+    antwort=keydefault
+    for line in config:
+        if len(line)<l: continue
+        if line[0:1]=='#': continue
+        if line[0:l]==confkey: antwort=line[l:]   
+    return antwort
+
+def write_entry(config,section,confkey,keyvalue):
+    #write a config entry into section
+    myconfig=[]
+    found=False
+    mysection='[Flag]'
+    l=len(confkey) 
+    print 'write'+section+':',confkey+keyvalue
+    for line in config:
+        if len(line)>2:
+           if line[0]=='[':
+              newsection=line.strip()
+              if mysection==section:
+                 if found==False: 
+                    myconfig.append(confkey+keyvalue)
+                    found=True
+              mysection=newsection
+              myconfig.append(line)
+              continue 
+        if len(line)<l:
+           myconfig.append(line)
+           continue
+        if (line[0:l]==confkey) and (mysection==section):
+           found=True
+           myconfig.append(confkey+keyvalue)
+           continue
+        myconfig.append(line)
+    if found==False: 
+       myconfig.append(confkey+keyvalue)
+    return myconfig
+
+def delete_entry(config,confkey):
+    #delete a config entry
+    myconfig=[]
+    found=False
+    l=len(confkey) 
+    for line in config:
+        if len(line)<l:
+           myconfig.append(line)
+           continue
+        if line[0:l]==confkey:
+           found=True
+           continue
+        myconfig.append(line)
+    return myconfig
+class Tool:
+
+    def delete_event(self, widget, event, data=None):
+        # If you return FALSE in the "delete_event" signal handler,
+        # GTK will emit the "destroy" signal. Returning TRUE means
+        # you don't want the window to be destroyed.
+        # This is useful for popping up 'are you sure you want to quit?'
+        # type dialogs.
+        # Change FALSE to TRUE and the main window will not be destroyed
+        # with a "delete_event".
+        windowsize=self.window.get_size()
+        windowpos=self.window.get_position()
+        home=os.getenv('HOME')
+        home=home+'/.lxdmconf'
+        f=file(home,'w')
+        if f:
+           f.write('x=%i\n'      % windowpos[0])
+           f.write('y=%i\n'      % windowpos[1])
+           f.write('width=%i\n'  % windowsize[0])
+           f.write('height=%i\n' % windowsize[1])
+           f.close()
+        return False
+
+    def destroy(self, widget, data=None):
+        #wird beim beenden ausgeführt
+        gtk.main_quit()
+
+    def goodbye(self,data=None):
+        #Cancel Button is clicked
+        if not self.delete_event(self.window,data):
+           gtk.main_quit()
+
+
+    def save(self,data=None):
+        #Apply Button is clicked
+        print '==================================='       
+        os.system('mkdir  /etc/lxdm.d  2>/dev/null')
+
+        if self.cb_numlock.get_active(): 
+           self.config=write_entry(self.config,'[base]','numlock=','1')
+        else:
+           self.config=write_entry(self.config,'[base]','numlock=','0')
+
+        if self.cb_lang.get_active(): 
+           self.config=write_entry(self.config,'[display]','lang=','1')
+        else:
+           self.config=write_entry(self.config,'[display]','lang=','0')
+
+        if self.cb_bottom.get_active(): 
+           self.config=write_entry(self.config,'[display]','bottom_pane=','1')
+        else:
+           self.config=write_entry(self.config,'[display]','bottom_pane=','0')
+
+        if self.cb_autologin.get_active(): 
+           a=self.entryuser.get_text()
+           a=a.strip()
+           self.config=write_entry(self.config,'[base]','autologin=',a)
+        else:
+           self.config=delete_entry(self.config,'autologin=')      
+
+        a=self.entrysession.get_text()
+        a=a.strip()
+        if self.cb_session.get_active():
+           self.config=write_entry(self.config,'[base]','session=',a)
+        else:
+           self.config=delete_entry(self.config,'session=')
+
+        model = self.combobox.get_model()
+        index = self.combobox.get_active()
+        theme=model[index][0]
+        self.config=write_entry(self.config,'[display]','bg=',theme)
+
+        model = self.comboboxLXDM.get_model()
+        index = self.comboboxLXDM.get_active()
+        theme=model[index][0]
+        self.config=write_entry(self.config,'[display]','theme=',theme)
+
+        model = self.comboboxGTK.get_model()
+        index = self.comboboxGTK.get_active()
+        theme=model[index][0]
+        self.config=write_entry(self.config,'[display]','gtk_theme=',theme)
+
+        f=codecs.open('/etc/lxdm/lxdm.conf','w','utf_8')
+        for line in self.config:
+            text=line+'\n'
+            f.write(text)
+        f.close()
+        #gtk.main_quit()
+        self.goodbye()
+
+
+    def read_config(self):
+        filename='/etc/lxdm.d/lxdm_custom.conf'
+        if not os.access(filename,os.R_OK): filename='/etc/lxdm/lxdm.conf'
+        f=codecs.open(filename,'r','utf_8')
+        text=f.read()
+        f.close()
+        self.config=text.split('\n')
+
+        a=read_entry(self.config,"numlock=","0")
+        a=a.replace('\t', ' ')
+        a=a.strip()
+        print 'numlock=',a
+        if a=='1': 
+           self.cb_numlock.set_active(True)
+
+        a=read_entry(self.config,"lang=","1")
+        a=a.replace('\t', ' ')
+        a=a.strip()
+        print 'lang=',a
+        if a=='1': 
+           self.cb_lang.set_active(True)
+
+        a=read_entry(self.config,"bottom_pane=","1")
+        a=a.replace('\t', ' ')
+        a=a.strip()
+        print 'bottom_pane=',a
+        if a=='1': 
+           self.cb_bottom.set_active(True)
+
+        myusers=os.listdir('/home')
+        if len(myusers)>0: 
+           try:
+              myuser=unicode(myusers[0],'utf_8')
+           except:
+              myuser=unicode(myusers[0],'iso8859_15')
+        a=read_entry(self.config,"autologin=","_OFF")
+        a=a.replace('\t', ' ')
+        a=a.strip()
+        print 'autologin=',a
+        if a!='_OFF': 
+           self.cb_autologin.set_active(True)
+           self.entryuser.set_text(a)
+        else:
+           if len(myusers)>0: self.entryuser.set_text(myuser)
+
+
+        a=read_entry(self.config,"session=","/usr/bin/startlxde")
+        a=a.replace('\t', ' ')
+        a=a.strip()
+        print 'session=',a
+        self.entrysession.set_text(a)
+        a=read_entry(self.config,"session=","_OFF")
+        if a!='_OFF': self.cb_session.set_active(True)
+
+        a=read_entry(self.config,"bg=","/usr/share/wallpapers/default.png")
+        a=a.replace('\t', ' ')
+        a=a.strip()
+        print 'bg=',a
+        i=1
+        themes=get_themes('/usr/share/wallpapers')
+        for theme in themes:
+            if theme==a: self.combobox.set_active(i)
+            i+=1
+
+        a=read_entry(self.config,"theme=","Industrial")
+        a=a.replace('\t', ' ')
+        a=a.strip()
+        print 'theme=',a
+        i=0
+        themes=get_lxdm_themes()
+        for theme in themes:
+            if theme==a: self.comboboxLXDM.set_active(i)
+            i+=1
+
+        a=read_entry(self.config,"gtk_theme=","Clearlooks")
+        a=a.replace('\t', ' ')
+        a=a.strip()
+        print 'gtk_theme=',a
+        i=0
+        themes=get_gtk2_themes()
+        for theme in themes:
+            if theme==a: self.comboboxGTK.set_active(i)
+            i+=1
+
+
+
+    def theme_changed(self,data):               #Background picture has changed
+        model = self.combobox.get_model()
+        index = self.combobox.get_active()
+        filename=model[index][0]
+        try:
+           self.err=0
+           bild=gtk.gdk.pixbuf_new_from_file(filename)
+           bildvorschau=bild.scale_simple(360,240,gtk.gdk.INTERP_BILINEAR)
+           del bild
+           self.image.set_from_pixbuf(bildvorschau)
+           gc.collect()
+        except:
+           self.err=1
+           self.image.set_from_stock('gtk-stop', gtk.ICON_SIZE_DIALOG)
+
+
+    def lxdm_theme_changed(self,data):
+        if self.err==1:
+           try: 
+                model = self.comboboxLXDM.get_model()
+                index = self.comboboxLXDM.get_active()
+                filename='/usr/share/lxdm/themes/' + model[index][0] + '/'
+                f=codecs.open(filename + 'gtkrc','r','utf_8')
+                text2=f.read()
+                f.close()
+                text=text2.split('\n')          
+                text2='' 
+                found=0
+                a=len('style "')
+                b=len('style "back"')
+                for line in text:
+                    c=len(line)
+                    if c>=a:               
+                       if line[0:a]=='style "': 
+                          found=0
+                    if c>=b:
+                       if line[0:b]=='style "back"': 
+                          found=1
+                    if found==1:
+                       if 'file="' in line:
+                          text2=line.replace('\t','') 
+                          text2=text2.strip()
+                          text2=text2[5:].replace('"','')
+                bild=gtk.gdk.pixbuf_new_from_file(filename+text2)
+                bildvorschau=bild.scale_simple(360,240,gtk.gdk.INTERP_BILINEAR)
+                del bild
+                self.image.set_from_pixbuf(bildvorschau)
+                gc.collect()
+           except:
+                self.image.set_from_stock('gtk-stop', gtk.ICON_SIZE_DIALOG)
+                 
+
+
+    def __init__(self):
+        home=os.getenv('HOME')
+        if not home: sys.exit(1)
+        home=home+'/.lxdmconf'
+        if not os.access(home,os.R_OK):
+           f=file(home,'w')
+           f.write('x=0\n')
+           f.write('y=0\n')
+           f.write('width=500\n')
+           f.write('height=400\n')
+           f.close()
+        f=file(home,'r')
+        s=f.readline()
+        while s !='':
+           s=s.replace('\n','')
+           z=s.split('=')
+           if z[0]=='x':       self.pos_x=int(z[1])
+           if z[0]=='y':       self.pos_y=int(z[1])
+           if z[0]=='width':   self.width=int(z[1])
+           if z[0]=='height':  self.height=int(z[1])
+           s=f.readline()
+        f.close()
+
+        window = gtk.Window(gtk.WINDOW_TOPLEVEL)
+        self.window=window
+        vbox = gtk.VBox(False, 0)
+        window.add(vbox)
+
+        # When the window is given the "delete_event" signal (this is given
+        # by the window manager, usually by the "close" option, or on the
+        # titlebar), we ask it to call the delete_event () function
+        # as defined above. The data passed to the callback
+        # function is NULL and is ignored in the callback function.
+        window.connect("delete_event", self.delete_event)
+    
+        # Here we connect the "destroy" event to a signal handler.  
+        # This event occurs when we call gtk_widget_destroy() on the window,
+        # or if we return FALSE in the "delete_event" callback.
+        window.connect("destroy", self.destroy)
+    
+        # Sets the border width of the window.
+        window.set_title(i18n('lxdm Login Configuration'))
+        window.set_size_request(400,200)
+        window.resize(self.width, self.height)
+        window.move(self.pos_x,self.pos_y)
+
+        vbox2=gtk.VBox(False,0)
+        self.cb_numlock=gtk.CheckButton(i18n("Numlock"))
+        self.cb_lang=gtk.CheckButton(i18n("choose Language"))
+        self.cb_bottom=gtk.CheckButton(i18n("Bottom Pane"))
+        self.cb_autologin=gtk.CheckButton(i18n("autologin") + '       ')
+        label1=gtk.Label(i18n("User") + ':')
+        label1spacer=gtk.Label("     ")
+        self.entryuser=gtk.Entry(max=0)
+        hbox2 = gtk.HBox(False, 0)
+        hbox2.pack_start(self.cb_autologin,False,False,0)
+        hbox2.pack_start(label1,False,False,0)
+        hbox2.pack_start(self.entryuser,True,True,0)
+        #hbox2.pack_start(label1spacer,False,False,0)
+        vbox2.pack_start(self.cb_numlock,False,False,0)
+        vbox2.pack_start(self.cb_lang,False,False,0)
+        vbox2.pack_start(self.cb_bottom,False,False,0)
+        vbox2.pack_start(hbox2,False,False,0)
+        hbox3 = gtk.HBox(False, 0)
+        self.cb_session=gtk.CheckButton(i18n("session") + ':')
+        labelhspacer=gtk.Label(' ')
+        label2spacer=gtk.Label(" ")
+        self.entrysession=gtk.Entry(max=0)
+        hbox3.pack_start(self.cb_session,False,False,0)
+        hbox3.pack_start(self.entrysession,True,True,0)
+        #hbox3.pack_start(label2spacer,False,False,0)
+        vbox2.set_border_width(20)
+        vbox2.pack_start(labelhspacer,True,True,0)
+        vbox2.pack_start(hbox3,False,False,0)
+
+        self.image=gtk.Image()
+        hbox5 = gtk.HBox(False, 0)
+        hbox4 = gtk.HBox(False, 0)
+        vbox4 = gtk.VBox(False, 0)
+        labeltext=i18n('Theme')
+        label2=gtk.Label(i18n('Background')+':')
+        label12=gtk.Label('  GTK2-'+labeltext+':')
+        label13=gtk.Label(labeltext+':')
+        self.comboboxGTK = gtk.combo_box_new_text()
+        themes=get_gtk2_themes()
+        for theme in themes:
+            self.comboboxGTK.append_text(theme)
+        self.comboboxLXDM = gtk.combo_box_new_text()
+        themes=get_lxdm_themes()
+        for theme in themes:
+            self.comboboxLXDM.append_text(theme)
+        self.combobox = gtk.combo_box_new_text()
+        self.combobox.connect( 'changed', self.theme_changed)
+        self.combobox.append_text(labeltext)
+        themes=get_themes('/usr/share/wallpapers')
+        for theme in themes:
+            self.combobox.append_text(theme)
+        self.combobox.set_active(0)
+        self.comboboxLXDM.connect( 'changed', self.lxdm_theme_changed)
+        hbox5.pack_start(label13,False,False,0)
+        hbox5.pack_start(self.comboboxLXDM,True,True,0)
+        hbox5.pack_start(label12,False,False,0)
+        hbox5.pack_start(self.comboboxGTK,True,True,0)
+        hbox4.pack_start(label2,False,False,0)
+        hbox4.pack_start(self.combobox,True,True,0)
+        vbox4.pack_start(hbox5,False,False,0)
+        vbox4.pack_start(hbox4,False,False,0)
+        vbox4.pack_start(self.image,True,True,0)
+        notebook = gtk.Notebook()
+        notebook.set_tab_pos(gtk.POS_TOP)
+        tab_label1=gtk.Label(i18n('General'))
+        tab_label2=gtk.Label(i18n('Themes'))
+        notebook.append_page(vbox2,tab_label1) 
+        notebook.append_page(vbox4,tab_label2) 
+
+        vbox.pack_start(notebook, True, True, 0)
+
+        hbox = gtk.HBox(False, 0)
+        button1=gtk.Button(stock='gtk-apply')
+        hiddenlabel=gtk.Label(' ')
+        button2=gtk.Button(stock='gtk-cancel')
+        hbox.pack_start(button1,False,False,0)
+        hbox.pack_start(hiddenlabel,True,True,0)
+        hbox.pack_start(button2,False,False,0)
+        button1.connect_object("clicked", self.save,None)
+        button2.connect_object("clicked", self.goodbye,None)
+        self.combobox.set_tooltip_text('/usr/share/wallpapers')
+
+        vbox.pack_end(hbox, False, False, 5)
+        window.set_border_width(2)
+        self.read_config()
+        window.show_all()
+        userid=os.getuid()
+        if userid!=0:
+               dialog = gtk.MessageDialog(self.window, gtk.DIALOG_MODAL,gtk.MESSAGE_ERROR,gtk.BUTTONS_OK, "ERROR: not root!")
+               result = dialog.run()
+               dialog.destroy()
+               sys.exit(1)
+
+
+    def main(self):
+        # All PyGTK applications must have a gtk.main(). Control ends here
+        # and waits for an event to occur (like a key press or mouse event).
+        gtk.main()
+
+
+
+# If the program is run directly or passed as an argument to the python
+# interpreter then create a HelloWorld instance and show it
+if __name__ == "__main__":
+     codec1=Xcodec.lower().replace('iso-','iso').replace('-','_')
+     if 'ansi' in codec1: codec1='iso8859_1'  #Ansi is shit...
+     I18N_ready = load_i18n('lxdmconf.moo')
+     Elfriede = Tool()
+     Elfriede.main()
+
+
+
index b21981d..5a2988b 100644 (file)
@@ -2,5 +2,18 @@ NULL=
 
 SUBDIRS=
 
-EXTRA_DIST = \
+bin_SCRIPTS = lxproxy.py
+
+lxproxydir = $(prefix)/bin
+
+lxproxy_PYTHON = \
+    AboutLxproxyDialog.py \
+    lxproxyconfig.py \
+    PreferencesLxproxyDialog.py
+
+DISTCLEANFILES = $(bin_SCRIPTS)         
+
+EXTRA_DIST =  \
+    $(bin_SCRIPTS) \
+    $(lxproxy_PYTHON) \
        $(NULL)
index b21981d..4c2dade 100644 (file)
@@ -2,5 +2,12 @@ NULL=
 
 SUBDIRS=
 
-EXTRA_DIST = \
+bin_SCRIPTS = openbox-keyconf.py
+
+openbox-keyconfdir = $(prefix)/bin
+
+DISTCLEANFILES = $(bin_SCRIPTS)         
+
+EXTRA_DIST =  \
+    $(bin_SCRIPTS) \
        $(NULL)
diff --git a/src/openbox-keyconf/openbox-keyconf b/src/openbox-keyconf/openbox-keyconf
deleted file mode 100755 (executable)
index 2e42387..0000000
+++ /dev/null
@@ -1,572 +0,0 @@
-#!/usr/bin/python
-# -*- coding: UTF-8 -*-
-#**************************************************************************
-#                                                                         *
-#   Copyright (c) 2010 by Elfriede Apfelkuchen                            *
-#                                                                         *
-#   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 3 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, see <http://www.gnu.org/licenses/>. *
-#                                                                         *
-#**************************************************************************
-
-helptext="""M = [Mod3]
-W = [Windows]
-S = [Shift]
-A = [Alt]
-C = [Control]
-
-F1,F2,F3,F4,F5,F6,F7,F8,F9,F10,F11,F12
-Escape
-Return
-Menu
-Tab
-Pause
-space
-Print
-Caps_Lock
-Scroll_Lock
-Num_Lock
-Insert
-Delete
-BackSpace
-Home  = [Pos1]
-End   = [End]
-Prior = [PageUp]
-Next  = [PageDown]
-asciicircum =  [^]
-less        =  [<]
-greater     =  [>]
-minus       =  [-]
-plus        =  [+]
-comma       =  [,]
-period      =  [.]
-numbersign  =  [#]
-acute       =  [´]
-
-Left,Right,Up,Down
-_____________________
-
-[Keypad/Numberblock]
-
-KP_0, KP_1, KP_2, KP_3, KP_4, KP_5, KP_6, KP_7, KP_8, KP_9
-KP_Divide   = [/]
-KP_Multiply = [*]
-KP_Subtract = [-]
-KP_Add      = [+]
-KP_Enter
-KP_Begin  = [5]
-KP_Home   = [7]
-KP_End    = [1]
-KP_Prior  = [9] [PageUp]
-KP_Next   = [3] [PageDown]
-KP_Up     = [8] [cursor up]     
-KP_Down   = [2] [cursor down]
-KP_Left   = [4] [cursor left]
-KP_Right  = [6] [cursor right]
-
-for more keycodes start "xev" in a terminal"""
-
-
-
-
-import locale
-locale.setlocale(locale.LC_ALL, '')           #set locale from 'LANG'
-Xcodec=locale.getpreferredencoding(False)
-import os
-import sys
-import time
-import string
-import codecs
-import pygtk
-pygtk.require('2.0')
-import gtk
-import pango
-import gobject
-import gc
-
-configfile=".config/openbox/lxde-rc.xml"
-mybuffer=None
-helpwindow=None
-I18N={}
-
-def i18n(text):
-    if I18N_ready:
-       if I18N.has_key(text): return I18N[text]
-       else: return text
-    else: return text
-
-def load_i18n(filename):
-     #lädt Internationalisierung.moo file
-     ready=False
-     lang=os.getenv('LANG')
-     if not lang: return ready
-     lang2='/usr/share/locale/'+lang[0:2] +'/LC_MESSAGES/'+filename
-     lang3='/usr/share/locale/'+lang[0:5] +'/LC_MESSAGES/'+filename
-     lang='no file'
-     if   os.access(lang3,os.R_OK): lang=lang3
-     elif os.access(lang2,os.R_OK): lang=lang2
-     if lang != 'no file':
-        f=codecs.open(lang,'r','utf_8')
-        if f:
-           lang=f.readlines()
-           f.close()
-           ready=True
-           for z in lang:
-               s=z.replace('\n','').split('=')
-               if s[0]=='': continue
-               I18N[s[0]]=s[1]
-     return ready
-
-
-def create_help_view(data=None):
-    global helpwindow,mybuffer
-    if mybuffer!=None: 
-       helpwindow.show()
-       helpwindow.present()
-       return
-    helpwindow = gtk.Window(gtk.WINDOW_TOPLEVEL)
-    helpwindow.set_title(i18n('Help: keyboard codes'))
-    helpwindow.set_size_request(600,400)
-    helpwindow.set_position(gtk.WIN_POS_CENTER_ALWAYS)
-    helpwindow.connect("destroy", destroy_help_view)
-    view=gtk.TextView()
-    view.set_editable(False)
-    view.set_cursor_visible(False)
-    view.set_pixels_above_lines(0)
-    view.set_pixels_below_lines(0)
-    view.set_pixels_inside_wrap(0)
-    view.set_wrap_mode(gtk.WRAP_NONE)
-    font_desc = pango.FontDescription('Monospace 12')
-    if font_desc:
-       view.modify_font(font_desc)
-    sw = gtk.ScrolledWindow()
-    sw.set_shadow_type(gtk.SHADOW_ETCHED_IN)
-    sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
-    sw.add(view)
-    mybuffer=view.get_buffer()
-    mybuffer.set_text(helptext)
-    helpwindow.add(sw) 
-    helpwindow.show_all()
-    
-
-def destroy_help_view(widget, data=None):
-    global helpwindow,mybuffer
-    helpwindow.destroy()
-    helpwindow=None
-    mybuffer=None
-
-
-
-class Tool:
-
-    def delete_event(self, widget, event, data=None):
-        # If you return FALSE in the "delete_event" signal handler,
-        # GTK will emit the "destroy" signal. Returning TRUE means
-        # you don't want the window to be destroyed.
-        # This is useful for popping up 'are you sure you want to quit?'
-        # type dialogs.
-        # Change FALSE to TRUE and the main window will not be destroyed
-        # with a "delete_event".
-        windowsize=self.window.get_size()
-        windowpos=self.window.get_position()
-        filenamen=home+'/.openbox-keyconf'
-        f=file(filenamen,'w')
-        if f:
-           f.write('x=%i\n'      % windowpos[0])
-           f.write('y=%i\n'      % windowpos[1])
-           f.write('width=%i\n'  % windowsize[0])
-           f.write('height=%i\n' % windowsize[1])
-           f.close()
-        return False
-
-
-    def destroy(self, widget, data=None):
-        #wird beim beenden ausgeführt
-        gtk.main_quit()
-
-
-    def goodbye(self,data=None):
-        #Cancel Button is clicked
-        if not self.delete_event(self.window,data):
-           gtk.main_quit()
-
-
-    def get_pathnumber(self,keycode):
-        # return pathnumber of a given keycode
-        for i in range(self.count_list):
-            if self.liststore[i][0]==keycode: break
-        if self.liststore[i][0]!=keycode: return -1  
-        if self.liststore[i][3]=='add':   return -1
-        return i
-
-
-    def save(self,data=None):
-        #Apply button is clicked
-        filename=home+'/'+configfile
-        text=''
-        try:
-           f=codecs.open(filename,'r','utf_8')
-           text=f.read()
-           config=text.split('\n')
-           f.close()
-        except:
-           print "can't read",filename 
-        for i in range(self.count_list):
-            a=self.liststore[i][1]
-            b=self.liststore[i][2]
-            c=self.liststore[i][3]
-            d=self.liststore[i][0]
-            if c!='orginal':
-               if c=='delete': print c,d 
-               else: print a,b
-        gc.collect()
-
-        f=codecs.open(filename,'w','utf_8')
-        found=False
-        cutting=False 
-        for line in config:
-            if '<keyboard>' in line:
-               found=True
-               f.write(line+'\n')
-               continue
-            if '</keyboard>' in line:
-               found=False
-               # add keybinding code
-               for i in range(self.count_list): 
-                   s=self.liststore[i][3]
-                   if s=='add':
-                      f.write('    <keybind key="'+self.liststore[i][1]+'">\n')
-                      a=self.liststore[i][2]
-                      a=a.split('command=')
-                      b=a[1].split(',)')
-                      f.write('      <action name="Execute">\n')
-                      f.write('        <command>'+b[0]+'</command>\n')
-                      f.write('      </action>\n')
-                      f.write('    </keybind>\n')
-               f.write(line+'\n')
-               continue
-            if not found:
-               f.write(line+'\n')
-               continue
-            if cutting:
-               if '</keybind>' in line: cutting=False
-               continue    
-            if '<keybind ' in line: 
-               lin=line.split('"')
-               p=self.get_pathnumber(lin[1])
-               if p==-1:
-                  f.write(line+'\n')
-                  continue
-               s=self.liststore[p][3]
-               if s=='orginal':
-                  f.write(line+'\n')
-                  continue
-               if s=='delete':
-                  cutting=True
-                  continue 
-               if s=='name':
-                  f.write('    <keybind key="'+self.liststore[p][1]+'">\n')
-                  continue
-               if s=='execute':
-                  f.write('    <keybind key="'+self.liststore[p][1]+'">\n')
-                  a=self.liststore[p][2]
-                  a=a.split('command=')
-                  b=a[1].split(',)')
-                  f.write('      <action name="Execute">\n')
-                  f.write('        <command>'+b[0]+'</command>\n')
-                  f.write('      </action>\n')
-                  f.write('    </keybind>\n')
-                  cutting=True
-                  continue
-            f.write(line+'\n')
-        f.flush()
-        f.close()
-        os.system('openbox --reconfigure')
-        self.goodbye()
-
-
-    def mouse(self, widget, event, data=None):
-        if event.button==1:
-           # a keybinding in the treeview is clicked
-           pathinfo=self.treeview.get_path_at_pos(int(event.x),int(event.y)) 
-           if pathinfo==None: return False
-           pathnr=pathinfo[0][0]  
-           name=self.liststore[pathnr][1]
-           action=self.liststore[pathnr][2]
-           self.lock=True
-           self.cb_exec.set_active(False)
-           self.execute.set_sensitive(0)
-           if 'command=' in action:
-              a1=action.split('command=')
-              a2=a1[1].split(',)')
-              self.execute.set_text(a2[0])
-              self.hbox.show()
-           else: self.hbox.hide()
-           self.path=pathnr
-           self.keys.set_text(name)
-           self.action.set_text(action)
-           self.lock=False
-   
-    
-    def row_activate(self, treeview, pathnr, column): 
-           # a keybinding is selected by doubleclick or keyboard
-           name=self.liststore[pathnr][1]
-           action=self.liststore[pathnr][2]
-           self.lock=True
-           self.cb_exec.set_active(False)
-           self.execute.set_sensitive(0)
-           if 'command=' in action:
-              a1=action.split('command=')
-              a2=a1[1].split(',)')
-              self.execute.set_text(a2[0])
-              self.hbox.show()
-           else: self.hbox.hide()
-           self.path=pathnr
-           self.keys.set_text(name)
-           self.action.set_text(action)
-           self.lock=False
-
-
-    def keys_changed(self,data):
-        if self.lock: return 
-        if self.path==-1: return  
-        a=self.keys.get_text() 
-        a=a.strip()
-        self.liststore[self.path][1]=a
-        b=self.liststore[self.path][3]
-        if b=='orginal': self.liststore[self.path][3]='name'
-
-
-    def execute_entry_changed(self,data):
-        if self.lock: return 
-        if self.path==-1: return  
-        a=self.execute.get_text() 
-        a=a.strip()
-        b='Execute(command='+a+',)'
-        self.liststore[self.path][2]=b
-        self.action.set_text(b)
-        
-
-    def add_new_keybinding(self,data=None):
-        self.count_list+=1
-        self.liststore.append(['F12','F12','Execute(command='+i18n("NameOfProgram")+',)','add'])     
-
-
-    def delete_keybinding(self,data=None):
-        if self.lock: return  
-        if self.path==-1: return  
-        self.hbox.hide()
-        self.liststore[self.path][1]=""
-        self.liststore[self.path][2]=""
-        self.liststore[self.path][3]="delete"
-        self.action.set_text('')
-        self.keys.set_text('')
-
-
-    def toggle_execute_entry(self,data=None):
-        if self.lock: return 
-        if self.path!=-1: b=self.liststore[self.path][3]
-        s=self.cb_exec.get_active()
-        if s: 
-           self.execute.set_sensitive(1)
-           if self.path!=-1:
-              if (b=='orginal')or(b=='name'):
-                  self.liststore[self.path][3]='execute'
-        else: 
-           self.execute.set_sensitive(0)
-           if self.path!=-1:
-              if (b=='execute'):
-                  self.liststore[self.path][3]='name'
-
-
-    def __init__(self):
-        namen=home+'/.openbox-keyconf'
-        if not os.access(namen,os.R_OK):
-           f=file(namen,'w')
-           f.write('x=0\n')
-           f.write('y=0\n')
-           f.write('width=800\n')
-           f.write('height=400\n')
-           f.close()
-        f=file(namen,'r')
-        s=f.readline()
-        while s !='':
-           s=s.replace('\n','')
-           z=s.split('=')
-           if z[0]=='x':       self.pos_x=int(z[1])
-           if z[0]=='y':       self.pos_y=int(z[1])
-           if z[0]=='width':   self.width=int(z[1])
-           if z[0]=='height':  self.height=int(z[1])
-           s=f.readline()
-        f.close()
-
-        window = gtk.Window(gtk.WINDOW_TOPLEVEL)
-        self.window=window
-        vbox = gtk.VBox(False, 0)
-        window.set_border_width(5)
-        window.add(vbox)
-
-        # When the window is given the "delete_event" signal (this is given
-        # by the window manager, usually by the "close" option, or on the
-        # titlebar), we ask it to call the delete_event () function
-        # as defined above. The data passed to the callback
-        # function is NULL and is ignored in the callback function.
-        window.connect("delete_event", self.delete_event)
-    
-        # Here we connect the "destroy" event to a signal handler.  
-        # This event occurs when we call gtk_widget_destroy() on the window,
-        # or if we return FALSE in the "delete_event" callback.
-        window.connect("destroy", self.destroy)
-    
-        # Sets the border width of the window.
-        window.set_title(i18n('openbox keyboard bindings'))
-        window.set_size_request(400,200)
-        window.resize(self.width, self.height)
-        window.move(self.pos_x,self.pos_y)
-
-        self.liststore=gtk.ListStore(str,str,str,str)
-        self.treeview=gtk.TreeView()
-        self.treeview.set_headers_visible(True)
-        self.treeview.set_model(self.liststore) 
-        self.treeview.set_property('rules-hint',True)
-        self.treeview.set_property('enable-grid-lines',True)
-        self.treeview.connect('row-activated', self.row_activate)
-        self.treeview.set_events(self.treeview.get_events() | gtk.gdk.BUTTON_PRESS_MASK)
-        self.treeview.connect("button-press-event", self.mouse)
-        self.cell1 = gtk.CellRendererText()
-        self.cell2 = gtk.CellRendererText()
-        self.spalte1 = gtk.TreeViewColumn(i18n('Key'))
-        self.spalte2 = gtk.TreeViewColumn(i18n('Action'))
-        self.treeview.append_column(self.spalte1)
-        self.treeview.append_column(self.spalte2)
-        self.spalte1.pack_start(self.cell1,True)
-        self.spalte2.pack_start(self.cell2,True)
-        self.spalte1.set_attributes(self.cell1, text=1)
-        self.spalte2.set_attributes(self.cell2, text=2)
-        sw = gtk.ScrolledWindow()
-        sw.set_shadow_type(gtk.SHADOW_ETCHED_IN)
-        sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
-        sw.add(self.treeview)
-        filename=home+'/'+configfile
-        self.count_list=0
-        try:
-           f=codecs.open(filename,'r','utf_8')
-           line=f.readline()
-           found=False
-           data='frog'
-           action=False
-           name=''
-           while True: 
-                 line=f.readline()
-                 if not line: break
-                 if '<keyboard>' in line:
-                    found=True
-                    continue
-                 if '</keyboard>' in line: 
-                    found=False
-                 if not found: continue
-                 lin=line.replace('\n','')
-                 if '<keybind ' in lin:
-                    lin2=lin.split('"') 
-                    name=lin2[1]
-                    action=False 
-                    data=''
-                    continue
-                 if '</keybind>' in lin:                 
-                    if action: data+=')'
-                    if name!='': 
-                       self.liststore.append([name,name,data,'orginal'])
-                       self.count_list+=1
-                    name=''
-                    continue
-                 if name!='':
-                    if '</action>' in lin: continue
-                    if '<action ' in lin:   
-                       if action: data+='), ' 
-                       action=True
-                       lin2=lin.split('"') 
-                       data=data+lin2[1]+'('
-                       continue
-                    if '<startupnotify>' in lin:
-                       continue 
-                    if '</startupnotify>' in lin:
-                       continue 
-                    if ('<' in lin) and ('>' in lin):
-                       lin2=lin.split('<')
-                       lin3=lin2[1].split('>')
-                       data=data+lin3[0]+'='+lin3[1]+','
-                 continue
-           f.close()
-        except:
-           pass
-        gc.collect()
-        self.lock=True
-        self.path=-1
-        hbox = gtk.HBox(False, 5)
-        self.keys=gtk.Entry(max=40)
-        self.keys.connect("changed",self.keys_changed)
-        self.action=gtk.Label('')
-        hbox.pack_start(self.keys,False,False,0)
-        hbox.pack_start(self.action,True,True,0)
-        vbox.pack_start(hbox, False,False, 0)
-        self.hbox = gtk.HBox(False, 5)
-        self.cb_exec=gtk.CheckButton(i18n("Edit command")+" =")
-        self.cb_exec.connect_object("toggled",self.toggle_execute_entry,None)
-        self.execute=gtk.Entry(max=0) 
-        self.execute.connect("changed",self.execute_entry_changed)
-        self.hbox.pack_start(self.cb_exec,False,False,0)
-        self.hbox.pack_start(self.execute,True,True,0)
-        vbox.pack_start(self.hbox, False,False, 0)
-        vbox.pack_start(sw, True, True, 0)
-        hbox = gtk.HBox(False, 5)
-        button1=gtk.Button(stock='gtk-apply')
-        hiddenlabel=gtk.Label(' ')
-        button2=gtk.Button(stock='gtk-cancel')
-        button3=gtk.Button(stock='gtk-add')
-        button4=gtk.Button(stock='gtk-delete')
-        button5=gtk.Button(stock='gtk-help')
-        hbox.pack_start(button1,False,False,0)
-        hbox.pack_start(button3,False,False,0)
-        hbox.pack_start(button4,False,False,0)
-        hbox.pack_start(button5,False,False,0)
-        hbox.pack_start(hiddenlabel,True,True,0)
-        hbox.pack_start(button2,False,False,0)
-        button1.connect_object("clicked", self.save,None)
-        button2.connect_object("clicked", self.goodbye,None)
-        button3.connect_object("clicked", self.add_new_keybinding,None)
-        button4.connect_object("clicked", self.delete_keybinding,None)
-        button5.connect("clicked", create_help_view)
-        vbox.pack_end(hbox, False, False, 0)
-        window.show_all() 
-        self.hbox.hide()       
-
-
-    def main(self):
-        # All PyGTK applications must have a gtk.main(). Control ends here
-        # and waits for an event to occur (like a key press or mouse event).
-        gtk.main()
-
-
-
-# If the program is run directly or passed as an argument to the python
-# interpreter then create a HelloWorld instance and show it
-if __name__ == "__main__":
-     home=os.getenv("HOME")
-     codec1=Xcodec.lower().replace('iso-','iso').replace('-','_')
-     if 'ansi' in codec1: codec1='iso8859_1'  #Ansi is shit...
-     I18N_ready = load_i18n('openbox-keyconf.moo')
-     Elfriede = Tool()
-     Elfriede.main()
-
-
-
diff --git a/src/openbox-keyconf/openbox-keyconf.py b/src/openbox-keyconf/openbox-keyconf.py
new file mode 100755 (executable)
index 0000000..2e42387
--- /dev/null
@@ -0,0 +1,572 @@
+#!/usr/bin/python
+# -*- coding: UTF-8 -*-
+#**************************************************************************
+#                                                                         *
+#   Copyright (c) 2010 by Elfriede Apfelkuchen                            *
+#                                                                         *
+#   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 3 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, see <http://www.gnu.org/licenses/>. *
+#                                                                         *
+#**************************************************************************
+
+helptext="""M = [Mod3]
+W = [Windows]
+S = [Shift]
+A = [Alt]
+C = [Control]
+
+F1,F2,F3,F4,F5,F6,F7,F8,F9,F10,F11,F12
+Escape
+Return
+Menu
+Tab
+Pause
+space
+Print
+Caps_Lock
+Scroll_Lock
+Num_Lock
+Insert
+Delete
+BackSpace
+Home  = [Pos1]
+End   = [End]
+Prior = [PageUp]
+Next  = [PageDown]
+asciicircum =  [^]
+less        =  [<]
+greater     =  [>]
+minus       =  [-]
+plus        =  [+]
+comma       =  [,]
+period      =  [.]
+numbersign  =  [#]
+acute       =  [´]
+
+Left,Right,Up,Down
+_____________________
+
+[Keypad/Numberblock]
+
+KP_0, KP_1, KP_2, KP_3, KP_4, KP_5, KP_6, KP_7, KP_8, KP_9
+KP_Divide   = [/]
+KP_Multiply = [*]
+KP_Subtract = [-]
+KP_Add      = [+]
+KP_Enter
+KP_Begin  = [5]
+KP_Home   = [7]
+KP_End    = [1]
+KP_Prior  = [9] [PageUp]
+KP_Next   = [3] [PageDown]
+KP_Up     = [8] [cursor up]     
+KP_Down   = [2] [cursor down]
+KP_Left   = [4] [cursor left]
+KP_Right  = [6] [cursor right]
+
+for more keycodes start "xev" in a terminal"""
+
+
+
+
+import locale
+locale.setlocale(locale.LC_ALL, '')           #set locale from 'LANG'
+Xcodec=locale.getpreferredencoding(False)
+import os
+import sys
+import time
+import string
+import codecs
+import pygtk
+pygtk.require('2.0')
+import gtk
+import pango
+import gobject
+import gc
+
+configfile=".config/openbox/lxde-rc.xml"
+mybuffer=None
+helpwindow=None
+I18N={}
+
+def i18n(text):
+    if I18N_ready:
+       if I18N.has_key(text): return I18N[text]
+       else: return text
+    else: return text
+
+def load_i18n(filename):
+     #lädt Internationalisierung.moo file
+     ready=False
+     lang=os.getenv('LANG')
+     if not lang: return ready
+     lang2='/usr/share/locale/'+lang[0:2] +'/LC_MESSAGES/'+filename
+     lang3='/usr/share/locale/'+lang[0:5] +'/LC_MESSAGES/'+filename
+     lang='no file'
+     if   os.access(lang3,os.R_OK): lang=lang3
+     elif os.access(lang2,os.R_OK): lang=lang2
+     if lang != 'no file':
+        f=codecs.open(lang,'r','utf_8')
+        if f:
+           lang=f.readlines()
+           f.close()
+           ready=True
+           for z in lang:
+               s=z.replace('\n','').split('=')
+               if s[0]=='': continue
+               I18N[s[0]]=s[1]
+     return ready
+
+
+def create_help_view(data=None):
+    global helpwindow,mybuffer
+    if mybuffer!=None: 
+       helpwindow.show()
+       helpwindow.present()
+       return
+    helpwindow = gtk.Window(gtk.WINDOW_TOPLEVEL)
+    helpwindow.set_title(i18n('Help: keyboard codes'))
+    helpwindow.set_size_request(600,400)
+    helpwindow.set_position(gtk.WIN_POS_CENTER_ALWAYS)
+    helpwindow.connect("destroy", destroy_help_view)
+    view=gtk.TextView()
+    view.set_editable(False)
+    view.set_cursor_visible(False)
+    view.set_pixels_above_lines(0)
+    view.set_pixels_below_lines(0)
+    view.set_pixels_inside_wrap(0)
+    view.set_wrap_mode(gtk.WRAP_NONE)
+    font_desc = pango.FontDescription('Monospace 12')
+    if font_desc:
+       view.modify_font(font_desc)
+    sw = gtk.ScrolledWindow()
+    sw.set_shadow_type(gtk.SHADOW_ETCHED_IN)
+    sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
+    sw.add(view)
+    mybuffer=view.get_buffer()
+    mybuffer.set_text(helptext)
+    helpwindow.add(sw) 
+    helpwindow.show_all()
+    
+
+def destroy_help_view(widget, data=None):
+    global helpwindow,mybuffer
+    helpwindow.destroy()
+    helpwindow=None
+    mybuffer=None
+
+
+
+class Tool:
+
+    def delete_event(self, widget, event, data=None):
+        # If you return FALSE in the "delete_event" signal handler,
+        # GTK will emit the "destroy" signal. Returning TRUE means
+        # you don't want the window to be destroyed.
+        # This is useful for popping up 'are you sure you want to quit?'
+        # type dialogs.
+        # Change FALSE to TRUE and the main window will not be destroyed
+        # with a "delete_event".
+        windowsize=self.window.get_size()
+        windowpos=self.window.get_position()
+        filenamen=home+'/.openbox-keyconf'
+        f=file(filenamen,'w')
+        if f:
+           f.write('x=%i\n'      % windowpos[0])
+           f.write('y=%i\n'      % windowpos[1])
+           f.write('width=%i\n'  % windowsize[0])
+           f.write('height=%i\n' % windowsize[1])
+           f.close()
+        return False
+
+
+    def destroy(self, widget, data=None):
+        #wird beim beenden ausgeführt
+        gtk.main_quit()
+
+
+    def goodbye(self,data=None):
+        #Cancel Button is clicked
+        if not self.delete_event(self.window,data):
+           gtk.main_quit()
+
+
+    def get_pathnumber(self,keycode):
+        # return pathnumber of a given keycode
+        for i in range(self.count_list):
+            if self.liststore[i][0]==keycode: break
+        if self.liststore[i][0]!=keycode: return -1  
+        if self.liststore[i][3]=='add':   return -1
+        return i
+
+
+    def save(self,data=None):
+        #Apply button is clicked
+        filename=home+'/'+configfile
+        text=''
+        try:
+           f=codecs.open(filename,'r','utf_8')
+           text=f.read()
+           config=text.split('\n')
+           f.close()
+        except:
+           print "can't read",filename 
+        for i in range(self.count_list):
+            a=self.liststore[i][1]
+            b=self.liststore[i][2]
+            c=self.liststore[i][3]
+            d=self.liststore[i][0]
+            if c!='orginal':
+               if c=='delete': print c,d 
+               else: print a,b
+        gc.collect()
+
+        f=codecs.open(filename,'w','utf_8')
+        found=False
+        cutting=False 
+        for line in config:
+            if '<keyboard>' in line:
+               found=True
+               f.write(line+'\n')
+               continue
+            if '</keyboard>' in line:
+               found=False
+               # add keybinding code
+               for i in range(self.count_list): 
+                   s=self.liststore[i][3]
+                   if s=='add':
+                      f.write('    <keybind key="'+self.liststore[i][1]+'">\n')
+                      a=self.liststore[i][2]
+                      a=a.split('command=')
+                      b=a[1].split(',)')
+                      f.write('      <action name="Execute">\n')
+                      f.write('        <command>'+b[0]+'</command>\n')
+                      f.write('      </action>\n')
+                      f.write('    </keybind>\n')
+               f.write(line+'\n')
+               continue
+            if not found:
+               f.write(line+'\n')
+               continue
+            if cutting:
+               if '</keybind>' in line: cutting=False
+               continue    
+            if '<keybind ' in line: 
+               lin=line.split('"')
+               p=self.get_pathnumber(lin[1])
+               if p==-1:
+                  f.write(line+'\n')
+                  continue
+               s=self.liststore[p][3]
+               if s=='orginal':
+                  f.write(line+'\n')
+                  continue
+               if s=='delete':
+                  cutting=True
+                  continue 
+               if s=='name':
+                  f.write('    <keybind key="'+self.liststore[p][1]+'">\n')
+                  continue
+               if s=='execute':
+                  f.write('    <keybind key="'+self.liststore[p][1]+'">\n')
+                  a=self.liststore[p][2]
+                  a=a.split('command=')
+                  b=a[1].split(',)')
+                  f.write('      <action name="Execute">\n')
+                  f.write('        <command>'+b[0]+'</command>\n')
+                  f.write('      </action>\n')
+                  f.write('    </keybind>\n')
+                  cutting=True
+                  continue
+            f.write(line+'\n')
+        f.flush()
+        f.close()
+        os.system('openbox --reconfigure')
+        self.goodbye()
+
+
+    def mouse(self, widget, event, data=None):
+        if event.button==1:
+           # a keybinding in the treeview is clicked
+           pathinfo=self.treeview.get_path_at_pos(int(event.x),int(event.y)) 
+           if pathinfo==None: return False
+           pathnr=pathinfo[0][0]  
+           name=self.liststore[pathnr][1]
+           action=self.liststore[pathnr][2]
+           self.lock=True
+           self.cb_exec.set_active(False)
+           self.execute.set_sensitive(0)
+           if 'command=' in action:
+              a1=action.split('command=')
+              a2=a1[1].split(',)')
+              self.execute.set_text(a2[0])
+              self.hbox.show()
+           else: self.hbox.hide()
+           self.path=pathnr
+           self.keys.set_text(name)
+           self.action.set_text(action)
+           self.lock=False
+   
+    
+    def row_activate(self, treeview, pathnr, column): 
+           # a keybinding is selected by doubleclick or keyboard
+           name=self.liststore[pathnr][1]
+           action=self.liststore[pathnr][2]
+           self.lock=True
+           self.cb_exec.set_active(False)
+           self.execute.set_sensitive(0)
+           if 'command=' in action:
+              a1=action.split('command=')
+              a2=a1[1].split(',)')
+              self.execute.set_text(a2[0])
+              self.hbox.show()
+           else: self.hbox.hide()
+           self.path=pathnr
+           self.keys.set_text(name)
+           self.action.set_text(action)
+           self.lock=False
+
+
+    def keys_changed(self,data):
+        if self.lock: return 
+        if self.path==-1: return  
+        a=self.keys.get_text() 
+        a=a.strip()
+        self.liststore[self.path][1]=a
+        b=self.liststore[self.path][3]
+        if b=='orginal': self.liststore[self.path][3]='name'
+
+
+    def execute_entry_changed(self,data):
+        if self.lock: return 
+        if self.path==-1: return  
+        a=self.execute.get_text() 
+        a=a.strip()
+        b='Execute(command='+a+',)'
+        self.liststore[self.path][2]=b
+        self.action.set_text(b)
+        
+
+    def add_new_keybinding(self,data=None):
+        self.count_list+=1
+        self.liststore.append(['F12','F12','Execute(command='+i18n("NameOfProgram")+',)','add'])     
+
+
+    def delete_keybinding(self,data=None):
+        if self.lock: return  
+        if self.path==-1: return  
+        self.hbox.hide()
+        self.liststore[self.path][1]=""
+        self.liststore[self.path][2]=""
+        self.liststore[self.path][3]="delete"
+        self.action.set_text('')
+        self.keys.set_text('')
+
+
+    def toggle_execute_entry(self,data=None):
+        if self.lock: return 
+        if self.path!=-1: b=self.liststore[self.path][3]
+        s=self.cb_exec.get_active()
+        if s: 
+           self.execute.set_sensitive(1)
+           if self.path!=-1:
+              if (b=='orginal')or(b=='name'):
+                  self.liststore[self.path][3]='execute'
+        else: 
+           self.execute.set_sensitive(0)
+           if self.path!=-1:
+              if (b=='execute'):
+                  self.liststore[self.path][3]='name'
+
+
+    def __init__(self):
+        namen=home+'/.openbox-keyconf'
+        if not os.access(namen,os.R_OK):
+           f=file(namen,'w')
+           f.write('x=0\n')
+           f.write('y=0\n')
+           f.write('width=800\n')
+           f.write('height=400\n')
+           f.close()
+        f=file(namen,'r')
+        s=f.readline()
+        while s !='':
+           s=s.replace('\n','')
+           z=s.split('=')
+           if z[0]=='x':       self.pos_x=int(z[1])
+           if z[0]=='y':       self.pos_y=int(z[1])
+           if z[0]=='width':   self.width=int(z[1])
+           if z[0]=='height':  self.height=int(z[1])
+           s=f.readline()
+        f.close()
+
+        window = gtk.Window(gtk.WINDOW_TOPLEVEL)
+        self.window=window
+        vbox = gtk.VBox(False, 0)
+        window.set_border_width(5)
+        window.add(vbox)
+
+        # When the window is given the "delete_event" signal (this is given
+        # by the window manager, usually by the "close" option, or on the
+        # titlebar), we ask it to call the delete_event () function
+        # as defined above. The data passed to the callback
+        # function is NULL and is ignored in the callback function.
+        window.connect("delete_event", self.delete_event)
+    
+        # Here we connect the "destroy" event to a signal handler.  
+        # This event occurs when we call gtk_widget_destroy() on the window,
+        # or if we return FALSE in the "delete_event" callback.
+        window.connect("destroy", self.destroy)
+    
+        # Sets the border width of the window.
+        window.set_title(i18n('openbox keyboard bindings'))
+        window.set_size_request(400,200)
+        window.resize(self.width, self.height)
+        window.move(self.pos_x,self.pos_y)
+
+        self.liststore=gtk.ListStore(str,str,str,str)
+        self.treeview=gtk.TreeView()
+        self.treeview.set_headers_visible(True)
+        self.treeview.set_model(self.liststore) 
+        self.treeview.set_property('rules-hint',True)
+        self.treeview.set_property('enable-grid-lines',True)
+        self.treeview.connect('row-activated', self.row_activate)
+        self.treeview.set_events(self.treeview.get_events() | gtk.gdk.BUTTON_PRESS_MASK)
+        self.treeview.connect("button-press-event", self.mouse)
+        self.cell1 = gtk.CellRendererText()
+        self.cell2 = gtk.CellRendererText()
+        self.spalte1 = gtk.TreeViewColumn(i18n('Key'))
+        self.spalte2 = gtk.TreeViewColumn(i18n('Action'))
+        self.treeview.append_column(self.spalte1)
+        self.treeview.append_column(self.spalte2)
+        self.spalte1.pack_start(self.cell1,True)
+        self.spalte2.pack_start(self.cell2,True)
+        self.spalte1.set_attributes(self.cell1, text=1)
+        self.spalte2.set_attributes(self.cell2, text=2)
+        sw = gtk.ScrolledWindow()
+        sw.set_shadow_type(gtk.SHADOW_ETCHED_IN)
+        sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
+        sw.add(self.treeview)
+        filename=home+'/'+configfile
+        self.count_list=0
+        try:
+           f=codecs.open(filename,'r','utf_8')
+           line=f.readline()
+           found=False
+           data='frog'
+           action=False
+           name=''
+           while True: 
+                 line=f.readline()
+                 if not line: break
+                 if '<keyboard>' in line:
+                    found=True
+                    continue
+                 if '</keyboard>' in line: 
+                    found=False
+                 if not found: continue
+                 lin=line.replace('\n','')
+                 if '<keybind ' in lin:
+                    lin2=lin.split('"') 
+                    name=lin2[1]
+                    action=False 
+                    data=''
+                    continue
+                 if '</keybind>' in lin:                 
+                    if action: data+=')'
+                    if name!='': 
+                       self.liststore.append([name,name,data,'orginal'])
+                       self.count_list+=1
+                    name=''
+                    continue
+                 if name!='':
+                    if '</action>' in lin: continue
+                    if '<action ' in lin:   
+                       if action: data+='), ' 
+                       action=True
+                       lin2=lin.split('"') 
+                       data=data+lin2[1]+'('
+                       continue
+                    if '<startupnotify>' in lin:
+                       continue 
+                    if '</startupnotify>' in lin:
+                       continue 
+                    if ('<' in lin) and ('>' in lin):
+                       lin2=lin.split('<')
+                       lin3=lin2[1].split('>')
+                       data=data+lin3[0]+'='+lin3[1]+','
+                 continue
+           f.close()
+        except:
+           pass
+        gc.collect()
+        self.lock=True
+        self.path=-1
+        hbox = gtk.HBox(False, 5)
+        self.keys=gtk.Entry(max=40)
+        self.keys.connect("changed",self.keys_changed)
+        self.action=gtk.Label('')
+        hbox.pack_start(self.keys,False,False,0)
+        hbox.pack_start(self.action,True,True,0)
+        vbox.pack_start(hbox, False,False, 0)
+        self.hbox = gtk.HBox(False, 5)
+        self.cb_exec=gtk.CheckButton(i18n("Edit command")+" =")
+        self.cb_exec.connect_object("toggled",self.toggle_execute_entry,None)
+        self.execute=gtk.Entry(max=0) 
+        self.execute.connect("changed",self.execute_entry_changed)
+        self.hbox.pack_start(self.cb_exec,False,False,0)
+        self.hbox.pack_start(self.execute,True,True,0)
+        vbox.pack_start(self.hbox, False,False, 0)
+        vbox.pack_start(sw, True, True, 0)
+        hbox = gtk.HBox(False, 5)
+        button1=gtk.Button(stock='gtk-apply')
+        hiddenlabel=gtk.Label(' ')
+        button2=gtk.Button(stock='gtk-cancel')
+        button3=gtk.Button(stock='gtk-add')
+        button4=gtk.Button(stock='gtk-delete')
+        button5=gtk.Button(stock='gtk-help')
+        hbox.pack_start(button1,False,False,0)
+        hbox.pack_start(button3,False,False,0)
+        hbox.pack_start(button4,False,False,0)
+        hbox.pack_start(button5,False,False,0)
+        hbox.pack_start(hiddenlabel,True,True,0)
+        hbox.pack_start(button2,False,False,0)
+        button1.connect_object("clicked", self.save,None)
+        button2.connect_object("clicked", self.goodbye,None)
+        button3.connect_object("clicked", self.add_new_keybinding,None)
+        button4.connect_object("clicked", self.delete_keybinding,None)
+        button5.connect("clicked", create_help_view)
+        vbox.pack_end(hbox, False, False, 0)
+        window.show_all() 
+        self.hbox.hide()       
+
+
+    def main(self):
+        # All PyGTK applications must have a gtk.main(). Control ends here
+        # and waits for an event to occur (like a key press or mouse event).
+        gtk.main()
+
+
+
+# If the program is run directly or passed as an argument to the python
+# interpreter then create a HelloWorld instance and show it
+if __name__ == "__main__":
+     home=os.getenv("HOME")
+     codec1=Xcodec.lower().replace('iso-','iso').replace('-','_')
+     if 'ansi' in codec1: codec1='iso8859_1'  #Ansi is shit...
+     I18N_ready = load_i18n('openbox-keyconf.moo')
+     Elfriede = Tool()
+     Elfriede.main()
+
+
+
index b21981d..dc35bd6 100644 (file)
@@ -2,5 +2,12 @@ NULL=
 
 SUBDIRS=
 
-EXTRA_DIST = \
+bin_SCRIPTS = screenshot.py
+
+screenshotdir = $(prefix)/bin
+
+DISTCLEANFILES = $(bin_SCRIPTS)         
+
+EXTRA_DIST =  \
+    $(bin_SCRIPTS) \
        $(NULL)
index b21981d..6c25e42 100644 (file)
@@ -2,5 +2,12 @@ NULL=
 
 SUBDIRS=
 
-EXTRA_DIST = \
+bin_SCRIPTS = services.py
+
+servicesdir = $(prefix)/bin
+
+DISTCLEANFILES = $(bin_SCRIPTS)         
+
+EXTRA_DIST =  \
+    $(bin_SCRIPTS) \
        $(NULL)