Reunicon icons from ~/apps/Menu/

This commit is contained in:
cuu
2018-12-12 23:11:52 +08:00
parent aa878e79da
commit ba7451271a
4 changed files with 79 additions and 3 deletions

View File

@@ -54,7 +54,7 @@ type IconItemInterface interface {
GetCmdInvoke() PluginInterface
GetFileName() string
Draw()
}
@@ -72,6 +72,7 @@ type IconItem struct {
Label LabelInterface
Align int
AnimationTime int
FileName string
}
@@ -240,6 +241,9 @@ func (self *IconItem) GetCmdInvoke() PluginInterface {
return self.CmdInvoke
}
func (self *IconItem) GetFileName() string {
return self.FileName
}
func (self *IconItem) Draw() {
if self.Parent == nil {
fmt.Println("Error: IconItem Draw Parent nil")

View File

@@ -6,7 +6,7 @@ import (
"strings"
"log"
//"encoding/json"
//"path/filepath"
"path/filepath"
"github.com/veandco/go-sdl2/sdl"
"github.com/veandco/go-sdl2/ttf"
@@ -264,6 +264,27 @@ func (self *MainScreen) ExtraName(name string) string {
}
}
//ExecPackage is all-in-one folder ,Name.sh,Name.png,etc
func (self *MainScreen) IsExecPackage(dirname string ) bool {
files,err := ioutil.ReadDir(dirname)
if err != nil {
log.Fatal(err)
return false
}
bname := filepath.Base(dirname)
bname = self.ExtraName(bname)
for _,v := range files {
if v.Name() == bname+".sh" {
return true
}
}
return false
}
func (self *MainScreen) IsPluginPackage(dirname string ) bool {
ret := false
files,err := ioutil.ReadDir(dirname)