Add gettext support and add a pot file
authorJulien Lavergne <julien.lavergne@gmail.com>
Fri, 18 Jun 2010 22:02:17 +0000 (00:02 +0200)
committerJulien Lavergne <julien.lavergne@gmail.com>
Fri, 18 Jun 2010 22:02:17 +0000 (00:02 +0200)
Fix renaming of files

19 files changed:
configure.ac
data/Makefile.am
po/POTFILES.in
po/lxadmin.pot [new file with mode: 0644]
src/lxcc/lxcc.py
src/lxdmconf/lxdmconf.py
src/lxfontconfig/Makefile.am
src/lxfontconfig/fontconfig.py [deleted file]
src/lxfontconfig/lxfontconfig.py [new file with mode: 0644]
src/lxkeyboardconf/Makefile.am
src/lxkeyboardconf/keyboardconf.py [deleted file]
src/lxkeyboardconf/lxkeyboardconf.py [new file with mode: 0755]
src/lxscreenshot/Makefile.am
src/lxscreenshot/lxscreenshot.py [new file with mode: 0755]
src/lxscreenshot/screenshot.py [deleted file]
src/lxservices/Makefile.am
src/lxservices/lxservices.py [new file with mode: 0755]
src/lxservices/services.py [deleted file]
src/openbox-keyconf/openbox-keyconf.py

index aa84972..a0a82c6 100644 (file)
@@ -85,14 +85,14 @@ AC_CONFIG_FILES([
     data/ui/lxproxy/Makefile
     po/Makefile.in
     src/Makefile
-    src/fontconfig/Makefile
-    src/keyboardconf/Makefile
     src/lxcc/Makefile
     src/lxdmconf/Makefile
+    src/lxfontconfig/Makefile
+    src/lxkeyboardconf/Makefile
     src/lxproxy/Makefile
+    src/lxscreenshot/Makefile
+    src/lxservices/Makefile
     src/openbox-keyconf/Makefile
-    src/screenshot/Makefile
-    src/services/Makefile
 ])
 
 AC_OUTPUT
index 074f60d..3984f8b 100644 (file)
@@ -9,8 +9,8 @@ desktop_in_files = \
        lxfontconfig.desktop.in \
        lxkeyboard-setup.desktop.in \
        lxproxy.desktop.in \
-       lxscreenshot.py.desktop.in \
-       lxservices.py.desktop.in \
+       lxscreenshot.desktop.in \
+       lxservices.desktop.in \
        openbox-keyconf.desktop.in \
        $(NULL)
 desktop_DATA = $(desktop_in_files:.desktop.in=.desktop)
index 4c049b5..3bd8873 100644 (file)
@@ -1,5 +1,18 @@
 # List of source files containing translatable strings.
 
-data/template.desktop.in
-data/ui/about.glade.in
-src/template.c
+data/lxcc.desktop.in
+data/lxdmconf.desktop.in
+data/lxfontconfig.desktop.in
+data/lxkeyboard-setup.desktop.in
+data/lxproxy.desktop.in
+data/lxscreenshot.desktop.in
+data/lxservices.desktop.in
+data/openbox-keyconf.desktop.in
+
+src/lxcc/lxcc.py
+src/lxdmconf/lxdmconf.py
+src/lxfontconfig/lxfontconfig.py
+src/lxkeyboardconf/lxkeyboardconf.py
+src/lxscreenshot/lxscreenshot.py
+src/lxservices/lxservices.py
+src/openbox-keyconf/openbox-keyconf.py
diff --git a/po/lxadmin.pot b/po/lxadmin.pot
new file mode 100644 (file)
index 0000000..bd86ed6
--- /dev/null
@@ -0,0 +1,246 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2010-06-19 00:00+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=CHARSET\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../data/lxdmconf.desktop.in.h:1
+msgid "Login-screen"
+msgstr ""
+
+#: ../data/lxfontconfig.desktop.in.h:1
+msgid "Fontconfiguration"
+msgstr ""
+
+#: ../src/lxcc/lxcc.py:118
+msgid "LXDE-Control-Center"
+msgstr ""
+
+#. Sets the border width of the window.
+#: ../src/lxdmconf/lxdmconf.py:433
+msgid "lxdm Login Configuration"
+msgstr ""
+
+#: ../src/lxdmconf/lxdmconf.py:439
+msgid "Numlock"
+msgstr ""
+
+#: ../src/lxdmconf/lxdmconf.py:440
+msgid "choose Language"
+msgstr ""
+
+#: ../src/lxdmconf/lxdmconf.py:441
+msgid "Bottom Pane"
+msgstr ""
+
+#: ../src/lxdmconf/lxdmconf.py:442
+msgid "autologin"
+msgstr ""
+
+#: ../src/lxdmconf/lxdmconf.py:443
+msgid "User"
+msgstr ""
+
+#: ../src/lxdmconf/lxdmconf.py:456
+msgid "session"
+msgstr ""
+
+#: ../src/lxdmconf/lxdmconf.py:471
+msgid "Theme"
+msgstr ""
+
+#: ../src/lxdmconf/lxdmconf.py:472
+msgid "Background"
+msgstr ""
+
+#: ../src/lxdmconf/lxdmconf.py:503
+msgid "General"
+msgstr ""
+
+#: ../src/lxdmconf/lxdmconf.py:504
+msgid "Themes"
+msgstr ""
+
+#. Defaultfont wurde angeklickt, erzeugt jetzt Defaultfont-dialog
+#: ../src/lxfontconfig/lxfontconfig.py:280
+msgid "Select Default Font"
+msgstr ""
+
+#: ../src/lxfontconfig/lxfontconfig.py:330
+msgid "Fontconfig"
+msgstr ""
+
+#: ../src/lxfontconfig/lxfontconfig.py:334
+msgid "Defaultfont"
+msgstr ""
+
+#. disabled because there are a Defaultfont chooser in Erscheinungsbild
+#. vbox.pack_start(hbox,False,False,0)
+#: ../src/lxfontconfig/lxfontconfig.py:343
+msgid "Antialising"
+msgstr ""
+
+#: ../src/lxfontconfig/lxfontconfig.py:347
+msgid "Hinting"
+msgstr ""
+
+#: ../src/lxfontconfig/lxfontconfig.py:350
+msgid "Automatic hinting"
+msgstr ""
+
+#: ../src/lxfontconfig/lxfontconfig.py:351
+msgid "Automatic hinting doesn't work good!"
+msgstr ""
+
+#: ../src/lxfontconfig/lxfontconfig.py:356
+msgid "Style"
+msgstr ""
+
+#: ../src/lxfontconfig/lxfontconfig.py:359
+#: ../src/lxfontconfig/lxfontconfig.py:373
+msgid "none"
+msgstr ""
+
+#: ../src/lxfontconfig/lxfontconfig.py:360
+msgid "slight"
+msgstr ""
+
+#: ../src/lxfontconfig/lxfontconfig.py:361
+msgid "medium"
+msgstr ""
+
+#: ../src/lxfontconfig/lxfontconfig.py:362
+msgid "full"
+msgstr ""
+
+#: ../src/lxfontconfig/lxfontconfig.py:364
+msgid "stronger Hinting make fonts sharper"
+msgstr ""
+
+#: ../src/lxfontconfig/lxfontconfig.py:370
+msgid "Sub pixel geometry"
+msgstr ""
+
+#: ../src/lxfontconfig/lxfontconfig.py:374
+msgid "don't split a pixel into 3 subpixels (no color artefacts)"
+msgstr ""
+
+#: ../src/lxfontconfig/lxfontconfig.py:383
+msgid "rgb"
+msgstr ""
+
+#: ../src/lxfontconfig/lxfontconfig.py:384
+#: ../src/lxfontconfig/lxfontconfig.py:394
+msgid "split a pixel horizontal into 3 subpixels"
+msgstr ""
+
+#: ../src/lxfontconfig/lxfontconfig.py:393
+msgid "bgr"
+msgstr ""
+
+#: ../src/lxfontconfig/lxfontconfig.py:403
+msgid "vrgb"
+msgstr ""
+
+#: ../src/lxfontconfig/lxfontconfig.py:404
+#: ../src/lxfontconfig/lxfontconfig.py:414
+msgid "split a pixel vertical into 3 subpixels"
+msgstr ""
+
+#: ../src/lxfontconfig/lxfontconfig.py:413
+msgid "vbgr"
+msgstr ""
+
+#: ../src/lxfontconfig/lxfontconfig.py:423
+msgid "Screen resolution"
+msgstr ""
+
+#: ../src/lxfontconfig/lxfontconfig.py:427
+msgid "override dpi"
+msgstr ""
+
+#: ../src/lxfontconfig/lxfontconfig.py:438
+msgid "Save"
+msgstr ""
+
+#: ../src/lxkeyboardconf/lxkeyboardconf.py:377
+msgid "DoubleClick Language"
+msgstr ""
+
+#: ../src/lxkeyboardconf/lxkeyboardconf.py:398
+msgid "Language"
+msgstr ""
+
+#: ../src/lxkeyboardconf/lxkeyboardconf.py:399
+#: ../src/lxservices/lxservices.py:214
+msgid "Description"
+msgstr ""
+
+#: ../src/lxkeyboardconf/lxkeyboardconf.py:400
+msgid "Variant"
+msgstr ""
+
+#: ../src/lxkeyboardconf/lxkeyboardconf.py:420
+msgid "install service:  ~/.config/autostart/xkeyboard"
+msgstr ""
+
+#: ../src/lxkeyboardconf/lxkeyboardconf.py:428
+msgid "Default:"
+msgstr ""
+
+#: ../src/lxkeyboardconf/lxkeyboardconf.py:430
+msgid "Variant:"
+msgstr ""
+
+#: ../src/lxscreenshot/lxscreenshot.py:134
+msgid "Screenshot"
+msgstr ""
+
+#: ../src/lxscreenshot/lxscreenshot.py:138
+msgid "_Screenshot"
+msgstr ""
+
+#: ../src/lxservices/lxservices.py:197
+msgid "Services"
+msgstr ""
+
+#: ../src/lxservices/lxservices.py:213
+msgid "Service"
+msgstr ""
+
+#: ../src/openbox-keyconf/openbox-keyconf.py:140
+msgid "Help: keyboard codes"
+msgstr ""
+
+#: ../src/openbox-keyconf/openbox-keyconf.py:364
+msgid "NameOfProgram"
+msgstr ""
+
+#. Sets the border width of the window.
+#: ../src/openbox-keyconf/openbox-keyconf.py:434
+msgid "openbox keyboard bindings"
+msgstr ""
+
+#: ../src/openbox-keyconf/openbox-keyconf.py:450
+msgid "Key"
+msgstr ""
+
+#: ../src/openbox-keyconf/openbox-keyconf.py:451
+msgid "Action"
+msgstr ""
+
+#: ../src/openbox-keyconf/openbox-keyconf.py:525
+msgid "Edit command"
+msgstr ""
index 5a1de5a..5c50b09 100755 (executable)
@@ -54,6 +54,8 @@ import gtk
 import codecs
 import pango
 
+from gettext import gettext as _
+
 I18N={}
 
 def i18n(text):
@@ -113,7 +115,7 @@ class Simple:
         # create a new window
         window = gtk.Window(gtk.WINDOW_TOPLEVEL)
         self.window=window
-        window.set_title(i18n('LXDE-Control-Center'))
+        window.set_title(_('LXDE-Control-Center'))
         window.connect("destroy", self.destroy)
         window.set_border_width(3)
         window.set_position(gtk.WIN_POS_CENTER_ALWAYS)
index ee49d2c..03095a4 100644 (file)
@@ -32,6 +32,8 @@ import gtk
 import pango
 import gc
 
+from gettext import gettext as _
+
 I18N={}
 
 def i18n(text):
@@ -428,17 +430,17 @@ class Tool:
         window.connect("destroy", self.destroy)
     
         # Sets the border width of the window.
-        window.set_title(i18n('lxdm Login Configuration'))
+        window.set_title(_('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") + ':')
+        self.cb_numlock=gtk.CheckButton(_("Numlock"))
+        self.cb_lang=gtk.CheckButton(_("choose Language"))
+        self.cb_bottom=gtk.CheckButton(_("Bottom Pane"))
+        self.cb_autologin=gtk.CheckButton(_("autologin") + '       ')
+        label1=gtk.Label(_("User") + ':')
         label1spacer=gtk.Label("     ")
         self.entryuser=gtk.Entry(max=0)
         hbox2 = gtk.HBox(False, 0)
@@ -451,7 +453,7 @@ class Tool:
         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") + ':')
+        self.cb_session=gtk.CheckButton(_("session") + ':')
         labelhspacer=gtk.Label(' ')
         label2spacer=gtk.Label(" ")
         self.entrysession=gtk.Entry(max=0)
@@ -466,8 +468,8 @@ class Tool:
         hbox5 = gtk.HBox(False, 0)
         hbox4 = gtk.HBox(False, 0)
         vbox4 = gtk.VBox(False, 0)
-        labeltext=i18n('Theme')
-        label2=gtk.Label(i18n('Background')+':')
+        labeltext=_('Theme')
+        label2=gtk.Label(_('Background')+':')
         label12=gtk.Label('  GTK2-'+labeltext+':')
         label13=gtk.Label(labeltext+':')
         self.comboboxGTK = gtk.combo_box_new_text()
@@ -498,8 +500,8 @@ class Tool:
  
         notebook = gtk.Notebook()
         notebook.set_tab_pos(gtk.POS_TOP)
-        tab_label1=gtk.Label(i18n('General'))
-        tab_label2=gtk.Label(i18n('Themes'))
+        tab_label1=gtk.Label(_('General'))
+        tab_label2=gtk.Label(_('Themes'))
         notebook.append_page(vbox2,tab_label1) 
         notebook.append_page(vbox4,tab_label2) 
 
index 910e259..78bd1cc 100644 (file)
@@ -4,15 +4,15 @@ SUBDIRS=
 
 fontconfigdir = $(prefix)/bin
 
-DISTCLEANFILES = fontconfig.py
+DISTCLEANFILES = lxfontconfig.py
 
 install-exec-local:
        test -e "$(DESTDIR)$(bindir)" || mkdir -p "$(DESTDIR)$(bindir)"
-       $(INSTALL) -m 755 fontconfig.py "$(DESTDIR)$(bindir)/fontconfig"
+       $(INSTALL) -m 755 lxfontconfig.py "$(DESTDIR)$(bindir)/lxfontconfig"
 
 uninstall-local:
-       rm -f $(DESTDIR)$(bindir)/fontconfig
+       rm -f $(DESTDIR)$(bindir)/lxfontconfig
 
 EXTRA_DIST =  \
-    fontconfig.py \
+    lxfontconfig.py \
        $(NULL)
diff --git a/src/lxfontconfig/fontconfig.py b/src/lxfontconfig/fontconfig.py
deleted file mode 100644 (file)
index d372d74..0000000
+++ /dev/null
@@ -1,469 +0,0 @@
-#!/usr/bin/python
-# -*- coding: UTF-8 -*-
-#**************************************************************************
-#                                                                         *
-#   Copyright (c) 2008 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 pygtk
-pygtk.require('2.0')
-import gtk
-import codecs
-import pango
-display=gtk.gdk.display_get_default()
-
-
-DefaultIcon=[
-"16 16 4 1",
-"a c #00ffff",
-"# c #000000",
-". c None",
-"b c #00c0c0",
-".......##.......",
-"......####......",
-".....######.....",
-".......##.......",
-"....########....",
-"..#.#aabbaa#.#..",
-".##.#ab##ba#.##.",
-"#####a#aa#a#####",
-"#####a####a#####",
-".##.#a#aa#a#.##.",
-"..#.#abaaba#.#..",
-"....########....",
-".......##.......",
-".....######.....",
-"......####......",
-".......##......."]
-
-irgb=[
-"18 6 3 1",
-"# c #00ff00",
-"a c #0000ff",
-". c #ff0000",
-"......######aaaaaa",
-"......######aaaaaa",
-"......######aaaaaa",
-"......######aaaaaa",
-"......######aaaaaa",
-"......######aaaaaa"]
-
-ibgr=[
-"18 6 3 1",
-"# c #00ff00",
-". c #0000ff",
-"a c #ff0000",
-"......######aaaaaa",
-"......######aaaaaa",
-"......######aaaaaa",
-"......######aaaaaa",
-"......######aaaaaa",
-"......######aaaaaa"]
-
-ivrgb=[
-"12 12 3 1",
-"# c #00ff00",
-"a c #0000ff",
-". c #ff0000",
-"............",
-"............",
-"............",
-"............",
-"############",
-"############",
-"############",
-"############",
-"aaaaaaaaaaaa",
-"aaaaaaaaaaaa",
-"aaaaaaaaaaaa",
-"aaaaaaaaaaaa"]
-
-ivbgr=[
-"12 12 3 1",
-"# c #00ff00",
-". c #0000ff",
-"a c #ff0000",
-"............",
-"............",
-"............",
-"............",
-"############",
-"############",
-"############",
-"############",
-"aaaaaaaaaaaa",
-"aaaaaaaaaaaa",
-"aaaaaaaaaaaa",
-"aaaaaaaaaaaa"]
-
-
-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 get_string(self):
-        #erstellt ein fontconfig configfile als textstring,
-        #zuerst GUI-Elemente auswerten...
-        index = self.combobox.get_active()
-        hintstyle='hintnone'
-        if index==1: hintstyle='hintslight'
-        if index==2: hintstyle='hintmedium'
-        if index==3: hintstyle='hintfull'
-        if self.autohint.get_active(): autohint='true'
-        else: autohint='false'
-        if self.anti.get_active(): anti='true'
-        else: anti='false'
-        rgba='none'
-        if self.radio2.get_active(): rgba='rgb'
-        if self.radio3.get_active(): rgba='bgr'
-        if self.radio4.get_active(): rgba='vrgb'
-        if self.radio5.get_active(): rgba='vbgr'
-
-        #erstellen des fontconfig Strings
-        s='<?xml version="1.0"?>\n'
-        s+='<!DOCTYPE fontconfig SYSTEM "fonts.dtd">\n'
-        s+='<!-- ~/.fonts.conf for per-user font configuration -->\n'
-        s+='<fontconfig>\n'
-        s+='  <match target="font">\n'
-        s+='    <edit name="antialias" mode="assign"><bool>'+anti+'</bool></edit>\n'
-        s+='    <edit name="hinting" mode="assign"><bool>true</bool></edit>\n'
-        s+='    <edit name="autohint" mode="assign"><bool>'+autohint+'</bool></edit>\n'
-        s+='    <edit name="hintstyle" mode="assign"><const>'+hintstyle+'</const></edit>\n'
-        s+='    <edit name="rgba" mode="assign"><const>'+rgba+'</const></edit>\n'
-        s+='  </match>\n'
-        s+='</fontconfig>\n'
-        return s
-
-
-    def save(self,data):
-        #wird ausgeführt wenn Anwenden geklickt wird
-        text=self.get_string()
-        try:
-            home=os.getenv("HOME")
-            f=open(os.path.join(home,'.fonts.conf'),'w')
-            if f:
-               f.write(text)
-               f.close()
-        except:
-            print "can't write ~/.fonts.conf"
-        print text
-
-        #werte GUI-Elemente aus
-        index = self.combobox.get_active()
-        hintstyle='hintnone'
-        if index==1: hintstyle='hintslight'
-        if index==2: hintstyle='hintmedium'
-        if index==3: hintstyle='hintfull'
-        if self.autohint.get_active(): autohint='1'
-        else: autohint='0'
-        if self.anti.get_active(): anti='1'
-        else: anti='0'
-        rgba='none'
-        if self.radio2.get_active(): rgba='rgb'
-        if self.radio3.get_active(): rgba='bgr'
-        if self.radio4.get_active(): rgba='vrgb'
-        if self.radio5.get_active(): rgba='vbgr'
-
-        #erstellt den Xft-String für ~/.fonts.sh
-        text='#!/bin/sh\n'
-        text=text+'echo "Xft.antialias: '+anti+'" | xrdb -merge\n'
-        text=text+'echo "Xft.hinting: 1" | xrdb -merge\n'
-        text=text+'echo "Xft.autohint: '+autohint+'" | xrdb -merge\n'
-        text=text+'echo "Xft.hintstyle: '+hintstyle+'" | xrdb -merge\n'
-        text=text+'echo "Xft.rgba: '+rgba+'" | xrdb -merge\n'
-        if self.cb_dpi.get_active():
-           dpi=str(int(self.adj.get_value()))
-           text = text + 'xrandr --dpi ' + dpi
-        print '================================================='
-        print text
-        try:
-            home=os.getenv("HOME")
-            namen=home+'/.fonts.sh' 
-            f=open(namen,'w')
-            if f:
-               f.write(text)
-               f.close()
-               os.system('chmod a+x '+namen)
-               os.system(namen)
-        except:
-            print "can't write ~/.fonts.sh"
-
-        #erstellt ~/.config/autostart/fontconfig.desktop damit ~/.fonts.sh (Xft) beim booten ausgeführt wird.
-        try:
-            os.system('mkdir ~/.config/autostart 2>/dev/null')
-            home=os.getenv("HOME")
-            namen2=home+'/.config/autostart/fontconfig.desktop' 
-            f=open(namen2,'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=fonts\n')  
-              f.write('Name=fontconfig\n')
-              f.write('Comment=Antialising,Subpixelrendering\n')
-              f.write('Exec='+namen+'\n')
-              f.write('StartupNotify=false\n')
-              f.write('Terminal=false\n')
-              f.write('Hidden=false\n')
-              f.close()
-        except:
-            print "can't write fontconfig.desktop"
-        display.beep()
-        display.sync()
-        gtk.main_quit()
-
-
-    def goodbye(self,data):
-        #Abbrechen wurde angeklickt...
-        gtk.main_quit()
-
-
-    def set_font(self,text):
-        #Defaultfont wurde angeklickt, erzeugt jetzt Defaultfont-dialog 
-        self.font_dialog=gtk.FontSelectionDialog(i18n('Select Default Font'))
-        self.font_dialog.set_font_name('Sans 10')
-        self.font_dialog.set_position(gtk.WIN_POS_MOUSE)
-        self.font_dialog.connect("destroy", self.set_font3)
-        self.font_dialog.ok_button.connect("clicked",self.set_font2)
-        self.font_dialog.cancel_button.connect_object("clicked",lambda wid: wid.destroy(),self.font_dialog)
-        if not (self.font_dialog.flags() & gtk.VISIBLE):
-           self.font_dialog.show()
-        else:
-           self.font_dialog.destroy()
-           self.font_dialog = None    #font_dialog_destroyed
-
-    def set_font2(self, data):
-        #im Defaultfont-dialog wurde OK angeklickt
-        myfont = self.font_dialog.get_font_name()
-        font_desc = pango.FontDescription(myfont)
-        if font_desc:
-           self.font.modify_font(font_desc)
-        self.font.set_text(myfont)
-        print myfont
-        self.font_dialog.destroy()
-        self.font_dialog = None       #font_dialog_destroyed
-        #der Defaultfont wird in ~/.gtkrc-2.0 gespeichert, Themes werden dort nicht aktiviert!
-        home=os.getenv("HOME")
-        f=open(os.path.join(home,'.gtkrc-2.0'),'w')
-        if f:
-               f.write('style "user-font"\n')
-               f.write('{\n')
-               f.write('  font_name="'+myfont+'"\n')
-               f.write('}\n')
-               f.write('widget_class "*" style "user-font"\n')
-               f.write('include "'+home+'/.gtkrc-2.0.mine"\n')
-               f.close()
-
-    def set_font3(self, data=None):
-        #im Defaultfont-dialog wurde Abbrechen geklickt
-        self.font_dialog.destroy()
-        self.font_dialog = None       #font_dialog_destroyed
-
-
-    def toggle_dpi(self,data=None):
-        s=self.cb_dpi.get_active()
-        if s: self.spinner.set_sensitive(1)
-        else: self.spinner.set_sensitive(0)
-
-
-    def __init__(self):
-        # create a new window
-        window = gtk.Window(gtk.WINDOW_TOPLEVEL)
-        self.window=window
-        window.set_title(i18n('Fontconfig'))
-        vbox = gtk.VBox(False, 5)
-        window.add(vbox)
-        hbox=gtk.HBox(False,5)
-        button=gtk.Button(i18n("Defaultfont"))
-        button.connect('clicked',self.set_font)
-        hbox.pack_start(button,False,False,0)
-        self.font=gtk.Label('')
-        hbox.pack_start(self.font,False,False,0)
-
-        #disabled because there are a Defaultfont chooser in Erscheinungsbild
-        #vbox.pack_start(hbox,False,False,0)
-
-        self.anti=gtk.CheckButton(i18n("Antialising"))
-        self.anti.set_active(True)
-        vbox.pack_start(self.anti,False,False,0)
-
-        frame = gtk.Frame(i18n("Hinting"))
-        vbox2=gtk.VBox(False,5)
-        vbox2.set_border_width(5)
-        self.autohint=gtk.CheckButton(i18n("Automatic hinting"))
-        self.autohint.set_tooltip_text(i18n("Automatic hinting doesn't work good!"))
-        #self.autohint.set_active(True)
-        vbox2.pack_start(self.autohint,False,False)
-        hbox2=gtk.HBox(False,10)
-        vbox2.pack_start(hbox2,False,False)
-        label=gtk.Label(i18n("Style")+':')
-        hbox2.pack_start(label,False,False)   
-        combobox = gtk.combo_box_new_text()
-        combobox.append_text(i18n('none'))
-        combobox.append_text(i18n('slight'))
-        combobox.append_text(i18n('medium'))
-        combobox.append_text(i18n('full'))
-        combobox.set_active(3)
-        combobox.set_tooltip_text(i18n("stronger Hinting make fonts sharper"))
-        self.combobox=combobox
-        hbox2.pack_start(combobox,False,False)   
-        frame.add(vbox2)
-        vbox.pack_start(frame,False,False)   
-
-        frame = gtk.Frame(i18n("Sub pixel geometry"))
-        vbox3=gtk.VBox(False,5)
-
-        radio=gtk.RadioButton(None,i18n("none"))
-        radio.set_tooltip_text(i18n("don't split a pixel into 3 subpixels (no color artefacts)"))
-        radio.set_active(True)
-        self.radio1=radio 
-        vbox3.pack_start(radio,False,False)
-
-        window.set_resizable(False)
-        hbox=gtk.HBox(False,5)
-        image=gtk.Image()
-        image.set_from_pixbuf(gtk.gdk.pixbuf_new_from_xpm_data(irgb))
-        radio=gtk.RadioButton(self.radio1,i18n("rgb"))       
-        radio.set_tooltip_text(i18n("split a pixel horizontal into 3 subpixels"))
-        self.radio2=radio 
-        hbox.pack_start(radio,False,False,0)
-        hbox.pack_start(image,False,False,0)
-        vbox3.pack_start(hbox,False,False)
-
-        hbox=gtk.HBox(False,5)
-        image=gtk.Image()
-        image.set_from_pixbuf(gtk.gdk.pixbuf_new_from_xpm_data(ibgr))
-        radio=gtk.RadioButton(self.radio1,i18n("bgr"))
-        radio.set_tooltip_text(i18n("split a pixel horizontal into 3 subpixels"))
-        self.radio3=radio 
-        hbox.pack_start(radio,False,False,0)
-        hbox.pack_start(image,False,False,0)
-        vbox3.pack_start(hbox,False,False)
-
-        hbox=gtk.HBox(False,5)
-        image=gtk.Image()
-        image.set_from_pixbuf(gtk.gdk.pixbuf_new_from_xpm_data(ivrgb))
-        radio=gtk.RadioButton(self.radio1,i18n("vrgb"))
-        radio.set_tooltip_text(i18n("split a pixel vertical into 3 subpixels"))
-        self.radio4=radio 
-        hbox.pack_start(radio,False,False,0)
-        hbox.pack_start(image,False,False,0)
-        vbox3.pack_start(hbox,False,False)
-
-        hbox=gtk.HBox(False,5)
-        image=gtk.Image()
-        image.set_from_pixbuf(gtk.gdk.pixbuf_new_from_xpm_data(ivbgr))
-        radio=gtk.RadioButton(self.radio1,i18n("vbgr"))
-        radio.set_tooltip_text(i18n("split a pixel vertical into 3 subpixels"))
-        self.radio5=radio 
-        hbox.pack_start(radio,False,False,0)
-        hbox.pack_start(image,False,False,0)
-        vbox3.pack_start(hbox,False,False)
-
-        frame.add(vbox3)
-        vbox.pack_start(frame,False,False)   
-
-        frame = gtk.Frame(i18n("Screen resolution"))
-        vbox4=gtk.VBox(False,5)
-        vbox4.set_border_width(5)
-        hbox=gtk.HBox(False,5)
-        self.cb_dpi=gtk.CheckButton(i18n("override dpi")+':')
-        self.cb_dpi.connect_object("toggled",self.toggle_dpi,None)
-        self.adj = gtk.Adjustment(96.0, 50.0, 999.0, 1.0, 10.0, 0.0)
-        self.spinner = gtk.SpinButton(self.adj, 0, 0)
-        self.spinner.set_sensitive(0)
-        hbox.pack_start(self.cb_dpi,False,False,0)
-        hbox.pack_start(self.spinner,False,False,0)
-        vbox4.pack_start(hbox,False,False,0)
-        frame.add(vbox4)
-        vbox.pack_start(frame,False,False)   
-
-        frame = gtk.Frame(i18n("Save"))
-        hbox=gtk.HBox(False,5) 
-        hbox.set_border_width(5)       
-        button1=gtk.Button(stock='gtk-apply')
-        button2=gtk.Button(stock='gtk-cancel')
-        button1.connect('clicked',self.save)
-        button2.connect('clicked',self.goodbye)
-        hbox.pack_start(button1,False,False,0)
-        hbox.pack_start(button2,False,False,0)
-        frame.add(hbox)
-        vbox.pack_start(frame,False,False)   
-
-        # 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)
-        window.set_border_width(5)
-        window.set_position(gtk.WIN_POS_CENTER_ALWAYS)
-        gtk.window_set_default_icon(gtk.gdk.pixbuf_new_from_xpm_data(DefaultIcon))
-        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('fontconfig.py.moo')
-     app = Simple()
-     app.main()
diff --git a/src/lxfontconfig/lxfontconfig.py b/src/lxfontconfig/lxfontconfig.py
new file mode 100644 (file)
index 0000000..a64a773
--- /dev/null
@@ -0,0 +1,471 @@
+#!/usr/bin/python
+# -*- coding: UTF-8 -*-
+#**************************************************************************
+#                                                                         *
+#   Copyright (c) 2008 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 pygtk
+pygtk.require('2.0')
+import gtk
+import codecs
+import pango
+display=gtk.gdk.display_get_default()
+
+from gettext import gettext as _
+
+
+DefaultIcon=[
+"16 16 4 1",
+"a c #00ffff",
+"# c #000000",
+". c None",
+"b c #00c0c0",
+".......##.......",
+"......####......",
+".....######.....",
+".......##.......",
+"....########....",
+"..#.#aabbaa#.#..",
+".##.#ab##ba#.##.",
+"#####a#aa#a#####",
+"#####a####a#####",
+".##.#a#aa#a#.##.",
+"..#.#abaaba#.#..",
+"....########....",
+".......##.......",
+".....######.....",
+"......####......",
+".......##......."]
+
+irgb=[
+"18 6 3 1",
+"# c #00ff00",
+"a c #0000ff",
+". c #ff0000",
+"......######aaaaaa",
+"......######aaaaaa",
+"......######aaaaaa",
+"......######aaaaaa",
+"......######aaaaaa",
+"......######aaaaaa"]
+
+ibgr=[
+"18 6 3 1",
+"# c #00ff00",
+". c #0000ff",
+"a c #ff0000",
+"......######aaaaaa",
+"......######aaaaaa",
+"......######aaaaaa",
+"......######aaaaaa",
+"......######aaaaaa",
+"......######aaaaaa"]
+
+ivrgb=[
+"12 12 3 1",
+"# c #00ff00",
+"a c #0000ff",
+". c #ff0000",
+"............",
+"............",
+"............",
+"............",
+"############",
+"############",
+"############",
+"############",
+"aaaaaaaaaaaa",
+"aaaaaaaaaaaa",
+"aaaaaaaaaaaa",
+"aaaaaaaaaaaa"]
+
+ivbgr=[
+"12 12 3 1",
+"# c #00ff00",
+". c #0000ff",
+"a c #ff0000",
+"............",
+"............",
+"............",
+"............",
+"############",
+"############",
+"############",
+"############",
+"aaaaaaaaaaaa",
+"aaaaaaaaaaaa",
+"aaaaaaaaaaaa",
+"aaaaaaaaaaaa"]
+
+
+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 get_string(self):
+        #erstellt ein fontconfig configfile als textstring,
+        #zuerst GUI-Elemente auswerten...
+        index = self.combobox.get_active()
+        hintstyle='hintnone'
+        if index==1: hintstyle='hintslight'
+        if index==2: hintstyle='hintmedium'
+        if index==3: hintstyle='hintfull'
+        if self.autohint.get_active(): autohint='true'
+        else: autohint='false'
+        if self.anti.get_active(): anti='true'
+        else: anti='false'
+        rgba='none'
+        if self.radio2.get_active(): rgba='rgb'
+        if self.radio3.get_active(): rgba='bgr'
+        if self.radio4.get_active(): rgba='vrgb'
+        if self.radio5.get_active(): rgba='vbgr'
+
+        #erstellen des fontconfig Strings
+        s='<?xml version="1.0"?>\n'
+        s+='<!DOCTYPE fontconfig SYSTEM "fonts.dtd">\n'
+        s+='<!-- ~/.fonts.conf for per-user font configuration -->\n'
+        s+='<fontconfig>\n'
+        s+='  <match target="font">\n'
+        s+='    <edit name="antialias" mode="assign"><bool>'+anti+'</bool></edit>\n'
+        s+='    <edit name="hinting" mode="assign"><bool>true</bool></edit>\n'
+        s+='    <edit name="autohint" mode="assign"><bool>'+autohint+'</bool></edit>\n'
+        s+='    <edit name="hintstyle" mode="assign"><const>'+hintstyle+'</const></edit>\n'
+        s+='    <edit name="rgba" mode="assign"><const>'+rgba+'</const></edit>\n'
+        s+='  </match>\n'
+        s+='</fontconfig>\n'
+        return s
+
+
+    def save(self,data):
+        #wird ausgeführt wenn Anwenden geklickt wird
+        text=self.get_string()
+        try:
+            home=os.getenv("HOME")
+            f=open(os.path.join(home,'.fonts.conf'),'w')
+            if f:
+               f.write(text)
+               f.close()
+        except:
+            print "can't write ~/.fonts.conf"
+        print text
+
+        #werte GUI-Elemente aus
+        index = self.combobox.get_active()
+        hintstyle='hintnone'
+        if index==1: hintstyle='hintslight'
+        if index==2: hintstyle='hintmedium'
+        if index==3: hintstyle='hintfull'
+        if self.autohint.get_active(): autohint='1'
+        else: autohint='0'
+        if self.anti.get_active(): anti='1'
+        else: anti='0'
+        rgba='none'
+        if self.radio2.get_active(): rgba='rgb'
+        if self.radio3.get_active(): rgba='bgr'
+        if self.radio4.get_active(): rgba='vrgb'
+        if self.radio5.get_active(): rgba='vbgr'
+
+        #erstellt den Xft-String für ~/.fonts.sh
+        text='#!/bin/sh\n'
+        text=text+'echo "Xft.antialias: '+anti+'" | xrdb -merge\n'
+        text=text+'echo "Xft.hinting: 1" | xrdb -merge\n'
+        text=text+'echo "Xft.autohint: '+autohint+'" | xrdb -merge\n'
+        text=text+'echo "Xft.hintstyle: '+hintstyle+'" | xrdb -merge\n'
+        text=text+'echo "Xft.rgba: '+rgba+'" | xrdb -merge\n'
+        if self.cb_dpi.get_active():
+           dpi=str(int(self.adj.get_value()))
+           text = text + 'xrandr --dpi ' + dpi
+        print '================================================='
+        print text
+        try:
+            home=os.getenv("HOME")
+            namen=home+'/.fonts.sh' 
+            f=open(namen,'w')
+            if f:
+               f.write(text)
+               f.close()
+               os.system('chmod a+x '+namen)
+               os.system(namen)
+        except:
+            print "can't write ~/.fonts.sh"
+
+        #erstellt ~/.config/autostart/fontconfig.desktop damit ~/.fonts.sh (Xft) beim booten ausgeführt wird.
+        try:
+            os.system('mkdir ~/.config/autostart 2>/dev/null')
+            home=os.getenv("HOME")
+            namen2=home+'/.config/autostart/fontconfig.desktop' 
+            f=open(namen2,'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=fonts\n')  
+              f.write('Name=fontconfig\n')
+              f.write('Comment=Antialising,Subpixelrendering\n')
+              f.write('Exec='+namen+'\n')
+              f.write('StartupNotify=false\n')
+              f.write('Terminal=false\n')
+              f.write('Hidden=false\n')
+              f.close()
+        except:
+            print "can't write fontconfig.desktop"
+        display.beep()
+        display.sync()
+        gtk.main_quit()
+
+
+    def goodbye(self,data):
+        #Abbrechen wurde angeklickt...
+        gtk.main_quit()
+
+
+    def set_font(self,text):
+        #Defaultfont wurde angeklickt, erzeugt jetzt Defaultfont-dialog 
+        self.font_dialog=gtk.FontSelectionDialog(_('Select Default Font'))
+        self.font_dialog.set_font_name('Sans 10')
+        self.font_dialog.set_position(gtk.WIN_POS_MOUSE)
+        self.font_dialog.connect("destroy", self.set_font3)
+        self.font_dialog.ok_button.connect("clicked",self.set_font2)
+        self.font_dialog.cancel_button.connect_object("clicked",lambda wid: wid.destroy(),self.font_dialog)
+        if not (self.font_dialog.flags() & gtk.VISIBLE):
+           self.font_dialog.show()
+        else:
+           self.font_dialog.destroy()
+           self.font_dialog = None    #font_dialog_destroyed
+
+    def set_font2(self, data):
+        #im Defaultfont-dialog wurde OK angeklickt
+        myfont = self.font_dialog.get_font_name()
+        font_desc = pango.FontDescription(myfont)
+        if font_desc:
+           self.font.modify_font(font_desc)
+        self.font.set_text(myfont)
+        print myfont
+        self.font_dialog.destroy()
+        self.font_dialog = None       #font_dialog_destroyed
+        #der Defaultfont wird in ~/.gtkrc-2.0 gespeichert, Themes werden dort nicht aktiviert!
+        home=os.getenv("HOME")
+        f=open(os.path.join(home,'.gtkrc-2.0'),'w')
+        if f:
+               f.write('style "user-font"\n')
+               f.write('{\n')
+               f.write('  font_name="'+myfont+'"\n')
+               f.write('}\n')
+               f.write('widget_class "*" style "user-font"\n')
+               f.write('include "'+home+'/.gtkrc-2.0.mine"\n')
+               f.close()
+
+    def set_font3(self, data=None):
+        #im Defaultfont-dialog wurde Abbrechen geklickt
+        self.font_dialog.destroy()
+        self.font_dialog = None       #font_dialog_destroyed
+
+
+    def toggle_dpi(self,data=None):
+        s=self.cb_dpi.get_active()
+        if s: self.spinner.set_sensitive(1)
+        else: self.spinner.set_sensitive(0)
+
+
+    def __init__(self):
+        # create a new window
+        window = gtk.Window(gtk.WINDOW_TOPLEVEL)
+        self.window=window
+        window.set_title(_('Fontconfig'))
+        vbox = gtk.VBox(False, 5)
+        window.add(vbox)
+        hbox=gtk.HBox(False,5)
+        button=gtk.Button(_("Defaultfont"))
+        button.connect('clicked',self.set_font)
+        hbox.pack_start(button,False,False,0)
+        self.font=gtk.Label('')
+        hbox.pack_start(self.font,False,False,0)
+
+        #disabled because there are a Defaultfont chooser in Erscheinungsbild
+        #vbox.pack_start(hbox,False,False,0)
+
+        self.anti=gtk.CheckButton(_("Antialising"))
+        self.anti.set_active(True)
+        vbox.pack_start(self.anti,False,False,0)
+
+        frame = gtk.Frame(_("Hinting"))
+        vbox2=gtk.VBox(False,5)
+        vbox2.set_border_width(5)
+        self.autohint=gtk.CheckButton(_("Automatic hinting"))
+        self.autohint.set_tooltip_text(_("Automatic hinting doesn't work good!"))
+        #self.autohint.set_active(True)
+        vbox2.pack_start(self.autohint,False,False)
+        hbox2=gtk.HBox(False,10)
+        vbox2.pack_start(hbox2,False,False)
+        label=gtk.Label(_("Style")+':')
+        hbox2.pack_start(label,False,False)   
+        combobox = gtk.combo_box_new_text()
+        combobox.append_text(_('none'))
+        combobox.append_text(_('slight'))
+        combobox.append_text(_('medium'))
+        combobox.append_text(_('full'))
+        combobox.set_active(3)
+        combobox.set_tooltip_text(_("stronger Hinting make fonts sharper"))
+        self.combobox=combobox
+        hbox2.pack_start(combobox,False,False)   
+        frame.add(vbox2)
+        vbox.pack_start(frame,False,False)   
+
+        frame = gtk.Frame(_("Sub pixel geometry"))
+        vbox3=gtk.VBox(False,5)
+
+        radio=gtk.RadioButton(None,_("none"))
+        radio.set_tooltip_text(_("don't split a pixel into 3 subpixels (no color artefacts)"))
+        radio.set_active(True)
+        self.radio1=radio 
+        vbox3.pack_start(radio,False,False)
+
+        window.set_resizable(False)
+        hbox=gtk.HBox(False,5)
+        image=gtk.Image()
+        image.set_from_pixbuf(gtk.gdk.pixbuf_new_from_xpm_data(irgb))
+        radio=gtk.RadioButton(self.radio1,_("rgb"))       
+        radio.set_tooltip_text(_("split a pixel horizontal into 3 subpixels"))
+        self.radio2=radio 
+        hbox.pack_start(radio,False,False,0)
+        hbox.pack_start(image,False,False,0)
+        vbox3.pack_start(hbox,False,False)
+
+        hbox=gtk.HBox(False,5)
+        image=gtk.Image()
+        image.set_from_pixbuf(gtk.gdk.pixbuf_new_from_xpm_data(ibgr))
+        radio=gtk.RadioButton(self.radio1,_("bgr"))
+        radio.set_tooltip_text(_("split a pixel horizontal into 3 subpixels"))
+        self.radio3=radio 
+        hbox.pack_start(radio,False,False,0)
+        hbox.pack_start(image,False,False,0)
+        vbox3.pack_start(hbox,False,False)
+
+        hbox=gtk.HBox(False,5)
+        image=gtk.Image()
+        image.set_from_pixbuf(gtk.gdk.pixbuf_new_from_xpm_data(ivrgb))
+        radio=gtk.RadioButton(self.radio1,_("vrgb"))
+        radio.set_tooltip_text(_("split a pixel vertical into 3 subpixels"))
+        self.radio4=radio 
+        hbox.pack_start(radio,False,False,0)
+        hbox.pack_start(image,False,False,0)
+        vbox3.pack_start(hbox,False,False)
+
+        hbox=gtk.HBox(False,5)
+        image=gtk.Image()
+        image.set_from_pixbuf(gtk.gdk.pixbuf_new_from_xpm_data(ivbgr))
+        radio=gtk.RadioButton(self.radio1,_("vbgr"))
+        radio.set_tooltip_text(_("split a pixel vertical into 3 subpixels"))
+        self.radio5=radio 
+        hbox.pack_start(radio,False,False,0)
+        hbox.pack_start(image,False,False,0)
+        vbox3.pack_start(hbox,False,False)
+
+        frame.add(vbox3)
+        vbox.pack_start(frame,False,False)   
+
+        frame = gtk.Frame(_("Screen resolution"))
+        vbox4=gtk.VBox(False,5)
+        vbox4.set_border_width(5)
+        hbox=gtk.HBox(False,5)
+        self.cb_dpi=gtk.CheckButton(_("override dpi")+':')
+        self.cb_dpi.connect_object("toggled",self.toggle_dpi,None)
+        self.adj = gtk.Adjustment(96.0, 50.0, 999.0, 1.0, 10.0, 0.0)
+        self.spinner = gtk.SpinButton(self.adj, 0, 0)
+        self.spinner.set_sensitive(0)
+        hbox.pack_start(self.cb_dpi,False,False,0)
+        hbox.pack_start(self.spinner,False,False,0)
+        vbox4.pack_start(hbox,False,False,0)
+        frame.add(vbox4)
+        vbox.pack_start(frame,False,False)   
+
+        frame = gtk.Frame(_("Save"))
+        hbox=gtk.HBox(False,5) 
+        hbox.set_border_width(5)       
+        button1=gtk.Button(stock='gtk-apply')
+        button2=gtk.Button(stock='gtk-cancel')
+        button1.connect('clicked',self.save)
+        button2.connect('clicked',self.goodbye)
+        hbox.pack_start(button1,False,False,0)
+        hbox.pack_start(button2,False,False,0)
+        frame.add(hbox)
+        vbox.pack_start(frame,False,False)   
+
+        # 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)
+        window.set_border_width(5)
+        window.set_position(gtk.WIN_POS_CENTER_ALWAYS)
+        gtk.window_set_default_icon(gtk.gdk.pixbuf_new_from_xpm_data(DefaultIcon))
+        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('fontconfig.py.moo')
+     app = Simple()
+     app.main()
index 5159528..8f40a4b 100644 (file)
@@ -2,17 +2,17 @@ NULL=
 
 SUBDIRS=
 
-keyboardconfdir = $(prefix)/bin
+lxkeyboardconfdir = $(prefix)/bin
 
-DISTCLEANFILES = keyboardconf.py
+DISTCLEANFILES = lxkeyboardconf.py
 
 install-exec-local:
        test -e "$(DESTDIR)$(bindir)" || mkdir -p "$(DESTDIR)$(bindir)"
-       $(INSTALL) -m 755 keyboardconf.py "$(DESTDIR)$(bindir)/keyboardconf"
+       $(INSTALL) -m 755 lxkeyboardconf.py "$(DESTDIR)$(bindir)/lxkeyboardconf"
 
 uninstall-local:
-       rm -f $(DESTDIR)$(bindir)/keyboardconf
+       rm -f $(DESTDIR)$(bindir)/lxkeyboardconf
 
 EXTRA_DIST =  \
-    keyboardconf.py \
+    lxkeyboardconf.py \
        $(NULL)
diff --git a/src/lxkeyboardconf/keyboardconf.py b/src/lxkeyboardconf/keyboardconf.py
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/lxkeyboardconf/lxkeyboardconf.py b/src/lxkeyboardconf/lxkeyboardconf.py
new file mode 100755 (executable)
index 0000000..2be7ecf
--- /dev/null
@@ -0,0 +1,521 @@
+#!/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
+
+from gettext import gettext as _
+
+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(_('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(_('Language'))
+        self.spalte2 = gtk.TreeViewColumn(_('Description'))
+        self.spalte3 = gtk.TreeViewColumn(_('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(_("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(_("Default:"))
+        self.combobox = gtk.combo_box_new_text()
+        label5=gtk.Label(_("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 6b6612f..4f21ce3 100644 (file)
@@ -2,17 +2,17 @@ NULL=
 
 SUBDIRS=
 
-screenshotdir = $(prefix)/bin
+lxscreenshotdir = $(prefix)/bin
 
-DISTCLEANFILES = screenshot.py
+DISTCLEANFILES = lxscreenshot.py
 
 install-exec-local:
        test -e "$(DESTDIR)$(bindir)" || mkdir -p "$(DESTDIR)$(bindir)"
-       $(INSTALL) -m 755 screenshot.py "$(DESTDIR)$(bindir)/screenshot"
+       $(INSTALL) -m 755 lxscreenshot.py "$(DESTDIR)$(bindir)/lxscreenshot"
 
 uninstall-local:
-       rm -f $(DESTDIR)$(bindir)/screenshot
+       rm -f $(DESTDIR)$(bindir)/lxscreenshot
 
 EXTRA_DIST =  \
-       screenshot.py \
+       lxscreenshot.py \
        $(NULL)
diff --git a/src/lxscreenshot/lxscreenshot.py b/src/lxscreenshot/lxscreenshot.py
new file mode 100755 (executable)
index 0000000..c4a1fc7
--- /dev/null
@@ -0,0 +1,162 @@
+#!/usr/bin/python
+# -*- coding: UTF-8 -*-
+#**************************************************************************
+#                                                                         *
+#   Copyright (c) Februar 2008 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'
+import os
+import sys
+import string
+import pygtk
+pygtk.require('2.0')
+import gtk
+import codecs
+import gobject
+
+from gettext import gettext as _
+
+DefaultIcon=[
+"16 14 4 1",
+"      c None",
+".     c black",
+"X     c white",
+"o     c gray50",
+"      ......    ",
+"     .XXXXXX.   ",
+" ....Xo...oX... ",
+".XXXX.......XXX.",
+".......ooo......",
+".Xoo..oXXoo..oo.",
+".Xoo..oXooo..oo.",
+".Xoo..ooooo..oo.",
+".Xooo..ooo..ooo.",
+".Xooo.......ooo.",
+".Xooooo...ooooo.",
+" .............. ",
+"                ",
+"                "]
+
+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
+
+
+
+class Simple:
+
+    def destroy(self, widget, data=None):
+        #wird beim beenden ausgeführt
+        gtk.main_quit()
+
+    def registerStock(self,namen,text,icon):
+        #registriert eine Standart-Button-Beschriftung mit icon
+        items = [(namen, text, 0, 0, '')]
+        # Register our stock items
+        gtk.stock_add(items)
+        # Add our custom icon factory to the list of defaults
+        factory = gtk.IconFactory()
+        factory.add_default()
+        pixbuf=gtk.gdk.pixbuf_new_from_xpm_data(icon)
+        icon_set = gtk.IconSet(pixbuf)
+        factory.add(namen, icon_set)
+
+    def start(self,data):
+        #screenshot angeklickt, verstecke Fenster und starte self.screenshot mit 0.5s Verzögerung
+        self.source_id = gobject.timeout_add(500, self.screenshot)
+        self.window.hide()
+
+    def screenshot(self):
+        #jetzt wird der screenshot tatsächlich ausgeführt
+        home=os.getenv("HOME")
+        filename=os.path.join(home,"screenshot-01.png")
+        i=1
+        while os.path.exists(filename):
+              i+=1     
+              filename=os.path.join(home,"screenshot-%02i.png" % i)
+        rootWindow = gtk.gdk.get_default_root_window()
+        width=gtk.gdk.screen_width()
+        height=gtk.gdk.screen_height()
+        pixbuf = gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB,False,8,width,height)
+        pixbuf.get_from_drawable(rootWindow,rootWindow.get_colormap(),0,0,0,0,width,height)
+        pixbuf.save(filename,"png")
+        print filename
+        dialog = gtk.MessageDialog(self.window, gtk.DIALOG_MODAL,gtk.MESSAGE_INFO,gtk.BUTTONS_OK, filename)
+        result = dialog.run()
+        dialog.destroy()
+        gtk.main_quit()
+        return False
+
+    def __init__(self):
+        window = gtk.Window(gtk.WINDOW_TOPLEVEL)
+        self.window=window
+        window.set_title(_('Screenshot'))
+        bbox=gtk.HBox(False,0)
+        window.add(bbox)
+        window.connect("destroy", self.destroy)
+        self.registerStock('cat-screenshot',_('_Screenshot'),DefaultIcon) 
+        button1=gtk.Button(stock='cat-screenshot')
+        button2=gtk.Button(stock='gtk-cancel')
+        bbox.pack_start(button1,True,True,0)
+        bbox.pack_start(button2,True,True,0)
+        button1.connect('clicked',self.start)
+        button2.connect('clicked',self.destroy)
+        window.set_border_width(5)
+        window.set_position(gtk.WIN_POS_CENTER_ALWAYS)
+        gtk.window_set_default_icon(gtk.gdk.pixbuf_new_from_xpm_data(DefaultIcon))
+        window.set_resizable(False)
+        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('screenshot.py.moo')
+     app = Simple()
+     app.main()
diff --git a/src/lxscreenshot/screenshot.py b/src/lxscreenshot/screenshot.py
deleted file mode 100755 (executable)
index 7332584..0000000
+++ /dev/null
@@ -1,161 +0,0 @@
-#!/usr/bin/python
-# -*- coding: UTF-8 -*-
-#**************************************************************************
-#                                                                         *
-#   Copyright (c) Februar 2008 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'
-import os
-import sys
-import string
-import pygtk
-pygtk.require('2.0')
-import gtk
-import codecs
-import gobject
-    
-
-DefaultIcon=[
-"16 14 4 1",
-"      c None",
-".     c black",
-"X     c white",
-"o     c gray50",
-"      ......    ",
-"     .XXXXXX.   ",
-" ....Xo...oX... ",
-".XXXX.......XXX.",
-".......ooo......",
-".Xoo..oXXoo..oo.",
-".Xoo..oXooo..oo.",
-".Xoo..ooooo..oo.",
-".Xooo..ooo..ooo.",
-".Xooo.......ooo.",
-".Xooooo...ooooo.",
-" .............. ",
-"                ",
-"                "]
-
-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
-
-
-
-class Simple:
-
-    def destroy(self, widget, data=None):
-        #wird beim beenden ausgeführt
-        gtk.main_quit()
-
-    def registerStock(self,namen,text,icon):
-        #registriert eine Standart-Button-Beschriftung mit icon
-        items = [(namen, text, 0, 0, '')]
-        # Register our stock items
-        gtk.stock_add(items)
-        # Add our custom icon factory to the list of defaults
-        factory = gtk.IconFactory()
-        factory.add_default()
-        pixbuf=gtk.gdk.pixbuf_new_from_xpm_data(icon)
-        icon_set = gtk.IconSet(pixbuf)
-        factory.add(namen, icon_set)
-
-    def start(self,data):
-        #screenshot angeklickt, verstecke Fenster und starte self.screenshot mit 0.5s Verzögerung
-        self.source_id = gobject.timeout_add(500, self.screenshot)
-        self.window.hide()
-
-    def screenshot(self):
-        #jetzt wird der screenshot tatsächlich ausgeführt
-        home=os.getenv("HOME")
-        filename=os.path.join(home,"screenshot-01.png")
-        i=1
-        while os.path.exists(filename):
-              i+=1     
-              filename=os.path.join(home,"screenshot-%02i.png" % i)
-        rootWindow = gtk.gdk.get_default_root_window()
-        width=gtk.gdk.screen_width()
-        height=gtk.gdk.screen_height()
-        pixbuf = gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB,False,8,width,height)
-        pixbuf.get_from_drawable(rootWindow,rootWindow.get_colormap(),0,0,0,0,width,height)
-        pixbuf.save(filename,"png")
-        print filename
-        dialog = gtk.MessageDialog(self.window, gtk.DIALOG_MODAL,gtk.MESSAGE_INFO,gtk.BUTTONS_OK, filename)
-        result = dialog.run()
-        dialog.destroy()
-        gtk.main_quit()
-        return False
-
-    def __init__(self):
-        window = gtk.Window(gtk.WINDOW_TOPLEVEL)
-        self.window=window
-        window.set_title(i18n('Screenshot'))
-        bbox=gtk.HBox(False,0)
-        window.add(bbox)
-        window.connect("destroy", self.destroy)
-        self.registerStock('cat-screenshot',i18n('_Screenshot'),DefaultIcon) 
-        button1=gtk.Button(stock='cat-screenshot')
-        button2=gtk.Button(stock='gtk-cancel')
-        bbox.pack_start(button1,True,True,0)
-        bbox.pack_start(button2,True,True,0)
-        button1.connect('clicked',self.start)
-        button2.connect('clicked',self.destroy)
-        window.set_border_width(5)
-        window.set_position(gtk.WIN_POS_CENTER_ALWAYS)
-        gtk.window_set_default_icon(gtk.gdk.pixbuf_new_from_xpm_data(DefaultIcon))
-        window.set_resizable(False)
-        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('screenshot.py.moo')
-     app = Simple()
-     app.main()
index dbf6fef..e5229bd 100644 (file)
@@ -2,17 +2,17 @@ NULL=
 
 SUBDIRS=
 
-servicesdir = $(prefix)/bin
+lxservicesdir = $(prefix)/bin
 
-DISTCLEANFILES = services.py
+DISTCLEANFILES = lxservices.py
 
 install-exec-local:
        test -e "$(DESTDIR)$(bindir)" || mkdir -p "$(DESTDIR)$(bindir)"
-       $(INSTALL) -m 755 services.py "$(DESTDIR)$(bindir)/services"
+       $(INSTALL) -m 755 lxservices.py "$(DESTDIR)$(bindir)/lxservices"
 
 uninstall-local:
-       rm -f $(DESTDIR)$(bindir)/services
+       rm -f $(DESTDIR)$(bindir)/lxservices
 
 EXTRA_DIST =  \
-    services.py \
+    lxservices.py \
        $(NULL)
diff --git a/src/lxservices/lxservices.py b/src/lxservices/lxservices.py
new file mode 100755 (executable)
index 0000000..0ef1ceb
--- /dev/null
@@ -0,0 +1,313 @@
+#!/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 string
+import time
+import codecs
+import pygtk
+pygtk.require('2.0')
+import gtk
+import pango
+
+from gettext import gettext as _
+
+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"]
+
+gelb=[
+"16 16 4 1",
+". c #000000",
+"# c #40a000",
+"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"]
+
+DefaultIcon=[
+"16 16 4 1",
+"      c None",
+".     c black",
+"o     c white",
+"O     c gray50",
+"   .. .....     ",
+"  .oo.ooooo.    ",
+"  .ooooooooo.   ",
+"  .oO.oooo..o.  ",
+"   .. ....O ..  ",
+"       ...   .  ",
+"       ...      ",
+"       ...      ",
+"       ...      ",
+"       ...      ",
+"       ...      ",
+"       ...      ",
+"       ...      ",
+"       ...      ",
+"                ",
+"                "]
+
+
+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):
+     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
+
+
+runlevel=[]
+def get_runlevel(pathname):
+    global runlevel 
+    for i in os.listdir(pathname):
+        if len(i)>3:
+           if (i[0]=='S'):
+              runlevel.append(i[3:])
+
+
+class startmenu:
+    def destroy(self, widget, data=None):
+        gtk.main_quit()
+
+
+    def row_activate(self, treeview, path, column):
+        # a service is doubleclicked...
+        directory='/etc/init.d'
+        name=self.liststore[path][4]
+        state=self.liststore[path][0]
+        if state==1:                   
+           self.liststore[path][0]=0      #deactivate service
+           self.liststore[path][1]=Soff
+           os.rename(directory+os.sep+name,directory+os.sep+name+'_OFF')
+           command=directory+os.sep+name+'_OFF'+ ' stop &'
+           print command
+           os.system(command.encode(codec1))
+        else:
+           self.liststore[path][0]=1      #activate service
+           self.liststore[path][1]=Son
+           os.rename(directory+os.sep+name+'_OFF',directory+os.sep+name)
+           command=directory+os.sep+name+ ' start &'
+           print command
+           os.system(command.encode(codec1))
+
+
+    def __init__(self):
+        window = gtk.Window(gtk.WINDOW_TOPLEVEL)
+        self.window=window
+        window.set_title(_('Services')+' "/etc/init.d"')
+        window.set_size_request(600,400)
+        vbox = gtk.VBox(False, 10)
+        window.add(vbox)
+        window.set_position(gtk.WIN_POS_CENTER_ALWAYS)
+        gtk.window_set_default_icon(gtk.gdk.pixbuf_new_from_xpm_data(DefaultIcon))
+        self.liststore=gtk.ListStore(int,gtk.gdk.Pixbuf,str,str,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.cellpb = gtk.CellRendererPixbuf()
+        self.cell1 = gtk.CellRendererText()
+        self.cell2 = gtk.CellRendererText()
+        self.cellpb.set_property('cell-background', 'grey80')
+        self.cell1.set_property('cell-background', 'grey80')
+        self.spalte1 = gtk.TreeViewColumn(_('Service'))
+        self.spalte2 = gtk.TreeViewColumn(_('Description'))
+        self.treeview.append_column(self.spalte1)
+        self.treeview.append_column(self.spalte2)
+        self.spalte1.pack_start(self.cellpb,False)
+        self.spalte1.pack_start(self.cell1,True)
+        self.spalte2.pack_start(self.cell2,True)
+        self.spalte1.set_attributes(self.cellpb, pixbuf=1)
+        self.spalte1.set_attributes(self.cell1, text=2)
+        self.spalte2.set_attributes(self.cell2, text=3)
+        sw = gtk.ScrolledWindow()
+        sw.set_shadow_type(gtk.SHADOW_ETCHED_IN)
+        sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
+        sw.add(self.treeview)
+        vbox.pack_start(sw , True, True, 0)
+        window.connect("destroy", self.destroy)
+        window.show_all()
+        self.liststore.set_sort_column_id(2, gtk.SORT_ASCENDING)
+        get_runlevel('/etc/rcS.d')
+        get_runlevel('/etc/rc0.d')
+        get_runlevel('/etc/rc1.d')
+        get_runlevel('/etc/rc2.d')
+        get_runlevel('/etc/rc3.d')
+        get_runlevel('/etc/rc4.d')
+        get_runlevel('/etc/rc5.d')
+        get_runlevel('/etc/rc6.d')
+        #print runlevel
+        for i in os.listdir('/etc/init.d'):
+            name=i.replace('_OFF','')
+            try:
+                name2=unicode(name,codec1)
+            except:
+                name2=name
+            info='...'
+            found=0
+            try:
+                f=codecs.open('/etc/init.d/'+i,'r','utf_8')
+                text=f.read()
+                f.close() 
+                text=text.split('\n') 
+                for line in text:
+                    if '### BEGIN INIT INFO' in line: found=1
+                    if '### END INIT INFO' in line: found=3
+                    if (found == 0) or (found>2): continue
+                    if '# Provides:' in line:
+                       name2=line[11:]
+                       name2=name2.replace('\t','')
+                       name2=name2.strip() 
+                       continue
+                    if '# Short-Description:' in line:
+                       text2=line[20:]
+                       text2=text2.replace('\t','')
+                       info=text2.strip()
+                       continue
+            except:
+                print "error reading service: "+i
+            if found==0:
+               print 'ignore '+i
+               continue
+
+            nummer=1
+            if '_OFF' in i: nummer=0
+            try:
+                if nummer==1:
+                   if name in runlevel:
+                      self.liststore.append([nummer,Son,name2,info,name])
+                   else:
+                      self.liststore.append([nummer,Son2,name2,info,name])
+                else:
+                   self.liststore.append([nummer,Soff,name2,info,name])
+            except:
+                pass
+        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()
+
+
+
+    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...
+     if os.getenv('UTF8_FILENAMES','0')=='1': codec1='utf_8'
+     I18N_ready = load_i18n('services.py.moo')
+     Soff=gtk.gdk.pixbuf_new_from_xpm_data(rot)
+     Son2=gtk.gdk.pixbuf_new_from_xpm_data(gelb)
+     Son =gtk.gdk.pixbuf_new_from_xpm_data(gruen)
+     app=startmenu()
+     app.main() 
+
+
diff --git a/src/lxservices/services.py b/src/lxservices/services.py
deleted file mode 100755 (executable)
index 9dc0f41..0000000
+++ /dev/null
@@ -1,311 +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 string
-import time
-import codecs
-import pygtk
-pygtk.require('2.0')
-import gtk
-import pango
-
-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"]
-
-gelb=[
-"16 16 4 1",
-". c #000000",
-"# c #40a000",
-"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"]
-
-DefaultIcon=[
-"16 16 4 1",
-"      c None",
-".     c black",
-"o     c white",
-"O     c gray50",
-"   .. .....     ",
-"  .oo.ooooo.    ",
-"  .ooooooooo.   ",
-"  .oO.oooo..o.  ",
-"   .. ....O ..  ",
-"       ...   .  ",
-"       ...      ",
-"       ...      ",
-"       ...      ",
-"       ...      ",
-"       ...      ",
-"       ...      ",
-"       ...      ",
-"       ...      ",
-"                ",
-"                "]
-
-
-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):
-     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
-
-
-runlevel=[]
-def get_runlevel(pathname):
-    global runlevel 
-    for i in os.listdir(pathname):
-        if len(i)>3:
-           if (i[0]=='S'):
-              runlevel.append(i[3:])
-
-
-class startmenu:
-    def destroy(self, widget, data=None):
-        gtk.main_quit()
-
-
-    def row_activate(self, treeview, path, column):
-        # a service is doubleclicked...
-        directory='/etc/init.d'
-        name=self.liststore[path][4]
-        state=self.liststore[path][0]
-        if state==1:                   
-           self.liststore[path][0]=0      #deactivate service
-           self.liststore[path][1]=Soff
-           os.rename(directory+os.sep+name,directory+os.sep+name+'_OFF')
-           command=directory+os.sep+name+'_OFF'+ ' stop &'
-           print command
-           os.system(command.encode(codec1))
-        else:
-           self.liststore[path][0]=1      #activate service
-           self.liststore[path][1]=Son
-           os.rename(directory+os.sep+name+'_OFF',directory+os.sep+name)
-           command=directory+os.sep+name+ ' start &'
-           print command
-           os.system(command.encode(codec1))
-
-
-    def __init__(self):
-        window = gtk.Window(gtk.WINDOW_TOPLEVEL)
-        self.window=window
-        window.set_title(i18n('Services')+' "/etc/init.d"')
-        window.set_size_request(600,400)
-        vbox = gtk.VBox(False, 10)
-        window.add(vbox)
-        window.set_position(gtk.WIN_POS_CENTER_ALWAYS)
-        gtk.window_set_default_icon(gtk.gdk.pixbuf_new_from_xpm_data(DefaultIcon))
-        self.liststore=gtk.ListStore(int,gtk.gdk.Pixbuf,str,str,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.cellpb = gtk.CellRendererPixbuf()
-        self.cell1 = gtk.CellRendererText()
-        self.cell2 = gtk.CellRendererText()
-        self.cellpb.set_property('cell-background', 'grey80')
-        self.cell1.set_property('cell-background', 'grey80')
-        self.spalte1 = gtk.TreeViewColumn(i18n('Service'))
-        self.spalte2 = gtk.TreeViewColumn(i18n('Description'))
-        self.treeview.append_column(self.spalte1)
-        self.treeview.append_column(self.spalte2)
-        self.spalte1.pack_start(self.cellpb,False)
-        self.spalte1.pack_start(self.cell1,True)
-        self.spalte2.pack_start(self.cell2,True)
-        self.spalte1.set_attributes(self.cellpb, pixbuf=1)
-        self.spalte1.set_attributes(self.cell1, text=2)
-        self.spalte2.set_attributes(self.cell2, text=3)
-        sw = gtk.ScrolledWindow()
-        sw.set_shadow_type(gtk.SHADOW_ETCHED_IN)
-        sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
-        sw.add(self.treeview)
-        vbox.pack_start(sw , True, True, 0)
-        window.connect("destroy", self.destroy)
-        window.show_all()
-        self.liststore.set_sort_column_id(2, gtk.SORT_ASCENDING)
-        get_runlevel('/etc/rcS.d')
-        get_runlevel('/etc/rc0.d')
-        get_runlevel('/etc/rc1.d')
-        get_runlevel('/etc/rc2.d')
-        get_runlevel('/etc/rc3.d')
-        get_runlevel('/etc/rc4.d')
-        get_runlevel('/etc/rc5.d')
-        get_runlevel('/etc/rc6.d')
-        #print runlevel
-        for i in os.listdir('/etc/init.d'):
-            name=i.replace('_OFF','')
-            try:
-                name2=unicode(name,codec1)
-            except:
-                name2=name
-            info='...'
-            found=0
-            try:
-                f=codecs.open('/etc/init.d/'+i,'r','utf_8')
-                text=f.read()
-                f.close() 
-                text=text.split('\n') 
-                for line in text:
-                    if '### BEGIN INIT INFO' in line: found=1
-                    if '### END INIT INFO' in line: found=3
-                    if (found == 0) or (found>2): continue
-                    if '# Provides:' in line:
-                       name2=line[11:]
-                       name2=name2.replace('\t','')
-                       name2=name2.strip() 
-                       continue
-                    if '# Short-Description:' in line:
-                       text2=line[20:]
-                       text2=text2.replace('\t','')
-                       info=text2.strip()
-                       continue
-            except:
-                print "error reading service: "+i
-            if found==0:
-               print 'ignore '+i
-               continue
-
-            nummer=1
-            if '_OFF' in i: nummer=0
-            try:
-                if nummer==1:
-                   if name in runlevel:
-                      self.liststore.append([nummer,Son,name2,info,name])
-                   else:
-                      self.liststore.append([nummer,Son2,name2,info,name])
-                else:
-                   self.liststore.append([nummer,Soff,name2,info,name])
-            except:
-                pass
-        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()
-
-
-
-    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...
-     if os.getenv('UTF8_FILENAMES','0')=='1': codec1='utf_8'
-     I18N_ready = load_i18n('services.py.moo')
-     Soff=gtk.gdk.pixbuf_new_from_xpm_data(rot)
-     Son2=gtk.gdk.pixbuf_new_from_xpm_data(gelb)
-     Son =gtk.gdk.pixbuf_new_from_xpm_data(gruen)
-     app=startmenu()
-     app.main() 
-
-
index 2e42387..2f6764d 100755 (executable)
@@ -94,6 +94,8 @@ import pango
 import gobject
 import gc
 
+from gettext import gettext as _
+
 configfile=".config/openbox/lxde-rc.xml"
 mybuffer=None
 helpwindow=None
@@ -135,7 +137,7 @@ def create_help_view(data=None):
        helpwindow.present()
        return
     helpwindow = gtk.Window(gtk.WINDOW_TOPLEVEL)
-    helpwindow.set_title(i18n('Help: keyboard codes'))
+    helpwindow.set_title(_('Help: keyboard codes'))
     helpwindow.set_size_request(600,400)
     helpwindow.set_position(gtk.WIN_POS_CENTER_ALWAYS)
     helpwindow.connect("destroy", destroy_help_view)
@@ -359,7 +361,7 @@ class Tool:
 
     def add_new_keybinding(self,data=None):
         self.count_list+=1
-        self.liststore.append(['F12','F12','Execute(command='+i18n("NameOfProgram")+',)','add'])     
+        self.liststore.append(['F12','F12','Execute(command='+_("NameOfProgram")+',)','add'])     
 
 
     def delete_keybinding(self,data=None):
@@ -429,7 +431,7 @@ class Tool:
         window.connect("destroy", self.destroy)
     
         # Sets the border width of the window.
-        window.set_title(i18n('openbox keyboard bindings'))
+        window.set_title(_('openbox keyboard bindings'))
         window.set_size_request(400,200)
         window.resize(self.width, self.height)
         window.move(self.pos_x,self.pos_y)
@@ -445,8 +447,8 @@ class Tool:
         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.spalte1 = gtk.TreeViewColumn(_('Key'))
+        self.spalte2 = gtk.TreeViewColumn(_('Action'))
         self.treeview.append_column(self.spalte1)
         self.treeview.append_column(self.spalte2)
         self.spalte1.pack_start(self.cell1,True)
@@ -520,7 +522,7 @@ class Tool:
         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=gtk.CheckButton(_("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)