[gimp] pygimp: python-console: ensure initial width of 80 characters



commit 04ef2c34db770fdb21243beeed0726db961a219c
Author: Kristian Rietveld <kris loopnest org>
Date:   Fri Apr 29 10:20:33 2016 +0200

    pygimp: python-console: ensure initial width of 80 characters

 plug-ins/pygimp/plug-ins/python-console.py |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/plug-ins/pygimp/plug-ins/python-console.py b/plug-ins/pygimp/plug-ins/python-console.py
index da62585..4e6588d 100755
--- a/plug-ins/pygimp/plug-ins/python-console.py
+++ b/plug-ins/pygimp/plug-ins/python-console.py
@@ -82,7 +82,13 @@ def do_console():
 
             scrl_win.add(self.cons)
 
-            self.set_default_size(500, 500)
+            width, height = self.cons.get_default_size()
+            sb_width, sb_height = scrl_win.get_vscrollbar().size_request()
+
+            # Account for scrollbar width and border width to ensure
+            # the text view gets a width of 80 characters. We don't care
+            # so much whether the height will be exactly 40 characters.
+            self.set_default_size(width + sb_width + 2 * 12, height)
 
         def response(self, dialog, response_id):
             if response_id == RESPONSE_BROWSE:


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]