Esempio n. 1
0
    def __init__(self, parent, streams, types):
        super().__init__(parent)

        img.setItemBitmap(self.m_bitmapTick, 'tickmark')
        img.setItemBitmap(self.m_bitmapCross, 'crossmark')

        self.streams = streams
        self.selection = []

        self.m_items.SetIconMap({
            False: img.getBitmap('crossmark'),
            True: img.getBitmap('tickmark')
        })

        for s in streams:
            self.m_items.InsertItem(os.path.basename(s.path), icon=False)

        self.m_choiceSelType.SetClientData(0, ['subtitle/text', 'audio'])
        self.m_choiceSelType.SetClientData(1, ['subtitle/text'])
        self.m_choiceSelType.SetClientData(2, ['audio'])

        stypes = set(s.type for ss in streams
                     for s in ss.streams.values()) & set(types)
        hasAudio = 'audio' in stypes
        hasSubtitle = 'subtitle/text' in stypes

        enableTypeSelection = hasAudio and hasSubtitle
        self.m_textSelType.Show(enableTypeSelection)
        self.m_choiceSelType.Show(enableTypeSelection)

        langs = set(
            canonizeLang(s.lang) for ss in streams
            for s in ss.streams.values() if s.type in types)
        self.m_choiceSelLang.Append(_('auto'), None)
        if '' in langs:
            langs.discard('')
            self.m_choiceSelLang.Append(_('<undefined>'), '')

        self.m_choiceSelLang.addSortedLangs(
            {languages.getName(l): l
             for l in langs})
        self.m_choiceSelLang.SetSelection(0)

        titles = set(s.title for ss in streams for s in ss.streams.values()
                     if s.type in types)
        self.m_choiceSelTitle.Append(_('auto'), None)
        for title in sorted(titles):
            value = title
            if title == '':
                title = _('<empty>')
            self.m_choiceSelTitle.Append(title, value)
        self.m_choiceSelTitle.SetSelection(0)

        self.m_textSelTitle.Show(len(titles) > 1)
        self.m_choiceSelTitle.Show(len(titles) > 1)

        self.onSelChange()

        self.Fit()
        self.Layout()
Esempio n. 2
0
    def __init__(self, parent, task):
        super().__init__(parent)

        self.m_buttonDebugMenu.SetLabel(u'\u22ee')  # 2630
        img.setItemBitmap(self.m_bitmapTick, 'tickmark')
        img.setItemBitmap(self.m_bitmapCross, 'crossmark')

        if settings().debugOptions:
            self.m_buttonDebugMenu.Show()

        self.m_buttonStop.SetFocus()
        self.Fit()
        self.Layout()

        self.errors = error.ErrorsCollector()
        self.pendingErrors = False

        self.task = task

        self.sync = Synchronizer(task.sub, task.ref)
        self.sync.onError = self.onError

        self.running = True
        self.closing = False
        self.runTime = wx.StopWatch()

        self.sleeper = gizmo.Sleeper()
        self.thread = gizmo.Thread(self.syncJob, name='Synchro')
Esempio n. 3
0
    def __init__(self, parent, tasks):
        super().__init__(parent)

        self.currentTask = None
        self.selectedTask = None

        self.tasks = [TaskState(task) for task in tasks]

        img.setItemBitmap(self.m_bitmapTick, 'tickmark')
        img.setItemBitmap(self.m_bitmapCross, 'crossmark')
        self.m_gaugeTotalProgress.SetRange(len(self.tasks) * 100)

        self.m_items.SetIconMap({
            'run': img.getBitmap('run'),
            'idle': img.getBitmap('idle'),
            'success': img.getBitmap('tickmark'),
            'fail': img.getBitmap('crossmark'),
            'run-err': img.getBitmap('run'),
            'idle-err': img.getBitmap('idle'),
            'success-err': img.getBitmap('tickmark'),
            'fail-err': img.getBitmap('error'),
        })

        for task in self.tasks:
            name = os.path.basename(task.getOutputPath())
            self.m_items.InsertItem(name, icon='idle', item=task)

        self.running = True
        self.closing = False
        self.runTime = wx.StopWatch()
        self.thread = threading.Thread(target=self.syncJob, name='BatchSync')
        self.thread.start()
Esempio n. 4
0
    def __init__(self, parent):
        super().__init__(parent)
        img.setItemBitmap(self.m_bitmapLogo, 'logo')

        try:
            from subsync.version import version
            self.m_textVersion.SetLabel(_('version ') + version)
        except:
            pass

        self.m_buttonClose.SetFocus()
        self.Fit()
        self.Layout()

        # workaround for buttons cut in half
        wx.CallAfter(self.Fit)
Esempio n. 5
0
    def __init__(self, parent, subs, refs, refsCache=None, listener=None):
        super().__init__(parent)

        self.m_buttonDebugMenu.SetLabel(u'\u22ee') # 2630
        img.setItemBitmap(self.m_bitmapTick, 'tickmark')
        img.setItemBitmap(self.m_bitmapCross, 'crossmark')

        if settings().debugOptions:
            self.m_buttonDebugMenu.Show()

        self.m_buttonStop.SetFocus()
        self.Fit()
        self.Layout()

        self.subs = subs
        self.refs = refs

        self.startTime = time.time()
        self.sync = None

        self.isRunning = False
        self.isCorrelated = False
        self.isSubReady = False

        self.errors = collections.OrderedDict()

        self.updateTimer = wx.Timer(self)
        self.Bind(wx.EVT_TIMER, self.onUpdateTimerTick, self.updateTimer)

        with busydlg.BusyDlg(self, _('Loading, please wait...')):
            self.sync = synchro.Synchronizer(self, self.subs, self.refs, refsCache)
            self.sync.start()

        self.isRunning = True
        self.updateTimer.Start(500)

        self.listener = listener
Esempio n. 6
0
 def __init__(self, *args, **kwargs):
     super().__init__(*args, **kwargs)
     self.Bind(wx.EVT_BUTTON, self.onClick)
     img.setItemBitmap(self, 'info')
     self.message = None