Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Games
Kajongg
Commits
3982f39d
Commit
3982f39d
authored
Apr 09, 2021
by
Wolfgang Rohdewald
Browse files
pylint: move duplicate code into handleSignals()
parent
1fed5fe3
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/common.py
View file @
3982f39d
...
...
@@ -15,6 +15,7 @@ import shutil
import
logging
import
logging.handlers
import
socket
from
signal
import
signal
,
SIGABRT
,
SIGINT
,
SIGTERM
from
qt
import
QStandardPaths
try
:
...
...
@@ -139,6 +140,19 @@ def socketName():
return
os
.
path
.
normpath
(
'{}/socket{}'
.
format
(
serverDir
,
Internal
.
defaultPort
))
def
handleSignals
(
handler
):
"""set up signal handling"""
signal
(
SIGABRT
,
handler
)
signal
(
SIGINT
,
handler
)
signal
(
SIGTERM
,
handler
)
if
os
.
name
!=
'nt'
:
from
signal
import
SIGHUP
,
SIGQUIT
signal
(
SIGHUP
,
handler
)
signal
(
SIGQUIT
,
handler
)
class
Debug
:
"""holds flags for debugging output. At a later time we might
...
...
src/mainwindow.py
View file @
3982f39d
...
...
@@ -10,7 +10,6 @@ SPDX-License-Identifier: GPL-2.0
# pylint: disable=wrong-import-order, wrong-import-position
import
sys
import
os
import
codecs
from
itertools
import
chain
...
...
@@ -18,10 +17,9 @@ import cgitb
import
tempfile
import
webbrowser
import
logging
from
signal
import
signal
,
SIGABRT
,
SIGINT
,
SIGTERM
from
log
import
logError
,
logDebug
from
common
import
Options
,
Internal
,
isAlive
,
Debug
from
common
import
Options
,
Internal
,
isAlive
,
Debug
,
handleSignals
class
MyHook
(
cgitb
.
Hook
):
...
...
@@ -111,13 +109,7 @@ def cleanExit(*unusedArgs): # pylint: disable=unused-argument
# sys.exit(0)
MainWindow
.
aboutToQuit
()
signal
(
SIGABRT
,
cleanExit
)
signal
(
SIGINT
,
cleanExit
)
signal
(
SIGTERM
,
cleanExit
)
if
os
.
name
!=
'nt'
:
from
signal
import
SIGHUP
,
SIGQUIT
signal
(
SIGHUP
,
cleanExit
)
signal
(
SIGQUIT
,
cleanExit
)
handleSignals
(
cleanExit
)
class
MainWindow
(
KXmlGuiWindow
):
...
...
src/server.py
View file @
3982f39d
...
...
@@ -17,7 +17,6 @@ import sys
import
os
import
logging
import
datetime
from
signal
import
signal
,
SIGABRT
,
SIGINT
,
SIGTERM
from
zope.interface
import
implementer
...
...
@@ -45,14 +44,8 @@ def cleanExit(*unusedArgs): # pylint: disable=unused-argument
except
ReactorNotRunning
:
pass
signal
(
SIGABRT
,
cleanExit
)
signal
(
SIGINT
,
cleanExit
)
signal
(
SIGTERM
,
cleanExit
)
if
os
.
name
!=
'nt'
:
from
signal
import
SIGHUP
,
SIGQUIT
signal
(
SIGHUP
,
cleanExit
)
signal
(
SIGQUIT
,
cleanExit
)
from
common
import
handleSignals
handleSignals
(
cleanExit
)
from
common
import
Options
,
Internal
,
Debug
Internal
.
isServer
=
True
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment