debreate 0.7.7 bug and fix on Ubuntu 14.04

debreate = Debian Package Builder

:~$ debreate
Traceback (most recent call last):
File "/usr/bin/debreate", line 235, in <module>
File "/usr/bin/debreate", line 232, in TestConfig
Run(pos, size, maximize, center, dias, cwd)
File "/usr/bin/debreate", line 81, in Run
frame = debreate.MainWindow(None, -1, "", pos, size)
File "/usr/share/debreate/", line 218, in __init__
self.page_build = panbuild.Panel(self.Wizard, ID_BUILD)
File "/usr/share/debreate/", line 38, in __init__
self.md5 = _md5.md5(self.md5)
AttributeError: 'module' object has no attribute 'md5'

Solution at line37:

self.md5 =
#self.md5 = _md5.MD5()

Keyboard hooks / event filters on Qt


A special keyboard is used to navigate through a Qt program. The keyboard has only arrows and Enter key.
The program has several buttons (with only one it could be set as prefered and thus Enter would work)
he mouse can not be used and

At first glance the function “void keyPressEvent( QKeyEvent *k );” seems better at first glance but in practice it doesn’t allow asking for the object generating the event and the keys do different things depending on where they are pressed.

In the .h file:

	    bool eventFilter(QObject *object, QEvent *event);

In the cpp file:

ui->password->installEventFilter(this); // I also want to move to the next input box with the down arrow key.

ui->validate->installEventFilter(this); // The buttons are activated with Space key instead of Enter key

bool userpass::eventFilter(QObject *object, QEvent *event){

    QKeyEvent *k = static_cast(event);

    if (event->type() == QEvent::KeyPress)

	 if (object == ui->password ) {
            if(k->key() == Qt::Key_Down || k->key() == Qt::Key_Enter || k->key() == Qt::Key_Return ){
                //  qDebug("Going down");

	  if (object == ui->validate ) {         
           if (k->key() == Qt::Key_Enter || k->key() == Qt::Key_Return ){
                qDebug("Trying to log in");
                // validate is a button and the buttons are activated with Spacebar instead of Enter key.
                // So I create an artificial key event and I send it to the object who received enter.
                QKeyEvent *event = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Space, Qt::NoModifier);
                QCoreApplication::postEvent (object, event);
    } // end of keypress events.

    return 0;
	/* How to get the native keycode on Linux and XWindow:
	   On XWindow for keys without a Qt name, use the command "showkey" and do +8 to it.
	   Then use nativeScanCode. (native for Xwindow that is. For the kernel is nativeScanCode-8)
	   example: if(k->nativeScanCode()==36 || k->nativeScanCode()==114 ){ ...