mirror of
https://github.com/Py-KMS-Organization/py-kms.git
synced 2024-09-19 07:18:51 -04:00
Removed old gui code references and variables
This commit is contained in:
parent
f1fa5b794f
commit
4bd60959f1
6 changed files with 11 additions and 48 deletions
|
@ -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.
|
|
|
@ -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`.
|
- To show the help pages type: `python3 pykms_Server.py -h` and `python3 pykms_Client.py -h`.
|
||||||
|
|
||||||
## License
|
## 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_ 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
|
|
|
@ -45,10 +45,9 @@ class client_thread(threading.Thread):
|
||||||
def __init__(self, name):
|
def __init__(self, name):
|
||||||
threading.Thread.__init__(self)
|
threading.Thread.__init__(self)
|
||||||
self.name = name
|
self.name = name
|
||||||
self.with_gui = False
|
|
||||||
|
|
||||||
def run(self):
|
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",
|
pretty_printer(log_obj = loggerclt.warning, to_exit = True, where = "clt",
|
||||||
put_text = "{reverse}{magenta}{bold}Something went wrong. Exiting...{end}")
|
put_text = "{reverse}{magenta}{bold}Something went wrong. Exiting...{end}")
|
||||||
|
|
||||||
def clt_main(with_gui = False):
|
def clt_main():
|
||||||
try:
|
try:
|
||||||
if not with_gui:
|
# Parse options.
|
||||||
# Parse options.
|
client_options()
|
||||||
client_options()
|
|
||||||
|
|
||||||
# Check options.
|
# Check options.
|
||||||
client_check()
|
client_check()
|
||||||
|
@ -393,4 +391,4 @@ def readKmsResponseV6(data):
|
||||||
return message
|
return message
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
clt_main(with_gui = False)
|
clt_main()
|
||||||
|
|
|
@ -400,7 +400,6 @@ def pretty_printer(**kwargs):
|
||||||
if None `put_text` must be defined for printing process.
|
if None `put_text` must be defined for printing process.
|
||||||
`to_exit ` --> if True system exit is called.
|
`to_exit ` --> if True system exit is called.
|
||||||
`where` --> specifies if message is server-side or client-side
|
`where` --> specifies if message is server-side or client-side
|
||||||
(useful for GUI redirect).
|
|
||||||
"""
|
"""
|
||||||
# Set defaults for not defined options.
|
# Set defaults for not defined options.
|
||||||
options = {'log_obj' : None,
|
options = {'log_obj' : None,
|
||||||
|
|
|
@ -194,9 +194,6 @@ def logger_create(log_obj, config, mode = 'a'):
|
||||||
frmt_name = '%(name)s '
|
frmt_name = '%(name)s '
|
||||||
|
|
||||||
from pykms_Server import serverthread
|
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):
|
def apply_formatter(levelnum, formats, handler, color = False):
|
||||||
levelformdict = {}
|
levelformdict = {}
|
||||||
|
@ -521,7 +518,7 @@ def check_setup(config, options, logger, where):
|
||||||
# Check logfile.
|
# Check logfile.
|
||||||
config['logfile'] = check_logfile(config['logfile'], options['lfile']['def'], where = where)
|
config['logfile'] = check_logfile(config['logfile'], options['lfile']['def'], where = where)
|
||||||
|
|
||||||
# Check logsize (py-kms Gui).
|
# Check logsize
|
||||||
if config['logsize'] == "":
|
if config['logsize'] == "":
|
||||||
if any(opt in ['STDOUT', 'FILEOFF'] for opt in config['logfile']):
|
if any(opt in ['STDOUT', 'FILEOFF'] for opt in config['logfile']):
|
||||||
# set a recognized size never used.
|
# 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'],
|
pretty_printer(put_text = "{reverse}{red}{bold}argument `-S/--logsize`: invalid with: '%s'. Exiting...{end}" %config['logsize'],
|
||||||
where = where, to_exit = True)
|
where = where, to_exit = True)
|
||||||
|
|
||||||
# Check loglevel (py-kms Gui).
|
# Check loglevel
|
||||||
if config['loglevel'] == "":
|
if config['loglevel'] == "":
|
||||||
# set a recognized level never used.
|
# set a recognized level never used.
|
||||||
config['loglevel'] = 'ERROR'
|
config['loglevel'] = 'ERROR'
|
||||||
|
|
|
@ -134,7 +134,8 @@ class server_thread(threading.Thread):
|
||||||
self.name = name
|
self.name = name
|
||||||
self.queue = queue
|
self.queue = queue
|
||||||
self.server = None
|
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()
|
self.is_running_thread = threading.Event()
|
||||||
|
|
||||||
def terminate_serve(self):
|
def terminate_serve(self):
|
||||||
|
@ -169,13 +170,7 @@ class server_thread(threading.Thread):
|
||||||
self.server.pykms_serve()
|
self.server.pykms_serve()
|
||||||
except (SystemExit, Exception) as e:
|
except (SystemExit, Exception) as e:
|
||||||
self.eject = True
|
self.eject = True
|
||||||
if not self.with_gui:
|
raise
|
||||||
raise
|
|
||||||
else:
|
|
||||||
if isinstance(e, SystemExit):
|
|
||||||
continue
|
|
||||||
else:
|
|
||||||
raise
|
|
||||||
|
|
||||||
##---------------------------------------------------------------------------------------------------------------------------------------------------------
|
##---------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -385,9 +380,6 @@ def server_check():
|
||||||
opts = [('clientcount', '-c/--client-count'),
|
opts = [('clientcount', '-c/--client-count'),
|
||||||
('timeoutidle', '-t0/--timeout-idle'),
|
('timeoutidle', '-t0/--timeout-idle'),
|
||||||
('timeoutsndrcv', '-t1/--timeout-sndrcv')]
|
('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_other(srv_config, opts, loggersrv, where = 'srv')
|
||||||
|
|
||||||
# Check further addresses / ports.
|
# Check further addresses / ports.
|
||||||
|
@ -467,7 +459,6 @@ def server_main_terminal():
|
||||||
server_check()
|
server_check()
|
||||||
serverthread.checked = True
|
serverthread.checked = True
|
||||||
|
|
||||||
# (without GUI) and (without daemon).
|
|
||||||
# Run threaded server.
|
# Run threaded server.
|
||||||
serverqueue.put('start')
|
serverqueue.put('start')
|
||||||
# Wait to finish.
|
# Wait to finish.
|
||||||
|
|
Loading…
Reference in a new issue