-
Notifications
You must be signed in to change notification settings - Fork 11
GUI improvements #56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GUI improvements #56
Conversation
This pull request has been mentioned on Image.sc Forum. There might be relevant details there: https://forum.image.sc/t/would-someone-make-a-dark-script-editor/51870/6 |
@tferr Awesome! Also: I fixed the repeated output of the same language's support status. |
- Improve Consistency of Title Case - Add titled separators to larger menus - errorScreen: Adopt pane font size, not hardwired value - Bookmarks: Info message when list is empty - Disable 'clear' menu entry, redundant with JButton of 'errorScreen'
- Contextual Menu: (Collapse, Expand, Reveal Selection in OS, Reset) - Add button: prompt remembers last folder and accepts drag & drop - Drag & drop support from the OS' File Explorer - Fix hardwired colors for compatibility with dark L&F - Minor Improvements to dialogs - Do not collapse nodes when reloading - File filtering: - Help message in tooltip - Case insensitive by default - Clearing field resets tree
This simplifies things quite a bit. While at it, add options for Regex, Cases sensitive, built-in help, etc.
- Controls for tab placement - Opening files via drag & drop - Navigate tabs using scrollwheel - Fix drag & drop related exception Plus minor code cleanup of FileSystemTreePanel. Signed-off-by: Curtis Rueden <ctrueden@wisc.edu>
- Edit> - Organize by categories - Moved entries to Options> menu - Window> - Toggles for panels - Tab navigation (previous Tabs> menu) - Options> - Use titled dividers - Indention controls - Themes!! - Autocompletion controls - Prefs. controls - Help> - List of developer resources
Especially 'contextual help' menu entries. Signed-off-by: Curtis Rueden <ctrueden@wisc.edu>
While at it, ensure Menu choices updates on theme change
- Move FileSystemTree tweaks to FileSystemTreePanel - Ensure Filtering field is large enough to display placeholders - Add explicit error messages to buttons - Cleanup API - Misc
- GUI Tweaks: - Improve dialogs, capitalization, tooltips, etc. - Organize options menu & disable non-applicable options as needed - Use Find/Replace (as opposed to segregated commands) - Correct changeListener -> ItemListener - Minor code/API cleanup
Lots of new things now.
afe6733
to
ee92ec4
Compare
Rebased and merged. All final commits compile with passing tests. If there are any lingering issues, we can address them with followup commits/PRs. |
Hi @tferr looks great, thanks so much! On the toggle for autocompletions with control+space vs without: when opening the Script Editor, the checkbox is ticked but one has to use control+space to activate autocompletions. So either it's initialized wrong or the logic is the other way. Also, I can't seem to get it to work without control+space for jython. By the way: I added method and constructor parameterized autocompletion for jython https://github.com/scijava/script-editor-jython/commits/main -- we should release both repos. |
The themes: seem to only apply to the script textarea? The output and error textareas and the file tree don't change, in Ubuntu 20.04 with java 8. |
The little arrows that enabled the left and right panels to be collapsed seem to have disappeared. Yes, I see under the "Window" menu new menu items to collapse/show them. But was it necessary to remove the arrows? I like that they are visually explicit, and use them all the time. |
When opening a new tab, the theme isn't the same as the last active tab. It's actually the default theme. That should change, similar to how the new tab inherits the language of the previously active one. |
The Options menu item for "Mark occurrences" doesn't seem to do anything: upon text search, occurrences are marked regardless of the checkbox status. |
Wow. Great!
Grrrr, I can confirm this. The same seems to apply to the "indent guides" (that shoudl display a vertical line of sorts at each tab location). Weird because those checkboxes just waive the option to the RSyntaxArea. Will look
I will check the logic. But again, we are just waiving the option to the LanguageSupport here: script-editor/src/main/java/org/scijava/ui/swing/script/EditorPane.java Lines 569 to 571 in 7c55b2d
I have no explanation as per why is not working. Maybe the 200ms delay is the problem? Meanwhile, let me know if you have insights
Oops. Good point. Will look.
The reason was twofold: 1) those arrows are only present on certain L&F (i think metal does not have them), so I thought the menu would bring collapsible panes to more people, and 2) I just could not get the checkboxes in the Window> menu to become aware of their state. I did try, but I ran out of time and gave up. Basically, if you toggle those arrows, then the checkboxes in the menu become auto-of-sync, and I came across funky states, where I had to reset the preferences to have the panes back. I left a comment here: script-editor/src/main/java/org/scijava/ui/swing/script/TextEditor.java Lines 640 to 643 in 7c55b2d
An easy fix would be to bring the arrows back, and add a "Reset Layout" menu item that restores all panes, so that folks can use in case of 'out-of-sync-panic'.
That is correct. Outside the EditorPane the theme is set by the LookAndFeel. I am also on Ubuntu and when the system-wide (Gnome) theme is set to "dark" (the default for me!?) GTK+ also adapts a dark theme. The snapshots I sent were using FlatLaf. It has been a lifesaver for me, not because of aesthetics (but it does look great!), but because they have been plowing through a bunch of limitations of Swing, namely proper support for hiDPI screens. One can say they brought Swing back from the dead. Without it, nothing ever scales properly on linux (at least with Java8). Also, they keep improving it, and patching all sorts of old bugs: E.g., I used to get a segfault(!!) when dragging certain dialogs/frames across screens: It is an old bug that won't be fixed, but they have a workaround for it! |
Was needed, wasn't it. This makes exploring the java libraries much easier. I even added an attempt at guessing which existing variable names are suitable for each constructor or method argument, based on their type when the latter can be inferred. By the way, won't compile without latest commit to script-editor, in other words, you have to adjust the pom.xml of script-editor-jython to use the 0.6.2-SNAPSHOT of script-editor. |
Quick update on the keyless auto-completion: It seems to be working indeed, just i 6855 n an awkward way:
It seems that the behavior of what triggers it is defined here, i.e., by all the classes that extend DefaultCompletionProvider: For Java, it seems that the default is just the '.', i.e., nothing else will trigger it. I suspect, the jython-autocompletion would have to adjust the rules to meet expectations. @haesleinhuepf, this would apply to your ij1 macro completions too.
I will try to look over the weekend |
The Mark All' occurrences feature is restricted to certain identifiers defined on individually for each language. This makes it so, that in addition to whatever is being specified, it is also possible to double-click on any string to highlight all occurrences. In addition, this adds an error strip to the right side of the text area, marking the positioning of lines associated with syntax errors and 'Mark all'/'Find all' occurrences. Related to @acardona's report, #56 (comment)
@acardona: just pushed a couple of fixes for the stuff you reported. The "Mark All" occurrences being language specific was bothering me, so I made it so that when you double-click on a string (any string), all of its occurrences get highlighted. Also, now there is an "Error strip" on the right side of the pane (like in Eclipse) that highlights all the lines with 1) errors and warnings, 2) "Find all" and 3) "Mark all" occurrences. It is kind of neat! I also made it so, if there is a URL, ctrl-clicking on it, will open it in the browser. The "Indent tab lines' works, but it only marks leading white space and the detection of such is also language-specific, so it may not do much by default. Updated: I opened a couple of PRs on the jython side: |
Question on hyperlinks: I see them become underlined in java documentation (/** .... */ style), but not in e.g., python (""" .... """ style). In the code, the implementation seems language neutral, meaning, this is likely delegated to the language support classes? Any hints here on how to enable it for languages other than java? The line in question: |
RSyntaxTextArea is quite awkward in the sense that even 'global' TextArea options become language specific when a language is set. I can try to look |
The MouseListener in RSyntaxTextArea triggers HyperlinkListener related code when Token#isHyperLink() is true, like here
|
This pull request has been mentioned on Image.sc Forum. There might be relevant details there: |
I've been using the editor these days quite a lot. One thing that use to bonkers me all the time was the fact that font sizes were never consistently stored across restarts (e.g., the console would always have 12pt at startup). With a hiDPI screen, I was always changing the fonts. So, I decided to finally cleanup all the hardwired values...
At a certain point, it became obvious that we are not using RSyntaxArea to its full potential. One thing led to the other, and I ended up doing way more than what I had expected. Here is a summary:
EditorPane:
Autocompletion:
Other Improvements/Tweaks:
@ctrueden I felt easier to add this class that implements the File Drag&Drop. it is in the public domain. It works quite well (SNT uses it a lot). Would be super useful to add it to all the scijava Swing-based components that handle files (e.g., file prompts)
@imagejan, @ctrueden, @haesleinhuepf, @acardona: Unfortunately, I won't have time to do much more. Would be great if you guys could test things on your end. The Editor is getting better and better all the time!!
I am attaching a binary here, in case it helps (note the dummy .zip extension appended to fool the uploader).
script-editor-0.6.2-SNAPSHOT.jar.zip
Also, here are some snapshots: