Rapid Gui Programming – Movies – Chapter 8

As I have mentioned here before, it is tricky for me to upgrade the scripts written by the author in PyQt4 to PyQt5, the version I am using (PyQt 5.5.1)

I’ve come up with new problems with chapter 8. The first was what I though was another problem with signals.

I’ve snipped the segment of code with the original being commented (preceded with and *), and my solution below it. In this case I spent a week or two trying to resolve this error:

# self.connect(self.table, SIGNAL("itemDoubleClicked(QTableWidgetItem*)"),
#                self.editEdit)
self.table.itemDoubleClicked.connect(self.editEdit())
QShortcut(QKeySequence("Return"), self.table, self.editEdit)

 

def fileOpen(self):
    if not self.okToContinue():
        return
    path = (QFileInfo(self.movies.filename()).path()
            if not self.movies.filename() else ".")
    # QFileDialog(QWidget, Qt.WindowFlags) QFileDialog(QWidget parent=None, str caption='', str directory='', str filter='')
    options = QFileDialog.Options()
    options |= QFileDialog.DontUseNativeDialog
    options |= QFileDialog.List
    fname, _ = QFileDialog.getOpenFileName(self,
            "My Movies - Load Movie Data", path,
            "My Movies data files ({})".format(self.movies.formats()), options=options)
    if fname:
        ok, msg = self.movies.load(fname[0])
        self.statusBar().showMessage(msg, 5000)
        self.updateTable()

Author: korkiley

Systems Administrator at University of Vermont (retired as of 7/1/2012) Married Favorite Activities: Condor Glider Online Competition, Developing web sites, making espresso, and keeping a blog

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s