Improved console
This commit is contained in:
@@ -8,8 +8,8 @@ from sh_edraft.configuration.model.configuration_variable_name import Configurat
|
||||
from sh_edraft.environment.base.environment_base import EnvironmentBase
|
||||
from sh_edraft.environment.hosting_environment import HostingEnvironment
|
||||
from sh_edraft.environment.model.environment_name import EnvironmentName
|
||||
from sh_edraft.utils.console.console import Console
|
||||
from sh_edraft.utils.console.model.foreground_color import ForegroundColor
|
||||
from sh_edraft.console.console import Console
|
||||
from sh_edraft.console.model import ForegroundColor
|
||||
|
||||
|
||||
class Configuration(ConfigurationBase):
|
||||
|
@@ -1,12 +1,9 @@
|
||||
import contextlib
|
||||
import io
|
||||
import os
|
||||
import sys
|
||||
from typing import Union, Optional
|
||||
from termcolor import colored
|
||||
|
||||
from sh_edraft.utils.console.model.background_color import BackgroundColor
|
||||
from sh_edraft.utils.console.model.foreground_color import ForegroundColor
|
||||
from sh_edraft.console.model.background_color import BackgroundColor
|
||||
from sh_edraft.console.model.foreground_color import ForegroundColor
|
||||
|
||||
|
||||
class Console:
|
||||
@@ -93,17 +90,24 @@ class Console:
|
||||
|
||||
@staticmethod
|
||||
def close():
|
||||
Console.read_line('\nPress any key to continue...')
|
||||
Console.reset()
|
||||
Console.write('\n\n\nPress any key to continue...')
|
||||
Console.read_line()
|
||||
exit()
|
||||
|
||||
@staticmethod
|
||||
def read(output: str = None) -> str:
|
||||
user_input = input(output if output else '')
|
||||
return user_input[0]
|
||||
@classmethod
|
||||
def read(cls, output: str = None) -> str:
|
||||
if output is not None:
|
||||
cls.write(output)
|
||||
|
||||
@staticmethod
|
||||
def read_line(output: str = None) -> str:
|
||||
return input(output if output else '')
|
||||
return input()[0]
|
||||
|
||||
@classmethod
|
||||
def read_line(cls, output: str = None) -> str:
|
||||
if output is not None:
|
||||
cls.write(output)
|
||||
|
||||
return input()
|
||||
|
||||
@classmethod
|
||||
def reset(cls):
|
||||
@@ -118,14 +122,16 @@ class Console:
|
||||
@classmethod
|
||||
def write_at(cls, x: int, y: int, *args):
|
||||
string = ' '.join(map(str, args))
|
||||
cls._output(string, x, y)
|
||||
cls._output(string, x, y, end='')
|
||||
|
||||
@classmethod
|
||||
def write_line(cls, *args):
|
||||
string = ' '.join(map(str, args))
|
||||
cls._output(string)
|
||||
cls._output('')
|
||||
cls._output(string, end='')
|
||||
|
||||
@classmethod
|
||||
def write_line_at(cls, x: int, y: int, *args):
|
||||
string = ' '.join(map(str, args))
|
||||
cls._output(string, x, y)
|
||||
cls._output('', end='')
|
||||
cls._output(string, x, y, end='')
|
@@ -5,8 +5,8 @@ from sqlalchemy.orm import Session, sessionmaker
|
||||
|
||||
from sh_edraft.database.connection.base.database_connection_base import DatabaseConnectionBase
|
||||
from sh_edraft.database.model.database_settings import DatabaseSettings
|
||||
from sh_edraft.utils.console.console import Console
|
||||
from sh_edraft.utils.console.model.foreground_color import ForegroundColor
|
||||
from sh_edraft.console.console import Console
|
||||
from sh_edraft.console.model.foreground_color import ForegroundColor
|
||||
|
||||
|
||||
class DatabaseConnection(DatabaseConnectionBase):
|
||||
|
@@ -6,8 +6,8 @@ from sh_edraft.database.connection.base.database_connection_base import Database
|
||||
from sh_edraft.database.context.base.database_context_base import DatabaseContextBase
|
||||
from sh_edraft.database.model.dbmodel import DBModel
|
||||
from sh_edraft.database.model.database_settings import DatabaseSettings
|
||||
from sh_edraft.utils.console.console import Console
|
||||
from sh_edraft.utils.console.model.foreground_color import ForegroundColor
|
||||
from sh_edraft.console.console import Console
|
||||
from sh_edraft.console.model.foreground_color import ForegroundColor
|
||||
|
||||
|
||||
class DatabaseContext(DatabaseContextBase):
|
||||
|
@@ -3,8 +3,8 @@ from typing import Optional
|
||||
|
||||
from sh_edraft.configuration.base.configuration_model_base import ConfigurationModelBase
|
||||
from sh_edraft.database.model.database_settings_name import DatabaseSettingsName
|
||||
from sh_edraft.utils.console.console import Console
|
||||
from sh_edraft.utils.console.model.foreground_color import ForegroundColor
|
||||
from sh_edraft.console.console import Console
|
||||
from sh_edraft.console.model.foreground_color import ForegroundColor
|
||||
|
||||
|
||||
class DatabaseSettings(ConfigurationModelBase):
|
||||
|
@@ -8,7 +8,7 @@ from sh_edraft.hosting.application_runtime import ApplicationRuntime
|
||||
from sh_edraft.hosting.base.application_host_base import ApplicationHostBase
|
||||
from sh_edraft.service.providing.service_provider import ServiceProvider
|
||||
from sh_edraft.service.providing.base.service_provider_base import ServiceProviderBase
|
||||
from sh_edraft.utils.console import Console
|
||||
from sh_edraft.console import Console
|
||||
|
||||
|
||||
class ApplicationHost(ApplicationHostBase):
|
||||
|
@@ -8,8 +8,8 @@ from sh_edraft.logging.base.logger_base import LoggerBase
|
||||
from sh_edraft.logging.model.logging_settings import LoggingSettings
|
||||
from sh_edraft.logging.model.logging_level import LoggingLevel
|
||||
from sh_edraft.time.model.time_format_settings import TimeFormatSettings
|
||||
from sh_edraft.utils.console.console import Console
|
||||
from sh_edraft.utils.console.model.foreground_color import ForegroundColor
|
||||
from sh_edraft.console.console import Console
|
||||
from sh_edraft.console.model.foreground_color import ForegroundColor
|
||||
|
||||
|
||||
class Logger(LoggerBase):
|
||||
|
@@ -4,8 +4,8 @@ from typing import Optional
|
||||
from sh_edraft.configuration.base.configuration_model_base import ConfigurationModelBase
|
||||
from sh_edraft.logging.model.logging_settings_name import LoggingSettingsName
|
||||
from sh_edraft.logging.model.logging_level import LoggingLevel
|
||||
from sh_edraft.utils.console.console import Console
|
||||
from sh_edraft.utils.console.model.foreground_color import ForegroundColor
|
||||
from sh_edraft.console.console import Console
|
||||
from sh_edraft.console.model.foreground_color import ForegroundColor
|
||||
|
||||
|
||||
class LoggingSettings(ConfigurationModelBase):
|
||||
|
@@ -4,8 +4,8 @@ from typing import Optional
|
||||
from sh_edraft.configuration.base.configuration_model_base import ConfigurationModelBase
|
||||
from sh_edraft.publishing.model.template import Template
|
||||
from sh_edraft.publishing.model.publish_settings_name import PublishSettingsName
|
||||
from sh_edraft.utils.console.console import Console
|
||||
from sh_edraft.utils.console.model.foreground_color import ForegroundColor
|
||||
from sh_edraft.console.console import Console
|
||||
from sh_edraft.console.model.foreground_color import ForegroundColor
|
||||
|
||||
|
||||
class PublishSettings(ConfigurationModelBase):
|
||||
|
@@ -3,8 +3,8 @@ from typing import Optional
|
||||
|
||||
from sh_edraft.configuration.base.configuration_model_base import ConfigurationModelBase
|
||||
from sh_edraft.time.model.time_format_settings_names import TimeFormatSettingsNames
|
||||
from sh_edraft.utils.console.console import Console
|
||||
from sh_edraft.utils.console.model.foreground_color import ForegroundColor
|
||||
from sh_edraft.console.console import Console
|
||||
from sh_edraft.console.model.foreground_color import ForegroundColor
|
||||
|
||||
|
||||
class TimeFormatSettings(ConfigurationModelBase):
|
||||
|
@@ -20,7 +20,6 @@ __version__ = '2020.12.5'
|
||||
from collections import namedtuple
|
||||
|
||||
# imports:
|
||||
from .console import Console
|
||||
from .credential_manager import CredentialManager
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
|
Reference in New Issue
Block a user