update some package

This commit is contained in:
Xuan Sang LE 2020-05-21 17:28:02 +02:00
parent 6cda32bd3c
commit 04225e74fb
13 changed files with 43 additions and 101 deletions

View File

@ -349,6 +349,10 @@
{ {
text: "File dialog", text: "File dialog",
id: "file" id: "file"
},
{
text: "Text dialog",
id: "text"
} }
]); ]);
return btrun.set("onbtclick", (e) => { return btrun.set("onbtclick", (e) => {
@ -419,6 +423,13 @@
}).then((f, name) => { }).then((f, name) => {
return this.notify(f, name); return this.notify(f, name);
}); });
case "text":
return this.openDialog("TextDialog", {
title: "Text dialog review",
value: "txt data"
}).then((d) => {
return this.notify(d);
});
} }
}); });
} }

View File

@ -7,7 +7,7 @@
"email": "xsang.le@gmail.com", "email": "xsang.le@gmail.com",
"licences": "GPLv3" "licences": "GPLv3"
}, },
"version":"0.0.1-a", "version":"0.0.2-a",
"category":"Other", "category":"Other",
"mimes":["none"], "mimes":["none"],
"iconclass": "fa fa-delicious", "iconclass": "fa fa-delicious",

Binary file not shown.

View File

@ -153,7 +153,8 @@ class ShowCase extends this.OS.GUI.BaseApplication
{ text: "YesNo dialog", id: "yesno" }, { text: "YesNo dialog", id: "yesno" },
{ text: "Selection dialog", id: "selection" }, { text: "Selection dialog", id: "selection" },
{ text: "About dialog", id: "about" }, { text: "About dialog", id: "about" },
{ text: "File dialog", id: "file" } { text: "File dialog", id: "file" },
{ text: "Text dialog", id: "text" }
] ]
btrun.set "onbtclick", (e) => btrun.set "onbtclick", (e) =>
@ -216,6 +217,14 @@ class ShowCase extends this.OS.GUI.BaseApplication
}) })
.then (f, name) => .then (f, name) =>
@notify f, name @notify f, name
when "text"
@openDialog("TextDialog", {
title: "Text dialog review",
value: "txt data"
})
.then (d) =>
@notify d
else return else return

View File

@ -7,7 +7,7 @@
"email": "xsang.le@gmail.com", "email": "xsang.le@gmail.com",
"licences": "GPLv3" "licences": "GPLv3"
}, },
"version":"0.0.1-a", "version":"0.0.2-a",
"category":"Other", "category":"Other",
"mimes":["none"], "mimes":["none"],
"iconclass": "fa fa-delicious", "iconclass": "fa fa-delicious",

View File

@ -41,7 +41,7 @@
"description": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/ShowCase/README.md", "description": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/ShowCase/README.md",
"category": "Other", "category": "Other",
"author": "Xuan Sang LE", "author": "Xuan Sang LE",
"version": "0.0.1-a", "version": "0.0.2-a",
"download": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/ShowCase/build/release/ShowCase.zip" "download": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/ShowCase/build/release/ShowCase.zip"
}, },
{ {
@ -50,7 +50,7 @@
"description": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/wTerm/README.md", "description": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/wTerm/README.md",
"category": "System", "category": "System",
"author": "Xuan Sang LE", "author": "Xuan Sang LE",
"version": "0.0.1-a", "version": "0.0.2-a",
"download": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/wTerm/build/release/wTerm.zip" "download": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/wTerm/build/release/wTerm.zip"
} }

View File

@ -171,6 +171,3 @@
text-decoration: underline; text-decoration: underline;
} }
afx-app-window[data-id="ClipboardDialog"] textarea {
resize: none
}

View File

@ -1,6 +1,6 @@
(function() { (function() {
void 0; void 0;
var ClipboardDialog, wTerm; var wTerm;
// Copyright 2017-2018 Xuan Sang LE <xsang.le AT gmail DOT com> // Copyright 2017-2018 Xuan Sang LE <xsang.le AT gmail DOT com>
@ -18,50 +18,7 @@
// General Public License for more details. // General Public License for more details.
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
//along with this program. If not, see https://www.gnu.org/licenses/. //along with this program. If not, see https://www.gnu.org/licenses/
ClipboardDialog = class ClipboardDialog extends this.OS.GUI.BasicDialog {
constructor() {
super("ClipboardDialog", ClipboardDialog.scheme);
}
init() {
this.find("btnOk").set("onbtclick", (e) => {
var value;
value = $(this.find("txtInput")).val();
if (!(value && value !== "")) {
return;
}
if (this.handle) {
this.handle(value);
}
return this.quit();
});
return this.find("btnCancel").set("onbtclick", (e) => {
return this.quit();
});
}
};
ClipboardDialog.scheme = `<afx-app-window data-id = "ClipboardDialog" width='400' height='300' apptitle = "__(Clipboard)">
<afx-vbox>
<afx-hbox>
<div data-width = "10" />
<afx-vbox>
<div data-height="10" />
<textarea data-id= "txtInput" />
<div data-height="10" />
<afx-hbox data-height="30">
<div />
<afx-button data-id = "btnOk" text = "__(Ok)" data-width = "40" />
<afx-button data-id = "btnCancel" text = "__(Cancel)" data-width = "50" />
</afx-hbox>
</afx-vbox>
<div data-width = "10" />
</afx-hbox>
</afx-vbox>
</afx-app-window>`;
wTerm = class wTerm extends this.OS.GUI.BaseApplication { wTerm = class wTerm extends this.OS.GUI.BaseApplication {
constructor(args) { constructor(args) {
super("wTerm", args); super("wTerm", args);
@ -122,22 +79,26 @@
var text; var text;
switch (data.id) { switch (data.id) {
case "paste": case "paste":
return this.openDialog(new ClipboardDialog()).then((d) => { return this._api.getClipboard().then((text) => {
var i, len, results, v; var i, len, results, v;
if (!(text && text !== "")) {
return;
}
results = []; results = [];
for (i = 0, len = d.length; i < len; i++) { for (i = 0, len = text.length; i < len; i++) {
v = d[i]; v = text[i];
results.push(this.socket.send(`i${v}`)); results.push(this.socket.send(`i${v}`));
} }
return results; return results;
}).catch((e) => {
return this.error(__("Unable to paste"), e);
}); });
case "copy": case "copy":
text = this.term.getSelection(); text = this.term.getSelection();
if (!(text && text !== "")) { if (!(text && text !== "")) {
return; return;
} }
this._api.setClipboard(text); return this._api.setClipboard(text);
return console.log(this._api.getClipboard());
} }
} }

View File

@ -6,7 +6,7 @@
"author": "Xuan Sang LE", "author": "Xuan Sang LE",
"email": "xsang.le@gmail.com" "email": "xsang.le@gmail.com"
}, },
"version":"0.0.1-a", "version":"0.0.2-a",
"category":"System", "category":"System",
"iconclass":"fa fa-terminal", "iconclass":"fa fa-terminal",
"mimes":["none"], "mimes":["none"],

Binary file not shown.

View File

@ -14,41 +14,7 @@
# General Public License for more details. # General Public License for more details.
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
#along with this program. If not, see https://www.gnu.org/licenses/. #along with this program. If not, see https://www.gnu.org/licenses/
class ClipboardDialog extends this.OS.GUI.BasicDialog
constructor: () ->
super "ClipboardDialog", ClipboardDialog.scheme
init: () ->
@find("btnOk").set "onbtclick", (e) =>
value = $(@find "txtInput").val()
return unless value and value isnt ""
@handle value if @handle
@quit()
@find("btnCancel").set "onbtclick", (e) =>
@quit()
ClipboardDialog.scheme = """
<afx-app-window data-id = "ClipboardDialog" width='400' height='300' apptitle = "__(Clipboard)">
<afx-vbox>
<afx-hbox>
<div data-width = "10" />
<afx-vbox>
<div data-height="10" />
<textarea data-id= "txtInput" />
<div data-height="10" />
<afx-hbox data-height="30">
<div />
<afx-button data-id = "btnOk" text = "__(Ok)" data-width = "40" />
<afx-button data-id = "btnCancel" text = "__(Cancel)" data-width = "50" />
</afx-hbox>
</afx-vbox>
<div data-width = "10" />
</afx-hbox>
</afx-vbox>
</afx-app-window>
"""
class wTerm extends this.OS.GUI.BaseApplication class wTerm extends this.OS.GUI.BaseApplication
constructor: (args) -> constructor: (args) ->
@ -89,13 +55,14 @@ class wTerm extends this.OS.GUI.BaseApplication
mctxHandle: (data) -> mctxHandle: (data) ->
switch data.id switch data.id
when "paste" when "paste"
@openDialog(new ClipboardDialog()).then (d) => @_api.getClipboard().then (text) =>
@socket.send "i#{v}" for v in d return unless text and text isnt ""
@socket.send "i#{v}" for v in text
.catch (e) => @error __("Unable to paste"), e
when "copy" when "copy"
text = @term.getSelection() text = @term.getSelection()
return unless text and text isnt "" return unless text and text isnt ""
@_api.setClipboard text @_api.setClipboard text
console.log @_api.getClipboard()
else else

View File

@ -1,3 +0,0 @@
afx-app-window[data-id="ClipboardDialog"] textarea {
resize: none
}

View File

@ -6,7 +6,7 @@
"author": "Xuan Sang LE", "author": "Xuan Sang LE",
"email": "xsang.le@gmail.com" "email": "xsang.le@gmail.com"
}, },
"version":"0.0.1-a", "version":"0.0.2-a",
"category":"System", "category":"System",
"iconclass":"fa fa-terminal", "iconclass":"fa fa-terminal",
"mimes":["none"], "mimes":["none"],