Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
ardublockly
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
ardublockly
Commits
55765797
Commit
55765797
authored
May 27, 2015
by
carlosperate
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CEF print updates and removal of magnet links
parent
bc7ac485
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
16 deletions
+13
-16
start_cef.py
start_cef.py
+13
-16
No files found.
start_cef.py
View file @
55765797
#!/usr/bin/env python2
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
#
#
# Embedding CEF browser in a wxPython window to launch Ardublockly.
# Embedding CEF browser in a wxPython window to launch Ardublockly.
...
@@ -197,7 +197,7 @@ class MainFrame(wx.Frame):
...
@@ -197,7 +197,7 @@ class MainFrame(wx.Frame):
self
.
Bind
(
wx
.
EVT_CLOSE
,
self
.
OnClose
)
self
.
Bind
(
wx
.
EVT_CLOSE
,
self
.
OnClose
)
if
USE_EVT_IDLE
and
not
popup
:
if
USE_EVT_IDLE
and
not
popup
:
# Bind EVT_IDLE only for the main application frame.
# Bind EVT_IDLE only for the main application frame.
print
(
"Using EVT_IDLE to execute the CEF message loop work"
)
print
(
g_ardutag
+
"Using EVT_IDLE to execute the CEF message loop work"
)
self
.
Bind
(
wx
.
EVT_IDLE
,
self
.
OnIdle
)
self
.
Bind
(
wx
.
EVT_IDLE
,
self
.
OnIdle
)
self
.
CreateMenu
()
self
.
CreateMenu
()
...
@@ -323,6 +323,8 @@ class JavascriptExternal:
...
@@ -323,6 +323,8 @@ class JavascriptExternal:
print
(
g_ardutag
+
"TestAllTypes: "
+
str
(
args
))
print
(
g_ardutag
+
"TestAllTypes: "
+
str
(
args
))
def
ExecuteFunction
(
self
,
*
args
):
def
ExecuteFunction
(
self
,
*
args
):
if
g_platform_os
==
"linux"
:
self
.
mainBrowser
.
GetMainFrame
().
ExecuteFunction
(
*
args
)
self
.
mainBrowser
.
ExecuteFunction
(
*
args
)
self
.
mainBrowser
.
ExecuteFunction
(
*
args
)
def
TestJSCallback
(
self
,
jsCallback
):
def
TestJSCallback
(
self
,
jsCallback
):
...
@@ -375,7 +377,7 @@ class JavascriptExternal:
...
@@ -375,7 +377,7 @@ class JavascriptExternal:
self
.
cookieVisitor
=
CookieVisitor
()
self
.
cookieVisitor
=
CookieVisitor
()
cookieManager
=
self
.
mainBrowser
.
GetUserData
(
"cookieManager"
)
cookieManager
=
self
.
mainBrowser
.
GetUserData
(
"cookieManager"
)
if
not
cookieManager
:
if
not
cookieManager
:
print
(
"
\n
[ardublockly]
Cookie manager not yet created! Visit "
print
(
g_ardutag
+
"
Cookie manager not yet created! Visit "
"the cookietester website first and create some cookies"
)
"the cookietester website first and create some cookies"
)
return
return
cookieManager
.
VisitAllCookies
(
self
.
cookieVisitor
)
cookieManager
.
VisitAllCookies
(
self
.
cookieVisitor
)
...
@@ -385,7 +387,7 @@ class JavascriptExternal:
...
@@ -385,7 +387,7 @@ class JavascriptExternal:
self
.
cookieVisitor
=
CookieVisitor
()
self
.
cookieVisitor
=
CookieVisitor
()
cookieManager
=
self
.
mainBrowser
.
GetUserData
(
"cookieManager"
)
cookieManager
=
self
.
mainBrowser
.
GetUserData
(
"cookieManager"
)
if
not
cookieManager
:
if
not
cookieManager
:
print
(
"
\n
[ardublockly]
Cookie manager not yet created! Visit "
print
(
g_ardutag
+
"
Cookie manager not yet created! Visit "
"the cookietester website first and create some cookies"
)
"the cookietester website first and create some cookies"
)
return
return
cookieManager
.
VisitUrlCookies
(
cookieManager
.
VisitUrlCookies
(
...
@@ -396,7 +398,7 @@ class JavascriptExternal:
...
@@ -396,7 +398,7 @@ class JavascriptExternal:
def
SetCookie
(
self
):
def
SetCookie
(
self
):
cookieManager
=
self
.
mainBrowser
.
GetUserData
(
"cookieManager"
)
cookieManager
=
self
.
mainBrowser
.
GetUserData
(
"cookieManager"
)
if
not
cookieManager
:
if
not
cookieManager
:
print
(
"
\n
[ardublockly]
Cookie manager not yet created! Visit "
print
(
g_ardutag
+
"
Cookie manager not yet created! Visit "
"the cookietester website first and create some cookies"
)
"the cookietester website first and create some cookies"
)
return
return
cookie
=
cefpython
.
Cookie
()
cookie
=
cefpython
.
Cookie
()
...
@@ -404,25 +406,25 @@ class JavascriptExternal:
...
@@ -404,25 +406,25 @@ class JavascriptExternal:
cookie
.
SetValue
(
"yeah really"
)
cookie
.
SetValue
(
"yeah really"
)
cookieManager
.
SetCookie
(
"http://www.html-kit.com/tools/cookietester/"
,
cookieManager
.
SetCookie
(
"http://www.html-kit.com/tools/cookietester/"
,
cookie
)
cookie
)
print
(
"
\n
[ardublockly]
Cookie created! Visit html-kit cookietester to "
print
(
g_ardutag
+
"
Cookie created! Visit html-kit cookietester to "
"see it"
)
"see it"
)
def
DeleteCookies
(
self
):
def
DeleteCookies
(
self
):
cookieManager
=
self
.
mainBrowser
.
GetUserData
(
"cookieManager"
)
cookieManager
=
self
.
mainBrowser
.
GetUserData
(
"cookieManager"
)
if
not
cookieManager
:
if
not
cookieManager
:
print
(
"
\n
[ardublockly]
Cookie manager not yet created! Visit "
print
(
g_ardutag
+
"
Cookie manager not yet created! Visit "
"the cookietester website first and create some cookies"
)
"the cookietester website first and create some cookies"
)
return
return
cookieManager
.
DeleteCookies
(
cookieManager
.
DeleteCookies
(
"http://www.html-kit.com/tools/cookietester/"
,
"http://www.html-kit.com/tools/cookietester/"
,
"Created_Via_Python"
)
"Created_Via_Python"
)
print
(
"
\n
[ardublockly]
Cookie deleted! Visit html-kit cookietester "
print
(
g_ardutag
+
"
Cookie deleted! Visit html-kit cookietester "
"to see the result"
)
"to see the result"
)
class
StringVisitor
:
class
StringVisitor
:
def
Visit
(
self
,
string
):
def
Visit
(
self
,
string
):
print
(
"
\n
[ardublockly]
StringVisitor.Visit(): string:"
)
print
(
g_ardutag
+
"
StringVisitor.Visit(): string:"
)
print
(
"--------------------------------"
)
print
(
"--------------------------------"
)
print
(
string
)
print
(
string
)
print
(
"--------------------------------"
)
print
(
"--------------------------------"
)
...
@@ -431,9 +433,9 @@ class StringVisitor:
...
@@ -431,9 +433,9 @@ class StringVisitor:
class
CookieVisitor
:
class
CookieVisitor
:
def
Visit
(
self
,
cookie
,
count
,
total
,
deleteCookie
):
def
Visit
(
self
,
cookie
,
count
,
total
,
deleteCookie
):
if
count
==
0
:
if
count
==
0
:
print
(
"
\n
[ardublockly]
CookieVisitor.Visit(): total cookies: %s"
%
print
(
g_ardutag
+
"
CookieVisitor.Visit(): total cookies: %s"
%
total
)
total
)
print
(
"
\n
[ardublockly]
CookieVisitor.Visit(): cookie:"
)
print
(
g_ardutag
+
"
CookieVisitor.Visit(): cookie:"
)
print
(
" "
+
str
(
cookie
.
Get
()))
print
(
" "
+
str
(
cookie
.
Get
()))
# True to continue visiting cookies
# True to continue visiting cookies
return
True
return
True
...
@@ -477,11 +479,6 @@ class ClientHandler:
...
@@ -477,11 +479,6 @@ class ClientHandler:
def
OnBeforeBrowse
(
self
,
browser
,
frame
,
request
,
isRedirect
):
def
OnBeforeBrowse
(
self
,
browser
,
frame
,
request
,
isRedirect
):
print
(
g_ardutag
+
"RequestHandler::OnBeforeBrowse()"
)
print
(
g_ardutag
+
"RequestHandler::OnBeforeBrowse()"
)
print
(
" url = %s"
%
request
.
GetUrl
()[:
100
])
print
(
" url = %s"
%
request
.
GetUrl
()[:
100
])
# Handle "magnet:" links.
if
request
.
GetUrl
().
startswith
(
"magnet:"
):
print
(
g_ardutag
+
"RequestHandler::OnBeforeBrowse(): "
"magnet link clicked, cancelling browse request"
)
return
True
return
False
return
False
def
OnBeforeResourceLoad
(
self
,
browser
,
frame
,
request
):
def
OnBeforeResourceLoad
(
self
,
browser
,
frame
,
request
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment