Skip to content

Commit

Permalink
remove matplotlib dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianrosenzweig committed Oct 27, 2024
1 parent 15ce515 commit 8f503d2
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 11 deletions.
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
13 changes: 5 additions & 8 deletions pytch/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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,
),
)
Expand All @@ -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,
),
)
Expand Down
12 changes: 10 additions & 2 deletions pytch/gui_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 8f503d2

Please sign in to comment.