September 10th, 2007 by exhuma.twn
Yet another thing that’s not automagic in Qt.
Here’s a python solution:
if __name__ == "__main__":
app = QtGui.QApplication(sys.argv)
dw = app.desktop().width()
dh = app.desktop().height()
myapp = MainWindow()
myapp.setGeometry(
int((dw - (dw - (dw / 2)) * 1.5) / 2),
int((dh - (dh - (dh / 2)) * 1.5) / 2),
int((dw - (dw / 2)) * 1.5),
int((dh - (dh / 2)) * 1.5))
myapp.show()
sys.exit(app.exec_())
This will also resize the window, adapting to the desktop size.
Found and adapted from the Qt interest archive.
Posted in Python | No Comments »
September 10th, 2007 by exhuma.twn
Many things are very easy to accomplish in Qt. Qt’s designer is a great help with that. But the is no option to simply “enable” scrollbars for a frame. Also, the QScrollArea can nowhere be found in the designer. The solution is actually quite simple:
- Add the component you want to be scrollable (QFrame, QLabel, …) in the designer as usual
- In the application code:
- Create a new QScrollArea
- Set the parent of the widget you created in the designer to “None”
- Set the widget of the QScrollArea to the widget from step 1
- Insert the QScrollArea to you ui
And here’s some example code (boiled down to the essentials):
sa = QtGui.QScrollArea()
self.ui.myWidget.setParent(None)
sa.setWidget(self.ui.myWidget)
self.ui.vboxlayout1.insertWidget(0, sa)
You would probably write this somewhere in you application-constructor right after you call setupUi.
This will insert the scroll area at the top of vboxlayout1 (see the doc for insertWidget). You can of course also use addWidget.
It’s a shame that there’s no direct support for QScrollArea in designer. Maybe we will see it in some future release.
An example for C++ can be found in the Qt Forums.
Posted in Python | 2 Comments »
September 6th, 2007 by exhuma.twn
I never cared about which terminal to chose. I usually ended up with aterm on non-KDE boxes and Konsole on KDE boxes. This comparison (and the attached comments) is actually quite interesting.
The results were quite surprising 😉
Posted in Linux | No Comments »
August 16th, 2007 by exhuma.twn
Oh yess… rants… I love to rant… and after my adventures of today and reading the last post, I have to dump my thoughts as well. And this one is about one of our web-providers in our oh-so technically advanced country. Or so they claim.
Read the rest of this entry »
Posted in Babble | No Comments »
August 10th, 2007 by exhuma.twn
Due to inane network restrictions I am maintaining several copies of my vimrc file. I would syncronize it though other means. Alas, the restrictions not only cover the network. So I have to resort to simply posting it here.
This is not meant to be an explanation of vim configuration file. However, it contains lots of comments, and might prove a good primer/starting-point. Eventually I will also include other modifications I made in my vim-home-folder as they are either used in the vimrc or just plain useful 😉
Read the rest of this entry »
Posted in Babble, Coding Voodoo | 2 Comments »
July 26th, 2007 by exhuma.twn
Oholoh is a site that keeps code statistics of open-source projetcs. It’s very interesting to browse though the different projects and look at their metrics.
It can also be a nice incentive to get people do commit on a regular basis, as it adds a sort of healthy competition to the development cycle.
Anyhow…. Great idea, and it already keeps track of quite a number of projects.
Posted in Coding Voodoo | No Comments »
July 19th, 2007 by exhuma.twn
That’s all I have to say!
Posted in Coding Voodoo | No Comments »
July 12th, 2007 by exhuma.twn
A few months ago, I decided to write a “quick” introduction to the LAB color space.
But instead of just writing the “hey! look, I can increase the luminosity of my image without losing color information”-type of post, I decided to get intimate with LAB and make the fuzzier concepts (the A and the B) a bit easier to understand using practical examples.
The reason why I still haven’t written more about LAB is simple. I got hooked! The more I read about LAB the more I am intrigues by the possibilities and the more I read about it. It’s a vicious circle.
I am now working on my 3rd attempt of the first example (yes, the usual-luminosity-suspect 😉 ) and I am still not quite satisfied. My recent discovery is how stupidly easy one can fix a color-cast in an image with LAB. With this technique you can even get rid of light fog or haze.
However, creating, and annotating, the example images is very time-consuming. And until end of summer I am still very busy, so I will have to postpone my posts a few months 😐
Stay tuned!
Posted in Photo Voodoo | No Comments »
July 12th, 2007 by exhuma.twn
My preferred way to deploy python applications on Windows is to use py2exe.
py2exe is a Python Distutils extension which converts Python scripts into executable Windows programs, able to run without requiring a Python installation.
If you run in trouble with sip, read on…
Read the rest of this entry »
Posted in Python | 1 Comment »
July 9th, 2007 by wickeddoc
I create a small Flickr API interface for PHP5 which takes advantage of the Overloading feature of PHP5.
Using the __call method we can dynamically create an interface to all the Flickr API functions using only a very small script.
The name of the class is purely ironic as it is a very simple and easy-to-use class and far from Overkill.
Read the rest of this entry »
Posted in PHP | 7 Comments »