Skip to content

Commit d2ce5a9

Browse files
committed
- New tool: "DR-DS"
- Overhaul of the UI, removed the need for QDarkstyle - Misc fixes and improvements
1 parent b7f0e0e commit d2ce5a9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+3411
-452
lines changed

__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66
:date: 2024.05
77
"""
88

9-
__version__ = '1.2.0'
9+
__version__ = '1.3.0'

dark_fusion_style.py

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# coding:utf-8
2+
"""
3+
:module: dark_fusion_style.py
4+
:description: Minimalistic dark theme
5+
:author: Michel 'Mitch' Pecqueur
6+
:date: 2025.03
7+
"""
8+
9+
from PyQt5.QtCore import Qt
10+
from PyQt5.QtGui import QPalette, QColor
11+
from PyQt5.QtWidgets import QStyleFactory, QProxyStyle, QToolTip
12+
13+
14+
class DarkFusionStyle(QProxyStyle):
15+
def __init__(self):
16+
super().__init__(QStyleFactory.create('Fusion')) # Based on Fusion style
17+
18+
def standardPalette(self):
19+
palette = QPalette()
20+
21+
# Background
22+
palette.setColor(QPalette.Background, QColor(39, 39, 39))
23+
palette.setColor(QPalette.Window, QColor(63, 63, 63))
24+
palette.setColor(QPalette.WindowText, QColor(223, 223, 223))
25+
palette.setColor(QPalette.Base, QColor(39, 39, 39))
26+
palette.setColor(QPalette.AlternateBase, QColor(47, 47, 47))
27+
28+
# Tool tip
29+
palette.setColor(QPalette.ToolTipBase, QColor(39, 39, 39))
30+
palette.setColor(QPalette.ToolTipText, Qt.white)
31+
32+
# Text
33+
palette.setColor(QPalette.Button, QColor(71, 71, 71))
34+
palette.setColor(QPalette.ButtonText, QColor(223, 223, 223))
35+
palette.setColor(QPalette.Text, QColor(223, 223, 223))
36+
palette.setColor(QPalette.BrightText, Qt.white)
37+
38+
# Highlight
39+
palette.setColor(QPalette.Link, QColor(31, 127, 159))
40+
palette.setColor(QPalette.Highlight, QColor(31, 127, 159))
41+
palette.setColor(QPalette.HighlightedText, Qt.black)
42+
43+
# Disabled state
44+
palette.setColor(QPalette.Disabled, QPalette.WindowText, QColor(127, 127, 127))
45+
palette.setColor(QPalette.Disabled, QPalette.ButtonText, QColor(127, 127, 127))
46+
palette.setColor(QPalette.Disabled, QPalette.Text, QColor(127, 127, 127))
47+
palette.setColor(QPalette.Disabled, QPalette.Link, QColor(127, 127, 127))
48+
palette.setColor(QPalette.Disabled, QPalette.Highlight, QColor(63, 63, 63))
49+
palette.setColor(QPalette.Disabled, QPalette.HighlightedText, QColor(127, 127, 127))
50+
51+
return palette
52+
53+
54+
def apply_dark_theme(widget):
55+
dark_style = DarkFusionStyle()
56+
dark_plt = dark_style.standardPalette()
57+
widget.setStyle(dark_style)
58+
widget.setPalette(dark_plt)
59+
60+
QToolTip.setPalette(dark_plt)

requirements.txt

-38 Bytes
Binary file not shown.

sample_tools_UI.py

+29-27
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,13 @@
1414
from functools import partial
1515
from pathlib import Path
1616

17-
import qdarkstyle
17+
from dark_fusion_style import apply_dark_theme
18+
1819
from PyQt5 import QtWidgets, QtCore, QtGui, Qt
1920

2021
from __init__ import __version__ # noqa
2122

22-
# from tools.simple_logger import SimpleLogger
23+
from tools.simple_logger import SimpleLogger
2324

2425
if getattr(sys, 'frozen', False):
2526
import pyi_splash # noqa
@@ -70,6 +71,7 @@ def __init__(self):
7071

7172
self.tools = {
7273
'SMP2ds': 'smp2ds_UI.py',
74+
'DR-DS': 'drds_UI.py',
7375
'Split Audio Tool': 'split_tool_UI.py',
7476
'Rename Sample Tool': 'rename_tool_UI.py',
7577
'Loop Tool': 'loop_tool_UI.py',
@@ -84,6 +86,7 @@ def __init__(self):
8486

8587
self.icons = {
8688
'SMP2ds': 'smp2ds_64.png',
89+
'DR-DS': 'drds_64.png',
8790
'Split Audio Tool': 'split_tool_64.png',
8891
'Rename Sample Tool': 'rename_tool_64.png',
8992
'Loop Tool': 'loop_tool_64.png',
@@ -93,6 +96,7 @@ def __init__(self):
9396

9497
self.status_tips = {
9598
'SMP2ds': 'Create Decent Sampler presets from samples',
99+
'DR-DS': 'Create Decent Sampler drum presets from samples',
96100
'Split Audio Tool': 'Split and trim audio file(s) by detecting silences',
97101
'Rename Sample Tool': "Rename audio files and update their 'smpl' chunk/metadata",
98102
'Loop Tool': 'Detect loop points or modify audio files to make them loop',
@@ -112,15 +116,15 @@ def import_tools(self):
112116
print(f'Failed to import {module_name}: {e}')
113117

114118
def setupUi(self):
115-
centralwidget = QtWidgets.QWidget(self)
116-
centralwidget.setObjectName('centralwidget')
117-
lyt = QtWidgets.QHBoxLayout(centralwidget)
118-
lyt.setObjectName('tool_btn_lyt')
119-
120-
self.setCentralWidget(centralwidget)
119+
self.centralwidget = QtWidgets.QWidget(self)
120+
self.setCentralWidget(self.centralwidget)
121+
self.lyt = QtWidgets.QHBoxLayout(self.centralwidget)
121122

122-
status_bar = QtWidgets.QStatusBar()
123-
self.setStatusBar(status_bar)
123+
self.status_bar = QtWidgets.QStatusBar(parent=self)
124+
plt = self.palette()
125+
self.bgc = plt.base().color().getRgb()[:3]
126+
self.setStyleSheet(f'QStatusBar{{background-color:rgb{self.bgc};}}')
127+
self.setStatusBar(self.status_bar)
124128

125129
for tool, cmd in self.tools.items():
126130
img_file = resource_path(Path(self.icons_path).joinpath(self.icons[tool]))
@@ -131,7 +135,7 @@ def setupUi(self):
131135
btn.setToolTip(tool)
132136
btn.setStatusTip(self.status_tips[tool])
133137
btn.clicked.connect(partial(self.launch_tool, name=tool))
134-
lyt.addWidget(btn)
138+
self.lyt.addWidget(btn)
135139

136140
img_file = resource_path(Path(self.icons_path).joinpath('quit_64.png'))
137141
close_btn = IconButton(image=img_file, parent=self)
@@ -140,9 +144,9 @@ def setupUi(self):
140144
close_btn.setToolTip('Quit')
141145
close_btn.setStatusTip('Close all tools and quit')
142146

143-
lyt.addWidget(close_btn)
147+
self.lyt.addWidget(close_btn)
144148

145-
self.setLayout(lyt)
149+
self.centralwidget.setLayout(self.lyt)
146150

147151
app_icon = QtGui.QIcon()
148152
img_file = resource_path(Path(self.icons_path).joinpath('sample_tools_64.png'))
@@ -157,8 +161,6 @@ def launch_tool(self, name):
157161
:param str name:
158162
:return:
159163
"""
160-
# QtWidgets.QMainWindow()
161-
162164
if name in self.running:
163165
print(f'{name} already running')
164166
try:
@@ -203,12 +205,12 @@ def __init__(self, parent=None, size=64, image=''):
203205
self.setFlat(True)
204206

205207

206-
# def global_exception_handler(exctype, value, tb):
207-
# logger.log_exception(value)
208+
def global_exception_handler(exctype, value, tb):
209+
logger.log_exception(value)
208210

209211

210-
# logger = SimpleLogger('sample_tools_log.txt')
211-
# sys.excepthook = global_exception_handler
212+
logger = SimpleLogger('sample_tools_log.txt')
213+
sys.excepthook = global_exception_handler
212214
# atexit.register(lambda: logger.logger.info("Application is shutting down."))
213215

214216
if __name__ == '__main__':
@@ -218,14 +220,14 @@ def __init__(self, parent=None, size=64, image=''):
218220
ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID(app_id)
219221

220222
app = QtWidgets.QApplication(sys.argv)
221-
app.setStyleSheet(qdarkstyle.load_stylesheet(qt_api='pyqt5'))
222-
223-
if platform.system() == "Darwin":
224-
macos_style = """
225-
QComboBox{combobox-popup: 0;}
226-
QComboBox QAbstractItemView {min-width: 64px;}
227-
"""
228-
app.setStyleSheet(app.styleSheet() + macos_style)
223+
apply_dark_theme(app)
224+
225+
# if platform.system() == "Darwin":
226+
# macos_style = """
227+
# QComboBox{combobox-popup: 0;}
228+
# QComboBox QAbstractItemView {min-width: 64px;}
229+
# """
230+
# app.setStyleSheet(app.styleSheet() + macos_style)
229231

230232
font = app.font()
231233
font.setPointSize(11)

tools/UI/icons/drds_64.png

3.31 KB
Loading

tools/UI/icons/quit_64.png

-10 Bytes
Loading

tools/UI/icons/work/drds.afdesign

31.5 KB
Binary file not shown.

tools/UI/icons/work/quit.afdesign

-35 Bytes
Binary file not shown.

tools/UI/loop_tool.py

+2-21
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# -*- coding: utf-8 -*-
22

3-
# Form implementation generated from reading ui file 'C:\Users\mitch\Documents\PycharmProjects\github\sample_tools\tools\UI\loop_tool.ui'
3+
# Form implementation generated from reading ui file 'loop_tool.ui'
44
#
55
# Created by: PyQt5 UI code generator 5.15.11
66
#
@@ -15,10 +15,6 @@ class Ui_loop_tool_mw(object):
1515
def setupUi(self, loop_tool_mw):
1616
loop_tool_mw.setObjectName("loop_tool_mw")
1717
loop_tool_mw.resize(880, 800)
18-
font = QtGui.QFont()
19-
font.setPointSize(10)
20-
font.setStyleStrategy(QtGui.QFont.PreferAntialias)
21-
loop_tool_mw.setFont(font)
2218
loop_tool_mw.setLocale(QtCore.QLocale(QtCore.QLocale.English, QtCore.QLocale.UnitedStates))
2319
self.centralwidget = QtWidgets.QWidget(loop_tool_mw)
2420
self.centralwidget.setObjectName("centralwidget")
@@ -45,10 +41,7 @@ def setupUi(self, loop_tool_mw):
4541
self.files_lyt.addWidget(self.files_lw)
4642
self.set_files_tb = QtWidgets.QToolButton(self.centralwidget)
4743
font = QtGui.QFont()
48-
font.setPointSize(10)
4944
font.setBold(True)
50-
font.setWeight(75)
51-
font.setStyleStrategy(QtGui.QFont.PreferAntialias)
5245
self.set_files_tb.setFont(font)
5346
self.set_files_tb.setObjectName("set_files_tb")
5447
self.files_lyt.addWidget(self.set_files_tb)
@@ -671,10 +664,7 @@ def setupUi(self, loop_tool_mw):
671664
self.output_path_lyt.addWidget(self.output_path_l)
672665
self.set_output_path_tb = QtWidgets.QToolButton(self.centralwidget)
673666
font = QtGui.QFont()
674-
font.setPointSize(10)
675667
font.setBold(True)
676-
font.setWeight(75)
677-
font.setStyleStrategy(QtGui.QFont.PreferAntialias)
678668
self.set_output_path_tb.setFont(font)
679669
self.set_output_path_tb.setObjectName("set_output_path_tb")
680670
self.output_path_lyt.addWidget(self.set_output_path_tb)
@@ -779,10 +769,7 @@ def setupUi(self, loop_tool_mw):
779769
self.process_sel_pb.setSizePolicy(sizePolicy)
780770
self.process_sel_pb.setMinimumSize(QtCore.QSize(160, 0))
781771
font = QtGui.QFont()
782-
font.setPointSize(10)
783772
font.setBold(True)
784-
font.setWeight(75)
785-
font.setStyleStrategy(QtGui.QFont.PreferAntialias)
786773
self.process_sel_pb.setFont(font)
787774
self.process_sel_pb.setObjectName("process_sel_pb")
788775
self.buttons_lyt.addWidget(self.process_sel_pb, 0, 1, 1, 1)
@@ -794,10 +781,7 @@ def setupUi(self, loop_tool_mw):
794781
self.preview_pb.setSizePolicy(sizePolicy)
795782
self.preview_pb.setMinimumSize(QtCore.QSize(160, 0))
796783
font = QtGui.QFont()
797-
font.setPointSize(10)
798784
font.setBold(True)
799-
font.setWeight(75)
800-
font.setStyleStrategy(QtGui.QFont.PreferAntialias)
801785
self.preview_pb.setFont(font)
802786
self.preview_pb.setObjectName("preview_pb")
803787
self.buttons_lyt.addWidget(self.preview_pb, 0, 0, 1, 1)
@@ -809,10 +793,7 @@ def setupUi(self, loop_tool_mw):
809793
self.process_pb.setSizePolicy(sizePolicy)
810794
self.process_pb.setMinimumSize(QtCore.QSize(160, 0))
811795
font = QtGui.QFont()
812-
font.setPointSize(10)
813796
font.setBold(True)
814-
font.setWeight(75)
815-
font.setStyleStrategy(QtGui.QFont.PreferAntialias)
816797
self.process_pb.setFont(font)
817798
self.process_pb.setStyleSheet("QPushButton{background-color: rgb(31, 159, 127);\n"
818799
"color: rgb(255, 255, 255);}")
@@ -890,7 +871,7 @@ def retranslateUi(self, loop_tool_mw):
890871
"0.5 centered (Default) \n"
891872
"1 forward, allow loop start very close to start of sample"))
892873
self.hash_search_cb.setToolTip(_translate("loop_tool_mw", "Detect \"perfect\" binary repeat\n"
893-
"Useful to detect loop in preprocessed audio where perfect a loop is likely present\n"
874+
"Useful to detect loop in preprocessed audio where a perfect loop is likely present\n"
894875
"Add some overhead dependent on the file size"))
895876
self.hash_search_cb.setText(_translate("loop_tool_mw", "1st Pass Hash Search"))
896877
self.range_limits_cb.setToolTip(_translate("loop_tool_mw", "Apply constraints to loop search scope"))

tools/UI/loop_tool.ui

+1-22
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,6 @@
1010
<height>800</height>
1111
</rect>
1212
</property>
13-
<property name="font">
14-
<font>
15-
<pointsize>10</pointsize>
16-
<stylestrategy>PreferAntialias</stylestrategy>
17-
</font>
18-
</property>
1913
<property name="windowTitle">
2014
<string>Loop Tool</string>
2115
</property>
@@ -74,10 +68,7 @@ SPACE BAR to play/stop selected file LOOPED</string>
7468
<widget class="QToolButton" name="set_files_tb">
7569
<property name="font">
7670
<font>
77-
<pointsize>10</pointsize>
78-
<weight>75</weight>
7971
<bold>true</bold>
80-
<stylestrategy>PreferAntialias</stylestrategy>
8172
</font>
8273
</property>
8374
<property name="toolTip">
@@ -659,7 +650,7 @@ For high notes or high frequency content, try to reduce value below 10ms</string
659650
</property>
660651
<property name="toolTip">
661652
<string>Detect &quot;perfect&quot; binary repeat
662-
Useful to detect loop in preprocessed audio where perfect a loop is likely present
653+
Useful to detect loop in preprocessed audio where a perfect loop is likely present
663654
Add some overhead dependent on the file size</string>
664655
</property>
665656
<property name="layoutDirection">
@@ -1896,10 +1887,7 @@ color: rgb(255, 255, 255);</string>
18961887
<widget class="QToolButton" name="set_output_path_tb">
18971888
<property name="font">
18981889
<font>
1899-
<pointsize>10</pointsize>
1900-
<weight>75</weight>
19011890
<bold>true</bold>
1902-
<stylestrategy>PreferAntialias</stylestrategy>
19031891
</font>
19041892
</property>
19051893
<property name="toolTip">
@@ -2149,10 +2137,7 @@ Use wav for 32 bits float</string>
21492137
</property>
21502138
<property name="font">
21512139
<font>
2152-
<pointsize>10</pointsize>
2153-
<weight>75</weight>
21542140
<bold>true</bold>
2155-
<stylestrategy>PreferAntialias</stylestrategy>
21562141
</font>
21572142
</property>
21582143
<property name="toolTip">
@@ -2179,10 +2164,7 @@ Use wav for 32 bits float</string>
21792164
</property>
21802165
<property name="font">
21812166
<font>
2182-
<pointsize>10</pointsize>
2183-
<weight>75</weight>
21842167
<bold>true</bold>
2185-
<stylestrategy>PreferAntialias</stylestrategy>
21862168
</font>
21872169
</property>
21882170
<property name="toolTip">
@@ -2210,10 +2192,7 @@ and play the result without writing anything</string>
22102192
</property>
22112193
<property name="font">
22122194
<font>
2213-
<pointsize>10</pointsize>
2214-
<weight>75</weight>
22152195
<bold>true</bold>
2216-
<stylestrategy>PreferAntialias</stylestrategy>
22172196
</font>
22182197
</property>
22192198
<property name="toolTip">

0 commit comments

Comments
 (0)