Selaa lähdekoodia

Initial commit

Maarten van den Berg 6 vuotta sitten
commit
ce4d42be4e
8 muutettua tiedostoa jossa 98 lisäystä ja 0 poistoa
  1. 9 0
      .gitignore
  2. 1 0
      MANIFEST.in
  3. 13 0
      README.md
  4. 3 0
      piket/__init__.py
  5. 23 0
      piket/gui.py
  6. 14 0
      piket/sound.py
  7. BIN
      piket/sounds/plop.wav
  8. 35 0
      setup.py

+ 9 - 0
.gitignore

@@ -0,0 +1,9 @@
1
+# Compiled python modules.
2
+*.pyc
3
+
4
+# Setuptools distribution folder.
5
+/dist/
6
+
7
+# Python egg metadata, regenerated from source files by setuptools.
8
+/*.egg-info
9
+/*.egg

+ 1 - 0
MANIFEST.in

@@ -0,0 +1 @@
1
+include piket/sounds/*.wav

+ 13 - 0
README.md

@@ -0,0 +1,13 @@
1
+# piket
2
+
3
+## Attribution
4
+This project contains the following files from external sources:
5
+
6
+- ["Plop" sound effect][plopsound], by
7
+	[`michaelkoehler`][michaelkoehler-freesound],
8
+	licensed under [CC BY 3.0].
9
+	Located in `piket/sounds/plop.wav`.
10
+
11
+[plopsound]: https://freesound.org/people/michaelkoehler/sounds/207191/
12
+[michaelkoehler-freesound]: https://freesound.org/people/michaelkoehler/
13
+[CC BY 3.0]: https://creativecommons.org/licenses/by/3.0/

+ 3 - 0
piket/__init__.py

@@ -0,0 +1,3 @@
1
+"""
2
+Piket, a touch-screen interface for counting consumptions.
3
+"""

+ 23 - 0
piket/gui.py

@@ -0,0 +1,23 @@
1
+"""
2
+Provides the graphical front-end for Piket.
3
+"""
4
+import sys
5
+
6
+from PySide2.QtWidgets import QApplication, QPushButton
7
+
8
+from piket.sound import PLOP_WAVE
9
+
10
+
11
+def plop() -> None:
12
+    """ Asynchronously play the plop sound. """
13
+    PLOP_WAVE.play()
14
+
15
+
16
+if __name__ == "__main__":
17
+    app = QApplication(sys.argv)
18
+
19
+    button = QPushButton("Plop!")
20
+    button.clicked.connect(plop)
21
+
22
+    button.show()
23
+    app.exec_()

+ 14 - 0
piket/sound.py

@@ -0,0 +1,14 @@
1
+"""
2
+Provides functions related to playing sounds.
3
+"""
4
+
5
+import os
6
+
7
+import simpleaudio as sa
8
+
9
+
10
+SOUNDS_DIR = os.path.join(os.path.dirname(__file__), "sounds")
11
+""" Contains the absolute path to the sounds directory. """
12
+
13
+PLOP_WAVE = sa.WaveObject.from_wave_file(os.path.join(SOUNDS_DIR, "plop.wav"))
14
+""" SimpleAudio WaveObject containing the plop sound. """

BIN
piket/sounds/plop.wav


+ 35 - 0
setup.py

@@ -0,0 +1,35 @@
1
+from setuptools import setup
2
+
3
+setup(
4
+        name='piket',
5
+        version='0.0.1',
6
+
7
+        classifiers=[
8
+            'Development Status :: 2 - Pre-Alpha',
9
+            'License :: OSI Approved :: MIT License',
10
+            'Programming Language :: Python :: 3'
11
+            'Programming Language :: Python :: 3 :: Only',
12
+        ],
13
+
14
+        url='https://git.maartenberg.nl/maarten/piket',
15
+        author='Maarten van den Berg',
16
+        author_email='maartenberg1+pypi@gmail.com',
17
+
18
+        license='MIT',
19
+        packages=['piket'],
20
+
21
+        install_requires=[
22
+            'PySide2',
23
+            'simpleaudio',
24
+        ],
25
+
26
+        extras_require={
27
+            'dev': [
28
+                'black',
29
+                'pylint',
30
+            ],
31
+        },
32
+
33
+        include_package_data=True,
34
+        zip_safe=False
35
+)