Skip to content

Commit ae4d685

Browse files
committed
[region-editor] Transition to Tcl/Tk for GUI #181
This allows for better control over window events and makes input handling more consistent across platforms. It also allows better customization, for example, the system undo/redo commands are used instead of key binds. There is still much work to do, however this is a good starting point, and has feature parity with the existing editor.
1 parent e4eb41f commit ae4d685

17 files changed

+1639
-948
lines changed

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
site/
44
build/
55
dist/dvr-scan/*
6-
dist/dvr-scan*
7-
dist/dvr_scan*
6+
dist/dvr-scan-*
7+
dist/dvr_scan-*
88
*.egg-info/
99
/tutorial-env/*
1010
.DS_Store

dist/dvr-scan.spec

Lines changed: 49 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,16 @@
22

33
block_cipher = None
44

5-
a = Analysis(['../dvr_scan/__main__.py'],
5+
cli = Analysis(['../dvr_scan/__main__.py'],
66
pathex=['.'],
77
binaries=None,
88
datas=[
9-
('../dvr-scan.cfg', 'dvr-scan'),
10-
('../*.md', 'dvr-scan'),
11-
('../dist/dvr-scan.ico', 'dvr-scan'),
12-
('../dvr_scan/LICENSE*', 'dvr-scan'),
13-
('../docs/*.md', 'dvr-scan/docs/')
9+
('../dvr_scan/dvr-scan.ico', 'dvr_scan'),
10+
('../dvr_scan/dvr-scan-logo.png', 'dvr_scan'),
11+
('../dvr-scan.cfg', 'dvr_scan/APP_FOLDER'),
12+
('../*.md', 'dvr_scan/APP_FOLDER'),
13+
('../dvr_scan/LICENSE*', 'dvr_scan/APP_FOLDER'),
14+
('../docs/*.md', 'dvr_scan/APP_FOLDER/docs/')
1415
],
1516
hiddenimports=[],
1617
hookspath=[],
@@ -20,10 +21,31 @@ a = Analysis(['../dvr_scan/__main__.py'],
2021
win_private_assemblies=False,
2122
cipher=block_cipher)
2223

23-
pyz = PYZ(a.pure, a.zipped_data,
24+
app = Analysis(['../dvr_scan/app/__main__.py'],
25+
pathex=['.'],
26+
binaries=None,
27+
datas=[
28+
('../dvr_scan/dvr-scan.ico', 'dvr_scan'),
29+
('../dvr_scan/dvr-scan-logo.png', 'dvr_scan'),
30+
('../dvr-scan.cfg', 'dvr_scan/APP_FOLDER'),
31+
('../*.md', 'dvr_scan/APP_FOLDER'),
32+
('../dvr_scan/LICENSE*', 'dvr_scan/APP_FOLDER'),
33+
('../docs/*.md', 'dvr_scan/APP_FOLDER/docs/')
34+
],
35+
hiddenimports=[],
36+
hookspath=[],
37+
runtime_hooks=[],
38+
excludes=["av"],
39+
win_no_prefer_redirects=False,
40+
win_private_assemblies=False,
2441
cipher=block_cipher)
25-
exe = EXE(pyz,
26-
a.scripts,
42+
43+
cli_pyz = PYZ(cli.pure, cli.zipped_data,
44+
cipher=block_cipher)
45+
app_pyz = PYZ(app.pure, app.zipped_data,
46+
cipher=block_cipher)
47+
cli_exe = EXE(cli_pyz,
48+
cli.scripts,
2749
exclude_binaries=True,
2850
name='dvr-scan',
2951
debug=False,
@@ -32,10 +54,24 @@ exe = EXE(pyz,
3254
console=True,
3355
version='.version_info',
3456
icon='dvr-scan.ico')
35-
coll = COLLECT(exe,
36-
a.binaries,
37-
a.zipfiles,
38-
a.datas,
57+
app_exe = EXE(app_pyz,
58+
app.scripts,
59+
exclude_binaries=True,
60+
name='dvr-scan-app',
61+
debug=False,
62+
strip=False,
63+
upx=True,
64+
console=True,
65+
version='.version_info',
66+
icon='dvr-scan.ico')
67+
coll = COLLECT(cli_exe,
68+
cli.binaries,
69+
cli.zipfiles,
70+
cli.datas,
71+
app_exe,
72+
app.binaries,
73+
app.zipfiles,
74+
app.datas,
3975
strip=False,
4076
upx=True,
4177
name='dvr-scan')

dist/installer/DVR-Scan.aip

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
<ROW Directory="LocalAppDataFolder" Directory_Parent="TARGETDIR" DefaultDir="LOCALA~1|LocalAppDataFolder" IsPseudoRoot="1"/>
6161
<ROW Directory="Mexico_Dir" Directory_Parent="tzdata_Dir" DefaultDir="Mexico"/>
6262
<ROW Directory="North_Dakota_Dir" Directory_Parent="America_Dir" DefaultDir="NORTH_~1|North_Dakota"/>
63+
<ROW Directory="PIL_Dir" Directory_Parent="_internal_Dir" DefaultDir="PIL"/>
6364
<ROW Directory="Pacific_Dir" Directory_Parent="tzdata_Dir" DefaultDir="Pacific"/>
6465
<ROW Directory="SystemV_Dir" Directory_Parent="tzdata_Dir" DefaultDir="SystemV"/>
6566
<ROW Directory="TARGETDIR" DefaultDir="SourceDir"/>
@@ -71,6 +72,7 @@
7172
<ROW Directory="cv2_Dir" Directory_Parent="_internal_Dir" DefaultDir="cv2"/>
7273
<ROW Directory="data_Dir" Directory_Parent="cv2_Dir" DefaultDir="data"/>
7374
<ROW Directory="docs_Dir" Directory_Parent="APPDIR" DefaultDir="docs"/>
75+
<ROW Directory="dvr_scan_Dir" Directory_Parent="_internal_Dir" DefaultDir="dvr_scan"/>
7476
<ROW Directory="encoding_Dir" Directory_Parent="_tcl_data_Dir" DefaultDir="encoding"/>
7577
<ROW Directory="fft_Dir" Directory_Parent="numpy_Dir" DefaultDir="fft"/>
7678
<ROW Directory="gapi_Dir" Directory_Parent="cv2_Dir" DefaultDir="gapi"/>
@@ -128,6 +130,7 @@
128130
<ROW Component="__init__.py_2" ComponentId="{CC81E13B-98B6-4123-B58B-508564936E49}" Directory_="mat_wrapper_Dir" Attributes="0" KeyPath="__init__.py_2" Type="0"/>
129131
<ROW Component="__init__.py_3" ComponentId="{19547ADA-5843-4723-8981-D734D6E2C993}" Directory_="typing_Dir" Attributes="0" KeyPath="__init__.py_4" Type="0"/>
130132
<ROW Component="__init__.py_4" ComponentId="{5C768E9C-4B68-4767-B916-01019FE7E779}" Directory_="utils_Dir" Attributes="0" KeyPath="__init__.py_5" Type="0"/>
133+
<ROW Component="_imaging.cp313win_amd64.pyd" ComponentId="{F6A417D9-13CB-4037-9DED-F333659F273F}" Directory_="PIL_Dir" Attributes="256" KeyPath="_imaging.cp313win_amd64.pyd" Type="0"/>
131134
<ROW Component="_multiarray_tests.cp313win_amd64.pyd" ComponentId="{1B5C3446-2796-4F07-9C5A-029986CA6FD2}" Directory_="_core_Dir" Attributes="256" KeyPath="_multiarray_tests.cp313win_amd64.pyd" Type="0"/>
132135
<ROW Component="_pocketfft_umath.cp313win_amd64.pyd" ComponentId="{F38BD11F-54AE-410A-ACF9-057065D807F7}" Directory_="fft_Dir" Attributes="256" KeyPath="_pocketfft_umath.cp313win_amd64.pyd" Type="0"/>
133136
<ROW Component="_umath_linalg.cp313win_amd64.pyd" ComponentId="{9DDB3DD3-4795-4C0B-BD3B-106E2EBADAE0}" Directory_="linalg_Dir" Attributes="256" KeyPath="_umath_linalg.cp313win_amd64.pyd" Type="0"/>
@@ -182,6 +185,7 @@
182185
<ROW Component="cs.msg" ComponentId="{F24A8C57-F6F8-447B-93DA-551D1537AEB6}" Directory_="msgs_1_Dir" Attributes="0" KeyPath="cs.msg_1" Type="0"/>
183186
<ROW Component="dvrscan.cfg" ComponentId="{18A37A49-86C6-42DF-A130-DC5499CD6677}" Directory_="DVRScan_Dir" Attributes="16" KeyPath="dvrscan.cfg_1" Type="0"/>
184187
<ROW Component="dvrscan.exe" ComponentId="{BFAC0A4B-76D6-4EF9-B2B5-DFB8B5AC8885}" Directory_="APPDIR" Attributes="256" KeyPath="dvrscan.exe"/>
188+
<ROW Component="dvrscanlogo.png" ComponentId="{05FD099E-40AB-476C-AD2D-300B5F4DE001}" Directory_="dvr_scan_Dir" Attributes="0" KeyPath="dvrscanlogo.png" Type="0"/>
185189
<ROW Component="ffmpeg.exe" ComponentId="{BBCE1F27-65DC-461F-B81C-CF84ED2D7201}" Directory_="APPDIR" Attributes="256" KeyPath="ffmpeg.exe"/>
186190
<ROW Component="http.tcl" ComponentId="{10B85E89-AAB5-47BE-9CCA-FA767C015062}" Directory_="http1.0_Dir" Attributes="0" KeyPath="http.tcl" Type="0"/>
187191
<ROW Component="libcrypto3.dll" ComponentId="{217DC358-8ADE-4E4C-8661-FB6C4FBA6EA7}" Directory_="_internal_Dir" Attributes="256" KeyPath="libcrypto3.dll"/>
@@ -214,7 +218,6 @@
214218
<ROW File="LICENSETHIRDPARTY" Component_="LICENSETHIRDPARTY" FileName="LICENS~2|LICENSE-THIRDPARTY" Attributes="0" SourcePath="..\dvr-scan\LICENSE-THIRDPARTY" SelfReg="false"/>
215219
<ROW File="README.md" Component_="LICENSE" FileName="README.md" Attributes="0" SourcePath="..\dvr-scan\README.md" SelfReg="false"/>
216220
<ROW File="dvrscan.cfg" Component_="LICENSE" FileName="dvr-scan.cfg" Attributes="0" SourcePath="..\dvr-scan\dvr-scan.cfg" SelfReg="false"/>
217-
<ROW File="dvrscan.ico" Component_="LICENSE" FileName="dvr-scan.ico" Attributes="0" SourcePath="..\dvr-scan\dvr-scan.ico" SelfReg="false"/>
218221
<ROW File="apimswincoreconsolel110.dll" Component_="apimswincoreconsolel110.dll" FileName="API-MS~1.DLL|api-ms-win-core-console-l1-1-0.dll" Attributes="0" SourcePath="..\dvr-scan\_internal\api-ms-win-core-console-l1-1-0.dll" SelfReg="false"/>
219222
<ROW File="apimswincoredatetimel110.dll" Component_="apimswincoredatetimel110.dll" FileName="API-MS~2.DLL|api-ms-win-core-datetime-l1-1-0.dll" Attributes="0" SourcePath="..\dvr-scan\_internal\api-ms-win-core-datetime-l1-1-0.dll" SelfReg="false"/>
220223
<ROW File="apimswincoredebugl110.dll" Component_="apimswincoredebugl110.dll" FileName="API-MS~3.DLL|api-ms-win-core-debug-l1-1-0.dll" Attributes="0" SourcePath="..\dvr-scan\_internal\api-ms-win-core-debug-l1-1-0.dll" SelfReg="false"/>
@@ -1233,6 +1236,13 @@
12331236
<ROW File="index.md" Component_="changelog.md" FileName="index.md" Attributes="0" SourcePath="..\dvr-scan\docs\index.md" SelfReg="false"/>
12341237
<ROW File="resources.md" Component_="changelog.md" FileName="RESOUR~1.MD|resources.md" Attributes="0" SourcePath="..\dvr-scan\docs\resources.md" SelfReg="false"/>
12351238
<ROW File="dvrscan.cfg_1" Component_="dvrscan.cfg" FileName="dvr-scan.cfg" Attributes="0" SourcePath="..\dvr-scan\dvr-scan.cfg" SelfReg="false"/>
1239+
<ROW File="dvrscanlogo.png" Component_="dvrscanlogo.png" FileName="DVR-SC~1.PNG|dvr-scan-logo.png" Attributes="0" SourcePath="..\dvr-scan\_internal\dvr_scan\dvr-scan-logo.png" SelfReg="false"/>
1240+
<ROW File="dvrscan.ico_1" Component_="dvrscanlogo.png" FileName="dvr-scan.ico" Attributes="0" SourcePath="..\dvr-scan\_internal\dvr_scan\dvr-scan.ico" SelfReg="false"/>
1241+
<ROW File="_imaging.cp313win_amd64.pyd" Component_="_imaging.cp313win_amd64.pyd" FileName="_IMAGI~1.PYD|_imaging.cp313-win_amd64.pyd" Attributes="0" SourcePath="..\dvr-scan\_internal\PIL\_imaging.cp313-win_amd64.pyd" SelfReg="false"/>
1242+
<ROW File="_imagingcms.cp313win_amd64.pyd" Component_="_imaging.cp313win_amd64.pyd" FileName="_IMAGI~2.PYD|_imagingcms.cp313-win_amd64.pyd" Attributes="0" SourcePath="..\dvr-scan\_internal\PIL\_imagingcms.cp313-win_amd64.pyd" SelfReg="false"/>
1243+
<ROW File="_imagingmath.cp313win_amd64.pyd" Component_="_imaging.cp313win_amd64.pyd" FileName="_IMAGI~3.PYD|_imagingmath.cp313-win_amd64.pyd" Attributes="0" SourcePath="..\dvr-scan\_internal\PIL\_imagingmath.cp313-win_amd64.pyd" SelfReg="false"/>
1244+
<ROW File="_imagingtk.cp313win_amd64.pyd" Component_="_imaging.cp313win_amd64.pyd" FileName="_IMAGI~4.PYD|_imagingtk.cp313-win_amd64.pyd" Attributes="0" SourcePath="..\dvr-scan\_internal\PIL\_imagingtk.cp313-win_amd64.pyd" SelfReg="false"/>
1245+
<ROW File="_webp.cp313win_amd64.pyd" Component_="_imaging.cp313win_amd64.pyd" FileName="_WEBPC~1.PYD|_webp.cp313-win_amd64.pyd" Attributes="0" SourcePath="..\dvr-scan\_internal\PIL\_webp.cp313-win_amd64.pyd" SelfReg="false"/>
12361246
</COMPONENT>
12371247
<COMPONENT cid="caphyon.advinst.msicomp.AiPersistentDataComponent">
12381248
<ROW PersistentRow="dvrscan.cfg_1" Type="0" Condition="1"/>
@@ -1495,6 +1505,8 @@
14951505
<ROW Feature_="DVRScan" Component_="altTheme.tcl"/>
14961506
<ROW Feature_="DVRScan" Component_="changelog.md"/>
14971507
<ROW Feature_="DVRScan" Component_="dvrscan.cfg"/>
1508+
<ROW Feature_="DVRScan" Component_="dvrscanlogo.png"/>
1509+
<ROW Feature_="DVRScan" Component_="_imaging.cp313win_amd64.pyd"/>
14981510
</COMPONENT>
14991511
<COMPONENT cid="caphyon.advinst.msicomp.MsiIconsComponent">
15001512
<ROW Name="dvr_scan_icon.exe" SourcePath="dvr_scan_icon.ico" Index="0"/>

dist/post_release.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,15 @@
1717
"imageio_ffmpeg",
1818
"importlib_metadata-*.dist-info",
1919
"matplotlib",
20-
"PIL",
2120
"PyQt5",
2221
"pip-*.dist-info",
2322
"psutil",
2423
"pyinstaller-*.dist-info",
2524
"setuptools-*.dist-info",
2625
"tcl8",
26+
"pywin32_system32",
2727
"wheel-*.dist-info",
28+
"win32",
2829
"wx",
2930
]
3031

@@ -57,10 +58,10 @@
5758
# Collect self dependencies.
5859
# TODO: See if the following can be added to COLLECT instead of including
5960
# these files as part of the .spec file Analysis step.
60-
for f in glob.glob(os.path.join(BASE_PATH, "dvr-scan/*")):
61+
APP_FOLDER = os.path.join(BASE_PATH, "dvr_scan/APP_FOLDER")
62+
for f in glob.glob(os.path.join(APP_FOLDER, "*")):
6163
shutil.move(f, DIST_PATH)
62-
63-
os.rmdir(os.path.join(BASE_PATH, "dvr-scan"))
64+
os.rmdir(APP_FOLDER)
6465

6566

6667
def write_version_file():

dist/requirements_windows.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
numpy
55
opencv-python==4.10.0.84
66
opencv-contrib-python==4.10.0.84
7+
pillow
78
platformdirs
89
pyinstaller>=6.0
910
pytest

dvr_scan/__main__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ def main():
3333
sys.exit(EXIT_ERROR)
3434
logger = logging.getLogger("dvr_scan")
3535
redirect = FakeTqdmLoggingRedirect if settings.get("quiet-mode") else logging_redirect_tqdm
36+
# TODO: Use Python __debug__ mode instead of hard-coding as config option.
3637
debug_mode = settings.get("debug")
3738
show_traceback = getattr(logging, settings.get("verbosity").upper()) == logging.DEBUG
3839
with redirect(loggers=[logger]):
@@ -47,6 +48,7 @@ def main():
4748
if debug_mode:
4849
raise
4950
except KeyboardInterrupt:
51+
# TODO: This doesn't always work when the GUI is running.
5052
logger.info("Stopping (interrupt received)...", exc_info=show_traceback)
5153
if debug_mode:
5254
raise

0 commit comments

Comments
 (0)