From 24abd55f8628c2e3845f7ae634b3dca1b05575a3 Mon Sep 17 00:00:00 2001 From: cuu Date: Wed, 26 Jun 2019 17:11:06 +0800 Subject: [PATCH 1/6] wifilist --- Menu/GameShell/10_Settings/Wifi/wifi_list.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Menu/GameShell/10_Settings/Wifi/wifi_list.py b/Menu/GameShell/10_Settings/Wifi/wifi_list.py index c1d1037..5313231 100644 --- a/Menu/GameShell/10_Settings/Wifi/wifi_list.py +++ b/Menu/GameShell/10_Settings/Wifi/wifi_list.py @@ -569,7 +569,10 @@ class WifiList(Page): if is_wifi_connected_now() == False: self.ConfigWireless(password_inputed) else: - self.ShowBox(MyLangManager.Tr("Disconnect first")) + self._Daemon.SetForcedDisconnect(True) + self._Connecting = False + self.ConfigWireless(password_inputed) + #self.ShowBox(MyLangManager.Tr("Disconnect first")) def OnReturnBackCb(self): pass From 0b733435f64ead9ce76fbf272f2b00a3aff73929 Mon Sep 17 00:00:00 2001 From: cuu Date: Wed, 26 Jun 2019 17:18:53 +0800 Subject: [PATCH 2/6] 10 times to force wifi disconnect when try to connect a new one --- Menu/GameShell/10_Settings/Wifi/wifi_list.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/Menu/GameShell/10_Settings/Wifi/wifi_list.py b/Menu/GameShell/10_Settings/Wifi/wifi_list.py index 5313231..8fa7ce0 100644 --- a/Menu/GameShell/10_Settings/Wifi/wifi_list.py +++ b/Menu/GameShell/10_Settings/Wifi/wifi_list.py @@ -569,10 +569,19 @@ class WifiList(Page): if is_wifi_connected_now() == False: self.ConfigWireless(password_inputed) else: - self._Daemon.SetForcedDisconnect(True) - self._Connecting = False - self.ConfigWireless(password_inputed) - #self.ShowBox(MyLangManager.Tr("Disconnect first")) + for i=0 to 10: + if is_wifi_connected_now() == True: + self._Daemon.SetForcedDisconnect(True) + self._Connecting = False + else: + break + + pygame.time.delay(100) + + if is_wifi_connected_now() == False: + self.ConfigWireless(password_inputed) + else: + self.ShowBox(MyLangManager.Tr("Disconnect first")) def OnReturnBackCb(self): pass From 8c0c6ac86a119a3abc84e131f16ef3858959f3de Mon Sep 17 00:00:00 2001 From: cuu Date: Wed, 26 Jun 2019 17:23:18 +0800 Subject: [PATCH 3/6] ... --- Menu/GameShell/10_Settings/Wifi/wifi_list.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Menu/GameShell/10_Settings/Wifi/wifi_list.py b/Menu/GameShell/10_Settings/Wifi/wifi_list.py index 8fa7ce0..f9c218f 100644 --- a/Menu/GameShell/10_Settings/Wifi/wifi_list.py +++ b/Menu/GameShell/10_Settings/Wifi/wifi_list.py @@ -569,7 +569,7 @@ class WifiList(Page): if is_wifi_connected_now() == False: self.ConfigWireless(password_inputed) else: - for i=0 to 10: + for i in range(0,10): if is_wifi_connected_now() == True: self._Daemon.SetForcedDisconnect(True) self._Connecting = False From 0f2cf846eb94accd14740b073551604704f4722e Mon Sep 17 00:00:00 2001 From: cuu Date: Wed, 26 Jun 2019 17:29:25 +0800 Subject: [PATCH 4/6] wifilist --- Menu/GameShell/10_Settings/Wifi/wifi_list.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Menu/GameShell/10_Settings/Wifi/wifi_list.py b/Menu/GameShell/10_Settings/Wifi/wifi_list.py index f9c218f..c5882d7 100644 --- a/Menu/GameShell/10_Settings/Wifi/wifi_list.py +++ b/Menu/GameShell/10_Settings/Wifi/wifi_list.py @@ -571,6 +571,8 @@ class WifiList(Page): else: for i in range(0,10): if is_wifi_connected_now() == True: + self.ShowBox(MyLangManager.Tr("Launching")) + self._Daemon.Disconnect() self._Daemon.SetForcedDisconnect(True) self._Connecting = False else: From badeb13268fa58ba4489384c1e9f66370d8fc852 Mon Sep 17 00:00:00 2001 From: cuu Date: Wed, 26 Jun 2019 21:12:20 +0800 Subject: [PATCH 5/6] FootMsg changes for the buttons layout --- sys.py/UI/foot_bar.py | 7 ++++++- sys.py/UI/keys_def.py | 6 +++--- sys.py/config.py | 15 +++++++++++++-- 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/sys.py/UI/foot_bar.py b/sys.py/UI/foot_bar.py index b2cc8e2..4b25afc 100644 --- a/sys.py/UI/foot_bar.py +++ b/sys.py/UI/foot_bar.py @@ -15,6 +15,8 @@ from lang_manager import MyLangManager from widget import Widget from skin_manager import MySkinManager +import config + icon_base_path = MySkinManager.GiveIcon("gameshell/footbar_icons/") class FootBarIcon(MultiIconItem): @@ -134,7 +136,10 @@ class FootBar(Widget): self.Draw() def SetLabelTexts(self,texts): - barr = ["nav","y","x","b","a","select"] + if config.ButtonsLayout == "xbox": + barr = ["nav","y","x","b","a","select"] + else: + barr = ["nav","x","y","a","b","select"] texts2 = texts + [""] if len(texts) == 5 else texts for idx,x in enumerate(barr): diff --git a/sys.py/UI/keys_def.py b/sys.py/UI/keys_def.py index dc59b53..176adc5 100644 --- a/sys.py/UI/keys_def.py +++ b/sys.py/UI/keys_def.py @@ -6,9 +6,8 @@ from sys import exit import os import sys - -from config import CurKeySet - +import config +from config import CurKeySet ## read only def GetButtonsLayoutMode(): lm = "xbox" @@ -25,6 +24,7 @@ def SetButtonsLayoutMode(mode): SetXYABButtons(mode) with open(".buttonslayout", "w") as f: f.write(mode) + config.ButtonsLayout = mode def SetXYABButtons(mode): if mode == "snes": diff --git a/sys.py/config.py b/sys.py/config.py index f83ab63..5b12eb1 100644 --- a/sys.py/config.py +++ b/sys.py/config.py @@ -19,6 +19,8 @@ VERSION="stable 1.25" SKIN=None +ButtonsLayout="xbox" + ## three timer values in seconds: dim screen, close screen,PowerOff ## zero means no action PowerLevels = {} @@ -30,7 +32,7 @@ PowerLevels["balance_saving"] = [40,0,0] PowerLevel = "balance_saving" def PreparationInAdv(): - global SKIN + global SKIN,ButtonsLayout global PowerLevel if SKIN != None: @@ -44,7 +46,16 @@ def PreparationInAdv(): gameshell_skin = gameshell_skin.strip() SKIN= gameshell_skin - + + if FileExists(".buttonslayout") == True: + with open(".buttonslayout") as f: + btnlayout = f.read() + + btnlayout = btnlayout.strip() + ButtonsLayout = btnlayout + if ButtonsLayout != "xbox" and ButtonsLayout != "snes": + ButtonsLayout = "xbox" + if FileExists(".powerlevel") == False: os.system("touch .powerlevel") From 3673da1bf46fd6af70b45d78cb0ec05dba4871e7 Mon Sep 17 00:00:00 2001 From: cuu Date: Wed, 26 Jun 2019 22:15:41 +0800 Subject: [PATCH 6/6] bug fix --- sys.py/run.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/sys.py/run.py b/sys.py/run.py index e75f84a..33e5995 100644 --- a/sys.py/run.py +++ b/sys.py/run.py @@ -344,7 +344,14 @@ def event_process(event,main_screen): gobject_main_loop.quit() os.chdir( GetExePath()) - exec_app_cmd = "cd "+os.path.dirname(event.message.strip().split(" ")[0])+";" + endpos = len(event.message) + space_break_pos = endpos + for i in range(0,endpos): + if event.message[i] == "/" and event.message[i-1] == " " and i > 6: + space_break_pos = i-1 + break + + exec_app_cmd = "cd "+os.path.dirname(event.message[:space_break_pos])+";" exec_app_cmd += event.message exec_app_cmd += "; sync & cd "+GetExePath()+"; exec python "+myscriptname print(exec_app_cmd) @@ -363,7 +370,14 @@ def event_process(event,main_screen): pygame.quit() gobject_main_loop.quit() os.chdir( GetExePath()) - exec_app_cmd = "cd "+os.path.dirname(event.message.strip().split(" ")[0])+";" + endpos = len(event.message) + space_break_pos = endpos + for i in range(0,endpos): + if event.message[i] == "/" and event.message[i-1] == " " and i > 6: + space_break_pos = i-1 + break + + exec_app_cmd = "cd "+os.path.dirname(event.message[:space_break_pos])+";" exec_app_cmd += event.message exec_app_cmd += "; sync & cd "+GetExePath()+"; exec python "+myscriptname print(exec_app_cmd)