Example #1
0
 def elementId(self):
     """returns the SVG element id of the tile"""
     if not self.showShadows:
         return QString("TILE_2")
     lightSourceIndex = LIGHTSOURCES.index(
         self.tile.board.rotatedLightSource())
     return QString("TILE_%1").arg(lightSourceIndex % 4 + 1)
Example #2
0
 def __changeAngle2(self, dummyResult):
     """now that no animation is running, really change"""
     if self.game: # might be finished meanwhile
         with Animated(False):
             wall = self.game.wall
             oldIdx = LIGHTSOURCES.index(wall.lightSource) # pylint: disable=E1101
             newLightSource = LIGHTSOURCES[(oldIdx + 1) % 4]
             wall.lightSource = newLightSource
             self.selectorBoard.lightSource = newLightSource
             self.discardBoard.lightSource = newLightSource
             self.adjustView()
             scoringDialog = self.actionScoring.data().toPyObject()
             if isinstance(scoringDialog, ScoringDialog):
                 scoringDialog.computeScores()
             self.centralScene.placeFocusRect()
Example #3
0
 def __changeAngle2(self, dummyResult):
     """now that no animation is running, really change"""
     if self.game:  # might be finished meanwhile
         with Animated(False):
             wall = self.game.wall
             oldIdx = LIGHTSOURCES.index(wall.lightSource)  # pylint: disable=E1101
             newLightSource = LIGHTSOURCES[(oldIdx + 1) % 4]
             wall.lightSource = newLightSource
             self.selectorBoard.lightSource = newLightSource
             self.discardBoard.lightSource = newLightSource
             self.adjustView()
             scoringDialog = self.actionScoring.data().toPyObject()
             if isinstance(scoringDialog, ScoringDialog):
                 scoringDialog.computeScores()
             self.centralScene.placeFocusRect()
Example #4
0
 def newLightSource(self):
     """next value"""
     oldIdx = LIGHTSOURCES.index(self.game.wall.lightSource)
     return LIGHTSOURCES[(oldIdx + 1) % 4]
Example #5
0
 def shadowOffsets(self, lightSource, rotation):
     """real offset of the shadow on the screen"""
     if not Internal.Preferences.showShadows:
         return (0, 0)
     lightSourceIndex = LIGHTSOURCES.index(lightSource)
     return self.__shadowOffsets[lightSourceIndex][rotation // 90]
Example #6
0
 def elementId(self):
     """returns the SVG element id of the tile"""
     if not self.showShadows:
         return QString("TILE_2")
     lightSourceIndex = LIGHTSOURCES.index(self.tile.board.rotatedLightSource())
     return QString("TILE_%1").arg(lightSourceIndex%4+1)
Example #7
0
File: scene.py Project: KDE/kajongg
 def newLightSource(self):
     """next value"""
     oldIdx = LIGHTSOURCES.index(self.game.wall.lightSource)
     return LIGHTSOURCES[(oldIdx + 1) % 4]
Example #8
0
 def shadowOffsets(self, lightSource, rotation):
     """real offset of the shadow on the screen"""
     if not Preferences.showShadows:
         return (0, 0)
     lightSourceIndex = LIGHTSOURCES.index(lightSource)
     return self.__shadowOffsets[lightSourceIndex][rotation//90]
Example #9
0
 def rotatedLightSource(self):
     """the light source we need for the original tile before it is rotated"""
     lightSourceIndex = LIGHTSOURCES.index(self.lightSource)
     lightSourceIndex = (lightSourceIndex+self.sceneRotation() // 90)%4
     return LIGHTSOURCES[lightSourceIndex]
Example #10
0
 def __elementId(self):
     """returns the SVG element id of the tile"""
     if not Internal.Preferences.showShadows:
         return "TILE_2"
     lightSourceIndex = LIGHTSOURCES.index(self.board.rotatedLightSource())
     return "TILE_{}".format(lightSourceIndex % 4 + 1)
Example #11
0
 def rotatedLightSource(self):
     """the light source we need for the original tile before it is rotated"""
     lightSourceIndex = LIGHTSOURCES.index(self.lightSource)
     lightSourceIndex = (lightSourceIndex+self.sceneRotation() // 90)%4
     return LIGHTSOURCES[lightSourceIndex]
Example #12
0
 def __elementId(self):
     """returns the SVG element id of the tile"""
     if not Internal.Preferences.showShadows:
         return QString("TILE_2")
     lightSourceIndex = LIGHTSOURCES.index(self.board.rotatedLightSource())
     return QString("TILE_{}".format(lightSourceIndex % 4 + 1))