MCPcopy Index your code
hub / github.com/pyfa-org/Pyfa / _TabsContainer

Class _TabsContainer

gui/chrome_tabs.py:722–1425  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

720
721
722class _TabsContainer(wx.Panel):
723 def __init__(self, parent, pos=(50, 0), size=(100, 22), id=wx.ID_ANY,
724 can_add=True, tabWidthMode=0):
725 """
726 Defines the tab container. Handles functions such as tab selection and
727 dragging, and defines minimum width of tabs (all tabs are of equal
728 width, which is determined via widest tab). Also handles the tab
729 preview, if any.
730 """
731 super().__init__(parent, id, pos, size)
732 self.tabWidthMode = tabWidthMode
733
734 self.tabs = []
735 self.width, self.height = size
736 self.container_height = self.height
737 self.start_drag = False
738 self.dragging = False
739
740 # amount of overlap of tabs?
741 self.inclination = 7
742
743 if can_add:
744 self.reserved = 48
745 else:
746 self.reserved = self.inclination * 4
747
748 # pixel distance to drag before we actually start dragging
749 self.drag_trail = 5
750
751 self.dragx = 0
752 self.dragy = 0
753 self.dragged_tab = None
754 self.drag_trigger = self.drag_trail
755
756 self.show_add_button = can_add
757
758 self.tab_container_width = self.width - self.reserved
759 self.fxBmps = {}
760
761 self.add_button = _AddRenderer()
762 self.add_bitmap = self.add_button.Render()
763
764 self.preview_timer = None
765 self.preview_timer_id = wx.ID_ANY
766 self.preview_wnd = None
767 self.preview_bmp = None
768 self.preview_pos = None
769 self.preview_tab = None
770
771 self.Bind(wx.EVT_TIMER, self.OnTimer)
772 self.Bind(wx.EVT_LEAVE_WINDOW, self.OnLeaveWindow)
773
774 self.Bind(wx.EVT_PAINT, self.OnPaint)
775 self.Bind(wx.EVT_ERASE_BACKGROUND, self.OnErase)
776 self.Bind(wx.EVT_LEFT_DOWN, self.OnLeftDown)
777 self.Bind(wx.EVT_LEFT_UP, self.OnLeftUp)
778 self.Bind(wx.EVT_MIDDLE_UP, self.OnMiddleUp)
779 self.Bind(wx.EVT_MOTION, self.OnMotion)

Callers 1

__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected