def __init__(self, parent, file, allowOpen=True): super().__init__(parent) self.file = InputFile(stream=file) self.openStream(self.file) self.m_buttonOpen.Show(allowOpen) if allowOpen: filedrop.setFileDropTarget(self, OnDropFile=self.onDropFile)
def __init__(self, parent, file, allowOpen=True, defaultLang=None): super().__init__(parent) self.defaultLang = defaultLang self.file = copy(file) self.openStream(self.file) self.m_buttonOpen.Show(allowOpen) if allowOpen: filedrop.setFileDropTarget(self, OnDropFile=self.onDropFile) self.Fit() self.Layout()
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()
def __init__(self, parent, *args, **kwargs): wx.ScrolledWindow.__init__(self, parent, *args, **kwargs) self.AlwaysShowScrollbars(vflag=True, hflag=False) self.SetBackgroundStyle(wx.BG_STYLE_PAINT) self.Bind(wx.EVT_SIZE, self.onResize) self.Bind(wx.EVT_PAINT, self.onPaint) self.Bind(wx.EVT_LEFT_DOWN, self.onMouseLeftDown) self.Bind(wx.EVT_LEFT_UP, self.onMouseLeftUp) self.Bind(wx.EVT_MOTION, self.onMouseMove) self.Bind(wx.EVT_CONTEXT_MENU, self.onContextMenuProcess) self.itemHeight = 0 self.cols = [] self.colWidth = 0 self.selectedItems = set() self.markedRow = 0 self.dragSource = None self.dragPos = None self.drawDragPos = False self.onItemsChange = lambda: None self.onSelection = lambda: None self.onContextMenu = lambda col, item, index: None self.onFilesDrop = lambda col, paths, index: None self.onPaintEmpty = lambda width, height: None filedrop.setFileDropTarget( self, OnDropFiles=self.onFilesDropProcess, OnDragOver=self.onFilesDrag, OnLeave=self.onFilesDragLeave, children=False)
def __init__(self, parent, *args, **kwargs): super().__init__(parent) filedrop.setFileDropTarget(self, OnDropFile=self.onDropSubFile) self.stream = None self.defaultLangKey = None