File tree Expand file tree Collapse file tree 7 files changed +52
-42
lines changed Expand file tree Collapse file tree 7 files changed +52
-42
lines changed Original file line number Diff line number Diff line change 2121
2222# This file is the system monitor configuration GUI
2323
24+ from library .pythoncheck import check_python_version
25+ check_python_version ()
26+
2427import glob
2528import os
2629import platform
3033import requests
3134import babel
3235
33- MIN_PYTHON = (3 , 9 )
34- if sys .version_info < MIN_PYTHON :
35- print ("[ERROR] Python %s.%s or later is required." % MIN_PYTHON )
36- try :
37- sys .exit (0 )
38- except :
39- os ._exit (0 )
40-
4136try :
4237 import tkinter .ttk as ttk
4338 from tkinter import *
Original file line number Diff line number Diff line change 1+ # SPDX-License-Identifier: GPL-3.0-or-later
2+ #
3+ # turing-smart-screen-python - a Python system monitor and library for USB-C displays like Turing Smart Screen or XuanFang
4+ # https://github.com/mathoudebine/turing-smart-screen-python/
5+ #
6+ # Copyright (C) 2021 Matthieu Houdebine (mathoudebine)
7+ #
8+ # This program is free software: you can redistribute it and/or modify
9+ # it under the terms of the GNU General Public License as published by
10+ # the Free Software Foundation, either version 3 of the License, or
11+ # (at your option) any later version.
12+ #
13+ # This program is distributed in the hope that it will be useful,
14+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
15+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16+ # GNU General Public License for more details.
17+ #
18+ # You should have received a copy of the GNU General Public License
19+ # along with this program. If not, see <https://www.gnu.org/licenses/>.
20+
21+ # This file is used to check if Python version used is compatible
22+ import os
23+ import sys
24+
25+ # Oldest / newest version supported
26+ MIN_PYTHON = (3 , 9 )
27+ MAX_PYTHON = (3 , 13 )
28+
29+
30+ def check_python_version ():
31+ current_version = sys .version_info [:2 ]
32+
33+ if current_version < MIN_PYTHON or current_version > MAX_PYTHON :
34+ print (f"[ERROR] Python { current_version [0 ]} .{ current_version [1 ]} is not supported by this program. "
35+ f"Python { MIN_PYTHON [0 ]} .{ MIN_PYTHON [1 ]} -{ MAX_PYTHON [0 ]} .{ MAX_PYTHON [1 ]} required." )
36+ try :
37+ sys .exit (0 )
38+ except :
39+ os ._exit (0 )
Original file line number Diff line number Diff line change 2525# along with this program. If not, see <https://www.gnu.org/licenses/>.
2626
2727# This file is the system monitor main program to display HW sensors on your screen using themes (see README)
28+
29+ from library .pythoncheck import check_python_version
30+ check_python_version ()
31+
2832import glob
2933import os
3034import sys
3135
32- MIN_PYTHON = (3 , 9 )
33- if sys .version_info < MIN_PYTHON :
34- print ("[ERROR] Python %s.%s or later is required." % MIN_PYTHON )
35- try :
36- sys .exit (0 )
37- except :
38- os ._exit (0 )
39-
4036try :
4137 import atexit
4238 import locale
Original file line number Diff line number Diff line change 2222# This file generate PNG previews for available fonts
2323
2424import os
25- import sys
26-
27- MIN_PYTHON = (3 , 9 )
28- if sys .version_info < MIN_PYTHON :
29- print ("[ERROR] Python %s.%s or later is required." % MIN_PYTHON )
30- try :
31- sys .exit (0 )
32- except :
33- os ._exit (0 )
34-
3525from PIL import Image , ImageDraw , ImageFont
3626import math
3727from pathlib import Path
Original file line number Diff line number Diff line change 2121
2222# This file is a simple Python test program using the library code to display custom content on screen (see README)
2323
24+ from library .pythoncheck import check_python_version
25+ check_python_version ()
26+
2427import os
2528import signal
2629import sys
Original file line number Diff line number Diff line change 2222# theme-editor.py: Allow to easily edit themes for System Monitor (main.py) in a preview window on the computer
2323# The preview window is refreshed as soon as the theme file is modified
2424
25+ from library .pythoncheck import check_python_version
26+ check_python_version ()
27+
2528import locale
2629import logging
2730import os
3033import sys
3134import time
3235
33- MIN_PYTHON = (3 , 8 )
34- if sys .version_info < MIN_PYTHON :
35- print ("[ERROR] Python %s.%s or later is required." % MIN_PYTHON )
36- try :
37- sys .exit (0 )
38- except :
39- os ._exit (0 )
40-
4136try :
4237 import tkinter
4338 from PIL import ImageTk , Image
Original file line number Diff line number Diff line change 2929PNG_SIGNATURE = b'\x89 \x50 \x4E \x47 \x0D \x0A \x1A \x0A '
3030PNG_IEND = b'\x49 \x45 \x4E \x44 \xAE \x42 \x60 \x82 '
3131
32- MIN_PYTHON = (3 , 8 )
33- if sys .version_info < MIN_PYTHON :
34- print ("[ERROR] Python %s.%s or later is required." % MIN_PYTHON )
35- try :
36- sys .exit (0 )
37- except :
38- os ._exit (0 )
39-
4032if len (sys .argv ) != 2 :
4133 print ("Usage :" )
4234 print (" turing-theme-extractor.py path/to/theme-file.data" )
You can’t perform that action at this time.
0 commit comments