This patch dynamically adapt the width of the gui window to the longest context key in the database.
>From 9dd40fbd76c988574447e196ef2ebfa969e8832f Mon Sep 17 00:00:00 2001
From: Olivier Guerrier <[email protected]>
Date: Wed, 29 May 2013 21:14:01 +0200
Subject: [PATCH 2/4] make the width of the gui window related to the longest
 context key

---
 assword.py |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/assword.py b/assword.py
index f1b758c..70921b5 100644
--- a/assword.py
+++ b/assword.py
@@ -198,8 +198,12 @@ class Gui:
         completion.set_model(liststore)
         completion.set_text_column(0)
         completion.set_match_func(match_func, 0) # 0 is column number
+        context_len = 20
         for context in self.db.entries:
+            if len(context) > context_len:
+                context_len = len(context)
             liststore.append([context])
+        self.entry.set_width_chars(context_len)
         hbox = gtk.HBox()
         vbox = gtk.VBox()
         self.createbutton = gtk.Button("Create")
-- 
1.7.10.4


Reply via email to