diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..9994ca0e66aaa0bb4892cb86ca755b83135f8ebd --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +.DS_Store +applet +application.linux32 +application.linux64 +application.windows32 +application.windows64 +application.macosx \ No newline at end of file diff --git a/NiloProject.pde b/NiloProject.pde deleted file mode 100644 index 2617da4293ad4bc7d34040b0252b1b5b7339bd2a..0000000000000000000000000000000000000000 --- a/NiloProject.pde +++ /dev/null @@ -1,43 +0,0 @@ -//NiloProject Versao alpha 0.3 - -//by Faruk Hammoud, Escola Politecnica da Universidade de Sao Paulo, 2017. - - -PImage poli; -PImage calatrava; -PImage pizza; - -import camera3D.*; -import camera3D.generators.*; -import camera3D.generators.util.*; -import processing.net.*; - - - - - -//DEFINES -int MAP_MAX = 1000; - -//Funções Anexas -void Definicoes() { - - TAREFAS.AlteraTarefaCodigo("Exemplo", "MOUSEPRESSED"); - TAREFAS.AlteraTarefaLetra("Exemplo", 'd'); - TAREFAS.Tarefa("Ativa Frame Base"); - noCursor(); -} - -//Funções Main -void setup() { - fullScreen(P3D); - poli = loadImage("poli.png"); - calatrava = loadImage("calatrava.jpg"); - pizza = loadImage("pizza.png"); - Definicoes(); -} -void draw() { - FRAMES.Mostrar(); - lights(); - directionalLight(0, 255, 0, 0, -1, 0); -} \ No newline at end of file diff --git a/NiloProject.pyde b/NiloProject.pyde new file mode 100644 index 0000000000000000000000000000000000000000..1cf1e0f30e632630ca4e957658c82843ee1c94c4 --- /dev/null +++ b/NiloProject.pyde @@ -0,0 +1,142 @@ + +#-------------------------------------------------------------------------------# +# Ola, # +# Eu sou Faruk, e esse eh o codigo do NiloProject # +# Uma IDE interativa para Python # +# # +#-------------------------------------------------------------------------------# +# Versao: a0.6 (12/12/2018) . Por Faruk Hammoud, 2018. # +# Compilado em Processing 3.4 (by Processing Foundation) - Python Mode # +# Distribuicao Livre # +# Suporte 24/7 : faruk.hammoud@usp.br # +#-------------------------------------------------------------------------------# + +add_library('serial') +add_library('arduino') +add_library('udp') + + +from sys_index import * +from sys_interface import * +ARDUINO_INICIALIZADO = False +udp = 0 +control_ultimo = False + +try: + #ard = Arduino(this, Arduino.list()[0], 57600) + print(".ARDUINO INICIALIZADO.") + #ARDUINO_INICIALIZADO = True +except BaseException as erro: + print(erro) +def setup(): + #print(Data().rvgSample('data/lua/rvgs/cubic1.rvg',150,150)) + font = loadFont("Menlo-Regular-20.vlw"); + textFont(font, 20); + udp = UDP(6000) + udp.listen(True) + delay(1000) + + fullScreen() + frameRate(20)#Manter isso aqui(diminuir pra 5 em caso de MAX CPU) + if ARDUINO_INICIALIZADO: + ARDUINO.inicializa(ard) + Data().obtemPacotes() + Data().importaCodigo('/meta_data/nilo_code.nlo') + + Tarefas().alteraTarefaCodigo('Processa Scroll Up','SCROLLUP') + Tarefas().alteraTarefaCodigo('Processa Scroll Down','SCROLLDOWN') + Tarefas().alteraTarefaCodigo('Processa MouseDragged','MOUSEDRAGGED') + Tarefas().alteraTarefaCodigo('Processa MouseClicked','MOUSECLICKED') + Tarefas().alteraTarefaCodigo('Processa MouseDoubleClicked','MOUSEDOUBLECLICKED') + Tarefas().alteraTarefaCodigo('Processa MousePressed','MOUSEPRESSED') + Tarefas().alteraTarefaCodigo('Processa MouseReleased','MOUSERELEASED') + Tarefas().alteraTarefaCodigo('Processa Esquerda','LEFT') + Tarefas().alteraTarefaCodigo('Processa Cima','UP') + Tarefas().alteraTarefaCodigo('Processa Direita','RIGHT') + Tarefas().alteraTarefaCodigo('Processa Baixo','DOWNS') + Tarefas().alteraTarefaCodigo('Processa Enter','ENTER') + Tarefas().alteraTarefaCodigo('Ativa Selecao Refletida','CTRL') + Tarefas().alteraTarefaCodigo('Tabula','TAB') + Tarefas().alteraTarefaCodigo('Copia','CTRL-C') + Tarefas().alteraTarefaCodigo('Corta','CTRL-X') + Tarefas().alteraTarefaCodigo('Cola','CTRL-V') +def draw(): + Frames().mostrar() + Thread(target=Interpretador().interpreta()) + INTERFACE.reset() +def keyPressed(): + INTERFACE.actTempoTecla() + global control_ultimo + if control_ultimo: + if keyCode == 88: + Tarefas().tarefaCodigo('CTRL-X') + if keyCode == 67: + Tarefas().tarefaCodigo('CTRL-C') + if keyCode == 86: + Tarefas().tarefaCodigo('CTRL-V') + if keyCode == CONTROL: + Tarefas().tarefaCodigo('CTRL') + control_ultimo = False + elif keyCode == CONTROL: + control_ultimo = True + else: + if keyCode == 9: + Tarefas().tarefaCodigo('TAB') + elif keyCode == 40: + Tarefas().tarefaCodigo('DOWNS') + INTERFACE.algo_aconteceu = True + elif keyCode == 37: + Tarefas().tarefaCodigo('LEFT') + elif keyCode == 39: + Tarefas().tarefaCodigo('RIGHT') + elif keyCode == 38: + Tarefas().tarefaCodigo('UP') + INTERFACE.algo_aconteceu = True + elif keyCode == 10: + Tarefas().tarefaCodigo('ENTER') + INTERFACE.algo_aconteceu = True + elif keyCode == 27: + Tarefas().tarefaCodigo('ESC') + elif keyCode >= 32 and keyCode <= 125 or keyCode == 222 : + Tarefas().tarefaLetra(key) + n = - len(INTERFACE.tmp_text) + x = - tamanhoTexto(INTERFACE.tmp_text) + INTERFACE.tmp_text = Interpretador().normaliza(INTERFACE.tmp_text[0:INTERFACE.cursor_letra] +str(key)+ INTERFACE.tmp_text[INTERFACE.cursor_letra:]) + n += len(INTERFACE.tmp_text) + x += tamanhoTexto(INTERFACE.tmp_text) + INTERFACE.cursor_letra+=n + INTERFACE.cursor_x += x + if key==DELETE: + INTERFACE.delete() + if key==BACKSPACE: + INTERFACE.backspace() + else:INTERFACE.palavrasChave() +def keyReleased(): + Tarefas().tarefa('Desativa Selecao Refletida') +def mousePressed(): + INTERFACE.algo_aconteceu = True + Tarefas().tarefaCodigo('MOUSEPRESSED') +def mouseReleased(): + Tarefas().tarefaCodigo('MOUSERELEASED') +def mouseDragged(): + INTERFACE.algo_aconteceu = True + Tarefas().tarefaCodigo('MOUSEDRAGGED') +def mouseClicked(evt): + INTERFACE.algo_aconteceu = True + n = evt.getCount() + INTERFACE.mouse_lado = mouseButton + if n == 1: + Tarefas().tarefaCodigo('MOUSECLICKED') + else: + Tarefas().tarefaCodigo('MOUSEDOUBLECLICKED') +def mouseWheel(event): + e = event.getCount() + if e>0: + Tarefas().tarefaCodigo('SCROLLUP') + else: + Tarefas().tarefaCodigo('SCROLLDOWN') + pass +def receive(data,ip,port): + data = subset(data,0,len(data)-2) + LUVA.data = str(data) + println(Luva.data) diff --git a/data/AAR120NF.WHL b/data/AAR120NF.WHL new file mode 100644 index 0000000000000000000000000000000000000000..e59f6d7e6a19de7ed6d4ede2418ad61f5a1a8537 --- /dev/null +++ b/data/AAR120NF.WHL @@ -0,0 +1,871 @@ +AAR 1:20 Narrow Flange, Wheel reference profile. +Made by Christian Hauch, 4-11-97, from +draving supplied by AAR. + +0.00 -30.44 +0.00 -30.19 +0.00 -29.94 +0.00 -29.69 +0.00 -29.44 +0.00 -29.19 +0.00 -28.94 +0.00 -28.69 +0.00 -28.44 +0.00 -28.19 +0.00 -27.94 +0.00 -27.69 +0.00 -27.44 +0.00 -27.19 +0.00 -26.94 +0.00 -26.69 +0.00 -26.44 +0.00 -26.19 +0.00 -25.94 +0.00 -25.69 +0.00 -25.44 +0.00 -25.19 +0.00 -24.94 +0.00 -24.69 +0.00 -24.44 +0.00 -24.19 +0.00 -23.94 +0.00 -23.69 +0.00 -23.44 +0.00 -23.19 +0.00 -22.94 +0.00 -22.69 +0.00 -22.44 +0.00 -22.19 +0.00 -21.94 +0.00 -21.69 +0.00 -21.44 +0.00 -21.19 +0.00 -20.94 +0.00 -20.69 +0.00 -20.44 +0.00 -20.19 +0.00 -19.94 +0.00 -19.69 +0.00 -19.44 +0.00 -19.19 +0.00 -18.94 +0.00 -18.69 +0.00 -18.44 +0.00 -18.19 +0.00 -17.94 +0.00 -17.69 +0.00 -17.44 +0.00 -17.19 +0.00 -16.94 +0.00 -16.69 +0.00 -16.44 +0.00 -16.19 +0.00 -15.94 +0.00 -15.69 +0.00 -15.44 +0.00 -15.19 +0.00 -14.94 +0.00 -14.69 +0.00 -14.44 +0.00 -14.19 +0.00 -13.94 +0.00 -13.69 +0.00 -13.44 +0.00 -13.19 +0.00 -12.94 +0.00 -12.69 +0.00 -12.44 +0.00 -12.19 +0.00 -11.94 +0.00 -11.69 +0.00 -11.44 +0.00 -11.19 +0.00 -10.94 +0.00 -10.69 +0.00 -10.44 +0.00 -10.19 +0.00 -9.94 +0.00 -9.69 +0.00 -9.44 +0.00 -9.19 +0.00 -8.94 +0.00 -8.69 +0.00 -8.44 +0.00 -8.19 +0.00 -7.94 +0.00 -7.69 +0.00 -7.44 +0.00 -7.19 +0.00 -6.94 +0.00 -6.69 +0.00 -6.44 +0.00 -6.19 +0.00 -5.94 +0.00 -5.69 +0.00 -5.44 +0.00 -5.19 +0.00 -4.94 +0.00 -4.69 +0.00 -4.44 +0.00 -4.19 +0.00 -3.94 +0.00 -3.69 +0.00 -3.44 +0.00 -3.19 +0.00 -2.94 +0.00 -2.69 +0.00 -2.44 +0.00 -2.19 +0.00 -1.94 +0.00 -1.69 +0.00 -1.44 +0.00 -1.19 +0.00 -0.94 +0.00 -0.69 +0.00 -0.44 +0.00 -0.19 +0.00 0.06 +0.00 0.31 +0.00 0.56 +0.00 0.81 +0.00 1.06 +0.00 1.31 +0.00 1.56 +0.00 1.81 +0.00 2.06 +0.00 2.31 +0.00 2.56 +0.00 2.81 +0.00 3.06 +0.00 3.31 +0.00 3.56 +0.00 3.81 +0.00 4.06 +0.00 4.31 +0.00 4.56 +0.00 4.81 +0.00 5.06 +0.00 5.31 +0.00 5.56 +0.00 5.81 +0.00 6.06 +0.00 6.31 +0.00 6.56 +0.01 6.81 +0.03 7.05 +0.05 7.30 +0.08 7.55 +0.11 7.80 +0.14 8.05 +0.17 8.30 +0.20 8.54 +0.24 8.79 +0.27 9.04 +0.31 9.29 +0.35 9.53 +0.39 9.78 +0.44 10.03 +0.48 10.27 +0.53 10.52 +0.58 10.76 +0.63 11.01 +0.68 11.25 +0.74 11.50 +0.79 11.74 +0.85 11.98 +0.91 12.23 +0.97 12.47 +1.03 12.71 +1.10 12.95 +1.16 13.19 +1.23 13.43 +1.30 13.67 +1.37 13.91 +1.45 14.15 +1.52 14.39 +1.60 14.63 +1.68 14.87 +1.76 15.10 +1.84 15.34 +1.92 15.57 +2.01 15.81 +2.09 16.04 +2.18 16.28 +2.27 16.51 +2.36 16.74 +2.46 16.98 +2.55 17.21 +2.65 17.44 +2.75 17.67 +2.85 17.90 +2.95 18.12 +3.05 18.35 +3.16 18.58 +3.27 18.80 +3.38 19.02 +3.50 19.25 +3.62 19.46 +3.75 19.68 +3.87 19.90 +4.01 20.11 +4.14 20.32 +4.28 20.53 +4.42 20.74 +4.56 20.94 +4.71 21.14 +4.86 21.34 +5.01 21.54 +5.17 21.73 +5.33 21.93 +5.49 22.12 +5.66 22.30 +5.83 22.49 +6.00 22.67 +6.17 22.85 +6.35 23.03 +6.53 23.20 +6.71 23.37 +6.90 23.54 +7.09 23.70 +7.28 23.86 +7.47 24.02 +7.66 24.18 +7.86 24.33 +8.06 24.48 +8.27 24.63 +8.47 24.77 +8.68 24.91 +8.89 25.05 +9.10 25.18 +9.31 25.31 +9.53 25.44 +9.74 25.56 +9.96 25.68 +10.19 25.80 +10.41 25.91 +10.63 26.02 +10.86 26.13 +11.09 26.23 +11.32 26.33 +11.55 26.42 +11.78 26.51 +12.02 26.60 +12.25 26.68 +12.49 26.76 +12.73 26.84 +12.97 26.91 +13.21 26.98 +13.45 27.05 +13.69 27.11 +13.93 27.17 +14.18 27.22 +14.42 27.27 +14.67 27.32 +14.91 27.36 +15.16 27.40 +15.41 27.43 +15.66 27.46 +15.91 27.48 +16.15 27.46 +16.40 27.44 +16.65 27.41 +16.90 27.37 +17.15 27.34 +17.39 27.30 +17.64 27.25 +17.88 27.20 +18.13 27.15 +18.37 27.09 +18.62 27.03 +18.86 26.97 +19.10 26.90 +19.34 26.83 +19.58 26.76 +19.81 26.68 +20.05 26.59 +20.28 26.51 +20.52 26.42 +20.75 26.32 +20.98 26.23 +21.21 26.13 +21.43 26.02 +21.66 25.91 +21.88 25.80 +22.11 25.69 +22.33 25.57 +22.54 25.45 +22.76 25.32 +22.97 25.19 +23.19 25.06 +23.40 24.92 +23.60 24.79 +23.81 24.64 +24.01 24.50 +24.21 24.35 +24.41 24.20 +24.61 24.04 +24.80 23.89 +24.99 23.72 +25.18 23.56 +25.37 23.39 +25.55 23.22 +25.73 23.05 +25.91 22.88 +26.09 22.70 +26.26 22.52 +26.43 22.33 +26.60 22.15 +26.76 21.96 +26.92 21.77 +27.08 21.57 +27.23 21.38 +27.39 21.18 +27.53 20.98 +27.68 20.77 +27.82 20.57 +27.96 20.36 +28.09 20.15 +28.23 19.94 +28.36 19.72 +28.48 19.51 +28.60 19.29 +28.72 19.07 +28.84 18.85 +28.95 18.62 +29.06 18.40 +29.16 18.17 +29.26 17.94 +29.36 17.71 +29.46 17.48 +29.55 17.25 +29.65 17.02 +29.74 16.79 +29.83 16.55 +29.93 16.32 +30.02 16.09 +30.11 15.86 +30.19 15.62 +30.28 15.39 +30.36 15.15 +30.45 14.92 +30.53 14.68 +30.61 14.44 +30.69 14.21 +30.77 13.97 +30.85 13.73 +30.93 13.49 +31.00 13.26 +31.08 13.02 +31.16 12.78 +31.25 12.55 +31.33 12.31 +31.43 12.08 +31.52 11.85 +31.62 11.62 +31.72 11.39 +31.83 11.16 +31.93 10.94 +32.05 10.71 +32.16 10.49 +32.28 10.27 +32.40 10.05 +32.52 9.84 +32.65 9.62 +32.78 9.41 +32.91 9.20 +33.05 8.99 +33.19 8.78 +33.33 8.57 +33.48 8.37 +33.62 8.17 +33.77 7.97 +33.93 7.77 +34.08 7.58 +34.24 7.38 +34.41 7.19 +34.57 7.00 +34.74 6.82 +34.91 6.64 +35.08 6.45 +35.26 6.28 +35.43 6.10 +35.61 5.93 +35.80 5.76 +35.98 5.59 +36.17 5.42 +36.36 5.26 +36.55 5.10 +36.75 4.94 +36.94 4.79 +37.14 4.64 +37.34 4.49 +37.55 4.34 +37.75 4.20 +37.96 4.06 +38.17 3.92 +38.38 3.79 +38.59 3.66 +38.81 3.53 +39.02 3.41 +39.24 3.29 +39.46 3.17 +39.68 3.05 +39.91 2.94 +40.13 2.83 +40.36 2.72 +40.59 2.62 +40.82 2.52 +41.05 2.43 +41.28 2.33 +41.51 2.25 +41.75 2.16 +41.98 2.08 +42.22 2.00 +42.46 1.92 +42.70 1.85 +42.94 1.78 +43.18 1.72 +43.42 1.65 +43.66 1.60 +43.91 1.54 +44.15 1.49 +44.40 1.44 +44.64 1.40 +44.89 1.36 +45.14 1.32 +45.39 1.28 +45.63 1.25 +45.88 1.23 +46.13 1.20 +46.38 1.18 +46.63 1.17 +46.88 1.16 +47.13 1.14 +47.38 1.13 +47.63 1.12 +47.88 1.11 +48.13 1.09 +48.38 1.08 +48.63 1.07 +48.88 1.06 +49.13 1.04 +49.38 1.03 +49.63 1.02 +49.88 1.01 +50.13 0.99 +50.38 0.98 +50.63 0.97 +50.87 0.96 +51.12 0.94 +51.37 0.93 +51.62 0.92 +51.87 0.91 +52.12 0.89 +52.37 0.88 +52.62 0.87 +52.87 0.86 +53.12 0.84 +53.37 0.83 +53.62 0.82 +53.87 0.81 +54.12 0.79 +54.37 0.78 +54.62 0.77 +54.87 0.76 +55.12 0.74 +55.37 0.73 +55.62 0.72 +55.87 0.71 +56.12 0.69 +56.37 0.68 +56.62 0.67 +56.87 0.66 +57.12 0.64 +57.37 0.63 +57.62 0.62 +57.87 0.61 +58.12 0.59 +58.37 0.58 +58.62 0.57 +58.86 0.56 +59.11 0.54 +59.36 0.53 +59.61 0.52 +59.86 0.51 +60.11 0.49 +60.36 0.48 +60.61 0.47 +60.86 0.46 +61.11 0.44 +61.36 0.43 +61.61 0.42 +61.86 0.41 +62.11 0.39 +62.36 0.38 +62.61 0.37 +62.86 0.36 +63.11 0.34 +63.36 0.33 +63.61 0.32 +63.86 0.31 +64.11 0.29 +64.36 0.28 +64.61 0.27 +64.86 0.26 +65.11 0.24 +65.36 0.23 +65.61 0.22 +65.86 0.21 +66.11 0.19 +66.36 0.18 +66.61 0.17 +66.85 0.16 +67.10 0.14 +67.35 0.13 +67.60 0.12 +67.85 0.11 +68.10 0.09 +68.35 0.08 +68.60 0.07 +68.85 0.06 +69.10 0.04 +69.35 0.03 +69.60 0.02 +69.85 0.01 +70.10 -0.01 +70.35 -0.02 +70.60 -0.03 +70.85 -0.04 +71.10 -0.05 +71.35 -0.07 +71.60 -0.08 +71.85 -0.09 +72.10 -0.10 +72.35 -0.12 +72.60 -0.13 +72.85 -0.14 +73.10 -0.15 +73.35 -0.17 +73.60 -0.18 +73.85 -0.19 +74.10 -0.20 +74.35 -0.22 +74.60 -0.23 +74.84 -0.24 +75.09 -0.25 +75.34 -0.27 +75.59 -0.28 +75.84 -0.29 +76.09 -0.30 +76.34 -0.32 +76.59 -0.33 +76.84 -0.34 +77.09 -0.35 +77.34 -0.37 +77.59 -0.38 +77.84 -0.39 +78.09 -0.40 +78.34 -0.42 +78.59 -0.43 +78.84 -0.44 +79.09 -0.45 +79.34 -0.47 +79.59 -0.48 +79.84 -0.49 +80.09 -0.50 +80.34 -0.52 +80.59 -0.53 +80.84 -0.54 +81.09 -0.55 +81.34 -0.57 +81.59 -0.58 +81.84 -0.59 +82.09 -0.60 +82.34 -0.62 +82.59 -0.63 +82.83 -0.64 +83.08 -0.65 +83.33 -0.67 +83.58 -0.68 +83.83 -0.69 +84.08 -0.70 +84.33 -0.72 +84.58 -0.73 +84.83 -0.74 +85.08 -0.75 +85.33 -0.77 +85.58 -0.78 +85.83 -0.79 +86.08 -0.80 +86.33 -0.82 +86.58 -0.83 +86.83 -0.84 +87.08 -0.85 +87.33 -0.87 +87.58 -0.88 +87.83 -0.89 +88.08 -0.90 +88.33 -0.92 +88.58 -0.93 +88.83 -0.94 +89.08 -0.95 +89.33 -0.97 +89.58 -0.98 +89.83 -0.99 +90.08 -1.00 +90.33 -1.02 +90.58 -1.03 +90.82 -1.04 +91.07 -1.05 +91.32 -1.07 +91.57 -1.08 +91.82 -1.09 +92.07 -1.10 +92.32 -1.12 +92.57 -1.13 +92.82 -1.14 +93.07 -1.15 +93.32 -1.17 +93.57 -1.18 +93.82 -1.19 +94.07 -1.20 +94.32 -1.22 +94.57 -1.23 +94.82 -1.24 +95.07 -1.25 +95.32 -1.27 +95.57 -1.28 +95.82 -1.29 +96.07 -1.30 +96.32 -1.32 +96.57 -1.33 +96.82 -1.34 +97.07 -1.35 +97.32 -1.37 +97.57 -1.38 +97.82 -1.39 +98.07 -1.40 +98.32 -1.42 +98.57 -1.43 +98.82 -1.44 +99.06 -1.45 +99.31 -1.47 +99.56 -1.48 +99.81 -1.49 +100.06 -1.50 +100.31 -1.52 +100.56 -1.53 +100.81 -1.54 +101.06 -1.55 +101.31 -1.57 +101.56 -1.58 +101.81 -1.59 +102.06 -1.60 +102.31 -1.62 +102.56 -1.63 +102.81 -1.64 +103.06 -1.65 +103.31 -1.67 +103.56 -1.68 +103.81 -1.69 +104.06 -1.70 +104.31 -1.72 +104.56 -1.73 +104.81 -1.74 +105.06 -1.75 +105.31 -1.77 +105.56 -1.78 +105.81 -1.79 +106.06 -1.80 +106.31 -1.82 +106.56 -1.83 +106.81 -1.84 +107.05 -1.85 +107.30 -1.87 +107.55 -1.88 +107.80 -1.89 +108.05 -1.90 +108.30 -1.92 +108.55 -1.93 +108.80 -1.94 +109.05 -1.95 +109.30 -1.97 +109.55 -1.98 +109.80 -1.99 +110.05 -2.00 +110.30 -2.02 +110.55 -2.03 +110.80 -2.04 +111.05 -2.05 +111.30 -2.06 +111.55 -2.08 +111.80 -2.09 +112.05 -2.10 +112.30 -2.11 +112.55 -2.13 +112.80 -2.14 +113.05 -2.15 +113.30 -2.16 +113.55 -2.18 +113.80 -2.19 +114.05 -2.20 +114.30 -2.21 +114.55 -2.23 +114.80 -2.24 +115.04 -2.25 +115.29 -2.26 +115.54 -2.28 +115.79 -2.29 +116.04 -2.30 +116.29 -2.31 +116.54 -2.33 +116.79 -2.34 +117.04 -2.35 +117.29 -2.36 +117.54 -2.38 +117.79 -2.39 +118.04 -2.40 +118.29 -2.41 +118.54 -2.43 +118.79 -2.44 +119.04 -2.45 +119.29 -2.46 +119.54 -2.48 +119.79 -2.49 +120.04 -2.50 +120.29 -2.51 +120.54 -2.53 +120.79 -2.54 +121.04 -2.55 +121.29 -2.56 +121.54 -2.58 +121.79 -2.59 +122.04 -2.60 +122.29 -2.61 +122.54 -2.63 +122.79 -2.64 +123.03 -2.65 +123.28 -2.66 +123.53 -2.68 +123.78 -2.69 +124.03 -2.70 +124.28 -2.71 +124.53 -2.73 +124.78 -2.74 +125.03 -2.75 +125.28 -2.76 +125.53 -2.78 +125.78 -2.79 +126.03 -2.80 +126.28 -2.81 +126.53 -2.83 +126.78 -2.84 +127.03 -2.85 +127.28 -2.86 +127.53 -2.88 +127.78 -2.89 +128.03 -2.90 +128.28 -2.91 +128.53 -2.93 +128.78 -2.94 +129.03 -2.95 +129.28 -2.96 +129.53 -2.98 +129.78 -2.99 +130.03 -3.00 +130.28 -3.02 +130.52 -3.03 +130.77 -3.06 +131.02 -3.08 +131.27 -3.11 +131.52 -3.14 +131.77 -3.18 +132.01 -3.22 +132.26 -3.27 +132.50 -3.32 +132.75 -3.37 +132.99 -3.43 +133.23 -3.49 +133.48 -3.55 +133.72 -3.62 +133.96 -3.69 +134.19 -3.77 +134.43 -3.85 +134.67 -3.93 +134.90 -4.02 +135.13 -4.11 +135.37 -4.20 +135.60 -4.30 +135.82 -4.40 +136.05 -4.51 +136.28 -4.62 +136.50 -4.73 +136.72 -4.84 +136.94 -4.96 +137.16 -5.09 +137.37 -5.21 +137.59 -5.34 +137.80 -5.47 +138.01 -5.61 +138.22 -5.75 +138.42 -5.89 +138.63 -6.04 +138.83 -6.19 +139.02 -6.34 +139.22 -6.49 +139.41 -6.65 +139.61 -6.81 +139.79 -6.98 +139.98 -7.14 +140.16 -7.32 +140.34 -7.49 +140.52 -7.66 +140.70 -7.84 +140.87 -8.02 +141.04 -8.21 +141.20 -8.39 +141.37 -8.58 +141.53 -8.78 +141.68 -8.97 +141.84 -9.17 +141.99 -9.37 +142.14 -9.57 +142.28 -9.77 +142.42 -9.98 +142.56 -10.19 +142.70 -10.40 +142.83 -10.61 +142.96 -10.82 +143.08 -11.04 +143.20 -11.26 +143.32 -11.48 +143.43 -11.70 +143.55 -11.93 +143.65 -12.15 +143.76 -12.38 +143.86 -12.61 +143.95 -12.84 +144.05 -13.07 +144.14 -13.30 +144.22 -13.54 +144.30 -13.78 +144.38 -14.01 +144.46 -14.25 +144.53 -14.49 +144.59 -14.73 +144.66 -14.97 +144.72 -15.22 +144.77 -15.46 +144.82 -15.71 +144.87 -15.95 +144.91 -16.20 +144.95 -16.44 +144.99 -16.69 +145.02 -16.94 +145.05 -17.19 +145.07 -17.44 +145.10 -17.69 +145.11 -17.93 +145.12 -18.18 +145.13 -18.43 +145.14 -18.68 diff --git a/data/Consolas-48.vlw b/data/Consolas-48.vlw new file mode 100644 index 0000000000000000000000000000000000000000..0a158fe272f472625e7ea064a0036d8d09b6fde5 Binary files /dev/null and b/data/Consolas-48.vlw differ diff --git a/data/CourierStd-Bold-48.vlw b/data/CourierStd-Bold-48.vlw new file mode 100644 index 0000000000000000000000000000000000000000..d143f2471c7847f44de175a10bd7d1cf656883f5 Binary files /dev/null and b/data/CourierStd-Bold-48.vlw differ diff --git a/data/Menlo-Bold-12.vlw b/data/Menlo-Bold-12.vlw new file mode 100644 index 0000000000000000000000000000000000000000..a919ef9554bc1d926787225e76bc6785c2454c0f Binary files /dev/null and b/data/Menlo-Bold-12.vlw differ diff --git a/data/Menlo-Regular-20.vlw b/data/Menlo-Regular-20.vlw new file mode 100644 index 0000000000000000000000000000000000000000..6317c994bd3a892d09a7a7fc5f27004c7436d432 Binary files /dev/null and b/data/Menlo-Regular-20.vlw differ diff --git a/data/Menlo-Regular-48.vlw b/data/Menlo-Regular-48.vlw new file mode 100644 index 0000000000000000000000000000000000000000..bdd6ba9c3df062af9a8ed789d05f0a13bb42e766 Binary files /dev/null and b/data/Menlo-Regular-48.vlw differ diff --git a/data/Monospace821BT-Roman-48.vlw b/data/Monospace821BT-Roman-48.vlw new file mode 100644 index 0000000000000000000000000000000000000000..0a5e48e6b77d09aec16f5ef3d9bc94a7b92b8aa2 Binary files /dev/null and b/data/Monospace821BT-Roman-48.vlw differ diff --git a/data/Monospaced.bold-60.vlw b/data/Monospaced.bold-60.vlw new file mode 100644 index 0000000000000000000000000000000000000000..e11095b45c3779abb4e51f23e4bea69215720ba0 Binary files /dev/null and b/data/Monospaced.bold-60.vlw differ diff --git a/data/Monospaced.plain-20.vlw b/data/Monospaced.plain-20.vlw new file mode 100644 index 0000000000000000000000000000000000000000..9cc82b0d7df556df98f2726c23e53a36278272b4 Binary files /dev/null and b/data/Monospaced.plain-20.vlw differ diff --git a/data/Monospaced.plain-60.vlw b/data/Monospaced.plain-60.vlw new file mode 100644 index 0000000000000000000000000000000000000000..132958548d342129e2b9b310e840b5bb19680c21 Binary files /dev/null and b/data/Monospaced.plain-60.vlw differ diff --git a/data/__init__$py.class b/data/__init__$py.class new file mode 100644 index 0000000000000000000000000000000000000000..9983f872bff31d4b3a1110710d32363f9fdde8ef Binary files /dev/null and b/data/__init__$py.class differ diff --git a/pkg_JupiterPro.pde b/data/__init__.py similarity index 100% rename from pkg_JupiterPro.pde rename to data/__init__.py diff --git a/data/calatrava.jpg b/data/calatrava.jpg deleted file mode 100644 index 4669ed8ffb19edff825dad5610848b43694ae348..0000000000000000000000000000000000000000 Binary files a/data/calatrava.jpg and /dev/null differ diff --git a/data/images/add.png b/data/images/add.png new file mode 100644 index 0000000000000000000000000000000000000000..35d98b14ab38c0c053075f4529188a95d42642b9 Binary files /dev/null and b/data/images/add.png differ diff --git a/data/images/file.png b/data/images/file.png new file mode 100644 index 0000000000000000000000000000000000000000..7336ea43982dbb696d840c1b962aeb77f3f562ed Binary files /dev/null and b/data/images/file.png differ diff --git a/data/images/folder.png b/data/images/folder.png new file mode 100644 index 0000000000000000000000000000000000000000..ca36a0e4e8e9b8f0a395ce18d3934d9320aef8a3 Binary files /dev/null and b/data/images/folder.png differ diff --git a/data/images/logo.png b/data/images/logo.png new file mode 100644 index 0000000000000000000000000000000000000000..2f347d2651a7355073f962f7c65cc2d6529916c7 Binary files /dev/null and b/data/images/logo.png differ diff --git a/data/images/objects.png b/data/images/objects.png new file mode 100644 index 0000000000000000000000000000000000000000..44ba1cf86b1fa0e99c2a69442bd5f0aba4ccd871 Binary files /dev/null and b/data/images/objects.png differ diff --git a/data/meta_data/default_code.nlo b/data/meta_data/default_code.nlo new file mode 100644 index 0000000000000000000000000000000000000000..0b69113c1b2a8e049580abe9ba93c1919f8c5420 --- /dev/null +++ b/data/meta_data/default_code.nlo @@ -0,0 +1,3 @@ +file_name = '' +# Welcome to the NiloProject, a0.5 +# by Faruk Hammoud, 2018 \ No newline at end of file diff --git a/data/meta_data/nilo_code.nlo b/data/meta_data/nilo_code.nlo new file mode 100644 index 0000000000000000000000000000000000000000..0dd048403e2e59c75893eeacc0c8c54020b27044 --- /dev/null +++ b/data/meta_data/nilo_code.nlo @@ -0,0 +1,10 @@ +file_name = '' +# Welcome to the NiloProject, a0.5 +# by Faruk Hammoud, 2018 +x = Bar( 0 , 10 , 0 ) +y = Bar( 0 , 10 , 3.0 ) +z = Function('x,y','x*x+y*y') +Show ( 'z' , 'z is' ) +if z > 5: + fill(Color('orange'),150) + ellipse(mouseX,mouseY,50,50) diff --git a/data/meta_data/packages.inf b/data/meta_data/packages.inf new file mode 100644 index 0000000000000000000000000000000000000000..ea74c6a4e41728520d5884935aa8238f72e01c09 --- /dev/null +++ b/data/meta_data/packages.inf @@ -0,0 +1,2 @@ +<pkg>pkg_nativo</pkg> + diff --git a/data/meta_data/python_code.nlo b/data/meta_data/python_code.nlo new file mode 100644 index 0000000000000000000000000000000000000000..fb0e71fc19b97eab0a47e4e3fd4bea855e3b8ad2 --- /dev/null +++ b/data/meta_data/python_code.nlo @@ -0,0 +1,15 @@ +file_name = '' +# Welcome to the NiloProject, a0.5 +# by Faruk Hammoud, 2018 +x =0 +y =3.0 +z = x*x+y*y +Frames().arquivos[Frames().n][5].valores_parametros = [] +Frames().arquivos[Frames().n][5].valores_parametros.append(x) +Frames().arquivos[Frames().n][5].valores_parametros.append(y) + +Frames().arquivos[Frames().n][6].valor = z +if z > 5: + fill(Color('orange'),150) + ellipse(mouseX,mouseY,50,50) + diff --git a/data/packages/__init__$py.class b/data/packages/__init__$py.class new file mode 100644 index 0000000000000000000000000000000000000000..db714c36e6a9969d60c230e660fa3135fa64bdc6 Binary files /dev/null and b/data/packages/__init__$py.class differ diff --git a/data/packages/__init__.py b/data/packages/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/data/packages/pkg_nativo/__init__.py b/data/packages/pkg_nativo/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..cfb296196e5b3cd3e476cb9ee5d69bee9fc53eab --- /dev/null +++ b/data/packages/pkg_nativo/__init__.py @@ -0,0 +1 @@ +<mod>mod_basico</mod> \ No newline at end of file diff --git a/data/packages/pkg_nativo/pkg_nativo$py.class b/data/packages/pkg_nativo/pkg_nativo$py.class new file mode 100644 index 0000000000000000000000000000000000000000..5fb3e614587c064bce8fa486ffbf97f36d408b7f Binary files /dev/null and b/data/packages/pkg_nativo/pkg_nativo$py.class differ diff --git a/data/packages/pkg_nativo/pkg_nativo.py b/data/packages/pkg_nativo/pkg_nativo.py new file mode 100644 index 0000000000000000000000000000000000000000..14b696ad75e00f9a6cbc6970842bbc8e294844ba --- /dev/null +++ b/data/packages/pkg_nativo/pkg_nativo.py @@ -0,0 +1,118 @@ +from sys_index import * + +class Projeto: + def __init__(self): + #variaveis do projeto + self.nome = 'null_project' + self.autor = '' + self.data_de_criacao = 'dd/mm/aaaa' + self.data_ultima_modificacao = 'dd/mm/aaaa' + self.versao = 0 + self.sub_versao = 0 + self.variaveis = 0 + self.codigo = [] + + #metodos de comunicacao do projeto + def ImportaProjeto(self): + pass + def ExportaProjeto(self): + pass + def MudaNome(self,nome): + self.nome = nome + def IncluiVariavel(self): + pass + + #metodos de simulacao + # +class Frame(object): + def __init__(self,numero): + self.on = True + self.tam_x = width/2 + self.tam_y = 25 + self.editando = False + self.nilo_code = '' + self.numero = numero + self.refletido = False + def MostrarFrame(self,inf = [10,0,0,0]): + if Frames().selecao_refletida: + if self.refletido: + fill(Cores().azul) + noStroke() + rect(1,2,5,self.tam_y-4) + elif (0 < inf[2] <= self.tam_y) and (width/2 > inf[1] and inf[3]==0 or width/2 > inf[1] and inf[3]==1) : + fill(Cores().branco) + noStroke() + rect(1,2,5,self.tam_y-4) + if Interface().mouse_clicked: + Interface().mouse_clicked = False + self.refletido = True + else: + fill(Cores().cinza_escuro) + noStroke() + rect(1,2,5,self.tam_y-4) + else: + if self.editando: + fill(Cores().verde) + noStroke() + rect(1,2,5,self.tam_y-4) + elif 0 < inf[2] <= self.tam_y and (inf[1] < width/2 and inf[3]==0 or inf[1] > width/2 and inf[3]==1): + fill(Cores().branco) + noStroke() + rect(1,2,5,self.tam_y-4) + if Interface().mouse_clicked: + Interface().mouse_clicked = False + Interface().tmp_text = self.nilo_code + Frames().SairEdicao() + Frames().frame_selecionado = self.numero + self.editando = True + else: + fill(Cores().cinza_escuro) + noStroke() + rect(1,2,5,self.tam_y-4) +class Linha(Frame): + def __init__(self,numero): + super(Linha, self).__init__(numero) + def Mostrar(self,inf = [10,0,0]): + super(Linha, self).MostrarFrame(inf) + fill(Cores().branco) + textSize(inf[0]) + self.nilo_code = Interpretador().Normaliza(self.nilo_code) + Interpretador().ImprimeLinha(self.nilo_code,20,20,self.editando) +class Barra(Frame): + def __init__(self,numero): + super(Barra, self).__init__(numero) + self.tam_y = 50 + self.nilo_code = 'n = Barra(10,20,15)' + def Mostrar(self,inf = [10,0,0]): + super(Barra, self).MostrarFrame(inf) + textSize(inf[0]) + pre_texto = matchAll('<tag>'+self.texto,'<tag>(.*?)=')[0][1] + Interpretador().ImprimeLinha(pre_texto+'=',20,31,self.editando) + x0 = textWidth(pre_texto+'=') +40 + tam_x = width/2 - 2*x0 + p0 = Interpretador().Parametros(self.texto)[0] + p1 = Interpretador().Parametros(self.texto)[1] + p2 = Interpretador().Parametros(self.texto)[2] + stroke(Cores().branco) + strokeWeight(3) + line(x0,25,x0+tam_x,25) + fill(Cores().preto) + ellipse(x0+tam_x*(p2-p0)/(p1-p0),25,20,20) +class Botao(Frame): + def __init__(self,numero): + super(Botao, self).__init__(numero) + self.tam_y = 50 + self.nilo_code = 'n = Botao(False)' + def Mostrar(self,inf = [10,0,0]): + super(Botao, self).MostrarFrame(inf) + textSize(inf[0]) + pre_texto = matchAll('<tag>'+self.texto,'<tag>(.*?)=')[0][1] + Interpretador().ImprimeLinha(pre_texto+'=',20,31,self.editando) + fill(Cores().branco) + noStroke() + ellipse(textWidth(pre_texto+'=') +55,25,30,30) + ellipse(textWidth(pre_texto+'=') +85,25,30,30) + rect(textWidth(pre_texto+'=') +55,10,30,30) + #ellipse + + \ No newline at end of file diff --git a/data/pizza.png b/data/pizza.png deleted file mode 100644 index c3acbe7a25d6dc70752ce2f14996c9ed41359372..0000000000000000000000000000000000000000 Binary files a/data/pizza.png and /dev/null differ diff --git a/data/plug_ins/a.nlo b/data/plug_ins/a.nlo new file mode 100644 index 0000000000000000000000000000000000000000..4f2150754e0027c1331de8e195cb70da01866441 --- /dev/null +++ b/data/plug_ins/a.nlo @@ -0,0 +1,6 @@ +plug_in = 'a' +fill ( Cores ( ) .cinza ) +rect ( 0 , 0 , 648 , 300 ) +fill ( Cores ( ) .cinza_escuro ) +text ( 'Truss Solver Plugin - POLI - USP' , 10 , 30 ) +rect ( 20 , 50 , 604 , 220 , 50 ) diff --git a/data/plug_ins/havai.nlo b/data/plug_ins/havai.nlo new file mode 100644 index 0000000000000000000000000000000000000000..0f5f3dd17ea93adc4c9b38fce0c4a9871180f263 --- /dev/null +++ b/data/plug_ins/havai.nlo @@ -0,0 +1 @@ +plug_in = 'havai' diff --git a/data/plug_ins/plug - in.nlo b/data/plug_ins/plug - in.nlo new file mode 100644 index 0000000000000000000000000000000000000000..a31c31f1870c194eca751494cdfff434c244e5de --- /dev/null +++ b/data/plug_ins/plug - in.nlo @@ -0,0 +1,3 @@ +plug_in = 'plug - in' +fill ( Cores ( ) .laranja ) +rect ( 0 , 0 , 100 , 100 ) diff --git a/data/poli.png b/data/poli.png deleted file mode 100644 index 9671304bc4c6a67b87f073e868910bb02e70f5e7..0000000000000000000000000000000000000000 Binary files a/data/poli.png and /dev/null differ diff --git a/data/saves/CargaTermica.nlo b/data/saves/CargaTermica.nlo new file mode 100644 index 0000000000000000000000000000000000000000..88f305ec8ccdd048257d1a2353f508dc0af83368 --- /dev/null +++ b/data/saves/CargaTermica.nlo @@ -0,0 +1,48 @@ +file_name = 'CargaTermica' +dia = 57 +hora = 14.5 +# Angulo de incidencia entre o azimute do sol e a normal a superficie +gama = Barra ( 0 , 6.28318530718 , 2.50791672798 ) +# Fluxo da radiacao solar aparente ( W / m2 ) +A = Barra ( 800 , 1400 , 1170.84452529 ) +# Coeficiente de extincao atmosferica +B = 0.177 +# Coeficiente de radiacao difusa +C = 0.092 +# Reflectancia do entorno +ro = 0.2 +# Inclinacao da superficie +sigma = 0 +# Fator de forma entre superficie absorvedora e o ceu +Fss = ( 1 + cos ( sigma ) ) / 2.0 +# Fator de forma entre superficie absorvedora e superficies do entorno +Fsg = ( 1 + cos ( sigma ) ) / 2.0 +# Latitude +L = - 23.55 * ( pi / 180.0 ) +# Declinacao +sigma_min = 23.47 * sin ( ( 2 * pi / 365.0 ) * ( 284 + dia ) ) * ( pi / 180.0 ) +# Deslocamento angular do sol +H = ( hora - 12 ) * ( pi / 12.0 ) +Mostrar ( 'cos ( H ) ' , 'cos ( H ) eh' ) +# Altitude Solar +beta = asin ( cos ( L ) * cos ( sigma_min ) * cos ( H ) + sin ( L ) * sin ( sigma_min ) ) +# Azimute Solar +fi = acos ( ( sin ( beta ) * sin ( L ) - sin ( sigma_min ) ) / ( cos ( beta ) * cos ( L ) ) ) +# Zenite +teta_z = ( pi / 2 ) - beta +# Angulo de incidencia +teta = acos ( cos ( teta_z ) * cos ( sigma ) + sin ( teta_z ) * sin ( sigma ) * cos ( gama ) ) +# Fluxo de radiacao direta +Idn = A / exp ( beta / sin ( beta ) ) +# Radiacao difusa +Id = C * Idn * Fss +# Radicacao refletida +Ir = Idn * ( C + sin ( beta ) ) * ro * Fsg +# Radiacao Total +It = Idn * cos ( teta ) + Id + Ir +Mostrar ( 'It' , 'It eh' ) +Mostrar ( 'Idn' , 'Idn eh' ) +Mostrar ( 'Id' , 'Id eh' ) +Mostrar ( 'Ir' , 'Ir eh' ) +Mostrar ( 'tan ( beta ) / cos ( gama ) ' , 'tan ( beta ) / cos ( gama ) eh' ) +Mostrar ( 'Idn * cos ( teta ) ' , 'Idn * cos ( teta ) eh' ) diff --git a/data/saves/Jadde Materiais.nlo b/data/saves/Jadde Materiais.nlo new file mode 100644 index 0000000000000000000000000000000000000000..1e92817fff57f64154b7ec407b2f06d9f7af6dfd --- /dev/null +++ b/data/saves/Jadde Materiais.nlo @@ -0,0 +1,14 @@ +file_name = 'Jadde Materiais' +# Welcome to the NiloProject , a0.4 +# by Faruk Hammoud , 2018 + +qtd = Barra ( 0 , 50 , 22.4104379789 ) +preco = SeletorManual ( [['tijolos' , '3.00'] , ['pedra' , '2.00'] , ['piso' , '5.00'] , ['pia' , '55.00'] , ['' , '']] , 1 ) +valor = qtd * float ( preco ) +incluir_frete = Botao ( True ) +if incluir_frete : + valor += 5.00 +desconto15 = Botao ( True ) +if desconto15 : + valor *= 0.85 +Mostrar ( 'valor' , 'valor eh' ) diff --git a/data/saves/JupiterPro.nlo b/data/saves/JupiterPro.nlo new file mode 100644 index 0000000000000000000000000000000000000000..511a8f627a3e8925552a1eac951629d9b9cbfc3f --- /dev/null +++ b/data/saves/JupiterPro.nlo @@ -0,0 +1,5 @@ +file_name = 'JupiterPro' +# Welcome to NiloProject Beta +# by Faruk Hammoud , 2018 + +# esse eh o jupiter pro diff --git a/data/saves/Lab 1 - MecFlu.nlo b/data/saves/Lab 1 - MecFlu.nlo new file mode 100644 index 0000000000000000000000000000000000000000..3d419cf85a5a0617fd701fac05f998c74e53ef58 --- /dev/null +++ b/data/saves/Lab 1 - MecFlu.nlo @@ -0,0 +1,7 @@ +file_name = 'Lab 1 - MecFlu' +# Welcome to the NiloProject ( Beta Version ) +# by Faruk Hammoud , 2018 + +a = 9 +Show ( 'a' , 'a eh' ) + diff --git a/data/saves/MecFlu.nlo b/data/saves/MecFlu.nlo new file mode 100644 index 0000000000000000000000000000000000000000..216f5088feebc1995f96d43875c3e56fd8eb26d3 --- /dev/null +++ b/data/saves/MecFlu.nlo @@ -0,0 +1,57 @@ +file_name = 'MecFlu' +# Welcome to the NiloProject ( Beta Version ) +# by Faruk Hammoud , 2018 + +# 1 ) DADOS DO EXPERIMENTO ( em mmOleo ) +# 30 Hz +p30 = [ - 7.0 , - 7.0 , - 5.5 , - 3.5 , 0 , 2.5 , 4.0 , 3.5 , 3.0 , 3.0 , 3.0 , 2.5 , 2.5 , 3.0 , 3.0 , 3.0 , 3.0 , 3.0 ] +pitot30 = - 6.5 * ( 784 * 9.8 / 1000 ) +# 40 Hz +p40 = [ - 12.0 , - 12.5 , - 10.0 , - 5.5 , - 1.0 , 4.0 , 6.5 , 6.0 , 5.0 , 5.0 , 4.5 , 5.0 , 5.0 , 5.5 , 5.5 , 5.5 , 5.0 , 5.0 ] +pitot40 = - 12.5 * ( 784 * 9.8 / 1000 ) +# 50 Hz +p50 = [ - 20.0 , - 19.0 , - 15.5 , - 9.0 , - 2.0 , 6.0 , 9.0 , 7.5 , 6.0 , 5.5 , 6.0 , 6.5 , 7.0 , 7.5 , 7.5 , 8.0 , 7.5 , 7.0 ] +pitot50 = - 18.5 * ( 784 * 9.8 / 1000 ) + +# 2 ) FUNCOES DO EXPERIMENTO +def Ro ( material = 'agua' ) : + if material == 'agua' : + return 1000.0 + elif material == 'oleo' : + return 784.0 + elif material == 'ar' : + return 1.2041 +def mmToPressao ( lista , material ) : + lista_nova = [] + for item in lista : + lista_nova.append ( item * Ro ( material ) * 9.8 / 1000 ) + return lista_nova +def Cp ( pressoes , velocidade , material ) : + lista_nova = [] + for pressao in pressoes : + lista_nova.append ( pressao / ( 0.5 * pow ( velocidade , 2 ) * Ro ( material ) ) ) + return lista_nova +def Pitot ( deltaP , material ) : + return sqrt ( 2 * deltaP / Ro ( material ) ) +def Cd ( D , Ro , v , A ) : + return 2 * D / ( Ro * pow ( v , 2 ) * A ) +def Arrasto ( Cd , Ro , v , A ) : + return Cd * ( 1 / 2 ) * Ro * pow ( v , 2 ) * A +class Cilindro : + def __init__ ( self , diametro ) : + self.diametro = diametro + self.angulo = 0 + self.comprimento = 100 + +# 3 ) Processamento de Dados +vel30 = Pitot ( abs ( pitot30 ) , 'ar' ) +vel40 = Pitot ( abs ( pitot40 ) , 'ar' ) +vel50 = Pitot ( abs ( pitot50 ) , 'ar' ) +p30 = mmToPressao ( p30 , 'oleo' ) +p40 = mmToPressao ( p40 , 'oleo' ) +p50 = mmToPressao ( p50 , 'oleo' ) +cp30 = Cp ( p30 , vel30 , 'ar' ) +cp40 = Cp ( p40 , vel40 , 'ar' ) +cp50 = Cp ( p50 , vel50 , 'ar' ) +Mostrar ( 'p30' , 'p30 is' ) + diff --git a/data/saves/Sais.nlo b/data/saves/Sais.nlo new file mode 100644 index 0000000000000000000000000000000000000000..ad80d32067bc87aff206d6e3d0f3ab872fb5eb1f --- /dev/null +++ b/data/saves/Sais.nlo @@ -0,0 +1,13 @@ +file_name = 'Sais' +# Welcome to the NiloProject , a0.4 +# by Faruk Hammoud , 2018 +b = Botao ( False ) +if b : + fill ( Cores ( ) .verde , 50 ) +else : + fill ( Cores ( ) .vermelho , 50 ) +ellipse ( mouseX , mouseY , 20 , 20 ) +x = Barra ( 0 , 500 , 357.1447219 ) +rect ( x + 500 , 400 , 200 , 100 ) +Mostrar ( 'b' , 'b eh' ) +Mostrar ( 'x' , 'x eh' ) diff --git a/data/saves/sqrt.nlo b/data/saves/sqrt.nlo new file mode 100644 index 0000000000000000000000000000000000000000..dff941e90b90678ad77723272ba8fd5089da59f4 --- /dev/null +++ b/data/saves/sqrt.nlo @@ -0,0 +1,11 @@ +file_name = 'sqrt' +# Welcome to the NiloProject ( Beta Version ) +# by Faruk Hammoud , 2018 +n = Barra ( 0 , 100 , 53.1409168081 ) +n = sqrt ( n ) +Show ( 'n' , 'n is' ) +f = Botao ( True ) +if f and n > 5 : + fill ( Cores ( ) .verde , 100 ) + ellipse ( mouseX , mouseY , 50 , 50 ) + diff --git a/f_modules/mod_arduino.py b/f_modules/mod_arduino.py new file mode 100644 index 0000000000000000000000000000000000000000..2bfafa2b56e0bee71778056d1119c263a508e1d2 --- /dev/null +++ b/f_modules/mod_arduino.py @@ -0,0 +1,29 @@ +import __main__ +A0 = 0 +A1 = 1 +A2 = 2 +A3 = 3 +A4 = 4 +A5 = 5 +add_library('arduino') +def analogRead(porta): + return ARDUINO.analogRead(porta) +def analogWrite(porta,valor): + ARDUINO.analogWrite(porta,valor) +def digitalRead(porta): + return ARDUINO.digitalRead(porta) +def digitalWrite(porta,valor): + ARDUINO.digitalWrite(porta,valor) +class NiloArduino: + ard = 0 + def inicializa(self,arduino): + ArduinoData.ard = arduino + def analogRead(self,porta): + return NiloArduino.ard.analogRead(porta) + def analogWrite(self,porta,valor): + NiloArduino.ard.analogWrite(porta,valor) + def digitalRead(self,porta): + return NiloArduino.ard.digitalRead(porta) + def digitalWrite(self,porta,valor): + NiloArduino.ard.digitalgWrite(porta,valor) +ARDUINO = NiloArduino() diff --git a/f_modules/mod_luva.py b/f_modules/mod_luva.py new file mode 100644 index 0000000000000000000000000000000000000000..1b9a94e7c029cc44ba636105c4fab7aa500443b2 --- /dev/null +++ b/f_modules/mod_luva.py @@ -0,0 +1,14 @@ +import __main__ +class NiloLuva: + def __init__(self): + self.temperatura = 0 + self.aceleracao = [] + self.giroscopio = [] + self.ip = '192.168.0.23' + self.port = 4210 + self.mensagem = 'LVCA=1;\n' + self.data = '' + def solicitaLuva(self): + udp.send(self.mensagem,self.ip,self.port) + +LUVA = NiloLuva() diff --git a/mod_basico$py.class b/mod_basico$py.class new file mode 100644 index 0000000000000000000000000000000000000000..8d3f44cfe314cf5b8116f86b4660a3e8cfdeed64 Binary files /dev/null and b/mod_basico$py.class differ diff --git a/mod_basico.py b/mod_basico.py new file mode 100644 index 0000000000000000000000000000000000000000..01374a174d67373654d2be4a86a18885df72bdc6 --- /dev/null +++ b/mod_basico.py @@ -0,0 +1,861 @@ +from sys_index import * + +lista_objetos = ['Frame','Linha','Bar','Button','Show','Plot','Box','PlugIn','Function','Table'] + + #metodos de simulacao + # +class Frame(object): + def __init__(self,classe): + self.frame = 0 + self.classe = classe + self.sobreposicao = False + self.tam_x = width/2 + self.tam_y = 25 + self.editando = False + self.mouse_dentro = False + self.nilo_code = '' + self.python_code = '' + self.texto = '' + self.refletido = False + self.plug_in = '' #'' para frame basico e 'x' para pertencente ao plugin x + def mostrarFrame(self,i,inf = [10,0,0]): #tamanho fonte, x relativo ao objeto, y relativo ao objeto + self.frame = i + if 0 < inf[2] <= self.tam_y: + self.mouse_dentro = True + else: + self.mouse_dentro = False + if Frames().selecao_refletida: + if self.mouse_dentro and 0 < inf[1] < width/2: + fill(Cores().azul_claro) + if Interface().mouse_clicked: + self.refletido = switch(self.refletido) + else: + if self.refletido: + fill(Cores().azul) + else: + fill(Cores().cinza_escuro) + else: + if self.editando: + Frames().plug_in = self.plug_in + fill(Cores().verde) + elif self.mouse_dentro and 0 < inf[1] < width/2: + fill(Cores().branco) + if Interface().mouse_clicked: + Frames().sairEdicao() + self.editar() + else: + fill(Cores().cinza_escuro) + noStroke() + rect(1,2,5,self.tam_y-4) +class Plot(Frame): + def __init__(self,var= '[[0,0],[1,1],[2,4]]'): + super(Plot, self).__init__("Plot") + self.plug_in = Frames().objetoFrameEditando().plug_in + self.tam_y = 300 + self.texto = Frames().niloCodeEditando() + self.nilo_code = self.texto + self.python_code = ' ' + self.var = var + self.data = [[0,0],[1,1]] + Frames().arquivos[Frames().n][Frames().frameEditando()] = self + self.mouse_em_cima = False + self.clicado = False + self.bool = bool + self.centro = 0 + def editar(self): + self.editando = True + def mostrar(self,i,inf = [10,0,0]): + self.nilo_code = self.texto + self.python_code = 'Frames().arquivos[Frames().n]['+str(self.frame)+'].data = '+self.var + if self.editando: Interface().cursor_letra = 0 + super(Plot, self).mostrarFrame(i,inf) + textSize(inf[0]) + maximoX = -1000000 + maximoY = -1000000 + minimoX = 1000000 + minimoY = 1000000 + for dado in self.data: + if dado[0] > maximoX: maximoX = dado[0] + if dado[1] > maximoY: maximoY = dado[1] + if dado[0] < minimoX: minimoX = dado[0] + if dado[1] < minimoY: minimoY = dado[1] + if maximoX == minimoX: minimoX-=1 + if maximoY == minimoY: minimoY-=1 + for i in range(len(self.data)-1): + fill(50,50,250) + stroke(50,50,250) + strokeWeight(5) + x0 = int(10+(float(self.data[i][0]-minimoX)/(maximoX-minimoX))*(width*0.4)) + y0 = int((float(self.data[i][1]-minimoY)/(maximoY-minimoY))*(height*0.3)) + x1 = int(10+(float(self.data[i+1][0]-minimoX)/(maximoX-minimoX))*(width*0.4)) + y1 = int((float(self.data[i+1][1]-minimoY)/(maximoY-minimoY))*(height*0.3)) + line(x0,300-y0,x1,300-y1) +class TextBox(): + def __init__(self,texto_principal = ''): + self.texto_principal = texto_principal + self.editando = False + self.tamanho_letra = 20 + self.mouse_dentro = False + self.ultimo_mouseXrelativo = 0 + def mudaTexto(self,texto_principal): + self.texto_principal = texto_principal + def retornaTexto(self): + return self.texto_principal + def editar(self): + self.editando = True + Interface().tmp_text = self.texto_principal + Interface().Cursor(self.ultimo_mouseXrelativo) + def mostrar(self,inf = [10,0,0]): + self.ultimo_mouseXrelativo = inf[1] + if Interface().algo_aconteceu: + self.editando = False + self.mouse_dentro = False + if 0< inf[1] <= tamanhoTexto(self.texto_principal)+20 and -20 < inf[2] <= -20 + self.tamanho_letra: + self.mouse_dentro = True + ellipse(0,0,3,3) + if Interface().mouse_clicked and self.mouse_dentro: + self.editar() + if self.editando: + self.texto_principal = Interface().tmp_text + self.texto_principal = Interpretador().normaliza(self.texto_principal) + Interpretador().imprimeLinha(self.texto_principal,0,0,self.editando) +class Linha(Frame): + def __init__(self,texto = ''): + super(Linha, self).__init__("Linha") + self.plug_in = '' #mudado posteriormente na importacao ou no criaLinha + self.cursor_x = 0 + self.textbox = TextBox(texto) + print(self.textbox.retornaTexto()) + self.editar() + def sairEdicao(self): + self.textbox.editando = False + def editar(self): + self.editando = True + self.textbox.editar() + def mostrar(self,i,inf = [10,0,0]): + super(Linha, self).mostrarFrame(i,inf) + textSize(inf[0]) + if not self.editando: #O TextBox so detecta por padrao + self.textbox.editando = False + else: + self.textbox.editando = True + with pushMatrix(): + inf = translada(20,20,inf) + self.textbox.mostrar(inf) + self.nilo_code = self.textbox.retornaTexto() + self.python_code = self.textbox.retornaTexto() +class Table(Frame): + def __init__(self,var_l = 'x',var_c = 'y',linhas = ['','',''],colunas = ['','',''],tabela = [['','',''],['','',''],['','','']],sel_l = 0,sel_c = 0): + super(Table,self).__init__("Table") + self.plug_in = Frames().objetoFrameEditando().plug_in + variavel = matchAll('<tag>'+Frames().niloCodeEditando(),'<tag>(.*?)=')[0][1] + self.variavel_textbox = TextBox(variavel) + self.tabela_textboxes = [] + self.linhas_textboxes = [] + self.colunas_textboxes = [] + self.sel_l = sel_l + self.sel_c = sel_c + self.var_l = var_l + self.var_c = var_c + Frames().arquivos[Frames().n][Frames().frameEditando()] = self + n_colunas = len(tabela[0]) + n_linhas = len(tabela) + for i in range(n_linhas): + self.tabela_textboxes.append([]) + self.linhas_textboxes.append(TextBox(linhas[i])) + for j in range(n_colunas): + self.tabela_textboxes[i].append(TextBox(tabela[i][j])) + for i in range(n_colunas): + self.colunas_textboxes.append(TextBox(colunas[i])) + self.tam_y = 30*(n_linhas+1)+5 + def maiorDaColuna(self,n): + maior = 50 + if n == -1: + for item in self.linhas_textboxes: + if tamanhoTexto(item.retornaTexto())+10 > maior: + maior = tamanhoTexto(item.retornaTexto())+10 + else: + if tamanhoTexto(self.colunas_textboxes[n].retornaTexto())+10>maior: + maior = tamanhoTexto(self.colunas_textboxes[n].retornaTexto())+10 + for i in range(self.n_linhas()): + for j in range(self.n_colunas()): + if j == n and tamanhoTexto(self.tabela_textboxes[i][j].retornaTexto())+10 > maior: + maior = tamanhoTexto(self.tabela_textboxes[i][j].retornaTexto())+10 + return maior + def editar(self): + self.editando = True + def n_linhas(self): + return len(self.linhas_textboxes) + def n_colunas(self): + return len(self.colunas_textboxes) + def plotaRetangulosSelecao(self): + strokeWeight(3) + fill(255,0,0,50) + stroke(255,0,0,150) + rect(0,30*(self.sel_l+1),self.tamX(),30) + fill(0,0,255,50) + stroke(0,0,255,150) + rect(self.posX(self.sel_c),0,self.maiorDaColuna(self.sel_c),30*(self.n_linhas()+1)) + def tamX(self): + tamanho = 0 + for i in range(-1,self.n_colunas()): + tamanho += self.maiorDaColuna(i) + return tamanho + def posX(self,n): + tamanho = 0 + for i in range(-1,n): + tamanho += self.maiorDaColuna(i) + return tamanho + def codigos(self): + tabela = [] + linhas = [] + colunas = [] + for i in range(self.n_linhas()): + tabela.append([]) + for j in range(self.n_colunas()): + tabela[i].append(self.tabela_textboxes[i][j].retornaTexto()) + for i in range(self.n_linhas()): + linhas.append(self.linhas_textboxes[i].retornaTexto()) + for i in range(self.n_colunas()): + colunas.append(self.colunas_textboxes[i].retornaTexto()) + self.mouse_em_cima = False + self.celula_mouse = [0,0] + self.nilo_code = self.variavel_textbox.retornaTexto()+' = Table(\''+self.var_l+'\',\''+self.var_c+'\','+str(linhas)+','+str(colunas)+','+str(tabela)+')' + self.python_code = self.variavel_textbox.retornaTexto()+' = '+str(self.tabela_textboxes[self.sel_l][self.sel_c].retornaTexto()) + def mostrar(self,i,inf=[10,0,0]): + super(Table,self).mostrarFrame(i,inf) + self.codigos() + with pushMatrix(): + inf = translada(20,20,inf) + self.variavel_textbox.mostrar(inf) + inf = translada(tamanhoTexto(self.variavel_textbox.retornaTexto()+' '),0,inf) + Interpretador().imprimeLinha(' =') + inf = translada(30,-20,inf) + inf0 = inf + with pushMatrix(): + for i in range(-1,self.n_linhas()): + inf1 = inf + with pushMatrix(): + for j in range(-1,self.n_colunas()): + fill(0) + stroke(255) + strokeWeight(2) + rect(0,0,self.maiorDaColuna(j),30) + inf2 = inf + self.mouse_em_cima = False + with pushMatrix(): + inf = translada(5,20,inf) + if i == -1 and j == -1: + text(self.var_l+'~'+self.var_c,0,0) + elif i == -1: + self.colunas_textboxes[j].mostrar(inf) + elif j == -1: + self.linhas_textboxes[i].mostrar(inf) + else: + self.tabela_textboxes[i][j].mostrar(inf) + if self.tabela_textboxes[i][j].mouse_dentro: + self.mouse_em_cima = True + self.celula_mouse = [i,j] + inf = inf2 + if self.mouse_em_cima: + fill(0,0) + stroke(0,255,0) + strokeWeight(3) + rect(2,2,self.maiorDaColuna(j)-4,26,10) + if Interface().mouse_clicked: + self.sel_l = i + self.sel_c = j + inf = translada(self.maiorDaColuna(j),0,inf) + inf = inf1 + inf = translada(0,30,inf) + inf = inf0 + self.plotaRetangulosSelecao() +class Function(Frame): + def __init__(self,parametros = 'x',funcao = ''): + super(Function, self).__init__("Function") + self.plug_in = Frames().objetoFrameEditando().plug_in + self.tam_y = 300 + self.escala = 1 + self.texto = Frames().niloCodeEditando() + self.nilo_code = self.texto + self.python_code = ' ' + self.variavel = matchAll('<tag>'+self.nilo_code,'<tag>(.*?)=')[0][1] + self.parametros_texto = parametros + self.parametros = split(parametros,',') + self.valores_parametros = [0] + self.valores_parametros_default = [0] + self.ponto_atual = [0,0] + if funcao == '': + funcao='' + for p in self.parametros: + funcao += p+' + ' + funcao += '1' + self.funcao = funcao + self.funcao_default = '' + self.x_default = 0 + self.data = [[0,0],[1,1]] + self.data3D = [[[0,0,0],[0,1,0]],[[1,0,0],[1,1,0]]] + self.theta = PI/6 + self.phi = PI/12 + Frames().arquivos[Frames().n][Frames().frameEditando()] = self + self.mouse_em_cima = False + self.clicado = False + self.bool = bool + self.centro = 0 + self.textbox_var = TextBox(self.variavel) + self.textbox_fun = TextBox(self.funcao) + self.editar() + def editar(self): + self.editando = True + def geraData(self): + self.data = [] + self.data3D = [] + if len(self.parametros) == 1: + for i in range(-25,26): + try: + x = self.valores_parametros[0] + y = float(eval(self.funcao, {self.parametros[0]: x})) + self.ponto_atual = [x,y] + self.data.append([i*self.escala+x,float(eval(self.funcao, {self.parametros[0]: i*self.escala+x}))]) + except BaseException as err: + print('geraData:',err) + self.data.append([0,0]) + if len(self.parametros) == 2: + for i in range(-3,4): + self.data3D.append([]) + for j in range(-3,4): + try: + x = self.valores_parametros[0] + y = self.valores_parametros[1] + z = float(eval(self.funcao, {self.parametros[0]: x,self.parametros[1]: y})) + self.ponto_atual = [x,y,z] + self.data3D[i+3].append([i*self.escala+x,j*self.escala+y,float(eval(self.funcao, {self.parametros[0]: i*self.escala+x,self.parametros[1]: j*self.escala+y}))]) + except BaseException as err: + print('geraData3D:',err,millis()) + self.data.append([0,0]) + def scroll(self,x): + if x>0: + self.escala*=1.2 + if x<0: + self.escala/=1.2 + Thread(target = self.geraData()) + def editar(self): + self.editando = True + def minMaxXY(self): + maximoX = -1000000 + maximoY = -1000000 + minimoX = 1000000 + minimoY = 1000000 + for dado in self.data: + if dado[0] > maximoX: maximoX = dado[0] + if dado[1] > maximoY: maximoY = dado[1] + if dado[0] < minimoX: minimoX = dado[0] + if dado[1] < minimoY: minimoY = dado[1] + if maximoX == minimoX: minimoX-=1 + if maximoY == minimoY: minimoY-=1 + return minimoX,maximoX,minimoY,maximoY + def minMaxXY3D(self): + maximoX = -1000000 + maximoY = -1000000 + minimoX = 1000000 + minimoY = 1000000 + try: + for vetor_dado in self.data3D: + for dado in vetor_dado: + if dado[0]*cos(self.theta)+dado[1]*sin(self.theta) > maximoX: maximoX = dado[0]*cos(self.theta)+dado[1]*sin(self.theta) + if dado[2]+sin(self.phi)*(dado[0]*sin(self.theta)-dado[1]*cos(self.theta)) > maximoY: maximoY = dado[2]+sin(self.phi)*(dado[0]*sin(self.theta)-dado[1]*cos(self.theta)) + if dado[0]*cos(self.theta)+dado[1]*sin(self.theta) < minimoX: minimoX = dado[0]*cos(self.theta)+dado[1]*sin(self.theta) + if dado[2]+sin(self.phi)*(dado[0]*sin(self.theta)-dado[1]*cos(self.theta)) < minimoY: minimoY = dado[2]+sin(self.phi)*(dado[0]*sin(self.theta)-dado[1]*cos(self.theta)) + except BaseException as err: + print('minMax3D: ',err) + if maximoX == minimoX: minimoX-=1 + if maximoY == minimoY: minimoY-=1 + return minimoX,maximoX,minimoY,maximoY + def mostrar(self,i,inf = [10,0,0]): + super(Function, self).mostrarFrame(i,inf) + if self.editando: + self.theta += Interface().deltaX/25.0 + self.phi += Interface().deltaY/25.0 + textSize(inf[0]) + inf0 = inf + with pushMatrix(): + inf = translada(20,31,inf) + self.textbox_var.mostrar(inf) + inf = translada(tamanhoTexto(self.textbox_var.retornaTexto()),0,inf) + Interpretador().imprimeLinha(' = ',0,0) + inf = translada(tamanhoTexto(' = '),0,inf) + self.textbox_fun.mostrar(inf) + inf = inf0 + self.variavel = self.textbox_var.retornaTexto() + self.funcao = self.textbox_fun.retornaTexto() + self.nilo_code = self.variavel+' = Function(\''+self.parametros_texto+'\',\''+self.funcao+'\')' + self.python_code = self.variavel+' = '+self.funcao+'\n' + self.python_code += 'Frames().arquivos[Frames().n]['+str(self.frame)+'].valores_parametros = []\n' + for parametro in self.parametros: + self.python_code += 'Frames().arquivos[Frames().n]['+str(self.frame)+'].valores_parametros.append('+parametro+')\n' + if self.funcao != self.funcao_default or self.valores_parametros_default != self.valores_parametros: + self.valores_parametros_default = self.valores_parametros + self.funcao_default = self.funcao + Thread(target=self.geraData()) + if len(self.parametros) == 1: + minimoX,maximoX,minimoY,maximoY = self.minMaxXY() + def escalaX(valor): return int(10+(float(valor-minimoX)/(maximoX-minimoX))*(width*0.4)) + def escalaY(valor): return int((float(valor-minimoY)/(maximoY-minimoY))*(height*0.3)) + for i in range(len(self.data)-1): + stroke(50,50,250) + strokeWeight(2) + x0, y0, x1, y1 = escalaX(self.data[i][0]), escalaY(self.data[i][1]), escalaX(self.data[i+1][0]), escalaY(self.data[i+1][1]) + line(x0,300-y0,x1,300-y1) + fill(255,0,0,150) + noStroke() + ellipse(escalaX(self.ponto_atual[0]),300-escalaY(self.ponto_atual[1]),8,8) + elif len(self.parametros) == 2: + fill(0,255,0,50) + stroke(0,255,0,100) + minimoX,maximoX,minimoY,maximoY = self.minMaxXY3D() + def escalaX(valor): return int(10+(float(valor-minimoX)/(maximoX-minimoX))*(width*0.4)) + def escalaY(valor): return int((float(valor-minimoY)/(maximoY-minimoY))*(height*0.3)) + try: + for i in range(len(self.data3D)-1): + for j in range(len(self.data3D)-1): + strokeWeight(2) + x0, y0, z0 = self.data3D[i][j][0], self.data3D[i][j][1], self.data3D[i][j][2] + x1, y1, z1 = self.data3D[i][j+1][0], self.data3D[i][j+1][1], self.data3D[i][j+1][2] + x2, y2, z2 = self.data3D[i+1][j+1][0], self.data3D[i+1][j+1][1], self.data3D[i+1][j+1][2] + x3, y3, z3 = self.data3D[i+1][j][0], self.data3D[i+1][j][1], self.data3D[i+1][j][2] + beginShape() + vertex(escalaX(x0*cos(self.theta)+y0*sin(self.theta)),300-escalaY(z0+sin(self.phi)*(x0*sin(self.theta)-y0*cos(self.theta)))) + vertex(escalaX(x1*cos(self.theta)+y1*sin(self.theta)),300-escalaY(z1+sin(self.phi)*(x1*sin(self.theta)-y1*cos(self.theta)))) + vertex(escalaX(x2*cos(self.theta)+y2*sin(self.theta)),300-escalaY(z2+sin(self.phi)*(x2*sin(self.theta)-y2*cos(self.theta)))) + vertex(escalaX(x3*cos(self.theta)+y3*sin(self.theta)),300-escalaY(z3+sin(self.phi)*(x3*sin(self.theta)-y3*cos(self.theta)))) + endShape(CLOSE) + fill(255,0,0,150) + noStroke() + ellipse(escalaX(self.ponto_atual[0]*cos(self.theta)+self.ponto_atual[1]*sin(self.theta)),300-escalaY(self.ponto_atual[2]+sin(self.phi)*(self.ponto_atual[0]*sin(self.theta)-self.ponto_atual[1]*cos(self.theta))),8,8) + except BaseException as err: + print('Funcao3D:',err) +class PlugIn(Frame): + def __init__(self,nome = 'noname',tam_y = 300): + super(PlugIn, self).__init__("PlugIn") + self.plug_in = '' + self.nome = str(nome) + self.tam_y = tam_y + self.python_code = '' + self.nilo_code = 'PlugIn(\''+self.nome+'\','+str(self.tam_y)+')' + self.editando = True + Frames().arquivos[Frames().n][Frames().frameEditando()] = self + Data().importaPlugIn('/plug_ins/'+self.nome+'.nlo',self.nome) + self.python_code = Interpretador().pythonCodePlugIn(self.nome) + def editar(self): + self.editando = True + def salvar(self): + Data().exportaTexto([Interpretador().niloCodePlugIn(self.nome)],'plug_ins/'+self.nome+'.nlo') + def mostrar(self,i,inf = [10,0,0,0,0]): + super(PlugIn, self).mostrarFrame(i,inf) + Thread(target=self.salvar()) + if self.editando: + Frames().plug_in = self.nome + self.nilo_code = 'PlugIn(\''+self.nome+'\','+str(self.tam_y)+')' + self.python_code = 'with pushMatrix(): \n' + self.python_code += '\ttranslate('+str(inf[3]+6)+','+str(inf[4]+2)+') \n' + self.python_code += Interpretador().pythonCodePlugIn(self.nome) + +class Bar(Frame): + def __init__(self,p0,p1,p2 = 0): + super(Bar, self).__init__("Bar") + self.plug_in = Frames().actFrame()[Frames().frameEditando()].plug_in + self.tam_y = 50 + self.nilo_code = Frames().niloCodeEditando() + self.variavel = matchAll('<tag>'+self.nilo_code,'<tag>(.*?)=')[0][1] + self.textbox = TextBox(self.variavel) + self.python_code = self.variavel+' = '+str(p0+(p1-p0)/3) + Frames().arquivos[Frames().n][Frames().frameEditando()] = self + if p0 == p1: + p1+=0.01 + if p0 > p1: + p = p1 + p1 = p0 + p0 = p + if p2<p0 or p2>p1: + p2 = p0 + (p1-p0)/3.0 + self.p0 = p0 + self.p1 = p1 + self.p2 = p2 + self.mouse_em_cima = False + self.clicado = False + self.tempo_inicial = millis() + self.released = True + self.editar() + def editar(self): + self.editando = True + self.tempo_inicial = millis() + def mostrar(self,i,inf = [10,0,0]): + super(Bar, self).mostrarFrame(i,inf) + self.nilo_code = self.texto + textSize(inf[0]) + pre_texto = self.textbox.retornaTexto() + inf0 = inf + with pushMatrix(): + inf = translada(20,31,inf) + self.textbox.mostrar(inf) + inf = translada(tamanhoTexto(self.textbox.retornaTexto()),0,inf) + Interpretador().imprimeLinha('=',0,0) + inf = inf0 + self.python_code = pre_texto+'='+str(self.p2) + self.nilo_code = pre_texto+'= Bar( '+str(self.p0)+' , '+str(self.p1)+' , '+str(self.p2)+' )' + x0 = tamanhoTexto(pre_texto+'=') +40 + tam_x = width/2 - x0 -30 + strokeWeight(3) + + if pontoEmC([inf[1],inf[2]],[x0+tam_x*(self.p2-self.p0)/(self.p1-self.p0),25],10): + self.mouse_em_cima = True + fill(Cores().cinza) + else: + self.mouse_em_cima = False + fill(Cores().preto) + if self.mouse_em_cima and Interface().mouse_pressed: + self.clicado = True + if self.released: + self.released = False + self.tempo_inicial = millis() + if not Interface().mouse_pressed: + self.clicado = False + self.released = True + if self.clicado: + self.p2 = self.p0 + (float(inf[1]-x0)/tam_x)*(self.p1-self.p0) + if millis() - self.tempo_inicial < 2500: + if (self.p1-self.p0)/20.0 > 1: + passo = int((self.p1-self.p0)/20.0) + elif (self.p1-self.p0)/20.0 > 0.1: + passo = int(10*(self.p1-self.p0)/20.0)/10.0 + elif (self.p1-self.p0)/20.0 > 0.01: + passo = int(100*(self.p1-self.p0)/20.0)/100.0 + else: + passo = int(100*(self.p1-self.p0)/1000.0)/1000.0 + for i in range(40): + if abs(self.p2-self.p0-i*passo) <= passo/2.0: + self.p2 = self.p0+i*passo + elif millis() - self.tempo_inicial < 5000: + if (self.p1-self.p0)/100.0 > 1: + passo = int((self.p1-self.p0)/100.0) + elif (self.p1-self.p0)/100.0 > 0.1: + passo = int(10*(self.p1-self.p0)/100.0)/10.0 + elif (self.p1-self.p0)/100.0 > 0.01: + passo = int(100*(self.p1-self.p0)/100.0)/100.0 + else: + passo = int(100*(self.p1-self.p0)/1000.0)/1000.0 + for i in range(200): + if abs(self.p2-self.p0-i*passo) <= passo/2.0: + self.p2 = self.p0+i*passo + if self.p2<self.p0: + self.p2 = self.p0 + elif self.p2>self.p1: + self.p2 = self.p1 + fill(Cores().cinza_claro) + stroke(Cores().branco) + line(x0,25,x0+tam_x,25) + ellipse(x0+tam_x*(self.p2-self.p0)/(self.p1-self.p0),25,20,20) + textSize(12) + fill(Cores().branco) + if self.p2-self.p0 < self.p1-self.p2: + text(nfc(self.p2,2),x0+tam_x*(self.p2-self.p0)/(self.p1-self.p0)+15,20) + else: + text(nfc(self.p2,2),x0+tam_x*(self.p2-self.p0)/(self.p1-self.p0)-15-tamanhoTexto(nfc(self.p2,2)),20) +class CaixaOpcoes: + def __init__(self): + self.sobreposicao = True + self.x = mouseX + self.y = mouseY + self.tam_x = 150 + self.lista_tarefas_a = ['Copiar','Colar','Recortar','Anotar'] + self.lista_tarefas_b = ['Copiar','Colar','Recortar','Anotar'] + def editar(self): + self.editando = True + def mostrar(self): + i0 = -1 + noStroke() + for item in self.lista_tarefas_a: + if not pontoEmR([inf[1],inf[2]],[x0,10+i*30,self.tam_x,30]): + stroke(50,200) + rect(x0+2,10+i*30,self.tam_x,30-4) + else: + i0 = i + if not i0 == -1: + stroke(0,255,0) + rect(x0+2,10+i0*30,self.tam_x,30-4) + +class Box(Frame): + def __init__(self,lista = [['item','valor']],selecionado = 0): + + #Inicializa super frame + super(Box, self).__init__("Box") + self.nilo_code = Frames().niloCodeEditando() + variavel = matchAll('<tag>'+self.nilo_code,'<tag>(.*?)=')[0][1] + + #variaveis basicas + + self.nilo_code = Frames().niloCodeEditando() + self.tam_y = 50 + + self.variavel_textbox = TextBox(variavel) + self.textboxes = [] + self.lista_valores = [] + self.plug_in = Frames().actFrame()[Frames().frameEditando()].plug_in + for i in range(len(lista)): + self.textboxes.append(TextBox(lista[i][0],True)) + self.lista_valores.append(lista[i][1]) + self.valor_textbox = TextBox() + + self.expandido = False + self.mouse_em_cima_seta = False + self.mouse_em_cima = -1 # -1 para nenhum ou numero se algum + self.selecionado = selecionado + + + if isinstance(self.lista_valores[self.selecionado], basestring): + self.python_code = self.variavel_textbox.retornaTexto()+'= \''+str(self.lista_valores[self.selecionado])+'\'' + else: + self.python_code = self.variavel_textbox.retornaTexto()+'= '+str(self.lista_valores[self.selecionado]) + + Frames().arquivos[Frames().n][Frames().frameEditando()] = self + + self.variavel_textbox = TextBox(self.pre_texto) + self.textboxes = [] + self.textboxes.append(TextBox('item',True)) + self.valor_textbox = TextBox() + + self.expandido = False + self.mouse_em_cima_seta = False + self.mouse_em_cima = -1 # -1 para nenhum ou numero se algum + self.selecionado = 0 + self.lista_valores = ['valor'] + def maiorItem(self): + maior = 0 + for textbox in self.textboxes: + if tamanhoTexto(textbox.retornaTexto()) > maior: + maior = tamanhoTexto(textbox.retornaTexto()) + return maior + def lista(self): + lista = [] + for i in range(len(self.textboxes)): + lista.append([self.textboxes[i].retornaTexto(),self.lista_valores[i]]) + return lista + def editar(self): + self.editando = True + def mostrar(self,i,inf = [10,0,0]): + if self.textboxes[len(self.textboxes)-1].retornaTexto() != '': + self.textboxes.append(TextBox('',True)) + self.lista_valores.append('') + if not self.editando: + self.variavel_textbox.editando = False + self.valor_textbox.editando = False + for textbox in self.textboxes: + textbox.editando = False + super(Box, self).mostrarFrame(i,inf) + textSize(inf[0]) + x0 = tamanhoTexto(self.variavel_textbox.retornaTexto()+'=') +30 + + if isinstance(self.lista_valores[self.selecionado], basestring): + self.python_code = self.variavel_textbox.retornaTexto()+'= \''+str(self.lista_valores[self.selecionado])+'\'' + else: + self.python_code = self.variavel_textbox.retornaTexto()+'= '+str(self.lista_valores[self.selecionado]) + self.nilo_code = self.variavel_textbox.retornaTexto()+'= Box( '+str(self.lista())+' , '+str(self.selecionado)+' )' + if pontoEmR([inf[1],inf[2]],[x0+self.maiorItem()+60-30,10,30,30]): + self.mouse_em_cima_seta = True + else: + self.mouse_em_cima_seta = False + if self.mouse_em_cima_seta and Interface().mouse_clicked: + self.expandido = switch(self.expandido) + self.sobreposicao = self.expandido + Interface().reset() + if self.expandido: + fill(0,200) + self.mouse_em_cima = -1 + for i in range(len(self.textboxes)): + if pontoEmR([inf[1],inf[2]],[x0,10+(i+1)*30,self.maiorItem()+60,30]): + self.mouse_em_cima = i + if Interface().mouse_clicked: + self.selecionado = i + self.expandido = False + if not self.mouse_em_cima == -1: + stroke(0,255,0) + else: + self.sobreposicao = False + fill(Cores().preto) + strokeWeight(2) + if not self.expandido: + stroke(Cores().branco) + rect(x0,10,self.maiorItem()+60,30) + else: + stroke(Cores().branco) + rect(x0,10,self.maiorItem()+60,30) + fill(0,100) + for i in range(len(self.textboxes)): + if i != self.mouse_em_cima: + stroke(Cores().branco) + rect(x0,10+(i+1)*30,self.maiorItem()+60,30) + if self.mouse_em_cima != -1: + stroke(Cores().verde) + rect(x0,10+(self.mouse_em_cima+1)*30,self.maiorItem()+60,30) + if self.mouse_em_cima_seta: + stroke(Cores().verde) + else: + stroke(Cores().cinza) + line(x0+self.maiorItem()+60 - 23,20,x0+self.maiorItem()+60-15,30) + line(x0+self.maiorItem()+60-15,30,x0+self.maiorItem()+60-7,20) + + self.valor_textbox.mudaTexto(self.lista_valores[self.selecionado]) + with pushMatrix(): + inf = translada(20,30,inf) + self.variavel_textbox.mostrar(inf) + inf = translada(tamanhoTexto(self.variavel_textbox.retornaTexto()),0,inf) + Interpretador().imprimeLinha(' =',0,0) + inf0 = inf + with pushMatrix(): + if not self.expandido: + inf = translada(50,0,inf) + self.textboxes[self.selecionado].mostrar(inf) + else: + inf = translada(50,0,inf) + self.textboxes[self.selecionado].mostrar(inf) + inf = translada(0,30,inf) + for i in range(len(self.textboxes)): + self.textboxes[i].mostrar(inf) + inf = translada(0,30,inf) + inf = inf0 + inf = translada(self.maiorItem()+60 +40,0,inf) + Interpretador().imprimeLinha(' =',0,0) + inf = translada(20,0,inf) + self.valor_textbox.mostrar(inf) + self.lista_valores[self.selecionado] = self.valor_textbox.retornaTexto() + #text(self.mouse_em_cima,mouseX,mouseY) #para debug +class Button(Frame): + def __init__(self,bool = False): + super(Button, self).__init__("Button") + self.plug_in = Frames().actFrame()[Frames().frameEditando()].plug_in + self.tam_y = 50 + self.nilo_code = Frames().niloCodeEditando() + self.python_code = matchAll('<tag>'+self.nilo_code,'<tag>(.*?)=')[0][1]+'= False' + Frames().arquivos[Frames().n][Frames().frameEditando()] = self + self.mouse_em_cima = False + self.clicado = False + self.bool = bool + self.centro = 0 + def editar(self): + self.editando = True + def mostrar(self,i,inf = [10,0,0]): + #self.nilo_code = self.texto + super(Button, self).mostrarFrame(i,inf) + textSize(inf[0]) + pre_texto = matchAll('<tag>'+self.nilo_code,'<tag>(.*?)=')[0][1] + Interpretador().imprimeLinha(pre_texto+'=',20,31) + self.python_code = pre_texto+'='+str(self.bool) + self.nilo_code = pre_texto+'='+' Button ( '+str(self.bool)+' )' + x0 = tamanhoTexto(pre_texto+'=') +40 + noStroke() + fill(Cores().branco) + ellipse(x0,25,30,30) + ellipse(x0+30,25,30,30) + fill(Cores().verde) + ellipse(x0,25,24,24) + fill(Cores().vermelho) + ellipse(x0+30,25,24,24) + fill(Cores().branco) + rect(x0,10,30,30) + strokeWeight(3) + if pontoEmR([inf[1],inf[2]],[x0-10,10,50,30]): + self.mouse_em_cima = True + else: + self.mouse_em_cima = False + if self.mouse_em_cima and Interface().mouse_pressed: + self.clicado = True + if not Interface().mouse_pressed: + if self.clicado: + self.clicado = False + if self.centro >= x0+15: + self.bool = True + else: + self.bool = False + if self.clicado: + self.centro = inf[1] + if self.centro<x0: + self.centro = x0 + elif self.centro>x0+30: + self.centro = x0+30 + elif self.bool: + self.centro = x0+30 + else: + self.centro = x0 + fill(Cores().verde) + rect(x0-1,13,self.centro-x0+1,24) + fill(Cores().vermelho) + rect(self.centro,13,(x0+30)-self.centro+1,24) + fill(Cores().branco) + ellipse(self.centro,25,26,26) + fill(Cores().cinza_muito_claro) + ellipse(self.centro,25,12,12) +class Show(Frame): + def __init__(self,var = '',texto = ''): + super(Show, self).__init__("Show") + self.plug_in = Frames().objetoFrameEditando().plug_in + self.tam_y = 25 + self.var = str(var) + if texto != '': + self.texto = texto + else: + self.texto = self.var+' is' + Frames().arquivos[Frames().n][Frames().frameEditando()] = self + self.nilo_code = 'Show ( \''+self.var+'\' )' + self.python_code = 'Frames().arquivos[Frames().n]['+str(Frames().frameEditando())+'].valor = '+self.var + self.mouse_em_cima = False + self.mouse_em_cima_seta = False + self.controlando = False + self.x0 = 0 + #exec ('self.valor = '+self.var) + self.valor = 0 + self.valor0 = 0 + self.precisao = 2 + self.precisao0 = 2 + self.editar() + def editar(self): + self.editando = True + def mostrar(self,i,inf = [10,0,0]): + super(Show, self).mostrarFrame(i,inf) + textSize(inf[0]) + self.nilo_code = 'Show ( \''+self.var+'\' , \''+self.texto+'\' )' + self.python_code = 'Frames().arquivos[Frames().n]['+str(self.frame)+'].valor = '+self.var + Interpretador().imprimeLinha(self.texto,20,20,self.editando) + with pushMatrix(): + inf = translada(tamanhoTexto(self.texto),0,inf) + with pushMatrix(): + if isinstance(self.valor,float): + self.valor = nfc(self.valor,self.precisao) + if pontoEmR([inf[1],inf[2]],[30+tamanhoTexto(str(self.valor))-5,0,10,10]): + self.mouse_em_cima_seta = True + else: + self.mouse_em_cima_seta = False + if not self.controlando and self.mouse_em_cima_seta and Interface().mouse_pressed: + self.controlando = True + self.x0 = mouseX + self.precisao0 = self.precisao + self.valor0 = self.valor + if not Interface().mouse_pressed: + self.controlando = False + if self.mouse_em_cima_seta: + fill(255) + else: + fill(125) + if self.controlando: + inf = translada(30+tamanhoTexto(str(self.valor0))+(mouseX-self.x0),0,inf) + fill(0,255,0) + self.precisao = int(self.precisao0 + round((mouseX-self.x0)/12.55)) + if self.precisao < 0: + self.precisao = 0 + else: + inf = translada(30+tamanhoTexto(str(self.valor)),0,inf) + triangle(0,+5,-5,0,+5,0) + # + Interpretador().imprimeLinha(str(self.valor),30,20) #sVirg(self.valor) + # + # +# diff --git a/sketch.properties b/sketch.properties new file mode 100644 index 0000000000000000000000000000000000000000..2456b0abf78a2d08b40f46a7b2dadcb001b3dbc4 --- /dev/null +++ b/sketch.properties @@ -0,0 +1,2 @@ +mode=Python +mode.id=jycessing.mode.PythonMode diff --git a/sys_biblioteca$py.class b/sys_biblioteca$py.class new file mode 100644 index 0000000000000000000000000000000000000000..e55f748cd36f1cfc22671f6363f35b93490a4127 Binary files /dev/null and b/sys_biblioteca$py.class differ diff --git a/sys_biblioteca.py b/sys_biblioteca.py new file mode 100644 index 0000000000000000000000000000000000000000..a5a47763bf3d6da2d753f3f7fcb2f78a8526508c --- /dev/null +++ b/sys_biblioteca.py @@ -0,0 +1,348 @@ +from sys_index import * +class Cores: + + branco = color(255) + preto = color(0,0,0) + vermelho = color(255, 0, 0) + laranja = color(255,127,0) + orange = color(255,127,0) + verde = color(0, 255, 0) + verde_real = color(60, 255, 0) + azul = color(0, 0, 255) + azul_CAD = color(19,0,79) + azul_claro_CAD = color(38,0,158) + azul_claro = color(0, 230, 250) + verde_claro = color(50, 250, 0) + verde_amarelado = color(160, 250, 0) + rosa = color(250, 100, 200) + roxo = color(180,30,130) + amarelo = color(250, 250, 0) + cinza_escuro = color(50, 50, 50) + cinza = color(150, 150, 150) + cinza_claro = color(200, 200, 200) + cinza_muito_claro = color(225, 225, 225) + cinza_azulado = color(60, 100, 130) +def Color(color_name): + if color_name == 'orange': + return color(255,127,0) +class Ponto3D: + def __init__(self,lista = [0,0,0]): + self.x=lista[0] + self.y=lista[1] + self.z=lista[2] + def mudaPontos(self,lista = [0,0,0]): + self.x=lista[0] + self.y=lista[1] + self.z=lista[2] +class Ponto2D: + def __init__(self,lista = [0,0]): + self.x=lista[0] + self.y=lista[1] + def mudaPontos(self,lista = [0,0]): + self.x=lista[0] + self.y=lista[1] + def x(self): + return self.x + def y(self): + return self.y + +class MenuCircular: + menus = [] + def __init__(self,subtipo,x,y,lista_opcoes,lista_tarefas = [],icone = []): + if lista_tarefas == []: + lista_tarefas = lista_opcoes + self.botoes = [] + for i in range(len(lista_opcoes)): + a = Botao('texto',0,0,'',lista_tarefas[i]) + a.texto = lista_tarefas[i] + self.botoes.append(a) + self.x = 0 + self.y = 0 + self.tam_x = 40 + self.tam_y = 40 + self.tam_x_pretendido = 40 + self.lista_opcoes = lista_opcoes + self.lista_tarefas = lista_tarefas + self.subtipo = subtipo # 'botoes texto' 'texto' e 'botoes texto rotativo' + self.expandido = False + self.icone = icone + def mudaXY(self,x,y): + self.x = x + self.y = y + def ajustaTamX(self): + if self.mouse_em_cima: + if self.subtipo == 'status': + if Frames().erro == '': + self.tam_x_pretendido = 150 + else: + self.tam_x_pretendido = 60 + textWidth(str(Frames().erro)) + else: + tamanho = 0 + textSize(20) + for opcao in self.lista_opcoes: + tamanho += textWidth(opcao)+20 + self.tam_x_pretendido = 40 + tamanho + else: + self.tam_x_pretendido = 40 + if self.tam_x == self.tam_x_pretendido and self.tam_x != 40: + self.expandido = True + else: + self.expandido = False + if self.tam_x > self.tam_x_pretendido: + self.tam_x -= (5 + int(self.tam_x-self.tam_x_pretendido)/2) + if self.tam_x < self.tam_x_pretendido: + self.tam_x = self.tam_x_pretendido + elif self.tam_x < self.tam_x_pretendido: + self.tam_x += ( 5 + int(self.tam_x_pretendido-self.tam_x)/2) + if self.tam_x > self.tam_x_pretendido: + self.tam_x = self.tam_x_pretendido + def mostrarLayout(self): + noStroke() + #noFill() + ellipse(self.x+20,height-25,40,40) + rect(self.x+20,height-45,self.tam_x-40,40) + ellipse(self.x+self.tam_x-20,height-25,40,40) + fill(Cores().preto) + ellipse(self.x+20,height-25,36,36) + rect(self.x+20,height-43,self.tam_x-40,36) + ellipse(self.x+self.tam_x-20,height-25,36,36) + def avaliaMouse(self): + if self.x < mouseX < self.x + self.tam_x and self.y < mouseY < self.y + self.tam_y: + self.mouse_em_cima = True + + else: + self.mouse_em_cima = False + + if self.mouse_em_cima: + for menu in MenuCircular.menus: + menu.clicado = False + fill(Cores().azul_claro,25) + else: + fill(Cores().branco,25) + def mostrarBotoes(self): + x = self.x + 40 + for botao in self.botoes: + botao.mudaXY(x,self.y) + botao.mostrar() + x += int(textWidth(botao.texto)) + 20 + def mostrarIcone(self): + image(self.icone,self.x+10,self.y+10,20,20) + def mostrar(self): + noStroke() + textSize(20) + self.avaliaMouse() + self.mostrarLayout() + if self.subtipo == 'status': + if Frames().erro == '': + fill(Cores().verde) + ellipse(25,height-25,25*sin(millis()),25*sin(millis())) + if self.expandido: + text('Running!',50,height-18) + else: + fill(Cores().vermelho) + ellipse(25,height-25,25,25) + if self.expandido: + text(Frames().erro,50,height-18) + if self.subtipo == 'plug-ins': + self.lista_opcoes = Data().listaPlugIns() + self.lista_tarefas = Data().listaPlugIns() + if self.subtipo == 'botoes texto' or self.subtipo == 'botoes texto rotativo' or self.subtipo == 'plug-ins': + if self.expandido: + self.mostrarBotoes() + self.mostrarIcone() + self.ajustaTamX() +class ListaLateral: + + def __init__(self,x,y): + self.x = x + self.y = y + self.inicial = '' + self.atual = '' + self.lista = [] + self.n = 0 + + self.mouse_em_cima_1 = False + self.mouse_em_cima_2 = False + self.pressionado_1 = False + self.pressionado_2 = False + + self.iniciado = False + def mudaXY(self,x,y): + self.x = x + self.y = y + + def mudaInicial(self,inicial): + + if not self.iniciado: + self.inicial = inicial + for i in range(self.nOf_itens): + if self.inicial == self.lista[a]: + self.n = a; + self.iniciado = True; + def carregaLista(self,listagem): + self.lista = [] + #carregar + if listagem == 'Geral,Fluido 1,Fluido 2,Calculo': + pass + # self.nOf_itens = FRAMES.FRAME_concentrico.lista_comum.length; + #for (int a=0; a<FRAMES.FRAME_concentrico.lista_comum.length; a++) { + #self.lista[a] = FRAMES.FRAME_concentrico.lista_comum[a]; + #} + + if listagem == 'moleculas': + pass + #self.nOf_itens = DATA.moleculas.length; + #for (int a=0; a<DATA.moleculas.length; a++) { + # self.lista[a] = DATA.moleculas[a]; + #} + if listagem == 'usuarios': + for i in range(len(Data().usuario)): + self.lista.append(Data().usuario[i][1]) + def indiceN(self): return self.n + def texto(self): return self.lista[self.n] + def mostrar(self): + stroke(150, 150, 150) + if Calculo().mouseInC([self.x, self.y-8],10): + self.mouse_em_cima_1 = True + fill(200+(mouseX%20), 200+(mouseY%20), 200+((mouseX+mouseY)%20)) + else: + self.mouse_em_cima_1 = False + fill(255, 255, 255) + if self.mouse_em_cima_1 and mousePressed: + self.pressionado_1 = True + elif self.pressionado_1: + self.n-=1 + if self.n < 0: + self.n = 0 + self.pressionado_1 = False + ellipse(self.x, self.y-8, 20, 20) + triangle(self.x-5, self.y-8, self.x+5, self.y-5, self.x+5, self.y-11) + if Calculo().mouseInC([self.x+230,self.y-8],10): + self.mouse_em_cima_2 = True + fill(200+(mouseX%20), 200+(mouseY%20), 200+((mouseX+mouseY)%20)) + else: + self.mouse_em_cima_2 = False + fill(Cores().branco) + if self.mouse_em_cima_2 and mousePressed: + self.pressionado_2 = True + elif self.pressionado_2: + self.n+=1 + if self.n > len(self.lista)-1: + self.n = len(self.lista)-1 + self.pressionado_2 = False + ellipse(self.x+230, self.y-8, 20, 20) + triangle(self.x+235, self.y-8, self.x+225, self.y-5, self.x+225, self.y-11) + fill(255, 255, 255) + rect(self.x+15, self.y-18, 200, 20, 10) + fill(150) + textSize(16) + text(str(self.lista[self.n]), float(self.x+20),float(self.y-1)) + +class CheckBox: + def __init__(self,x,y,texto = '',valor = False): + self.x = x + self.y = y + self.texto = texto + self.valor = valor + + self.mouse_em_cima = False + self.pressionado = False + def retornaValor(self): return self.valor + def mudaTexto(self,texto): self.texto = texto + def mudaXY(self,x,y): + self.x = x + self.y = y + def mostrar(self,): + fill(Cores().braco) + stroke(200, 200, 200) + rect(self.x, self.y, 10, 10) + textSize(10) + fill(Cores().preto) + text(self.texto, self.x+20, self.y+10); + if self.valor: + fill(Cores().verde) + ellipse(self.x+5, self.y+5, 4, 4) + if Calculo().mouseIn(self.x,self.y,10,10): + self.mouse_em_cima = True + else: + self.mouse_em_cima = False + if Interface.MouseClicked(): + if self.valor: + self.valor = False + else : + self.valor = True + if self.mouse_em_cima: + fill(0, 100,0 ) + ellipse(self.x+5, self.y+5, 4, 4) +class Botao: + def __init__(self,tipo,x,y,link_tarefa_a,link_tarefa_b): + self.tipo = tipo + self.x = x + self.y = y + self.link_tarefa_a = link_tarefa_a + self.link_tarefa_b = link_tarefa_b + self.tam_x = 10 + self.tam_y = 10 + self.texto = '' + self.mouse_em_cima = False + self.clicado = False + self.pressionado = False + def mudaXY(self,x,y): + self.x = x + self.y = y + def mudaTexto(self,texto): self.texto = texto + def retornaValor(self): + if self.pressionado: return True + else: return False + def mudaValor(self,valor = False):self.clicado = valor + def mudaTamanho(self,tam_x,tam_y): + self.tam_x = tam_x + self.tam_y = tam_y + def mostrar(self): + if self.tipo == 'menu': + if Calculo().mouseIn(self.x,self.y,self.tam_x,self.tam_y): + self.mouse_em_cima = True + fill(Cores().verde,100) + stroke(Cores().azul_claro) + rect(self.x, self.y, self.tam_x,self.tam_y, 15) + Tarefas().tarefa(self.link_tarefa_a) + else: + self.mouse_em_cima = False + fill(Cores().verde,50) + noStroke() + rect(self.x, self.y, self.tam_x,self.tam_y, 15) + if self.mouse_em_cima and Interface().MouseClicked(): + self.clicado = Calculo().switch(self.clicado) + Tarefas().tarefa(self.link_tarefa_b) + if self.clicado: + fill(Cores().verde,100) + stroke(Cores().azul_claro) + rect(self.x, self.y, self.tam_x,self.tam_y, 15) + Tarefas().tarefa(self.link_tarefa_b) + + fill(Cores().azul) + textSize(16) + text(self.texto, self.x+5, self.y+20) + elif self.tipo == 'texto': + textSize(20) + if mouseIn(self.x,self.y+8,textWidth(self.texto),20): + self.mouse_em_cima = True + fill(Cores().azul) + stroke(Cores().azul_claro) + text(self.texto, self.x, self.y+28) + Tarefas().tarefa(self.link_tarefa_a) + else: + self.mouse_em_cima = False + fill(Cores().azul_claro) + noStroke() + text(self.texto, self.x, self.y+28) + if self.mouse_em_cima and Interface().mouse_clicked: + Tarefas().tarefa(self.link_tarefa_b) + + + + + + + + diff --git a/sys_calculo$py.class b/sys_calculo$py.class new file mode 100644 index 0000000000000000000000000000000000000000..11576929123d8c58b8487756ea4edc6fe63c2cbc Binary files /dev/null and b/sys_calculo$py.class differ diff --git a/sys_calculo.py b/sys_calculo.py new file mode 100644 index 0000000000000000000000000000000000000000..934ef205bca80acfb55dbea998bb66fbea206ca5 --- /dev/null +++ b/sys_calculo.py @@ -0,0 +1,45 @@ +from sys_index import * + +def translada(x,y,inf = [10,0,0]): + translate(x,y) + return [inf[0],inf[1]-x,inf[2]-y] +def x(x=1366): + return float(x)*width/1366 +def y(y=768): + return float(y)*height/768 +def Dist(A=[0,0],B=[0,0]): + return sqrt(pow(A[0]-B[0],2)+pow(A[1]-B[1],2)) +def mouseIn(x0 = 0,y0 = 0,dx = 0,dy = 0): + if mouseX >= x0 and mouseX <= x0+dx and mouseY >= y0 and mouseY <= y0+dy: return True + else: return False +def pontoEmR(P = [0,0],R = [0,0,0,0]): + if P[0] >= R[0] and P[0] <= R[0]+R[2] and P[1] >= R[1] and P[1] <= R[1]+R[3]: return True + else: return False +def mouseInC(P = [0,0],raio = 0): + if sqrt(pow(mouseX - P[0],2) + pow(mouseY - P[1],2)) < raio : return True + else: return False +def pontoEmC(P = [0,0],O = [0,0],raio = 0): + if sqrt(pow(P[0] - O[0],2) + pow(P[1] - O[1],2)) < raio : return True + else: return False +def switch(booleano): + if booleano:return False + else:return True +def sVirg(texto): + texto = str(texto) + final = '' + for i in texto: + if i != ',': final+= i + return final +def tamanhoTexto(texto): + return textWidth(texto) + len(matchAll('\t'+texto,'\t'))*50 - 50 +def xParaPosicao(x,texto): + for i in range(len(texto)-1): + if x >= tamanhoTexto(texto[0:i])-2 and x < tamanhoTexto(texto[0:i+1])-2: + #print(texto,i,tamanhoTexto(texto[0:i])) + return [i,tamanhoTexto(texto[0:i])] + #print(texto,len(texto)-1,int(tamanhoTexto(texto))) + return [len(texto),int(tamanhoTexto(texto))] +def debug(tempo): + ini = millis() + while millis() - ini < tempo: + Frames().mostrar() diff --git a/sys_data$py.class b/sys_data$py.class new file mode 100644 index 0000000000000000000000000000000000000000..8a425770b8b282ba9ea0fa9cae1317a988150d00 Binary files /dev/null and b/sys_data$py.class differ diff --git a/sys_data.py b/sys_data.py new file mode 100644 index 0000000000000000000000000000000000000000..97ede87ff926e3be87d33b7674f04e74c842109b --- /dev/null +++ b/sys_data.py @@ -0,0 +1,103 @@ +from sys_index import * +import subprocess +class Data: + + contas_linhas = list() + contas_string = '' + + #contas: file + usuario = [] + senha_cripto = [] + objetos = [] + + def __init__(self): + #data.packages + self.objetos = [] + self.modulos = ['mod_basico'] + self.pacotes = [] + def rvgSample(self,rvg,x,y): + output = subprocess.check_output(['lua','data/lua/src/sample.lua','data/lua/src/png',rvg,str(x),str(y)],stderr=subprocess.STDOUT,shell=True) + lista = matchAll(output,'<sample>(.*?)</sample>') + b = split(lista[0][1],',') + return [int(b[0]),int(b[1]),int(b[2]),int(b[3])] + def retornaModulos(self): + return self.modulos + def obtem(self): + for modulo in self.modulos: + pass + def retornaStr(self,arquivo): + linhas = list() + linhas = loadStrings(arquivo) + if linhas is not None: + l = join(linhas,' ') + else: + l='' + return l + def importaCodigo(self,codigo): + import mod_basico + Interface().reset() + linhas = list() + linhas = loadStrings(codigo) + if not linhas is None: + Frames().arquivos[Frames().n] = [] + for i in range(len(linhas)): + Frames().arquivos[Frames().n].append(mod_basico.Linha(linhas[i])) + Interface().tmp_text = linhas[i] + Frames().seleciona(-1) + Frames().mostrar() + Interpretador().interpreta() + def listaPlugIns(self): + import glob + pre_lista = glob.glob("**/plug_ins/*.nlo") + lista = [] + for item in pre_lista: + lista.append(split(split(item,'plug_ins\\')[1],'.nlo')[0]) + return lista + def importaPlugIn(self,codigo,plug_in = 'noname'): + import mod_basico + linhas = list() + linhas = loadStrings(codigo) + print(plug_in,codigo,linhas) + Frames().plug_in = plug_in + Frames().deletaPlugIn(plug_in) + if not linhas is None: + for i in range(len(linhas)): + print('adicionando ' + linhas[i] +' ao plug-in '+plug_in) + Frames().arquivos[Frames().n].append(mod_basico.Linha(linhas[i])) + Frames().arquivos[Frames().n][-1].plug_in = plug_in + Interface().tmp_text = linhas[i] + Frames().seleciona(-1) + Frames().mostrar() + Frames().mostrar() + Frames().mostrar() + Interpretador().interpreta() + else: + print('adicionando vazio ') + Frames().arquivos[Frames().n].append(mod_basico.Linha('plug_in = \''+plug_in+'\'')) + Frames().arquivos[Frames().n][-1].plug_in = plug_in + Interface().tmp_text = 'plug_in = '+plug_in + Frames().seleciona(-1) + Frames().mostrar() + Frames().mostrar() + Frames().mostrar() + Interpretador().interpreta() + Frames().plug_in = '' + def exportaTexto(self,lista,nome = 'blanc.txt'): + saveStrings('/data/'+str(nome),lista) + def obtemModulos(self,pacote): + modulos_inf = self.retornaStr('/packages/'+pacote+'/__init__.py') + modulos_lista = matchAll(modulos_inf,'<mod>(.*?)</mod>') + for modulo in modulos_lista: + self.modulos.append(modulo[1]) + def obtemPacotes(self): + pacotes_inf = self.retornaStr('/meta_data/packages.inf') + pacotes_lista = matchAll(pacotes_inf,'<pkg>(.*?)</pkg>') + self.pacotes = [] + for pacote in pacotes_lista: + self.pacotes.append(pacote[1]) + self.obtemModulos(pacote[1]) + def anexaObjetos(self,novos_objetos): + self.objetos = list(set().union(self.objetos,novos_objetos)) + + +DATA = Data() diff --git a/sys_frames$py.class b/sys_frames$py.class new file mode 100644 index 0000000000000000000000000000000000000000..64224e73d424048403a4a09cfd3faca55544621f Binary files /dev/null and b/sys_frames$py.class differ diff --git a/sys_frames.py b/sys_frames.py new file mode 100644 index 0000000000000000000000000000000000000000..83f63d4085153c70d05fa996faf4566411687dbb --- /dev/null +++ b/sys_frames.py @@ -0,0 +1,304 @@ +from sys_index import * + +class Frames: + def __init__(self,nome = ''): + #print('here') + self.nome = nome + self.one_time = True + self.arquivos = [] + self.arquivos.append([]) + self.plug_in = '' + self.n = 0 + self.lista_objetos = [] + self.erro = '' + self.def_inf = [20,0,0] #o vetor informativo fornece aos objetos: [0] - tamanho da letra, [1] - mouseX relativo, [2] - mouseY relativo, [3] - normal ou refletido + self.arquivos[0].append(Linha()) + self.arquivos[0][0].nilo_code = 'file_name = ' + self.logo = loadImage('/images/logo.png') + self.file = loadImage('/images/file.png') + self.diretorio = loadImage('/images/folder.png') + self.objetos = loadImage('/images/objects.png') + self.adicionar = loadImage('/images/add.png') + self.tarefa_pergunta = '' + self.resposta = '' + self.pergunta = False + self.variaveis = [] + self.valores = [] + self.selecao_refletida = False + self.texto_copiado = '' + MenuCircular.menus.append(MenuCircular('status',0,0,[])) #status execucao + MenuCircular.menus.append(MenuCircular('botoes texto',0,0,['New Project','New File','Open','Save'],[],self.file)) #file + MenuCircular.menus.append(MenuCircular('botoes texto rotativo',0,0,[],[],self.diretorio)) #diretorio projeto + MenuCircular.menus.append(MenuCircular('botoes texto rotativo',0,0,['Bar','Button','Show','Plot','Box','PlugIn','Function','Table'],[],self.objetos)) #objetos pacote padrao + MenuCircular.menus.append(MenuCircular('plug-ins',0,0,Data().listaPlugIns(),[],self.adicionar)) #adicionar pacote + def actFrame(self): + return self.arquivos[self.n] + def sairEdicao(self): + for f in self.actFrame(): + f.editando = False + def niloCodeEditando(self): + for f in self.actFrame(): + if f.editando: + return f.nilo_code + def deletaLinhaAtual(self): + self.deletaLinha(self.frameEditando()) + def contaFrames(self,plug_in=''): + n=0 + for f in self.actFrame(): + if f.plug_in == plug_in: + n+=1 + return n + def deletaLinha(self,n): + if not n is None: + plug_in = self.plugInEditando() + self.actFrame().pop(n) + if self.contaFrames(plug_in) == 0: + self.criaLinha(plug_in) + else: + self.seleciona(n-1) + def layout(self): + for i in range(10): + noStroke() + fill(0,0,0,25*i) + rect(0,height-100+5*i,width,5) + fill(0,0,0) + rect(0,height-50,width,50) + image(self.logo,width - 215,height-40,200,200*(116.0/794)) + if self.pergunta: + fill(Cores().verde) + textSize(20) + if int(millis()/500)%2==0: + text('> '+Interface().tmp_text,20,height-15) + else: + text('> '+Interface().tmp_text+'|',20,height-15) + else: + x = 5 + y = height - 45 + for menu in MenuCircular.menus: + menu.mudaXY(x,y) + x += menu.tam_x + 5 + menu.mostrar() + def perguntar(self,texto_base = '', tarefa = ''): + self.sairEdicao() + Interface().tmp_text = texto_base + self.tarefa_pergunta = tarefa + self.pergunta = True + def perguntaFinalizada(self): + if self.pergunta: + self.pergunta = False + self.resposta = matchAll(Interface().tmp_text+'</tag>',': (.*?)</tag>')[0][1] + Tarefas().tarefa(self.tarefa_pergunta) + def retornaNome(self): + try: + nome = matchAll(self.actFrame()[0].nilo_code,'\'(.*?)\'')[0][1] + except BaseError: + nome = 'noname' + return nome + def retornaNVar(self,nome): + for i in range(len(self.variaveis)): + if self.variaveis[i] == nome: + return i + self.variaveis.append(nome) + return len(self.variaveis)-1 + def seleciona(self, frame): + self.sairEdicao() + self.actFrame()[frame].editar() + #Interface().tmp_text = self.ActFrame()[frame].texto + def objetoFrameEditando(self): + for i in range(len(self.actFrame())): + if self.actFrame()[i].editando: + return self.actFrame()[i] + def frameEditando(self): + for i in range(len(self.actFrame())): + if self.actFrame()[i].editando: + return i + def frameMouse(self): + for i in range(len(self.actFrame())): + if self.actFrame()[i].mouse_dentro: + return i + return len(self.actFrame())-1 + def deletaPlugIn(self,plug_in = ''): + for i in range(len(self.actFrame())): + if self.actFrame()[i].plug_in == plug_in: + self.actFrame()[i].plug_in = 'moved_to_nowhere' + def plugInEditando(self): + return self.objetoFrameEditando().plug_in + def criaLinha(self,plug_in=''): + k = self.frameEditando() + if k is None: + k = -1 + self.actFrame().insert(k+1,Linha()) + self.actFrame()[k+1].plug_in = plug_in + for i in range(len(self.actFrame())): + self.actFrame()[i].numero=i + self.seleciona(k+1) + Interface().tmp_text ='' + def mostrarFrames(self): + contador_y = 0 + with pushMatrix(): + translate(5,Interface().scroll_1) + self.def_inf[1] = 5 + self.def_inf[2] = Interface().scroll_1 + for i in range(len(self.actFrame())): + f = self.actFrame()[i] + inf = [self.def_inf[0],0,0,self.def_inf[1],self.def_inf[2]] + inf[1] = mouseX - self.def_inf[1] + inf[2] = mouseY - self.def_inf[2] + if f.plug_in == '': + if not f.sobreposicao: + f.mostrar(i,inf) + translate(0,f.tam_y) + contador_y += f.tam_y + stroke(Cores().branco) + self.def_inf[2]+=f.tam_y + if f.editando: + if (contador_y + Interface().scroll_1) >= height -50: + Interface().scroll_1 -= 25 + elif (contador_y + Interface().scroll_1) <= 0: + Interface().scroll_1 += 25 + def mostrarObjetos(self): + for objeto in self.lista_objetos: + objeto.mostrar() + def mostrarFramesSobreposicao(self): + contador_y = 0 + with pushMatrix(): + translate(5,Interface().scroll_1) + self.def_inf[1] = 5 + self.def_inf[2] = Interface().scroll_1 + for i in range(len(self.actFrame())): + f = self.actFrame()[i] + if f.plug_in == '': + inf = [self.def_inf[0],0,0,self.def_inf[1],self.def_inf[2]] + inf[1] = mouseX - self.def_inf[1] + inf[2] = mouseY - self.def_inf[2] + if f.sobreposicao: + f.mostrar(i,inf) + translate(0,f.tam_y) + contador_y += f.tam_y + stroke(Cores().branco) + self.def_inf[2]+=f.tam_y + if f.editando: + if (contador_y + Interface().scroll_1) >= height -50: + Interface().scroll_1 -= 25 + elif (contador_y + Interface().scroll_1) <= 0: + Interface().scroll_1 += 25 + def yLinha(self,linha): + y = Interface().scroll_1 + for i in range(0,linha): + y += self.actFrame()[i].tam_y + return y + def textoSelecionado(self,apagar=False): + texto = '' + l_ini = Interface().selecao_linha_inicial + l_fim = Interface().selecao_linha_final + ini = Interface().selecao_posicao_inicial + fim = Interface().selecao_posicao_final + if l_ini > l_fim or l_ini == l_fim and ini > fim: #switch + s = l_ini + t = ini + l_ini = l_fim + ini = fim + l_fim = s + fim = t + if Interface().selecionado: + if l_ini == l_fim: + texto += self.actFrame()[l_ini].textbox.retornaTexto()[ini:fim] + if apagar: + if self.frameEditando() == l_ini: + Interface().tmp_text = self.actFrame()[l_ini].textbox.retornaTexto()[:ini]+self.actFrame()[l_ini].textbox.retornaTexto()[fim:] + else: + self.actFrame()[l_ini].textbox.mudaTexto(self.actFrame()[l_ini].textbox.retornaTexto()[:ini]+self.actFrame()[l_ini].textbox.retornaTexto()[fim:]) + else: + texto += self.actFrame()[l_ini].textbox.retornaTexto()[ini:] + for linha in range(l_ini+1,l_fim): + texto += self.actFrame()[linha].textbox.retornaTexto() + texto += self.actFrame()[l_fim].textbox.retornaTexto()[:fim] + if apagar: + if self.frameEditando() == l_ini: + Interface().tmp_text = self.actFrame()[l_ini].textbox.retornaTexto()[:ini] + else: + self.actFrame()[l_ini].textbox.mudaTexto(self.actFrame()[l_ini].textbox.retornaTexto()[:ini]) + if self.frameEditando() == l_fim: + Interface().tmp_text = self.actFrame()[l_fim].textbox.retornaTexto()[fim:] + else: + self.actFrame()[l_fim].textbox.mudaTexto(self.actFrame()[l_fim].textbox.retornaTexto()[fim:]) + for i in range(l_ini+1,l_fim): + self.deletaLinha(i) + return texto + def textoMouse(self): + if type(self.actFrame()[self.frameMouse()]) is Linha: + return self.actFrame()[self.frameMouse()].textbox.retornaTexto() + else: + return '' + def mostrarFramesAdjacentes(self): + with pushMatrix(): + translate(width/2+5,Interface().scroll_2) + self.def_inf[1] = width/2+5 + self.def_inf[2] = Interface().scroll_2 + if self.plug_in == '': + for i in range(len(self.actFrame())): + f = self.actFrame()[i] + if f.refletido: + inf = [self.def_inf[0],0,0,self.def_inf[1],self.def_inf[2]] + inf[1] = mouseX - self.def_inf[1] + inf[2] = mouseY - self.def_inf[2] + f.mostrar(i,inf) + translate(0,f.tam_y) + stroke(Cores().branco) + self.def_inf[2]+=f.tam_y + else: + for i in range(len(self.actFrame())): + f = self.actFrame()[i] + if f.plug_in == self.plug_in: + inf = [self.def_inf[0],0,0,self.def_inf[1],self.def_inf[2]] + inf[1] = mouseX - self.def_inf[1] + inf[2] = mouseY - self.def_inf[2] + f.mostrar(i,inf) + translate(0,f.tam_y) + stroke(Cores().branco) + self.def_inf[2]+=f.tam_y + def mostrarSelecao(self): + l_ini = Interface().selecao_linha_inicial + l_fim = Interface().selecao_linha_final + ini = Interface().selecao_inicial + fim = Interface().selecao_final + if l_ini > l_fim: #switch + s = l_ini + t = ini + l_ini = l_fim + ini = fim + l_fim = s + fim = t + if Interface().selecionado: + fill(Cores().azul_claro,50) + #stroke(Cores().azul_claro) + noStroke() + strokeWeight(1) + if l_ini == l_fim and ini != fim: + with pushMatrix(): + translate(0,self.yLinha(l_ini)) + rect(ini,0,fim-ini,25) + elif l_ini != l_fim: + with pushMatrix(): + translate(0,self.yLinha(l_ini)) + rect(ini,0,width/2-ini,25) + for i in range(l_ini+1,l_fim): + with pushMatrix(): + translate(0,self.yLinha(i)) + rect(25,0,width/2-25,25) + with pushMatrix(): + translate(0,self.yLinha(l_fim)) + rect(25,0,fim-25,25) + def colocaTmpText(self): + for frame in self.actFrame(): + if frame.editando: + frame.texto = Interface().tmp_text + def mostrar(self): + background(Cores().preto) + self.mostrarFrames() + self.mostrarFramesAdjacentes() + self.mostrarFramesSobreposicao() + self.mostrarSelecao() + self.mostrarObjetos() + self.layout() +FRAMES = Frames() diff --git a/sys_index$py.class b/sys_index$py.class new file mode 100644 index 0000000000000000000000000000000000000000..00635597ab306e0ea75dd8da95ededbccef51fc9 Binary files /dev/null and b/sys_index$py.class differ diff --git a/sys_index.py b/sys_index.py new file mode 100644 index 0000000000000000000000000000000000000000..978a0e9e3cc5ffc7ea7f584646aa0d9efa1877f5 --- /dev/null +++ b/sys_index.py @@ -0,0 +1,37 @@ +#CARREGA MODULOS DINAMICOS +def Data(): + import sys_data + return sys_data.DATA +def Tarefas(): + import sys_tarefas + return sys_tarefas.TAREFAS +def Frames(): + import sys_frames + return sys_frames.FRAMES +def Interface(): + import sys_interface + return sys_interface.INTERFACE +def Interpretador(): + import sys_interpretador + return sys_interpretador.INTERPRETADOR + +#CARREGA MODULOS ESTATICOS +from math import * +from gc import * +from sys_calculo import * +from sys_biblioteca import * +from threading import * +#from mod_arduino import * #gambiarra aqui +#CARREGA PACOTES +modulos = Data().retornaModulos() +for modulo in modulos: + exec('from '+modulo+' import *') + exec('Data().anexaObjetos(lista_objetos)') + + + + + + + + diff --git a/sys_interface$py.class b/sys_interface$py.class new file mode 100644 index 0000000000000000000000000000000000000000..609bc1223ff4af9c05bc0c797ba6890f17163c5f Binary files /dev/null and b/sys_interface$py.class differ diff --git a/sys_interface.pde b/sys_interface.pde deleted file mode 100644 index 159757c213161d598c662ef1a3981c9f6c0ea919..0000000000000000000000000000000000000000 --- a/sys_interface.pde +++ /dev/null @@ -1,96 +0,0 @@ -Interface INTERFACE = new Interface(); -class Interface { - - String tmp_text=""; - float valor_scroll = -30.0; - float valor_setas = 0; - - float rotacao_z = 0.0; - - int x_ref = 0; - int y_ref = 0; - int x_relativo = 0; - int y_relativo = 0; - - boolean mouse_clicked = false; - - Interface() { - - } - void Referencia() { - - rotateZ(INTERFACE.rotacao_z); - translate(INTERFACE.x_relativo, INTERFACE.y_relativo, INTERFACE.valor_scroll*10); - } - void ScrollPlus() { - valor_scroll++; - if(valor_scroll>0){valor_scroll = 0;} - } - void ScrollMinus() { - valor_scroll--; - if(valor_scroll<-50){valor_scroll = -50;} - - } - void DeletaString() { - this.tmp_text=""; - } - String RetornaString() { - return this.tmp_text; - } - float RetornaScroll() { - return this.valor_scroll; - } - void ZeraScroll() { - this.valor_scroll = 0; - } - void VerificaCodigo(String codigo) { - } -} -void keyPressed() { - //Geral - //Especifico - if ((key>='a'&&key<='z')||key==' '||key=='.'||(key>='A'&&key<='Z')||(key>='0'&&key<='9')||key=='ç'||key=='!'||key=='?') { - INTERFACE.tmp_text += str(key); - TAREFAS.TarefaLetra(key); - } - if (keyCode == DOWN) { - TAREFAS.TarefaCodigo("BAIXO"); - } else if (keyCode == LEFT) { - TAREFAS.TarefaCodigo("ESQUERDA"); - } else if (keyCode == RIGHT) { - TAREFAS.TarefaCodigo("DIREITA"); - } else if (keyCode == UP) { - TAREFAS.TarefaCodigo("CIMA"); - } else if (keyCode == ENTER) { - TAREFAS.TarefaCodigo("ENTER"); - } - if (key==DELETE) { - INTERFACE.DeletaString(); - } - if (key==BACKSPACE) { - if (INTERFACE.tmp_text.length() > 0) { - INTERFACE.tmp_text = INTERFACE.tmp_text.substring(0, INTERFACE.tmp_text.length() - 1); - } - } -} -void mousePressed() { - TAREFAS.TarefaCodigo("MOUSEPRESSED"); -} -void mouseDragged() { - TAREFAS.TarefaCodigo("MOUSEDRAGGED"); -} -void mouseClicked() { - - INTERFACE.mouse_clicked = true; - TAREFAS.TarefaCodigo("MOUSECLICKED"); -} - -void mouseWheel(MouseEvent event) { - float e = event.getCount(); - if (e>0) { - //println(mouseX+" "+mouseY); - INTERFACE.ScrollPlus(); - } else { - INTERFACE.ScrollMinus(); - } -} \ No newline at end of file diff --git a/sys_interface.py b/sys_interface.py new file mode 100644 index 0000000000000000000000000000000000000000..954f08d12f14ae62ef4ce4d741d879e0ea8d90d8 --- /dev/null +++ b/sys_interface.py @@ -0,0 +1,81 @@ +from sys_index import * + +class Interface: + def __init__(self): + self.tmp_text = '' + self.tempo_ultima_tecla = -50000 + self.scroll_1 = 0 + self.scroll_2 = 0 + self.x_ref = 0 + self.y_ref = 0 + self.x_relativo = 0 + self.y_relativo = 0 + + self.selecionado = False + self.selecao_inicial = 0 + self.selecao_linha_inicial = 0 + self.selecao_linha_final = 0 + self.selecao_posicao_inicial = 0 + self.selecao_posicao_final = 0 + self.selecao_final = 0 + + self.cursor_x = 0 + self.cursor_letra = 0 + self.cursor_max = 0 + + self.deltaX = 0 + self.deltaY = 0 + + self.mouse_clicked = False + self.mouse_pressed = False + self.mouse_lado = 'direita' + self.botao_mouse = '' + + self.algo_aconteceu = False + def actTempoTecla(self): + self.tempo_ultima_tecla = millis() + def tempoTecla(self): + return self.tempo_ultima_tecla + def scroll(self,x): + if x>0: + if mouseX <= width/2: + self.scroll_1 += 25 + if self.scroll_1 > 0: + self.scroll_1 = 0 + else: + self.scroll_2 += 25 + if self.scroll_2 > 0: + self.scroll_2 = 0 + else: + if mouseX <= width/2: + self.scroll_1 -= 25 + else: + self.scroll_2 -= 25 + def Cursor(self,mouse_x = -1): + if mouse_x == -1: + mouse_x = mouseX -25 + self.cursor_x = xParaPosicao(mouse_x,self.tmp_text)[1]+5 + self.cursor_letra = xParaPosicao(mouse_x,self.tmp_text)[0] + def reset(self): + self.mouse_clicked = False + self.algo_aconteceu = False + self.deltaX = 0 + self.deltaY = 0 + def backspace(self): + if self.cursor_letra > 0: + self.cursor_letra -=1 + self.tmp_text = self.tmp_text[0:self.cursor_letra]+self.tmp_text[self.cursor_letra+1:] + elif self.cursor_letra == 0: + Frames().deletaLinhaAtual() + def delete(self): + self.tmp_text = self.tmp_text[0:self.cursor_letra]+self.tmp_text[self.cursor_letra+1:] + def zeraScroll(self): + self.valor_scroll = 0 + def palavrasChave(self): + if self.tmp_text == 'projeto': + Frames().frame_quadriculado.MudaPontos([[43.13,477.89],[104.00,569.97],[432.34,228.68],[615.07,85.91],[440.13,661.23],[588.14,392.53],[885.73,752.85],[64.18,319.32],[8.47,305.84],[903.42,237.31]]) + elif self.tmp_text == 'faruk': + pass +INTERFACE = Interface() + + diff --git a/sys_interpretador$py.class b/sys_interpretador$py.class new file mode 100644 index 0000000000000000000000000000000000000000..dbecccff7804c158b4095689d5b1ee740b7429f7 Binary files /dev/null and b/sys_interpretador$py.class differ diff --git a/sys_interpretador.py b/sys_interpretador.py new file mode 100644 index 0000000000000000000000000000000000000000..c75accb2f498e5c0ec306056d1d7143819d24e9c --- /dev/null +++ b/sys_interpretador.py @@ -0,0 +1,255 @@ +from sys_index import * +import keyword +import __builtin__ + +class VAR_bool: + def __init__(self,x = False): + self.x = x + +class Interpretador: + #PROCESSA OPERACOES + #REALIZA ATRIBUICAO, COMPARACAO OU DEFINICAO + + def __init__(self): + self.ultimo_tempo_arquivos = 0 + def interpreta(self): + if millis() - self.ultimo_tempo_arquivos > 1000: + self.exportaCodigosAutoInicio() + self.ultimo_tempo_arquivos = millis() + try: + exec self.pythonCode() in globals() + Frames().erro = '' + except BaseException as err: + Frames().erro = str(err) + def roda(self,linha): + lista = split('\t'+linha,'\t') + if not lista is None and lista != []: + linha = lista[len(lista)-1] + linha = linha.strip(' ') + try: + exec linha in globals() + except SyntaxError as err: + #print(err) + pass + except Exception as err: + #print(err) + pass + else: + return 0 + def normaliza(self,linha): + lista = self.lista(linha,True) + linha = '' + for i in lista: + linha += str(i) + return linha + def lista(self, linha = '',debug = False): + palavras = [] + palavra_atual = '' + for letra in linha: + if letra in '><+-*/=#(),: ': + if palavra_atual != '': + palavras.append(palavra_atual) + palavras.append(letra) + palavra_atual = '' + else: + palavra_atual += letra + if palavra_atual != '': + palavras.append(palavra_atual) + print(palavras) + return palavras + def colore(self,n): + if n == 0: + fill(Cores().cinza) + elif n == 1: + fill(Cores().amarelo) + elif n == 2: + fill(Cores().branco) + elif n == 3: + fill(Cores().roxo) + elif n == 4: + fill(Cores().branco) + if n == 5: + fill(Cores().branco)#laranja + elif n == 6: + fill(Cores().verde_amarelado) + elif n == 7: + fill(Cores().rosa) + elif n == 8: + translate(50,0) + elif n == 10: + fill(Cores().vermelho) + elif n == 11: + fill(Cores().azul_claro) + def parametros(self,texto): + parametros = matchAll(texto,'\((.*?)\)')[0][1] + lista = split(parametros,',') + lista_2 = [] + for item in lista: + try: + item_2 = float(item) + except ValueError: + item_2 = item + lista_2.append(item_2) + return lista_2 + def modificaVariaveis(self,lista): + n_var = 0 + for i in range(len(lista)): + if lista[i][1] == 1: + n = Frames().retornaNVar(lista[i][0]) + lista[i][0] = 'nlo_'+str(n) + return lista + def compilaTexto(self,lista): + texto = '' + for item in lista: + if item[0] != '\n': + texto+=str(item[0]) + else: + texto+=str(item[0]) + return texto + def niloCode(self): + reconhecida_nilo = [] + for f in Frames().actFrame(): + if f.plug_in == '': + listinha_nilo = self.lista(f.nilo_code) + reconhecidinha_nilo = self.reconhece(listinha_nilo) + for item in reconhecidinha_nilo: + reconhecida_nilo.append(item) + reconhecida_nilo.append(['\n',8]) + try: + reconhecida_nilo.pop() + except BaseException: + pass + return self.compilaTexto(reconhecida_nilo) + def niloCodePlugIn(self,plug_in = 'noname'): + reconhecida_nilo = [] + for f in Frames().actFrame(): + if f.plug_in == plug_in: + listinha_nilo = self.lista(f.nilo_code) + reconhecidinha_nilo = self.reconhece(listinha_nilo) + for item in reconhecidinha_nilo: + reconhecida_nilo.append(item) + reconhecida_nilo.append(['\n',8]) + try: + reconhecida_nilo.pop() + except BaseException: + pass + return self.compilaTexto(reconhecida_nilo) + def pythonCode(self): + reconhecida = [] + for frame in Frames().actFrame(): + if frame.plug_in == '': + listinha = self.lista(frame.python_code) + reconhecidinha = self.reconhece(listinha) + for item in reconhecidinha: + if item[1] == 10: #unidade + reconhecida.append([self.converteUnidades(item[0]),10]) + else: + reconhecida.append(item) + reconhecida.append(['\n',8]) + return self.compilaTexto(reconhecida) + def pythonCodePlugIn(self,plug_in = 'noname'): + reconhecida = [] + for frame in Frames().actFrame(): + if frame.plug_in == plug_in: + listinha = self.lista('\t'+frame.python_code) + reconhecidinha = self.reconhece(listinha) + for item in reconhecidinha: + if item[1] == 10: #unidade + reconhecida.append([self.converteUnidades(item[0]),10]) + else: + reconhecida.append(item) + reconhecida.append(['\n',8]) + return self.compilaTexto(reconhecida) + def converteUnidades(self,unidade = 'mm'): + #'mm','lb','km/h','in','ft','yd','mi','Btu','hp','mph','oz','ton','kN','psi' + if unidade == 'mm': + return '*pow(10,-3)' + elif unidade == 'lb': + return '*0.453592' + elif unidade == 'km/h': + return '/3.6' + elif unidade == 'in': + return '*0.0254' + elif unidade == 'ft': + return '*0.3048' + elif unidade == 'yd': + return '*0.9144' + elif unidade == 'mi': + return '*1604000' + elif unidade == 'Btu': + return '*1055' + elif unidade == 'hp': + return '*745.7' + elif unidade == 'mph': + return '*1609/3600' + elif unidade == 'oz': + return '*0.02835' + elif unidade == 'ton': + return '*1000' + elif unidade == 'kN': + return '*1000' + elif unidade == 'psi': + return '*6897.1167' + else: + return unidade + def exportaCodigosAutoInicio(self): + Data().exportaTexto([self.niloCode()],'meta_data/nilo_code.nlo') + Data().exportaTexto([self.pythonCode()],'meta_data/python_code.nlo') + def reconhece(self,lista): + reconhecida = [] #0-comentario,1-variavel,2-sintaxe,3-funcoes,4-constantes,5-operacoes/comparacoes,6-valor,7-objetos,8-tab,9-espaco,10-unidade,11-processing + comentario = False + for item in lista: + if item == '#': + comentario = True + if comentario: + reconhecida.append([item,0]) + else: + if item == ' ': + reconhecida.append([item,9]) + elif item in ['mm','lb','km/h','in','ft','yd','mi','Btu','hp','mph','oz','ton','kN','psi']: + reconhecida.append([item,10]) + elif item == '\t': + reconhecida.append([item,8]) + elif item in ['+','-','*','/','+=','-=','*=','/=','=','>=','<=','==','<','>',':',',']: + reconhecida.append([item,5]) + elif item in ['A0','A1','A2','A3','A4','PI']: + reconhecida.append([item,4]) + elif item in ['[',']','(',')']: + reconhecida.append([item,2]) + elif item in item in keyword.kwlist: + reconhecida.append([item,3]) + elif item in dir(__builtin__): + reconhecida.append([item,11]) + elif item in Data().objetos: + reconhecida.append([item,7]) + else: + try: + val = float(item) + reconhecida.append([item,6]) + except ValueError: + if matchAll(item,'\'(.*?)\'') != None or matchAll(item,'\"(.*?)\"') != None: + reconhecida.append([item,6]) + else: + reconhecida.append([item,1]) + return reconhecida + def imprimeLinha(self,linha,x = 0,y = 0, editando = False): + #Lista, Reconhece, Imprime + pushMatrix() + translate(x,y) + pushMatrix() + lista = self.lista(linha) + reconhecida = self.reconhece(lista) + for i in range(len(reconhecida)): + self.colore(reconhecida[i][1]) + text(reconhecida[i][0],0,0) + translate(textWidth(reconhecida[i][0]),0) + if reconhecida[i][1] == 7: + Interpretador().roda(linha) + popMatrix() + if editando and int(millis()/500)%2==0: + fill(Cores().branco) + l = Interface().cursor_letra + text('|',tamanhoTexto(Interface().tmp_text[0:l])-3,0) + popMatrix() + +INTERPRETADOR = Interpretador() diff --git a/sys_objetos_padrao.pde b/sys_objetos_padrao.pde deleted file mode 100644 index 2dc859a0a77ba6ce0b1039a972c5f69a12d400ed..0000000000000000000000000000000000000000 --- a/sys_objetos_padrao.pde +++ /dev/null @@ -1,2 +0,0 @@ -class Tela: - void Mostrar: \ No newline at end of file diff --git a/sys_tarefas$py.class b/sys_tarefas$py.class new file mode 100644 index 0000000000000000000000000000000000000000..0a6d0ce9b0d3715950865d06a55231ada50dfd4b Binary files /dev/null and b/sys_tarefas$py.class differ diff --git a/sys_tarefas.pde b/sys_tarefas.pde deleted file mode 100644 index a8d02449b6e84ba0c4b236db8bcb39bdf87abcba..0000000000000000000000000000000000000000 --- a/sys_tarefas.pde +++ /dev/null @@ -1,88 +0,0 @@ -Tarefas TAREFAS = new Tarefas(); - -class Tarefas { - - //Vetor Tarefa por Letra e Codigo - String[] tarefa_letra = new String[512]; - String[] tarefa_codigo = new String[512]; - String[] codigo = new String[512]; - int indice_codigo = 0; - //Inicialização - Tarefas() { - for (int a = 0; a < this.tarefa_letra.length; a++) { - - this.tarefa_letra[a] = ""; - this.tarefa_codigo[a] = ""; - this.codigo[a]= ""; - } - } - - //Função Tarefa - - void AlteraTarefaLetra(String tarefa, char letra) { - - this.tarefa_letra[int(letra)] = tarefa; - } - void AlteraTarefaCodigo(String tarefa, String n_codigo) { - - this.tarefa_codigo[this.indice_codigo] = tarefa; - this.codigo[this.indice_codigo] = n_codigo; - this.indice_codigo++; - } - void Tarefa(String tarefa) { - if (tarefa == "") { - //Livre Execução - } - if (tarefa == "Ativa Frame Mapa") { - FRAMES.AtivaFrame(500); - } - if (tarefa == "Ativa Frame Base") { - FRAMES.AtivaFrame(0); - } - if (tarefa == "Estabelece Referência") { - INTERFACE.x_ref=mouseX; - INTERFACE.y_ref=mouseY; - } - if (tarefa == "Estabelece Arraste Mouse") { - INTERFACE.x_relativo+=(mouseX-INTERFACE.x_ref); - INTERFACE.y_relativo+=(mouseY-INTERFACE.y_ref); - INTERFACE.x_ref=mouseX; - INTERFACE.y_ref=mouseY; - } - if (tarefa == "Rotacionar Sentido Anti-horario") { - INTERFACE.rotacao_z -= PI/18; - } - if (tarefa == "Rotacionar Sentido Horario") { - INTERFACE.rotacao_z += PI/18; - } - if (tarefa == "CIMA - Bloco de Mapa") { - if (MAPA.bloco_y != 0) { - MAPA.bloco_y--; - } - } - if (tarefa == "Retorna Slide") { - FRAMES.FRAME_Base.frame_atual--; - } - if (tarefa == "BAIXO - Bloco de Mapa") { - if (MAPA.bloco_y != MAP_MAX/50 - 1) { - MAPA.bloco_y++; - } - } - if (tarefa == "Avanca Slide") { - FRAMES.FRAME_Base.frame_atual++; - - } - } - void TarefaLetra(char letra) { - //println(int(letra)); - this.Tarefa(this.tarefa_letra[int(letra)]); - } - - void TarefaCodigo(String texto) { - for (int a = 0; a<256; a++) { - if (this.codigo[a] == texto) { - this.Tarefa(this.tarefa_codigo[a]); - } - } - } -} \ No newline at end of file diff --git a/sys_tarefas.py b/sys_tarefas.py new file mode 100644 index 0000000000000000000000000000000000000000..9f30a75f01ed9c759d1994b48afa60a364ffd31e --- /dev/null +++ b/sys_tarefas.py @@ -0,0 +1,151 @@ +from sys_index import * + +class Tarefas: + def __init__(self): + #Vetor Tarefa por Letra e Codigo + self.tarefa_letra = [] + self.tarefa_codigo = [] + self.codigo = [] + self.indice_codigo = 0 + for i in range(512): + self.tarefa_letra.append('') + self.tarefa_codigo.append('') + self.codigo.append('') + + #Funcao Tarefa + def alteraTarefaLetra(self,tarefa,letra): + self.tarefa_letra[int(ord(letra))] = tarefa + def alteraTarefaCodigo(self,tarefa,codigo): + self.tarefa_codigo[self.indice_codigo] = tarefa + self.codigo[self.indice_codigo] = codigo + self.indice_codigo+=1 + def tarefa(self,tarefa): + if tarefa == '': + pass + elif tarefa == 'Ativa Selecao Refletida': + Frames().selecao_refletida = True + Frames().sairEdicao() + elif tarefa == 'Desativa Selecao Refletida': + Frames().selecao_refletida = False + elif tarefa == 'Processa Enter': + if not Frames().frameEditando() is None: + plug_in = Frames().plugInEditando() + Frames().criaLinha(plug_in) + if Interface().cursor_letra > len(Interface().tmp_text): + Interface().cursor_letra = len(Interface().tmp_text) + Interface().cursor_x = tamanhoTexto(Interface().tmp_text) + else: + Frames().perguntaFinalizada() + elif tarefa == 'Escapa do limbo': + Frames().sairEdicao() + elif tarefa == 'Tabula': + Interface().tmp_text = Interface().tmp_text[0:Interface().cursor_letra] +'\t '+ Interface().tmp_text[Interface().cursor_letra:] + Interface().cursor_x += 50 + Interface().cursor_letra+=2 + elif tarefa == 'Desativa Frame Menu': + Frames().desativaFrame(3) + elif tarefa == 'Pula Inicio': + Frames().desativaFrame(0) + Frames().ativaFrame(1) + elif tarefa == 'Processa Scroll Up': + #Frames().sairEdicao() + try: + Frames().arquivos[Frames().n][Frames().frameEditando()].scroll(1) + except BaseException as err: + print(err) + Interface().scroll(1) + elif tarefa == 'Processa Scroll Down': + #Frames().sairEdicao() + try: + Frames().arquivos[Frames().n][Frames().frameEditando()].scroll(-1) + except BaseException: + Interface().scroll(-1) + elif tarefa == 'Processa Esquerda': + if Interface().cursor_letra > 0: + Interface().cursor_letra-=1 + elif tarefa == 'Processa Cima': + if Frames().frameEditando() >= 1: + Frames().seleciona(Frames().frameEditando()-1) + if Interface().cursor_letra > len(Interface().tmp_text): + Interface().cursor_letra = len(Interface().tmp_text) + Interface().cursor_x = tamanhoTexto(Interface().tmp_text) + elif tarefa == 'Processa Direita': + if Interface().cursor_letra < len(Interface().tmp_text): + Interface().cursor_letra+=1 + Interface().cursor_x += tamanhoTexto(Interface().tmp_text[Interface().cursor_letra-1]) + elif tarefa == 'Save': + Frames().perguntar('Enter the file name: '+Frames().retornaNome(),'Finaliza Salvar') + elif tarefa == 'Finaliza Salvar': + Data().exportaTexto([Interpretador().niloCode()],'saves/'+Frames().resposta+'.nlo') + elif tarefa == 'Open': + Frames().perguntar('Enter the file name: ','Finaliza Abrir') + elif tarefa == 'Finaliza Abrir': + Data().importaCodigo('/saves/'+Frames().resposta+'.nlo') + elif tarefa == 'New Project': + Data().importaCodigo('/meta_data/default_code.nlo') + elif tarefa == 'Processa Baixo': + if not Frames().frameEditando() is None: + if Frames().frameEditando() < len(Frames().actFrame())-1 : + Frames().seleciona(Frames().frameEditando()+1) + if Interface().cursor_letra > len(Interface().tmp_text): + Interface().cursor_letra = len(Interface().tmp_text) + Interface().cursor_x = tamanhoTexto(Interface().tmp_text) + elif tarefa == 'Processa MouseDragged': + #print('dragged') + Interface().selecionado = True + Interface().selecao_final = xParaPosicao(mouseX-25,Frames().textoMouse())[1]+25 + Interface().selecao_linha_final = Frames().frameMouse() + Interface().deltaX = mouseX - pmouseX + Interface().deltaY = mouseY - pmouseY + elif tarefa == 'Processa MouseClicked': + #print('cliked') + Interface().mouse_clicked = True + Interface().cursor_x = mouseX + Interface().botao_mouse = mouseButton + elif tarefa == 'Processa MousePressed': + #print('pressed') + Interface().mouse_pressed = True + #if Frames().lista_frames[Frames().FrameMouse()].classe != 'Barra': + Interface().selecionado = False + Interface().selecao_posicao_inicial = xParaPosicao(mouseX-25,Frames().textoMouse())[0] + Interface().selecao_inicial = xParaPosicao(mouseX-25,Frames().textoMouse())[1]+25 + Interface().selecao_linha_inicial = Frames().frameMouse() + elif tarefa == 'Processa MouseReleased': + #print('released') + Interface().mouse_pressed = False + Interface().selecionado = True + Interface().selecao_posicao_final = xParaPosicao(mouseX-25,Frames().textoMouse())[0] + Interface().selecao_final = xParaPosicao(mouseX-25,Frames().textoMouse())[1]+25 + Interface().selecao_linha_final = Frames().frameMouse() + elif tarefa == 'Bar': + Interface().tmp_text = Interface().tmp_text[0:Interface().cursor_letra] +'Bar(0,1'+ Interface().tmp_text[Interface().cursor_letra:] + elif tarefa == 'Button': + Interface().tmp_text = Interface().tmp_text[0:Interface().cursor_letra] +'Button('+ Interface().tmp_text[Interface().cursor_letra:] + elif tarefa == 'Show': + Interface().tmp_text = Interface().tmp_text[0:Interface().cursor_letra] +'Show(\'x\''+ Interface().tmp_text[Interface().cursor_letra:] + elif tarefa == 'Plot': + Interface().tmp_text = Interface().tmp_text[0:Interface().cursor_letra] +'Plot(\'[[0,0],[1,1]]\''+ Interface().tmp_text[Interface().cursor_letra:] + elif tarefa == 'Box': + Interface().tmp_text = Interface().tmp_text[0:Interface().cursor_letra] +'Box('+ Interface().tmp_text[Interface().cursor_letra:] + elif tarefa == 'PlugIn': + Interface().tmp_text = Interface().tmp_text[0:Interface().cursor_letra] +'PlugIn(\'nome\''+ Interface().tmp_text[Interface().cursor_letra:] + elif tarefa == 'Function': + Interface().tmp_text = Interface().tmp_text[0:Interface().cursor_letra] +'Function(\'x\''+ Interface().tmp_text[Interface().cursor_letra:] + elif tarefa == 'Table': + Interface().tmp_text = Interface().tmp_text[0:Interface().cursor_letra] +'Table('+ Interface().tmp_text[Interface().cursor_letra:] + elif tarefa == 'Copia': + Frames().texto_copiado = Frames().textoSelecionado() + elif tarefa == 'Corta': + Frames().texto_copiado = Frames().textoSelecionado(True) + elif tarefa == 'Cola': + Interface().tmp_text = Interface().tmp_text[0:Interface().cursor_letra] +Frames().texto_copiado+ Interface().tmp_text[Interface().cursor_letra:] + elif tarefa in Data().listaPlugIns(): + Interface().tmp_text = 'PlugIn(\''+tarefa+'\')' + def tarefaLetra(self,letra): + self.tarefa(self.tarefa_letra[ord(letra)]) + def tarefaCodigo(self,texto): + for i in range(256): + if self.codigo[i] == texto: + self.tarefa(self.tarefa_codigo[i]) + +TAREFAS = Tarefas()