• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python qt.QtDo类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中weboob.tools.application.qt.QtDo的典型用法代码示例。如果您正苦于以下问题:Python QtDo类的具体用法?Python QtDo怎么用?Python QtDo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了QtDo类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: ContactNotes

class ContactNotes(QWidget):
    """ Widget for storing notes about a contact """

    def __init__(self, weboob, contact, parent=None):
        QWidget.__init__(self, parent)
        self.ui = Ui_Notes()
        self.ui.setupUi(self)

        self.weboob = weboob
        self.contact = contact

        self.ui.textEdit.setEnabled(False)
        self.ui.saveButton.setEnabled(False)
        self.process = QtDo(self.weboob, self._getNotes_cb, self._getNotes_eb)
        self.process.do('get_notes', self.contact.id, backends=(self.contact.backend,))

        self.connect(self.ui.saveButton, SIGNAL('clicked()'), self.saveNotes)

    def _getNotes_cb(self, backend, data):
        if not backend or not data:
            self.process = None
            self.ui.textEdit.setEnabled(True)
            self.ui.saveButton.setEnabled(True)
            return

        self.ui.textEdit.setText(data)

    def _getNotes_eb(self, backend, error, backtrace):
        if isinstance(error, NotImplementedError):
            return

        self.ui.textEdit.setEnabled(True)
        self.ui.saveButton.setEnabled(True)
        content = unicode(self.tr('Unable to load notes:\n%s\n')) % to_unicode(error)
        if logging.root.level == logging.DEBUG:
            content += '\n%s\n' % to_unicode(backtrace)
            QMessageBox.critical(self, self.tr('Error while loading notes'),
            content, QMessageBox.Ok)

    def saveNotes(self):
        text = unicode(self.ui.textEdit.toPlainText())
        self.ui.saveButton.setEnabled(False)
        self.ui.textEdit.setEnabled(False)

        self.process = QtDo(self.weboob, self._saveNotes_cb, self._saveNotes_eb)
        self.process.do('save_notes', self.contact.id, text, backends=(self.contact.backend,))

    def _saveNotes_cb(self, backend, data):
        self.ui.saveButton.setEnabled(True)
        self.ui.textEdit.setEnabled(True)
        pass

    def _saveNotes_eb(self, backend, error, backtrace):
        self.ui.saveButton.setEnabled(True)
        self.ui.textEdit.setEnabled(True)
        content = unicode(self.tr('Unable to save notes:\n%s\n')) % to_unicode(error)
        if logging.root.level == logging.DEBUG:
            content += '\n%s\n' % to_unicode(backtrace)
            QMessageBox.critical(self, self.tr('Error while saving notes'),
            content, QMessageBox.Ok)
开发者ID:Boussadia,项目名称:weboob,代码行数:60,代码来源:contacts.py


示例2: savePage

    def savePage(self):
        """ Saves the current page to the remote site """
        if self.backend is None:
            return
        new_content = unicode(self.ui.contentEdit.toPlainText())
        minor = self.ui.minorBox.isChecked()
        if new_content != self.content.content:
            self.ui.saveButton.setEnabled(False)
            self.ui.saveButton.setText('Saving...')
            self.ui.contentEdit.setReadOnly(True)
            self.content.content = new_content
            message = unicode(self.ui.descriptionEdit.text())

            def finished():
                self.process = None
                self.ui.saveButton.setText('Saved')
                self.ui.descriptionEdit.clear()
                self.ui.contentEdit.setReadOnly(False)

            self.process = QtDo(self.weboob,
                                None,
                                self._errorSavePage,
                                finished)
            self.process.do('push_content',
                            self.content,
                            message,
                            minor=minor,
                            backends=self.backend)
开发者ID:frankrousseau,项目名称:weboob,代码行数:28,代码来源:main_window.py


示例3: loadHistory

    def loadHistory(self):
        """ Loads the page's log into the 'History' tab """
        if self.backend is None:
            return

        self.ui.loadHistoryButton.setEnabled(False)
        self.ui.loadHistoryButton.setText("Loading...")

        self.ui.historyTable.clear()
        self.ui.historyTable.setRowCount(0)

        self.ui.historyTable.setHorizontalHeaderLabels(["Revision",
                                                        "Time",
                                                        "Author",
                                                        "Summary"])
        self.ui.historyTable.setColumnWidth(3, 1000)

        self.process = QtDo(self.weboob,
                            self._gotRevision,
                            self._errorHistory)
        self.process.do(self.app._do_complete,
                        self.ui.nbRevBox.value(),
                        (),
                        'iter_revisions',
                        self.content.id,
                        backends=(self.backend,))
开发者ID:Boussadia,项目名称:weboob,代码行数:26,代码来源:main_window.py


示例4: refreshHousingsList

    def refreshHousingsList(self):
        name = unicode(self.ui.queriesList.itemText(self.ui.queriesList.currentIndex()))
        q = self.config.get('queries', name)

        if q is None:
            return q

        self.ui.housingsList.clear()
        self.ui.queriesList.setEnabled(False)
        self.ui.bookmarksButton.setEnabled(False)

        query = Query()
        query.type = int(q.get('type', 0))
        query.cities = []
        for c in q['cities']:
            city = City(c['id'])
            city.backend = c['backend']
            city.name = c['name']
            query.cities.append(city)

        query.area_min = int(q['area_min']) or None
        query.area_max = int(q['area_max']) or None
        query.cost_min = int(q['cost_min']) or None
        query.cost_max = int(q['cost_max']) or None
        query.nb_rooms = int(q['nb_rooms']) or None

        self.process = QtDo(self.weboob, self.addHousing)
        self.process.do('search_housings', query)
开发者ID:Boussadia,项目名称:weboob,代码行数:28,代码来源:main_window.py


示例5: saveNotes

    def saveNotes(self):
        text = unicode(self.ui.textEdit.toPlainText())
        self.ui.saveButton.setEnabled(False)
        self.ui.textEdit.setEnabled(False)

        self.process = QtDo(self.weboob, self._saveNotes_cb, self._saveNotes_eb)
        self.process.do('save_notes', self.contact.id, text, backends=(self.contact.backend,))
开发者ID:Boussadia,项目名称:weboob,代码行数:7,代码来源:contacts.py


示例6: _sendPressed

    def _sendPressed(self):
        if not self.ui.replyWidget.isVisible():
            return

        text = unicode(self.ui.replyEdit.toPlainText())
        title = unicode(self.ui.titleEdit.text())

        self.ui.backendsList.setEnabled(False)
        self.ui.threadsList.setEnabled(False)
        self.ui.messagesTree.setEnabled(False)
        self.ui.replyButton.setEnabled(False)
        self.ui.replyWidget.setEnabled(False)
        self.ui.sendButton.setText(self.tr('Sending...'))
        flags = 0
        if self.ui.htmlBox.currentIndex() == 0:
            flags = Message.IS_HTML
        m = Message(thread=self.thread,
                    id=0,
                    title=title,
                    sender=None,
                    receivers=None,
                    content=text,
                    parent=self.message,
                    flags=flags)
        self.process_reply = QtDo(self.weboob, self._postReply_cb, self._postReply_eb)
        self.process_reply.do('post_message', m, backends=self.thread.backend)
开发者ID:eirmag,项目名称:weboob,代码行数:26,代码来源:messages_manager.py


示例7: searchCity

    def searchCity(self):
        pattern = unicode(self.ui.cityEdit.text())
        self.ui.resultsList.clear()
        self.ui.cityEdit.clear()
        self.ui.cityEdit.setEnabled(False)

        self.search_process = QtDo(self.weboob, self.addResult, fb=self.addResultEnd)
        self.search_process.do('search_city', pattern)
开发者ID:frankrousseau,项目名称:weboob,代码行数:8,代码来源:query.py


示例8: MiniVideo

class MiniVideo(QFrame):
    def __init__(self, weboob, backend, video, parent=None):
        QFrame.__init__(self, parent)
        self.ui = Ui_MiniVideo()
        self.ui.setupUi(self)

        self.weboob = weboob
        self.backend = backend
        self.video = video
        self.ui.titleLabel.setText(video.title)
        self.ui.backendLabel.setText(backend.name)
        self.ui.durationLabel.setText(unicode(video.duration))
        self.ui.authorLabel.setText(unicode(video.author))
        self.ui.dateLabel.setText(video.date and unicode(video.date) or '')
        if video.rating_max:
            self.ui.ratingLabel.setText('%s / %s' % (video.rating, video.rating_max))
        else:
            self.ui.ratingLabel.setText('%s' % video.rating)

        self.process_thumbnail = QtDo(self.weboob, self.gotThumbnail)
        self.process_thumbnail.do('fillobj', self.video, ['thumbnail'], backends=backend)

    def gotThumbnail(self, backend, video):
        if not backend:
            return

        if video.thumbnail and video.thumbnail.data:
            img = QImage.fromData(video.thumbnail.data)
            self.ui.imageLabel.setPixmap(QPixmap.fromImage(img))

    def enterEvent(self, event):
        self.setFrameShadow(self.Sunken)
        QFrame.enterEvent(self, event)

    def leaveEvent(self, event):
        self.setFrameShadow(self.Raised)
        QFrame.leaveEvent(self, event)

    def mousePressEvent(self, event):
        QFrame.mousePressEvent(self, event)

        video = self.backend.get_video(self.video.id)
        if video:
            video_widget = Video(video, self)
            video_widget.show()
开发者ID:eirmag,项目名称:weboob,代码行数:45,代码来源:minivideo.py


示例9: MetaGroup

class MetaGroup(IGroup):
    def iter_contacts(self, cb):
        if self.id == 'online':
            status = Contact.STATUS_ONLINE|Contact.STATUS_AWAY
        elif self.id == 'offline':
            status = Contact.STATUS_OFFLINE
        else:
            status = Contact.STATUS_ALL

        self.process = QtDo(self.weboob, lambda b, d: self.cb(cb, b, d))
        self.process.do('iter_contacts', status, caps=ICapContact)

    def cb(self, cb, backend, contact):
        if contact:
            cb(contact)
        elif not backend:
            self.process = None
            cb(None)
开发者ID:jocelynj,项目名称:weboob,代码行数:18,代码来源:contacts.py


示例10: urlClicked

    def urlClicked(self):
        url = unicode(self.ui.urlEdit.text())
        if not url:
            return

        backend_name = unicode(self.ui.backendsList.currentText())
        self.ui.urlButton.setEnabled(False)
        self.url_process = QtDo(self.weboob, self.urlClicked_cb, self.urlClicked_eb)
        self.url_process.do('get_contact', url, backends=backend_name)
开发者ID:jocelynj,项目名称:weboob,代码行数:9,代码来源:contacts.py


示例11: retrieveContact

    def retrieveContact(self, url):
        backend_name = unicode(self.ui.backendsList.currentText())
        self.ui.urlButton.setEnabled(False)

        def finished():
            self.url_process = None
            self.ui.urlButton.setEnabled(True)

        self.url_process = QtDo(self.weboob, self.retrieveContact_cb, self.retrieveContact_eb, finished)
        self.url_process.do('get_contact', url, backends=backend_name)
开发者ID:frankrousseau,项目名称:weboob,代码行数:10,代码来源:contacts.py


示例12: refreshThreadMessages

    def refreshThreadMessages(self, backend, id):
        self.ui.messagesTree.clear()
        self.ui.messageBody.clear()
        self.ui.backendsList.setEnabled(False)
        self.ui.threadsList.setEnabled(False)
        self.ui.replyButton.setEnabled(False)
        self.hideReply()

        self.process = QtDo(self.weboob, self._gotThreadMessages)
        self.process.do('get_thread', id, backends=backend)
开发者ID:jocelynj,项目名称:weboob,代码行数:10,代码来源:messages_manager.py


示例13: refreshMessages

    def refreshMessages(self, fillobj=False):
        if self.process_msg:
            return

        self.ui.refreshButton.setEnabled(False)
        self.process_msg = QtDo(self.weboob, self.gotThread, self.gotError)
        if fillobj and self.thread:
            self.process_msg.do('fillobj', self.thread, ['root'], backends=self.contact.backend)
        else:
            self.process_msg.do('get_thread', self.contact.id, backends=self.contact.backend)
开发者ID:jocelynj,项目名称:weboob,代码行数:10,代码来源:contacts.py


示例14: iter_contacts

    def iter_contacts(self, cb):
        if self.id == 'online':
            status = Contact.STATUS_ONLINE|Contact.STATUS_AWAY
        elif self.id == 'offline':
            status = Contact.STATUS_OFFLINE
        else:
            status = Contact.STATUS_ALL

        self.process = QtDo(self.weboob, lambda b, d: self.cb(cb, b, d))
        self.process.do('iter_contacts', status, caps=ICapContact)
开发者ID:jocelynj,项目名称:weboob,代码行数:10,代码来源:contacts.py


示例15: MetaGroup

class MetaGroup(IGroup):
    def iter_contacts(self, cb):
        if self.id == 'online':
            status = Contact.STATUS_ONLINE|Contact.STATUS_AWAY
        elif self.id == 'offline':
            status = Contact.STATUS_OFFLINE
        else:
            status = Contact.STATUS_ALL

        self.process = QtDo(self.weboob, lambda d: self.cb(cb, d), fb=lambda: self.fb(cb))
        self.process.do('iter_contacts', status, caps=CapContact)

    def cb(self, cb, contact):
        if contact:
            cb(contact)

    def fb(self, fb):
        self.process = None
        if fb:
            fb(None)
开发者ID:frankrousseau,项目名称:weboob,代码行数:20,代码来源:contacts.py


示例16: refreshThreads

    def refreshThreads(self):
        self.ui.messagesTree.clear()
        self.ui.threadsList.clear()

        self.hideReply()
        self.ui.replyButton.setEnabled(False)
        self.ui.backendsList.setEnabled(False)
        self.ui.threadsList.setEnabled(False)

        self.process_threads = QtDo(self.weboob, self._gotThread)
        self.process_threads.do('iter_threads', backends=self.backend, caps=ICapMessages)
开发者ID:jocelynj,项目名称:weboob,代码行数:11,代码来源:messages_manager.py


示例17: addHousing

    def addHousing(self, backend, housing):
        if not backend:
            self.ui.queriesList.setEnabled(True)
            self.ui.bookmarksButton.setEnabled(True)
            self.process = None
            return

        if not housing:
            return

        item = HousingListWidgetItem(housing)
        item.setAttrs(self.storage)

        if housing.photos is NotLoaded:
            process = QtDo(self.weboob, lambda b, c: self.setPhoto(c, item))
            process.do('fillobj', housing, ['photos'], backends=housing.backend)
            self.process_photo[housing.id] = process
        elif housing.photos is not NotAvailable and len(housing.photos) > 0:
            if not self.setPhoto(housing, item):
                photo = housing.photos[0]
                process = QtDo(self.weboob, lambda b, p: self.setPhoto(housing, item))
                process.do('fillobj', photo, ['data'], backends=housing.backend)
                self.process_photo[housing.id] = process

        self.ui.housingsList.addItem(item)

        if housing.fullid in self.process_bookmarks:
            self.process_bookmarks.pop(housing.fullid)
开发者ID:Boussadia,项目名称:weboob,代码行数:28,代码来源:main_window.py


示例18: postReply

 def postReply(self):
     text = unicode(self.ui.textEdit.toPlainText())
     self.ui.textEdit.setEnabled(False)
     self.ui.sendButton.setEnabled(False)
     m = Message(thread=self.thread,
                 id=0,
                 title=u'',
                 sender=None,
                 receivers=None,
                 content=text,
                 parent=self.messages[0].message if len(self.messages) > 0 else None)
     self.process_reply = QtDo(self.weboob, self._postReply_cb, self._postReply_eb)
     self.process_reply.do('post_message', m, backends=self.contact.backend)
开发者ID:jocelynj,项目名称:weboob,代码行数:13,代码来源:contacts.py


示例19: gotEvent

    def gotEvent(self, event):
        found = False
        for i in xrange(self.ui.typeBox.count()):
            s = self.ui.typeBox.itemData(i)
            if s == event.type:
                found = True
        if not found:
            print(event.type)
            self.ui.typeBox.addItem(event.type.capitalize(), event.type)
            if event.type == self.event_filter:
                self.ui.typeBox.setCurrentIndex(self.ui.typeBox.count()-1)

        if self.event_filter and self.event_filter != event.type:
            return

        if not event.contact:
            return

        contact = event.contact
        contact.backend = event.backend
        status = ''

        if contact.status == contact.STATUS_ONLINE:
            status = u'Online'
            status_color = 0x00aa00
        elif contact.status == contact.STATUS_OFFLINE:
            status = u'Offline'
            status_color = 0xff0000
        elif contact.status == contact.STATUS_AWAY:
            status = u'Away'
            status_color = 0xffad16
        else:
            status = u'Unknown'
            status_color = 0xaaaaaa

        if contact.status_msg:
            status += u' — %s' % contact.status_msg

        name = '<h2>%s</h2><font color="#%06X">%s</font><br /><i>%s</i>' % (contact.name, status_color, status, event.backend)
        date = event.date.strftime('%Y-%m-%d %H:%M')
        type = event.type
        message = event.message

        item = QTreeWidgetItem(None, [name, date, type, message])
        item.setData(0, Qt.UserRole, event)
        if contact.photos is NotLoaded:
            process = QtDo(self.weboob, lambda c: self.setPhoto(c, item))
            process.do('fillobj', contact, ['photos'], backends=contact.backend)
            self.photo_processes[contact.id] = process
        elif len(contact.photos) > 0:
            if not self.setPhoto(contact, item):
                photo = contact.photos.values()[0]
                process = QtDo(self.weboob, lambda p: self.setPhoto(contact, item))
                process.do('fillobj', photo, ['thumbnail_data'], backends=contact.backend)
                self.photo_processes[contact.id] = process

        self.ui.eventsList.addTopLevelItem(item)
        self.ui.eventsList.resizeColumnToContents(0)
        self.ui.eventsList.resizeColumnToContents(1)
开发者ID:frankrousseau,项目名称:weboob,代码行数:59,代码来源:events.py


示例20: __init__

    def __init__(self, weboob, contact, parent=None):
        QWidget.__init__(self, parent)
        self.ui = Ui_Notes()
        self.ui.setupUi(self)

        self.weboob = weboob
        self.contact = contact

        self.ui.textEdit.setEnabled(False)
        self.ui.saveButton.setEnabled(False)
        self.process = QtDo(self.weboob, self._getNotes_cb, self._getNotes_eb)
        self.process.do('get_notes', self.contact.id, backends=(self.contact.backend,))

        self.connect(self.ui.saveButton, SIGNAL('clicked()'), self.saveNotes)
开发者ID:Boussadia,项目名称:weboob,代码行数:14,代码来源:contacts.py



注:本文中的weboob.tools.application.qt.QtDo类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python qt5.QtDo类代码示例发布时间:2022-05-26
下一篇:
Python browser.Browser类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap