Browse Source

Initial setup.py

- Refactored project structure.
- Fixed import.
- Add launch script.
- Fixed *.mo loading dir.
- Updated documentation
fix_readme
Bogdan Cordier 4 years ago
parent
commit
dcd06a2d17

+ 4
- 4
Makefile View File

@@ -1,9 +1,9 @@
1 1
 .PHONY: po mo
2 2
 
3 3
 po:
4
-	xgettext -LPython -o data/locales/po/hadaly.pot --from-code=UTF-8 hadaly/*.kv hadaly/*.py	
5
-	msgmerge --update --no-fuzzy-matching --backup=off data/locales/po/fr.po data/locales/po/hadaly.pot
4
+	xgettext -LPython -o hadaly/data/locales/po/hadaly.pot --from-code=UTF-8 hadaly/*.kv hadaly/*.py
5
+	msgmerge --update --no-fuzzy-matching --backup=off hadaly/data/locales/po/fr.po hadaly/data/locales/po/hadaly.pot
6 6
 
7 7
 mo:
8
-	mkdir -p data/locales/fr/LC_MESSAGES
9
-	msgfmt data/locales/po/fr.po -o data/locales/fr/LC_MESSAGES/hadaly.mo
8
+	mkdir -p hadaly/data/locales/fr/LC_MESSAGES
9
+	msgfmt hadaly/data/locales/po/fr.po -o hadaly/data/locales/fr/LC_MESSAGES/hadaly.mo

+ 2
- 4
docs/installation.rst View File

@@ -25,16 +25,14 @@ Requirements
25 25
     ::
26 26
 
27 27
         pip install kivy-garden
28
-
29 28
         garden install magnet
30
-        garden install filechooserthumbview
31 29
 
32
-For now, no setup or binary are available, you have to clone the repository:
33 30
 
34 31
 ::
35 32
 
36 33
     git clone https://github.com/octogene/hadaly.git
37
-
34
+    cd hadaly
35
+    python setup.py install
38 36
 
39 37
 Windows
40 38
 ~~~~~~~

+ 7
- 2
docs/usage.rst View File

@@ -6,11 +6,16 @@ GNU/Linux
6 6
 
7 7
 ::
8 8
 
9
-    python hadaly.py [file.opah]
9
+    hadaly [file.opah]
10 10
 
11 11
 
12 12
 
13 13
 Windows
14 14
 ~~~~~~~
15 15
 
16
-For now, to directly open a presentation file (\*.opah) you'll have to drag'n drop the file on the hadaly.exe executable or the shortcut.
16
+::
17
+
18
+    hadaly.exe [file.opah]
19
+
20
+
21
+Or open *.opah files like any other by double clicking on it.

+ 0
- 7
hadaly.py View File

@@ -1,7 +0,0 @@
1
-#!/usr/bin/env python
2
-#-*- coding: utf-8 -*-
3
-
4
-from hadaly.__main__ import main
5
-
6
-if __name__ == '__main__':
7
-    main()

+ 7
- 7
hadaly/__main__.py View File

@@ -1,19 +1,19 @@
1 1
 #!/usr/bin/env python
2 2
 # -*- coding: utf-8 -*-
3
-
4
-__version__ = '0.1a'
5
-
3
+from __future__ import absolute_import
4
+import os, sys
6 5
 
7 6
 def main(args=None):
8
-    from app import HadalyApp
7
+    from .app import HadalyApp
9 8
     import locale
10 9
     import gettext
11 10
 
12 11
     current_locale, encoding = locale.getdefaultlocale()
13
-    language = gettext.translation('hadaly', 'data/locales/',
14
-                                   [current_locale], fallback=True)
12
+    abspath = os.path.abspath(os.path.dirname(sys.argv[0]))
13
+    langpath = abspath + '/data/locales/'
14
+    language = gettext.translation('hadaly', langpath,
15
+                                   [current_locale])
15 16
     language.install()
16
-
17 17
     HadalyApp().run()
18 18
 
19 19
 

+ 6
- 6
hadaly/app.py View File

@@ -1,5 +1,5 @@
1 1
 # -*- coding: utf-8 -*-
2
-from __future__ import division, unicode_literals
2
+from __future__ import division, unicode_literals, absolute_import
3 3
 import shutil
4 4
 
5 5
 from kivy import require
@@ -9,7 +9,7 @@ require('1.9.0')
9 9
 import os, json
10 10
 from sys import argv
11 11
 
12
-import __main__
12
+from .meta import version as app_version
13 13
 import urllib
14 14
 import re
15 15
 
@@ -32,16 +32,16 @@ from kivy.uix.popup import Popup
32 32
 from kivy.uix.label import Label
33 33
 from kivy.factory import Factory
34 34
 from kivy.uix.progressbar import ProgressBar
35
-from editor import Slide, SlideInfoDialog, DraggableSlide
36
-from viewer import SlideBox
35
+from .editor import Slide, SlideInfoDialog, DraggableSlide
36
+from .viewer import SlideBox
37 37
 from kivy.logger import Logger
38 38
 from kivy.network.urlrequest import UrlRequest
39
-from hadaly.search import ItemButton
39
+from .search import ItemButton
40 40
 from kivy.uix.filechooser import FileChooserIconView, FileChooserListView
41 41
 
42 42
 
43 43
 class HadalyApp(App):
44
-    presentation = DictProperty({'app': ('hadaly', __main__.__version__), 'title': 'New Title', 'slides': []})
44
+    presentation = DictProperty({'app': ('hadaly', app_version), 'title': 'New Title', 'slides': []})
45 45
 
46 46
     slides_list = ListProperty()
47 47
 

data/fonts/fontawesome-webfont.ttf → hadaly/data/fonts/fontawesome-webfont.ttf View File


data/icon.png → hadaly/data/icon.png View File


data/icon/128x128/icon.png → hadaly/data/icon/128x128/icon.png View File


data/icon/32x32/icon.png → hadaly/data/icon/32x32/icon.png View File


data/icon/48x48/icon.png → hadaly/data/icon/48x48/icon.png View File


data/icon/64x64/icon.png → hadaly/data/icon/64x64/icon.png View File


data/icon/icon.ico → hadaly/data/icon/icon.ico View File


data/icon/icon.svg → hadaly/data/icon/icon.svg View File


data/locales/po/fr.po → hadaly/data/locales/po/fr.po View File


data/presplash.jpg → hadaly/data/presplash.jpg View File


data/settings_panel.json → hadaly/data/settings_panel.json View File


+ 1
- 1
hadaly/editor.py View File

@@ -1,5 +1,5 @@
1 1
 # -*- coding: utf-8 -*-
2
-from __future__ import division, unicode_literals
2
+from __future__ import division, unicode_literals, absolute_import
3 3
 
4 4
 import os
5 5
 from functools import partial

+ 3
- 3
hadaly/hadaly.kv View File

@@ -1,4 +1,4 @@
1 1
 #:kivy 1.9.0
2
-#:include hadaly/editor.kv
3
-#:include hadaly/viewer.kv
4
-#:include hadaly/search.kv
2
+#:include editor.kv
3
+#:include viewer.kv
4
+#:include search.kv

+ 7
- 0
hadaly/meta.py View File

@@ -0,0 +1,7 @@
1
+"""This module contains metadata about the project."""
2
+title = 'hadaly'
3
+version = '0.1a'
4
+description = 'Presentation software for art historians'
5
+author = 'Bogdan Cordie'
6
+author_email = 'ooctogene@gmail.com'
7
+license = 'GPLv3'

+ 1
- 1
hadaly/search.py View File

@@ -1,5 +1,5 @@
1 1
 # -*- coding: utf-8 -*-
2
-from __future__ import division, unicode_literals
2
+from __future__ import division, unicode_literals, absolute_import
3 3
 
4 4
 try:
5 5
     from urlparse import urlparse, parse_qs

+ 1
- 1
hadaly/viewer.py View File

@@ -1,5 +1,5 @@
1 1
 # -*- coding: utf-8 -*-
2
-from __future__ import division, unicode_literals
2
+from __future__ import division, unicode_literals, absolute_import
3 3
 
4 4
 from kivy.uix.screenmanager import Screen
5 5
 from kivy.uix.scatter import Matrix

+ 5
- 0
scripts/hadaly View File

@@ -0,0 +1,5 @@
1
+#!/usr/bin/env python
2
+import runpy
3
+
4
+if __name__ == '__main__':
5
+    runpy.run_module('hadaly', run_name=__name__, alter_sys=True)

+ 37
- 0
setup.py View File

@@ -0,0 +1,37 @@
1
+#!/usr/bin/env python
2
+import os
3
+from setuptools import setup, find_packages
4
+from hadaly import meta
5
+
6
+def read(fname):
7
+    return open(os.path.join(os.path.dirname(__file__), fname)).read()
8
+
9
+setup(
10
+    name='hadaly',
11
+    version=meta.version,
12
+    description=meta.description,
13
+    packages=find_packages(),
14
+    url='https://octogene.github.io/hadaly/',
15
+    license=meta.license,
16
+    author=meta.author,
17
+    author_email=meta.author_email,
18
+    requires=['lxml', 'Pillow', 'kivy'],
19
+    long_description=read('README.md'),
20
+    package_data={'hadaly': ['data/*.png',
21
+                             'data/fonts/*.ttf',
22
+                             'data/locales/fr/LC_MESSAGES/*.mo']},
23
+    include_package_data=True,
24
+    classifiers=[
25
+        "Development Status :: 3 - Alpha",
26
+        "Environment :: X11 Applications",
27
+        "Programming Language :: Python :: 2.7",
28
+        "Operating System :: OS Independent",
29
+        "Natural Language :: English",
30
+        "Natural Language :: French",
31
+        "Topic :: Education",
32
+        "Intended Audience :: Education",
33
+        "License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
34
+    ],
35
+    scripts = ['scripts/hadaly'],
36
+    zip_safe = False,
37
+)

Loading…
Cancel
Save