The little things

The day started with some amendments in a LaTeX report Kamal was generating. It involved keeping chapters out of index and without page numbers as per the requirements. \chapter, notice did the work. The spacing above the chapter banner seemed more than required, we tried reducing it initially. 😛 But this was wrong.

It happens to most of us for most of the times, things are working good. A slight change somewhere and it gets messed up and later do not remember what we did and doubt if some change was done or not. So happened with one of my friends Jasmeen today. But we got it resolved, some permissions issues.

Coming to scripting, the documentation does not illustrate a complete proper usage of the scripting classes. So for some time, we moved onto adding icons and fixing the issues with script and command widget added whenever a new file was generated. One of them is fixed to some extent. Proper instances of the widgets forming the script widget have to be created and destroyed at right times. And coming back home, I started with scripting and tried implementing a minimal example in eCAD and then the custom implementation would be done subsequently.

The javascript file added as a resource currently for testing worked quite well with node in terminal. It just had a single line: console.log("Hey I am called. Haha!"); but what was wrong with the JSEngine. It needs everything wrapped up in a function. I learnt this in quite sometime before which I got real freaking errors.

Learning new things take a little time. But I guess I got the tail of the scripting classes in Qt and the flow.

For now I am stuck with TypeError: Property draw of object [null] is not a function since the object referred may be incorrect.

Bugs can be beautiful

Moving to my next task, live preview. Earlier we have been deploying only mousePressEvent() and mouseReleaseEvent(). The mouseMoveEvent() will be coming in action now.

The other day I have been working on this and my colleagues were really enjoying using this, though it is a bug.

Just a glimpse:

Screenshot from 2014-11-05 15:57:48

Isn’t it awesome? 😀 I will be fixing this now.

Angles identified

I have been implementing arc using three points considering on its circumference. But the angles have been troubling me continuously. Neither start angle nor the span angle i.e. difference of start angle and end angle was correct. If one of them was correct, other was easy to compute.

A negation with start angle solved the problem. The start and end point of the arc are always on the arc except the middle point i.e. the second click, sometimes.

For now, arc is implemented without angle issues in clock-wise direction, except the two cases I have just identified. If clockwise is done, anti-clockwise implementation won’t be much hassle.

Finally :D

Besides helping out in scripting, I have been slow for my own job because of boredom ascribed to continuous trials but with no results. It was confusing and it had to be. I was doing the right things but at wrong places. 😛

So I kept line again aside and starting hunting the undo/redo implementation for circle and ellipse. Though logic was same but even trivial things like displaying correct information in the undo stack seemed of much significance to us. This was tricky since I was doing it all in the wrong place. But it worked finally.

Then the bulb glowed again. And I did undo/redo for line without constructor over-riding now. It involved so much less effort today. And that feeling when your commit reduces the lines of code and does the same work correctly. So finally I am done with my undo/redo task. It is over. 😀

Yeah it involved struggle

Implementing move command only for line was not easy, albeit it has a glitch still but most of the important necessary things have been done.

The issues I faced include:

  1. setPos() function just with a single parameter viz. the scene position did all well. Undo redo had no issue. Though on undo, it quickly jumped to the very first position when it was initially added into the drawing area, which is quite not acceptable.
  2. The undo stack showed the changed position of the line in terms of its local coordinates. Well, we never wanted too. The scene position, preferably, should be shown in the undo stack for convenience.
  3. If the line is displaced from its original position and subsequently the file is saved, again we saw there were the coordinates of the very initial position when it was created in scene in first place.

The first still doesn’t make sense to me yet since a similar implementation in redo is working decently. For obtaining appropriate information for move operation on line, I followed constructor over-riding. The way the things were pushed on to the stack had also to be modified. Constructor over-riding did it in combination with a li’l hacks I had to do at a few places in order to obtain the desired results.

Similarly, saving the correct coordinates for line after is moved also was deployed with a li’l trick. Adding the current scene position to the original local position gave fruitful results while saving the file. The correct implementation for circle and ellipse is under development. 😀

A few trivial things

A few minute changes had to be done like setting correct icons. Did those. I have not yet understood the implementation of multiple line text. Scrutinized the code that had been implemented for it. Understanding work done by others is necessary. I figured a few unnecessary things and we got them corrected.

Saving of text was not in action till today. I used the function associated with QTextEdit class that was being used to add text to the drawing area.

toPlainText() function is being used to save the text entity.

I have figured out the issues with shortcuts not working in all documents. Hoping to close that issue soon too.


I got really excited when I reported to do the new LaTeX task for writing a book using it. 😀 A book! This was something I had in my mind during my six weeks training. Well finally I got an opportunity.

Focusing on the content only, we proceeded with a simple template for the book. I have got 4 chapters today in total. I have been exposed to so much of equations and mathematical stuff. Sleeping with 2 done. 😀 It was interesting all the way. Writing those equations, seeing them perfect in first go overwhelmed me. But not the case of those large square brackets. The starting one is small and closing one larger, maybe due to fraction towards the closing one.

Though this maybe a li’l time consuming, I would say it is awesome. ^_^.

Cracking the issues

I had considered that arc’s implementation would go on similarly as it was deployed in Dr. Geo by us but to no avail. The start and end angles tricked then and now too. My bad, could not figure it out yet. Though arc is painted but it is shifted by a same angle from the start point and end point.

Then I presented eCAD to one of my Civil colleagues. The users have their own so creative minds. The two things, as mentioned, to be at the top in priority list are scripting and live preview along with dimensioning. Yes, these really would make the software user friendly to a next level.

Next I have solved issue #51 today. Every time the undo stack reached to the state when it was empty and when any of the entity buttons was selected and drawing was started, there occurred a crash. This has been solved. Also the bounding rect for ellipse is computed but is not optimized for selection of the ellipses.

There are so many issues when eCAD is installed on Linux systems only. Will be preying them tomorrow as well.

Something New

Today I got my hands on wordpress while making my theme for my personal website. The template customizing was not a tough job initially but migrating it to wordpress was interesting. functions.php is a very important in any wordpress theme. The initial template provided static menu items in the top navigation bar. These were replaced bymain-nav registered in the functions file.

Though I was done with showing the navigation bar, CSS did not work. This issue came up due to difference in ids in the main file and css file. For the first time ever, I did something in CSS. I customized the look and feel of menu items as it was in the initial template. It is interesting.

Coming to eCAD, I will be moving with minimal example implementation to understand line() function. While playing with line, I got a polyline drawn in my eCAD.:D Well playing with things brings out something unexpected. A little manipulation will be needed to treat all the lines constituting the polyline as a single drawing item instead of all those multiple lines.

Trying to make out the best of my time.