From 46c73329a5caf3fb488c45aabb83b228c0d3c493 Mon Sep 17 00:00:00 2001 From: Micah Lee Date: Thu, 10 Jun 2021 10:24:28 -0700 Subject: [PATCH] Switch from termcolor to colorama --- BUILD.md | 13 ++++++++++--- dangerzone/gui/tasks.py | 4 ++-- install/linux/build_rpm.py | 2 +- stdeb.cfg | 2 +- 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/BUILD.md b/BUILD.md index 8126674..c68b2da 100644 --- a/BUILD.md +++ b/BUILD.md @@ -5,7 +5,7 @@ Install dependencies: ```sh -sudo apt install -y dh-python python3 python3-stdeb python3-pyside2.qtcore python3-pyside2.qtgui python3-pyside2.qtwidgets python3-appdirs python3-click python3-xdg python3-requests python3-termcolor +sudo apt install -y dh-python python3 python3-stdeb python3-pyside2.qtcore python3-pyside2.qtgui python3-pyside2.qtwidgets python3-appdirs python3-click python3-xdg python3-requests python3-colorama ``` You also need docker, either by installing the [Docker snap package](https://snapcraft.io/docker), installing the `docker.io` package, or by installing `docker-ce` by following [these instructions for Ubuntu](https://docs.docker.com/install/linux/docker-ce/ubuntu/) or [for Debian](https://docs.docker.com/install/linux/docker-ce/debian/). @@ -27,7 +27,7 @@ Create a .deb: Install dependencies: ```sh -sudo dnf install -y rpm-build python3 python3-pyside2 python3-appdirs python3-click python3-pyxdg python3-requests python3-termcolor +sudo dnf install -y rpm-build python3 python3-pyside2 python3-appdirs python3-click python3-pyxdg python3-requests python3-colorama ``` You also need docker, either by installing the `docker` package, or by installing `docker-ce` by following [these instructions](https://docs.docker.com/install/linux/docker-ce/fedora/). @@ -61,7 +61,14 @@ poetry install Run from source tree: ``` -poetry run dangerzone +# start a shell in the virtual environment +poetry shell + +# run the CLI +./dev_scripts/dangerzone-cli --help + +# run the GUI +./dev_scripts/dangerzone ``` To create an app bundle, use the `build_app.py` script: diff --git a/dangerzone/gui/tasks.py b/dangerzone/gui/tasks.py index 3dc5ade..4ccb2cb 100644 --- a/dangerzone/gui/tasks.py +++ b/dangerzone/gui/tasks.py @@ -4,7 +4,7 @@ import os import pipes import platform from PySide2 import QtCore, QtWidgets, QtGui -from termcolor import cprint +from colorama import Style class TaskBase(QtCore.QThread): @@ -27,7 +27,7 @@ class TaskBase(QtCore.QThread): self.update_details.emit(output) stderr = p.stderr.read().decode() - cprint(stderr, attrs=["dark"]) + print(Style.DIM + stderr + Style.RESET_ALL) self.update_details.emit(output) if p.returncode == 126 or p.returncode == 127: diff --git a/install/linux/build_rpm.py b/install/linux/build_rpm.py index 42e582a..0d6c2b8 100755 --- a/install/linux/build_rpm.py +++ b/install/linux/build_rpm.py @@ -31,7 +31,7 @@ def main(): print("* Building RPM package") subprocess.run( - "python3 setup.py bdist_rpm --requires='python3-pyside2,python3-appdirs,python3-click,python3-pyxdg,python3-requests,python3-termcolor,(docker or docker-ce)'", + "python3 setup.py bdist_rpm --requires='python3-pyside2,python3-appdirs,python3-click,python3-pyxdg,python3-requests,python3-colorama,(docker or docker-ce)'", shell=True, cwd=root, check=True, diff --git a/stdeb.cfg b/stdeb.cfg index cfae021..df13e23 100644 --- a/stdeb.cfg +++ b/stdeb.cfg @@ -1,6 +1,6 @@ [DEFAULT] Package3: dangerzone -Depends3: python3, python3-pyside2.qtcore, python3-pyside2.qtgui, python3-pyside2.qtwidgets, python3-appdirs, python3-click, python3-xdg, python3-requests, python3-termcolor +Depends3: python3, python3-pyside2.qtcore, python3-pyside2.qtgui, python3-pyside2.qtwidgets, python3-appdirs, python3-click, python3-xdg, python3-requests, python3-colorama Build-Depends: dh-python, python3, python3-all Suite: bionic X-Python3-Version: >= 3.6 \ No newline at end of file