Displaying 3 results from an estimated 3 matches for "loaded_uri".
2006 Dec 11
0
[780] trunk/wxruby2/samples/html/html.rb: Error handling eg if no network present or server down
...::BusyCursor.busy do
</span><del>- res = Net::HTTP.start(uri.host, uri.port) do | http |
- http.get(uri.path)
</del><ins>+ begin
+ res = Net::HTTP.start(uri.host, uri.port) do | http |
+ http.get(uri.path)
+ end
+ @loaded_uri = uri
+ set_page(res.body)
+ rescue => err
+ msg = "Could not load page:\n#{err}"
+ Wx::MessageDialog.new(nil, msg, ''Error loading page'',
+ Wx::OK|Wx::ICON_ERROR).show_modal
+ return ''...
2006 Nov 06
3
HtmlWindow and friends
Hi
Attached is a patch to add HtmlWindow and some of its friends, including
HtmlEasyPrinting. Also a sample.
I haven''t tried exposing the parsing and rendering API yet to allow
custom tags etc - I just wanted to get basic HTML and the 0.6.0
compatibility classes first. There may well be some quite easy classes left.
There''s one ugly kludge to get OnOpeningURL to compile -
2006 Nov 12
0
[724] trunk/wxruby2: Initial commit of HtmlWindow functionality
...39;'uri''
+
+class MyHtmlWindow < Wx::HtmlWindow
+ attr_reader :html_src
+ def load_page_from_uri(uri)
+ case uri
+ when URI::HTTP
+ Wx::BusyCursor.busy do
+ res = Net::HTTP.start(uri.host, uri.port) do | http |
+ http.get(uri.path)
+ end
+ @loaded_uri = uri
+ set_page(res.body)
+ end
+ return @loaded_uri
+ when URI::Generic
+ if @loaded_uri and @loaded_uri.kind_of?(URI::HTTP)
+ return load_page_from_uri( @loaded_uri.merge(uri) )
+ elsif @loaded_uri # current viewing a file
+ if uri.to_s =~ /^\//
+...