9
9
import tkinter .ttk as ttk
10
10
import webbrowser
11
11
from os .path import join
12
+ from importlib .metadata import metadata
12
13
from typing import TYPE_CHECKING
13
14
14
- from Cryptodome import __version__ as pycryptodomex_version
15
- from pyctr import __version__ as pyctr_version
16
-
17
15
from .osver import get_os_ver
18
16
# "from .. import" didn't work :/
19
17
from __init__ import __copyright__ as ninfs_copyright
20
18
from __init__ import __version__ as ninfs_version
21
19
20
+ frozen_using = None
21
+ if getattr (sys , 'frozen' , False ):
22
+ if getattr (sys , '_MEIPASS' , False ):
23
+ frozen_using = 'PyInstaller'
24
+ else :
25
+ # cx-Freeze probably
26
+ frozen_using = 'cx-Freeze'
27
+
22
28
if TYPE_CHECKING :
23
29
from . import NinfsGUI
24
30
@@ -68,7 +74,10 @@ def __init__(self, parent: 'NinfsGUI' = None):
68
74
header_label = ttk .Label (container , text = f'ninfs { ninfs_version } ' , font = (None , 15 , 'bold' ))
69
75
header_label .grid (row = 0 , column = 0 , padx = pad , pady = pad , sticky = tk .W )
70
76
71
- version_label = ttk .Label (container , text = f'Running on { python_version } { pybits } -bit' )
77
+ running_on = f'Running on Python { python_version } { pybits } -bit'
78
+ if frozen_using :
79
+ running_on += f' (frozen using { frozen_using } )'
80
+ version_label = ttk .Label (container , text = running_on )
72
81
version_label .grid (row = 1 , column = 0 , padx = pad , pady = (0 , pad ), sticky = tk .W )
73
82
74
83
copyright_label = ttk .Label (container , text = 'This program uses several libraries and modules, which have '
@@ -77,15 +86,15 @@ def __init__(self, parent: 'NinfsGUI' = None):
77
86
78
87
# tab name, license file name, url
79
88
info = [
80
- (f'ninfs { ninfs_version } ' , 'ninfs.md' , 'https://github.com/ihaveamac/ninfs' ,
89
+ (f'ninfs' , ninfs_version , 'ninfs.md' , 'https://github.com/ihaveamac/ninfs' ,
81
90
'ninfs - Copyright (c) 2017-2021 Ian Burgwin' ),
82
- (f'WinFsp 2020.2 ' , 'winfsp.txt' , 'https://github.com/billziss-gh/winfsp' ,
91
+ (f'WinFsp' , '2023 ' , 'winfsp.txt' , 'https://github.com/billziss-gh/winfsp' ,
83
92
'WinFsp - Windows File System Proxy, Copyright (C) Bill Zissimopoulos' ),
84
- (f'pycryptodomex { pycryptodomex_version } ' , 'pycryptodome.rst' ,
93
+ (f'pycryptodomex' , metadata ( 'pycryptodomex' )[ 'Version' ] , 'pycryptodome.rst' ,
85
94
'https://github.com/Legrandin/pycryptodome' , 'PyCryptodome - multiple licenses' ),
86
- (f'pyctr { pyctr_version } ' , 'pyctr' , 'https://github.com/ihaveamac/pyctr' ,
95
+ (f'pyctr' , metadata ( 'pyctr' )[ 'Version' ] , 'pyctr' , 'https://github.com/ihaveamac/pyctr' ,
87
96
'pyctr - Copyright (c) 2017-2021 Ian Burgwin' ),
88
- ('haccrypto 0.1.2' , 'haccrypto.md' , 'https://github.com/luigoalma/haccrypto' ,
97
+ ('haccrypto' , metadata ( 'haccrypto' )[ 'Version' ] , 'haccrypto.md' , 'https://github.com/luigoalma/haccrypto' ,
89
98
'haccrypto - Copyright (c) 2017-2021 Ian Burgwin & Copyright (c) 2020-2021 Luis Marques' )
90
99
]
91
100
@@ -97,10 +106,9 @@ def func():
97
106
webbrowser .open (do_url )
98
107
return func
99
108
100
- for tab_name , license_file , url , header in info :
101
- print ([tab_name , license_file , url ])
109
+ for proj_name , proj_version , license_file , url , header in info :
102
110
frame = ttk .Frame (license_notebook )
103
- license_notebook .add (frame , text = tab_name )
111
+ license_notebook .add (frame , text = proj_name + ' ' + proj_version )
104
112
105
113
license_header_label = ttk .Label (frame , text = header )
106
114
license_header_label .grid (row = 0 , sticky = tk .W , padx = pad // 2 , pady = pad // 2 )
0 commit comments