2021.4 #19
@ -22,10 +22,12 @@
|
||||
<select />
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="7e2256bc-a6b8-4880-83a6-8b0e3372d0a4" name="Default Changelist" comment="Improved application host">
|
||||
<change afterPath="$PROJECT_DIR$/src/cpl.json" afterDir="false" />
|
||||
<list default="true" id="7e2256bc-a6b8-4880-83a6-8b0e3372d0a4" name="Default Changelist" comment="Added cpl.json">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/tests/cpl.json" beforeDir="false" afterPath="$PROJECT_DIR$/src/tests/cpl.json" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/cpl/application/application_host.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/cpl/application/application_host.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/cpl/application/application_runtime.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/cpl/application/application_runtime.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/cpl/application/application_runtime_abc.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/cpl/application/application_runtime_abc.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/cpl_cli/startup.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/cpl_cli/startup.py" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
@ -97,7 +99,7 @@
|
||||
<recent name="$PROJECT_DIR$/src/cpl/database" />
|
||||
</key>
|
||||
</component>
|
||||
<component name="RunManager" selected="Python.main cli">
|
||||
<component name="RunManager" selected="Python.cli help">
|
||||
<configuration name="cli build" type="PythonConfigurationType" factoryName="Python">
|
||||
<module name="sh_common_py_lib" />
|
||||
<option name="INTERPRETER_OPTIONS" value="" />
|
||||
@ -486,13 +488,6 @@
|
||||
<option name="presentableId" value="Default" />
|
||||
<updated>1605881914521</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00042" summary="Published for 2020.12.9">
|
||||
<created>1608049772153</created>
|
||||
<option name="number" value="00042" />
|
||||
<option name="presentableId" value="LOCAL-00042" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1608049772153</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00043" summary="Publish improvements for pip install">
|
||||
<created>1608059323858</created>
|
||||
<option name="number" value="00043" />
|
||||
@ -829,7 +824,14 @@
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1614837218919</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="91" />
|
||||
<task id="LOCAL-00091" summary="Added cpl.json">
|
||||
<created>1614837337289</created>
|
||||
<option name="number" value="00091" />
|
||||
<option name="presentableId" value="LOCAL-00091" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1614837337289</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="92" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="Vcs.Log.Tabs.Properties">
|
||||
@ -845,8 +847,6 @@
|
||||
<option name="oldMeFiltersMigrated" value="true" />
|
||||
</component>
|
||||
<component name="VcsManagerConfiguration">
|
||||
<MESSAGE value="Published" />
|
||||
<MESSAGE value="Improved publisher" />
|
||||
<MESSAGE value="Added imports" />
|
||||
<MESSAGE value="Removed build form gitignore, added build command" />
|
||||
<MESSAGE value="Added init file for build command package" />
|
||||
@ -870,7 +870,9 @@
|
||||
<MESSAGE value="Improved cli" />
|
||||
<MESSAGE value="Smaller bugfixes" />
|
||||
<MESSAGE value="Improved application host" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="Improved application host" />
|
||||
<MESSAGE value="Improved cpl.json" />
|
||||
<MESSAGE value="Added cpl.json" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="Added cpl.json" />
|
||||
</component>
|
||||
<component name="XDebuggerManager">
|
||||
<breakpoint-manager>
|
||||
|
@ -1,6 +1,5 @@
|
||||
import atexit
|
||||
from collections import Callable
|
||||
from datetime import datetime
|
||||
|
||||
from cpl.application.application_host_abc import ApplicationHostABC
|
||||
from cpl.application.application_runtime import ApplicationRuntime
|
||||
@ -22,10 +21,6 @@ class ApplicationHost(ApplicationHostABC):
|
||||
self._app_runtime = ApplicationRuntime(self._config)
|
||||
self._services = ServiceProvider(self._app_runtime)
|
||||
|
||||
# Set vars
|
||||
self._start_time: datetime = datetime.now()
|
||||
self._end_time: datetime = datetime.now()
|
||||
|
||||
@property
|
||||
def configuration(self) -> ConfigurationABC:
|
||||
return self._config
|
||||
|
@ -1,3 +1,4 @@
|
||||
import pathlib
|
||||
from datetime import datetime
|
||||
|
||||
from cpl.application.application_runtime_abc import ApplicationRuntimeABC
|
||||
@ -12,6 +13,8 @@ class ApplicationRuntime(ApplicationRuntimeABC):
|
||||
self._app_configuration = config
|
||||
self._start_time: datetime = datetime.now()
|
||||
self._end_time: datetime = datetime.now()
|
||||
self._working_directory = pathlib.Path().absolute()
|
||||
self._runtime_directory = pathlib.Path(__file__).parent.absolute()
|
||||
|
||||
@property
|
||||
def configuration(self) -> ConfigurationABC:
|
||||
@ -21,10 +24,6 @@ class ApplicationRuntime(ApplicationRuntimeABC):
|
||||
def start_time(self) -> datetime:
|
||||
return self._start_time
|
||||
|
||||
@start_time.setter
|
||||
def start_time(self, start_time: datetime):
|
||||
self._start_time = start_time
|
||||
|
||||
@property
|
||||
def end_time(self) -> datetime:
|
||||
return self._end_time
|
||||
@ -36,3 +35,21 @@ class ApplicationRuntime(ApplicationRuntimeABC):
|
||||
@property
|
||||
def date_time_now(self) -> datetime:
|
||||
return datetime.now()
|
||||
|
||||
@property
|
||||
def working_directory(self) -> str:
|
||||
return self._working_directory
|
||||
|
||||
def set_working_directory(self, path: str = ''):
|
||||
if path != '':
|
||||
self._working_directory = path
|
||||
return
|
||||
|
||||
self._working_directory = pathlib.Path().absolute()
|
||||
|
||||
@property
|
||||
def runtime_directory(self) -> str:
|
||||
return self._runtime_directory
|
||||
|
||||
def set_runtime_directory(self, file: str):
|
||||
self._runtime_directory = pathlib.Path(file).parent.absolute()
|
||||
|
@ -32,3 +32,14 @@ class ApplicationRuntimeABC(ABC):
|
||||
@property
|
||||
@abstractmethod
|
||||
def date_time_now(self) -> datetime: pass
|
||||
|
||||
@property
|
||||
@abstractmethod
|
||||
def working_directory(self) -> str: pass
|
||||
|
||||
@property
|
||||
@abstractmethod
|
||||
def runtime_directory(self) -> str: pass
|
||||
|
||||
@abstractmethod
|
||||
def set_runtime_directory(self, runtime_directory: str): pass
|
||||
|
@ -22,18 +22,20 @@ class Startup(StartupABC):
|
||||
|
||||
def create_application_host(self) -> ApplicationHostABC:
|
||||
self._app_host = ApplicationHost()
|
||||
|
||||
self._app_host.application_runtime.set_runtime_directory(__file__)
|
||||
self._app_host.console_argument_error_function(Error.error)
|
||||
|
||||
self._configuration = self._app_host.configuration
|
||||
self._services = self._app_host.services
|
||||
|
||||
self._app_host.console_argument_error_function(Error.error)
|
||||
|
||||
return self._app_host
|
||||
|
||||
def create_configuration(self) -> ConfigurationABC:
|
||||
self._configuration.add_environment_variables('PYTHON_')
|
||||
self._configuration.add_environment_variables('CPL_')
|
||||
self._configuration.add_console_argument('', 'help', ['h'], '')
|
||||
self._configuration.add_console_argument('', 'version', ['v'], '')
|
||||
self._configuration.add_console_argument('', 'help', ['-h', '-H'], '')
|
||||
self._configuration.add_console_argument('', 'version', ['-v', '-V'], '')
|
||||
self._configuration.add_console_arguments()
|
||||
|
||||
return self._configuration
|
||||
|
Loading…
Reference in New Issue
Block a user