diff options
author | Tim Potter <tpot@samba.org> | 2002-09-18 08:16:22 +0000 |
---|---|---|
committer | Tim Potter <tpot@samba.org> | 2002-09-18 08:16:22 +0000 |
commit | e7ff6ab84058a7823b047b99bafd87274d72fa3b (patch) | |
tree | 3503f08ec80a24740a88d6c3d31037a946943446 /source3 | |
parent | e59d5b50fe882cb1b65ca2f665b0c93c6273c436 (diff) | |
download | samba-e7ff6ab84058a7823b047b99bafd87274d72fa3b.tar.gz samba-e7ff6ab84058a7823b047b99bafd87274d72fa3b.tar.bz2 samba-e7ff6ab84058a7823b047b99bafd87274d72fa3b.zip |
Display the repr() of non-string dictionary values.
(This used to be commit 3c6975c711d87755f0532147f9aaecb224159f43)
Diffstat (limited to 'source3')
-rwxr-xr-x | source3/python/gtkdictbrowser.py | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/source3/python/gtkdictbrowser.py b/source3/python/gtkdictbrowser.py index 6d6cdb3c8a..dd8bed8f47 100755 --- a/source3/python/gtkdictbrowser.py +++ b/source3/python/gtkdictbrowser.py @@ -116,16 +116,27 @@ class GtkDictBrowser: # Set the text to appear in the right hand side of the user interface - def set_value_text(self, text): - self.text.delete_text(0, self.text.get_length()) + def set_value_text(self, item): - # The text widget has trouble inserting text containing NULL - # characters. + # Clear old old value in text window - text = string.replace(text, "\x00", ".") + self.text.delete_text(0, self.text.get_length()) + + if type(item) == str: - self.text.insert(self.font, None, None, text) + # The text widget has trouble inserting text containing NULL + # characters. + + item = string.replace(item, "\x00", ".") + + self.text.insert(self.font, None, None, item) + else: + + # A non-text item + + self.text.insert(self.font, None, None, repr(item)) + # This function is called when a key is selected in the left hand side # of the user interface. @@ -246,7 +257,7 @@ def hex_string(data): if __name__ == "__main__": - dict = {"chicken": "ham", "spam": "fun"} + dict = {"chicken": "ham", "spam": "fun", "subdict": {"a": "b", "c": "d"}} db = GtkDictBrowser(dict) |