5351: Focus on eventref and sourecref editors (patches by Michiel, MathieuMD); consistent editeventref.glade file (romjerome)

svn: r18471
This commit is contained in:
Jérôme Rapinat 2011-11-21 10:30:31 +00:00
parent f58ec21ec8
commit 68e7025c4e
3 changed files with 445 additions and 461 deletions

View File

@ -10,15 +10,22 @@
<object class="GtkVBox" id="dialog-vbox11">
<property name="visible">True</property>
<child>
<object class="GtkVPaned" id="vpaned1">
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="can_focus">True</property>
<child>
<object class="GtkExpander" id="expander1">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="expanded">True</property>
<property name="spacing">6</property>
<property name="xalign">0</property>
<property name="xpad">6</property>
<property name="ypad">3</property>
<property name="label" translatable="yes">&lt;b&gt;Reference information&lt;/b&gt;</property>
<property name="use_markup">True</property>
<property name="use_underline">True</property>
<property name="justify">center</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkNotebook" id="notebook_ref">
<property name="visible">True</property>
@ -80,50 +87,18 @@
</object>
</child>
<child type="tab">
<object class="GtkHBox" id="hbox128">
<property name="visible">True</property>
<property name="spacing">6</property>
<child>
<object class="GtkImage" id="image2688">
<property name="visible">True</property>
<property name="stock">gtk-file</property>
<property name="icon-size">1</property>
</object>
<packing>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label618">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;General&lt;/b&gt;</property>
<property name="use_markup">True</property>
<property name="justify">center</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="tab_fill">False</property>
</packing>
</child>
</object>
</child>
<child type="label">
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;Reference information&lt;/b&gt;</property>
<property name="use_markup">True</property>
</object>
</child>
</object>
<packing>
<property name="resize">True</property>
<property name="shrink">True</property>
<property name="position">2</property>
</packing>
</child>
<child>
@ -486,13 +461,7 @@
</child>
</object>
<packing>
<property name="resize">True</property>
<property name="shrink">True</property>
</packing>
</child>
</object>
<packing>
<property name="position">1</property>
<property name="position">3</property>
</packing>
</child>
<child internal-child="action_area">
@ -554,9 +523,9 @@
</object>
</child>
<action-widgets>
<action-widget response="-11">help</action-widget>
<action-widget response="-6">cancel</action-widget>
<action-widget response="-5">ok</action-widget>
<action-widget response="0">help</action-widget>
<action-widget response="0">cancel</action-widget>
<action-widget response="0">ok</action-widget>
</action-widgets>
</object>
</interface>

View File

@ -3,6 +3,7 @@
#
# Copyright (C) 2000-2006 Donald N. Allingham
# 2009 Gary Burton
# 2011 Michiel D. Nauta
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -82,6 +83,11 @@ class EditEventRef(EditReference):
self.primtab = RefTab(self.dbstate, self.uistate, self.track,
_('_General'), tblref)
def _post_init(self):
date = self.top.get_object('eer_date_entry')
if not date.get_text_length():
date.grab_focus();
def _init_event(self):
if not self.db.readonly:
self.commit_event = self.db.commit_personal_event

View File

@ -3,6 +3,7 @@
#
# Copyright (C) 2000-2006 Donald N. Allingham
# 2009 Gary Burton
# 2011 Michiel D. Nauta / MathieuMD
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -80,6 +81,14 @@ class EditSourceRef(EditReference):
self.primtab = RefTab(self.dbstate, self.uistate, self.track,
_('General'), tblref)
def _post_init(self):
title = self.top.get_object('title')
volume = self.top.get_object('volume')
if not title.get_text_length():
title.grab_focus();
elif not volume.get_text_length():
volume.grab_focus();
def _connect_signals(self):
self.define_ok_button(self.top.get_object('ok'),self.ok_clicked)
self.define_cancel_button(self.top.get_object('cancel'))