Robert Basic's blog

Posts tagged 'pyqt'

pugdebug 1.0.0.

by Robert Basic on July 01, 2015.

After 3 months since announcing that I’m working on pugdebug, and some 5 months since I actually started working on it, it is finally time to let version 1.0.0 out in the wild.

It’s been a busy 3 months: 82 pull requests got merged, 67 issues resolved, more than 350 commits pushed. A lot of changes, fixes and improvements found their way into this first version.

First of all, a big thanks goes out to Ivan Habunek and Srdjan Vranac for helping. They asked for and added new features, tested on Windows and OSX systems, helped fleshing out ideas.

One of the biggest news is that there are binaries built for Linux and Windows operating systems, using pyinstaller. These binaries include everything pugdebug needs to work so there is no need to install anything. Just download the binary for your system and run it. That’s it. It makes me incredibly happy that it’s possible to have it this simple to run and use pugdebug.


The user interface has improved a great deal. It is using dockable widgets for different pieces of the UI, making the layout of the application configurable by just dragging the widgets around. It’s not all great though, there’s still room for improvement, but it will be better over time.

pugdebug allows to debug multiple requests one after the other which helps debugging in a more “complicated” scenario where there are, for example, multiple AJAX calls triggered in succession. By starting to listen to incomming connections, pugdebug will listen to all incoming connections and, based on the IDE key setting, decide should the connection be queued for debugging, or ignored.

It is also now possible to create projects inside pugdebug, as a way to help switching between different PHP projects where debugging is needed. Simply name the project, set it’s settings and that’s it. pugdebug stores all the configuration files in it’s own directory, so nothing will be added to your PHP projects.

I’m especially happy and proud that pugdebug got included on Xdebug’s website on the list of remote debugging clients. Thanks to Derick Rethans!

For more information on how to use pugdebug, take a look at the read me file or the wiki and let me know if you have any issues with it!

Tags: debugging, pugdebug, pyqt, python, qt, stable, xdebug.
Categories: Development, Programming, Software.

Introducing pugdebug

by Robert Basic on April 01, 2015.

In my spare time in the past few months I was working on a tool that would help me in my every day job as a PHP programmer. As you may, or may not, know, I’m using vim as my editor/almost IDE, but one thing that is missing from it is the ability to debug PHP files remotely. Yes, there are a bunch of plugins out there that add debugging to vim, but none of them felt usable for me.

And based on my google searches, there are no standalone remote debuggers for PHP, that work on Linux.

In February this year I started to work on a desktop application that would help me address this issue.


pugdebug  is a PyQt desktop application meant to be used as a remote debugger for PHP, that communicates with xdebug.

It is meant to be a debugger and only a debugger. There are a plenty of (good) IDEs that include remote debugging and I’m not going to start writing another one (although I did start one, once).

The application is still pretty simple, ugly as hell, but it works. Sort of. There are still a few kinks left to sort out and I’m doing my best to write them all down.

It’s dependencies are Python 3.4, Qt 5.4, SIP 4.6 and PyQt 5.4. The read me file should have a bit more details on how to start using it. I know it’s a bit messy to set everything up, but I am working on building executables for different Linux distros. That stuff is hard!

It is lincesed under the GNU GPL v3 license, because PyQt.

Using pugdebug

Start the application, click the start button and then it waits for incomming connections. Load a PHP page to start a HTTP debug session, and pugdebug should break on the first line of your code.

Stepping around the code is possible with the step into, step out and step over commands. At each step, pugdebug will get the current variables state from xdebug and display them.

Double clicking on lines in the code viewer will set breakpoints on those lines. Do note though that there needs to be a debugging session active to be able to set a breakpoint. This will change in the (near) future.

And that’s about it. While I know it doesn’t look like much, this was, and still is, a nice learning experience for me and the best part of it is that I was using pugdebug earlier this week to debug a PHP application I’m working on.

Tags: debugging, pugdebug, pyqt, python, qt, xdebug.
Categories: Development, Programming, Software.

Passing arguments to custom slots in PyQt

by Robert Basic on November 30, 2010.
Heads-up! You're reading an old post and the information in it is quite probably outdated.

While hacking on ape, I came to a situation where I need to pass some arguments to a custom defined slot. The slot is being called from different signals, one where the argument is passed by PyQt itself and a second one where I need to programmatically pass the argument to the slot.

First I tried with something like:

action = QAction("My action", parent)

which ended in an error: TypeError: connect() slot argument should be a callable or a signal, not ‘NoneType’

After a bit of poking around I passed a lambda function to the connect() method:

action = QAction("My action", parent)
action.triggered.connect(lambda arg=my_argument: my_slot(arg))

Works like a charm.

Also this is my first try to use github gists as a way to embed/highlight code. Hope it’ll work out.

Happy hackin’!

Tags: ape, lambda, pyqt, python, signals, slots.
Categories: Programming.

Connecting signals and slots with PyQt - the new style

by Robert Basic on November 09, 2010.
Heads-up! You're reading an old post and the information in it is quite probably outdated.

While working on ape I had a problem with figuring out how to properly connect a signal to a slot, where the signal is emitted by a QTreeView widget. As this is not my first app with python and pyqt, I was doing something like (this is, btw, the “old style”):

self.connect(widget, SIGNAL("emitted_signal()"), self.my_slot)

but it simply didn’t work. Nothing happened. I was trying all different of connect/signal/slot combinations but everything was just dead silent. Google gave only pretty much old posts talking about QT3. Then I figured that, because the QTreeView is “sitting” inside a QDockWidget, maybe that dock widget thingy is somehow intercepting/taking over the signals. Nope. Wth? Wtf is going on? Current pyqt version is (on my machine) 4.6. Last time I used pyqt it was something like 4.2 or 4.3. Something must’ve been changed in the mean time. Off to the pyqt docs I go (btw, I use the official QT docs, the C++ version, there isn’t really a big difference from pyqt): PyQt reference, chapter 7 - “New-style Signal and Slot Support”. A-ha! They changed it! Here is an example of the “new style”:


Oh my, isn’t that just beautiful?! Much more readable and simpler, for me at least. And it works! Yay! The QTreeView signals are happily connected to slots, thus, I’m happy too.

A few paragraphs later, turns out that the “old style” isn’t thrown out, it should still work. Why it didn’t work for me escapes me at the moment, but honestly, I don’t really care as long as the new style is working.

Happy hackin’!

Tags: ape, pyqt, python, signals, slots.
Categories: Development, Programming.

ape is a PHP editor

by Robert Basic on November 06, 2010.
Heads-up! You're reading an old post and the information in it is quite probably outdated.

A week ago I started working on a simple editor/IDE for PHP called ape. That’s my weak try on creating a reverse acronym as ape stands for - ape is a PHP editor. This is kind of an introductory post into the whole developing process of it, as my intention is to blog about it a bit more :)


First, to answer the question everyone is giving me when I mention I’m writing ape:
“Why the hell do you do that (to yourself)?”

Programming is fun. Programming is interesting. Programming makes me learn new things. I like having fun and I do this to learn more about programming and having even more fun. I’m writing web applications each and every day, so writing a desktop app requires a different way of thinking and leaving my “comfort zone” (altho, I’m quite comfortable in front of the keyboard hackin’ away code). ape is written in python and pyqt, but again, it’s not about the language used, for me it is about programming.

The idea

Netbeans is my main IDE for quite some time now and I love it. I know my way around vim, too. But, netbeans has too many features for my taste - I use SVN, git, (on rare occasions I write them) run unit tests from the console. As for vim, maybe I just don’t get it enough, but I feel less productive with it. Debugging PHP apps ends up var_dump-ing things all over the place. So, basically what I want/need from an editor is grouping files into projects, regex search/replace, code coloring & completion and, of course, file editing.

I plan to write a feature a day. On my personal projects I usually want to push out as much code as I can during one day as I’m highly motivated, but this time want to try a different approach. So far I didn’t got far, figured out syntax highlighting, opening files from a file browser widget thingy and things like that, but more on that in other posts.

If anyone wants to take a look, the source code is up on github. It is licensed under GNU GPL v2, as pyqt is licensed under it and I don’t want to waste my time on figuring out could I use MIT or some other license.

Happy hackin’!

Tags: ape, editor, ide, php, pyqt, python.
Categories: Development, Programming.