why is it row-1?
···
On Thu, Jul 17, 2008 at 5:42 AM, Timothy Grant timothy.grant@gmail.com wrote:
On Wed, Jul 16, 2008 at 4:32 PM, Timothy Grant timothy.grant@gmail.com wrote:
I know what changed as I’m adding new functionality. Situation gets a bit funny though. I took my PowerBook down to his office and said “See it works for me.” and showed him just how well it worked. Then he said “Let me try.” So I let him try and he’s managed to make it break on OSX, and I can replicate the problem. It just needed to be exercised more thoroughly on OSX than it did on Vista. Immediate crash on Vista, not so immediate crash on OSX.
So now I’m trying to figure out why my abuse of a wx.Grid is causing a segfault.
On Wed, Jul 16, 2008 at 4:26 PM, Paul Hartley phartley@gmail.com wrote:
If it were me, I would probably try to figure out which widgets are known to have inconsistencies between platforms and check over the code for those… but obviously something has to have changed if things stopped working, so tracing back what could have changed (i.e. in your code, or especially in your friend’s box) could be what you need to do…
paul
On Wed, Jul 16, 2008 at 2:33 PM, Timothy Grant timothy.grant@gmail.com wrote:
Up until today, the code I have written on my PowerBook has performed flawlessly on Windows too. I don’t have a windows box to test on, so rely on a friend who has a Vista box.
My most recent iteration of code works just fine for me, but when he gets it he can make it crash, a hard crash, no traceback no anything, and I have no idea where to start debugging this process.
I’m using a Notebook and have some widgets on Tab 1, that affect the content of Tab 2. The crash occurs when clicking on Tab 2.
Does anyone have any ideas on how I should go about tracking this down?
–
Stand Fast,
tjg. [Timothy Grant]
I’ve got a bit more information now, narrowed it down to one line of code. I have the following class. When I uncomment the line in blue. The app segfaults without it all is fine. I find it particularly puzzling that I can use the attribute on a column with no problem, but when applied to the row it segfaults. Any insight would be greatly appreciated.
(and yes, I am aware of a violation of the Law of Demeter It’s on the todo list to be fixed).
class SkillGrid(wxgrd.Grid):
def init(self, parent, *args, **kwargs):wxgrd.Grid.__init__(self, parent, *args, **kwargs) self.column_headings = ['Skill Name', 'Ability', 'Skill', 'Modifier', 'Misc. Mod'] self.CreateGrid(0, len(self.column_headings)) self.SetRowLabelSize(0) for i, ch in enumerate(self.column_headings): self.SetColLabelValue(i, ch) self.SetColSize(col=i, width=77) self.SetColSize(col=0, width=200) self.SetColLabelSize(20) self.engine = wx.GetApp().engine self.attr = self.GetOrCreateCellAttr(0,0) self.attr.SetReadOnly(True) self.build_skill_grid() Publisher().subscribe(self.build_skill_grid, ('update', 'character', 'character_class')) def build_skill_grid(self, message=None): def add_row_and_data(row, data, format_string="%s"): self.AppendRows(1) self.SetCellValue(row=row, col=0, s=format_string % self.engine.skill_name_for_code(data)) self.SetCellBackgroundColour(row, 0, self.GetLabelBackgroundColour()) if self.GetNumberRows() > 0: self.DeleteRows(0, self.GetNumberRows()) cc = self.engine.character_class_for_code_or_name( name=self.engine.character.character_class) row = 0 for s in cc.skills: if type(s) == type([]): ####################################### # self.SetRowAttr(row - 1, self.attr) # ####################################### for col in range(len(self.column_headings)): self.SetCellBackgroundColour(row - 1, col, self.GetLabelBackgroundColour()) for ss in s: add_row_and_data(row=row, data=ss, format_string=" %s") row += 1 else: add_row_and_data(row, s) row += 1 self.SetColAttr(0, self.attr)
–
Stand Fast,
tjg. [Timothy Grant]
wxpython-users mailing list
–
There is NO FATE, we are the creators.