From 8f503d2a33e6ed5ac45f5cdb3b1916741fcf6792 Mon Sep 17 00:00:00 2001 From: sebastianrosenzweig Date: Sun, 27 Oct 2024 16:10:44 +0100 Subject: [PATCH] remove matplotlib dependency --- pyproject.toml | 1 - pytch/gui.py | 13 +++++-------- pytch/gui_utils.py | 12 ++++++++++-- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 6b3dd39..1cd6689 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -16,7 +16,6 @@ dependencies = [ "pyqt6>=6.7.0", "libf0>=1.0.2", "sounddevice>=0.4.7", - "matplotlib>=3.7.2", "pyqtgraph>=0.13.1" ] requires-python = ">=3.11" diff --git a/pytch/gui.py b/pytch/gui.py index 0758e98..f0dabe4 100644 --- a/pytch/gui.py +++ b/pytch/gui.py @@ -9,7 +9,7 @@ import numpy as np import importlib.metadata -from .gui_utils import FloatQLineEdit, QHLine, disable_interactivity +from .gui_utils import FloatQLineEdit, QHLine, disable_interactivity, colors from .audio import AudioProcessor, get_input_devices, get_fs_options from PyQt6 import QtCore as qc @@ -183,10 +183,7 @@ def __init__(self, sounddevice_idx, channels, fs, fft_size, out_path): self.disp_t_conf = 10 self.lvl_cvals = [-80, -12, 0] self.lvl_colors = ["green", "yellow", "red"] - self.ch_colors = pg.colormap.get("Set2", source="matplotlib", skipCache=True) - self.ch_colors = [ - self.ch_colors.getColors()[i][:-1] for i in [0, 1, 2, 5, 3, 4, 6, 7] - ] + self.ch_colors = colors self.cur_disp_freq_lims = [ 20, 1000, @@ -1063,7 +1060,7 @@ def __init__(self, main_window: MainWindow, *args, **kwargs): line = pg.PlotDataItem( self.t_axis, self.f0_tmp, - pen=pg.mkPen(channel_view.color, width=main_window.line_width), + pen=pg.mkPen(channel_view.color, width=main_window.line_width + 2), ) self.plot_item.addItem(line) self._lines.append(line) @@ -1125,7 +1122,7 @@ def __init__(self, main_window: MainWindow, *args, **kwargs): self.f0_tmp, pen=pg.mkPen( cv0.color, - width=main_window.line_width, + width=main_window.line_width + 2, style=pg.QtCore.Qt.PenStyle.SolidLine, ), ) @@ -1134,7 +1131,7 @@ def __init__(self, main_window: MainWindow, *args, **kwargs): self.f0_tmp, pen=pg.mkPen( cv1.color, - width=main_window.line_width, + width=main_window.line_width + 2, style=pg.QtCore.Qt.PenStyle.DashLine, ), ) diff --git a/pytch/gui_utils.py b/pytch/gui_utils.py index f39437b..4f8df33 100644 --- a/pytch/gui_utils.py +++ b/pytch/gui_utils.py @@ -7,9 +7,17 @@ from PyQt6 import QtGui as qg from PyQt6 import QtWidgets as qw -import pyqtgraph as pg - logger = logging.getLogger("pytch.gui_utils") +colors = [ + (102, 194, 165), + (252, 141, 98), + (141, 160, 203), + (255, 217, 47), + (231, 138, 195), + (166, 216, 84), + (229, 196, 148), + (179, 179, 179), +] class FloatQLineEdit(qw.QLineEdit):