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 1919
2020# This file is the system monitor configuration GUI
2121
22+ from library .pythoncheck import check_python_version
23+ check_python_version ()
24+
2225import glob
2326import os
2427import platform
2831import requests
2932import babel
3033
31- MIN_PYTHON = (3 , 9 )
32- if sys .version_info < MIN_PYTHON :
33- print ("[ERROR] Python %s.%s or later is required." % MIN_PYTHON )
34- try :
35- sys .exit (0 )
36- except :
37- os ._exit (0 )
38-
3934try :
4035 import tkinter .ttk as ttk
4136 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 2323# along with this program. If not, see <https://www.gnu.org/licenses/>.
2424
2525# This file is the system monitor main program to display HW sensors on your screen using themes (see README)
26+
27+ from library .pythoncheck import check_python_version
28+ check_python_version ()
29+
2630import glob
2731import os
2832import sys
2933
30- MIN_PYTHON = (3 , 9 )
31- if sys .version_info < MIN_PYTHON :
32- print ("[ERROR] Python %s.%s or later is required." % MIN_PYTHON )
33- try :
34- sys .exit (0 )
35- except :
36- os ._exit (0 )
37-
3834try :
3935 import atexit
4036 import locale
Original file line number Diff line number Diff line change 2020# This file generate PNG previews for available fonts
2121
2222import os
23- import sys
24-
25- MIN_PYTHON = (3 , 9 )
26- if sys .version_info < MIN_PYTHON :
27- print ("[ERROR] Python %s.%s or later is required." % MIN_PYTHON )
28- try :
29- sys .exit (0 )
30- except :
31- os ._exit (0 )
32-
3323from PIL import Image , ImageDraw , ImageFont
3424import math
3525from pathlib import Path
Original file line number Diff line number Diff line change 1919
2020# This file is a simple Python test program using the library code to display custom content on screen (see README)
2121
22+ from library .pythoncheck import check_python_version
23+ check_python_version ()
24+
2225import os
2326import signal
2427import sys
Original file line number Diff line number Diff line change 2020# theme-editor.py: Allow to easily edit themes for System Monitor (main.py) in a preview window on the computer
2121# The preview window is refreshed as soon as the theme file is modified
2222
23+ from library .pythoncheck import check_python_version
24+ check_python_version ()
25+
2326import locale
2427import logging
2528import os
2831import sys
2932import time
3033
31- MIN_PYTHON = (3 , 8 )
32- if sys .version_info < MIN_PYTHON :
33- print ("[ERROR] Python %s.%s or later is required." % MIN_PYTHON )
34- try :
35- sys .exit (0 )
36- except :
37- os ._exit (0 )
38-
3934try :
4035 import tkinter
4136 from PIL import ImageTk , Image
Original file line number Diff line number Diff line change 2727PNG_SIGNATURE = b'\x89 \x50 \x4E \x47 \x0D \x0A \x1A \x0A '
2828PNG_IEND = b'\x49 \x45 \x4E \x44 \xAE \x42 \x60 \x82 '
2929
30- MIN_PYTHON = (3 , 8 )
31- if sys .version_info < MIN_PYTHON :
32- print ("[ERROR] Python %s.%s or later is required." % MIN_PYTHON )
33- try :
34- sys .exit (0 )
35- except :
36- os ._exit (0 )
37-
3830if len (sys .argv ) != 2 :
3931 print ("Usage :" )
4032 print (" turing-theme-extractor.py path/to/theme-file.data" )
You can’t perform that action at this time.
0 commit comments