Getting Back on Track

Today we finally got an answer to our query on how to work with QGraphicsScene and QGraphicsItems.

We asked around on IRC and ML but didn’t get a reply. So we posted our query along with code of our demo application on Qt’s forum.

And at last somebody replied and pointed our mistake.

We were creating a scene directly in our mainwindow and each entity has its own mouse events associated with it like mousepress, mousemove, etc. and the paint event was also defined here.

But we have to handle events in the scene and not in the item. Only painting is to be done in item class. So now we have separate graphicsscene class which will handle the events.

Exploring Examples

Qt is marvy but it takes a plenty of time and investment to get fruitful results and better grasp on it.

Today Dr. Rai advised to go through the examples of Qt to have its overview.

Though there are loads of examples available, it’d be more fitting to go only through the selected ones that are related to our immediate work.

GDCAD to eCAD

Today I got the access on the eCAD repository for GreatDevelopers account on github.

So I shifted the files from GDCAD repository to this eCAD repository.

Now any further work will be done on this new repository.

We also need to look into the source code of FreeCAD. Need to clone the code tomorrow.

Second task in LH

We finished our second task to implement AJAX in lab report form.

It was pretty easy after the first task and less complex ’cause it was a standalone form not on the admin side.

I feel as I am getting a little hang on Django.

Now I am going through the unit-tests in the LCv3 and looking into the code of kernel.

Finished with the task

Kamalpreet and I are finished with our first task of implementing the dependent drop-downs. After successfully implementing a form on a new page we had to do embed the same on admin side.
We had help from Jasvir as it was really tricky to get the drop-downs to work as we wanted to.

And now we got our second task to do similar AJAX thing in Lab Reports. This time we have to include a template as well.

On the note of my original project, GD-CAD, I am now cloning the LCv3 repo to study the kernel while following this motto:
I don’t have to reinvent the wheel, but I will be cautious before I act.

Almost done

Today we looked into how to add the fields in the admin side.

We had already created a form last time when we were trying to do in admin directly except the form should be a ModelForm instead of a simple form.

After searching online and help from Jasvir, we have the form added recursively (for multiple items).

Next I am looking into correcting the jQuery and AJAX implementation.

On the other note, I’ve passed my final evaluation in GSoC.

Forming a form

Today we tried creating a form in Django. It is pretty straightforward.

Also added JavaScript to the template of the form itself. Everything that we create in forms.py with forms module is converted into HTML so we can directly access the IDs of those fields.

Right now our fields are disabled and enabled correctly but we have not yet found a perfect solution to directly access database from the JS. We might not even have to.

There are two options we found to achieve this dependent selection:

  1. jQuery
  2. AJAX

Diving into Django

Completed fourth part of Django Poll App and began working on the assigned task.

Kamalpreet and I made a new form, not included in the admin site, a standalone for now. Next we are looking on how to add JavaScript in the Django code.

With this JavaScript, we’ll be able to change the values of the fields with respect to the values selected in the above field. This will improve the user experience as there won’t be a long list in a single drop-down, only a filtered result will be displayed to the user.

I am learning about forms in Django.

I also completed my report of GSoC for final evaluation and added some additional information in Dr. Geo’s user manual.

GSoC: Final Report

After midterm, it was decided that I begin working on a re-write of GNU Dr. Geo to incorporate the newer APIs that have replaced older ones which have been deprecated in recent years.

The most important change was in GTK library as they have dropped GDK Drawing API completely in version 3. They recommend to use Cairo 2D Library directly to make use of Drawing widget provided in the Gtk.

So I started with a basic approach to divide the software in two core parts:

  • GUI
  • Kernel

GUI handles all the graphics, how entities are created, how they are displayed and even how the windows and widgets are created and handled.
Kernel handles the processing of the entities, how they are stored and also how objects are created and used.

My main motive was to provide a general program that can draw some entities and stores them.

Below is the image that shows my current progress.

drgeo-intro
GNU Dr. Geo Window

My modular version of GNU Dr. Geo has following features:

  1. Has Tabbed Document Interface (TDI)
    tab
    TDI interface

    You can create new tabs by clicking New menu item in File menu. You can also close these tabs.

  2. Draw Points
    point
    Single Point

    You can draw points on the canvas by selecting Point entity in Draw menu.

    Multiple Points
    Multiple Points
  3. Draw Line
    Line Entity
    Line Entity

    You can draw line on the canvas by selecting Line entity in Draw menu. But you need two points drawn on the canvas in order to draw line between them.

  4. Draw Circle
    Circle Entity
    Circle Entity

    You can draw circle on the canvas by selecting Circle entity in Draw menu. But you need two points drawn on the canvas in order to draw circle. The first selected point will be the center point of the circle while the second selected point will calculate the radius of the circle.

  5. Draw Arc
    Arc Entity
    Arc Entity

    You can draw arc on the canvas by selecting Arc entity in Draw menu. But you need three points drawn on the canvas in order to draw arc. The first selected point will be the start point of the arc while the second selected point will determine the direction of the arc and the third selected point will be the end point of the arc.

Points are stored in a vector and this vector is iterated to check whether there is already a point drawn under our mouse at any time and at any position.

Kernel, right now, has the container class for point. Similarly all entities will have their own respective containers. Also the drawing areas will have their objects stored and iterated to check which tab is selected and undo/redo operations will be implemented on that.

There are a lot of things that needs improvement and hopefully I will be a part of the development of GNU Dr. Geo for a long time to implement what I have planned for it.

It was great coding and learning experience.