fix for @oleting
This commit is contained in:
@@ -25,7 +25,7 @@ class Iinstruction(metaclass=ABCMeta):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
def _getblkheight(self) -> float:
|
def _getblkheight(self) -> float:
|
||||||
return cti.get_text_size(self.instruction_text)[1]
|
return cti.get_text_size(self.instruction_text)[1] + 5#padding
|
||||||
|
|
||||||
def _getblkwidth(self) -> float:
|
def _getblkwidth(self) -> float:
|
||||||
return cti.get_text_size(self.instruction_text)[0]+50 #padding
|
return cti.get_text_size(self.instruction_text)[0]+50 #padding
|
||||||
@@ -92,7 +92,7 @@ class if_instruction(Iinstruction):
|
|||||||
return w
|
return w
|
||||||
|
|
||||||
def getblkheight(self) -> float:
|
def getblkheight(self) -> float:
|
||||||
return max(self.get_trueheight(), self.get_falseheight())
|
return self._getblkheight() + max(self.get_trueheight(), self.get_falseheight())
|
||||||
|
|
||||||
def getblkwidth(self) -> float:
|
def getblkwidth(self) -> float:
|
||||||
return max(self._getblkwidth(), self.get_truewidth() + self.get_falsewidth())
|
return max(self._getblkwidth(), self.get_truewidth() + self.get_falsewidth())
|
||||||
@@ -101,7 +101,7 @@ class if_instruction(Iinstruction):
|
|||||||
def to_image(self, x:int, y:int, x_sz: int) -> Iterable[float]:
|
def to_image(self, x:int, y:int, x_sz: int) -> Iterable[float]:
|
||||||
true_w = self.get_truewidth()
|
true_w = self.get_truewidth()
|
||||||
false_w = self.get_falsewidth()
|
false_w = self.get_falsewidth()
|
||||||
true_x, true_y, _, _, false_x, false_y, _, _ = cti.draw_if_statement(
|
true_x, true_y, false_x, false_y = cti.draw_if_statement(
|
||||||
self.instruction_text, x, y, true_w, false_w, self.getblkheight()
|
self.instruction_text, x, y, true_w, false_w, self.getblkheight()
|
||||||
)
|
)
|
||||||
self.draw_true_case(true_x, true_y, true_w)
|
self.draw_true_case(true_x, true_y, true_w)
|
||||||
@@ -130,7 +130,6 @@ class if_instruction(Iinstruction):
|
|||||||
res += "}"
|
res += "}"
|
||||||
return res
|
return res
|
||||||
|
|
||||||
#TODO
|
|
||||||
# class switch_instruction(Iinstruction):
|
# class switch_instruction(Iinstruction):
|
||||||
# """Switch structure"""
|
# """Switch structure"""
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
from os import stat
|
|
||||||
from interpreter.interpret_source import Function_scope
|
|
||||||
from typing import Dict, List, Optional
|
from typing import Dict, List, Optional
|
||||||
from PySimpleGUI import one_line_progress_meter
|
from PySimpleGUI import one_line_progress_meter
|
||||||
import logging
|
import logging
|
||||||
@@ -8,6 +6,7 @@ import os.path
|
|||||||
import secrets
|
import secrets
|
||||||
|
|
||||||
from interpreter.interpret_source import JavaInterpreter
|
from interpreter.interpret_source import JavaInterpreter
|
||||||
|
from interpreter.function_scope import Function_scope
|
||||||
from draw.code_to_image_wrapper import NSD_writer
|
from draw.code_to_image_wrapper import NSD_writer
|
||||||
import draw.code_to_image as cti
|
import draw.code_to_image as cti
|
||||||
|
|
||||||
@@ -50,7 +49,7 @@ class NassiShneidermanDiagram:
|
|||||||
return filepath
|
return filepath
|
||||||
else:
|
else:
|
||||||
while os.path.exists(filepath+".png"):
|
while os.path.exists(filepath+".png"):
|
||||||
filepath = filepath + str(secrets.token_hex(1))
|
filepath += str(secrets.token_hex(1))
|
||||||
return filepath
|
return filepath
|
||||||
return filepath
|
return filepath
|
||||||
|
|
||||||
|
|||||||
@@ -329,7 +329,10 @@
|
|||||||
// final int value;
|
// final int value;
|
||||||
// };
|
// };
|
||||||
// }
|
// }
|
||||||
public void test_function() {
|
|
||||||
|
class Testing {
|
||||||
|
|
||||||
|
public void test_function() {
|
||||||
int rot = getRotation();
|
int rot = getRotation();
|
||||||
|
|
||||||
if (richtung=="vorne" && rot==0 || richtung=="rechts" && rot==270 || richtung=="links" && rot==90)
|
if (richtung=="vorne" && rot==0 || richtung=="rechts" && rot==270 || richtung=="links" && rot==90)
|
||||||
@@ -348,28 +351,30 @@ public void test_function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (richtung=="vorne" && rot==90 || richtung=="rechts" && rot==0 || richtung=="links" && rot==180)
|
// if (richtung=="vorne" && rot==90 || richtung=="rechts" && rot==0 || richtung=="links" && rot==180)
|
||||||
{
|
// {
|
||||||
if(getOneObjectAtOffset(0,1,Huegel.class)!=null && ((Huegel)getOneObjectAtOffset(0,1,Huegel.class)).getSteigung() >30)
|
// if(getOneObjectAtOffset(0,1,Huegel.class)!=null && ((Huegel)getOneObjectAtOffset(0,1,Huegel.class)).getSteigung() >30)
|
||||||
{
|
// {
|
||||||
return true;
|
// return true;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// }
|
||||||
|
|
||||||
|
// if (richtung=="vorne" && rot==270 || richtung=="rechts" && rot==180 || richtung=="links" && rot==0)
|
||||||
|
// {
|
||||||
|
// if(getOneObjectAtOffset(0,-1,Huegel.class)!=null && ((Huegel)getOneObjectAtOffset(0,-1,Huegel.class)).getSteigung() >30)
|
||||||
|
// {
|
||||||
|
// return true;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// }
|
||||||
|
|
||||||
|
// if(richtung!="vorne" && richtung!="links" && richtung!="rechts")
|
||||||
|
// {
|
||||||
|
// nachricht("Befehl nicht korrekt!");
|
||||||
|
// }
|
||||||
|
|
||||||
|
// return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if (richtung=="vorne" && rot==270 || richtung=="rechts" && rot==180 || richtung=="links" && rot==0)
|
|
||||||
{
|
|
||||||
if(getOneObjectAtOffset(0,-1,Huegel.class)!=null && ((Huegel)getOneObjectAtOffset(0,-1,Huegel.class)).getSteigung() >30)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if(richtung!="vorne" && richtung!="links" && richtung!="rechts")
|
|
||||||
{
|
|
||||||
nachricht("Befehl nicht korrekt!");
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user