Ejemplo n.º 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)
Ejemplo n.º 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()
Ejemplo n.º 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()
Ejemplo n.º 4
0
 def newLightSource(self):
     """next value"""
     oldIdx = LIGHTSOURCES.index(self.game.wall.lightSource)
     return LIGHTSOURCES[(oldIdx + 1) % 4]
Ejemplo n.º 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]
Ejemplo n.º 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)
Ejemplo n.º 7
0
Archivo: scene.py Proyecto: KDE/kajongg
 def newLightSource(self):
     """next value"""
     oldIdx = LIGHTSOURCES.index(self.game.wall.lightSource)
     return LIGHTSOURCES[(oldIdx + 1) % 4]
Ejemplo n.º 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]
Ejemplo n.º 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]
Ejemplo n.º 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)
Ejemplo n.º 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]
Ejemplo n.º 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))