Archive for the ‘planet-mageia-english’ tag
Some months ago I wrote about the new features available in Cantor from KDE 4.13 release. But I did not write about a new nice feature available in that release too – so let’s see the new code completion in Cantor script editor!
I coded a default syntax highlighting to each backend in script editor. Script editor is based on KatePart/KTextEditor, a great piece of code from KDE libs used in several KDE softwares like KWrite, Kate, Kile, KDevelop, and more.
The Kate guys released a new feature in KDE 4.13 release: an improved code completion for all languages supported by KTextEditor. It use the same XML file to syntax highlighting from each language to provide this new code completion.
As I coded the default syntax highlighting, the code completion for the script editor was enabled as default too. Amazing!
So, let’s see some pictures about this feature:
Code completion in Scilab
This figure we use code completion to write a plot command in script editor from Scilab backend.
Code completion in Maxima
In Maxima backend we can see the code completion working not only to the commands with initial string typed: for example, contour_plot is suggested in the figure.
This new code completion is available to all backends that have the script editor plugin implemented. To use it you just type Ctrl+Space in the editor.
There are some improvements to this feature to be implemented in the future. For example, it would be interesting load the functions to modules/packages imported in the editor – for example, in Python I can use import numpy and the numpy functions could be available in code completion too. The variables in the Cantor workspace could be available in the script editor too.
But it is work to the future. For now, you can have fun with this new code completion., and thanks for all Kate developers for this nice feature!
I have some posts to write about Cantor but first I would like to request a help to KDE packagers of several Linux distros around the world.
I received some mails from users asking “how can I use python in Cantor?” or “where is python support in Cantor?”. Well, python2-backend is available in Cantor since KDE 4.12 release. If you is using KDE >= 4.12 but you can not to use python in Cantor, maybe the package was not build correctly.
python 2 development library (commonly packed as python-devel in some Linux distros) is required to build python2-backend. python 2 is required to use Cantor with python 2.
Then if you are a Cantor user and can not to use Cantor with python, please write a bug report in the bug management system of your distro. You can to put a link in the bug report to this post too.
Anyway, if your distro bring or not bring python2-backend, write a comment below and I will make a table with this information.
[UPDATE May 13, 2014] – In FISL I and Paulo Andrade, a Mandriva/Conectiva employer, noticed that Cantor is missing the Python backend in Fedora. Paulo wrote a bug report and the packager fix it. Maybe in one week the Cantor with the fix will be available in Fedora repositories. Thanks Paulo!
Soon I am going to one of the biggest events in the world about free software, the International Free Software Forum (FISL)!
As usual this year will be very present in KDE activities – especially the lecture by Kévin Ottens on KDE Frameworks 5, and the KDE community meeting. It will be easy to find me on the KDE booth in the user group area too.
I intent to attend other lectures, for example the metamodeling using Qt with Sandro, the 30-year history of GNU with Aracele, devices for neuroscience studies with Cabelo, and some more - I’m still far from decided “my” FISL schedule.
May 9, 16:00h, I will present a paper on Free Software Workshop about the development of Python backend for Cantor.
The complete schedule of FISL activities has more than 300 lectures, workshops, short courses, and more!
See you there!
A small blogpost about Cantor before Brazilian Carnival parties.
KDE 4.13 is feature freeze now and I developed some improvements in Cantor’s script editor. It will be available in next KDE stable release around April 16.
Now Python 2 and Scilab backends have support to script editor! See some pictures:
You can access script editor in menu bar View -> Show Script Editor. The script editor is based in kate-part, so you have syntax highlighting, line numbering, mini-map, and all cool stuffs from Kate. You have a Run Script button too, so you can just push this button and the script will be load in Cantor worksheet, as you can see in examples.
There is news for others Cantor backends too. Now script editor load default syntax highlighting for each backend – in old versions it did not happen. And, if you push New button, the new script editor will have the default syntax highlighting working too.
It is the news about my work in Cantor for KDE 4.13. I intent improve Python 2 backend and script editor for future releases.
But now it is time to go to Brazilian street parties! Happy Carnival! ;)
Cantor is a mathematical/scientific programming software, a frontend providing IDE features (syntax highlighting, tab-complete, variables management, and more) and a advanced terminal. Cantor support a lot of mathematical engines like Octave, Sage, Maxima, Kalgebra, Qualculate, R, Scilab (developed by me too), and now, Python 2. You can see Cantor as a Matlab-like software, but it uses other mathematical environment/software as programming language.
This post I will do a “feature tour” in Python 2 backend to show Cantor software for scientific python developers community.
Initial Screen – Syntax Highlighting and Tab Complete
After select the Python 2 backend, Cantor will show the initial screen. This window have a big widget for the Python 2 terminal, and two side panels – one to show the Python 2 help and the other to variables management.
Let’s see some commands inputs in the terminal:
Cantor is highlighting the Python 2 syntax and, in side panel, you can see the variables created.
Now, let’s create new variables with similar names to test the tab complete. See the picture below:
After create variables variable_x, variable_y e variable_var, we can write in terminal var and type tab key twice – Cantor will show the variables and functions with the same piece of word. Tab complete is available for module functions too.
Cantor show error messages in terminal too. Next figure show a import error:
You can save the terminal state or just the input commands and their outputs in a file. Cantor allows upload/download a terminal example for a remote server. You can explore this features in “File” menu.
Cantor shows Python help from help command in a side panel. The picture below shows the help for complex class:
Cantor uses Qt/KDE technologies, so you can change the window format moving the side panels. Next picture show the window with the variables management in the left side and the help panel in the right side.
Variables management panel shows the variables created in Cantor session, showing their labels and values. The panel have some additional functions too, in buttons bottom the widget. These functions are, from left to right, Add variable, Load variables, Save variables, and Clear all variables.
Add variable just open a pop-up window to input a label and a value to a variable.
Load variables and Save variables uses shelve module to data persistence. When the buttons are clicked, Cantor loads scripts to, in first case, read and load variables to the session, and, in second case, save the python dictionary in a file. The figures below show this operations:
The function Clear all variables delete each variable from Python dictionary. The code is below:
The figures below show the graphic loaded in Cantor worksheet. When a session is exported, the graphic will be exported too. This feature can be configured to create the graphics in a new window – this is the default option.
Conclusion and Future
This is the first stable version of Python 2 support in Cantor. It is working good, but you can see the bug presence in some parts of software.
I would like to see some feedbacks from mathematical/scientific programming python community. I am not a “pythonist”, so the python community can find bugs and strange behaviours in the software better than me. I would like to see some feature suggestions too.
For the next version, Python 2 backend will have support to script editor – unfortunately, I can not develop it for this release.
If you are interested in the backend development, my blog have a set of posts (in Portuguese and English) about it. You can download the source code in Cantor repository – the license is GPLv2. And you can submit a bug report in KDE bugzilla.
And you can contact me in comments area below or in my mail address filipe at kde.org.
A fast update: now Cantor backends for Python2 and Scilab were merged in master branch. I will do more polishing until the stable release in KDE 4.12. You can follow the new status of development compiling and testing Cantor from master branch.
In a related topic, KDE Edu sprint in A Coruña, Spain, began and runs through the October 30th. Unfortunately I can not participate this time but I expect go to the next meeting (maybe, in Akademy 2014). =)
Have a good work, edu-gearheads!
Back to 2011 I was a GSoC student at Scilab community. My project was to create a backend for Scilab in Cantor, the KDE mathematical software. My project ended very well and the objectives were accomplished. You can see several features of this project in reports from my blog.
The backend would be working with Scilab 5.4 because I implemented the standard streams support in Scilab. The backend was available in KDE 4.8, released in January 2012, but Scilab 5.4 was released in October 2012. Unfortunately, when this version of Scilab was released, the standard streams support were not working.
Since this date I tried some times fix it but I did not obtained success.
Therefore, Scilab release a 5.5-beta1 version in begin of this October and I did a test with Cantor and… voilá! The standard streams is working now and the Cantor backend is working too!
Now it is time to Scilab backend for Cantor revive! I am doing “nightly-builds” of Scilab to verify if the standard streams are working and I developed new features to the backend. Let me show them:
Predefined functions and variables
In the past Scilab backend had a giant-size XML file listing all predefined functions and variables. Now the backend run getscilabkeywords command to get this information, used in tab-complete and syntax highlighting.
Tab-Complete and Syntax Highlighting
These features were available in previous version of the backend to predefined functions and variables. Now user variables are too used in these features.
Tab-complete for predefined functions
Variable Management Panel
Scilab backend now have a preliminary variable management panel. All variable defined by user are showed in this panel.
With this feature the user can save and load variables, and clean the variable environment.
But it is a preliminary version based in Octave variable management: the user must define the variable presenting it (you can not use “;”). So the label and value will be send to panel.
Scilab backend reviving in KDE 4.12
I am working for this new version of Scilab backend in KDE 4.12.
But you can test it now: the code is hosted in scilab-backend branch from Cantor repository.