V8 ScriptEditor python testing and bugs

Hi, I just tried to make a listbox in python3 but that isn’t working, so I tried with Rhino UI, but that doesn’t work either:

import rhinoscriptsyntax as rs
import Rhino

items = []
items.append("test 0")
items.append("test 1")
items.append("test 2")

### This doesn't work so I made another, but that doesn't work either
#print rs.ListBox(list)

title="test"
message="test"
default = 0
result = Rhino.UI.Dialogs.ShowListBox(title, message, items, default)
print(result)
import System
import rhinoscriptsyntax as rs
items = ['test 0', 'test 1', 'test 2']
rs.ListBox(System.Collections.Generic.List[System.String](items))
1 Like

Wow :smiley:
I hope that is not the solution for the future, but more of a workaround while RhinoCode matures. Thanks!

Fixed this issue and will be available in next WIP (https://mcneel.myjetbrains.com/youtrack/issue/RH-72933)

This code should work now

import rhinoscriptsyntax as rs

print(
    rs.ListBox(
        ["test 0", "test 1", "test 2"],
        "test message",
        "test title",
        "test 2"
    )
)

image

1 Like

RH-72933 is fixed in the latest WIP

1 Like

Question: Why does it spend time on ‘Restoring packages’ every time I run WIP as a new instance?
Isn’t the packages installed via PIP? Or am I missunderstanding and this is just the ‘import’ thing doing it’s thing?

@Holo Currently it is the import thing doing it’s thing. There are bugs there I’m sure which we will fix when I can get passed the editor UI issues and changes.

1 Like

Thanks, good to know. It works well, just seemed odd that it did it every time, but now I know.

A wish: It would be great if it could indicate some sort of status from the installation of external libraries, maybe indicating how big the file it installs is, or how far it has come in the process. I got the experience that Rhino had crashed the other day, but then realized that the library I was trying to use was 50MB, so it was just downloading and installing.

I noticed that if I try to import a big library just after referencing it then it can fail, so it is better to reference first, then import scriptsyntax, Rhino etc and then import the new library. Maybe Rhino tries to move on before it is done or something.

Also in the python editor we get examples shown when we type commands, can this be activated in RhinoCode too? They are of great help.

Did you rename RhinoCode in the latest WIP?
I can’t start it with that name now. (just upgraded)

Looks like it’s ScriptEditor now, Jørgen.
-wim

1 Like

Ah, great, I tried the EditScript but that was the old rhinoscript thing :slight_smile:

Takker!

1 Like

Hi @eirannejad

I found a few issues, It’s great that the script editor minimizes when ran, but it should wait until packages are read in, or in some way indicate that something is going on in the background. Right now I can run other tools in Rhino when this happens.

And It shows spaces in names as %20 :slight_smile:
image

I also found that Rhino can think that a file is open in python when I try to save over a file, so “it’s” prevented from renaming the file.
Don’t know what that is yet, I’ll see if I can find a pattern.

1 Like

Could we please have an “open recent” tab here:
image

Here is an icon i found that I think fits that purpose:
image

1 Like

Hi again @eirannejad

I see that I can start a new ScriptEditor while one is running and that causes some trouble, this typically happen when a script tries to install some packages.

And I see that I can run a Python3 script from a button now, great stuff! Thanks! …but… it seems to install the needed libraries every single time that button is pushed. I guess this is just a Beta thing but I want to make sure you know about it.

I also sometimes get’s an error that an api can’t be found and I have to restart Rhino, or the entire computer for it to work again. I have not found anything that makes sense as to why, I’ll keep my eyes open.

EDIT: and another thing that affects the speed of programming, if I add a hash in front of a line then the scripteditor takes a break before it updates the line, forcing me to wait. I think it is checking the code, but it would be nice if this was done in the background.

Yeap that was a change I added for testing but then forgot to remove before merge. Fixed. Will be available in next WIP

I still need to cleanup the autocompletion and diagnostics for better performance.

1 Like

You can press Ctrl+Shitf+T to open the “Recent codes” prompt

This is fixed as well

1 Like

Hi again!
Can you please move “line info” to the front of the error report?
It would make it easier to navigate to the correct line when the error report is very long.

And add an empy line here so it is easier to read the last line and see that I have reached the end of the document?