Compare commits

...

10 commits

10 changed files with 82 additions and 19 deletions

2
.gitignore vendored
View file

@ -1,3 +1,5 @@
*~ *~
__pycache__ __pycache__
/build /build
/dist
/MANIFEST

2
MANIFEST.in Normal file
View file

@ -0,0 +1,2 @@
include etc/pylock.conf
include po/POTFILES.in po/pylock.pot po/*.po

8
po/POTFILES.in Normal file
View file

@ -0,0 +1,8 @@
[encoding: UTF-8]
pylock/__init__.py
pylock/Main.py
pylock/Locker.py
pylock/Selection.py
pylock/pam.py
pylock/LockWindow.py
[type: gettext/glade]pylock/data/unlock.ui

View file

@ -7,7 +7,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: pylock 0.1\n" "Project-Id-Version: pylock 0.1\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2013-04-12 16:37+0200\n" "POT-Creation-Date: 2013-04-16 10:35+0200\n"
"PO-Revision-Date: 2012-02-01 19:30+0100\n" "PO-Revision-Date: 2012-02-01 19:30+0100\n"
"Last-Translator: Matthias Schiffer <mschiffer@universe-factory.net>\n" "Last-Translator: Matthias Schiffer <mschiffer@universe-factory.net>\n"
"Language-Team: German <de@li.org>\n" "Language-Team: German <de@li.org>\n"
@ -16,11 +16,11 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
#: ../pylock/LockWindow.py:119 #: ../pylock/LockWindow.py:123
msgid "This computer is currently locked by the user <i>{username}</i>." msgid "This computer is currently locked by the user <i>{username}</i>."
msgstr "Dieser Computer ist zur Zeit vom Benutzer <i>{username}</i> gesperrt." msgstr "Dieser Computer ist zur Zeit vom Benutzer <i>{username}</i> gesperrt."
#: ../pylock/LockWindow.py:123 #: ../pylock/LockWindow.py:127
msgid "" msgid ""
"This computer is currently locked by the user <i>{username}</i>.\n" "This computer is currently locked by the user <i>{username}</i>.\n"
"The user can be logged out in {minutes:02}:{seconds:02} minutes." "The user can be logged out in {minutes:02}:{seconds:02} minutes."
@ -28,7 +28,7 @@ msgstr ""
"Dieser Computer ist zur Zeit vom Benutzer <i>{username}</i> gesperrt.\n" "Dieser Computer ist zur Zeit vom Benutzer <i>{username}</i> gesperrt.\n"
"Der Benutzer kann in {minutes:02}:{seconds:02} Minuten ausgeloggt werden." "Der Benutzer kann in {minutes:02}:{seconds:02} Minuten ausgeloggt werden."
#: ../pylock/LockWindow.py:128 #: ../pylock/LockWindow.py:132
msgid "" msgid ""
"This computer is currently locked by the user <i>{username}</i>.\n" "This computer is currently locked by the user <i>{username}</i>.\n"
"The user can be logged out now." "The user can be logged out now."
@ -36,14 +36,14 @@ msgstr ""
"Dieser Computer ist zur Zeit vom Benutzer <i>{username}</i> gesperrt.\n" "Dieser Computer ist zur Zeit vom Benutzer <i>{username}</i> gesperrt.\n"
"Der Benutzer kann jetzt ausgeloggt werden." "Der Benutzer kann jetzt ausgeloggt werden."
#: ../unlock.ui.h:1 #: ../pylock/data/unlock.ui.h:1
msgid "Password:" msgid "Password:"
msgstr "Passwort:" msgstr "Passwort:"
#: ../unlock.ui.h:2 #: ../pylock/data/unlock.ui.h:2
msgid "Unlock" msgid "Unlock"
msgstr "Entsperren" msgstr "Entsperren"
#: ../unlock.ui.h:3 #: ../pylock/data/unlock.ui.h:3
msgid "Logout" msgid "Logout"
msgstr "Ausloggen" msgstr "Ausloggen"

View file

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2013-04-12 18:43+0200\n" "POT-Creation-Date: 2013-04-16 10:35+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"

10
pylock.py Executable file
View file

@ -0,0 +1,10 @@
#!/usr/bin/env python3
import os
import sys
sys.path.insert(0, os.path.dirname(__file__))
from pylock import Main
Main.main()

View file

@ -58,7 +58,7 @@ class Locker(object):
if self.currentLogoutTimeout > 0: if self.currentLogoutTimeout > 0:
GLib.timeout_add_seconds(1, self._checkLogout) GLib.timeout_add_seconds(1, self._checkLogout)
return True return False
def unlock(self): def unlock(self):
if self.locked: if self.locked:

View file

@ -64,7 +64,7 @@ def main():
locale.textdomain('pylock') locale.textdomain('pylock')
if 'theme' in config: if 'theme' in config:
Gtk.Settings.get_defalt().set_property('gtk-theme-name', config['theme']) Gtk.Settings.get_default().set_property('gtk-theme-name', config['theme'])
def waitForSelection(): def waitForSelection():
if Selection.get() != 0: if Selection.get() != 0:

View file

@ -1,29 +1,70 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
import distutils import distutils.core
import DistUtilsExtra.auto import distutils.command.build
import distutils.command.install
import glob
import os import os
class build_pylock(distutils.command.build.build):
def run(self):
distutils.command.build.build.run(self)
data_files = self.distribution.data_files
if data_files is None:
# in case not data_files are defined in setup.py
self.distribution.data_files = data_files = []
for po_file in glob.glob("po/*.po"):
lang = os.path.basename(po_file[:-3])
mo_dir = os.path.join("build", "mo", lang, "LC_MESSAGES")
mo_file = os.path.join(mo_dir, "%s.mo" % self.distribution.metadata.name)
if not os.path.exists(mo_dir):
os.makedirs(mo_dir)
cmd = ["msgfmt", po_file, "-o", mo_file]
po_mtime = os.path.getmtime(po_file)
mo_mtime = os.path.exists(mo_file) and os.path.getmtime(mo_file) or 0
if po_mtime > mo_mtime:
self.spawn(cmd)
targetpath = os.path.join("share/locale", lang, "LC_MESSAGES")
data_files.append((targetpath, (mo_file,)))
class install_pylock(distutils.command.install.install): class install_pylock(distutils.command.install.install):
def run(self): def run(self):
distutils.dir_util.copy_tree('etc', os.path.join(self.root, '/etc'),
preserve_times=0, preserve_symlinks=1, verbose=1)
distutils.command.install.install.run(self) distutils.command.install.install.run(self)
DistUtilsExtra.auto.setup( distutils.dir_util.copy_tree('etc', os.path.join(self.root, 'etc'),
name = 'pylock', preserve_times=0, preserve_symlinks=1, verbose=1)
version = '1',
data_files = [], distutils.core.setup(
name = 'pylock',
version = '3',
author = 'Matthias Schiffer',
author_email = 'mschiffer@universe-factory.net',
url = 'http://git.universe-factory.net/pylock/',
description = 'A lightweight screenlocker for X implemented in Python 3 using Gtk3',
license = 'BSD',
packages = ['pylock'], packages = ['pylock'],
package_data = { package_data = {
'pylock': ['data/unlock.ui', 'data/bg.svg'], 'pylock': ['data/unlock.ui', 'data/bg.svg'],
}, },
scripts = ['scripts/pylock'],
cmdclass = { cmdclass = {
'build': build_pylock,
'install': install_pylock, 'install': install_pylock,
}, },
provides = ['pylock'],
requires = [
'gi.repository.Gtk',
'gi.repository.Gdk',
'gi.repository.GdkX11',
'gi.repository.GObject',
'gi.repository.GLib',
],
) )