Mercurial > hg > Feedworm
view AddFeed.py @ 254:156edbd0733a pyqt5
the pyqt5 branch was merged into the default branch
author | Dirk Olmes <dirk@xanthippe.ping.de> |
---|---|
date | Fri, 10 Nov 2017 01:45:55 +0100 |
parents | 3ce39af93e77 |
children |
line wrap: on
line source
# -*- coding: utf-8 -*- from PyQt5.QtWidgets import QDialog from Ui_AddFeed import Ui_AddFeed import logging class AddFeed(QDialog): def __init__(self, backend=None): super(AddFeed, self).__init__(None) self.backend = backend self.exception = None self.ui = Ui_AddFeed() self.ui.setupUi(self) self.ui.url.setFocus() def accept(self): try: url = self.getUrl() self.backend.createFeed(url) except AttributeError as ae: logging.getLogger("AddFeed").info(ae) self.exception = ae super(AddFeed, self).accept() def getUrl(self): text = self.ui.url.text() # the content of a QLineEdit is a QString, convert it to a Python string return str(text)