From: Brett G. G. <gi...@cp...> - 2006-10-06 01:30:16
|
Hi Axel, Duncan, et. al. I tried going to Trac to look at the bug list to see if some issues I'm having were reported. However, the reports give me a "Maximum recursion limit exceeded error" and then python spews its traceback. (If you like, I can include that for you) (Long bug related stuff below....) The search didn't seem to find anything relevant. The first is to do with layoutGetPixelExtents. I've had to do the following: getTextExtent :: PangoLayout -> String -> IO (Int,Int) getTextExtent playout txt = do playout `layoutSetText` (hackMinusToSpace txt) (Rectangle xl yl wl hl, Rectangle x y w h) <- layoutGetPixelExtents playout let ext = (abs (w-x) ,abs (h-y)) return ext and hackMinusToSpace :: String -> String hackMinusToSpace [] = [] hackMinusToSpace ('-':ss) = 'a':hackMinusToSpace ss hackMinusToSpace (a:ss) = a:hackMinusToSpace ss to get the correct size for text strings. It seems when a text string contains '-', the values for wl and w go rather wonky - values like 290873 and such returned for 5-8 character strings. With the hack, life is lovely. Second has to do with TreeList / listStoreAppend... Following one of the examples, I created a tree model with -- create the tree model createTreeAndStore = do mainView <- treeViewNew skel <- emptyListSkel let createTextColumn name = do (attr, _, set) <- listSkelAddAttribute skel cellText column <- newTreeViewColumn column `treeViewColumnSetTitle` name mainView `treeViewAppendColumn` column renderer <- treeViewColumnNewText column True True renderer `treeViewColumnAssociate` [attr] return set -- create the various columns in both the model and view setLineNo <- createTextColumn "Line" setIns <- createTextColumn "Instruction" store <- newListStore skel mainView `treeViewSetModel` store return (mainView, store, setLineNo, setIns) and then actually use that as: setPageData :: [Instruction OurBasis] -> Int -> IO TreeView setPageData ins ip = do (tv, store, setLineno, setIns) <- createTreeAndStore tv `treeViewSetHeadersVisible` True sel <- treeViewGetSelection tv sel `treeSelectionSetMode` SelectionNone -- TODO - This inner loop seems to crash at random times. mapM_ (\(ln, txt) -> do iter <- listStoreAppend store setLineno iter ln setIns iter txt return () ) $ zip (List.map show [ip..]) (List.map show ins) print " SPD: Created and returning tree model" return tv As the TODO comment says - the inner loop just seems to crash sometimes. These windows have anywhere from 5 - 500 lines. Longer ones seem to crash more regularly. I have changed this to just a big text box where I format the output text with Text.Printf and I've not had a crash in the last few weeks since I did that. Any thoughts on this one? Thanks -- Brett G. Giles Grad Student - Category Theory gi...@cp... http://pages.cpsc.ucalgary.ca/~gilesb |