Skip to content

Commit 646bfb7

Browse files
committed
Fix a translation bug
1 parent c96a427 commit 646bfb7

File tree

9 files changed

+15
-8
lines changed

9 files changed

+15
-8
lines changed

assets/project.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"targets":[{"isStage":true,"name":"Stage","variables":{},"lists":{},"broadcasts":{},"blocks":{},"comments":{},"currentCostume":0,"costumes":[{"assetId":"cd21514d0531fdffb22204e0ec5ed84a","name":"backdrop1","md5ext":"cd21514d0531fdffb22204e0ec5ed84a.svg","dataFormat":"svg","rotationCenterX":240,"rotationCenterY":180}],"sounds":[],"volume":100,"layerOrder":0,"tempo":60,"videoTransparency":50,"videoState":"on","textToSpeechLanguage":"ro"},{"isStage":false,"name":"Balloon1","variables":{},"lists":{},"broadcasts":{},"blocks":{"]p0WM]/6Ve;iPTfO~ov:":{"opcode":"event_whenkeypressed","next":"czG|E7P$QI*{rA2iUC-w","parent":null,"inputs":{},"fields":{"KEY_OPTION":["space",null]},"shadow":false,"topLevel":true,"x":48,"y":208},"czG|E7P$QI*{rA2iUC-w":{"opcode":"control_repeat","next":null,"parent":"]p0WM]/6Ve;iPTfO~ov:","inputs":{"TIMES":[1,[6,"10"]],"SUBSTACK":[2,"fMb(Tc_!lhzbgDNihKSq"]},"fields":{},"shadow":false,"topLevel":false},"fMb(Tc_!lhzbgDNihKSq":{"opcode":"motion_changeyby","next":null,"parent":"czG|E7P$QI*{rA2iUC-w","inputs":{"DY":[1,[4,"5"]]},"fields":{},"shadow":false,"topLevel":false},"XDeo_FHmn,lz+e0E9lVL":{"opcode":"event_whenflagclicked","next":"mgHB88^RU,vL)z1QeKRr","parent":null,"inputs":{},"fields":{},"shadow":false,"topLevel":true,"x":48,"y":64},"mgHB88^RU,vL)z1QeKRr":{"opcode":"motion_gotoxy","next":null,"parent":"XDeo_FHmn,lz+e0E9lVL","inputs":{"X":[1,[4,"0"]],"Y":[1,[4,"0"]]},"fields":{},"shadow":false,"topLevel":false}},"comments":{},"currentCostume":0,"costumes":[{"assetId":"3dc0568c0414f091db6da7b90bcc2a64","name":"balloon1-a","bitmapResolution":1,"md5ext":"3dc0568c0414f091db6da7b90bcc2a64.svg","dataFormat":"svg","rotationCenterX":37.8470329351303,"rotationCenterY":43.83676071798408}],"sounds":[{"assetId":"83a9787d4cb6f3b7632b4ddfebf74367","name":"Pop","dataFormat":"wav","format":"","rate":44100,"sampleCount":1032,"md5ext":"83a9787d4cb6f3b7632b4ddfebf74367.wav"}],"volume":100,"layerOrder":1,"visible":true,"x":0,"y":0,"size":100,"direction":90,"draggable":false,"rotationStyle":"all around"}],"monitors":[],"extensions":[],"meta":{"semver":"3.0.0","vm":"0.2.0-prerelease.20220308092939","agent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.51 Safari/537.36"}}
1+
{"targets":[{"isStage":true,"name":"Stage","variables":{},"lists":{},"broadcasts":{},"blocks":{},"comments":{},"currentCostume":0,"costumes":[{"assetId":"cd21514d0531fdffb22204e0ec5ed84a","name":"backdrop1","md5ext":"cd21514d0531fdffb22204e0ec5ed84a.svg","dataFormat":"svg","rotationCenterX":240,"rotationCenterY":180}],"sounds":[],"volume":100,"layerOrder":0,"tempo":60,"videoTransparency":50,"videoState":"on","textToSpeechLanguage":"ro"},{"isStage":false,"name":"Balloon1","variables":{},"lists":{},"broadcasts":{},"blocks":{"]p0WM]/6Ve;iPTfO~ov:":{"opcode":"event_whenkeypressed","next":"czG|E7P$QI*{rA2iUC-w","parent":null,"inputs":{},"fields":{"KEY_OPTION":["space",null]},"shadow":false,"topLevel":true,"x":48,"y":208},"czG|E7P$QI*{rA2iUC-w":{"opcode":"control_repeat","next":null,"parent":"]p0WM]/6Ve;iPTfO~ov:","inputs":{"TIMES":[1,[6,"10"]],"SUBSTACK":[2,"fMb(Tc_!lhzbgDNihKSq"]},"fields":{},"shadow":false,"topLevel":false},"fMb(Tc_!lhzbgDNihKSq":{"opcode":"motion_changeyby","next":null,"parent":"czG|E7P$QI*{rA2iUC-w","inputs":{"DY":[1,[4,"5"]]},"fields":{},"shadow":false,"topLevel":false},"XDeo_FHmn,lz+e0E9lVL":{"opcode":"event_whenflagclicked","next":"mgHB88^RU,vL)z1QeKRr","parent":null,"inputs":{},"fields":{},"shadow":false,"topLevel":true,"x":48,"y":64},"mgHB88^RU,vL)z1QeKRr":{"opcode":"motion_gotoxy","next":null,"parent":"XDeo_FHmn,lz+e0E9lVL","inputs":{"X":[1,[4,"0"]],"Y":[1,[4,"0"]]},"fields":{},"shadow":false,"topLevel":false},"+m(RP9TzxLn/R*+qy)22":{"opcode":"operator_multiply","next":null,"parent":null,"inputs":{"NUM1":[1,[4,"5"]],"NUM2":[1,[4,"2"]]},"fields":{},"shadow":false,"topLevel":true,"x":-312,"y":648}},"comments":{},"currentCostume":0,"costumes":[{"assetId":"3dc0568c0414f091db6da7b90bcc2a64","name":"balloon1-a","bitmapResolution":1,"md5ext":"3dc0568c0414f091db6da7b90bcc2a64.svg","dataFormat":"svg","rotationCenterX":37.8470329351303,"rotationCenterY":43.83676071798408}],"sounds":[{"assetId":"83a9787d4cb6f3b7632b4ddfebf74367","name":"Pop","dataFormat":"wav","format":"","rate":44100,"sampleCount":1032,"md5ext":"83a9787d4cb6f3b7632b4ddfebf74367.wav"}],"volume":100,"layerOrder":1,"visible":true,"x":0,"y":150,"size":100,"direction":90,"draggable":false,"rotationStyle":"all around"}],"monitors":[],"extensions":[],"meta":{"semver":"3.0.0","vm":"0.2.0-prerelease.20220308092939","agent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.51 Safari/537.36"}}

block.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def evaluateBlockValue(self):
5757
except ZeroDivisionError:
5858
raise ZeroDivisionError(_("zero-division-error"))
5959
return self.value
60-
elif self.opcode == "operator_random": # () * ()
60+
elif self.opcode == "operator_random": # pick random from () to ()
6161
decimals1 = len(str(math.modf(float(self.getInputValue("from"))))) - 2
6262
decimals2 = len(str(math.modf(float(self.getInputValue("to"))))) - 2
6363
if decimals1 > decimals2:
@@ -66,6 +66,12 @@ def evaluateBlockValue(self):
6666
decimals = decimals2
6767
self.value = random.randint(int(self.getInputValue("from")) * 10 ** decimals, int(self.getInputValue("to")) * 10 ** decimals) / 10 ** decimals
6868
return self.value
69+
elif self.opcode == "motion_xposition": # x position
70+
self.value = self.target.x
71+
return self.value
72+
elif self.opcode == "motion_xposition": # y position
73+
self.value = self.target.y
74+
return self.value
6975

7076
# Returns block input value
7177
def getBlockInputValue(self, inputId):

config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
# Project file name
3131
# If the "manual" mode is chosen, set the Scratch project file to load.
32-
projectFileName: str = "projects/balloon.sb3"
32+
projectFileName: str = "projects/balloon-simple.sb3"
3333

3434
# Extract on project run
3535
# Set whether to extract the project assets on run.

main.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
along with this program. If not, see <https://www.gnu.org/licenses/>.
2020
"""
2121

22-
__version__ = "M18 (development version)"
22+
__version__ = "M19 (development version)"
2323
__author__ = "Secret-chest"
2424

2525
import tkinter.simpledialog
@@ -131,7 +131,7 @@
131131

132132
# Create project player and window
133133
display = pygame.display.set_mode([WIDTH, HEIGHT])
134-
pygame.display.set_caption(_("window-title", projectName=projectName, s2pVersionString="Scratch2Python" + __version__))
134+
pygame.display.set_caption(_("window-title", projectName=projectName, s2pVersionString="Scratch2Python " + __version__))
135135
pygame.display.set_icon(icon)
136136

137137
# Extract if requested

projects/balloon-simple.sb3

3.46 KB
Binary file not shown.

projects/balloon-start.sb3

3.34 KB
Binary file not shown.

projects/balloon.sb3

56 Bytes
Binary file not shown.

projects/xy-reporters.sb3

7.83 KB
Binary file not shown.

scratch.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -277,13 +277,16 @@ def execute(block, s, keys=[]):
277277
if block.repeatCounter is None:
278278
block.repeatCounter = int(block.getInputValue("times"))
279279
# Don't mark the loop as ran until done, and do a screen refresh
280-
if block.repeatCounter > 0:
280+
if block.repeatCounter > 1:
281281
block.blockRan = False
282282
else:
283283
block.blockRan = True
284284
block.repeatCounter = None
285285
block.screenRefresh = True
286286

287+
if block.repeatCounter is not None:
288+
block.repeatCounter -= 1
289+
287290
# If there are blocks, get them
288291
if inputs["SUBSTACK"][1]:
289292
# No blocks will be flagged as ran inside a forever loop
@@ -300,8 +303,6 @@ def execute(block, s, keys=[]):
300303
nb = s.target.blocks[nb.next]
301304
block.substack.add(nb.blockID)
302305
nb.next = block.blockID
303-
if block.repeatCounter is not None:
304-
block.repeatCounter -= 1
305306
return nextBlock
306307

307308
elif opcode == "procedures_call":

0 commit comments

Comments
 (0)