Commit 98fe39bf authored by Wolfgang Rohdewald's avatar Wolfgang Rohdewald
Browse files

whitespace fixes

parent 364f8964
......@@ -87,11 +87,12 @@ class KmjBuild(build):
def run(self):
for binary in ['kajongg', 'kajonggserver']:
open(binary, 'w').write('#!/bin/sh\nexec %skajongg/%s.py $*\n' % (kdeDirs['data'], binary))
os.chmod(binary, 0o0755 )
os.chmod(binary, 0o0755)
call(['cp sc-apps-kajongg.svgz kajongg.svgz'], shell=True)
call(['cp sc-action-games-kajongg-law.svgz games-kajongg-law.svgz'], shell=True)
build.run(self)
setup(name='kajongg',
version=VERSION,
description='The classical game of Mah Jongg',
......
......@@ -145,6 +145,7 @@ class Animation(QPropertyAnimation, StrMixin):
if needRefresh and Internal.scene:
Internal.scene.focusRect.refresh()
class ParallelAnimationGroup(QParallelAnimationGroup, StrMixin):
"""
......@@ -157,8 +158,6 @@ class ParallelAnimationGroup(QParallelAnimationGroup, StrMixin):
running = [] # we need a reference to active animation groups
current = None
clsUid = 0
def __init__(self, animations, parent=None):
QParallelAnimationGroup.__init__(self, parent)
self.animations = animations
......@@ -293,6 +292,7 @@ class ParallelAnimationGroup(QParallelAnimationGroup, StrMixin):
"""for debugging"""
return 'G{}({}:{})'.format(self.uid, len(self.animations), self.stateName())
class AnimatedMixin:
"""for UITile and PlayerWind"""
......@@ -468,11 +468,13 @@ def animate():
return ParallelAnimationGroup.current.deferred
return succeed(None).addErrback(logException)
def doCallbackWithSpeed(result, speed, callback, *args, **kwargs):
"""as the name says"""
with AnimationSpeed(speed):
callback(result, *args, **kwargs)
def animateAndDo(callback, *args, **kwargs):
"""if we want the next animations to have the same speed as the current group,
do not use animate().addCallback() because speed would not be kept"""
......
......@@ -50,7 +50,7 @@ class Background(Resource):
self.imageWidth = self.group.readInteger('Width')
self.imageHeight = self.group.readInteger('Height')
except Exception as exc:
logException(exc) # TODO: simplify if we switch to twisted logger
logException(exc) # TODO: simplify if we switch to twisted logger
raise
self.isPlain = bool(self.group.readEntry('Plain'))
if not self.isPlain:
......
......@@ -110,7 +110,7 @@ class PlayerWind(AnimatedMixin, QGraphicsObject, StrMixin):
painter.scale(0.60, 0.60)
renderer.render(painter, self.wind.markerSvgName, self.boundingRect())
def boundingRect(self): # pylint: disable=no-self-use
def boundingRect(self): # pylint: disable=no-self-use
"""define the part of the tile we want to see"""
size = int(Internal.scene.windTileset.faceSize.height() * 1.1)
return QRectF(QPoint(), QPoint(size, size))
......@@ -178,6 +178,7 @@ class WindLabel(QLabel):
child.paint(painter, QStyleOptionGraphicsItem())
return pMap
class Board(QGraphicsRectItem, StrMixin):
""" a board with any number of positioned tiles"""
......
......@@ -84,7 +84,7 @@ class ChatModel(QAbstractTableModel):
elif role == Qt.DisplayRole and index.column() == 2:
result = i18n(chatLine.message)
elif role == Qt.ForegroundRole and index.column() == 2:
palette = Internal.app.palette() # pylint: disable=no-member
palette = Internal.app.palette() # pylint: disable=no-member
color = 'blue' if chatLine.isStatusMessage else palette.windowText(
)
result = QColor(color)
......
......@@ -34,6 +34,7 @@ from signal import signal, SIGABRT, SIGINT, SIGTERM
from log import logError, logDebug
from common import Options, Internal, isAlive, Debug
class MyHook(cgitb.Hook):
"""override the standard cgitb hook: invoke the browser"""
......@@ -57,6 +58,7 @@ class MyHook(cgitb.Hook):
# sys.excepthook = MyHook()
NOTFOUND = []
try:
......@@ -70,6 +72,7 @@ try:
except ImportError as importError:
NOTFOUND.append('Package python-zope-interface missing: %s' % importError)
try:
from twisted.spread import pb # pylint: disable=unused-import
from twisted.internet.error import ReactorNotRunning
......@@ -622,8 +625,9 @@ class MainWindow(KXmlGuiWindow):
centralWidget.setAutoFillBackground(True)
@afterQueuedAnimations
def tilesetNameChanged(
self, unusedDeferredResult, unusedOldValue=None, unusedNewValue=None, *unusedArgs): # pylint: disable=unused-argument
def tilesetNameChanged( # pylint: disable=unused-argument
self, unusedDeferredResult, unusedOldValue=None,
unusedNewValue=None, *unusedArgs):
"""if the wanted tileset changed, apply the change now"""
if self.centralView:
with AnimationSpeed():
......
......@@ -784,9 +784,7 @@ class Knitting(MJRule):
suitCounts = list(len([x for x in hand.tiles if x.lowerGroup == y])
for y in Tile.colors)
minSuit = min(suitCounts)
result = ''.join(
x for idx,
x in enumerate(Tile.colors) if suitCounts[idx] > minSuit)
result = ''.join(x for idx, x in enumerate(Tile.colors) if suitCounts[idx] > minSuit)
if len(result) == 2:
return result
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment