From 4bd60959f1b9abdf3cd0d904cb176ee46c6b0918 Mon Sep 17 00:00:00 2001 From: simonmicro Date: Fri, 9 Dec 2022 19:51:18 +0100 Subject: [PATCH] Removed old gui code references and variables --- LICENSE.gui.md | 21 --------------------- README.md | 3 +-- py-kms/pykms_Client.py | 12 +++++------- py-kms/pykms_Format.py | 1 - py-kms/pykms_Misc.py | 7 ++----- py-kms/pykms_Server.py | 15 +++------------ 6 files changed, 11 insertions(+), 48 deletions(-) delete mode 100644 LICENSE.gui.md diff --git a/LICENSE.gui.md b/LICENSE.gui.md deleted file mode 100644 index 1d06073..0000000 --- a/LICENSE.gui.md +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2020 Matteo ℱan - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/README.md b/README.md index c52406b..ead2964 100644 --- a/README.md +++ b/README.md @@ -47,5 +47,4 @@ The wiki has been completly reworked and is now available on [readthedocs.com](h - To show the help pages type: `python3 pykms_Server.py -h` and `python3 pykms_Client.py -h`. ## License - - _py-kms_ is [![Unlicense](https://img.shields.io/badge/license-unlicense-lightgray.svg)](https://github.com/SystemRage/py-kms/blob/master/LICENSE) - - _py-kms GUI_ is [![MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/SystemRage/py-kms/blob/master/LICENSE.gui.md) © Matteo ℱan + - _py-kms_ is [![Unlicense](https://img.shields.io/badge/license-unlicense-lightgray.svg)](https://github.com/SystemRage/py-kms/blob/master/LICENSE) \ No newline at end of file diff --git a/py-kms/pykms_Client.py b/py-kms/pykms_Client.py index 749ae4c..d2fe1b5 100644 --- a/py-kms/pykms_Client.py +++ b/py-kms/pykms_Client.py @@ -45,10 +45,9 @@ class client_thread(threading.Thread): def __init__(self, name): threading.Thread.__init__(self) self.name = name - self.with_gui = False def run(self): - clt_main(with_gui = self.with_gui) + clt_main() #--------------------------------------------------------------------------------------------------------------------------------------------------------- @@ -297,11 +296,10 @@ def client_create(clt_sock): pretty_printer(log_obj = loggerclt.warning, to_exit = True, where = "clt", put_text = "{reverse}{magenta}{bold}Something went wrong. Exiting...{end}") -def clt_main(with_gui = False): +def clt_main(): try: - if not with_gui: - # Parse options. - client_options() + # Parse options. + client_options() # Check options. client_check() @@ -393,4 +391,4 @@ def readKmsResponseV6(data): return message if __name__ == "__main__": - clt_main(with_gui = False) + clt_main() diff --git a/py-kms/pykms_Format.py b/py-kms/pykms_Format.py index d0d28c5..ee37363 100644 --- a/py-kms/pykms_Format.py +++ b/py-kms/pykms_Format.py @@ -400,7 +400,6 @@ def pretty_printer(**kwargs): if None `put_text` must be defined for printing process. `to_exit ` --> if True system exit is called. `where` --> specifies if message is server-side or client-side - (useful for GUI redirect). """ # Set defaults for not defined options. options = {'log_obj' : None, diff --git a/py-kms/pykms_Misc.py b/py-kms/pykms_Misc.py index f948d44..c96f094 100644 --- a/py-kms/pykms_Misc.py +++ b/py-kms/pykms_Misc.py @@ -194,9 +194,6 @@ def logger_create(log_obj, config, mode = 'a'): frmt_name = '%(name)s ' from pykms_Server import serverthread - if serverthread.with_gui: - frmt_std = frmt_name + frmt_std - frmt_min = frmt_name + frmt_min def apply_formatter(levelnum, formats, handler, color = False): levelformdict = {} @@ -521,7 +518,7 @@ def check_setup(config, options, logger, where): # Check logfile. config['logfile'] = check_logfile(config['logfile'], options['lfile']['def'], where = where) - # Check logsize (py-kms Gui). + # Check logsize if config['logsize'] == "": if any(opt in ['STDOUT', 'FILEOFF'] for opt in config['logfile']): # set a recognized size never used. @@ -530,7 +527,7 @@ def check_setup(config, options, logger, where): pretty_printer(put_text = "{reverse}{red}{bold}argument `-S/--logsize`: invalid with: '%s'. Exiting...{end}" %config['logsize'], where = where, to_exit = True) - # Check loglevel (py-kms Gui). + # Check loglevel if config['loglevel'] == "": # set a recognized level never used. config['loglevel'] = 'ERROR' diff --git a/py-kms/pykms_Server.py b/py-kms/pykms_Server.py index 80e549e..543fe79 100755 --- a/py-kms/pykms_Server.py +++ b/py-kms/pykms_Server.py @@ -134,7 +134,8 @@ class server_thread(threading.Thread): self.name = name self.queue = queue self.server = None - self.is_running_server, self.with_gui, self.checked = [False for _ in range(3)] + self.is_running_server = False + self.checked = False self.is_running_thread = threading.Event() def terminate_serve(self): @@ -169,13 +170,7 @@ class server_thread(threading.Thread): self.server.pykms_serve() except (SystemExit, Exception) as e: self.eject = True - if not self.with_gui: - raise - else: - if isinstance(e, SystemExit): - continue - else: - raise + raise ##--------------------------------------------------------------------------------------------------------------------------------------------------------- @@ -385,9 +380,6 @@ def server_check(): opts = [('clientcount', '-c/--client-count'), ('timeoutidle', '-t0/--timeout-idle'), ('timeoutsndrcv', '-t1/--timeout-sndrcv')] - if serverthread.with_gui: - opts += [('activation', '-a/--activation-interval'), - ('renewal', '-r/--renewal-interval')] check_other(srv_config, opts, loggersrv, where = 'srv') # Check further addresses / ports. @@ -467,7 +459,6 @@ def server_main_terminal(): server_check() serverthread.checked = True - # (without GUI) and (without daemon). # Run threaded server. serverqueue.put('start') # Wait to finish.