Skip to content
Snippets Groups Projects
Commit 257b1b7e authored by Liorithiel's avatar Liorithiel
Browse files

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

borders removed.
parent a06937d9
No related branches found
No related tags found
No related merge requests found
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
<property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property> <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property> <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<property name="focus_on_map">True</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"/> <signal name="destroy" handler="on_adhoc_commands_window_destroy" last_modification_time="Thu, 22 Jun 2006 22:50:45 GMT"/>
<child> <child>
......
...@@ -466,7 +466,7 @@ ...@@ -466,7 +466,7 @@
<widget class="GtkNotebook" id="data_form_types_notebook"> <widget class="GtkNotebook" id="data_form_types_notebook">
<property name="visible">True</property> <property name="visible">True</property>
<property name="show_tabs">False</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="tab_pos">GTK_POS_TOP</property>
<property name="scrollable">False</property> <property name="scrollable">False</property>
<property name="enable_popup">False</property> <property name="enable_popup">False</property>
...@@ -483,7 +483,7 @@ ...@@ -483,7 +483,7 @@
<child> <child>
<widget class="GtkViewport" id="single_form_viewport"> <widget class="GtkViewport" id="single_form_viewport">
<property name="visible">True</property> <property name="visible">True</property>
<property name="shadow_type">GTK_SHADOW_IN</property> <property name="shadow_type">GTK_SHADOW_NONE</property>
<child> <child>
<placeholder/> <placeholder/>
......
...@@ -67,19 +67,10 @@ class DataFormWidget(gtk.Alignment, object): ...@@ -67,19 +67,10 @@ class DataFormWidget(gtk.Alignment, object):
# create appropriate description for instructions field if there isn't any # create appropriate description for instructions field if there isn't any
if dataform.instructions=='': if dataform.instructions=='':
if dataform.type=='result': self.instructions_label.set_no_show_all(True)
# form is single self.instructions_label.hide()
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')
else: else:
instructions = dataform.instructions self.instructions_label.set_text(instructions)
self.instructions_label.set_text(instructions)
def get_data_form(self): def get_data_form(self):
""" Data form displayed in the widget or None if no form. """ """ Data form displayed in the widget or None if no form. """
...@@ -267,7 +258,7 @@ class SingleForm(gtk.Table, object): ...@@ -267,7 +258,7 @@ class SingleForm(gtk.Table, object):
assert isinstance(dataform, dataforms.SimpleDataForm) assert isinstance(dataform, dataforms.SimpleDataForm)
gtk.Table.__init__(self) gtk.Table.__init__(self)
self.set_col_spacings(6) self.set_col_spacings(12)
self.set_row_spacings(6) self.set_row_spacings(6)
self.tooltips = gtk.Tooltips() self.tooltips = gtk.Tooltips()
...@@ -297,10 +288,12 @@ class SingleForm(gtk.Table, object): ...@@ -297,10 +288,12 @@ class SingleForm(gtk.Table, object):
if field.type=='hidden': continue if field.type=='hidden': continue
commonlabel = True commonlabel = True
commonlabelcenter = False
commonwidget = True commonwidget = True
widget = None widget = None
if field.type=='boolean': if field.type=='boolean':
commonlabelcenter = True
widget = gtk.CheckButton() widget = gtk.CheckButton()
widget.connect('toggled', self.on_boolean_checkbutton_toggled, field) widget.connect('toggled', self.on_boolean_checkbutton_toggled, field)
widget.set_active(field.value) widget.set_active(field.value)
...@@ -403,6 +396,7 @@ class SingleForm(gtk.Table, object): ...@@ -403,6 +396,7 @@ class SingleForm(gtk.Table, object):
del xml del xml
elif field.type == 'text-private': elif field.type == 'text-private':
commonlabelcenter = True
widget = gtk.Entry() widget = gtk.Entry()
widget.connect('changed', self.on_text_single_entry_changed, field) widget.connect('changed', self.on_text_single_entry_changed, field)
widget.set_visibility(False) widget.set_visibility(False)
...@@ -428,6 +422,7 @@ class SingleForm(gtk.Table, object): ...@@ -428,6 +422,7 @@ class SingleForm(gtk.Table, object):
else:# field.type == 'text-single' or field.type is nonstandard: else:# field.type == 'text-single' or field.type is nonstandard:
# JEP says that if we don't understand some type, we # JEP says that if we don't understand some type, we
# should handle it as text-single # should handle it as text-single
commonlabelcenter = True
if readwrite: if readwrite:
widget = gtk.Entry() widget = gtk.Entry()
widget.connect('changed', self.on_text_single_entry_changed, field) widget.connect('changed', self.on_text_single_entry_changed, field)
...@@ -446,7 +441,10 @@ class SingleForm(gtk.Table, object): ...@@ -446,7 +441,10 @@ class SingleForm(gtk.Table, object):
if commonlabel and field.label is not None: if commonlabel and field.label is not None:
label = gtk.Label(field.label) 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) label = decorate_with_tooltip(label, field)
self.attach(label, 0, 1, linecounter, linecounter+1, self.attach(label, 0, 1, linecounter, linecounter+1,
xoptions=gtk.FILL, yoptions=gtk.FILL) xoptions=gtk.FILL, yoptions=gtk.FILL)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment