Tiny and simple webserver for Basico

While developing the Dashboard module I had problems to display charts generated with Pygal. Charts can only be saved as SVG format (they can be saved as PNG files but I haven’t found any portable library to use easily in Windows).

The first solution I came up with was to create an HTML file and then point to the SVG file but WebKit doesn’t allow to do that if you aren’t using a Webserver (it is all about security policies).

So the next step was to implement a tiny webserver based on Python 3 core standard library. After a few research looking for simple implementations I found one very simple. At first, it worked but then Basico became unstable:

– After stopping Basico, the next execution returns errors due to the webserver isn’t stopped successfully and the port remains binded.
– Another issue: you can’t run the webserver and GTK application in the same thread because then the application freezes.

After a little bit more of research I was able to rewrite the module to overcome these problems and keep the compatibility in both platforms, Linux and Windows.

Finally, I was able to load my webpage from my tiny and simple webserver and embed it into my GTK application using WebKit:

The code used to do this:

The HTML code:

 

 

Basico 0.2 released

Hi,

I am proud to announce Basico 0.2

It has been a long time since I released version 0.1 and there have been many changes. And many challenges.

Core internals

First of challenges was to allow Basico to download SAP Notes again. There was a problem of compatibility between Selenium webdriver and Firefox, therefore Basico stopped working suddenly. Months later, Selenium webdriver was updated and, by using the Gecko webdriver, it worked again but… Basico was unable to login in Launchpad using a S-User and password :(

Finally, I came up with the idea of using Single Sign-On with SAP Passports. And it works out very well. Just apply for your SAP Passport, add it to your firefox browser and trust it (see INSTALL page).

After this change I’ve been still unable to setup Selenium’s webdriver properly for working with threads, so SAP Notes are downloaded sequentially, one by one.

 

User Interface

In the UI side there has been a lot of improvements.

Views

  • Views
  • Task view
  • Component Id view
  • Component Description view
  • Bookmarks view
  • Category view
  • Chronologic view
  • Priority view
  • Type view
Now, you can browse your SAP Notes using many views: by tasks, component, component code, component description, bookmarks, categories, crhonologic order, priority or type.
The most interesting one is Tasks. You can select one or more SAP Notes and group them in a task. So, for example, if you are working in an SAP BW System, you can add all related SAP Notes that you use in a task:
 
 
 
 
Another view very useful is Chronological order. Here you can check your day to day and know what you were working with:

 
 

Operations

When you select one or more SAP Notes, Operations menu is activated. Then, you can choose to browse selected SAP Notes, bookmark them , manage task(s) they belong to, export them or delete them.

Also, from this menu, you can export your SAP Notes by choosing one of the following formats:

  • JSON: share your SAP Notes with all metadata
  • CSV: the right format to include in your reports or documents
  • Plain text: it only saves SAP Note Id(s)

 

Download / Import SAP Notes

Here, you can import a JSON file with SAP Notes or you can download them from Launchpad.

 

Search & Filter

By clicking in Search button you enable the search entry to search in all database and, optionally, filter by one of the available properties:

 

SAP Note metadata details

From fingerprint button you can see all details for selected SAP Note.

 
A program execution worths more than one thousand words. Give it a try ;-)

Get Firefox profile directory with Python (Linux and Windows)

Piece of code used in Basico (util.py module) to get the default user’s Firefox profile directory.

This profile must have the SAP Passport imported in the Certificate store.