jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1340526?usp=email )

Change subject: Reuse GUI highlight configuration values
......................................................................

Reuse GUI highlight configuration values

Fetch normal and selection highlight settings once each and reuse their
foreground and background values when configuring the text editor.
Avoid duplicate GetHighlight() calls while preserving the settings.

Change-Id: I53f37fbc1905b1f8dda9cf3285e4f0da7f48d61b
---
M pywikibot/userinterfaces/gui.py
1 file changed, 6 insertions(+), 6 deletions(-)

Approvals:
  JJMC89: Looks good to me, approved
  jenkins-bot: Verified




diff --git a/pywikibot/userinterfaces/gui.py b/pywikibot/userinterfaces/gui.py
index 08ee564..4c194cc 100644
--- a/pywikibot/userinterfaces/gui.py
+++ b/pywikibot/userinterfaces/gui.py
@@ -89,18 +89,18 @@
     @staticmethod
     def _initialize_config(theme):
         """Fix idleConf.GetHighlight method for different Python releases."""
+        normal = idleConf.GetHighlight(theme, 'normal')
+        hilite = idleConf.GetHighlight(theme, 'hilite')
         return {
             'padx': 5,
             'wrap': 'word',
             'undo': 'True',
             'width': idleConf.GetOption('main', 'EditorWindow', 'width'),
             'height': idleConf.GetOption('main', 'EditorWindow', 'height'),
-            'foreground': idleConf.GetHighlight(theme, 'normal')['foreground'],
-            'background': idleConf.GetHighlight(theme, 'normal')['background'],
-            'highlightcolor': idleConf.GetHighlight(
-                theme, 'hilite')['foreground'],
-            'highlightbackground': idleConf.GetHighlight(
-                theme, 'hilite')['background'],
+            'foreground': normal['foreground'],
+            'background': normal['background'],
+            'highlightcolor': hilite['foreground'],
+            'highlightbackground': hilite['background'],
             'insertbackground': idleConf.GetHighlight(
                 theme, 'cursor')['foreground'],
         }

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1340526?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.wikimedia.org/r/settings?usp=email

Gerrit-MessageType: merged
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I53f37fbc1905b1f8dda9cf3285e4f0da7f48d61b
Gerrit-Change-Number: 1340526
Gerrit-PatchSet: 2
Gerrit-Owner: Mahveotm <[email protected]>
Gerrit-Reviewer: JJMC89 <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
Pywikibot-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to