mirror of
https://github.com/lxsang/antos-frontend.git
synced 2025-07-29 04:09:45 +02:00
core services renamed to syslog
This commit is contained in:
@ -14,8 +14,8 @@ class CodePad.BaseExtension
|
||||
notify: (m) ->
|
||||
@app.notify m
|
||||
|
||||
error: (m) ->
|
||||
@app.error m
|
||||
error: (m, e) ->
|
||||
@app.error m, e
|
||||
|
||||
dependencies: () ->
|
||||
[]
|
||||
@ -87,6 +87,7 @@ class CodePad.BaseExtension
|
||||
path = (list.splice 0, 1)[0].asFileHandle()
|
||||
path.parent().mk path.basename
|
||||
.then (d) =>
|
||||
@app.trigger "filechange", { file: path.parent(), type: "dir" }
|
||||
@mkdirAll list
|
||||
.then () -> resolve()
|
||||
.catch (e) -> reject e
|
||||
@ -101,9 +102,11 @@ class CodePad.BaseExtension
|
||||
.read()
|
||||
.then (data) =>
|
||||
file = item[1].asFileHandle()
|
||||
file
|
||||
.setCache(data.format name, "#{path}/#{name}")
|
||||
.write "text/plain"
|
||||
.then () =>
|
||||
@app.trigger "filechange", { file: file, type: "file" }
|
||||
@mkfileAll list, path, name
|
||||
.then () -> resolve()
|
||||
.catch (e) -> reject e
|
||||
|
@ -47,9 +47,6 @@ class App.extensions.AntOSDK extends App.BaseExtension
|
||||
mktpl: (path, name, flag) ->
|
||||
rpath = "#{path}/#{name}"
|
||||
dirs = [
|
||||
"#{rpath}/build",
|
||||
"#{rpath}/build/release",
|
||||
"#{rpath}/build/debug",
|
||||
"#{rpath}/javascripts",
|
||||
"#{rpath}/css",
|
||||
"#{rpath}/coffees",
|
||||
@ -102,33 +99,40 @@ class App.extensions.AntOSDK extends App.BaseExtension
|
||||
.catch (e) -> reject e
|
||||
|
||||
build: (meta) ->
|
||||
dirs = [
|
||||
"#{meta.root}/build",
|
||||
"#{meta.root}/build/debug",
|
||||
"#{meta.root}/build/release"
|
||||
]
|
||||
new Promise (resolve, reject) =>
|
||||
@compile(meta).then (src) =>
|
||||
@cat ("#{meta.root}/#{v}" for v in meta.javascripts), src
|
||||
.then (jsrc) ->
|
||||
new Promise (r, e) ->
|
||||
"#{meta.root}/build/debug/main.js"
|
||||
.asFileHandle()
|
||||
.setCache jsrc
|
||||
.write("text/plain")
|
||||
.then (d) ->
|
||||
r()
|
||||
.catch (ex) -> e ex
|
||||
.then () =>
|
||||
new Promise (r, e) =>
|
||||
@cat ("#{meta.root}/#{v}" for v in meta.css), ""
|
||||
.then (txt) ->
|
||||
return r() if txt is ""
|
||||
"#{meta.root}/build/debug/main.css"
|
||||
.asFileHandle()
|
||||
.setCache txt
|
||||
.write("text/plain")
|
||||
.then (d) ->
|
||||
r()
|
||||
.catch (ex) -> e ex
|
||||
.then () =>
|
||||
@copy ("#{meta.root}/#{v}" for v in meta.copies), "#{meta.root}/build/debug"
|
||||
.then () -> resolve()
|
||||
@mkdirAll(dirs).then =>
|
||||
@compile(meta).then (src) =>
|
||||
@cat ("#{meta.root}/#{v}" for v in meta.javascripts), src
|
||||
.then (jsrc) ->
|
||||
new Promise (r, e) ->
|
||||
"#{meta.root}/build/debug/main.js"
|
||||
.asFileHandle()
|
||||
.setCache jsrc
|
||||
.write("text/plain")
|
||||
.then (d) ->
|
||||
r()
|
||||
.catch (ex) -> e ex
|
||||
.then () =>
|
||||
new Promise (r, e) =>
|
||||
@cat ("#{meta.root}/#{v}" for v in meta.css), ""
|
||||
.then (txt) ->
|
||||
return r() if txt is ""
|
||||
"#{meta.root}/build/debug/main.css"
|
||||
.asFileHandle()
|
||||
.setCache txt
|
||||
.write("text/plain")
|
||||
.then (d) ->
|
||||
r()
|
||||
.catch (ex) -> e ex
|
||||
.then () =>
|
||||
@copy ("#{meta.root}/#{v}" for v in meta.copies), "#{meta.root}/build/debug"
|
||||
.then () -> resolve()
|
||||
.catch (e) -> reject e
|
||||
.catch (e) -> reject e
|
||||
.catch (e) -> reject e
|
||||
|
||||
|
@ -27,6 +27,7 @@ class CodePad extends this.OS.GUI.BaseApplication
|
||||
dir.read().then (d) ->
|
||||
return reject d.error if d.error
|
||||
resolve d.result
|
||||
.catch (e) -> reject e
|
||||
@setup()
|
||||
|
||||
setup: () ->
|
||||
@ -38,6 +39,8 @@ class CodePad extends this.OS.GUI.BaseApplication
|
||||
enableSnippets: true,
|
||||
enableLiveAutocompletion: true,
|
||||
highlightActiveLine: true,
|
||||
highlightSelectedWord: true,
|
||||
behavioursEnabled: true,
|
||||
wrap: true,
|
||||
fontSize: "11pt"
|
||||
}
|
||||
@ -72,11 +75,13 @@ class CodePad extends this.OS.GUI.BaseApplication
|
||||
@editor.focus()
|
||||
return false
|
||||
@fileview.set "onfileopen", (e) =>
|
||||
return unless e.data and e.data.path
|
||||
return if e.data.type is "dir"
|
||||
@openFile e.data.path.asFileHandle()
|
||||
|
||||
@fileview.set "onfileselect", (e) =>
|
||||
return unless e.data or e.data.type is "dir"
|
||||
return unless e.data and e.data.path
|
||||
return if e.data.type is "dir"
|
||||
i = @findTabByFile e.data.path.asFileHandle()
|
||||
return @tabbar.set "selected", i if i isnt -1
|
||||
|
||||
@ -118,6 +123,12 @@ class CodePad extends this.OS.GUI.BaseApplication
|
||||
e.data.from.get("parent").update src.parent().path
|
||||
.catch (e) => @error __("Unable to move file/folder"), e
|
||||
|
||||
@on "filechange", (data) =>
|
||||
path = data.file.path
|
||||
path = data.file.parent().path if data.type is "file"
|
||||
@fileview.update path
|
||||
|
||||
|
||||
@loadExtensionMetaData()
|
||||
@initCommandPalete()
|
||||
@initSideBar()
|
||||
@ -178,16 +189,17 @@ class CodePad extends this.OS.GUI.BaseApplication
|
||||
m = @modes.getModeForPath(file.path)
|
||||
file.langmode = { caption: m.caption, mode: m.mode }
|
||||
else
|
||||
file.langmode = { caption: "Text", mode: "ace/mode/text" }
|
||||
file.langmode = { caption: "Text", mode: "ace/mode/text" }
|
||||
@editormux = true
|
||||
@editor.getSession().setUndoManager new ace.UndoManager()
|
||||
@editor.setValue file.cache, -1
|
||||
@editor.session.setMode file.langmode.mode
|
||||
@editor.session.setUndoManager file.um
|
||||
@editor.getSession().setMode file.langmode.mode
|
||||
if file.cursor
|
||||
@editor.renderer.scrollCursorIntoView {
|
||||
row: file.cursor.row, column: file.cursor.column
|
||||
}, 0.5
|
||||
@editor.selection.moveTo file.cursor.row, file.cursor.column
|
||||
@editor.getSession().setUndoManager file.um
|
||||
@updateStatus()
|
||||
@editor.focus()
|
||||
|
||||
@ -423,7 +435,7 @@ class CodePad extends this.OS.GUI.BaseApplication
|
||||
evt.preventDefault()
|
||||
@.openDialog("YesNoDialog", {
|
||||
title: "__(Quit)",
|
||||
text: __("Ignore all {0} unsaved files ?", dirties.length)
|
||||
text: __("Ignore all unsaved files: {0} ?", (v.filename() for v in dirties).join ", " )
|
||||
}).then (d) =>
|
||||
if d
|
||||
v.dirty = false for v in dirties
|
||||
|
Reference in New Issue
Block a user