mirror of
https://github.com/lxsang/antos-frontend.git
synced 2025-07-29 04:09:45 +02:00
add darkmode themes, clean up
This commit is contained in:
@ -8,7 +8,7 @@
|
||||
</afx-vbox>
|
||||
<afx-resizer data-width = "3" ></afx-resizer>
|
||||
<afx-vbox>
|
||||
<afx-tab-bar closable="true" data-height="27" data-id = "tabbar"></afx-tab-bar>
|
||||
<afx-tab-bar closable="true" data-height="26" data-id = "tabbar"></afx-tab-bar>
|
||||
<div data-id="datarea"></div>
|
||||
</afx-vbox>
|
||||
</afx-hbox>
|
||||
|
@ -50,36 +50,37 @@ class CodePad.BaseExtension
|
||||
|
||||
mkar: (src, dest) ->
|
||||
@notify __("Preparing for release")
|
||||
new Promise (r, e) =>
|
||||
@import("os://scripts/jszip.min.js").then () ->
|
||||
src.asFileHandle()
|
||||
.read().then (d) ->
|
||||
return e d.error if d.error
|
||||
r d.result
|
||||
.catch (ex) -> e ex
|
||||
.catch (ex) -> e ex
|
||||
.then (files) =>
|
||||
new Promise (resolve, reject) =>
|
||||
new Promise (r, e) =>
|
||||
zip = new JSZip()
|
||||
fn = (list) =>
|
||||
return r zip if list.length is 0
|
||||
f = (list.splice 0, 1)[0].path.asFileHandle()
|
||||
return fn list if f.type is "dir"
|
||||
f.read("binary").then (d) =>
|
||||
zip.file f.basename, d, { binary: true }
|
||||
@notify __("add {0} to zip", f.basename)
|
||||
fn list
|
||||
@import("os://scripts/jszip.min.js").then () ->
|
||||
src.asFileHandle()
|
||||
.read().then (d) ->
|
||||
return e d.error if d.error
|
||||
r d.result
|
||||
.catch (ex) -> e ex
|
||||
fn files
|
||||
.then (zip) =>
|
||||
zip.generateAsync({ type: "base64" }).then (data) =>
|
||||
dest.asFileHandle()
|
||||
.setCache('data:application/zip;base64,' + data)
|
||||
.write("base64").then (r) =>
|
||||
return @error __("Cannot save the zip file: {0}", r.error) if r.error
|
||||
@notify __("Package is generated in release folder")
|
||||
.catch (e) => @error e.toString()
|
||||
.catch (e) => @error e.toString()
|
||||
.catch (ex) -> e ex
|
||||
.then (files) =>
|
||||
new Promise (r, e) =>
|
||||
zip = new JSZip()
|
||||
fn = (list) =>
|
||||
return r zip if list.length is 0
|
||||
f = (list.splice 0, 1)[0].path.asFileHandle()
|
||||
return fn list if f.type is "dir"
|
||||
f.read("binary").then (d) =>
|
||||
zip.file f.basename, d, { binary: true }
|
||||
@notify __("add {0} to zip", f.basename)
|
||||
fn list
|
||||
.catch (ex) -> e ex
|
||||
fn files
|
||||
.then (zip) =>
|
||||
zip.generateAsync({ type: "base64" }).then (data) =>
|
||||
dest.asFileHandle()
|
||||
.setCache('data:application/zip;base64,' + data)
|
||||
.write("base64").then (r) =>
|
||||
return reject r.error if r.error
|
||||
@notify __("Package is generated in release folder")
|
||||
.catch (e) -> reject e
|
||||
.catch (e) -> reject e
|
||||
|
||||
mkdirAll: (list) ->
|
||||
new Promise (resolve, reject) =>
|
||||
|
@ -27,20 +27,20 @@ class App.extensions.AntOSDK extends App.BaseExtension
|
||||
buildnrun: () ->
|
||||
@metadata("project.json").then (meta) =>
|
||||
@build(meta).then () =>
|
||||
@run(meta).catch (e) => @error.toString()
|
||||
@run(meta).catch (e) => @error __("Unable to run project"), e
|
||||
.catch (e) =>
|
||||
@error e.toString()
|
||||
.catch (e) => @error e.toString()
|
||||
@error __("Unable to build project"), e
|
||||
.catch (e) => @error __("Unable to read meta-data"), e
|
||||
|
||||
release: () ->
|
||||
@metadata("project.json").then (meta) =>
|
||||
@build(meta).then () =>
|
||||
@mkar("#{meta.root}/build/debug", "#{meta.root}/build/release/#{meta.name}.zip")
|
||||
.then () ->
|
||||
.catch (e) => @error.toString()
|
||||
.catch (e) => @error __("Unable to create package archive"), e
|
||||
.catch (e) =>
|
||||
@error e.toString()
|
||||
.catch (e) => @error e.toString()
|
||||
@error __("Unable to build project"), e
|
||||
.catch (e) => @error __("Unable to read meta-data"), e
|
||||
|
||||
|
||||
# private functions
|
||||
@ -70,8 +70,8 @@ class App.extensions.AntOSDK extends App.BaseExtension
|
||||
@app.currdir = rpath.asFileHandle()
|
||||
@app.initSideBar()
|
||||
@app.openFile "#{rpath}/README.md".asFileHandle()
|
||||
.catch (e) => @error e.stack
|
||||
.catch (e) => @error e.stack
|
||||
.catch (e) => @error __("Unable to create template files"), e
|
||||
.catch (e) => @error __("Unable to create project directory"), e
|
||||
|
||||
verify: (list) ->
|
||||
new Promise (resolve, reject) =>
|
||||
@ -112,7 +112,7 @@ class App.extensions.AntOSDK extends App.BaseExtension
|
||||
.setCache jsrc
|
||||
.write("text/plain")
|
||||
.then (d) ->
|
||||
return e d if d.error
|
||||
return e d.error if d.error
|
||||
r()
|
||||
.catch (ex) -> e ex
|
||||
.then () =>
|
||||
@ -125,7 +125,7 @@ class App.extensions.AntOSDK extends App.BaseExtension
|
||||
.setCache txt
|
||||
.write("text/plain")
|
||||
.then (d) ->
|
||||
return e d if d.error
|
||||
return e d.error if d.error
|
||||
r()
|
||||
.catch (ex) -> e ex
|
||||
.then () =>
|
||||
|
@ -18,10 +18,10 @@ class App.extensions.ExtensionMaker extends App.BaseExtension
|
||||
buildnrun: () ->
|
||||
@metadata("extension.json").then (meta) =>
|
||||
@build(meta).then () =>
|
||||
@run(meta).catch (e) => @error.toString()
|
||||
@run(meta).catch (e) => @error __("Unable to run extension"), e
|
||||
.catch (e) =>
|
||||
@error e.toString()
|
||||
.catch (e) => @error e.toString()
|
||||
@error __("Unable to build extension"), e
|
||||
.catch (e) => @error __("Unable to read meta-data"), e
|
||||
|
||||
release: () ->
|
||||
@metadata("extension.json").then (meta) =>
|
||||
@ -29,10 +29,10 @@ class App.extensions.ExtensionMaker extends App.BaseExtension
|
||||
@mkar("#{meta.root}/build/debug",
|
||||
"#{meta.root}/build/release/#{meta.meta.name}.zip")
|
||||
.then () ->
|
||||
.catch (e) => @error.toString()
|
||||
.catch (e) => @error __("Unable to create archive"), e
|
||||
.catch (e) =>
|
||||
@error e.toString()
|
||||
.catch (e) => @error e.toString()
|
||||
@error __("Unable to build extension"), e
|
||||
.catch (e) => @error __("Unable to read meta-data"), e
|
||||
|
||||
install: () ->
|
||||
@app.openDialog("FileDialog", {
|
||||
@ -43,7 +43,7 @@ class App.extensions.ExtensionMaker extends App.BaseExtension
|
||||
.then () =>
|
||||
@notify __("Extension installed")
|
||||
@app.loadExtensionMetaData()
|
||||
.catch (e) => @error e.stack
|
||||
.catch (e) => @error __("Unable to install extension"), e
|
||||
# private functions
|
||||
mktpl: (path, name) ->
|
||||
rpath = "#{path}/#{name}"
|
||||
@ -64,8 +64,8 @@ class App.extensions.ExtensionMaker extends App.BaseExtension
|
||||
@app.currdir = rpath.asFileHandle()
|
||||
@app.initSideBar()
|
||||
@app.openFile "#{rpath}/#{name}.coffee".asFileHandle()
|
||||
.catch (e) => @error e.stack
|
||||
.catch (e) => @error e.stack
|
||||
.catch (e) => @error __("Unable to create extension template"), e
|
||||
.catch (e) => @error __("Unable to create extension directories"), e
|
||||
|
||||
|
||||
verify: (list) ->
|
||||
@ -107,7 +107,7 @@ class App.extensions.ExtensionMaker extends App.BaseExtension
|
||||
.setCache jsrc
|
||||
.write("text/plain")
|
||||
.then (d) ->
|
||||
return e d if d.error
|
||||
return e d.error if d.error
|
||||
r()
|
||||
.catch (ex) -> e ex
|
||||
.then () ->
|
||||
@ -127,22 +127,24 @@ class App.extensions.ExtensionMaker extends App.BaseExtension
|
||||
.catch (e) -> reject e
|
||||
|
||||
run: (meta) ->
|
||||
path = "#{meta.root}/build/debug/#{meta.meta.name}.js"
|
||||
delete @app._api.shared[path] if @app._api.shared[path]
|
||||
@app._api.requires path
|
||||
.then () =>
|
||||
if @app.extensions[meta.meta.name]
|
||||
@app.extensions[meta.meta.name].child = []
|
||||
@app.extensions[meta.meta.name].addAction v for v in meta.meta.actions
|
||||
else
|
||||
@app.extensions[meta.meta.name] = new App.CMDMenu meta.meta.text
|
||||
@app.extensions[meta.meta.name].name = meta.meta.name
|
||||
@app.extensions[meta.meta.name].addAction v for v in meta.meta.actions
|
||||
@app.spotlight.addAction @app.extensions[meta.meta.name]
|
||||
@app.extensions[meta.meta.name].onchildselect (e) =>
|
||||
@app.loadAndRunExtensionAction e.data.item.get "data"
|
||||
@app.spotlight.run @app
|
||||
.catch (e) => @error e.toString()
|
||||
new Promise (resolve, reject) =>
|
||||
path = "#{meta.root}/build/debug/#{meta.meta.name}.js"
|
||||
delete @app._api.shared[path] if @app._api.shared[path]
|
||||
@app._api.requires path
|
||||
.then () =>
|
||||
if @app.extensions[meta.meta.name]
|
||||
@app.extensions[meta.meta.name].child = []
|
||||
@app.extensions[meta.meta.name].addAction v for v in meta.meta.actions
|
||||
else
|
||||
@app.extensions[meta.meta.name] = new App.CMDMenu meta.meta.text
|
||||
@app.extensions[meta.meta.name].name = meta.meta.name
|
||||
@app.extensions[meta.meta.name].addAction v for v in meta.meta.actions
|
||||
@app.spotlight.addAction @app.extensions[meta.meta.name]
|
||||
@app.extensions[meta.meta.name].onchildselect (e) =>
|
||||
@app.loadAndRunExtensionAction e.data.item.get "data"
|
||||
@app.spotlight.run @app
|
||||
resolve()
|
||||
.catch (e) -> reject e
|
||||
|
||||
|
||||
installExtension: (files, zip) ->
|
||||
|
@ -2,23 +2,14 @@
|
||||
This is an example project, generated by AntOS Development Kit
|
||||
|
||||
## Howto
|
||||
Use the CodePad command palette to access to the SDK functionalities:
|
||||
|
||||
1. Open the project.apj file with AntOSDK (simply double Click on it)
|
||||
2. Modify the UI in *assets/scheme.html*
|
||||
3. Modify application code in *coffees/main.coffee*
|
||||
4. Modify CSS style in *css/main.css*
|
||||
5. Other files need to be copied: put in to assets
|
||||
1. Create new project
|
||||
2. Init the project from the current folder located in side bar
|
||||
3. Build and run the project
|
||||
4. Release the project in zip package
|
||||
|
||||
## Set up build target
|
||||
|
||||
Click **Menu> Build > Build Option** or simply hit **ALT-Y**
|
||||
|
||||
In the build options dialog, add or remove files that need to be
|
||||
included into the build
|
||||
|
||||
Click **Save**
|
||||
|
||||
## Build application
|
||||
* To build: **Menu > Build > Build** or **ALT-C**
|
||||
* To build and run: **Menu > Build > Build and Run** or **CTRL-R**
|
||||
* To release: **Menu > Build > Build release** or **ALT-P**
|
||||
Open the `project.json` file from the current project tree and add/remove
|
||||
build target entries. Save the file
|
@ -1,3 +1,3 @@
|
||||
<afx-app-window apptitle="{0}" width="600" height="500" data-id="{0}">
|
||||
<afx-app-window apptitle="{0}" width="500" height="400" data-id="{0}">
|
||||
<afx-hbox ></afx-hbox>
|
||||
</afx-app-window>
|
@ -126,7 +126,7 @@ class CodePad extends this.OS.GUI.BaseApplication
|
||||
file.cache = d or ""
|
||||
@newTab file
|
||||
.catch (e) =>
|
||||
@error __("Unable to open: {0}", file.path)
|
||||
@error __("Unable to open: {0}", file.path), e
|
||||
|
||||
findTabByFile: (file) ->
|
||||
lst = @tabbar.get "items"
|
||||
@ -242,7 +242,7 @@ class CodePad extends this.OS.GUI.BaseApplication
|
||||
@extensions[ext.name].onchildselect (e) =>
|
||||
@loadAndRunExtensionAction e.data.item.get "data"
|
||||
.catch (e) =>
|
||||
@error __("Cannot load extension meta data")
|
||||
@error __("Cannot load extension meta data"), e
|
||||
|
||||
runExtensionAction: (name, action) ->
|
||||
return @error __("Unable to find extension: {0}", name) unless CodePad.extensions[name]
|
||||
@ -252,7 +252,7 @@ class CodePad extends this.OS.GUI.BaseApplication
|
||||
.then () ->
|
||||
ext[action]()
|
||||
.catch (e) =>
|
||||
@error e.stack
|
||||
@error __("Unable to preload extension"), e
|
||||
|
||||
loadAndRunExtensionAction: (data) ->
|
||||
name = data.parent.name
|
||||
@ -264,7 +264,7 @@ class CodePad extends this.OS.GUI.BaseApplication
|
||||
@_api.requires path
|
||||
.then () => @runExtensionAction name, action
|
||||
.catch (e) =>
|
||||
@error __("unable to load extension: {}", name)
|
||||
@error __("unable to load extension: {0}", name), e
|
||||
else
|
||||
@runExtensionAction name, action
|
||||
|
||||
@ -306,7 +306,7 @@ class CodePad extends this.OS.GUI.BaseApplication
|
||||
return @error __("Fail to create {0}: {1}", d, r.error) if r.error
|
||||
@fileview.update dir.path
|
||||
.catch (e) =>
|
||||
@error __("Fail to create: {0}", e.stack)
|
||||
@error __("Fail to create: {0}", e.stack), e
|
||||
|
||||
when "newdir"
|
||||
return unless dir
|
||||
@ -320,7 +320,7 @@ class CodePad extends this.OS.GUI.BaseApplication
|
||||
return @error __("Fail to create {0}: {1}", d, r.error) if r.error
|
||||
@fileview.update dir.path
|
||||
.catch (e) =>
|
||||
@error __("Fail to create: {0}", e.stack)
|
||||
@error __("Fail to create: {0}", dir.path), e
|
||||
|
||||
when "rename"
|
||||
return unless file
|
||||
@ -338,8 +338,7 @@ class CodePad extends this.OS.GUI.BaseApplication
|
||||
return @error __("Fail to rename to {0}: {1}", d, r.error) if r.error
|
||||
@fileview.update dir.path
|
||||
.catch (e) =>
|
||||
console.log e
|
||||
@error __("Fail to rename: {0}", e.stack)
|
||||
@error __("Fail to rename: {0}", file.path), e
|
||||
|
||||
when "delete"
|
||||
return unless file
|
||||
@ -357,7 +356,7 @@ class CodePad extends this.OS.GUI.BaseApplication
|
||||
return @error __("Fail to delete {0}: {1}", file.filename, r.error) if r.error
|
||||
@fileview.update dir.path
|
||||
.catch (e) =>
|
||||
@error __("Fail to delete: {0}", e.stack)
|
||||
@error __("Fail to delete: {0}", file.path), e
|
||||
|
||||
else
|
||||
|
||||
@ -370,7 +369,7 @@ class CodePad extends this.OS.GUI.BaseApplication
|
||||
file.text = file.basename
|
||||
@tabbar.update()
|
||||
@scheme.set "apptitle", "#{@currfile.basename}"
|
||||
.catch (e) => @error e.stack
|
||||
.catch (e) => @error __("Unable to save file: {0}", file.path), e
|
||||
|
||||
|
||||
saveAs: () ->
|
||||
@ -383,8 +382,6 @@ class CodePad extends this.OS.GUI.BaseApplication
|
||||
d = d.parent() if f.file.type is "file"
|
||||
@currfile.setPath "#{d.path}/#{f.name}"
|
||||
@save @currfile
|
||||
.catch (e) =>
|
||||
@error e.stack
|
||||
|
||||
menuAction: (dataid, r) ->
|
||||
me = @
|
||||
|
@ -1,6 +1,6 @@
|
||||
afx-app-window[data-id = "codepad"] afx-tab-bar> afx-list-view > div.list-container
|
||||
{
|
||||
border-top: 1px solid #272822;
|
||||
/*border-top: 1px solid #272822;*/
|
||||
overflow: hidden;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
Reference in New Issue
Block a user