Skip to content
George Dietz edited this page May 21, 2013 · 15 revisions

Misc. Notes.

On encoding strings:

Note that QT houses strings as QtString objects. You should decode these as follows:

unicode(form.outcome_name_le.text().toUtf8(), “utf-8”)

Setting breakpoints within QT

pyqtRemoveInputHook()
pdb.set_trace()

‘Building’ the UI

(This note only pertains to the main window, currently meta.ui).

We’ve written a custom QTTableView component, by sub-classing the default the QTTableView class. The main ui needs to be informed of this, or else uses the default QTTableView (this will fail). Here’s how to do this. First, generate the ui_meta.py in the standard way.

> pyuic4.bat meta.ui -o ui_meta.py

Now open up the generated ui_meta.py (I know, I know, you shouldn’t have to edit this directly; but it was the path of least resistance). First, add the following at the top of the module (after the “from PyQt4…” line):

#import ma_data_table_view
from .. import ma_data_table_view # changed due to change in directory structure

Now, replace

self.tableView = QtGui.QTableView(self.nav_frame)

With:

self.tableView = ma_data_table_view.MADataTable(self.nav_frame)

you must also do this for results_window.py: we’ve subclassed QTextEdit to produce console-like behavior

import qconsole

#self.psuedo_console = QtGui.QTextEdit(self.splitter)
self.psuedo_console = qconsole.QConsole(self.splitter)

Special notes on OS X

Make sure you are using the correct version of python (obviously) for pyuic, otherwise this will fail (and complain about no PyQT module). I think that on my box, for example, the fact that I use a special python version for QT stuff throws off pyuic4. You can just do this, instead:

> python-oma /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/PyQt4/uic/pyuic.py start_up2.ui -o ui_start_up2.py

Thereby explicitly using the correct version.

Clear all variables in R (because I always forget how)

> rm(list=ls(all=TRUE))