BUG Community

Welcome! Log In

Forums Recent Posts

Subscribe to Recent Posts 12,499 posts found

Oct 18, 2007 6:03pm
Medium kgilmer 215 posts

Topic: Applications / LCD Module Still Hangs

We’ve got a working solution and hope to release it to you very soon.

Oct 18, 2007 5:51pm
Medium kgilmer 215 posts

Topic: Applications / How do applications get started?

Oh and the latest SDK build has a Virtual BUG with two LCD lines.

Oct 18, 2007 5:45pm
Medium kgilmer 215 posts

Topic: BUG SDK / SDK installation

As a related item, the latest SDK build explicitly lists PDE as a required feature, so it will only install if PDE is installed.

Oct 18, 2007 5:44pm
Medium kgilmer 215 posts

Topic: BUG SDK / SDK Under Linux?

Daryll,

Nice work! Is there a RH forum thread or something we could point other fedora users to if they have the same issue?

Oct 18, 2007 4:07pm
Medium bballantine 56 posts

Topic: Applications / How do applications get started?

Shawn,

I’m primarily a web developer here at Bug, so I’m a bit of an SDK n00b myself, but I’ll take a swing at your question.

Using the Activator and ServiceTracker, your application is sorta always running, waiting for its service dependencies. Once its service dependencies are there, it will kick off doStart and do it’s thing.

If you wanted an app that wasn’t running all the time, then you are correct—your Activator could register a menu item or listen for hotkey events. I hope that helps. Def. let me know if it’s still unclear.

Thanks.

Oct 18, 2007 3:32pm
Medium bballantine 56 posts

Topic: Suggestion Box / Suggestions Wanted!

Hello All,

I began a new thread to address the topic of "Scripting the BUG". Check it out here: http://bugbeta.com/forums/viewtopic.php?t=73
Oct 18, 2007 3:29pm
Medium bballantine 56 posts

Topic: Applications / Scripting the BUG

I've been working on using Jython to write BUG apps and I've had some success. Once I go over what I've done with Ken and clean it up a little, I'll post a Hello World-type app on buglabs.net and a tutorial.

In the meantime I'll outline my approach (there are certainly other approaches, and probably better approaches, but so far what I've done is working):

  • In your bug app, add the Jython jar, and add it to your bundle manifest's "Bundle-ClassPath".
  • Create a Python interface to "wrap" your Jython class.
  • Create a Jython script
  • (.py file), implementing your wrapper interface.
  • To use the class, create an in instance of org.python.util.PythonInterpreter
  • There's some tricky code you have to add after you have your interpreter initialized that adds the bundle packages to the packages your jython script can see:


Bundle thisBundle = context.getBundle();
Dictionary bundleHeaders = thisBundle.getHeaders();
String importPackages = (String)bundleHeaders.get("Import-Package");
if(importPackages!=null)
{
String[] result = StringUtil.split(importPackages, ",");
for(int x=0; x<result.length; x++){
String pkg = result[x].trim();
PySystemState.add_package(pkg);
}
}
// this package -- so my Jython script can access my local classes
PySystemState.add_package("jythonbugtest");


  • Run the script
  • (.py) file via PythonInterpreter.execfile()
  • Create an instance of your Jython class within the script context
  • Pull out the object and cast it as your wrapper class.
  • Use it like you would a java class. See the code snippet below:


// execute my script, making the class available within the interpreter context
interp.execfile(scriptis);
// create an instance of my class