It now looks like this:

As you can see, there are some issues with scrollbars and I still need to do things like turn on line numbers and what not. Code folding and syntax highlighting goodness are all there now though.
If anyone would like to do up a Kate syntax highlighter file for the plasma-desktop scripting, that would be truly awesome. The syntax description XML dialect is described here and the plasma-desktop additions to the standard ECMA script runtime are here.

13 comments:
I think the scrollbar problem you're referring to is this one:
https://bugs.kde.org/show_bug.cgi?id=173255
For those that want to improve the syntax file:
You essentially just have to create a file called e.g. plasma-js.xml, use <IncludeRules context="##JavaScript" /> to get all the basic javascript stuff. Then you just have to create your a list of plasma keywords and are nearly done with it.
This is really simple.
Turn on line numbers like this:
- look at the KTextEditor::ConfigInterface
- on the top it says that it's a KTextEditor::View extension interface.
So you can qobject_cast any KTextEditor::View to this interface (provided the editor implementation implements this interface), see "Accessing the interface" in the above API docs.
Once you have the interface pointer, enable line numbers like this:
iface->setConfigValue("line-numbers", true);
That's all.
@milianw: good additional details. thanks.
@dhuamann: awesome! thanks :) i emailed kwrite-devel as well about this, but thanks for the fast answers here too!
Nice! :D
I'm adding scripting to ksysguard and need a similar dialog box for editing scripts.
I also wanted to have a help tab, to explain what to write. Imagine a new user just being presented with a blank page with no clue what to do next..
Any changes of other apps being able to use this?
I think the toolbar should be at the top of the window, especially since the buttons seem to apply to both the editor and output boxes.
@JohnFlux: "Any changes of other apps being able to use this?"
we could definitely share it between the workspace apps at least.
moving it lower in the stack would require a lot more API work, but somewhere in workspace/libs/ could work out nicely.
find me on irc sometime and we can maybe hash out some of the details.
@yman: "I think the toolbar should be at the top of the window, especially since the buttons seem to apply to both the editor and output boxes."
the buttons only apply to the editor. which is why they are where they are.
@Aaron J. Seigo:
They apply in the sense that both views are of the same model, and the buttons control the model. It's also the layout I'm used to from Eclipse, and I think your app would look prettier that way. Perhaps it may be a good idea to ask one of the UI experts in KDE, just to be sure you're right? (there is one you ofter mention on this blog, but I forgot her name)
@yman: so what would "Save" do when clicked? save the output? the script? whichever you'd clicked in?
currently, it saves the script. the buttons control the editor. they have nothing to do with the output.
and this certainly is not eclipse :)
@Aaron J. Seigo:
As in Eclipse, you'd be saving the script. I, at least, find it intuitive. Also, in terms of functionality this app is like having only eclipse's source and consol views, which is why I find the comparison to be in place. From screenshots and my professor's PC monitor it would seem KDevelop, NetBeans, and VisualStudio also use such a layout. Basically, what I'm saying is that it seems to be a common layout used by development tools, and should, in general, give a better feel to the programmer.
Also, now that I think about it "Source" would IMO be a better title than "Editor".
Hi,
I like the scripting stuff that is coming with Plasma / KDE 4.4.
I'm wondering if scripting could be used to implement the feature request I file at https://bugs.kde.org/show_bug.cgi?id=206721
To me this is a really critical feature and I see it as a major regression from KDE 3.x. But maybe this issue will be solved with the 4.4 release of Plasma. Do you think that this is possible?
Thanks,
Tom
@yman: again, this is not eclipse. this is not a software development tool (e.g. with projects and multiple files and what not). it's a simple embedded scripting console, and those buttons are directly and exclusively associated with the editor. the current layout makes this clear and keeps things looking nice as a bonus.
@tomwinkler: it can be used as a work around, but it's certainly not a proper fix.
as for "regression over 3.5", 3.5's behaviour is also broken. it made it impossible to have a setup for an external monitor and keep it there for when you plug in.
and yes, it taught people to somehow squeeze their panels all together and ignore some of the benefits of using multiple screens with mobile computers. that was unfortunate.
the solution, which has been detailed in another bug report of which yours is a duplicate of, is to do some smart merging of panels on the fly without permanently reassigning them.
as with changing wallpapers using drag-and-drop, nobody has showed up with a patch despite the "critical" nature of the problem.
so as with changing wallpapers using drag-and-drop, someone either needs to get motivated or you all get to wait for it to rise up to the top of my stack.
Post a Comment