KONTRA Gergely
2003-Nov-10 09:07 UTC
[Wxruby-users] picture organizer -- need a bit of help
While trying to develop a little wxruby program, I have some difficulties, namely: 1. I want to read all kind of graphic files, (mainly jpg, png and tiff is enough...) But, the current implementation seems to deal only with bmps and currently there is no way to call ::wxInitAllImageHandlers. 2. I think DnD is required in my case: I want to drop filenames on a TreeCtrl. I will try to add some classes, but now I cannot yet compile wxruby on mingw, I''m now using the precompiled msvc lib. 3. I''ve noticed, that wxGenericDirCtrl is not ported yet, however it can be used eg. in IDE''s very well. (I still miss some features in the original version, eg to set the root directory...) 4. I tried to use evt_idle to process creating thumbnails in the background. But I don''t know how to shut up this process, and second, I''ve noticed, that this codeblock is not called, when it should. After loading all the thumbnails, see the dummy counter in my prog... So how to correctly load thumbnails in background? Gergo -- +-[ Kontra, Gergely<kgergely@mcl.hu> PhD student Room IB113 ]---------+ | http://www.mcl.hu/~kgergely "Olyan langesz vagyok, hogy | | Mobil:(+36 20) 356 9656 ICQ: 175564914 poroltoval kellene jarnom" | +-- Magyar php mirror es magyar php dokumentacio: http://hu.php.net --+ -------------- next part -------------- A non-text attachment was scrubbed... Name: pictorG.zip Type: application/x-zip-compressed Size: 3288 bytes Desc: not available Url : http://rubyforge.org/pipermail/wxruby-users/attachments/20031110/d10993a7/pictorG.bin
KONTRA Gergely wrote:> While trying to develop a little wxruby program, I have some > difficulties, namely: > > 1. I want to read all kind of graphic files, (mainly jpg, png and tiff > is enough...) But, the current implementation seems to deal only with > bmps and currently there is no way to call ::wxInitAllImageHandlers.I just checked this change into cvs tonight.> 2. I think DnD is required in my case: I want to drop filenames on a > TreeCtrl. I will try to add some classes, but now I cannot yet > compile wxruby on mingw, I''m now using the precompiled msvc lib.Hopefully the advice from Gour will help. If not, please keep asking. It would be great for you to be able to add classes and methods on your own.> 3. I''ve noticed, that wxGenericDirCtrl is not ported yet, however it can > be used eg. in IDE''s very well. (I still miss some features in the > original version, eg to set the root directory...)I may be able to add this during this coming weekend. Not sure, though. Kevin
KONTRA Gergely wrote:> 4. I tried to use evt_idle to process creating thumbnails in the > background. But I don''t know how to shut up this process, and second, > I''ve noticed, that this codeblock is not called, when it should. > After loading all the thumbnails, see the dummy counter in my prog... > So how to correctly load thumbnails in background?evt_idle is intended for permanent idle processes. In your case, you just want a single task to execute in the background, which is a perfect use for a thread. I started with your program, modified the directory to work for my Linux box, changed the extension to .jpg, and added the new call to Wx::init_all_image_handlers. You shouldn''t have to do any of that. Then, at the end of MyFrame#show_pics, I changed the code to: log_status "Collecting done" Thread.new do @pic.show_list list end I also changed Pictures#show_list to: def show_list list num_images=list.length log_status ''Removing images'' clear_all list.each_with_index{|fn,i| puts("generating thumb for #{fn}") insert_item i,fn,i } list.each_with_index{|fn,i| puts("generating thumb for #{fn}") log_status PROG_THM[''prog''].sub(''NUM'',i.to_s).sub(''ALL'',num_images.to_s) @imageList.add Bitmap.new(Image.new(fn).rescale(THM_WIDTH,THM_HEIGHT)) refresh_item i } log_status PROG_THM[''done''] end I experimented briefly with calls to yield and Wx::yield, but both of those made things worse, not better. It seems to work pretty well without them on my system. I look forward to hearing how well this works for you. It looks like you have made a good start toward a nice program, by the way. Kevin
On 1110, Kevin Smith wrote: Thx for your help. In the meantime I started to implement wxDataObject and friends, and I''ve found the following problems: 1. wxruby''s extconf.rb doesn''t work for me: if I install wxwindows for mingw using a makefile, I have no wx-config. After hacking a lot with the Makefile, I end up with the Makefile attached. Can you modify extconf.rb to reflect these changes? The only problem, that it requires mingwm10.dll now... 2. Can somebody check, if it is ok or not? ps: Kevin: since the ruby file is not so large, can you please send me in mail? And where can I download the new wxruby files? thx Gergo -- +-[ Kontra, Gergely<kgergely@mcl.hu> PhD student Room IB113 ]---------+ | http://www.mcl.hu/~kgergely "Olyan langesz vagyok, hogy | | Mobil:(+36 20) 356 9656 ICQ: 175564914 poroltoval kellene jarnom" | +-- Magyar php mirror es magyar php dokumentacio: http://hu.php.net --+
Ok, I will download the CVS tarball and first think, and write after ;) Gergo -- +-[ Kontra, Gergely<kgergely@mcl.hu> PhD student Room IB113 ]---------+ | http://www.mcl.hu/~kgergely "Olyan langesz vagyok, hogy | | Mobil:(+36 20) 356 9656 ICQ: 175564914 poroltoval kellene jarnom" | +-- Magyar php mirror es magyar php dokumentacio: http://hu.php.net --+
KONTRA Gergely (kgergely@mlabdial.hit.bme.hu) wrote:> 1. wxruby''s extconf.rb doesn''t work for me: if I install wxwindows for > mingw using a makefile, I have no wx-config.Why you don''t install with ./configure ; make; make install? MSYS + MINGW provides very convenient environment for compiling on Win platform applications developed on Linux. If you don''t like it maybe you can try with free Borland commandline tools.> After hacking a lot with the Makefile, I end up with the Makefile > attached. Can you modify extconf.rb to reflect these changes? The > only problem, that it requires mingwm10.dll now...This is because of -mthreads paarameter.> 2. Can somebody check, if it is ok or not?It looks that maling lists'' software stripped attachment :-) Sincerely, Gour -- Gour gour@mail.inet.hr Registered Linux User #278493