Hi folks, now is the time to show the achievements which kept me busy from a month during the coding period for my ‘Google Summer of Code’ project LabPlot Theme Manager and taught me so many things related to an open-source community (KDE). This was a wonderful experience for me to brush up my coding skills and grow up a little-bit as a programmer.
As I mentioned in my last blog, LabPlot is an open source tool to analyze and visualize scientific data, for which we needed to create a theme manager which can provide users with different themes for the plots as per their taste. Before creating a theme manager, understanding so many existing functionalities in LabPlot was challenging for me, also which components the theme manager could effect was an important decision to take.
So, I would like to start from the beginning of coding period. In the starting of development phase, diving deep into the existing code was the first step to go. I created the development environment for KDE , so that the code can run on my local machine. Being a fresh programmer in an open-source project, it was quite new for me from getting all the dependencies to build an existing project and contribute to it which was made an easy task with the help of my mentor Alexander.
As I am a bit experienced to work with Qt Framework, I started to understand snippets of code and to make changes in it. I analyzed current implementation of LabPlot dock widgets, their features and defined which modules will interact/ which values must be preserved while implementing the theme manager.
For creating themes, I had to first decide on different color palettes/schemes (most fundamental need!). For this I went through a lot of websites and some literature to get to know how the color schemes should be put together. I decided on defining five colors in each theme palette. After this step, I defined the properties of a theme for eg. filling colors and styles of different components of the plot. I created one file per theme consisting of such properties. I created 3 themes so far- Bright, Creme and GraySlate… 😉
Now, the next step was to be able to read and apply these properties to a plot. For this functionality, I defined various overloaded functions- loadTheme() in component classes which were able to set the properties individually (component wise) by reading them from theme files. Since all these components were children of class WorksheetElement, I simply used this (overloaded) function for all the WorksheetElement’s child classes to apply the theme.
I also wrote an algorithm to generate a total of 35 shades and tints from each 5-color palette, as we need a range of different colors to be applied on different parts of the plot and its curves.
Additionally, I defined a class ThemeHandler which controls the primary functionalities of the theme manager. I created an object of this class in CartesianPlotDock which as a result added a button in its dock widget window for choosing a theme. Currently when clicked, this button lets the user choose a theme by clicking on its name from a list of existing themes. The next step of this project would be now to create a preview panel of these themes.
All in all , this concludes my mid-term results 🙂 Don’t forget to give me your feedback!