Slashdot Mirror


Developing Applications with KJSEmbed

Rich writes "Ian Geiser of SourceXtreme has released an interesting HOWTO showing how you can use KDE's embedded JavaScript tool to write quick-and-dirty apps. The apps can use the features of Qt and KDE to pack a lot of punch for a small amount of code. You can find it on his website."

25 comments

  1. Not trolling... by byolinux · · Score: 3, Interesting

    All this is fine, but really what Free Software needs is a tool like Visual Basic (the later versions) that

    a) works
    2) can take VB and convert
    d) can compile nicely to multiple architectures.

    As far as I know, nothing like this is available for GNU/Linux. The nearest thing I know like this, is RealBasic for Mac - now can produce binaries for X86, but it's not free.

    1. Re:Not trolling... by black+mariah · · Score: 3, Interesting

      Gambas (http://gambas.sf.net) is moving along at a nice clip. It's a VB-ish and simple enough that even a mega-lame coder wannabe like me can create some useful stuff. Currently compilation and running of programs is... iffy. Unless you have Gambas installed you're not going to be running any programs created by it on your computer, but it's a strong base for someone to jump in and add the features you're talking about.

      --
      'Standards' in computing only impress those who are impressed by things like 'standards'.
    2. Re:Not trolling... by mhesseltine · · Score: 4, Funny
      a) works
      2) can take VB and convert
      d) can compile nicely to multiple architectures.

      Does VB have an enumerator that counts a,2,d?

      --
      Overrated / Underrated : Moderation :: Anonymous Coward : Posting
    3. Re:Not trolling... by Viol8 · · Score: 1, Insightful

      Most unix apps arn't event driven (or even GUI) so an event driven language like VB (ok i know it can be non event driven but thats not its raison
      d'etre) is not much use as an all purpose solution. Tcl/Tk was good at this sort of thing but it seems to have gone below the radar in the last 5 years or so.

    4. Re:Not trolling... by Anonymous Coward · · Score: 0

      it seems that TK is still widely used, but TCL itself has fallen by the wayside. IIRC TCL had been promoted by SUN prior to the introduction of Java, but was thrown aside in Sun's effort to promote Java as the be-all-and-end-all of programming languages. Also Raymond trashed TCL pretty thoroughly, which effectively much made it verboten among OSS advocates. Admittedly TCL is a queer language, but does have its advantages.

    5. Re:Not trolling... by Brandybuck · · Score: 2, Insightful

      Well if it weren't for the requirement "can take VB and convert", you would have a lot of options. VB needs to go away. People didn't use VB because of the language, they used it because you could write crappy throwaway programs and prototypes quickly. Using Python, Perl, Ruby, Delphi, Java and or even C++ underneath makes no difference, because 99% of the time the RAD developer isn't touching any code.

      Frankly, the whole "programming for non-programmers" approach needs to be seriously rethought. It's good that marketing types can quickly make a mockup of an app, but they should never be led to believe that they can do the work of developers. One quarter million dollar realtime embedded product I work on was spec'd by marketing to use .NET. Without arguing one way or the other on the merits of .NET, one of the rationales for the decision was so that it would be easier to use Visual Basic. Huh?

      --
      Don't blame me, I didn't vote for either of them!
    6. Re:Not trolling... by byolinux · · Score: 1

      No, it's the Buzz Numbering System.

    7. Re:Not trolling... by the_womble · · Score: 1
      TCL is still being used and developed. I have was very impressed at how fast development happened when Arsdigita (when it was still being run by Philip Greenspun) adapted the ACS to my then employers pretty specialist needs.

      I thought it was RMS who trashed TCL. Incidentally the linked discussions warn that people will not use TCL because RMS does not like it: Reading the discussion he does seem to ahve been guility of a certain amount of exageration of its flaws.

  2. interface scripting by OmniVector · · Score: 4, Interesting

    I wish someone in linux would implement a system that mimics the functionality of apple script. before people go off flaming me, let me explain for those who don't know what it does. apple script basically lets you set hooks in the program in a standard way so that anyone can script an application by manipulating objects in the program. the program registers with the applescript by giving it a list of all the objects it has and the methods these objects have that you can call on them. it's a very clean interface, and requries little extra work from the developers (which is nice). even if this does exist for KDE/gnome.. it's under documented, or no one uses it!

    --
    - tristan
    1. Re:interface scripting by Rich · · Score: 4, Informative

      It's called DCOP and it's used a lot. Here's one of several tutorial on the subject: IBM tutorial. Note that Ian is planning a tutorial showing how you can use DCOP from KJSEmbed in this series too.

    2. Re:interface scripting by Anonymous Coward · · Score: 3, Informative

      And what's really nifty is that all of that is done via OSA, the Open Scripting Architecture. So if you don't feel like coding in applescript, you can access all those same hooks with any other scripting language that has an OSA implementation (javascript, perl, python, etc...)

    3. Re:interface scripting by Simon · · Score: 3, Insightful

      The current problems with using DCOP right now for scripting and macros type stuff are:

      * There is very little documentation about what DCOP interfaces programs like Kate have, and how they can be used for writing small scripts and macros.

      * The existing DCOP interfaces are not designed for the ease of use by scripters/powerusers. They are built directly on top of the C++ implementation.

      * The DCOP interfaces are often not complete enough to make it possible to script everything that can be done via the GUI.

      --
      Simon

    4. Re:interface scripting by Anonymous Coward · · Score: 0

      anything that can be done via the menu,toolbar, or keyboard accells is accessible via dcop. Anything that publishes a QObject is accessible via dcop, as well as the normal published interfaces.

      that being said, YES documentation is lacking, as well as macro recording. feel free to bother developers about their interfaces, this does inspire them document them. or you can just wait for it to happen on its own... i am sure you can figure out what will make it happen faster though ;)

    5. Re:interface scripting by TomorrowPlusX · · Score: 1

      Also, note that apps which are formally applescript supported export a "Dictionary" which allows you to see the applescript "API" ( grammer would be a better term ).

      That, alone, makes applescript really f*cking fantastic.

      --

      lorem ipsum, dolor sit amet
    6. Re:interface scripting by rikkus-x · · Score: 2, Informative
      There is very little documentation about what DCOP interfaces programs like Kate have, and how they can be used for writing small scripts and macros.

      I just figured this out by typing 'dcop kate' and then looking at what was printed.

      $ dcop kate KateDocumentManager openURL /etc/passwd ''
      DCOPRef(kate, KateDocument#3)
      $ dcop kate EditInterface#3 numLines
      61
      $ dcop kate EditInterface#3 insertLine 61 blah
      true

      Wasn't that hard, really. I do know what a DCOPRef is though, so I had a head start. My point is that you don't really need documentation for this sort of thing.

      The existing DCOP interfaces are not designed for the ease of use by scripters/powerusers. They are built directly on top of the C++ implementation.

      Er, what?

      The DCOP interfaces are often not complete enough to make it possible to script everything that can be done via the GUI.

      The only way you're going to get that level of scripting ability is to rewrite all apps in some interpreted language with remote method invocation and, to make life easier, reflection.

      Rik

    7. Re:interface scripting by be-fan · · Score: 1

      The only way you're going to get that level of scripting ability is to rewrite all apps in some interpreted language with remote method invocation and, to make life easier, reflection.
      Actually, libSMOKE provides full remote method invocation and reflection for Qt and KDE.

      --
      A deep unwavering belief is a sure sign you're missing something...
    8. Re:interface scripting by rikkus-x · · Score: 1

      Wow, I'll be checking that out soon!

      Rik

  3. Re:I just developed an app with it! by Anonymous Coward · · Score: 0

    actually the open is wrong, you would have to use KIO::NetAccess instead. That and the fact that you would have to pass the mp3 file to something like KNofity, or an open media player with a play interface. At least if you are going to be asinine, at least try your script first.

  4. KDE has embedded javascript? This explains a lot by Viol8 · · Score: 1, Flamebait

    Ok I don't use KDE (or Gnome for that matter) because of their bloated size. This probably goes someway to explaining why they're such monstrosities. I'm sure some KDE fanatic moderator
    will mod me down for this but all I want from a window manager (don't give me this "its an enviroment crud") is to display windows. I want the apps to do what I need , NOT the code running
    the eye candy around them.

  5. Re:KDE has embedded javascript? This explains a lo by stilborne · · Score: 3, Informative

    Javascript is not embedded in KDE. KJSEmbed is a set of Javascript bindings built on top of KDE Javascript implementation. this is no different than, say, Python or Java bindings. where it does deviate is that it is possible for an application to embed the KJS engine and thereby use KJSEmbed internally as a scripting option should it so choose. but it isn't like KJSEmbed is loaded whenever you start up KDE, or even the overwhelming majority of KDE apps for that matter.

    that said, one of the beautiful things about open source / Free software is choice. go crazy with your window manager only set up, and have fun with it! i'm glad you aren't forced to use something that doesn't fit your style and/or needs!

    all the same, it's only fair to be accurate. your viewpoint on "eye candy" derivative code trying to do "what you need" rather than the apps themselves is a rather inaccurate statement on how things work. desktop environments aren't for everyone (you being an example of that), but at least you could get your derision right ;-)

  6. Re:I just developed an app with it! by Anonymous Coward · · Score: 0
    Hi. Is this program released under the GPL?


    Also, maybe you could set up a sourceforge page?


    thanks!

  7. This is good. by scorp1us · · Score: 1

    I'm using the less extravagant version, Qt+QSA which is the core of this framework. We're using it because we're embedded and need the space so we can't have KDE on there. We get crossplatform architecture independence. We don't need to know or care about what the target processor is. And we can link it into our existing MFC app.

    I can say that it is quite impressive. It can replace wxPython, and even Mozilla and Java for application development.

    In the future my home projects will be done in KJSEmbed just because the Qt/KDE stuff is so easy to work with.

    --
    Slashdot's rate-of-post filter: Preventing you from posting too many great ideas at once.
  8. Re:KDE has embedded javascript? This explains a lo by Jerk+City+Troll · · Score: 3, Insightful

    If you hate it so much, then don't use it.

    I can't stand it when people bitch and moan about a some technology being too <negative_adjective> when it comes to open source. (Especially when people like you make complaints and don't even bother to substantiate them in any way. What you offer is purely opinion.) If you're in a position to use KDE, then you are not using Windows. If you are not using Windows, then you are in a position of choice.

    And that's really the whole point, isn't it?

    KDE is a desktop environment, not a window manager like you are asking for. In this case, KDE is trying to provide a platform that is both easy to use and serves the needs of rapid application development. These are things that will help make it a more viable alternative to Windows and tools like VisualBASIC which can be great for quick prototyping. Of course, I don't know what the point is of defending it on these grounds. It's a tool, one of many, well suited to certain tasks and perhaps not so well suited to others.

  9. KDE isnt just a window manager by nurb432 · · Score: 3, Informative

    Its a complete desktop environment, with all the features, libraries, intercommunications, coding standards, and all bells and whistles that go along with an 'environment'.

    If you just want a window manager, then KDE isn't your best choice in the first place...

    Please try to compare apples to apples...

    --
    ---- Booth was a patriot ----