Further Updates!...
Well - yet another delayed update - not a long one this time as I can't spend too long on the internet as it's getting late! I've mainly spent last week either asleep, or chatting to freinds over msn lol... Sunday was good though - I saw a m8 before church and we sat around and had a meal! (Obviously that was excellent in my opinion - lazy person that I am ;) I said that I'd been 'mostly' sleeping or chatting last week, but that didn't mean I never got *any* programming done at all - actually, I've finally added some internals (although obviously you can't see them all yet) to afloat, my adrift clone, and also completed adding the room dialog itself (not the additional popups though unfortunately)... but... I've come up against a problem - not a particularly hard to solve problem - but a problem all the same. In order to delete rooms and move them about in the list, and in order to change the sort method (which is implemented but not in the UI at the moment), I need a popup context menu when the right mouse button is clicked on the rooms pane. This sounds simple - unfortunately - I need a right mouse button context menu on ALL the panes. This menu is virtually the same for every pane - but not quite, and the amount of code it takes for just one menu in wxPython is so huge that if I were to code all of them seperately, it would probably equal the already existant 1040 lines of UI code. To be honest, I can't be bothered with all that for just a scattering of menus, with mostly the same options anyway - so I decided I'd rather just have one universal menu with any specific options coming up on demand. Optimally, this requires a certain way of programming them - that involves multiple references to a single object - which in python is not particularly simple. Anyway, to overcome this hurdle, I spent all of today writing a small (only 42 lines of actual code) module that acts as a wrapper to an underlying object and allows to create references by explicitly copying the wrapper! The way the wrapper works is such that all the functions and attributes of the contained object are replicated as native functions of the wrapper class but in fact, faked/linked back to the objects own functions! It took a fair amount of reading of pythons docs and eventually realising what was and wasn't possible to implement before I could get a reliable system up and running - but I've tested it, and it appears to work absolutely fabulously which is great! So anyhow, seeing as I rambled on about the system for so long (and I can't show any screenshots since it is entirely internal and invisible to the GUI) here is the only screenie you're going to get this time:
It shows the new room dialog (though not the directions tab - which has been most modified from the original adrift) with some sample text. In the background you can see the main window with the room list and count working perfectly. The tagging system of adrift has been added but is entirely automatic and seamlessly tags rooms with unique names if the user does not tag them him/herself! You can also see the console output - a new feature as well, related to a reorganising and repackaging of the files belonging to the program into a good directory structure and seperate 'common module' directories - which incidentally, is what I spent most of friday night and saturday morning setting up - another 'internal' (sorta) change that you can't really see from the GUI but very important and significant. It makes working on the program a whole lot easier! - especially when you don't have to scroll through 1000's of lines of muddled program code to find a tiny function embedded inside a nested class somewhere at the bottom lol! Anyway - will probably spend quite a bit of time this week getting the rest of the GUI up and running so I can start coding the player later on!




0 comments:
Post a Comment