tkinterweb-tkhtml 1.1.3__py3-none-linux_armv7l.whl → 2.0.0__py3-none-linux_armv7l.whl

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,58 +1,58 @@
1
1
  """
2
- TkinterWeb-Tkhtml v1.1
3
- This package provides pre-built binaries of a modified version of the Tkhtml3 widget from http://tkhtml.tcl.tk/tkhtml.html,
2
+ TkinterWeb-Tkhtml v2.0
3
+ This package provides pre-built binaries of a modified version of the Tkhtml3 widget from https://github.com/Andereoo/TkinterWeb-Tkhtml,
4
4
  which enables the display of styled HTML and CSS code in Tkinter applications.
5
5
 
6
- This package can be used to import the Tkhtml widget into Tkinter projects
6
+ If you are not using the compile script's --install option, to add a new Tkhtml version, use the following file naming conventions:
7
+ - For Tcl/Tk 8:
8
+ - For a standard release: libTkhtml[major_version.minor_version].[dll/dylib/so] (eg. libTkhtml3.0.dll)
9
+ - For an experimental release: libTkhtml[major_version.minor_version]exp.[dll/dylib/so] (eg. libTkhtml3.1exp.dll)
10
+ - For Tcl/Tk 9:
11
+ - For a standard release: libTkhtml[major_version.minor_version]-TclTk9.[dll/dylib/so] (eg. libTkhtml3.0-TclTk9.dll)
12
+ - For an experimental release: libTkhtml[major_version.minor_version]exp-TclTk9.[dll/dylib/so] (eg. libTkhtml3.1exp-TclTk9.dll)
13
+
14
+ This package can be used to load the Tkhtml widget into Tkinter applications.
7
15
  but is mainly intended to be used through TkinterWeb, which provides a full Python interface.
8
16
  See https://github.com/Andereoo/TkinterWeb.
9
17
 
10
- Copyright (c) 2025 Andereoo
18
+ Copyright (c) 2025 Andrew Clarke
11
19
  """
12
20
 
13
21
  import os
14
22
 
15
-
16
-
23
+ from tkinter import TclVersion
17
24
 
18
25
  __title__ = 'TkinterWeb-Tkhtml'
19
- __author__ = "Andereoo"
20
- __copyright__ = "Copyright (c) 2025 Andereoo"
26
+ __author__ = "Andrew Clarke"
27
+ __copyright__ = "Copyright (c) 2025 Andrew Clarke"
21
28
  __license__ = "MIT"
22
- __version__ = '1.1.3'
29
+ __version__ = '2.0.0'
23
30
 
24
- TKHTML_RELEASE = "3.0 (TkinterWeb standard)" # Backwards-compatibility. Not useful or even necessarily true anymore. Will be removed.
25
31
 
26
32
  TKHTML_ROOT_DIR = os.path.join(os.path.abspath(os.path.dirname(__file__)), "tkhtml")
27
33
 
34
+ ALL_TKHTML_BINARIES = [file for file in os.listdir(TKHTML_ROOT_DIR) if "libTkhtml" in file]
28
35
 
36
+ if TclVersion >= 9:
37
+ TKHTML_BINARIES = [file for file in ALL_TKHTML_BINARIES if "TclTk9" in file]
38
+ HELP_MESSAGE_EXP = f"Download https://github.com/Andereoo/TkinterWeb-Tkhtml/tree/experimental and run 'python compile.py' to compile Tkhtml. \
39
+ Copy the binary into {TKHTML_ROOT_DIR}, adding 'exp-TclTk9' after the filename (eg. 'libTkhtml3.1exp-TclTk9.dll')"
40
+ else:
41
+ TKHTML_BINARIES = [file for file in ALL_TKHTML_BINARIES if "TclTk9" not in file]
42
+ HELP_MESSAGE_EXP = f"Download https://github.com/Andereoo/TkinterWeb-Tkhtml/tree/experimental and run 'python compile.py' to compile Tkhtml. \
43
+ Copy the binary into {TKHTML_ROOT_DIR}, adding 'exp' after the filename (eg. 'libTkhtml3.1exp.dll')"
29
44
 
30
- TKHTML_BINARIES = [file for file in os.listdir(TKHTML_ROOT_DIR) if "libTkhtml" in file]
31
-
32
- # NOTE:
33
- # File names should be in the format libTkhtml[major].[minor].[so/dll/dylib]
34
- # Experimental file names should be in the format libTkhtml[major].[minor]exp.[so/dll/dylib]
45
+ HELP_MESSAGE = f"Download https://github.com/Andereoo/TkinterWeb-Tkhtml/tree/3.1-TclTk9 and run 'python compile.py --install' to compile and install Tkhtml. If you think this is a bug, consider filing a bug report."
35
46
 
36
- tkhtml_file = None
37
47
 
38
- help_message = f"To add a new Tkhtml version, drop your binary into the {TKHTML_ROOT_DIR} folder, named using the following conventions:\n\
39
- - For a standard release: libTkhtml[major_version.minor_version].[dll/dylib.so] (eg. libTkhtml3.0.dll)\n\
40
- - For an experimental release: libTkhtml[major_version.minor_version]exp.[dll/dylib.so] (eg. libTkhtml3.1exp.dll)"
41
-
42
- def get_tkhtml_folder():
43
- # Backwards-compatibility. Will be removed.
44
- return TKHTML_ROOT_DIR
45
-
46
- def get_loaded_tkhtml_version():
47
- global tkhtml_file
48
- if tkhtml_file:
49
- version = os.path.basename(tkhtml_file).replace("libTkhtml", "")
50
- return version[:version.rfind(".")]
51
- else:
52
- return None
53
-
54
48
  def get_tkhtml_file(version=None, index=-1, experimental=False):
55
49
  "Get the location of the platform's Tkhtml binary"
50
+ if not TKHTML_BINARIES:
51
+ if ALL_TKHTML_BINARIES:
52
+ raise OSError(f"No Tkhtml versions could be found for Tcl/Tk {int(TclVersion)}. {HELP_MESSAGE}")
53
+ else:
54
+ raise OSError(f"No Tkhtml versions could be found for your system. {HELP_MESSAGE}")
55
+
56
56
  if isinstance(version, float):
57
57
  version = str(version)
58
58
  if version:
@@ -61,20 +61,20 @@ def get_tkhtml_file(version=None, index=-1, experimental=False):
61
61
  # Note: experimental can be "auto"
62
62
  if "exp" in file:
63
63
  if not experimental:
64
- raise OSError(f"Tkhtml version {version} is an experimental release but experimental mode is disabled. {help_message}")
64
+ raise OSError(f"Tkhtml version {version} is an experimental release but experimental mode is disabled. {HELP_MESSAGE_EXP}")
65
65
  experimental = True
66
66
  else:
67
67
  if experimental == True:
68
- raise OSError(f"Tkhtml version {version} is not an experimental release but experimental mode is enabled. {help_message}")
68
+ raise OSError(f"Tkhtml version {version} is not an experimental release but experimental mode is enabled. {HELP_MESSAGE_EXP}")
69
69
  experimental = False
70
70
  return os.path.join(TKHTML_ROOT_DIR, file), version, experimental
71
- raise OSError(f"Tkhtml version {version} either does not exist or is unsupported on your system. {help_message}")
71
+ raise OSError(f"Tkhtml version {version} either does not exist or is unsupported on your system. {HELP_MESSAGE}")
72
72
  else:
73
73
  # Get highest numbered avaliable file if a version is not provided
74
74
  if experimental == True:
75
75
  files = [k for k in TKHTML_BINARIES if 'exp' in k]
76
76
  if not files:
77
- raise OSError(f"No experimental Tkhtml versions could be found on your system. {help_message}")
77
+ raise OSError(f"No experimental Tkhtml versions could be found on your system. {HELP_MESSAGE_EXP}")
78
78
  elif not experimental:
79
79
  files = [k for k in TKHTML_BINARIES if 'exp' not in k]
80
80
  else:
@@ -89,29 +89,23 @@ def get_tkhtml_file(version=None, index=-1, experimental=False):
89
89
  return os.path.join(TKHTML_ROOT_DIR, file), version, experimental
90
90
 
91
91
 
92
- def load_tkhtml_file(master, file, force=False):
92
+ def get_loaded_tkhtml_version(master):
93
+ """Get the version of the loaded Tkhtml instance.
94
+ This will raise a TclError if Tkhtml is not loaded.
95
+ Only call load_tkhtml_file or load_tkhtml if this fails or if you know this will fail."""
96
+ return master.tk.call("package", "present", "Tkhtml")
97
+
98
+
99
+ def load_tkhtml_file(master, file):
93
100
  "Load Tkhtml into the current Tcl/Tk instance"
94
- global tkhtml_file
95
- if (not tkhtml_file) or force:
96
- if TKHTML_ROOT_DIR not in os.environ["PATH"].split(os.pathsep):
97
- os.environ["PATH"] = os.pathsep.join([
98
- TKHTML_ROOT_DIR,
99
- os.environ["PATH"]
100
- ])
101
- master.tk.call("load", file)
102
- tkhtml_file = file
103
-
104
-
105
- def load_tkhtml(master, force=False, use_prebuilt=False):
101
+ if TKHTML_ROOT_DIR not in os.environ["PATH"].split(os.pathsep):
102
+ os.environ["PATH"] = os.pathsep.join([
103
+ TKHTML_ROOT_DIR,
104
+ os.environ["PATH"]
105
+ ])
106
+ master.tk.call("load", file)
107
+
108
+
109
+ def load_tkhtml(master):
106
110
  "Load Tkhtml into the current Tcl/Tk instance"
107
- if use_prebuilt:
108
- # Backwards-compatibility. Will likely be removed.
109
- file, version, experimental = get_tkhtml_file(None, 0)
110
- load_tkhtml_file(master, file, force)
111
- return version
112
-
113
- global tkhtml_file
114
- if (not tkhtml_file) or force:
115
- master.tk.call("package", "require", "Tkhtml")
116
- tkhtml_file = True
117
- return master.tk.call("package", "present", "Tkhtml")
111
+ master.tk.call("package", "require", "Tkhtml")
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2025 Andereoo
3
+ Copyright (c) 2025 Andrew Clarke
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: tkinterweb-tkhtml
3
- Version: 1.1.3
3
+ Version: 2.0.0
4
4
  Summary: HTML/CSS viewer for Tkinter
5
5
  Home-page: https://github.com/Andereoo/TkinterWeb-Tkhtml
6
6
  License: MIT
@@ -18,8 +18,8 @@ License-File: LICENSE.md
18
18
 
19
19
  # TkinterWeb-Tkhtml
20
20
 
21
- **This package provides pre-built binaries of a modified version of the Tkhtml3 widget from http://tkhtml.tcl.tk, which enables the display of styled HTML and CSS code in Tkinter applications.**
21
+ **This package provides pre-built binaries of a modified version of the Tkhtml3 widget from https://github.com/Andereoo/TkinterWeb-Tkhtml, which enables the display of styled HTML and CSS code in Tkinter applications.**
22
22
 
23
- This package can be used to import the Tkhtml widget into Tkinter projects but is mainly intended to be used through TkinterWeb, which provides a full Python interface.
23
+ This package can be used to load the Tkhtml widget into Tkinter applications but is mainly intended to be used through TkinterWeb, which provides a full Python interface.
24
24
 
25
25
  **See https://github.com/Andereoo/TkinterWeb for more information.**
@@ -0,0 +1,8 @@
1
+ tkinterweb_tkhtml/__init__.py,sha256=5rF4HJECZfAPddakqQVvDiHsyIAVQQHYSAOfJDlr2CQ,5309
2
+ tkinterweb_tkhtml/tkhtml/COPYRIGHT,sha256=DTaLs2-wF2uscyoCSsLB1oOqXwhtLRVZW1EdLa77OMs,1622
3
+ tkinterweb_tkhtml/tkhtml/libTkhtml3.0.so,sha256=7SLetf_4DXwz_iphlIRAvuuDnm6qYcfAdjVnnapfekc,310504
4
+ tkinterweb_tkhtml-2.0.0.dist-info/LICENSE.md,sha256=-PeosTLMUn2PEQ5Q12HUqYH4n_gjoKVxd107WE7BcMQ,1069
5
+ tkinterweb_tkhtml-2.0.0.dist-info/METADATA,sha256=Miq4LD-_2rLQ8wzahNhJt5xnz8qriKQ4FA-90Fkd0qI,1104
6
+ tkinterweb_tkhtml-2.0.0.dist-info/WHEEL,sha256=SfWbrUo49UCeTn4ZCaOubJz9Wtdk5gtBke9gOM6rnWs,101
7
+ tkinterweb_tkhtml-2.0.0.dist-info/top_level.txt,sha256=ZsOj9XY_g_0oGsUoDORlQhP0qdbT4X_Ts6yyFWG7i1A,18
8
+ tkinterweb_tkhtml-2.0.0.dist-info/RECORD,,
@@ -1,8 +0,0 @@
1
- tkinterweb_tkhtml/__init__.py,sha256=zkYwwSZDtDr-r0GOfHhZIziulwTR0hLNrzpBN7oBbl8,4637
2
- tkinterweb_tkhtml/tkhtml/COPYRIGHT,sha256=DTaLs2-wF2uscyoCSsLB1oOqXwhtLRVZW1EdLa77OMs,1622
3
- tkinterweb_tkhtml/tkhtml/libTkhtml3.0.so,sha256=7SLetf_4DXwz_iphlIRAvuuDnm6qYcfAdjVnnapfekc,310504
4
- tkinterweb_tkhtml-1.1.3.dist-info/LICENSE.md,sha256=A4A41a28mznzn27r63D6_15V0UfRNrfIbKrX3sabiX8,1064
5
- tkinterweb_tkhtml-1.1.3.dist-info/METADATA,sha256=QulV2npNcocDXdlFKVDydbEfRXajXnntdbThh39LCg4,1077
6
- tkinterweb_tkhtml-1.1.3.dist-info/WHEEL,sha256=SfWbrUo49UCeTn4ZCaOubJz9Wtdk5gtBke9gOM6rnWs,101
7
- tkinterweb_tkhtml-1.1.3.dist-info/top_level.txt,sha256=ZsOj9XY_g_0oGsUoDORlQhP0qdbT4X_Ts6yyFWG7i1A,18
8
- tkinterweb_tkhtml-1.1.3.dist-info/RECORD,,