소스 검색

FootMsg changes for the buttons layout

cuu 4 년 전
부모
커밋
badeb13268
3개의 변경된 파일22개의 추가작업 그리고 6개의 파일을 삭제
  1. 6 1
      sys.py/UI/foot_bar.py
  2. 3 3
      sys.py/UI/keys_def.py
  3. 13 2
      sys.py/config.py

+ 6 - 1
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):

+ 3 - 3
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":

+ 13 - 2
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")