Display banner

This commit is contained in:
Micah Lee 2021-06-09 17:31:06 -07:00
parent 1144fd9f87
commit 918e5fa306
No known key found for this signature in database
GPG key ID: 403C2657CD994F73
8 changed files with 183 additions and 7 deletions

View file

@ -7,7 +7,7 @@ This section documents the release process. Unless you're a dangerzone developer
Before making a release, all of these should be complete: Before making a release, all of these should be complete:
* Update `version` in `pyproject.toml` * Update `version` in `pyproject.toml`
* Update `dangerzone_version` in `dangerzone/__init__.py` * Update in `share/version.txt`
* Update version and download links in `README.md` * Update version and download links in `README.md`
* CHANGELOG.md should be updated to include a list of all major changes since the last release * CHANGELOG.md should be updated to include a list of all major changes since the last release
* There must be a PGP-signed git tag for the version, e.g. for dangerzone 0.1.0, the tag must be `v0.1.0` * There must be a PGP-signed git tag for the version, e.g. for dangerzone 0.1.0, the tag must be `v0.1.0`

View file

@ -1,8 +1,6 @@
import os import os
import sys import sys
dangerzone_version = "0.1.5"
# Depending on the filename, decide if we want to run: # Depending on the filename, decide if we want to run:
# dangerzone, dangerzone-cli, or dangerzone-container # dangerzone, dangerzone-cli, or dangerzone-container

View file

@ -1,9 +1,174 @@
import os import os
import shutil import shutil
import click import click
import colorama
from colorama import Fore, Back, Style
from .global_common import GlobalCommon from .global_common import GlobalCommon
from .common import Common from .common import Common
from dangerzone import global_common
def display_banner(global_common):
"""
Raw ASCII art example:
Dangerzone v0.1.5
https://dangerzone.rocks
"""
colorama.init(autoreset=True)
print(Fore.YELLOW + Style.DIM + "╭──────────────────────────╮")
print(
Fore.YELLOW
+ Style.DIM
+ ""
+ Fore.LIGHTYELLOW_EX
+ Style.NORMAL
+ " ▄██▄ "
+ Fore.YELLOW
+ Style.DIM
+ ""
)
print(
Fore.YELLOW
+ Style.DIM
+ ""
+ Fore.LIGHTYELLOW_EX
+ Style.NORMAL
+ " ██████ "
+ Fore.YELLOW
+ Style.DIM
+ ""
)
print(
Fore.YELLOW
+ Style.DIM
+ ""
+ Fore.LIGHTYELLOW_EX
+ Style.NORMAL
+ " ███▀▀▀██ "
+ Fore.YELLOW
+ Style.DIM
+ ""
)
print(
Fore.YELLOW
+ Style.DIM
+ ""
+ Fore.LIGHTYELLOW_EX
+ Style.NORMAL
+ " ███ ████ "
+ Fore.YELLOW
+ Style.DIM
+ ""
)
print(
Fore.YELLOW
+ Style.DIM
+ ""
+ Fore.LIGHTYELLOW_EX
+ Style.NORMAL
+ " ███ ██████ "
+ Fore.YELLOW
+ Style.DIM
+ ""
)
print(
Fore.YELLOW
+ Style.DIM
+ ""
+ Fore.LIGHTYELLOW_EX
+ Style.NORMAL
+ " ███ ▀▀▀▀████ "
+ Fore.YELLOW
+ Style.DIM
+ ""
)
print(
Fore.YELLOW
+ Style.DIM
+ ""
+ Fore.LIGHTYELLOW_EX
+ Style.NORMAL
+ " ███████ ▄██████ "
+ Fore.YELLOW
+ Style.DIM
+ ""
)
print(
Fore.YELLOW
+ Style.DIM
+ ""
+ Fore.LIGHTYELLOW_EX
+ Style.NORMAL
+ " ███████ ▄█████████ "
+ Fore.YELLOW
+ Style.DIM
+ ""
)
print(
Fore.YELLOW
+ Style.DIM
+ ""
+ Fore.LIGHTYELLOW_EX
+ Style.NORMAL
+ " ████████████████████ "
+ Fore.YELLOW
+ Style.DIM
+ ""
)
print(
Fore.YELLOW
+ Style.DIM
+ ""
+ Fore.LIGHTYELLOW_EX
+ Style.NORMAL
+ " ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀ "
+ Fore.YELLOW
+ Style.DIM
+ ""
)
print(Fore.YELLOW + Style.DIM + "│ │")
left_spaces = (15 - len(global_common.version) - 1) // 2
right_spaces = left_spaces
if left_spaces + len(global_common.version) + 1 + right_spaces < 15:
right_spaces += 1
print(
Fore.YELLOW
+ Style.DIM
+ ""
+ Fore.LIGHTWHITE_EX
+ Style.RESET_ALL
+ Style.BRIGHT
+ f"{' '*left_spaces}Dangerzone v{global_common.version}{' '*right_spaces}"
+ Fore.YELLOW
+ Style.DIM
+ ""
)
print(
Fore.YELLOW
+ Style.DIM
+ ""
+ Fore.LIGHTWHITE_EX
+ Style.RESET_ALL
+ " https://dangerzone.rocks "
+ Fore.YELLOW
+ Style.DIM
+ ""
)
print(Fore.YELLOW + Style.DIM + "╰──────────────────────────╯")
def exec_container(global_common, args): def exec_container(global_common, args):
@ -40,6 +205,8 @@ def cli_main(custom_container, safe_pdf_filename, ocr_lang, skip_update, filenam
global_common = GlobalCommon() global_common = GlobalCommon()
common = Common() common = Common()
display_banner(global_common)
# Validate filename # Validate filename
valid = True valid = True
try: try:

View file

@ -16,6 +16,10 @@ class GlobalCommon(object):
""" """
def __init__(self): def __init__(self):
# Version
with open(self.get_resource_path("version.txt")) as f:
self.version = f.read().strip()
# App data folder # App data folder
self.appdata_path = appdirs.user_config_dir("dangerzone") self.appdata_path = appdirs.user_config_dir("dangerzone")

2
poetry.lock generated
View file

@ -374,7 +374,7 @@ testing = ["pytest (>=4.6)", "pytest-checkdocs (>=1.2.3)", "pytest-flake8", "pyt
[metadata] [metadata]
lock-version = "1.1" lock-version = "1.1"
python-versions = ">=3.7,<3.10" python-versions = ">=3.7,<3.10"
content-hash = "26e6acc883dad4194c45e399fadaabc12730fdd3a7b2264737e4e81838183eee" content-hash = "72592722794667cf7cb6bea727b31eb60d710c90d488be9d10a13bbbcaa56688"
[metadata.files] [metadata.files]
altgraph = [ altgraph = [

View file

@ -18,6 +18,7 @@ wmi = {version = "*", platform = "win32"}
pyxdg = {version = "*", platform = "linux"} pyxdg = {version = "*", platform = "linux"}
pyobjc-core = {version = "*", platform = "darwin"} pyobjc-core = {version = "*", platform = "darwin"}
pyobjc-framework-launchservices = {version = "*", platform = "darwin"} pyobjc-framework-launchservices = {version = "*", platform = "darwin"}
colorama = "^0.4.4"
[tool.poetry.dev-dependencies] [tool.poetry.dev-dependencies]
pyinstaller = {version = "*", platform = "darwin"} pyinstaller = {version = "*", platform = "darwin"}

View file

@ -2,7 +2,9 @@
import setuptools import setuptools
import os import os
import sys import sys
from dangerzone import dangerzone_version
with open("share/version.txt") as f:
version = f.read().strip()
def file_list(path): def file_list(path):
@ -15,7 +17,7 @@ def file_list(path):
setuptools.setup( setuptools.setup(
name="dangerzone", name="dangerzone",
version=dangerzone_version, version=version,
author="Micah Lee", author="Micah Lee",
author_email="micah.lee@theintercept.com", author_email="micah.lee@theintercept.com",
license="MIT", license="MIT",
@ -23,7 +25,10 @@ setuptools.setup(
url="https://github.com/firstlookmedia/dangerzone", url="https://github.com/firstlookmedia/dangerzone",
packages=["dangerzone"], packages=["dangerzone"],
data_files=[ data_files=[
("share/applications", ["install/linux/media.firstlook.dangerzone.desktop"],), (
"share/applications",
["install/linux/media.firstlook.dangerzone.desktop"],
),
( (
"share/icons/hicolor/64x64/apps", "share/icons/hicolor/64x64/apps",
["install/linux/media.firstlook.dangerzone.png"], ["install/linux/media.firstlook.dangerzone.png"],

1
share/version.txt Normal file
View file

@ -0,0 +1 @@
0.2