moul-assets icon indicating copy to clipboard operation
moul-assets copied to clipboard

Duplicate control tags in the KI

Open cwalther opened this issue 4 years ago • 1 comments

Next time the KI sources are modified and new PRPs need to be distributed (if ever), the opportunity could be taken to fix duplicate control tag IDs:

  • In GUI_District_KIMini, change the tag of pfGUIUpDownPairMod "ChatScrollUpDown" from 51 to 55 because 51 is already taken by pfGUIButtonMod "miniKIChatScollUp".
  • In GUI_District_KIMicro, change the tag of pfGUIUpDownPairMod "microChatScrollUpDown" from 51 to 55 because 51 is already taken by pfGUIButtonMod "microKIChatScrollUp".

Then the performance of H-uru/moul-scripts#115 could be optimized as follows:

diff --git a/Python/ki/__init__.py b/Python/ki/__init__.py
index c104633..9ee8498 100644
--- a/Python/ki/__init__.py
+++ b/Python/ki/__init__.py
@@ -1138,7 +1138,7 @@ class xKI(ptModifier):
                 self.chatMgr.incomingChatFlashState -= 1
                 PtAtTimeCallback(self.key, 0.15, kTimers.IncomingChatFlash)
             else:
-                mKIdialog.refreshAllControls()
+                ptGUIControlUpDownPair(mKIdialog.getControlFromTag(kGUI.miniChatScrollUpDown)).refresh()
 
     ## Called by Plasma when a screen capture is done.
     # This gets called once the screen capture is performed and ready to be
diff --git a/Python/ki/xKIConstants.py b/Python/ki/xKIConstants.py
index 06838bd..d45fc5c 100644
--- a/Python/ki/xKIConstants.py
+++ b/Python/ki/xKIConstants.py
@@ -295,6 +295,7 @@ class kGUI:
     miniDragBar = 50
     miniChatScrollUp = 51
     miniChatScrollDown = 52
+    miniChatScrollUpDown = 55
     miniPlayerListUp = 53
     miniPlayerListDown = 54
 

(This is not an urgent issue, but just something to keep in mind.)

cwalther avatar Mar 14 '20 10:03 cwalther