فهرست منبع

change: home_dir multiuser

micha 15 ساعت پیش
والد
کامیت
3d87664650
7فایلهای تغییر یافته به همراه25 افزوده شده و 11 حذف شده
  1. 3 1
      _LibreLightDesk.py
  2. 2 2
      desktop/convert_mp4.desktop
  3. 1 1
      desktop/upgradeLibreLight.desktop
  4. 5 1
      lib/fifo.py
  5. 6 3
      lib/fixlib.py
  6. 5 2
      lib/libconfig.py
  7. 3 1
      lib/mytklib.py

+ 3 - 1
_LibreLightDesk.py

@@ -71,8 +71,10 @@ space_font = None
 INIT_OK = 0
 _global_short_key = 1
 
+from pathlib import Path
+home_dir = str(Path.home())
 
-path = "/home/user/LibreLight/"
+path = home_dir+"/LibreLight/"
 #os.chdir(path)
 f = open(path+"init.txt","r")
 lines=f.readlines()

+ 2 - 2
desktop/convert_mp4.desktop

@@ -3,8 +3,8 @@ Version=1.0
 Type=Application
 Name=convert mp4
 Comment=verkleinert die Videodateien in der Auflösung
-Exec=xterm -e 'python3 /home/user/LibreLight/video/converter/convert.py'
+Exec=xterm -e 'python3 ~/LibreLight/video/converter/convert.py'
 Icon=view-restore
-Path=/home/user/LibreLight/video/converter/
+Path=~/LibreLight/video/converter/
 Terminal=true
 StartupNotify=false

+ 1 - 1
desktop/upgradeLibreLight.desktop

@@ -4,6 +4,6 @@ Type=Application
 Name=upgrade LibreLight
 Exec=xfce4-terminal -e 'sh /opt/LibreLight/Xdesk/upgrade.sh'
 Icon=software-update-available
-Path=/home/user/
+Path=~
 Terminal=true
 StartupNotify=false

+ 5 - 1
lib/fifo.py

@@ -1,6 +1,10 @@
 
 cmd="mkfifo backpipe"
-fname = "/home/user/backpipe" # fifo named pipe
+
+from pathlib import Path
+home_dir = str(Path.home())
+
+fname = home_dir+"/backpipe" # fifo named pipe
 import json
 import sys
 import os

+ 6 - 3
lib/fixlib.py

@@ -8,7 +8,10 @@ import __main__  as MAIN
 from collections import OrderedDict
 from lib.cprint import *
 
-HOME = os.getenv('HOME')
+from pathlib import Path
+home_dir = str(Path.home())
+
+
 
 def _fixture_decode_sav_line(line):
     out = None
@@ -171,7 +174,7 @@ def index_fixtures():
 #def _fixture_create_import_list(path=None):
 def _fixture_load_import_list(path=None):
     if not path:
-        path = "/home/user/LibreLight/show"
+        path = home_dir+"/LibreLight/show"
 
     blist = []
     lsd = os.listdir(path)
@@ -300,7 +303,7 @@ def _load_fixture_list(mode="None"):
     blist = []
 
     if mode == "USER":
-        path = HOME+"/LibreLight/fixtures/"
+        path = home_dir+"/LibreLight/fixtures/"
 
     elif mode == "GLOBAL":
         path="/opt/LibreLight/Xdesk/fixtures/"

+ 5 - 2
lib/libconfig.py

@@ -3,6 +3,9 @@
 import os
 import json
 
+from pathlib import Path
+home_dir = str(Path.home())
+
 h = os.environ["HOME"]
 
 def cprint(txt,*args):
@@ -85,7 +88,7 @@ def _load_config():
 
 
 def load_remote_ip():
-    cfg_file = "/home/user/LibreLight/config.json"
+    cfg_file = home_dir+"/LibreLight/config.json"
     
     ip = _load_remote_ip(cfg_file)
     if not ip:
@@ -101,7 +104,7 @@ def load_remote_ip():
 
 def check_pro_easy():
     try:
-        f = open("/home/user/LibreLight/config.json")
+        f = open(home_dir+"/LibreLight/config.json")
         lines = f.readlines()
         f.close()
         for line in lines:

+ 3 - 1
lib/mytklib.py

@@ -7,6 +7,8 @@ import time
 #import _thread as thread
 import os
 
+from pathlib import Path
+home_dir = str(Path.home())
 
 def tk_btn_bg_loop(btn,c1="#00ffdd",c2="#00ffff",stime=time.time()):
     while time.time() < stime+10:
@@ -30,7 +32,7 @@ def tk_btn_bg_loop(btn,c1="#00ffdd",c2="#00ffff",stime=time.time()):
             change = 1
             time.sleep(0.5)
             if change:
-                if os.path.isfile("/home/user/LibreLight/blink"):
+                if os.path.isfile(home_dir+"/LibreLight/blink"):
                     c1 = "#0f0"
                     c2 = "#00f"
                 else: