Browse Source

Make desktop file for set_active

Maarten van den Berg 6 years ago
parent
commit
9c2804f8a0
3 changed files with 40 additions and 1 deletions
  1. 36 0
      bin/install-service-files.py
  2. 3 0
      bin/piket-manage-people
  3. 1 1
      setup.py

+ 36 - 0
bin/install-service-files.py

@@ -1,11 +1,16 @@
1 1
 import os.path
2 2
 import sys
3 3
 
4
+from piket_client.gui import PiketMainWindow
5
+
6
+icons_dir = PiketMainWindow.icons_dir
7
+
4 8
 systemd_user_dir = os.path.expanduser("~/.config/systemd/user")
5 9
 
6 10
 python_interpreter_dir = os.path.dirname(sys.executable)
7 11
 uwsgi_path = os.path.join(python_interpreter_dir, "uwsgi")
8 12
 piket_client_path = os.path.join(python_interpreter_dir, "piket-client")
13
+piket_manage_people_path = os.path.join(python_interpreter_dir, "piket-manage-people")
9 14
 
10 15
 server_template = f"""[Unit]
11 16
 Description=piket server daemon
@@ -42,4 +47,35 @@ with open(os.path.join(systemd_user_dir, "piket-server.service"), "w") as f:
42 47
 with open(os.path.join(systemd_user_dir, "piket-client.service"), "w") as f:
43 48
     f.write(client_template)
44 49
 
50
+# Desktop files
51
+main_template = f"""[Desktop Entry]
52
+Version=0.1.0
53
+Type=Application
54
+Name=Start Bierlijst
55
+Terminal=False
56
+Comment=V-V-V-OUWEN!!!
57
+Exec=systemctl --user start piket-client
58
+Icon={os.path.join(icons_dir, "white_beer_bottle.svg")}
59
+"""
60
+
61
+manage_people = f"""[Desktop Entry]
62
+Version=0.1.0
63
+Type=Application
64
+Name=Personen aanwezig
65
+Terminal=False
66
+Comment=Stel in wie er is.
67
+Exec={sys.executable} -m piket_client.set_active
68
+Icon={os.path.join(icons_dir, "white_add_person.svg")}
69
+"""
70
+
71
+with open(
72
+    os.path.join(os.path.expanduser("~/Desktop"), "piket-client.desktop"), "w"
73
+) as f:
74
+    f.write(main_template)
75
+
76
+with open(
77
+    os.path.join(os.path.expanduser("~/Desktop"), "piket-manage-people.desktop"), "w"
78
+) as f:
79
+    f.write(manage_people)
80
+
45 81
 print("Done! Don't forget to systemctl --user daemon-reload.")

+ 3 - 0
bin/piket-manage-people

@@ -0,0 +1,3 @@
1
+#!/bin/bash
2
+
3
+python -m piket_client.set_active

+ 1 - 1
setup.py

@@ -14,7 +14,7 @@ setup(
14 14
     author_email="maartenberg1+pypi@gmail.com",
15 15
     license="MIT",
16 16
     packages=["piket_client", "piket_server"],
17
-    scripts=["bin/piket-server", "bin/piket-server-dev"],
17
+    scripts=["bin/piket-server", "bin/piket-server-dev", "bin/piket-manage-people"],
18 18
     entry_points={
19 19
         "console_scripts": [
20 20
             "piket-client=piket_client.gui:main",