-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Shoes should have refresh method #152
Comments
Suggestion: inheritance should be used here. Top level APP refresh would refresh every associated windows, then refresh on windows, then on slots. Something along this line... |
I think you mean run time descending down a tree of slots, given a beginning slot entry? Not really Class inheritance. Just redraw the lower part of the tree from that node and below. From what I can tell, at this moment) in canvas.c, shoes_canvas_repaint_all() does just that. It does NOT start from top of the Window. All it it does is call shoes_slot_repaint() after computing sizes. In ruby.c, many widgets have a draw() method in their C api and there is no mention in the Manual that it exists and why you shouldn't call it or when you can. |
It ends up in app.c (instead of native.c ) which calls shoes_native_slot_paint(slot) which appears, at first glance is not the entire window. I think it's worth trying. It's only a few lines of code in the right places. An hour to implement. And more hours to figure out how to write a test that shows it does or doesn't repaint everything. |
It's actually quite difficult to write a test case to use the experimental refresh_slot method. First - you need something that is failing. For a few hours we have that opportunity. The fix for #151 hasn't been merged in so master yet Shoes.app do
slot = flow do
para 'Click me!'
click { slot.remove; slot.refresh_slot }
end
end It behaves as intended. If this code makes it into Shoes 3.3 it should come with a warning in the manual that the user is using swinging an axe at his layout problems so please file a bug. |
I knew i had seen this problem recently, it was on snapshot test/demo app Shoes.app width: 400, height: 400 do
ext = "svg"
ext = "pdf"
path = "#{LIB_DIR}/snapshotfile.#{ext}"
@slot = stack do
button("shoot!") do
r = snapshot :format => ext.to_sym, :filename => path do
stroke blue
strokewidth 4
fill black
oval 100, 100, 200
end
@slot.refresh_slot #new
info r.inspect
#alert path, title: "snapshot saved to :" # temporarily commented here for demo purpose
#Shoes.show_log # ditto
#para "Done" # comment this out and the svg does not show ### not needed anymore
end
end
end |
I remember that! @passenger94. But is it a bug in snapshot or stack? |
well, since the refresh_slot method do it's job as expected and without it it doesn't show the snapshot also you can make the snapshot appear by simply resizing the window i'm quite sure it's a refresh problem ! so a stack "bug" Edit : tested shoes_canvas_repaint_all in shoes_canvas_snapshot it works for me |
Guys, how do you come up with those method names such as |
There is an open issue about app.set_window_title. There is also reason that it is different from app.title= It's a very subtle distinction but they are not the same - so they have different name. Feel free to contribute patches to shoes.app w/o breaking everything. I came up with refresh_slots because I think it is hideous (but occasionally useful). I don't think refresh() or repaint() should be a general method that the user can call to redraw whatever there layout error is. If you re-read the entire thread, @backorder you would note that I'm pretty damn iffy about this proposed experimental method. So I gave it an experimental name. I await your patches for refresh() on all widgets and flows in your OO world. |
Your rational is somehow understandable. Perhaps you misunderstand my point. In OO, a class or object responding to a message gives the context. So if a Slot or instance of Slot responds to |
app or Shoes.app as we all know, is a freaking module and adding methods to modules is not OO. 2.x Refinements just make things worse (IMO) because for us it's 'C' down there. I'm a little cranky because I'm going to have to build a couple of new OracleBox VMs for OSX 10.9 and build the deps from source and it's not pretty or fast. There is nothing OO in Shoes other than widget styles and that isn't consistent. Read the manual again. There may be common names to confuse the innocent but damn little (nothing?) inherits at the C level. Shoes is functional. It only appears to be OO. Shoes is not Ruby ... yada yada. |
Shoes is not Ruby is a good reminder. Though Ruby is still in there. In any case, what I said is what makes sense. Shoes has its design issues and we are left with the kid. I am not the one making the final decision and my contributions of late are next to nothing. It is simply my feedback. Good luck with your builds. |
Shoes 4 is everything a Ruby purist and modern methods ruby-ist could hope for. They swear on their hipster hats and pinky rings that someone could write a qt or gtk back end that could do most of what is done in Shoes 3.2+. When I run out of things to do with 3.3 I might test that claim. I could also grow old and not care. |
Isn't this already done ? |
I was only assigning names and milestones to issues so they can be referenced from the changelog. Current name is fine with me. |
This feature is fully implemented under the method name refresh_slot but after some time as passed, I'm still suggesting it becomes simply refresh since its context is implied. |
Since refresh_slot is part of our legacy (3.3.0) the only backwards compatible option would be to have both methods. Both are fragile crutches indicating a deeper problem in Shoes. Watch samples/good-plot.rb on Linux. - hint - it doesn't work. |
How about rename it altogether, change it in the manual and use alias/alias_method on refresh_slot until eventually got rid of it. This method has most likely few users to none. What do you say? |
Actually, the only thing known to use it at the Ruby level and and need it is the video widget and that's a bit fragile on Windows and older OSX. for different reasons. At the moment, my preference would be to hide either name. |
Then it should just be renamed without concerns for backward compatibility. On a side note, I did use it on #285#issuecomment-259602723 |
I've added method 'refresh' to canvas - both call C shoes_canvas_refresh_slot. Neither appears to work on 3.3.2 for some widgets. See bugs/bug152.rb |
bug152.rb is working as expected !!! |
Yes. bug152.rb has it's own bugs. Doh! |
Closed in Shoes 3.3.2 |
In issues #151 it was suggested to add a refresh method (to slots or maybe everything?)
I have several thoughts on that.
I suspect such a method might be useful for custom widgets or things that Shoes doesn't do well so I'm inclined to favor it.
The text was updated successfully, but these errors were encountered: