Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
922974c7
Commit
922974c7
authored
Apr 28, 2014
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added muted
parent
c0de1195
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
287 additions
and
173 deletions
+287
-173
debugger.html
ethereal/assets/muted/debugger.html
+1
-1
index.html
ethereal/assets/muted/index.html
+44
-2
muted.js
ethereal/assets/muted/muted.js
+61
-0
muted.qml
ethereal/assets/qml/muted.qml
+58
-49
webapp.qml
ethereal/assets/qml/webapp.qml
+119
-118
ui_lib.go
ethereal/ui/ui_lib.go
+2
-2
dev_console.go
ethereum/dev_console.go
+2
-1
No files found.
ethereal/assets/muted/debugger.html
View file @
922974c7
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
<style
type=
"text/css"
>
<style
type=
"text/css"
>
html
,
body
{
html
,
body
{
margin
:
0
;
padding
:
0
;
margin
:
0
;
padding
:
0
;
min-height
:
100%
;
min-height
:
100%
;
}
}
#debugger
{
#debugger
{
...
...
ethereal/assets/muted/index.html
View file @
922974c7
...
@@ -7,20 +7,63 @@
...
@@ -7,20 +7,63 @@
<script
src=
"lib/codemirror.js"
></script>
<script
src=
"lib/codemirror.js"
></script>
<script
src=
"lib/matchbrackets.js"
></script>
<script
src=
"lib/matchbrackets.js"
></script>
<script
src=
"lib/go.js"
></script>
<script
src=
"lib/go.js"
></script>
<script
src=
"muted.js"
></script>
<style
type=
"text/css"
>
<style
type=
"text/css"
>
html
,
body
{
html
,
body
{
margin
:
0
;
padding
:
0
;
margin
:
0
;
padding
:
0
;
min-height
:
100%
;
}
#debugger
{
height
:
30%
;
font-family
:
"Monaco"
;
border-top
:
5px
solid
grey
;
}
#debugger
.line
{
overflow
:
none
;
}
#debugger
.col1
,
#debugger
.col2
{
float
:
left
;
padding
:
3px
;
}
#debugger
.col1
{
width
:
10px
;
padding-left
:
10px
-webkit-touch-callout
:
none
;
-webkit-user-select
:
none
;
-khtml-user-select
:
none
;
-moz-user-select
:
none
;
-ms-user-select
:
none
;
user-select
:
none
;
}
#debugger
.col2
{
width
:
90%
;
}
.prompt
{
color
:
"#5089D4"
;
}
}
.CodeMirror
{
.CodeMirror
{
height
:
100%
;
height
:
70%
;
font-size
:
14pt
;
}
}
</style>
</style>
</head>
</head>
<body>
<body>
<textarea
id=
"editor"
></textarea>
<textarea
id=
"editor"
></textarea>
<div
id=
"debugger"
>
<div
class=
"line"
>
<div
class=
"col1 prompt"
>
>
</div>
<div
class=
"col2"
contenteditable
>
</div>
</div>
</div>
<script>
<script>
var
textArea
=
document
.
querySelector
(
"#editor"
)
var
textArea
=
document
.
querySelector
(
"#editor"
)
var
editor
=
CodeMirror
.
fromTextArea
(
textArea
,
{
var
editor
=
CodeMirror
.
fromTextArea
(
textArea
,
{
...
@@ -33,6 +76,5 @@
...
@@ -33,6 +76,5 @@
indentWithTabs
:
true
,
indentWithTabs
:
true
,
});
});
</script>
</script>
</body>
</body>
</html>
</html>
ethereal/assets/muted/muted.js
0 → 100644
View file @
922974c7
// Helper function for generating pseudo callbacks and sending data to the QML part of the application
function
postData
(
data
,
cb
)
{
data
.
_seed
=
Math
.
floor
(
Math
.
random
()
*
1000000
)
if
(
cb
)
{
Muted
.
_callbacks
[
data
.
_seed
]
=
cb
;
}
if
(
data
.
args
===
undefined
)
{
data
.
args
=
[];
}
navigator
.
qt
.
postMessage
(
JSON
.
stringify
(
data
));
}
window
.
Muted
=
{
prototype
:
Object
(),
}
window
.
Muted
.
_callbacks
=
{}
window
.
Muted
.
_onCallbacks
=
{}
function
debug
(
/**/
)
{
console
.
log
(
"hello world"
)
var
args
=
arguments
;
var
msg
=
""
for
(
var
i
=
0
;
i
<
args
.
length
;
i
++
){
if
(
typeof
args
[
i
]
==
"object"
)
{
msg
+=
" "
+
JSON
.
stringify
(
args
[
i
])
}
else
{
msg
+=
args
[
i
]
}
}
document
.
querySelector
(
"#debugger"
).
innerHTML
+=
"<div class='line'><div class='col1'></div><div class='col2'>"
+
msg
+
"</div></div>"
;
}
console
.
log
=
function
()
{
var
args
=
[]
for
(
var
i
=
0
;
i
<
arguments
.
length
;
i
++
)
{
args
.
push
(
arguments
[
i
]);
}
postData
({
call
:
"log"
,
args
:
args
})
}
navigator
.
qt
.
onmessage
=
function
(
ev
)
{
var
data
=
JSON
.
parse
(
ev
.
data
)
if
(
data
.
_event
!==
undefined
)
{
Muted
.
trigger
(
data
.
_event
,
data
.
data
);
}
else
{
if
(
data
.
_seed
)
{
var
cb
=
Muted
.
_callbacks
[
data
.
_seed
];
if
(
cb
)
{
// Call the callback
cb
(
data
.
data
);
// Remove the "trigger" callback
delete
Muted
.
_callbacks
[
ev
.
_seed
];
}
}
}
}
ethereal/assets/qml/muted.qml
View file @
922974c7
...
@@ -7,59 +7,68 @@ import QtQuick.Window 2.1;
...
@@ -7,59 +7,68 @@ import QtQuick.Window 2.1;
import
Ethereum
1.0
import
Ethereum
1.0
ApplicationWindow
{
ApplicationWindow
{
id
:
window
id
:
window
title
:
"muted"
title
:
"muted"
width
:
900
width
:
900
height
:
600
height
:
600
minimumHeight
:
300
minimumHeight
:
300
property
alias
url
:
webView
.
url
property
alias
url
:
webView
.
url
property
alias
debugUrl
:
debugView
.
url
property
alias
webView
:
webView
property
alias
webView
:
webView
Item
{
Item
{
id
:
root
id
:
root
anchors.fill
:
parent
anchors.fill
:
parent
WebView
{
WebView
{
objectName
:
"webView"
objectName
:
"webView"
id
:
webView
id
:
webView
anchors
{
anchors
{
top
:
root
.
top
top
:
root
.
top
right
:
root
.
right
right
:
root
.
right
left
:
root
.
left
left
:
root
.
left
bottom
:
sizeGrip
.
top
bottom
:
root
.
bottom
}
//bottom: sizeGrip.top
}
}
Rectangle
{
experimental.preferences.javascriptEnabled
:
true
id
:
sizeGrip
experimental.preferences.navigatorQtObjectEnabled
:
true
color
:
"gray"
experimental.onMessageReceived
:
{
height
:
5
var
data
=
JSON
.
parse
(
message
.
data
)
anchors
{
left
:
root
.
left
right
:
root
.
right
}
y
:
Math
.
round
(
root
.
height
*
2
/
3
)
MouseArea
{
switch
(
data
.
call
)
{
anchors.fill
:
parent
case
"log"
:
drag.target
:
sizeGrip
console
.
log
.
apply
(
this
,
data
.
args
)
drag.minimumY
:
0
break
;
drag.maximumY
:
root
.
height
-
sizeGrip
.
height
}
drag.axis
:
Drag
.
YAxis
}
}
function
postData
(
seed
,
data
)
{
}
webview
.
experimental
.
postMessage
(
JSON
.
stringify
({
data
:
data
,
_seed
:
seed
}))
}
function
postEvent
(
event
,
data
)
{
webview
.
experimental
.
postMessage
(
JSON
.
stringify
({
data
:
data
,
_event
:
event
}))
}
}
WebView
{
/*
id
:
debugView
Rectangle {
objectName
:
"debugView"
id: sizeGrip
anchors
{
color: "gray"
left
:
root
.
left
height: 5
right
:
root
.
right
anchors {
bottom
:
root
.
bottom
left: root.left
top
:
sizeGrip
.
bottom
right: root.right
}
}
}
y: Math.round(root.height * 2 / 3)
}
MouseArea {
anchors.fill: parent
drag.target: sizeGrip
drag.minimumY: 0
drag.maximumY: root.height - sizeGrip.height
drag.axis: Drag.YAxis
}
}
*/
}
}
}
ethereal/assets/qml/webapp.qml
View file @
922974c7
...
@@ -7,134 +7,135 @@ import QtQuick.Window 2.1;
...
@@ -7,134 +7,135 @@ import QtQuick.Window 2.1;
import
Ethereum
1.0
import
Ethereum
1.0
ApplicationWindow
{
ApplicationWindow
{
id
:
window
id
:
window
title
:
"Ethereum"
title
:
"Ethereum"
width
:
900
width
:
900
height
:
600
height
:
600
minimumHeight
:
300
minimumHeight
:
300
property
alias
url
:
webview
.
url
property
alias
url
:
webview
.
url
property
alias
webView
:
webview
property
alias
webView
:
webview
Item
{
Item
{
objectName
:
"root"
objectName
:
"root"
id
:
root
id
:
root
anchors.fill
:
parent
anchors.fill
:
parent
state
:
"inspectorShown"
state
:
"inspectorShown"
WebView
{
WebView
{
objectName
:
"webView"
objectName
:
"webView"
id
:
webview
id
:
webview
anchors.fill
:
parent
anchors.fill
:
parent
/*
/*
anchors {
anchors {
left: parent.left
left: parent.left
right: parent.right
right: parent.right
bottom: sizeGrip.top
bottom: sizeGrip.top
top: parent.top
top: parent.top
}
}
*/
*/
onTitleChanged
:
{
window
.
title
=
title
}
onTitleChanged
:
{
window
.
title
=
title
}
experimental.preferences.javascriptEnabled
:
true
experimental.preferences.javascriptEnabled
:
true
experimental.preferences.navigatorQtObjectEnabled
:
true
experimental.preferences.navigatorQtObjectEnabled
:
true
experimental.preferences.developerExtrasEnabled
:
true
experimental.preferences.developerExtrasEnabled
:
true
experimental.userScripts
:
[
ui
.
assetPath
(
"ethereum.js"
)]
experimental.userScripts
:
[
ui
.
assetPath
(
"ethereum.js"
)]
experimental.onMessageReceived
:
{
experimental.onMessageReceived
:
{
//console.log("[onMessageReceived]: ", message.data)
//console.log("[onMessageReceived]: ", message.data)
var
data
=
JSON
.
parse
(
message
.
data
)
var
data
=
JSON
.
parse
(
message
.
data
)
switch
(
data
.
call
)
{
switch
(
data
.
call
)
{
case
"getBlockByNumber"
:
case
"getBlockByNumber"
:
var
block
=
eth
.
getBlock
(
"b9b56cf6f907fbee21db0cd7cbc0e6fea2fe29503a3943e275c5e467d649cb06"
)
var
block
=
eth
.
getBlock
(
"b9b56cf6f907fbee21db0cd7cbc0e6fea2fe29503a3943e275c5e467d649cb06"
)
postData
(
data
.
_seed
,
block
)
postData
(
data
.
_seed
,
block
)
break
break
case
"getBlockByHash"
:
case
"getBlockByHash"
:
var
block
=
eth
.
getBlock
(
"b9b56cf6f907fbee21db0cd7cbc0e6fea2fe29503a3943e275c5e467d649cb06"
)
var
block
=
eth
.
getBlock
(
"b9b56cf6f907fbee21db0cd7cbc0e6fea2fe29503a3943e275c5e467d649cb06"
)
postData
(
data
.
_seed
,
block
)
postData
(
data
.
_seed
,
block
)
break
break
case
"createTx"
:
case
"createTx"
:
if
(
data
.
args
.
length
<
5
)
{
if
(
data
.
args
.
length
<
5
)
{
postData
(
data
.
_seed
,
null
)
postData
(
data
.
_seed
,
null
)
}
else
{
}
else
{
var
tx
=
eth
.
createTx
(
data
.
args
[
0
],
data
.
args
[
1
],
data
.
args
[
2
],
data
.
args
[
3
],
data
.
args
[
4
])
var
tx
=
eth
.
createTx
(
data
.
args
[
0
],
data
.
args
[
1
],
data
.
args
[
2
],
data
.
args
[
3
],
data
.
args
[
4
])
postData
(
data
.
_seed
,
tx
)
postData
(
data
.
_seed
,
tx
)
}
break
case
"getStorage"
:
if
(
data
.
args
.
length
<
2
)
{
postData
(
data
.
_seed
,
null
)
}
else
{
var
stateObject
=
eth
.
getStateObject
(
data
.
args
[
0
])
var
storage
=
stateObject
.
getStorage
(
data
.
args
[
1
])
postData
(
data
.
_seed
,
storage
)
}
break
case
"getKey"
:
var
keys
=
eth
.
getKey
()
postData
(
data
.
_seed
,
keys
)
break
case
"watch"
:
if
(
data
.
args
.
length
>
0
)
{
eth
.
watch
(
data
.
args
[
0
]);
}
}
}
}
function
postData
(
seed
,
data
)
{
break
webview
.
experimental
.
postMessage
(
JSON
.
stringify
({
data
:
data
,
_seed
:
seed
}))
case
"getStorage"
:
}
if
(
data
.
args
.
length
<
2
)
{
function
postEvent
(
event
,
data
)
{
postData
(
data
.
_seed
,
null
)
webview
.
experimental
.
postMessage
(
JSON
.
stringify
({
data
:
data
,
_event
:
event
}))
}
else
{
}
var
stateObject
=
eth
.
getStateObject
(
data
.
args
[
0
])
var
storage
=
stateObject
.
getStorage
(
data
.
args
[
1
])
function
onNewBlockCb
(
block
)
{
postData
(
data
.
_seed
,
storage
)
postEvent
(
"block:new"
,
block
)
}
function
onObjectChangeCb
(
stateObject
)
{
postEvent
(
"object:change"
,
stateObject
)
}
}
Rectangle
{
id
:
sizeGrip
color
:
"gray"
visible
:
false
height
:
10
anchors
{
left
:
root
.
left
right
:
root
.
right
}
}
y
:
Math
.
round
(
root
.
height
*
2
/
3
)
break
case
"getKey"
:
MouseArea
{
var
keys
=
eth
.
getKey
()
anchors.fill
:
parent
postData
(
data
.
_seed
,
keys
)
drag.target
:
sizeGrip
break
drag.minimumY
:
0
case
"watch"
:
drag.maximumY
:
root
.
height
if
(
data
.
args
.
length
>
0
)
{
drag.axis
:
Drag
.
YAxis
eth
.
watch
(
data
.
args
[
0
]);
}
}
break
}
}
}
function
postData
(
seed
,
data
)
{
webview
.
experimental
.
postMessage
(
JSON
.
stringify
({
data
:
data
,
_seed
:
seed
}))
}
function
postEvent
(
event
,
data
)
{
webview
.
experimental
.
postMessage
(
JSON
.
stringify
({
data
:
data
,
_event
:
event
}))
}
WebView
{
function
onNewBlockCb
(
block
)
{
id
:
inspector
postEvent
(
"block:new"
,
block
)
visible
:
false
}
url
:
webview
.
experimental
.
remoteInspectorUrl
function
onObjectChangeCb
(
stateObject
)
{
anchors
{
postEvent
(
"object:change"
,
stateObject
)
left
:
root
.
left
}
right
:
root
.
right
}
top
:
sizeGrip
.
bottom
bottom
:
root
.
bottom
}
}
states
:
[
Rectangle
{
State
{
id
:
sizeGrip
name
:
"inspectorShown"
color
:
"gray"
PropertyChanges
{
visible
:
false
target
:
inspector
height
:
10
url
:
webview
.
experimental
.
remoteInspectorUrl
anchors
{
}
left
:
root
.
left
}
right
:
root
.
right
]
}
y
:
Math
.
round
(
root
.
height
*
2
/
3
)
MouseArea
{
anchors.fill
:
parent
drag.target
:
sizeGrip
drag.minimumY
:
0
drag.maximumY
:
root
.
height
drag.axis
:
Drag
.
YAxis
}
}
}
WebView
{
id
:
inspector
visible
:
false
url
:
webview
.
experimental
.
remoteInspectorUrl
anchors
{
left
:
root
.
left
right
:
root
.
right
top
:
sizeGrip
.
bottom
bottom
:
root
.
bottom
}
}
states
:
[
State
{
name
:
"inspectorShown"
PropertyChanges
{
target
:
inspector
url
:
webview
.
experimental
.
remoteInspectorUrl
}
}
]
}
}
}
ethereal/ui/ui_lib.go
View file @
922974c7
...
@@ -120,8 +120,8 @@ func (ui *UiLib) Muted(content string) {
...
@@ -120,8 +120,8 @@ func (ui *UiLib) Muted(content string) {
go
func
()
{
go
func
()
{
path
:=
"file://"
+
ui
.
AssetPath
(
"muted/index.html"
)
path
:=
"file://"
+
ui
.
AssetPath
(
"muted/index.html"
)
win
.
Set
(
"url"
,
path
)
win
.
Set
(
"url"
,
path
)
debuggerPath
:=
"file://"
+
ui
.
AssetPath
(
"muted/debugger.html"
)
//
debuggerPath := "file://" + ui.AssetPath("muted/debugger.html")
win
.
Set
(
"debugUrl"
,
debuggerPath
)
//
win.Set("debugUrl", debuggerPath)
win
.
Show
()
win
.
Show
()
win
.
Wait
()
win
.
Wait
()
...
...
ethereum/dev_console.go
View file @
922974c7
...
@@ -12,6 +12,7 @@ import (
...
@@ -12,6 +12,7 @@ import (
"github.com/ethereum/eth-go/ethutil"
"github.com/ethereum/eth-go/ethutil"
"github.com/ethereum/eth-go/ethwire"
"github.com/ethereum/eth-go/ethwire"
"github.com/ethereum/go-ethereum/utils"
"github.com/ethereum/go-ethereum/utils"
"github.com/obscuren/mutan"
"os"
"os"
"strings"
"strings"
)
)
...
@@ -190,7 +191,7 @@ func (i *Console) ParseInput(input string) bool {
...
@@ -190,7 +191,7 @@ func (i *Console) ParseInput(input string) bool {
case
"contract"
:
case
"contract"
:
fmt
.
Println
(
"Contract editor (Ctrl-D = done)"
)
fmt
.
Println
(
"Contract editor (Ctrl-D = done)"
)
mainInput
,
initInput
:=
ethutil
.
PreProcess
(
i
.
Editor
())
mainInput
,
initInput
:=
mutan
.
PreProcess
(
i
.
Editor
())
mainScript
,
err
:=
utils
.
Compile
(
mainInput
)
mainScript
,
err
:=
utils
.
Compile
(
mainInput
)
if
err
!=
nil
{
if
err
!=
nil
{
fmt
.
Println
(
err
)
fmt
.
Println
(
err
)
...
...
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