next is keyboard bugs

This commit is contained in:
cuu 2018-11-27 15:33:42 +08:00
parent 098105f890
commit fc7afbb680
13 changed files with 76 additions and 40 deletions

View File

@ -26,8 +26,12 @@ type NetItemMultiIcon struct {
func NewNetItemMultiIcon() *NetItemMultiIcon{ func NewNetItemMultiIcon() *NetItemMultiIcon{
p := &NetItemMultiIcon{} p := &NetItemMultiIcon{}
p.Width = 18 p.IconIndex = 0
p.Height = 18 p.IconWidth = 18
p.IconHeight = 18
p.Width = 18
p.Height = 18
return p return p
} }
@ -122,9 +126,6 @@ func (self *NetItem) SetActive( act bool) {
func (self *NetItem) UpdateStrenLabel( strenstr string) { // ## strenstr should be 'number',eg:'90' func (self *NetItem) UpdateStrenLabel( strenstr string) { // ## strenstr should be 'number',eg:'90'
self.Daemon.Get( self.Daemon.Method("FormatSignalForPrinting",strenstr), &strenstr)
self.Stren = strenstr self.Stren = strenstr
if _, ok := self.Labels["stren"]; ok { if _, ok := self.Labels["stren"]; ok {
@ -134,6 +135,7 @@ func (self *NetItem) UpdateStrenLabel( strenstr string) { // ## strenstr should
} }
func (self *NetItem) Init(i int,is_active bool) { func (self *NetItem) Init(i int,is_active bool) {
var sig_display_type int var sig_display_type int
strenstr := "quality" strenstr := "quality"
gap := 4 gap := 4
@ -142,9 +144,9 @@ func (self *NetItem) Init(i int,is_active bool) {
self.Wireless = self.Parent.Wireless self.Wireless = self.Parent.Wireless
self.Daemon = self.Parent.Daemon self.Daemon = self.Parent.Daemon
self.Daemon.Get( self.Daemon.Method("GetSignalDisplayType"), &sig_display_type ) self.Daemon.Get( self.Daemon.Method("GetSignalDisplayType"), &sig_display_type )
if sig_display_type == 0 { if sig_display_type == 0 {
strenstr = "quality" strenstr = "quality"
gap = 4 // Allow for 100% gap = 4 // Allow for 100%
@ -152,18 +154,19 @@ func (self *NetItem) Init(i int,is_active bool) {
strenstr = "strength" strenstr = "strength"
gap = 7 // -XX dbm = 7 gap = 7 // -XX dbm = 7
} }
self.NetId = i self.NetId = i
tmp :="" tmp := 0
self.Wireless.Get(self.Wireless.Method("GetWirelessProperty",self.NetId, strenstr),&tmp) self.Wireless.Get(self.Wireless.Method("GetWirelessProperty",self.NetId, strenstr),&tmp)
self.Daemon.Get( self.Daemon.Method("FormatSignalForPrinting",tmp), &tmp) tmp2 := ""
self.Stren = tmp self.Daemon.Get( self.Daemon.Method("FormatSignalForPrinting",tmp), &tmp2)
self.Stren = tmp2
self.Wireless.Get( self.Wireless.Method("GetWirelessProperty",self.NetId,"essid"),&self.Essid) self.Wireless.Get( self.Wireless.Method("GetWirelessProperty",self.NetId,"essid"),&self.Essid)
self.Wireless.Get( self.Wireless.Method("GetWirelessProperty",self.NetId,"bssid"),&self.Bssid) self.Wireless.Get( self.Wireless.Method("GetWirelessProperty",self.NetId,"bssid"),&self.Bssid)
check_enc := false check_enc := false
self.Wireless.Get( self.Wireless.Method("GetWirelessProperty",self.NetId,"encryption"),&check_enc) self.Wireless.Get( self.Wireless.Method("GetWirelessProperty",self.NetId,"encryption"),&check_enc)
@ -186,10 +189,10 @@ func (self *NetItem) Init(i int,is_active bool) {
self.SetActive(is_active) self.SetActive(is_active)
} }
fmt.Println(theString) //fmt.Println(theString)
essid_label := UI.NewLabel() essid_label := UI.NewLabel()
essid_label.PosY = 36 essid_label.PosX = 36
essid_label.CanvasHWND = self.Parent.GetCanvasHWND() essid_label.CanvasHWND = self.Parent.GetCanvasHWND()
essid_ := "" essid_ := ""
@ -199,7 +202,7 @@ func (self *NetItem) Init(i int,is_active bool) {
}else { }else {
essid_ = self.Essid essid_ = self.Essid
} }
fmt.Println(essid_)
essid_label.Init(essid_, self.FontObj,nil) essid_label.Init(essid_, self.FontObj,nil)
self.Labels["essid"] = essid_label self.Labels["essid"] = essid_label

View File

@ -10,7 +10,7 @@ import (
"github.com/cuu/gogame/color" "github.com/cuu/gogame/color"
*/ */
"github.com/cuu/LauncherGo/sysgo/UI" "github.com/cuu/LauncherGo/sysgo/UI"
"github.com/cuu/LauncherGo/sysgo/DBUS" //"github.com/cuu/LauncherGo/sysgo/DBUS"
) )
/******************************************************************************/ /******************************************************************************/
@ -29,8 +29,8 @@ func (self *WifiPlugin) Init( main_screen *UI.MainScreen ) {
self.ScanPage = NewWifiList() self.ScanPage = NewWifiList()
self.ScanPage.Name = "Scan wifi" self.ScanPage.Name = "Scan wifi"
self.ScanPage.Wireless = DBUS.DBusHandler.Wifi self.ScanPage.Wireless = main_screen.DBusManager.Wifi
self.ScanPage.Daemon = DBUS.DBusHandler.Daemon self.ScanPage.Daemon = main_screen.DBusManager.Daemon
self.ScanPage.Screen = main_screen self.ScanPage.Screen = main_screen
@ -40,7 +40,8 @@ func (self *WifiPlugin) Init( main_screen *UI.MainScreen ) {
func (self *WifiPlugin) Run( main_screen *UI.MainScreen ) { func (self *WifiPlugin) Run( main_screen *UI.MainScreen ) {
if main_screen != nil { if main_screen != nil {
main_screen.PushPage(self.ScanPage) main_screen.PushCurPage()
main_screen.SetCurPage(self.ScanPage)
main_screen.Draw() main_screen.Draw()
main_screen.SwapAndShow() main_screen.SwapAndShow()
} }

View File

@ -454,7 +454,7 @@ func (self *WifiList) GenNetworkList() {
for network_id:=0;network_id< num_of_networks;network_id++ { for network_id:=0;network_id< num_of_networks;network_id++ {
is_active = false is_active = false
self.Wireless.Get(self.Wireless.Method("GetCurrentSignalStrength",""), &cur_signal_strength) self.Wireless.Get(self.Wireless.Method("GetCurrentSignalStrength",""), &cur_signal_strength)
self.Wireless.Get(self.Wireless.Method("GetIwconfig"),&iwconfig) self.Wireless.Get(self.Wireless.Method("GetIwconfig"),&iwconfig)
self.Wireless.Get(self.Wireless.Method("GetCurrentNetworkID",iwconfig),&cur_network_id) self.Wireless.Get(self.Wireless.Method("GetCurrentNetworkID",iwconfig),&cur_network_id)
@ -520,9 +520,11 @@ func (self *WifiList) UpdateNetList(state int,info []string ,force_check bool,fi
var mystatus status var mystatus status
if state == -1 { if state == -1 {
self.Daemon.Get(self.Daemon.Method("GetConnectionStatus"),&mystatus) self.Daemon.Get(self.Daemon.Method("GetConnectionStatus"),&mystatus)
fmt.Println("state ",mystatus.State) fmt.Println("state ",mystatus.State)
fmt.Println("Trash ",mystatus.Trash) fmt.Println("Trash ",mystatus.Trash)
} }
if force_check == true || self.PrevWicdState != state { if force_check == true || self.PrevWicdState != state {
@ -730,8 +732,9 @@ func (self *WifiList) GetWirelessEncrypt(network_id int) []map[string]string {
for i,v := range self.EncMethods { for i,v := range self.EncMethods {
enc_type = "" enc_type = ""
self.Wireless.Get(self.Wireless.Method("GetWirelessProperty",network_id,"enctype"),&enc_type) self.Wireless.Get(self.Wireless.Method("GetWirelessProperty",network_id,"encryption_method"),&enc_type)
if v.Type == enc_type { enc_type = strings.ToLower(enc_type)
if enc_type != "" && v.Type == enc_type {
activeID = i activeID = i
break break
} }
@ -882,6 +885,7 @@ func (self *WifiList) KeyDown( ev *event.Event ) {
} }
wicd_wireless_encrypt_pwd := self.GetWirelessEncrypt(self.PsIndex) wicd_wireless_encrypt_pwd := self.GetWirelessEncrypt(self.PsIndex)
fmt.Println("wicd_wireless_encrypt_pwd ", wicd_wireless_encrypt_pwd)
if self.MyList[self.PsIndex].IsActive == true { if self.MyList[self.PsIndex].IsActive == true {
var ip string var ip string
@ -900,7 +904,9 @@ func (self *WifiList) KeyDown( ev *event.Event ) {
} }
} }
fmt.Println("APIOBJ.PasswordPage.SetPassword ", thepass,len(thepass))
APIOBJ.PasswordPage.SetPassword(thepass) APIOBJ.PasswordPage.SetPassword(thepass)
self.Screen.Draw() self.Screen.Draw()
self.Screen.SwapAndShow() self.Screen.SwapAndShow()
@ -929,6 +935,7 @@ func (self *WifiList) KeyDown( ev *event.Event ) {
func (self *WifiList) Init() { func (self *WifiList) Init() {
self.PosX = self.Index * self.Screen.Width self.PosX = self.Index * self.Screen.Width
self.Width = self.Screen.Width self.Width = self.Screen.Width
self.Height = self.Screen.Height self.Height = self.Screen.Height

View File

@ -2,7 +2,7 @@ package DBUS
import ( import (
"fmt" "fmt"
"strconv" //"strconv"
"github.com/godbus/dbus" "github.com/godbus/dbus"
) )
@ -127,8 +127,8 @@ func (self *DBus) check_for_wireless(iwconfig string, wireless_ip string) bool
if strength == 0 { if strength == 0 {
return false return false
} }
strength_str := strconv.Itoa(strength) strength_str := ""
self.Daemon.Get( self.Daemon.Method("FormatSignalForPrinting",strength_str), &strength_str) self.Daemon.Get( self.Daemon.Method("FormatSignalForPrinting",strength), &strength_str)
return true return true
} }
@ -174,5 +174,5 @@ var DBusHandler *DBus //global
func init() { func init() {
DBusHandler = NewDBus() DBusHandler = NewDBus()
DBusHandler.Init() DBusHandler.Init()
fmt.Println("dbus inited")
} }

View File

@ -61,7 +61,7 @@ func (self *InfoPageListItem) Draw() {
x,_ = self.Labels["Small"].Coord() x,_ = self.Labels["Small"].Coord()
w,h = self.Labels["Small"].Size() w,h = self.Labels["Small"].Size()
self.Labels["Small"].NewCoord( self.Width - w + 5 , self.PosY + (self.Height - h)/2 ) self.Labels["Small"].NewCoord( self.Width - w - 5 , self.PosY + (self.Height - h)/2 )
self.Labels["Small"].Draw() self.Labels["Small"].Draw()
} }

View File

@ -101,7 +101,8 @@ func (self *Textarea) AppendAndBlitText(alphabet string) {
func (self *Textarea) BuildBlitText() { func (self *Textarea) BuildBlitText() {
blit_rows := make([][]string,0) blit_rows := make([][]string,0)
blit_rows = append(blit_rows,[]string{})
w := 0 w := 0
// xmargin := 5 // xmargin := 5
endmargin :=15 endmargin :=15
@ -114,11 +115,7 @@ func (self *Textarea) BuildBlitText() {
t_width := surface.GetWidth(t) t_width := surface.GetWidth(t)
w+=t_width w+=t_width
if linenumber < len(blit_rows) { blit_rows[linenumber] = append(blit_rows[linenumber],v)
blit_rows[linenumber] = append(blit_rows[linenumber],v)
}else {
blit_rows = append(blit_rows,[]string{v})
}
if i == self.TextIndex - 1 { if i == self.TextIndex - 1 {
cursor_row = linenumber cursor_row = linenumber

View File

@ -1,7 +1,7 @@
package sysgo package sysgo
var ( var (
CurKeySet = "GameShell" CurKeySet = "PC"
DontLeave = false DontLeave = false
BackLight = "/proc/driver/backlight" BackLight = "/proc/driver/backlight"
Battery = "/sys/class/power_supply/axp20x-battery/uevent" Battery = "/sys/class/power_supply/axp20x-battery/uevent"

View File

@ -2,7 +2,7 @@ package misc
import ( import (
"bufio" "bufio"
"fmt" //"fmt"
"github.com/cuu/LauncherGo/sysgo/UI" "github.com/cuu/LauncherGo/sysgo/UI"
"log" "log"
"os" "os"
@ -119,7 +119,6 @@ func LoadEncryptionMethods(wired bool) []*CurType {
} }
enctypes, _ := UI.ReadLines(wpath_encryption + active_fname) enctypes, _ := UI.ReadLines(wpath_encryption + active_fname)
fmt.Println(enctypes)
var encryptionTypes []*CurType var encryptionTypes []*CurType

33
test.go
View File

@ -15,7 +15,9 @@ import (
"github.com/cuu/gogame/draw" "github.com/cuu/gogame/draw"
"github.com/cuu/gogame/image" "github.com/cuu/gogame/image"
"github.com/cuu/gogame/font" "github.com/cuu/gogame/font"
"github.com/cuu/gogame/time" "github.com/cuu/gogame/time"
"github.com/cuu/LauncherGo/sysgo/DBUS"
) )
const ( const (
@ -88,8 +90,35 @@ func run() int {
display.Flip() display.Flip()
event.AddCustomEvent(RUNEVT) event.AddCustomEvent(RUNEVT)
type status struct {
State int
Trash []string
}
var mystatus status
DBUS.DBusHandler.Daemon.Get(DBUS.DBusHandler.Daemon.Method("GetConnectionStatus"),&mystatus)
fmt.Println("state ",mystatus.State)
fmt.Println("Trash ",mystatus.Trash)
var essid string
var bssid string
DBUS.DBusHandler.Wifi.Get(DBUS.DBusHandler.Wifi.Method("GetWirelessProperty",0,"essid"),&essid)
fmt.Println(essid)
DBUS.DBusHandler.Wifi.Get(DBUS.DBusHandler.Wifi.Method("GetWirelessProperty",0,"bssid"),&bssid)
fmt.Println(bssid)
running := true running := true
for running { for running {
ev := event.Wait() ev := event.Wait()