Beispiel #1
0
 def __init__(self):
     super(Browser, self).__init__()
     self.ui = Ui_BrowserWidget()
     self.ui.setupUi(self)
     self.ui.webView.page().setForwardUnsupportedContent(True)
     self.ui.webView.page().unsupportedContent.connect(self.download)
     self.setWindowIcon(QIcon(get_file('animes.png')))
Beispiel #2
0
class Browser(QDialog):
    start_download = Signal(str, str)
    open_video = Signal(str, bool)

    def __init__(self):
        super(Browser, self).__init__()
        self.ui = Ui_BrowserWidget()
        self.ui.setupUi(self)
        self.ui.webView.page().setForwardUnsupportedContent(True)
        self.ui.webView.page().unsupportedContent.connect(self.download)
        self.setWindowIcon(QIcon(get_file('animes.png')))
        #self.player_window = player_w

    def showBox(self, text, infoText):
        mbox = QMessageBox()
        mbox.setWindowTitle("Semard")
        mbox.setText(text)
        mbox.setInformativeText(infoText)
        mbox.setStandardButtons(QMessageBox.Yes | QMessageBox.No
                                | QMessageBox.Cancel)
        mbox.setDefaultButton(QMessageBox.Yes)
        return mbox.exec_()


    def download(self, reply):
        filepath = reply.url().toString()
        #dl = self.showBox('Iniciar download de', filepath)
        #if dl == QMessageBox.Yes:
        split = urlparse.urlsplit(filepath)
        filename = split.path.split("/")[-1]
        ofd = QFileDialog()
        ofd.setFileMode(QFileDialog.Directory)
        ofd.setOption(QFileDialog.ShowDirsOnly)
        ofd.setWindowTitle(filename)
        if ofd.exec_():
            res = ofd.selectedFiles()[0]
            path = os.path.join(res, filename)
            self.start_download.emit(str(filepath), str(path))
        #elif dl == QMessageBox.No:
        #    pass
        #elif dl == QMessageBox.Cancel:
        #    pass

        rep = self.showBox('Tentar reproduzir o arquivo?', filepath)
        if rep == QMessageBox.Yes:
            self.open_video.emit(filepath, False)
            self.close()
            main.hide()
        elif rep == QMessageBox.No:
            pass
        elif rep == QMessageBox.Cancel:
            pass
Beispiel #3
0
class Browser(QDialog):
    start_download = Signal(str, str)
    open_video = Signal(str, bool)

    def __init__(self):
        super(Browser, self).__init__()
        self.ui = Ui_BrowserWidget()
        self.ui.setupUi(self)
        self.ui.webView.page().setForwardUnsupportedContent(True)
        self.ui.webView.page().unsupportedContent.connect(self.download)
        self.setWindowIcon(QIcon(get_file('animes.png')))
        #self.player_window = player_w

    def showBox(self, text, infoText):
        mbox = QMessageBox()
        mbox.setWindowTitle("Semard")
        mbox.setText(text)
        mbox.setInformativeText(infoText)
        mbox.setStandardButtons(QMessageBox.Yes | QMessageBox.No
                                | QMessageBox.Cancel)
        mbox.setDefaultButton(QMessageBox.Yes)
        return mbox.exec_()

    def download(self, reply):
        filepath = reply.url().toString()
        #dl = self.showBox('Iniciar download de', filepath)
        #if dl == QMessageBox.Yes:
        split = urlparse.urlsplit(filepath)
        filename = split.path.split("/")[-1]
        ofd = QFileDialog()
        ofd.setFileMode(QFileDialog.Directory)
        ofd.setOption(QFileDialog.ShowDirsOnly)
        ofd.setWindowTitle(filename)
        if ofd.exec_():
            res = ofd.selectedFiles()[0]
            path = os.path.join(res, filename)
            self.start_download.emit(str(filepath), str(path))
        #elif dl == QMessageBox.No:
        #    pass
        #elif dl == QMessageBox.Cancel:
        #    pass

        rep = self.showBox('Tentar reproduzir o arquivo?', filepath)
        if rep == QMessageBox.Yes:
            self.open_video.emit(filepath, False)
            self.close()
            main.hide()
        elif rep == QMessageBox.No:
            pass
        elif rep == QMessageBox.Cancel:
            pass
Beispiel #4
0
 def __init__(self):
     super(Browser, self).__init__()
     self.ui = Ui_BrowserWidget()
     self.ui.setupUi(self)
     self.ui.webView.page().setForwardUnsupportedContent(True)
     self.ui.webView.page().unsupportedContent.connect(self.download)
     self.setWindowIcon(QIcon(get_file('animes.png')))