Ejemplo n.º 1
0
    def __init__(self, parent, sub=None, ref=None):
        super().__init__(parent)

        img.setWinIcon(self)
        self.m_buttonMenu.SetLabel(u'\u22ee')  # 2630
        self.m_panelMain.GetSizer().SetSizeHints(self)

        self.m_buttonMaxDistInfo.message = descriptions.maxDistInfo

        if config.assetupd == None:
            self.m_menu.Remove(self.m_menuItemCheckUpdate.GetId())

        self.m_panelSub.setStream(sub)
        self.m_panelRef.setStream(ref)

        self.m_sliderMaxDist.SetValue(settings().windowSize / 60.0)
        self.onSliderMaxDistScroll(None)

        self.Fit()
        self.Layout()

        # allow only to resize horizontally
        size = self.GetSize()
        self.SetSizeHints(minW=size.GetWidth(),
                          minH=size.GetHeight(),
                          maxH=size.GetHeight())

        assetListUpdater.start(autoUpdate=settings().autoUpdate)
Ejemplo n.º 2
0
    def __init__(self, parent, subs=None, refs=None):
        super().__init__(parent)

        img.setWinIcon(self)
        self.m_buttonMenu.SetLabel(u'\u22ee')  # 2630
        self.m_panelMain.GetSizer().SetSizeHints(self)

        if config.assetupd == None:
            self.m_menu.Remove(self.m_menuItemCheckUpdate.GetId())

        self.m_panelSub.setStream(subs)
        self.m_panelSub.stream.types = ('subtitle/text', )

        self.m_panelRef.setStream(refs)
        self.m_panelRef.stream.types = ('subtitle/text', 'audio')

        self.m_sliderMaxDist.SetValue(settings().windowSize / 60.0)
        self.onSliderMaxDistScroll(None)

        self.Fit()
        self.Layout()

        # allow only to resize horizontally
        size = self.GetSize()
        self.SetSizeHints(minW=size.GetWidth(),
                          minH=size.GetHeight(),
                          maxH=size.GetHeight())

        self.refsCache = cache.WordsCache()
        assetManager.updateTask.start()
Ejemplo n.º 3
0
    def __init__(self, parent, tasks=None):
        super().__init__(parent)
        img.setWinIcon(self)

        self.m_buttonMaxDistInfo.message = descriptions.maxDistInfo
        self.m_buttonEffortInfo.message = descriptions.effortInfo

        self.m_sliderMaxDist.SetValue(settings().windowSize / 60)
        self.m_sliderEffort.SetValue(settings().minEffort * 100)
        self.onSliderMaxDistScroll(None)
        self.onSliderEffortScroll(None)

        # workaround for truncated texts
        self.m_textMaxDist.SetMinSize(wx.Size(int(self.m_textMaxDist.GetSize().width * 1.1), -1))
        self.m_textEffort.SetMinSize(wx.Size(int(self.m_textEffort.GetSize().width * 1.1), -1))

        self.sync = None
        self.closing = False
        self.startTime = 0.0

        self.m_items.updateEvent.addListener(self.onItemsUpdate)

        self.m_buttonAdd.Bind(wx.EVT_BUTTON, lambda e: self.addFiles())
        self.m_buttonRemove.Bind(wx.EVT_BUTTON, self.m_items.onMenuRemoveClick)
        self.m_buttonStreamSel.Bind(wx.EVT_BUTTON, self.m_items.onMenuStreamSelClick)
        self.m_buttonOutSel.Bind(wx.EVT_BUTTON, self.m_items.onMenuPatternClick)
        self.m_buttonAutoSort.Bind(wx.EVT_BUTTON, self.m_items.onMenuAutoSortClick)
        self.Bind(wx.EVT_MENU, lambda e: self.addFiles(), id=self.m_menuItemAddAuto.GetId())
        self.Bind(wx.EVT_MENU, lambda e: self.addFiles(0), id=self.m_menuItemAddSubs.GetId())
        self.Bind(wx.EVT_MENU, lambda e: self.addFiles(1), id=self.m_menuItemAddRefs.GetId())
        self.Bind(wx.EVT_MENU, lambda e: self.Close(), id=self.m_menuItemClose.GetId())
        self.Bind(wx.EVT_MENU, self.m_items.onMenuAutoSortClick, id=self.m_menuItemAutoSort.GetId())
        self.Bind(wx.EVT_MENU, self.m_items.onMenuRemoveClick, id=self.m_menuItemRemove.GetId())
        self.Bind(wx.EVT_MENU, lambda e: self.m_items.selectColumns([0, 1, 2]), id=self.m_menuItemSelectAll.GetId())
        self.Bind(wx.EVT_MENU, lambda e: self.m_items.selectColumns([0]), id=self.m_menuItemSelectSubs.GetId())
        self.Bind(wx.EVT_MENU, lambda e: self.m_items.selectColumns([1]), id=self.m_menuItemSelectRefs.GetId())
        self.Bind(wx.EVT_MENU, lambda e: self.m_items.selectColumns([2]), id=self.m_menuItemSelectOuts.GetId())
        self.Bind(wx.EVT_MENU, self.m_items.onMenuStreamSelClick, id=self.m_menuItemStreamSel.GetId())
        self.Bind(wx.EVT_MENU, self.m_items.onMenuPatternClick, id=self.m_menuItemOutSel.GetId())
        self.Bind(wx.EVT_MENU, self.m_items.onMenuPropsClick, id=self.m_menuItemProps.GetId())
        self.Bind(wx.EVT_MENU, self.onMenuAboutClick, id=self.m_menuItemAbout.GetId())

        filedrop.setFileDropTarget(self.m_panelAutoDrop, OnDropFiles=self.onPanelAutoDropFiles)

        if tasks:
            self.m_items.addTasks(tasks)

        self.Layout()