fix base dir
This commit is contained in:
parent
28253c05b5
commit
4a6533e1c9
7
ECD.py
7
ECD.py
@ -1,7 +1,12 @@
|
|||||||
|
import os
|
||||||
|
os.environ['PROJ_LIB'] = os.path.join(os.path.dirname(__file__), 'share/proj')
|
||||||
|
os.environ['GDAL_DATA'] = os.path.join(os.path.dirname(__file__), 'share')
|
||||||
|
os.environ['ECD_BASEDIR'] = os.path.dirname(__file__)
|
||||||
|
BASE_DIR = os.path.dirname(__file__)
|
||||||
from rscder import MulStart
|
from rscder import MulStart
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
logging.basicConfig(level=logging.INFO, filename='log.txt', filemode='w', format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
|
logging.basicConfig(level=logging.INFO, filename=os.path.join(BASE_DIR, 'log.txt'), filemode='a', format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
nuitka ECD.py --standalone --plugin-enable=qt-plugins --plugin-enable=numpy --show-progress --include-package=qgis --plugin-enable=pylint-warnings --output-dir=package --windows-icon-from-ico=logo.ico --no-pyi-file --follow-import-to=rscder --include-package=osgeo --include-package=PyQtAds
|
nuitka ECD.py --standalone --plugin-enable=pyqt5 --include-qt-plugins=sensible,styles --plugin-enable=numpy --show-progress --include-package=qgis --output-dir=package --windows-icon-from-ico=logo.ico
|
||||||
|
xcopy /Y icons/* package/ECD.dist/
|
||||||
@REM nuitka keygen.py --standalone --plugin-enable=qt-plugins --plugin-enable=numpy --show-progress --plugin-enable=pylint-warnings --output-dir=package --windows-disable-console --windows-icon-from-ico=logo.ico --no-pyi-file
|
@REM nuitka keygen.py --standalone --plugin-enable=qt-plugins --plugin-enable=numpy --show-progress --plugin-enable=pylint-warnings --output-dir=package --windows-disable-console --windows-icon-from-ico=logo.ico --no-pyi-file
|
||||||
|
|
||||||
|
|
||||||
|
4
log.txt
4
log.txt
@ -2,3 +2,7 @@
|
|||||||
2022-05-28 21:40:04,316 - root - INFO - remain_days: 186
|
2022-05-28 21:40:04,316 - root - INFO - remain_days: 186
|
||||||
2022-05-28 21:40:05,077 - root - INFO - lic data:2022-12-01 00:00:00
|
2022-05-28 21:40:05,077 - root - INFO - lic data:2022-12-01 00:00:00
|
||||||
2022-05-28 21:40:05,077 - root - INFO - remain_days: 186
|
2022-05-28 21:40:05,077 - root - INFO - remain_days: 186
|
||||||
|
2022-05-31 13:03:21,977 - root - INFO - lic data:2022-12-01 00:00:00
|
||||||
|
2022-05-31 13:03:21,997 - root - INFO - remain_days: 183
|
||||||
|
2022-05-31 13:03:23,512 - root - INFO - lic data:2022-12-01 00:00:00
|
||||||
|
2022-05-31 13:03:23,512 - root - INFO - remain_days: 183
|
||||||
|
@ -4,7 +4,7 @@ from typing import Tuple
|
|||||||
from PyQt5.QtCore import QSettings
|
from PyQt5.QtCore import QSettings
|
||||||
from rscder.utils.license import LicenseHelper
|
from rscder.utils.license import LicenseHelper
|
||||||
import yaml
|
import yaml
|
||||||
|
BASE_DIR = os.environ['ECD_BASEDIR']
|
||||||
class Settings(QSettings):
|
class Settings(QSettings):
|
||||||
|
|
||||||
def __init__(self, key):
|
def __init__(self, key):
|
||||||
@ -23,7 +23,7 @@ class Settings(QSettings):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def root(self):
|
def root(self):
|
||||||
_r = './plugins'
|
_r = os.path.join(BASE_DIR, '/plugins')
|
||||||
if not os.path.exists(_r):
|
if not os.path.exists(_r):
|
||||||
os.makedirs(_r)
|
os.makedirs(_r)
|
||||||
return _r
|
return _r
|
||||||
@ -105,10 +105,11 @@ class Settings(QSettings):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def end_date(self):
|
def end_date(self):
|
||||||
if not os.path.exists('lic/license.lic'):
|
lic_path = os.path.join(BASE_DIR, 'lic', 'license.lic')
|
||||||
|
if not os.path.exists(lic_path):
|
||||||
return datetime.now()
|
return datetime.now()
|
||||||
|
|
||||||
with open('lic/license.lic', 'r') as f:
|
with open(lic_path, 'r') as f:
|
||||||
lic = f.read()[::-1]
|
lic = f.read()[::-1]
|
||||||
|
|
||||||
lic_helper = LicenseHelper()
|
lic_helper = LicenseHelper()
|
||||||
@ -124,10 +125,11 @@ class Settings(QSettings):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def license(self):
|
def license(self):
|
||||||
if not os.path.exists('lic/license.lic'):
|
lic_path =os.path.join(BASE_DIR, 'lic', 'license.lic')
|
||||||
|
if not os.path.join(lic_path):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
with open('lic/license.lic', 'r') as f:
|
with open(lic_path, 'r') as f:
|
||||||
lic = f.read()[::-1]
|
lic = f.read()[::-1]
|
||||||
|
|
||||||
lic_helper = LicenseHelper()
|
lic_helper = LicenseHelper()
|
||||||
@ -144,7 +146,7 @@ class Settings(QSettings):
|
|||||||
@property
|
@property
|
||||||
def root(self):
|
def root(self):
|
||||||
with Settings(Settings.General.PRE) as s:
|
with Settings(Settings.General.PRE) as s:
|
||||||
return s.value('root', './')
|
return s.value('root', BASE_DIR)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def auto_save(self):
|
def auto_save(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user