Skip to content

Commit

Permalink
Fix a translation bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Secret-chest committed Mar 10, 2022
1 parent c96a427 commit 646bfb7
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 8 deletions.
2 changes: 1 addition & 1 deletion assets/project.json
Original file line number Diff line number Diff line change
@@ -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"}}
{"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"}}
8 changes: 7 additions & 1 deletion block.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def evaluateBlockValue(self):
except ZeroDivisionError:
raise ZeroDivisionError(_("zero-division-error"))
return self.value
elif self.opcode == "operator_random": # () * ()
elif self.opcode == "operator_random": # pick random from () to ()
decimals1 = len(str(math.modf(float(self.getInputValue("from"))))) - 2
decimals2 = len(str(math.modf(float(self.getInputValue("to"))))) - 2
if decimals1 > decimals2:
Expand All @@ -66,6 +66,12 @@ def evaluateBlockValue(self):
decimals = decimals2
self.value = random.randint(int(self.getInputValue("from")) * 10 ** decimals, int(self.getInputValue("to")) * 10 ** decimals) / 10 ** decimals
return self.value
elif self.opcode == "motion_xposition": # x position
self.value = self.target.x
return self.value
elif self.opcode == "motion_xposition": # y position
self.value = self.target.y
return self.value

# Returns block input value
def getBlockInputValue(self, inputId):
Expand Down
2 changes: 1 addition & 1 deletion config.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

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

# Extract on project run
# Set whether to extract the project assets on run.
Expand Down
4 changes: 2 additions & 2 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
along with this program. If not, see <https://www.gnu.org/licenses/>.
"""

__version__ = "M18 (development version)"
__version__ = "M19 (development version)"
__author__ = "Secret-chest"

import tkinter.simpledialog
Expand Down Expand Up @@ -131,7 +131,7 @@

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

# Extract if requested
Expand Down
Binary file added projects/balloon-simple.sb3
Binary file not shown.
Binary file added projects/balloon-start.sb3
Binary file not shown.
Binary file modified projects/balloon.sb3
Binary file not shown.
Binary file added projects/xy-reporters.sb3
Binary file not shown.
7 changes: 4 additions & 3 deletions scratch.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,13 +277,16 @@ def execute(block, s, keys=[]):
if block.repeatCounter is None:
block.repeatCounter = int(block.getInputValue("times"))
# Don't mark the loop as ran until done, and do a screen refresh
if block.repeatCounter > 0:
if block.repeatCounter > 1:
block.blockRan = False
else:
block.blockRan = True
block.repeatCounter = None
block.screenRefresh = True

if block.repeatCounter is not None:
block.repeatCounter -= 1

# If there are blocks, get them
if inputs["SUBSTACK"][1]:
# No blocks will be flagged as ran inside a forever loop
Expand All @@ -300,8 +303,6 @@ def execute(block, s, keys=[]):
nb = s.target.blocks[nb.next]
block.substack.add(nb.blockID)
nb.next = block.blockID
if block.repeatCounter is not None:
block.repeatCounter -= 1
return nextBlock

elif opcode == "procedures_call":
Expand Down

0 comments on commit 646bfb7

Please sign in to comment.