コード例 #1
0
ファイル: pysubd.py プロジェクト: pgiitu/pysubd
    def __init__(self, parent=None):
        QtGui.QWidget.__init__(self, parent)
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)
        self.ui.cancelButton.setDisabled(True)
        self.tobeSearched = []
        self.ui.progressUpdate.append(
            "--------------------------------------------PySubD Subtitle Downloader-------------------------------------------"
        )
        self.ui.progressUpdate.append(
            "------------------------------Drag and drop your movie files or folders here--------------------------------"
        )
        self.subd = SubtitleDownload()
        self.connect(self.subd, QtCore.SIGNAL("updategui(PyQt_PyObject)"),
                     self.appendUpdates)
        self.connect(self.subd, QtCore.SIGNAL("updateFound()"),
                     self.updateFound)
        self.connect(self.subd, QtCore.SIGNAL("updateAvailable()"),
                     self.updateAvailable)
        self.connect(self.subd, QtCore.SIGNAL("updateDownloaded()"),
                     self.updateDownloaded)
        self.connect(self.subd,
                     QtCore.SIGNAL("downloadComplete(PyQt_PyObject)"),
                     self.downloadComplete)

        QtCore.QObject.connect(self.ui.cancelButton,
                               QtCore.SIGNAL("clicked()"), self.cancelDownload)
        QtCore.QObject.connect(self.ui.browseButton,
                               QtCore.SIGNAL("clicked()"), self.openFileDialog)

        self.cancelled = False
        self.ui.authorLabel.setOpenExternalLinks(True)
        self.ui.cancelButton.setDisabled(True)
コード例 #2
0
ファイル: pysubd.py プロジェクト: emkamal/pysubd
    def __init__(self, parent=None):
        QtGui.QWidget.__init__(self, parent)
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)
        self.tobeSearched = []
        self.ui.progressUpdate.append(
            '''<p align="center" style=" margin-top:0px; margin-bottom:0px; 
                                        margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">
                                        <span style=" font-size:14pt; font-weight:400;">PySubD Subtitle Downloader</span>
                                        <br>
                                       Drag and drop your movie files or folders here</p><p></p>'''
        )
        self.subd = SubtitleDownload()

        self.connect(self.subd, QtCore.SIGNAL('updateAvailable()'),
                     self.updateAvailable)
        #New style PyQT signal and slots
        self.ui.cancelButton.clicked.connect(self.cancelDownload)
        self.ui.browseButton.clicked.connect(self.openFileDialog)
        self.ui.lang_selector.currentIndexChanged.connect(self.changeLanguage)

        communicator.updategui.connect(self.append_updates)
        communicator.found_video_file.connect(self.update_found_files)
        communicator.downloaded_sub.connect(self.update_downloaded_subs)
        communicator.all_download_complete.connect(self.download_complete)

        self.cancelled = False
        self.lang = str(self.ui.lang_selector.currentText())
        self.ui.authorLabel.setOpenExternalLinks(True)
        self.ui.cancelButton.setDisabled(True)
コード例 #3
0
ファイル: pysubd.py プロジェクト: sahilgupta/pysubd
    def __init__(self, parent=None):
        QtGui.QWidget.__init__(self, parent)
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)
        self.tobeSearched = []
        self.ui.progressUpdate.append('''<p align="center" style=" margin-top:0px; margin-bottom:0px; 
                                        margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">
                                        <span style=" font-size:14pt; font-weight:400;">PySubD Subtitle Downloader</span>
                                        <br>
                                       Drag and drop your movie files or folders here</p><p></p>''')
        self.subd = SubtitleDownload()
        
        self.connect(self.subd, QtCore.SIGNAL('updateAvailable()'),
                     self.updateAvailable)
        #New style PyQT signal and slots
        self.ui.cancelButton.clicked.connect(self.cancelDownload)
        self.ui.browseButton.clicked.connect(self.openFileDialog)
        self.ui.lang_selector.currentIndexChanged.connect(self.changeLanguage)
        
        communicator.updategui.connect(self.append_updates)
        communicator.found_video_file.connect(self.update_found_files)
        communicator.downloaded_sub.connect(self.update_downloaded_subs)
        communicator.all_download_complete.connect(self.download_complete)

        self.cancelled = False
        self.lang = str(self.ui.lang_selector.currentText())
        self.ui.authorLabel.setOpenExternalLinks(True)
        self.ui.cancelButton.setDisabled(True)
コード例 #4
0
    def __init__(self):

        # Variables
        self._logbook = None
        self._event_table = []
        self.logging = logging.getLogger(__name__)

        QMainWindow.__init__(self)
        Ui_MainWindow.__init__(self)

        #UI Settings
        self.setupUi(self)

        self.actionExit.triggered.connect(qApp.quit)
        self.actionNew_Logbook.triggered.connect(self.new_logbook)
        self.actionOpen_Logbook.triggered.connect(self.open_logbook)
        self.actionImport_File.triggered.connect(self.import_files)
        self.actionSync_with_Garmin.triggered.connect(self.import_files)

        self.selectAction = QComboBox()
        self.selectAction.insertItems(1, ["One", "Two", "Three"])
        self.toolBar.addWidget(self.selectAction)
        #        self.selectAction.activated[str].connect(self.selectGraph)
        self.selectAction.activated.connect(self.selectGraph)

        self.all_events_table.itemSelectionChanged.connect(
            self._selection_changed)
        self.all_events_table.setSelectionBehavior(
            QAbstractItemView.SelectRows)
        self.all_events_table.hideColumn(4)
        self.graphwidget = GraphWidget(self.graph)

        self.all_events_table.setSortingEnabled(True)
        self._ui_stack = {}

        self.actionSync_with_Garmin.setDisabled(True)
        self.actionImport_File.setDisabled(True)

        self.settings = QSettings("MyCompany", "FitView")
        if not self.settings.value("geometry") == None:
            self.restoreGeometry(self.settings.value("geometry"))
        if not self.settings.value("windowState") == None:
            self.restoreState(self.settings.value("windowState"))
コード例 #5
0
ファイル: pysubd.py プロジェクト: pgiitu/pysubd
    def __init__(self, parent=None):
        QtGui.QWidget.__init__(self, parent)
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)
        self.ui.cancelButton.setDisabled(True)
        self.tobeSearched = []
        self.ui.progressUpdate.append("--------------------------------------------PySubD Subtitle Downloader-------------------------------------------")
        self.ui.progressUpdate.append("------------------------------Drag and drop your movie files or folders here--------------------------------")
        self.subd = SubtitleDownload()
        self.connect(self.subd, QtCore.SIGNAL("updategui(PyQt_PyObject)"), self.appendUpdates)
        self.connect(self.subd, QtCore.SIGNAL("updateFound()"), self.updateFound)
        self.connect(self.subd, QtCore.SIGNAL("updateAvailable()"), self.updateAvailable)
        self.connect(self.subd, QtCore.SIGNAL("updateDownloaded()"), self.updateDownloaded)
        self.connect(self.subd, QtCore.SIGNAL("downloadComplete(PyQt_PyObject)"), self.downloadComplete)

        QtCore.QObject.connect(self.ui.cancelButton, QtCore.SIGNAL("clicked()"), self.cancelDownload)
        QtCore.QObject.connect(self.ui.browseButton, QtCore.SIGNAL("clicked()"), self.openFileDialog)

        self.cancelled = False
        self.ui.authorLabel.setOpenExternalLinks(True)
        self.ui.cancelButton.setDisabled(True)
コード例 #6
0
ファイル: pysubd.py プロジェクト: sahilgupta/pysubd
class PySubD(QtGui.QMainWindow):

    def __init__(self, parent=None):
        QtGui.QWidget.__init__(self, parent)
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)
        self.tobeSearched = []
        self.ui.progressUpdate.append('''<p align="center" style=" margin-top:0px; margin-bottom:0px; 
                                        margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">
                                        <span style=" font-size:14pt; font-weight:400;">PySubD Subtitle Downloader</span>
                                        <br>
                                       Drag and drop your movie files or folders here</p><p></p>''')
        self.subd = SubtitleDownload()
        
        self.connect(self.subd, QtCore.SIGNAL('updateAvailable()'),
                     self.updateAvailable)
        #New style PyQT signal and slots
        self.ui.cancelButton.clicked.connect(self.cancelDownload)
        self.ui.browseButton.clicked.connect(self.openFileDialog)
        self.ui.lang_selector.currentIndexChanged.connect(self.changeLanguage)
        
        communicator.updategui.connect(self.append_updates)
        communicator.found_video_file.connect(self.update_found_files)
        communicator.downloaded_sub.connect(self.update_downloaded_subs)
        communicator.all_download_complete.connect(self.download_complete)

        self.cancelled = False
        self.lang = str(self.ui.lang_selector.currentText())
        self.ui.authorLabel.setOpenExternalLinks(True)
        self.ui.cancelButton.setDisabled(True)
        
    def dragEnterEvent(self, event):
        if event.mimeData().hasUrls:
            event.accept()
        else:
            event.ignore()

    def dropEvent(self, event):
        self.cancelled = False
        if event.mimeData().hasUrls:
            event.setDropAction(QtCore.Qt.CopyAction)
            event.accept()
            links = []
            for url in event.mimeData().urls():
                links.append(str(url.toLocalFile()))

            self.ui.cancelButton.setEnabled(True)
            
            if self.tobeSearched:
                self.tobeSearched.extend(links)
            else:
                self.tobeSearched.extend(links)
                self.ui.lang_selector.setDisabled(True)
                self.subd.init(links, self.lang)
        else:
            event.ignore()

    @pyqtSlot()
    def openFileDialog(self):
        self.cancelled = False
        d = FileDialog()
        d.exec_()
        x = d.filesSelected()

        if x:
            self.ui.cancelButton.setEnabled(True)
            self.ui.browseButton.setDisabled(True)
            self.tobeSearched.extend(x)
            self.ui.lang_selector.setDisabled(True)
            self.subd.init(x, self.lang)

    @pyqtSlot()
    def cancelDownload(self):
        self.cancelled = True
        self.subd.stopTask()
        self.ui.cancelButton.setDisabled(True)
        self.ui.browseButton.setEnabled(True)
        self.ui.lang_selector.setEnabled(True) 

    @pyqtSlot()
    def changeLanguage(self):
        language = str(self.ui.lang_selector.currentText())
        self.lang = language
    
    @pyqtSlot(object)
    def download_complete(self, donepaths):
        for path in donepaths:
            self.tobeSearched.remove(path)
        if self.tobeSearched and not self.cancelled:
            self.ui.browseButton.setDisabled(True)
            self.ui.lang_selector.setDisabled(True) 
            self.ui.cancelButton.setEnabled(True)
            self.subd.init(self.tobeSearched, self.lang)
        else:
            self.ui.cancelButton.setDisabled(True)
            self.ui.lang_selector.setEnabled(True)
            self.ui.browseButton.setEnabled(True)

    @pyqtSlot(object, object)
    def append_updates(self, text, update_type):
        if update_type == 'info':
            color = 'black'
        elif update_type == 'error':
            color = 'red'
        elif update_type == 'success':
            color = 'green'
        update = '''<span style="color: %s;">%s</span>'''%(color, text)
        self.ui.progressUpdate.append(update)
        self.ui.scrollArea.verticalScrollBar().setValue(self.ui.scrollArea.verticalScrollBar().maximum())

    @pyqtSlot()
    def update_found_files(self):
        self.ui.foundlcdNumber.display(int(self.ui.foundlcdNumber.value()) + 1)

    @pyqtSlot()
    def updateAvailable(self):
        self.ui.availablelcdNumber.display(int(self.ui.availablelcdNumber.value()) + 1)

    @pyqtSlot()
    def update_downloaded_subs(self):
        self.ui.downloadedlcdNumber.display(int(self.ui.downloadedlcdNumber.value()) + 1)
コード例 #7
0
ファイル: pysubd.py プロジェクト: pgiitu/pysubd
class pysubd(QtGui.QMainWindow):
    def __init__(self, parent=None):
        QtGui.QWidget.__init__(self, parent)
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)
        self.ui.cancelButton.setDisabled(True)
        self.tobeSearched = []
        self.ui.progressUpdate.append("--------------------------------------------PySubD Subtitle Downloader-------------------------------------------")
        self.ui.progressUpdate.append("------------------------------Drag and drop your movie files or folders here--------------------------------")
        self.subd = SubtitleDownload()
        self.connect(self.subd, QtCore.SIGNAL("updategui(PyQt_PyObject)"), self.appendUpdates)
        self.connect(self.subd, QtCore.SIGNAL("updateFound()"), self.updateFound)
        self.connect(self.subd, QtCore.SIGNAL("updateAvailable()"), self.updateAvailable)
        self.connect(self.subd, QtCore.SIGNAL("updateDownloaded()"), self.updateDownloaded)
        self.connect(self.subd, QtCore.SIGNAL("downloadComplete(PyQt_PyObject)"), self.downloadComplete)

        QtCore.QObject.connect(self.ui.cancelButton, QtCore.SIGNAL("clicked()"), self.cancelDownload)
        QtCore.QObject.connect(self.ui.browseButton, QtCore.SIGNAL("clicked()"), self.openFileDialog)

        self.cancelled = False
        self.ui.authorLabel.setOpenExternalLinks(True)
        self.ui.cancelButton.setDisabled(True)

    def dragEnterEvent(self, event):
        if event.mimeData().hasUrls:
            event.accept()
        else:
            event.ignore()

    def dropEvent(self, event):
        self.cancelled = False
        if event.mimeData().hasUrls:
            event.setDropAction(QtCore.Qt.CopyAction)
            event.accept()
            links = []
            for url in event.mimeData().urls():
                links.append(str(url.toLocalFile()))

            self.ui.cancelButton.setEnabled(True)
            if self.tobeSearched:
                self.tobeSearched.extend(links)
            else:
                self.tobeSearched.extend(links)
                self.subd.init(links)
        else:
            event.ignore()

    def openFileDialog(self):
        self.cancelled = False
        d = FileDialog()
        d.exec_()
        x = d.filesSelected()

        if x:
            self.ui.cancelButton.setEnabled(True)
            self.ui.browseButton.setDisabled(True)
            self.tobeSearched.extend(x)
            self.subd.init(x)

    def cancelDownload(self):
        self.cancelled = True
        self.subd.stopTask()
        self.ui.cancelButton.setDisabled(True)
        self.ui.browseButton.setEnabled(True)

    def downloadComplete(self, donepaths):
        for path in donepaths:
            self.tobeSearched.remove(str(path))
        if self.tobeSearched and not self.cancelled:
            self.ui.browseButton.setDisabled(True)
            self.ui.cancelButton.setEnabled(True)
            self.subd.init(self.tobeSearched)
        else:
            self.ui.cancelButton.setDisabled(True)
            self.ui.browseButton.setEnabled(True)

    def appendUpdates(self, update):
        self.ui.progressUpdate.append(str(update))
        self.ui.scrollArea.verticalScrollBar().setValue(self.ui.scrollArea.verticalScrollBar().maximum())

    def updateFound(self):
        self.ui.foundlcdNumber.display(int(self.ui.foundlcdNumber.value() + 1))

    def updateAvailable(self):
        self.ui.availablelcdNumber.display(int(self.ui.availablelcdNumber.value() + 1))

    def updateDownloaded(self):
        self.ui.downloadedlcdNumber.display(int(self.ui.downloadedlcdNumber.value() + 1))
コード例 #8
0
ファイル: pysubd.py プロジェクト: pgiitu/pysubd
class pysubd(QtGui.QMainWindow):
    def __init__(self, parent=None):
        QtGui.QWidget.__init__(self, parent)
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)
        self.ui.cancelButton.setDisabled(True)
        self.tobeSearched = []
        self.ui.progressUpdate.append(
            "--------------------------------------------PySubD Subtitle Downloader-------------------------------------------"
        )
        self.ui.progressUpdate.append(
            "------------------------------Drag and drop your movie files or folders here--------------------------------"
        )
        self.subd = SubtitleDownload()
        self.connect(self.subd, QtCore.SIGNAL("updategui(PyQt_PyObject)"),
                     self.appendUpdates)
        self.connect(self.subd, QtCore.SIGNAL("updateFound()"),
                     self.updateFound)
        self.connect(self.subd, QtCore.SIGNAL("updateAvailable()"),
                     self.updateAvailable)
        self.connect(self.subd, QtCore.SIGNAL("updateDownloaded()"),
                     self.updateDownloaded)
        self.connect(self.subd,
                     QtCore.SIGNAL("downloadComplete(PyQt_PyObject)"),
                     self.downloadComplete)

        QtCore.QObject.connect(self.ui.cancelButton,
                               QtCore.SIGNAL("clicked()"), self.cancelDownload)
        QtCore.QObject.connect(self.ui.browseButton,
                               QtCore.SIGNAL("clicked()"), self.openFileDialog)

        self.cancelled = False
        self.ui.authorLabel.setOpenExternalLinks(True)
        self.ui.cancelButton.setDisabled(True)

    def dragEnterEvent(self, event):
        if event.mimeData().hasUrls:
            event.accept()
        else:
            event.ignore()

    def dropEvent(self, event):
        self.cancelled = False
        if event.mimeData().hasUrls:
            event.setDropAction(QtCore.Qt.CopyAction)
            event.accept()
            links = []
            for url in event.mimeData().urls():
                links.append(str(url.toLocalFile()))

            self.ui.cancelButton.setEnabled(True)
            if self.tobeSearched:
                self.tobeSearched.extend(links)
            else:
                self.tobeSearched.extend(links)
                self.subd.init(links)
        else:
            event.ignore()

    def openFileDialog(self):
        self.cancelled = False
        d = FileDialog()
        d.exec_()
        x = d.filesSelected()

        if x:
            self.ui.cancelButton.setEnabled(True)
            self.ui.browseButton.setDisabled(True)
            self.tobeSearched.extend(x)
            self.subd.init(x)

    def cancelDownload(self):
        self.cancelled = True
        self.subd.stopTask()
        self.ui.cancelButton.setDisabled(True)
        self.ui.browseButton.setEnabled(True)

    def downloadComplete(self, donepaths):
        for path in donepaths:
            self.tobeSearched.remove(str(path))
        if self.tobeSearched and not self.cancelled:
            self.ui.browseButton.setDisabled(True)
            self.ui.cancelButton.setEnabled(True)
            self.subd.init(self.tobeSearched)
        else:
            self.ui.cancelButton.setDisabled(True)
            self.ui.browseButton.setEnabled(True)

    def appendUpdates(self, update):
        self.ui.progressUpdate.append(str(update))
        self.ui.scrollArea.verticalScrollBar().setValue(
            self.ui.scrollArea.verticalScrollBar().maximum())

    def updateFound(self):
        self.ui.foundlcdNumber.display(int(self.ui.foundlcdNumber.value() + 1))

    def updateAvailable(self):
        self.ui.availablelcdNumber.display(
            int(self.ui.availablelcdNumber.value() + 1))

    def updateDownloaded(self):
        self.ui.downloadedlcdNumber.display(
            int(self.ui.downloadedlcdNumber.value() + 1))
コード例 #9
0
ファイル: pysubd.py プロジェクト: emkamal/pysubd
class PySubD(QtGui.QMainWindow):
    def __init__(self, parent=None):
        QtGui.QWidget.__init__(self, parent)
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)
        self.tobeSearched = []
        self.ui.progressUpdate.append(
            '''<p align="center" style=" margin-top:0px; margin-bottom:0px; 
                                        margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">
                                        <span style=" font-size:14pt; font-weight:400;">PySubD Subtitle Downloader</span>
                                        <br>
                                       Drag and drop your movie files or folders here</p><p></p>'''
        )
        self.subd = SubtitleDownload()

        self.connect(self.subd, QtCore.SIGNAL('updateAvailable()'),
                     self.updateAvailable)
        #New style PyQT signal and slots
        self.ui.cancelButton.clicked.connect(self.cancelDownload)
        self.ui.browseButton.clicked.connect(self.openFileDialog)
        self.ui.lang_selector.currentIndexChanged.connect(self.changeLanguage)

        communicator.updategui.connect(self.append_updates)
        communicator.found_video_file.connect(self.update_found_files)
        communicator.downloaded_sub.connect(self.update_downloaded_subs)
        communicator.all_download_complete.connect(self.download_complete)

        self.cancelled = False
        self.lang = str(self.ui.lang_selector.currentText())
        self.ui.authorLabel.setOpenExternalLinks(True)
        self.ui.cancelButton.setDisabled(True)

    def dragEnterEvent(self, event):
        if event.mimeData().hasUrls:
            event.accept()
        else:
            event.ignore()

    def dropEvent(self, event):
        self.cancelled = False
        if event.mimeData().hasUrls:
            event.setDropAction(QtCore.Qt.CopyAction)
            event.accept()
            links = []
            for url in event.mimeData().urls():
                links.append(str(url.toLocalFile()))

            self.ui.cancelButton.setEnabled(True)

            if self.tobeSearched:
                self.tobeSearched.extend(links)
            else:
                self.tobeSearched.extend(links)
                self.ui.lang_selector.setDisabled(True)
                self.subd.init(links, self.lang)
        else:
            event.ignore()

    @pyqtSlot()
    def openFileDialog(self):
        self.cancelled = False
        d = FileDialog()
        d.exec_()
        x = d.filesSelected()

        if x:
            self.ui.cancelButton.setEnabled(True)
            self.ui.browseButton.setDisabled(True)
            self.tobeSearched.extend(x)
            self.ui.lang_selector.setDisabled(True)
            self.subd.init(x, self.lang)

    @pyqtSlot()
    def cancelDownload(self):
        self.cancelled = True
        self.subd.stopTask()
        self.ui.cancelButton.setDisabled(True)
        self.ui.browseButton.setEnabled(True)
        self.ui.lang_selector.setEnabled(True)

    @pyqtSlot()
    def changeLanguage(self):
        language = str(self.ui.lang_selector.currentText())
        self.lang = language

    @pyqtSlot(object)
    def download_complete(self, donepaths):
        for path in donepaths:
            self.tobeSearched.remove(path)
        if self.tobeSearched and not self.cancelled:
            self.ui.browseButton.setDisabled(True)
            self.ui.lang_selector.setDisabled(True)
            self.ui.cancelButton.setEnabled(True)
            self.subd.init(self.tobeSearched, self.lang)
        else:
            self.ui.cancelButton.setDisabled(True)
            self.ui.lang_selector.setEnabled(True)
            self.ui.browseButton.setEnabled(True)

    @pyqtSlot(object, object)
    def append_updates(self, text, update_type):
        if update_type == 'info':
            color = 'black'
        elif update_type == 'error':
            color = 'red'
        elif update_type == 'success':
            color = 'green'
        update = '''<span style="color: %s;">%s</span>''' % (color, text)
        self.ui.progressUpdate.append(update)
        self.ui.scrollArea.verticalScrollBar().setValue(
            self.ui.scrollArea.verticalScrollBar().maximum())

    @pyqtSlot()
    def update_found_files(self):
        self.ui.foundlcdNumber.display(int(self.ui.foundlcdNumber.value()) + 1)

    @pyqtSlot()
    def updateAvailable(self):
        self.ui.availablelcdNumber.display(
            int(self.ui.availablelcdNumber.value()) + 1)

    @pyqtSlot()
    def update_downloaded_subs(self):
        self.ui.downloadedlcdNumber.display(
            int(self.ui.downloadedlcdNumber.value()) + 1)