Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delete line action, plus undo implemented for various commands #180

Merged
merged 64 commits into from
Jun 1, 2024
Merged
Changes from 1 commit
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
e411d2e
Provisional delete lines command
machinewrapped May 25, 2024
7041afd
Undo stack
machinewrapped May 25, 2024
5364aaa
Type hints
machinewrapped May 25, 2024
885d5be
Return valid type when deletion fails
machinewrapped May 25, 2024
7def0e6
Reset selection when lines are deleted
machinewrapped May 25, 2024
6a519b2
Use queued connections as much as possible
machinewrapped May 26, 2024
c313c49
Undo for merge lines
machinewrapped May 26, 2024
34c1167
Allow multiple model updates per command
machinewrapped May 26, 2024
fe45704
Undo for split/merge scene commands
machinewrapped May 26, 2024
b4957e3
Fix undo for merge scenes
machinewrapped May 26, 2024
d09f4ec
Fix for undo merge scenes
machinewrapped May 26, 2024
6bd403f
More precise viewmodel update for line merge
machinewrapped May 26, 2024
fb46ffc
Display subtitle line number in debugger
machinewrapped May 26, 2024
258b728
Fix for undo merge batches
machinewrapped May 28, 2024
8ec7399
Rename Reset -> Clear
machinewrapped May 28, 2024
dd3c95f
Only write project after batching if the flag is set
machinewrapped May 28, 2024
a0adfeb
Allow merging a single line without exception
machinewrapped May 28, 2024
5262be1
Unit tests for merge commands + undo
machinewrapped May 28, 2024
d79379e
Merge branch 'main' into delete-line
machinewrapped May 28, 2024
64fdbf4
Debug repr
machinewrapped May 28, 2024
ff3f48e
Moved batch settings back into test case
machinewrapped May 29, 2024
1b103e5
Split scene test
machinewrapped May 29, 2024
9c1c91e
Rename test file/class
machinewrapped May 29, 2024
c4c85f2
Fix for split batch undo
machinewrapped May 29, 2024
c10b1b9
Test for SplitBatchCommand
machinewrapped May 29, 2024
913130f
Undo for AutoSplitBatchCommand + tests
machinewrapped May 29, 2024
7b685c5
Just pass line numbers to MergeLinesCommand
machinewrapped May 29, 2024
41faf35
Merge lines test
machinewrapped May 29, 2024
bfc0b8a
Removed obsolete import
machinewrapped May 29, 2024
709e4d2
Redo commands
machinewrapped May 30, 2024
d812121
Queue thread safety
machinewrapped May 30, 2024
49c4119
Added base class for subtitle tests
machinewrapped May 30, 2024
131a9c3
Deleted lines test
machinewrapped May 30, 2024
aef7b8f
Validate that undo restores contents
machinewrapped May 30, 2024
969121b
Renamed file to match the test
machinewrapped May 30, 2024
7ddcb90
Validate batch sizes
machinewrapped May 30, 2024
173202d
Removed a TODO
machinewrapped May 30, 2024
8d385a1
More delete tests
machinewrapped May 30, 2024
03c9df5
Separate test for batching
machinewrapped May 30, 2024
9b86053
Cleanup
machinewrapped May 30, 2024
175e029
Consolidate options in base class
machinewrapped May 31, 2024
5804dd9
Reparse translations tests
machinewrapped Jun 1, 2024
8908be1
Made can_undo true by default
machinewrapped Jun 1, 2024
89de309
Don't renumber everything on save
machinewrapped Jun 1, 2024
ea0f10f
Removed some dead lines
machinewrapped Jun 1, 2024
ecaff61
Undo for reparse translations
machinewrapped Jun 1, 2024
69c9811
Fixed undo for reparse translations
machinewrapped Jun 1, 2024
b270e53
Update undo/redo tooltips
machinewrapped Jun 1, 2024
50a530a
Clear the undo stack when a command can't be undone
machinewrapped Jun 1, 2024
20564d0
Restore summaries on undo merge batches
machinewrapped Jun 1, 2024
1ff5ecc
Restore summaries on undo merge scenes
machinewrapped Jun 1, 2024
0096841
Fix for undo delete lines
machinewrapped Jun 1, 2024
114354c
Don't save project file automatically after reparse
machinewrapped Jun 1, 2024
ca4684c
Try to update proxy model when underlying model changes
machinewrapped Jun 1, 2024
3feaa9b
Don't modify parser translated when matching to originals
machinewrapped Jun 1, 2024
428e158
Don't renumber lines on load either
machinewrapped Jun 1, 2024
c2e9d35
Don't renumber lines on post-process
machinewrapped Jun 1, 2024
8270652
Update a TODO
machinewrapped Jun 1, 2024
17d82ed
Ensure scenes and batches are numbered correctly
machinewrapped Jun 1, 2024
70f95e2
Fix merging/preserving line translations
machinewrapped Jun 1, 2024
d208d52
Fix merge test logs
machinewrapped Jun 1, 2024
4a9581c
Validate merged translations
machinewrapped Jun 1, 2024
7b3ded4
Undid -> Undone
machinewrapped Jun 1, 2024
9b56755
Make InsertLines do what it says
machinewrapped Jun 1, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Moved batch settings back into test case
machinewrapped committed May 29, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit ff3f48e6678b430efa109fa4e069a03e788e99e4
3 changes: 0 additions & 3 deletions PySubtitle/UnitTests/TestData/chinese_dinner.py
Original file line number Diff line number Diff line change
@@ -548,9 +548,6 @@
'names': _names,
'original': chinese_dinner_jp,
'translated': chinese_dinner_en,
'expected_scene_count': 4,
'expected_scene_sizes': [2, 2, 1, 1],
'expected_scene_linecounts': [30, 25, 6, 3],
'expected_postprocess_differences': 13,
'expected_postprocess_unchanged': 51,
'response_map': {
11 changes: 8 additions & 3 deletions PySubtitle/UnitTests/test_Commands.py
Original file line number Diff line number Diff line change
@@ -30,7 +30,12 @@ class CommandsTests(unittest.TestCase):
command_test_cases = [
{
'data': chinese_dinner_data,
'commands' : [
'BatchSubtitlesCommand': {
'expected_scene_count': 4,
'expected_scene_sizes': [2, 2, 1, 1],
'expected_scene_linecounts': [30, 25, 6, 3],
},
'tests' : [
{
'command': 'MergeSceneCommandTest',
'scene_numbers': [2, 3],
@@ -90,11 +95,11 @@ def test_Commands(self):
file, datamodel = self._create_datamodel(data)

with self.subTest("BatchSubtitlesCommand"):
self.BatchSubtitlesCommandTests(file, datamodel, data)
self.BatchSubtitlesCommandTests(file, datamodel, test_case.get('BatchSubtitlesCommand'))

AddTranslations(file, data, 'translated')

for command_data in test_case['commands']:
for command_data in test_case['tests']:
command = command_data['command']

with self.subTest(command):
4 changes: 2 additions & 2 deletions PySubtitle/UnitTests/test_Project.py
Original file line number Diff line number Diff line change
@@ -75,8 +75,8 @@ def test_SubtitleBatches(self):
Test subtitle batcher, batch context and batch merging
"""
log_test_name("Test batch subtitles")
scene_count = chinese_dinner_data.get('expected_scene_count')
scene_lengths = chinese_dinner_data.get('expected_scene_linecounts')
scene_count = 4
scene_lengths = [30, 25, 6, 3]
first_lines = [
"いつものように食事が終わるまでは誰も入れないでくれ.",
"選んで何を食事の後.",