Pages: 1 2 »
  Print  
Author Topic: Can enigma be a widget engine?  (Read 3497 times)
Offline (Male) edsquare
Posted on: August 04, 2014, 10:58:27 AM

Member
Location: The throne of ringworld
Joined: Apr 2014
Posts: 402

View Profile
Acces the OS info? You know cpu temperature, ram usage, etc.

You know acces the web? like getting the weather from a site, or music, or stuff like that, not in a graphical way like a browser would but more like getting the info data and then displaying it in some way choosen by the programer.

And make calls to JS code?

I have a friend on deviantArt who makes desktop widgets for the now defunct Yahoo engine and one or two other widget engines, and talking about it we came up with the crazy idea of a universal widget engine. He knows VB and JS, I could do some stuff on Python.

Thinking about it I thought about ENIGMA as a possible solution to this, if the engine can get acces to that kind of stuff. And maybe even launch other installed applications, like a multimedia player, or a file manager.

It would also be a great way for enigma to get more exposure.
Logged
A child of five would understand this. Send someone to fetch a child of five.
Groucho Marx
Offline (Unknown gender) fervi
Reply #1 Posted on: August 04, 2014, 11:36:37 AM
Member
Joined: Feb 2013
Posts: 78

View Profile Email
On Linux it can be easy, if "INI" and "execute_shell" options will be implemented

In Windows probably external software or DLL

Fervi
Logged
Offline (Male) edsquare
Reply #2 Posted on: August 04, 2014, 12:34:39 PM

Member
Location: The throne of ringworld
Joined: Apr 2014
Posts: 402

View Profile
On Linux it can be easy, if "INI" and "execute_shell" options will be implemented

In Windows probably external software or DLL

Fervi

INI so it would launch at boot time right? and

Execute_Shell to launch other programms?

Will be implemented? you mean in enigma?

The windows comment I didn't understand.
Logged
A child of five would understand this. Send someone to fetch a child of five.
Groucho Marx
Offline (Unknown gender) TheExDeus
Reply #3 Posted on: August 04, 2014, 12:39:27 PM

Developer
Joined: Apr 2008
Posts: 1872

View Profile
Everything is possible with ENIGMA. It's open source. You could use it to control mars rovers if you wanted to (I actually use ENIGMA for robot planning and control). Current net_ functions should have the possibility to load html pages (though someone tried it some while back and had some problems with it), and then you could parse the html to get information. You can launch applications with execute_shell - I have used it to launch security camera feeds. It should also be quite easy to access PC information, like CPU temp. and RAM usage. We should actually make an extension like that.

Linux has ini (trough extension) and execute_shell functions as well.

edit: I think he meant something else. I don't understand why he actually mentioned INI's, as they are config files and are not that useful for information acquiring. To make it launch in boot time you would have to add it to Startup (on windows) and something equivalent on linux. It's not really that connected to the app itself, although ENIGMA has registry functions which should allow you to set this behavior inside the program.
« Last Edit: August 04, 2014, 12:42:04 PM by TheExDeus » Logged
Offline (Male) edsquare
Reply #4 Posted on: August 04, 2014, 12:58:32 PM

Member
Location: The throne of ringworld
Joined: Apr 2014
Posts: 402

View Profile
Everything is possible with ENIGMA. It's open source. You could use it to control mars rovers if you wanted to (I actually use ENIGMA for robot planning and control). Current net_ functions should have the possibility to load html pages (though someone tried it some while back and had some problems with it), and then you could parse the html to get information. You can launch applications with execute_shell - I have used it to launch security camera feeds. It should also be quite easy to access PC information, like CPU temp. and RAM usage. We should actually make an extension like that.

Linux has ini (trough extension) and execute_shell functions as well.

edit: I think he meant something else. I don't understand why he actually mentioned INI's, as they are config files and are not that useful for information acquiring. To make it launch in boot time you would have to add it to Startup (on windows) and something equivalent on linux. It's not really that connected to the app itself, although ENIGMA has registry functions which should allow you to set this behavior inside the program.


So if we had the code in c++ adding the extension to read the hardware data would be easy?

The INI's may be for saving the state of the active widgets, size, location, theme, etc.
Logged
A child of five would understand this. Send someone to fetch a child of five.
Groucho Marx
Offline (Unknown gender) TheExDeus
Reply #5 Posted on: August 04, 2014, 01:14:36 PM

Developer
Joined: Apr 2008
Posts: 1872

View Profile
Quote
So if we had the code in c++ adding the extension to read the hardware data would be easy?
Most of the stuff in C++ is easy, as it has great libraries and tons of API's. I just googled "get cpu temperature C++" and got some pretty good results for both Windows and Linux (ubuntu). But I did notice that there is a lot of incompatibility between versions of linux and variations of hardware. So it could end up not be so easy if we want to support all of that.
Logged
Offline (Male) edsquare
Reply #6 Posted on: August 04, 2014, 01:51:56 PM

Member
Location: The throne of ringworld
Joined: Apr 2014
Posts: 402

View Profile
Quote
So if we had the code in c++ adding the extension to read the hardware data would be easy?
Most of the stuff in C++ is easy, as it has great libraries and tons of API's. I just googled "get cpu temperature C++" and got some pretty good results for both Windows and Linux (ubuntu). But I did notice that there is a lot of incompatibility between versions of linux and variations of hardware. So it could end up not be so easy if we want to support all of that.

On linux no matter what distro (I think) you can read this information from /proc/pid/stat, where pid is the process ID that you're interested in.

See the proc man pages for details.
Code: [Select]
http://www.kernel.org/doc/man-pages/online/pages/man5/proc.5.html
Look also at ps -o format, which allows you to select the fields that ps should display. Again, see the man pages for details.
Code: [Select]
http://linux.die.net/man/1/ps

Logged
A child of five would understand this. Send someone to fetch a child of five.
Groucho Marx
Offline (Male) Josh @ Dreamland
Reply #7 Posted on: August 04, 2014, 09:38:30 PM

Prince of all Goldfish
Developer
Location: Pittsburgh, PA, USA
Joined: Feb 2008
Posts: 2949

View Profile Email
You are able to include arbitrary C++ code in ENIGMA games. You can do any of that stuff. The issue is that you probably don't want the weight of an entire game engine powering your little desklet. I'd recommend writing a minimalistic system under Platforms/ and implementing a full None graphics system, if you wanted to pursue that.
Logged
"That is the single most cryptic piece of code I have ever seen." -Master PobbleWobble
"I disapprove of what you say, but I will defend to the death your right to say it." -Evelyn Beatrice Hall, Friends of Voltaire
Offline (Male) edsquare
Reply #8 Posted on: August 04, 2014, 10:42:21 PM

Member
Location: The throne of ringworld
Joined: Apr 2014
Posts: 402

View Profile
You are able to include arbitrary C++ code in ENIGMA games. You can do any of that stuff. The issue is that you probably don't want the weight of an entire game engine powering your little desklet. I'd recommend writing a minimalistic system under Platforms/ and implementing a full None graphics system, if you wanted to pursue that.

Not sure if I understood you, the weight of the game would be on the engine not on the desklets, the desklets would comunicate with the engine and extract the info from it, it would also provide the graphics capability to the desklets to draw clocks, calendars and what not. The desklet itself could be nothing more than the graphics and some JS, Lua or python to communicate with the engine.

The real problem would be to make it launch itself at boot time, to prevent it from launching more than one instance of itself and/or the desklets, and to allow it to communicate with the web and to extract the weather, and other stuff from it.

Also it would need to be able to use full trasnparency no matter where it's installed, and to scale the desklet up and/or down accordingly to the desktop real state available.
Logged
A child of five would understand this. Send someone to fetch a child of five.
Groucho Marx
Offline (Male) Josh @ Dreamland
Reply #9 Posted on: August 05, 2014, 07:06:00 AM

Prince of all Goldfish
Developer
Location: Pittsburgh, PA, USA
Joined: Feb 2008
Posts: 2949

View Profile Email
The problem is that ENIGMA's events are synchronous. A normal clock applet does a repaint once a second or once a minute, and only ever gains CPU time otherwise when the user interacts with it. The panel tells the applet that the user has done something, and the applet responds. Using ENIGMA to code this, you'll instead be responding every thirtieth of a second, wasting CPU in the meantime. ENIGMA's default event loop is designed for games, which always have logic that needs performed 30 or more times per second. Your typical applet draws once, then sleeps for hours.
Logged
"That is the single most cryptic piece of code I have ever seen." -Master PobbleWobble
"I disapprove of what you say, but I will defend to the death your right to say it." -Evelyn Beatrice Hall, Friends of Voltaire
Offline (Unknown gender) TheExDeus
Reply #10 Posted on: August 05, 2014, 10:19:50 AM

Developer
Joined: Apr 2008
Posts: 1872

View Profile
There is no problem sleeping in ENIGMA as well. You could set automatic redraw to false, then pause the whole game for as long as possible, while creating a threaded script which checks for click in the window about five times a frame. Then CPU cost should be 0%. So I personally don't see a reason why it wouldn't be possible.

But Ed seems to care only about the "engine", or the one sending information to the widgets. Finding an effective way for that is more problematic, as sending data to a JS widget (which is rendered where exactly?) might be more involved.
Logged
Offline (Male) edsquare
Reply #11 Posted on: August 05, 2014, 10:41:18 AM

Member
Location: The throne of ringworld
Joined: Apr 2014
Posts: 402

View Profile
There is no problem sleeping in ENIGMA as well. You could set automatic redraw to false, then pause the whole game for as long as possible, while creating a threaded script which checks for click in the window about five times a frame. Then CPU cost should be 0%. So I personally don't see a reason why it wouldn't be possible.

But Ed seems to care only about the "engine", or the one sending information to the widgets. Finding an effective way for that is more problematic, as sending data to a JS widget (which is rendered where exactly?) might be more involved.

So building it as a "game" which displays all of this "minigames" would be easier?
Logged
A child of five would understand this. Send someone to fetch a child of five.
Groucho Marx
Offline (Unknown gender) TheExDeus
Reply #12 Posted on: August 05, 2014, 11:39:49 AM

Developer
Joined: Apr 2008
Posts: 1872

View Profile
It doesn't need to be a "game" with "minigames". I would just make everything in ENIGMA, that's all. Probably one project per widget. I have done many things in GM and ENIGMA, and making a complete game is not one of them. I use them for many totally different things. Like making a file browser that is actually faster than Windows one. I remember the "SubOS" (more precisely a "shell") craze in GMC many years back (it's basically making the graphical part of an OS inside GM and then running over your original OS), which really pushed the limits on what people though GM can do in terms of windows, widgets, file manipulation and so on. Many of those "SubOS's" really had widgets and things.
« Last Edit: August 05, 2014, 11:47:27 AM by TheExDeus » Logged
Offline (Male) edsquare
Reply #13 Posted on: August 05, 2014, 12:18:55 PM

Member
Location: The throne of ringworld
Joined: Apr 2014
Posts: 402

View Profile
It doesn't need to be a "game" with "minigames". I would just make everything in ENIGMA, that's all. Probably one project per widget. I have done many things in GM and ENIGMA, and making a complete game is not one of them. I use them for many totally different things. Like making a file browser that is actually faster than Windows one. I remember the "SubOS" (more precisely a "shell") craze in GMC many years back (it's basically making the graphical part of an OS inside GM and then running over your original OS), which really pushed the limits on what people though GM can do in terms of windows, widgets, file manipulation and so on. Many of those "SubOS's" really had widgets and things.

But one project per widget means one engine per widget, which means heigher ram use if you open more than ona widget.  :-\
Logged
A child of five would understand this. Send someone to fetch a child of five.
Groucho Marx
Offline (Unknown gender) TheExDeus
Reply #14 Posted on: August 05, 2014, 12:48:14 PM

Developer
Joined: Apr 2008
Posts: 1872

View Profile
An empty GM project is 15mb of ram right now. With all the bells and whistles of a widget, it probably be around 30mb. Taking into account I have seen rarely more than 3 widgets at the same time, then that is 90mb. Which is not that bad. The "engine" what you call shouldn't be more than a few megs in program anyway. Gathering data isn't that ram consuming. On the other hand the rendering and all that can be. From what I found widgets do use about that much ram or even more. They usually also use more CPU (like 2% to 9%) - this is from a topic I just read about Win7 gadgets.
And you said you would want to use JS and python to render them. I don't know what you can use to render JS as a widget though, I'd say Adobe AIR, which uses about 200mb of ram when launched. So I doubt you would get much less ram usage, than regular ENIGMA.
Logged
Pages: 1 2 »
  Print