Data forms: labels are aligned with top of widgets, default instructions gone,

borders removed.
This commit is contained in:
Tomasz Melcer 2006-12-16 20:05:06 +00:00
parent a06937d905
commit 257b1b7eeb
3 changed files with 15 additions and 16 deletions

View File

@ -18,6 +18,7 @@
<property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<property name="focus_on_map">True</property>
<property name="urgency_hint">False</property>
<signal name="destroy" handler="on_adhoc_commands_window_destroy" last_modification_time="Thu, 22 Jun 2006 22:50:45 GMT"/>
<child>

View File

@ -466,7 +466,7 @@
<widget class="GtkNotebook" id="data_form_types_notebook">
<property name="visible">True</property>
<property name="show_tabs">False</property>
<property name="show_border">True</property>
<property name="show_border">False</property>
<property name="tab_pos">GTK_POS_TOP</property>
<property name="scrollable">False</property>
<property name="enable_popup">False</property>
@ -483,7 +483,7 @@
<child>
<widget class="GtkViewport" id="single_form_viewport">
<property name="visible">True</property>
<property name="shadow_type">GTK_SHADOW_IN</property>
<property name="shadow_type">GTK_SHADOW_NONE</property>
<child>
<placeholder/>

View File

@ -67,19 +67,10 @@ class DataFormWidget(gtk.Alignment, object):
# create appropriate description for instructions field if there isn't any
if dataform.instructions=='':
if dataform.type=='result':
# form is single
instructions = _('This is result of query.')
else:
# form is writable (TODO: move that to build_*_data_form()?)
if isinstance(dataform, dataforms.SimpleDataForm):
instructions = _('Fill in the form.')
else:
instructions = _('Edit items on the list')
self.instructions_label.set_no_show_all(True)
self.instructions_label.hide()
else:
instructions = dataform.instructions
self.instructions_label.set_text(instructions)
self.instructions_label.set_text(instructions)
def get_data_form(self):
""" Data form displayed in the widget or None if no form. """
@ -267,7 +258,7 @@ class SingleForm(gtk.Table, object):
assert isinstance(dataform, dataforms.SimpleDataForm)
gtk.Table.__init__(self)
self.set_col_spacings(6)
self.set_col_spacings(12)
self.set_row_spacings(6)
self.tooltips = gtk.Tooltips()
@ -297,10 +288,12 @@ class SingleForm(gtk.Table, object):
if field.type=='hidden': continue
commonlabel = True
commonlabelcenter = False
commonwidget = True
widget = None
if field.type=='boolean':
commonlabelcenter = True
widget = gtk.CheckButton()
widget.connect('toggled', self.on_boolean_checkbutton_toggled, field)
widget.set_active(field.value)
@ -403,6 +396,7 @@ class SingleForm(gtk.Table, object):
del xml
elif field.type == 'text-private':
commonlabelcenter = True
widget = gtk.Entry()
widget.connect('changed', self.on_text_single_entry_changed, field)
widget.set_visibility(False)
@ -428,6 +422,7 @@ class SingleForm(gtk.Table, object):
else:# field.type == 'text-single' or field.type is nonstandard:
# JEP says that if we don't understand some type, we
# should handle it as text-single
commonlabelcenter = True
if readwrite:
widget = gtk.Entry()
widget.connect('changed', self.on_text_single_entry_changed, field)
@ -446,7 +441,10 @@ class SingleForm(gtk.Table, object):
if commonlabel and field.label is not None:
label = gtk.Label(field.label)
label.set_alignment(0.0, 0.5)
if commonlabelcenter:
label.set_alignment(0.0, 0.5)
else:
label.set_alignment(0.0, 0.0)
label = decorate_with_tooltip(label, field)
self.attach(label, 0, 1, linecounter, linecounter+1,
xoptions=gtk.FILL, yoptions=gtk.FILL)