-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix most self bugs - use Scarpe::App as self nearly always.
Make display properties properly inheritable Move DocumentRoot special behavior into app, make it 'just a Flow' Remove unused app-option override code in ControlInterface
- Loading branch information
Showing
18 changed files
with
206 additions
and
152 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
def printish(msg) | ||
#$stderr.puts msg | ||
File.open("/tmp/shoesy_stuff.txt", "a") do |f| | ||
f.write(msg + "\n") | ||
end | ||
end | ||
|
||
Shoes.app do | ||
printish "Self top: #{self.inspect}" # It's an instance of Shoes::App, yes | ||
stack do | ||
printish "Self in stack: #{self.inspect}" # Yup, here too | ||
end | ||
button("Clickity") do | ||
alert("You clicked me!") | ||
printish "Self in button handler: #{self.inspect}" # And here too | ||
end | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# frozen_string_literal: true | ||
|
||
require "net/http" | ||
require "openssl" | ||
require "nokogiri" | ||
|
||
class Scarpe::Widget | ||
def download(url) | ||
Thread.new do | ||
begin | ||
uri = URI(url) | ||
http = Net::HTTP.new(uri.host, uri.port) | ||
http.use_ssl = true | ||
http.verify_mode = OpenSSL::SSL::VERIFY_NONE | ||
|
||
request = Net::HTTP::Get.new(uri.request_uri) | ||
|
||
http.request(request) do |response| | ||
case response | ||
when Net::HTTPSuccess | ||
# content = response.body | ||
|
||
# headers = response.header | ||
|
||
html_get_title(content) | ||
else | ||
Scarpe.error("Failed to download content. Response code: #{response.code}") | ||
end | ||
end | ||
rescue StandardError => e | ||
Scarpe.error("Error occurred while downloading: #{e.message}") | ||
end | ||
end | ||
end | ||
|
||
private | ||
|
||
def html_get_title(content) | ||
doc = Nokogiri::HTML(content) | ||
|
||
title = doc.at_css("title")&.text&.strip || "" | ||
|
||
# headings = doc.css("h1").map(&:text) | ||
|
||
title | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# frozen_string_literal: true | ||
|
||
class Scarpe::Slot < Scarpe::Widget | ||
include Scarpe::Background | ||
include Scarpe::Border | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.