kitbash 1.10.0__tar.gz → 1.12.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (25) hide show
  1. {kitbash-1.10.0 → kitbash-1.12.0}/PKG-INFO +3 -3
  2. {kitbash-1.10.0 → kitbash-1.12.0}/kitbash/__init__.py +14 -64
  3. {kitbash-1.10.0 → kitbash-1.12.0}/kitbash/__main__.py +22 -26
  4. {kitbash-1.10.0 → kitbash-1.12.0}/kitbash/gui/kit_save_dialog.py +17 -3
  5. {kitbash-1.10.0 → kitbash-1.12.0}/kitbash/gui/main_window.py +28 -15
  6. {kitbash-1.10.0 → kitbash-1.12.0}/kitbash/jack_audio.py +2 -1
  7. {kitbash-1.10.0 → kitbash-1.12.0}/pyproject.toml +3 -3
  8. kitbash-1.10.0/kitbash/install.py +0 -44
  9. {kitbash-1.10.0 → kitbash-1.12.0}/.gitignore +0 -0
  10. {kitbash-1.10.0 → kitbash-1.12.0}/LICENSE +0 -0
  11. {kitbash-1.10.0 → kitbash-1.12.0}/README.md +0 -0
  12. {kitbash-1.10.0 → kitbash-1.12.0}/kitbash/gui/__init__.py +0 -0
  13. {kitbash-1.10.0 → kitbash-1.12.0}/kitbash/gui/drumkit_widget.py +0 -0
  14. {kitbash-1.10.0 → kitbash-1.12.0}/kitbash/gui/main_window.ui +0 -0
  15. {kitbash-1.10.0 → kitbash-1.12.0}/kitbash/res/empty.sfz +0 -0
  16. {kitbash-1.10.0 → kitbash-1.12.0}/kitbash/res/group_expanded.svg +0 -0
  17. {kitbash-1.10.0 → kitbash-1.12.0}/kitbash/res/group_hidden.svg +0 -0
  18. {kitbash-1.10.0 → kitbash-1.12.0}/kitbash/res/kitbash-icon.png +0 -0
  19. {kitbash-1.10.0 → kitbash-1.12.0}/kitbash/res/kitbash-icon.svg +0 -0
  20. {kitbash-1.10.0 → kitbash-1.12.0}/kitbash/res/save-sfz-icon.svg +0 -0
  21. {kitbash-1.10.0 → kitbash-1.12.0}/kitbash/scripts/bash_project.py +0 -0
  22. {kitbash-1.10.0 → kitbash-1.12.0}/kitbash/styles/light.css +0 -0
  23. {kitbash-1.10.0 → kitbash-1.12.0}/kitbash/styles/system.css +0 -0
  24. {kitbash-1.10.0 → kitbash-1.12.0}/kitbash/worker_threads.py +0 -0
  25. {kitbash-1.10.0 → kitbash-1.12.0}/tests/file_save_dialog.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: kitbash
3
- Version: 1.10.0
3
+ Version: 1.12.0
4
4
  Summary: Provides universal settings, styles, cached icons, and pixmaps, and the base
5
5
  Author-email: Leon Dionne <ldionne@dridesign.sh.cn>
6
6
  Description-Content-Type: text/markdown
@@ -10,8 +10,8 @@ Requires-Dist: PyQt5
10
10
  Requires-Dist: qt_liquid_pool >= 1.2.0
11
11
  Requires-Dist: recent_items_list >= 1.1.2
12
12
  Requires-Dist: sfzen >= 2.3.2
13
- Requires-Dist: soso_qt_extras >= 1.7.0
14
- Requires-Dist: xdg_soso >= 1.0.2
13
+ Requires-Dist: soso_qt_extras >= 1.13.0
14
+ Requires-Dist: xdg_soso >= 1.1.0
15
15
  Project-URL: Home, https://github.com/Zen-Master-SoSo/kitbash
16
16
 
17
17
  # KitBash
@@ -28,10 +28,14 @@ from functools import lru_cache
28
28
  from PyQt5.QtCore import QSettings
29
29
  from PyQt5.QtWidgets import QApplication, QSplitter
30
30
  from qt_extras import DevilBox
31
+ from qt_extras.settings import get_setting
32
+ from xdg_soso import XDGSetup
31
33
 
32
- __version__ = "1.10.0"
34
+ __version__ = "1.12.0"
33
35
 
34
- APPLICATION_NAME = "kitbash"
36
+ VENDOR_NAME = 'ZenSoSo'
37
+ APPLICATION_NAME = 'KitBash'
38
+ PACKAGE_NAME = 'kitbash'
35
39
  PACKAGE_DIR = dirname(__file__)
36
40
  DEFAULT_STYLE = 'system'
37
41
  AUDIO_ICON_SIZE = 16
@@ -54,28 +58,6 @@ def audio():
54
58
  audio.instance = Audio()
55
59
  return audio.instance
56
60
 
57
- @lru_cache
58
- def __settings():
59
- return QSettings('ZenSoSo', APPLICATION_NAME)
60
-
61
- def get_setting(key, default = None, type_ = None):
62
- value = __settings().value(key, default)
63
- if type_:
64
- if value is None:
65
- return type_()
66
- if type_ is bool:
67
- return value == '1'
68
- return type_(value)
69
- return value
70
-
71
- def set_setting(key, value):
72
- if isinstance(value, bool):
73
- value = '1' if value else '0'
74
- __settings().setValue(key, value)
75
-
76
- def delete_setting(key):
77
- __settings().remove(key)
78
-
79
61
  @lru_cache
80
62
  def styles():
81
63
  return {
@@ -89,47 +71,15 @@ def set_application_style():
89
71
  QApplication.instance().setStyleSheet(cssfile.read())
90
72
 
91
73
 
92
- class GeometrySaver:
93
- """
94
- Provides classes declared in this project which inherit from QDialog methods to
95
- easily save/restore window / splitter geometry.
96
-
97
- Geometry is saved in this project's QSettings accessed as "settings()"
98
- """
99
-
100
- def restore_geometry(self):
101
- if not hasattr(self, 'restoreGeometry'):
102
- logging.error('Object of type %s has no "restoreGeometry" function',
103
- self.__class__.__name__)
104
- return
105
- geometry = get_setting(self.__geometry_key())
106
- if geometry is not None:
107
- self.restoreGeometry(geometry) # pylint: disable = no-member
108
- # pylint: disable-next = no-member
109
- for splitter in self.findChildren(QSplitter):
110
- geometry = get_setting(self.__splitter_geometry_key(splitter))
111
- if geometry is not None:
112
- splitter.restoreState(geometry) # pylint: disable = no-member
113
-
114
- def save_geometry(self):
115
- if not hasattr(self, 'saveGeometry'):
116
- logging.error('Object of type %s has no "saveGeometry" function',
117
- self.__class__.__name__)
118
- return
119
- set_setting(
120
- self.__geometry_key(),
121
- self.saveGeometry()) # pylint: disable = no-member
122
- # pylint: disable-next = no-member
123
- for splitter in self.findChildren(QSplitter):
124
- set_setting(
125
- self.__splitter_geometry_key(splitter),
126
- splitter.saveState()) # pylint: disable = no-member
127
-
128
- def __geometry_key(self):
129
- return f'{self.__class__.__name__}/geometry'
74
+ class KitbashSetup(XDGSetup):
130
75
 
131
- def __splitter_geometry_key(self, splitter):
132
- return f'{self.__class__.__name__}/{splitter.objectName()}/geometry'
76
+ def __init__(self):
77
+ super().__init__(PACKAGE_NAME, APPLICATION_NAME)
78
+ self.vendor_name = VENDOR_NAME
79
+ self.comment = "Bash together new .SFZ drumkits from pieces of existing ones."
80
+ self.application_icon = join(dirname(__file__), 'res', 'kitbash-icon.svg')
81
+ self.categories = ['AudioVideo', 'Audio']
82
+ self.keywords = ['Audio', 'Sound', 'midi', 'SFZ', 'Drumkit']
133
83
 
134
84
 
135
85
  # end kitbash/kitbash/__init__.py
@@ -22,12 +22,13 @@ kitbash is a program you can use to combine parts of various SFZ files into a
22
22
  new SFZ with instruments "borrowed" from the originals.
23
23
  """
24
24
  import sys, logging
25
- from os import environ, getlogin
25
+ from os import environ
26
26
  from argparse import ArgumentParser
27
27
  from PyQt5.QtWidgets import QApplication
28
28
  from qt_extras import exceptions_hook
29
+ from qt_extras.settings import init_settings
29
30
  from xdg_soso import is_xdg
30
- from kitbash.install import KitbashSetup
31
+ from kitbash import VENDOR_NAME, PACKAGE_NAME, KitbashSetup
31
32
  from kitbash.gui.main_window import MainWindow
32
33
 
33
34
 
@@ -67,30 +68,25 @@ menu.""")
67
68
  format = log_format
68
69
  )
69
70
 
70
- if is_xdg() and (options.install or options.uninstall):
71
- installer = KitbashSetup()
72
- if options.install:
73
- installer.install()
74
- print(f'Successfully installed KitBash for {getlogin()} on this machine.')
75
- else:
76
- installer.uninstall()
77
- print(f'Successfully uninstalled KitBash for {getlogin()} on this machine.')
78
- return 0
79
-
80
- #-----------------------------------------------------------------------
81
- # Annoyance fix per:
82
- # https://stackoverflow.com/questions/986964/qt-session-management-error
83
- try:
84
- del environ['SESSION_MANAGER']
85
- except KeyError:
86
- pass
87
- #-----------------------------------------------------------------------
88
-
89
- app = QApplication([])
90
- sys.excepthook = exceptions_hook
91
- main_window = MainWindow(options)
92
- main_window.show()
93
- sys.exit(app.exec())
71
+ if options.install:
72
+ KitbashSetup().install()
73
+ elif options.uninstall:
74
+ KitbashSetup().uninstall()
75
+ else:
76
+ #-----------------------------------------------------------------------
77
+ # Annoyance fix per:
78
+ # https://stackoverflow.com/questions/986964/qt-session-management-error
79
+ try:
80
+ del environ['SESSION_MANAGER']
81
+ except KeyError:
82
+ pass
83
+ #-----------------------------------------------------------------------
84
+ app = QApplication([])
85
+ init_settings(VENDOR_NAME, PACKAGE_NAME)
86
+ sys.excepthook = exceptions_hook
87
+ main_window = MainWindow(options)
88
+ main_window.show()
89
+ sys.exit(app.exec())
94
90
 
95
91
  if __name__ == "__main__":
96
92
  sys.exit(main())
@@ -24,9 +24,11 @@ from os.path import realpath, splitext
24
24
  from functools import partial
25
25
  from PyQt5.QtCore import Qt, pyqtSlot, QCoreApplication
26
26
  from PyQt5.QtWidgets import QVBoxLayout, QLabel, QFileDialog, QGroupBox, QRadioButton
27
- from sfzen import (
28
- SAMPLES_ABSPATH, SAMPLES_RELPATH, SAMPLES_COPY, SAMPLES_SYMLINK, SAMPLES_HARDLINK)
29
- from kitbash import set_setting, GeometrySaver, KEY_SAMPLES_MODE
27
+ from qt_extras.geometry_saver import GeometrySaver
28
+ from qt_extras.settings import get_setting, set_setting
29
+ from sfzen import (SAMPLES_ABSPATH, SAMPLES_RELPATH, SAMPLES_COPY,
30
+ SAMPLES_SYMLINK, SAMPLES_HARDLINK)
31
+ from kitbash import KEY_SAMPLES_MODE
30
32
 
31
33
 
32
34
  class KitSaveDialog(QFileDialog, GeometrySaver):
@@ -77,6 +79,18 @@ class KitSaveDialog(QFileDialog, GeometrySaver):
77
79
  self.layout().addWidget(gb)
78
80
  self.selected_file = None
79
81
 
82
+ # -------------------------
83
+ # GeometrySaver overrides
84
+
85
+ def get_setting(self, key, default = None, type_ = None):
86
+ return get_setting(key, default, type_)
87
+
88
+ def set_setting(self, key, value):
89
+ set_setting(key, value)
90
+
91
+ # -------------------------
92
+ # Slots
93
+
80
94
  @pyqtSlot(int, bool)
81
95
  def slot_set_mode(self, mode, _):
82
96
  """
@@ -34,12 +34,14 @@ from PyQt5.QtWidgets import (
34
34
  from PyQt5.QtGui import QIcon
35
35
  from qt_extras import ShutUpQT, DevilBox
36
36
  from qt_extras.list_layout import VListLayout
37
+ from qt_extras.settings import get_setting, set_setting
38
+ from qt_extras.geometry_saver import GeometrySaver
37
39
  from recent_items_list import RecentItemsList
38
40
  from sfzen import SAMPLES_ABSPATH
39
41
  from sfzen.drumkits import Drumkit
40
42
  from kitbash import (
41
43
  APPLICATION_NAME, PACKAGE_DIR, DEFAULT_STYLE,
42
- styles, set_application_style, get_setting, set_setting, GeometrySaver, audio,
44
+ styles, set_application_style, audio,
43
45
  KEY_PREVIEW_VELOCITY, KEY_STYLE, KEY_SAMPLES_MODE,
44
46
  KEY_RECENT_DRUMKIT_FOLDER, KEY_RECENT_DRUMKITS,
45
47
  KEY_RECENT_PROJECT_FOLDER, KEY_RECENT_PROJECTS)
@@ -72,6 +74,7 @@ class MainWindow(QMainWindow, GeometrySaver):
72
74
  with ShutUpQT():
73
75
  uic.loadUi(join(PACKAGE_DIR, 'gui', 'main_window.ui'), self)
74
76
  self.setWindowIcon(QIcon(join(PACKAGE_DIR, 'res', 'kitbash-icon.png')))
77
+ self.action_save_bashed_kit.setIcon(QIcon(join(PACKAGE_DIR, 'res', 'save-sfz-icon.svg')))
75
78
  self.b_save_kit.setIcon(QIcon(join(PACKAGE_DIR, 'res', 'save-sfz-icon.svg')))
76
79
  self.b_save_kit.setIconSize(QSize(20, 20))
77
80
  # Setup signals
@@ -175,6 +178,15 @@ class MainWindow(QMainWindow, GeometrySaver):
175
178
  self.b_save_kit.setEnabled(has_kits)
176
179
  self.b_copy_path.setVisible(bool(self.saved_sfz_filename))
177
180
 
181
+ # -----------------------------------------------------------------
182
+ # GeometrySaver overrides
183
+
184
+ def get_setting(self, key, default = None, type_ = None):
185
+ return get_setting(key, default, type_)
186
+
187
+ def set_setting(self, key, value):
188
+ set_setting(key, value)
189
+
178
190
  # -----------------------------------------------------------------
179
191
  # Style functions:
180
192
 
@@ -579,21 +591,22 @@ class MainWindow(QMainWindow, GeometrySaver):
579
591
  @pyqtSlot()
580
592
  def slot_save_kit(self):
581
593
  if self.saved_sfz_filename is None:
582
- return self.slot_save_kit_as()
583
- try:
584
- self.bashed_kit.save_as(
585
- self.saved_sfz_filename, samples_mode = self.saved_sfz_samples_mode)
586
- except OSError as e:
587
- if e.errno == 18:
588
- DevilBox('Hardlinks between devices are not allowed.\n' +
589
- 'Choose a different path or sample mode.')
590
- elif e.errno == 2:
591
- return self.slot_save_kit_as()
592
- else:
593
- DevilBox(str(e))
594
+ self.slot_save_kit_as()
594
595
  else:
595
- self.statusbar.showMessage(f'Saved {self.saved_sfz_filename}', MESSAGE_TIMEOUT)
596
- self.update_ui()
596
+ try:
597
+ self.bashed_kit.save_as(
598
+ self.saved_sfz_filename, samples_mode = self.saved_sfz_samples_mode)
599
+ except OSError as e:
600
+ if e.errno == 18:
601
+ DevilBox('Hardlinks between devices are not allowed.\n' +
602
+ 'Choose a different path or sample mode.')
603
+ elif e.errno == 2:
604
+ self.slot_save_kit_as()
605
+ else:
606
+ DevilBox(str(e))
607
+ else:
608
+ self.statusbar.showMessage(f'Saved {self.saved_sfz_filename}', MESSAGE_TIMEOUT)
609
+ self.update_ui()
597
610
 
598
611
  @pyqtSlot()
599
612
  def slot_save_kit_as(self):
@@ -23,8 +23,9 @@ Provides MainWindow of the kitbash application.
23
23
  import logging # pylint: disable = unused-import
24
24
  from tempfile import mkstemp
25
25
  from os import unlink
26
+ from qt_extras.settings import get_setting, set_setting
26
27
  from qt_liquid_pool import LiquidPool
27
- from kitbash import get_setting, set_setting, KEY_MIDI_SOURCE, KEY_AUDIO_SINK
28
+ from kitbash import KEY_MIDI_SOURCE, KEY_AUDIO_SINK
28
29
 
29
30
 
30
31
  class Audio(LiquidPool):
@@ -11,8 +11,8 @@ dependencies = [
11
11
  "qt_liquid_pool >= 1.2.0",
12
12
  "recent_items_list >= 1.1.2",
13
13
  "sfzen >= 2.3.2",
14
- "soso_qt_extras >= 1.7.0",
15
- "xdg_soso >= 1.0.2"
14
+ "soso_qt_extras >= 1.13.0",
15
+ "xdg_soso >= 1.1.0"
16
16
  ]
17
17
 
18
18
  [project.urls]
@@ -27,7 +27,7 @@ requires = ["flit_core >=3.2,<4"]
27
27
  build-backend = "flit_core.buildapi"
28
28
 
29
29
  [bumpver]
30
- current_version = "1.10.0"
30
+ current_version = "1.12.0"
31
31
  version_pattern = "MAJOR.MINOR.PATCH"
32
32
  commit_message = "Bump version {old_version} -> {new_version}"
33
33
  commit = true
@@ -1,44 +0,0 @@
1
- # kitbash/kitbash/install.py
2
- #
3
- # Copyright 2026 Leon Dionne <ldionne@dridesign.sh.cn>
4
- #
5
- # This program is free software; you can redistribute it and/or modify
6
- # it under the terms of the GNU General Public License as published by
7
- # the Free Software Foundation; either version 2 of the License, or
8
- # (at your option) any later version.
9
- #
10
- # This program is distributed in the hope that it will be useful,
11
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- # GNU General Public License for more details.
14
- #
15
- # You should have received a copy of the GNU General Public License
16
- # along with this program; if not, write to the Free Software
17
- # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18
- # MA 02110-1301, USA.
19
- #
20
- """
21
- Install phoney-dictate as an application on XDG-compliant systems (like gnome).
22
- """
23
- import logging
24
- from os.path import dirname, join
25
- from xdg_soso import XDGSetup
26
-
27
- class KitbashSetup(XDGSetup):
28
-
29
- def __init__(self):
30
- super().__init__('kitbash', 'Kitbash')
31
- self._comment = "Bash together new .SFZ drumkits from pieces of existing ones."
32
- self._vendor_name = 'zen_soso'
33
- self._application_icon = join(dirname(__file__), 'res', 'kitbash-icon.svg')
34
- self._categories = ['AudioVideo', 'Audio']
35
- self._keywords = ['Audio', 'Sound', 'midi', 'SFZ', 'Drumkit']
36
-
37
- if __name__ == '__main__':
38
- logging.basicConfig(level = logging.DEBUG,
39
- format = "[%(filename)24s:%(lineno)4d] %(levelname)-8s %(message)s")
40
- installer = KitbashSetup()
41
- installer.install()
42
-
43
-
44
- # end kitbash/kitbash/install.py
File without changes
File without changes
File without changes
File without changes