describealign 2.0.0__tar.gz → 2.0.2__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: describealign
3
- Version: 2.0.0
3
+ Version: 2.0.2
4
4
  Summary: Combines videos with matching audio files (e.g. audio descriptions)
5
5
  Author-email: Julian Brown <julbean@proton.me>
6
6
  License-Expression: GPL-3.0-only
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: describealign
3
- Version: 2.0.0
3
+ Version: 2.0.2
4
4
  Summary: Combines videos with matching audio files (e.g. audio descriptions)
5
5
  Author-email: Julian Brown <julbean@proton.me>
6
6
  License-Expression: GPL-3.0-only
@@ -3,7 +3,6 @@ README.md
3
3
  describealign.py
4
4
  pyproject.toml
5
5
  requirements.txt
6
- version
7
6
  describealign.egg-info/PKG-INFO
8
7
  describealign.egg-info/SOURCES.txt
9
8
  describealign.egg-info/dependency_links.txt
@@ -1,3 +1,5 @@
1
+ __version__ = '2.0.2'
2
+
1
3
  # combines videos with matching audio files (e.g. audio descriptions)
2
4
  # input: video or folder of videos and an audio file or folder of audio files
3
5
  # output: videos in a folder "videos_with_ad", with aligned segments of the audio replaced
@@ -1130,7 +1132,7 @@ if wx is not None:
1130
1132
 
1131
1133
  class DialogSettings(wx.Dialog):
1132
1134
  def __init__(self, parent, config_path, is_dark):
1133
- wx.Dialog.__init__(self, parent, title="Settings - describealign", size=wx.Size(450,330),
1135
+ wx.Dialog.__init__(self, parent, title="Settings - describealign", size=wx.Size(450,370),
1134
1136
  style=wx.DEFAULT_DIALOG_STYLE|wx.TAB_TRAVERSAL)
1135
1137
  # setting the GUI dialog's font causes all contained elements to inherit that font by default
1136
1138
  self.SetFont(wx.Font(*gui_font))
@@ -1152,7 +1154,10 @@ if wx is not None:
1152
1154
  self.text_ctrl_prepend = wx.TextCtrl(self, name="prepend")
1153
1155
  set_tooltip(self.text_ctrl_prepend, "Output file name prepend text. Default is \"ad_\"")
1154
1156
 
1155
- self.checkbox_stretch_audio = wx.CheckBox(self, label="stretch_audio", name="stretch_audio")
1157
+ panel_stretch_audio_no_pitch_correction = wx.Panel(self)
1158
+
1159
+ self.checkbox_stretch_audio = wx.CheckBox(panel_stretch_audio_no_pitch_correction,
1160
+ label="stretch_audio", name="stretch_audio")
1156
1161
  set_tooltip(self.checkbox_stretch_audio, "Stretches the input audio to fit the input video. " + \
1157
1162
  "Default is to stretch the video to fit the audio. " + \
1158
1163
  "Keeps original video audio as secondary tracks. Slower " + \
@@ -1160,8 +1165,8 @@ if wx is not None:
1160
1165
  "paging or Out of Memory errors on low-RAM systems.")
1161
1166
  self.checkbox_stretch_audio.Bind(wx.EVT_CHECKBOX, self.update_stretch_audio_subsettings)
1162
1167
 
1163
- self.checkbox_no_pitch_correction = wx.CheckBox(self, label="no_pitch_correction",
1164
- name="no_pitch_correction")
1168
+ self.checkbox_no_pitch_correction = wx.CheckBox(panel_stretch_audio_no_pitch_correction,
1169
+ label="no_pitch_correction", name="no_pitch_correction")
1165
1170
  set_tooltip(self.checkbox_no_pitch_correction, "Skips pitch correction step when stretching audio. " + \
1166
1171
  "Requires --stretch_audio to be set, otherwise " + \
1167
1172
  "does nothing.")
@@ -1175,7 +1180,8 @@ if wx is not None:
1175
1180
  sizer_output_dir = wx.BoxSizer(wx.HORIZONTAL)
1176
1181
  sizer_alignment_dir = wx.BoxSizer(wx.HORIZONTAL)
1177
1182
  sizer_prepend = wx.BoxSizer(wx.HORIZONTAL)
1178
- sizer_stretch_audio_no_pitch_correction = wx.BoxSizer(wx.VERTICAL)
1183
+ sizer_stretch_audio_no_pitch_correction_outer = wx.BoxSizer(wx.HORIZONTAL)
1184
+ sizer_stretch_audio_no_pitch_correction_inner = wx.BoxSizer(wx.VERTICAL)
1179
1185
  sizer_save_cancel = wx.BoxSizer(wx.HORIZONTAL)
1180
1186
 
1181
1187
  # Configure layout with nested Box Sizers:
@@ -1192,28 +1198,34 @@ if wx is not None:
1192
1198
  # sizer_prepend
1193
1199
  # text_prepend
1194
1200
  # text_ctrl_prepend
1195
- # sizer_stretch_audio_no_pitch_correction
1196
- # checkbox_stretch_audio
1197
- # checkbox_no_pitch_correction
1201
+ # sizer_stretch_audio_no_pitch_correction_outer
1202
+ # panel_stretch_audio_no_pitch_correction
1203
+ # sizer_stretch_audio_no_pitch_correction_inner
1204
+ # checkbox_stretch_audio
1205
+ # checkbox_no_pitch_correction
1198
1206
  # sizer_save_cancel
1199
1207
  # button_save
1200
1208
  # button_cancel
1201
1209
  #
1202
1210
  self.SetSizer(sizer_dialog)
1203
1211
  sizer_dialog.Add(self.text_header, 0, wx.ALL, 5)
1204
- sizer_dialog.Add(sizer_output_dir, 1, wx.LEFT|wx.RIGHT|wx.EXPAND, 2)
1205
- sizer_dialog.Add(sizer_alignment_dir, 1, wx.LEFT|wx.RIGHT|wx.EXPAND, 2)
1206
- sizer_dialog.Add(sizer_prepend, 1, wx.LEFT|wx.EXPAND, 5)
1207
- sizer_dialog.Add(sizer_stretch_audio_no_pitch_correction, 1, wx.LEFT|wx.EXPAND, 5)
1208
- sizer_dialog.Add(sizer_save_cancel, 2, wx.BOTTOM|wx.EXPAND, 5)
1212
+ sizer_dialog.Add(sizer_output_dir, 3, wx.LEFT|wx.RIGHT|wx.EXPAND, 2)
1213
+ sizer_dialog.Add(sizer_alignment_dir, 3, wx.LEFT|wx.RIGHT|wx.EXPAND, 2)
1214
+ sizer_dialog.Add(sizer_prepend, 3, wx.LEFT|wx.EXPAND, 5)
1215
+ sizer_dialog.Add(sizer_stretch_audio_no_pitch_correction_outer, 3, wx.LEFT|wx.EXPAND, 5)
1216
+ sizer_stretch_audio_no_pitch_correction_outer.Add(panel_stretch_audio_no_pitch_correction,
1217
+ 1, wx.LEFT|wx.EXPAND, 5)
1218
+ sizer_stretch_audio_no_pitch_correction_outer.Add((0, 0), 2, wx.EXPAND, 5) # spacer
1219
+ sizer_dialog.Add(sizer_save_cancel, 5, wx.BOTTOM|wx.EXPAND, 5)
1209
1220
  sizer_prepend.Add(self.text_prepend, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5)
1210
1221
  sizer_prepend.Add(self.text_ctrl_prepend, 0, wx.ALIGN_CENTER_VERTICAL, 5)
1211
1222
  sizer_output_dir.Add(self.static_box_sizer_output, 1, wx.LEFT|wx.RIGHT|wx.ALIGN_CENTER_VERTICAL, 5)
1212
1223
  self.static_box_sizer_output.Add(self.dir_picker_output, 1, wx.EXPAND)
1213
1224
  sizer_alignment_dir.Add(self.static_box_sizer_alignment, 1, wx.LEFT|wx.RIGHT|wx.ALIGN_CENTER_VERTICAL, 5)
1214
1225
  self.static_box_sizer_alignment.Add(self.dir_picker_alignment, 1, wx.EXPAND)
1215
- sizer_stretch_audio_no_pitch_correction.Add(self.checkbox_stretch_audio, 0, wx.ALL, 5)
1216
- sizer_stretch_audio_no_pitch_correction.Add(self.checkbox_no_pitch_correction, 0, wx.ALL, 5)
1226
+ panel_stretch_audio_no_pitch_correction.SetSizer(sizer_stretch_audio_no_pitch_correction_inner)
1227
+ sizer_stretch_audio_no_pitch_correction_inner.Add(self.checkbox_stretch_audio, 0, wx.ALL, 5)
1228
+ sizer_stretch_audio_no_pitch_correction_inner.Add(self.checkbox_no_pitch_correction, 0, wx.ALL, 5)
1217
1229
  sizer_save_cancel.Add((0, 0), 3, wx.EXPAND, 5) # spacer
1218
1230
  sizer_save_cancel.Add(self.button_save, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5)
1219
1231
  sizer_save_cancel.Add((0, 0), 2, wx.EXPAND, 5) # spacer
@@ -1226,7 +1238,8 @@ if wx is not None:
1226
1238
  # cache dictionaries mapping setting names to widget setter and getter functions
1227
1239
  self.setting_getters = {}
1228
1240
  self.setting_setters = {}
1229
- for child in self.GetChildren():
1241
+ for child in itertools.chain(self.GetChildren(),
1242
+ panel_stretch_audio_no_pitch_correction.GetChildren()):
1230
1243
  child_class_name = child.GetClassName()
1231
1244
  child_name = child.GetName()
1232
1245
  if child_class_name == "wxDirPickerCtrl":
@@ -1250,6 +1263,8 @@ if wx is not None:
1250
1263
  self.update_stretch_audio_subsettings()
1251
1264
 
1252
1265
  set_background_color(self, is_dark)
1266
+ if sum(self.checkbox_stretch_audio.GetForegroundColour()[:3]) < 350:
1267
+ panel_stretch_audio_no_pitch_correction.SetBackgroundColour(gui_background_color_light)
1253
1268
 
1254
1269
  def update_stretch_audio_subsettings(self, event=None):
1255
1270
  subsettings = [self.checkbox_no_pitch_correction]
@@ -1453,16 +1468,21 @@ if wx is not None:
1453
1468
  def set_background_color(window, is_dark):
1454
1469
  children = get_children(window)
1455
1470
  for window in children + [window]:
1471
+ # modifying a CheckBox converts it into a Button, which would mess with screen readers
1472
+ if isinstance(window, wx.CheckBox):
1473
+ continue
1456
1474
  if is_dark:
1457
- if isinstance(window, (wx.ListCtrl, wx.Button, wx.TextCtrl)):
1475
+ if isinstance(window, (wx.ListCtrl, wx.TextCtrl)):
1458
1476
  window.SetBackgroundColour("Black")
1477
+ elif isinstance(window, wx.Button):
1478
+ window.SetBackgroundColour(tuple(x // 2 for x in gui_background_color_dark))
1459
1479
  else:
1460
1480
  window.SetBackgroundColour(gui_background_color_dark)
1461
1481
  window.SetForegroundColour("White" if is_dark else "Black")
1462
1482
 
1463
1483
  class FrameMain(wx.Frame):
1464
1484
  def __init__(self, parent):
1465
- wx.Frame.__init__(self, parent, title="describealign", size=wx.Size(800, 500))
1485
+ wx.Frame.__init__(self, parent, title=f"describealign v{__version__}", size=wx.Size(800, 500))
1466
1486
  # setting the GUI frame's font causes all contained elements to inherit that font by default
1467
1487
  self.SetFont(wx.Font(*gui_font))
1468
1488
  appearance = wx.SystemSettings.GetAppearance()
@@ -1725,27 +1745,26 @@ def command_line_interface():
1725
1745
  args = parser.parse_args()
1726
1746
 
1727
1747
  if args.version:
1728
- import importlib
1729
- cur_dir = os.getcwd()
1730
- if sys.path[0] == cur_dir:
1731
- # ignore describealign.py in current directory
1732
- del sys.path[0]
1733
- installed_spec = importlib.util.find_spec('describealign')
1734
- sys.path = [cur_dir] + sys.path
1748
+ print(f"version: {__version__}")
1749
+ if "__compiled__" in globals() or getattr(sys, 'frozen', False):
1750
+ print("running from compiled binary")
1735
1751
  else:
1736
- installed_spec = importlib.util.find_spec('describealign')
1737
- if installed_spec is None:
1738
- print("describealign is not installed")
1739
- else:
1740
- installed_path = os.path.abspath(installed_spec.origin)
1752
+ import importlib
1753
+ cur_dir = os.getcwd()
1754
+ if sys.path[0] == cur_dir:
1755
+ # ignore describealign.py in current directory
1756
+ del sys.path[0]
1757
+ installed_spec = importlib.util.find_spec('describealign')
1758
+ sys.path = [cur_dir] + sys.path
1759
+ else:
1760
+ installed_spec = importlib.util.find_spec('describealign')
1741
1761
  this_script_path = os.path.abspath(__file__)
1742
- if installed_path != this_script_path:
1743
- print("WARNING: describealign is not being run from the installed version")
1744
- print(f" installed path: {installed_path}")
1745
- print(f" content hash: {get_version_hash(installed_path)}")
1746
- print(f" this file path: {this_script_path}")
1747
- print(f" content hash: {get_version_hash(this_script_path)}")
1748
- print(f"installed version: {importlib.metadata.version('describealign')}")
1762
+ if installed_spec is None or (this_script_path != os.path.abspath(installed_spec.origin)):
1763
+ print("running from downloaded .py file")
1764
+ else:
1765
+ print("running from installed package")
1766
+ print(f"path: {this_script_path}")
1767
+ print(f"content hash: {get_version_hash(this_script_path)}")
1749
1768
  elif args.install_ffmpeg:
1750
1769
  # Make sure the file is world executable
1751
1770
  os.chmod(get_ffmpeg(), 0o755)
@@ -18,7 +18,7 @@ dynamic = ["version", "dependencies"]
18
18
  keywords = ["audio", "description", "alignment", "describe", "align", "video", "media", "stretch", "time-scale", "match", "combine", "fit", "blind", "impaired", "track", "sync", "synchronize", "register", "accessible", "accessibility", "descriptive", "narration", "visual", "low-vision", "disability", "access", "assistive"]
19
19
 
20
20
  [tool.setuptools.dynamic]
21
- version = { file = "version" }
21
+ version = { attr = "describealign.__version__" }
22
22
  dependencies = { file = "requirements.txt" }
23
23
 
24
24
  [project.scripts]
@@ -1 +0,0 @@
1
- 2.0.0
File without changes
File without changes
File without changes