Saturday, December 19, 2015

Kontinuity Progress

I have had so much fun working on Kontinuity, and it's not even anywhere close to usable yet!

December has been a busy month. College goes on steadily, I am always busy at the Geek Squad, and there always seems to be just one more Christmas meeting or White Elephant gift exchange to attend. But throughout all the craziness that is life, I keep working on this strange little program, trying to coax modules to work for me, making different parts and pieces link together and start working. Slowly, but steadily, I am seeing something take shape.

Every step, every feature that I am writing requires a bunch of research to make sure if I'm going to be using the right tool, using it the right way, and if it will be compatible with the other tools I'm using. For instance, I could be using Python 2.7 or 3.5. I could use CSV files for data storage, or I could take a little more time and figure out how to use SQLite3 (more than that, there are tons of Python modules for using SQLite3)! Do I want to use QT4 or QT5? What about OpenGL--do I need to create a context or should I try to get by with QT's painting tools?

For the most part, I've decided on what tools to use. Now I am making them work, and that's the hard part. An SQLite3 interface is built into python, so I have a class that lets me input and request data. Easy enough. Thanks to ZetCode for helping me along the way.

I had some trouble getting that data into an actual QT widget. I have been pouring through the QT documentation and converting the C++ code into Python with mixed success. Most of it makes sense after I work with it for a while, but I am still perplexed at times. However, with some time and persistence, I was able to use QTableWidgetItem to throw my python strings into a widget. However, I noticed that after adding an item to the database, even if I tried to redraw the widget, I had to restart the application before seeing the changes take effect. Pondering this problem at about 1AM, I took a few minutes to research the root problem.

It's easy for me to look at the problem as a short-term one. I just need to force this widget to do what I want! Then it will all work, right? Wrong. I'm taking the wrong approach to displaying my data. With a widget like the one I'm using, the entire database is being duplicated for one representation. That means I've got two databases and I'm not modifying the one that's on the screen. I need to be using a model view.

So today I am reading this page which leads me to watch videos on YouTube where the problem is properly explained. (Again, I have to thank someone else on the internet for helping me move along--this time, the shout-out goes to Yasin Uludag--thanks!) Hopefully, when I understand better the base problem, I'll be able to use one database and represent said database in several different formats.

I'd like one of those formats to be using OpenGL, but I spent several hours on creating a context and just never quite got to something that works. I was really close, and I think I can get it with just a little more time and research, but I'm just not there yet. I found a tutorial from KDAB to be immensely helpful, even with it being written in C++. I can't quite get the "versionFunctions()" part working properly in PyQt5, and I suspect it might be because of the differences in how PyQt4 used to handle OpenGL. Not sure on that one, I need to keep researching and testing...

All in all, I'm finding that the only way I can build the tools I need is to keep doing my research. I have to rely on the work of others to get help in figuring out how to tackle the problems I face. But that's the beauty of building and sharing. When we create things, we want to show them to others, to inspire people to create even bigger and better things! I love it when I get those "oh, wow, you can do that?" responses, not because my ego feels like it deserves compliments, but because I know I am inspiring others to to greater things!

I really can't just get on my laptop and code for several hours, expecting to have some brilliant product in the end. That's not how it works. Coding is a process of research, testing and collaboration, and if I have any success, it's because I'm standing on the shoulders of giants.

I look forward to the days ahead (Christmas!!!), and to furthering this project. It's on GitLab for those who are interested, but be warned, it's not very impressive! (yet?)

No comments:

Post a Comment