From: Peder P. <pe...@ho...> - 2004-10-02 20:19:08
|
My vote goes for solution 3 but I would add a radio group with 4 choices ['Recorded position', 'Left Top', 'Centered', 'Entered Value'] /Peder ----- Ursprungligt meddelande ----- Från: "Kevin Altis" <al...@se...> Till: "pythoncard-Users" <pyt...@li...> Skickat: den 1 oktober 2004 22:29 Ämne: [Pythoncard-users] the trouble with background position > I want to stamp out a problem that I keep forgetting to solve with the > Background position. The problem is that the resourceEditor saves the > position of the window in the .rsrc.py file, but in general when a > background is displayed you would want the position to just use the > default (-1, -1) so the window manager positions the window. Typically > that would be the top-left of the display or perhaps the center of the > display for a dialog. However, I can't really tell from querying the > position of the window whether it is the default position or not, so > the resourceEditor just saves the position as is and you manually have > to delete the 'position' attribute from the .rsrc.py file or change it > to (-1, -1). However, the next time you modify the file in the > resourceEditor your change is lost. > > You can always override the position manually in your on_initialize > handler or another method and in fact most of the tools that save > configuration information do just that. The position specified for all > backgrounds can also be overridden by sticking a a property into your > pythoncard_config.txt file such as: > > 'defaultBackgroundPosition':(5, 5), > > In fact, I have had a line like that in my config from the early days > of PythonCard, which is why I don't notice all the backgrounds that > have their position set to the middle of the screen or worse, off the > right edge of the screen because of where someone had last edited the > position in the resourceEditor. This is not a general solution to the > problem though and in fact I should probably remove that attribute > support from the config. > > So, I can see a few solutions to the position problem. > > 1. No longer save the background position attribute in the > resourceEditor. > > If you want a specific position, then that would explicitly need to be > set in your code or manually added to the .rsrc.py file. For simplicity > sake, this idea appeals to me the most. All existing .rsrc.py files in > the samples and tools where a 'position' has been saved, but shouldn't > have one, will be manually edited to get rid of the 'position' line. > The downside is that if you do want to have a position in the .rsrc.py > file, then whenever you edit the .rsrc.py file with the resourceEditor > that position will be lost. > > I might be able to add some code to the resourceEditor that only saves > the position if it is explicitly set by the user in the .rsrc.py file > or the background info dialog, but I'll have to ponder on that > solution. > > 2. Add an additional flag to the background on whether to override the > default position with the position attribute. > > This would allow the framework and resourceEditor code to know whether > to use the default position or not, but it seems a bit perverse to me > and adds complexity to all operations involving the background > position. > > 3. Change the background info dialog in the resourceEditor so there is > an explicit checkbox that needs to be checked in order to save the > position of the background. > > This would limit the solution and changes to just the resourceEditor, > but it could still be a bit strange. The position shown in the dialog > would probably need to be set manually, since whatever position you are > editing the window probably doesn't reflect where you want the > background or dialog to show up when the application is run. This > solution has some additional complications since I would probably still > need to save something with the .rsrc.py or have a general > resourceEditor preference for the option. > > There are probably some other solutions, but again at this point I lean > toward just not saving the position from the resourceEditor. Feel free > to reply with your opinions and I'll make a change early next week so > the change makes it into release 0.8.1. > > Time to go and find a view in Portland of the plume from Mt. St. Helens > :) > > http://story.news.yahoo.com/news?tmpl=story&cid=585&e=1&u=/nm/20041001/ > sc_nm/environment_volcano_dc > > ka > > > > ------------------------------------------------------- > This SF.net email is sponsored by: IT Product Guide on ITManagersJournal > Use IT products in your business? Tell us what you think of them. Give us > Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more > http://productguide.itmanagersjournal.com/guidepromo.tmpl > _______________________________________________ > Pythoncard-users mailing list > Pyt...@li... > https://lists.sourceforge.net/lists/listinfo/pythoncard-users > |