jueves, 15 de julio de 2010

[Devs] Basic design

In this post I'll explain a little bit more how Jake-PyQT4 works. If you're not a developer or if you don't have any coding skills, you can skip this post (if you want :p)

First part: Plugin system

The plugin system is loaded at start up. Once loaded, it will search in "plugins" directory. For each found folder it will search "main.py". If found, it will import it.
Once all plugins have been imported, plugin system will send a "get_capabilities" event.  All plugins can register to events, and every time the plugin system sends that event, all plugins that are currently registered to that event will run certain part of code. NOTES:

* more than one plugin can be registered for the same event.
* events are sent to each plugin synchronously, that means that only one plugin will run at the same time, so don't worry about printing things to the console, as it won't get mixed with the output of another plugins.
* each plugin can return a list of commands that can handle, and also, two plugins can handle the same command. Both plugins will be ran synchronously.

Second part: Libs

Currently I'm using Xlib on Linux and pyHook on Windows to handle the global keys. I'm still missing a Mac OS library, so if you know about some library that I could use, please write me an email, or comment here. I was thinking in using Xlib from darwin ports, but I'm not sure if it will work. Anyways, I guess I'll just have to setup a virtual machine and try it myself.
Also, I'm using googlepy for searching in google. But I have rewriten some parts from that lib because it wasn't working at all or as I wanted.
I'll write one lib per each website that I want to search in, and then I'll use that lib from a plugin. This will keep things simpler, and let more people code plugins without having to rewrite the same code for making queries in the same website.

Third part: Configuration system

Plugins must have the option to store settings. That's why the configuration system exists.
Plugins can have a list of options that will be passed to the configuration system. That list will be parsed and converted in a nice dialog. Settings will be stored in current user home folder.
If you want to look how does that list of options looks like, I suggest you to open up configsystem.py and see it yourself.
There is a large comment section will all types of settins, and a little example.


Forth and last part: Skin system

In fact, there is no skin system :p
I'll make a configuration dialog for Jake-PyQT4 (the main app) and I'll let users to choose a skin from there.
All UI elements can be styled using QSS. Also, tab position and transparency can be set with styles. If you need some help trying to make Jake-PyQT4 look as you like it you may need to read this and this. 

That's all for today! I'll post soon about what problems I think I'll have and what problems I'm having right now.
Bye! 

No hay comentarios:

Publicar un comentario