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

View File

@ -10,7 +10,7 @@ import (
"github.com/cuu/gogame/color"
*/
"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.Name = "Scan wifi"
self.ScanPage.Wireless = DBUS.DBusHandler.Wifi
self.ScanPage.Daemon = DBUS.DBusHandler.Daemon
self.ScanPage.Wireless = main_screen.DBusManager.Wifi
self.ScanPage.Daemon = main_screen.DBusManager.Daemon
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 ) {
if main_screen != nil {
main_screen.PushPage(self.ScanPage)
main_screen.PushCurPage()
main_screen.SetCurPage(self.ScanPage)
main_screen.Draw()
main_screen.SwapAndShow()
}

View File

@ -454,7 +454,7 @@ func (self *WifiList) GenNetworkList() {
for network_id:=0;network_id< num_of_networks;network_id++ {
is_active = false
self.Wireless.Get(self.Wireless.Method("GetCurrentSignalStrength",""), &cur_signal_strength)
self.Wireless.Get(self.Wireless.Method("GetIwconfig"),&iwconfig)
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
if state == -1 {
self.Daemon.Get(self.Daemon.Method("GetConnectionStatus"),&mystatus)
fmt.Println("state ",mystatus.State)
fmt.Println("Trash ",mystatus.Trash)
}
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 {
enc_type = ""
self.Wireless.Get(self.Wireless.Method("GetWirelessProperty",network_id,"enctype"),&enc_type)
if v.Type == enc_type {
self.Wireless.Get(self.Wireless.Method("GetWirelessProperty",network_id,"encryption_method"),&enc_type)
enc_type = strings.ToLower(enc_type)
if enc_type != "" && v.Type == enc_type {
activeID = i
break
}
@ -882,6 +885,7 @@ func (self *WifiList) KeyDown( ev *event.Event ) {
}
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 {
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)
self.Screen.Draw()
self.Screen.SwapAndShow()
@ -929,6 +935,7 @@ func (self *WifiList) KeyDown( ev *event.Event ) {
func (self *WifiList) Init() {
self.PosX = self.Index * self.Screen.Width
self.Width = self.Screen.Width
self.Height = self.Screen.Height

View File

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

View File

@ -61,7 +61,7 @@ func (self *InfoPageListItem) Draw() {
x,_ = self.Labels["Small"].Coord()
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()
}

View File

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

View File

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

View File

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

33
test.go
View File

@ -15,7 +15,9 @@ import (
"github.com/cuu/gogame/draw"
"github.com/cuu/gogame/image"
"github.com/cuu/gogame/font"
"github.com/cuu/gogame/time"
"github.com/cuu/gogame/time"
"github.com/cuu/LauncherGo/sysgo/DBUS"
)
const (
@ -88,8 +90,35 @@ func run() int {
display.Flip()
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
for running {
ev := event.Wait()