Esempio n. 1
0
    def web_metadata(self, url, btn_widget, pgr_widget):
        self.link_lbl.setText(url)
        f = fetch.Fetch()
        thread = QThread(self)
        thread.setObjectName('Gallerydialog web metadata')
        btn_widget.hide()
        pgr_widget.show()

        def status(stat):
            def do_hide():
                try:
                    pgr_widget.hide()
                    btn_widget.show()
                except RuntimeError:
                    pass

            if stat:
                do_hide()
            else:
                danger = """QProgressBar::chunk {
					background: QLinearGradient( x1: 0, y1: 0, x2: 1, y2: 0,stop: 0 #FF0350,stop: 0.4999 #FF0020,stop: 0.5 #FF0019,stop: 1 #FF0000 );
					border-bottom-right-radius: 5px;
					border-bottom-left-radius: 5px;
					border: .px solid black;}"""
                pgr_widget.setStyleSheet(danger)
                QTimer.singleShot(3000, do_hide)
            f.deleteLater()

        def gallery_picker(gallery, title_url_list, q):
            self.parent_widget._web_metadata_picker(gallery, title_url_list, q,
                                                    self)

        try:
            dummy_gallery = self.make_gallery(self.gallery)
        except AttributeError:
            dummy_gallery = self.make_gallery(gallerydb.Gallery(), False)
        if not dummy_gallery:
            status(False)
            return None

        dummy_gallery.link = url
        f.galleries = [dummy_gallery]
        f.moveToThread(thread)
        f.GALLERY_PICKER.connect(gallery_picker)
        f.GALLERY_EMITTER.connect(self.set_web_metadata)
        thread.started.connect(f.auto_web_metadata)
        thread.finished.connect(thread.deleteLater)
        f.FINISHED.connect(status)
        thread.start()
Esempio n. 2
0
    def web_metadata(self, url, btn_widget, pgr_widget):
        if not self.path_lbl.text():
            return
        self.link_lbl.setText(url)
        btn_widget.hide()
        pgr_widget.show()

        def status(stat):
            def do_hide():
                try:
                    pgr_widget.hide()
                    btn_widget.show()
                except RuntimeError:
                    pass

            if stat:
                do_hide()
            else:
                danger = """QProgressBar::chunk {
                    background: QLinearGradient( x1: 0, y1: 0, x2: 1, y2: 0,stop: 0 #FF0350,stop: 0.4999 #FF0020,stop: 0.5 #FF0019,stop: 1 #FF0000 );
                    border-bottom-right-radius: 5px;
                    border-bottom-left-radius: 5px;
                    border: .px solid black;}"""
                pgr_widget.setStyleSheet(danger)
                QTimer.singleShot(3000, do_hide)

        def gallery_picker(gallery, title_url_list, q):
            self.parent_widget._web_metadata_picker(gallery, title_url_list, q,
                                                    self)

        try:
            dummy_gallery = self.make_gallery(self.gallery, False)
        except AttributeError:
            dummy_gallery = self.make_gallery(gallerydb.Gallery(), False, True)
        if not dummy_gallery:
            status(False)
            return None

        dummy_gallery._g_dialog_url = url
        self._fetch_inst.galleries = [dummy_gallery]
        self._disconnect()
        self._fetch_inst.GALLERY_PICKER.connect(gallery_picker)
        self._fetch_inst.GALLERY_EMITTER.connect(self.set_web_metadata)
        self._fetch_inst.FINISHED.connect(status)
        self._fetch_thread.start()
Esempio n. 3
0
 def accept(self):
     self.make_gallery(gallerydb.Gallery(), new=True)
     self.delayed_close()
Esempio n. 4
0
    def accept(self):
        new_gallery = self.make_gallery(gallerydb.Gallery(), new=True)

        if new_gallery:
            self.delayed_close()