def __init__(self, parent, size=wx.DefaultSize, style=0): wx.ListCtrl.__init__(self, parent, size=size, style=wx.LC_REPORT | style) self.imageList = CachingImageList(16, 16) self.SetImageList(self.imageList, wx.IMAGE_LIST_SMALL) self.activeColumns = [] self.columnsMinWidth = [] self.Bind(wx.EVT_LIST_COL_END_DRAG, self.resizeChecker) self.Bind(wx.EVT_LIST_COL_BEGIN_DRAG, self.resizeSkip) if "wxMSW" in wx.PlatformInfo: self.Bind(wx.EVT_ERASE_BACKGROUND, self.OnEraseBk) self.mainFrame = gui.mainFrame.MainFrame.getInstance() i = 0 for colName in self.DEFAULT_COLS: if ":" in colName: colName, params = colName.split(":", 1) params = params.split(",") colClass = ViewColumn.getColumn(colName) paramList = colClass.getParameters() paramDict = {} for x, param in enumerate(paramList): name, type, defaultValue = param value = params[x] if len(params) > x else defaultValue value = value if value != "" else defaultValue if type == bool and isinstance(value, basestring): value = bool(value) if value.lower( ) != "false" and value != "0" else False paramDict[name] = value col = colClass(self, paramDict) else: col = ViewColumn.getColumn(colName)(self, None) self.addColumn(i, col) self.columnsMinWidth.append(self.GetColumnWidth(i)) i += 1 info = wx.ListItem() # noinspection PyPropertyAccess info.m_mask = wx.LIST_MASK_WIDTH self.InsertColumnInfo(i, info) self.SetColumnWidth(i, 0) self.imageListBase = self.imageList.ImageCount
def __init__(self, parent, size=wx.DefaultSize, style=0): wx.ListCtrl.__init__(self, parent, size=size, style=wx.LC_REPORT | style) self.imageList = CachingImageList(16, 16) self.SetImageList(self.imageList, wx.IMAGE_LIST_SMALL) self.activeColumns = [] self.columnsMinWidth = [] self.Bind(wx.EVT_LIST_COL_END_DRAG, self.resizeChecker) self.Bind(wx.EVT_LIST_COL_BEGIN_DRAG, self.resizeSkip) if "wxMSW" in wx.PlatformInfo: self.Bind(wx.EVT_ERASE_BACKGROUND, self.OnEraseBk) self.mainFrame = gui.mainFrame.MainFrame.getInstance() i = 0 for colName in self.DEFAULT_COLS: if ":" in colName: colName, params = colName.split(":", 1) params = params.split(",") colClass = ViewColumn.getColumn(colName) paramList = colClass.getParameters() paramDict = {} for x, param in enumerate(paramList): name, type, defaultValue = param value = params[x] if len(params) > x else defaultValue value = value if value != "" else defaultValue if type == bool and isinstance(value, basestring): value = bool(value) if value.lower() != "false" and value != "0" else False paramDict[name] = value col = colClass(self, paramDict) else: col = ViewColumn.getColumn(colName)(self, None) self.addColumn(i, col) self.columnsMinWidth.append(self.GetColumnWidth(i)) i += 1 info = wx.ListItem() # noinspection PyPropertyAccess info.m_mask = wx.LIST_MASK_WIDTH self.InsertColumnInfo(i, info) self.SetColumnWidth(i, 0) self.imageListBase = self.imageList.ImageCount
def __init__(self, parent, style=0): wx.ListCtrl.__init__(self, parent, style=wx.LC_REPORT | wx.BORDER_NONE | style) self.imageList = wx.ImageList(16, 16) self.SetImageList(self.imageList, wx.IMAGE_LIST_SMALL) self.activeColumns = [] self.columnsMinWidth = [] self.Bind(wx.EVT_LIST_COL_END_DRAG, self.resizeChecker) self.Bind(wx.EVT_LIST_COL_BEGIN_DRAG, self.resizeSkip) self.mainFrame = gui.mainFrame.MainFrame.getInstance() i = 0 for colName in self.DEFAULT_COLS: if ":" in colName: colName, params = colName.split(":", 1) params = params.split(",") colClass = ViewColumn.getColumn(colName) paramList = colClass.getParameters() paramDict = {} for x, param in enumerate(paramList): name, type, defaultValue = param value = params[x] if len(params) > x else defaultValue if type == bool: value = bool(value) if value != "False" else False paramDict[name] = value col = colClass(self, paramDict) else: col = ViewColumn.getColumn(colName)(self, None) self.addColumn(i, col) self.columnsMinWidth.append(self.GetColumnWidth(i)) i += 1 info = wx.ListItem() info.m_mask = wx.LIST_MASK_WIDTH self.InsertColumnInfo(i, info) self.SetColumnWidth(i, 0) self.imageListBase = self.imageList.ImageCount
def insertColumnBySpec(self, i, colSpec): if ":" in colSpec: colSpec, params = colSpec.split(":", 1) params = params.split(",") colClass = ViewColumn.getColumn(colSpec) paramList = colClass.getParameters() paramDict = {} for x, param in enumerate(paramList): name, type, defaultValue = param value = params[x] if len(params) > x else defaultValue value = value if value != "" else defaultValue if type == bool and isinstance(value, str): value = bool(value) if value.lower() != "false" and value != "0" else False paramDict[name] = value col = colClass(self, paramDict) else: col = ViewColumn.getColumn(colSpec)(self, None) self.addColumn(i, col) self.columnsMinWidth.append(self.GetColumnWidth(i))
def __init__(self, parent, style = 0): wx.ListCtrl.__init__(self, parent, style=wx.LC_REPORT | wx.BORDER_NONE | style) self.imageList = wx.ImageList(16, 16) self.SetImageList(self.imageList, wx.IMAGE_LIST_SMALL) self.activeColumns = [] self.columnsMinWidth = [] self.Bind(wx.EVT_LIST_COL_END_DRAG, self.resizeChecker) self.Bind(wx.EVT_LIST_COL_BEGIN_DRAG, self.resizeSkip) self.mainFrame = gui.mainFrame.MainFrame.getInstance() i = 0 for colName in self.DEFAULT_COLS: if ":" in colName: colName, params = colName.split(":", 1) params = params.split(",") colClass = ViewColumn.getColumn(colName) paramList = colClass.getParameters() paramDict = {} for x, param in enumerate(paramList): name, type, defaultValue = param value = params[x] if len(params) > x else defaultValue if type == bool: value = bool(value) if value != "False" else False paramDict[name] = value col = colClass(self, paramDict) else: col = ViewColumn.getColumn(colName)(self, None) self.addColumn(i, col) self.columnsMinWidth.append(self.GetColumnWidth(i)) i += 1 info = wx.ListItem() info.m_mask = wx.LIST_MASK_WIDTH self.InsertColumnInfo(i, info) self.SetColumnWidth(i, 0) self.imageListBase = self.imageList.ImageCount