Infodialog sufficiently large

Add easy test of dialogs to dialog.py


svn: r20066
This commit is contained in:
Benny Malengier 2012-07-24 18:29:17 +00:00
parent 868d00a67f
commit 43e7edd99f
2 changed files with 36 additions and 0 deletions

View File

@ -26,6 +26,8 @@
#
#-------------------------------------------------------------------------
import sys
import logging
_LOG = logging.getLogger(".dialog")
#-------------------------------------------------------------------------
#
@ -351,3 +353,33 @@ class MessageHideDialog(object):
def update_checkbox(self, obj, constant):
config.set(constant, obj.get_active())
config.save()
## Testing function of some of these dialogs
def main(args):
win = Gtk.Window()
win.set_title('Dialog test window')
win.set_position(Gtk.WindowPosition.CENTER)
def cb(window, event):
Gtk.main_quit()
win.connect('delete-event', cb)
def test_info(obj):
InfoDialog('The title', 'This is a lot of info\n to show to all!', parent=win)
vbox = Gtk.VBox()
win.add(vbox)
btn1 = Gtk.Button('Info dialog')
btn1.connect('clicked', test_info)
vbox.pack_start(btn1, True, True, 0)
win.show_all()
Gtk.main()
if __name__ == '__main__':
import sys
# fall back to root logger for testing
_LOG = logging
sys.exit(main(sys.argv))

View File

@ -223,12 +223,16 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="shadow_type">etched-in</property>
<property name="min_content_width">300</property>
<property name="min_content_height">300</property>
<child>
<object class="GtkTextView" id="infoview">
<property name="width_request">308</property>
<property name="height_request">210</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hscroll_policy">natural</property>
<property name="vscroll_policy">natural</property>
<property name="editable">False</property>
</object>
</child>