* src/DbPrompter.py (DbPrompter): Give possibility to open the recent file

* src/gramps.glade: Add recent file to DbPrompter


svn: r5376
This commit is contained in:
Martin Hawlisch 2005-11-08 20:20:37 +00:00
parent 0b94abb585
commit 5b70ab3eb3
3 changed files with 64 additions and 4 deletions

View File

@ -1,3 +1,8 @@
2005-11-08 Martin Hawlisch <Martin.Hawlisch@gmx.de>
* src/DbPrompter.py (DbPrompter): Give possibility to open
the recent file
* src/gramps.glade: Add recent file to DbPrompter
2005-11-08 Alex Roitman <shura@gramps-project.org> 2005-11-08 Alex Roitman <shura@gramps-project.org>
* src/EditPlace.py: Fix idle for new objects. * src/EditPlace.py: Fix idle for new objects.
* src/EditSource.py: Fix idle for new objects. * src/EditSource.py: Fix idle for new objects.

View File

@ -93,15 +93,49 @@ class DbPrompter:
Utils.set_titles(top,title,_('Open a database')) Utils.set_titles(top,title,_('Open a database'))
recent = opendb.get_widget("recent")
existing = opendb.get_widget("existing")
new = opendb.get_widget("new") new = opendb.get_widget("new")
new.set_active(want_new)
# write in recent file
gramps_rf = RecentFiles.GrampsRecentFiles()
gramps_rf.gramps_recent_files.sort()
gramps_rf.gramps_recent_files.reverse()
if gramps_rf.gramps_recent_files:
self.recent_file = gramps_rf.gramps_recent_files[0].get_path()
try:
self.recent_filetype = get_mime_type(self.recent_file)
filename = os.path.basename(self.recent_file).replace("_", "__")
recent.set_label( _("_Recent file: %s") % filename)
except RuntimeError:
recent.set_sensitive(False)
self.recent_file = None
else:
recent.set_sensitive(False)
self.recent_file = None
if want_new:
new.set_active(True)
else:
if not self.recent_file:
existing.set_active(True)
while 1: while 1:
top.show() top.show()
response = top.run() response = top.run()
top.hide() top.hide()
if response == gtk.RESPONSE_OK: if response == gtk.RESPONSE_OK:
if new.get_active(): if recent.get_active():
try:
if open_native(self.parent,self.recent_file,self.recent_filetype):
break
except RuntimeError,msg:
QuestionDialog.ErrorDialog(
_("Could not open file: %s") % self.recent_file,
str(msg))
recent.set_sensitive(False)
continue
elif new.get_active():
prompter = NewNativeDbPrompter(self.parent, prompter = NewNativeDbPrompter(self.parent,
self.parent_window) self.parent_window)
else: else:

View File

@ -5706,6 +5706,26 @@ Other</property>
</packing> </packing>
</child> </child>
<child>
<widget class="GtkRadioButton" id="recent">
<property name="border_width">5</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Open recent file: </property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child> <child>
<widget class="GtkRadioButton" id="existing"> <widget class="GtkRadioButton" id="existing">
<property name="border_width">5</property> <property name="border_width">5</property>
@ -5718,6 +5738,7 @@ Other</property>
<property name="active">True</property> <property name="active">True</property>
<property name="inconsistent">False</property> <property name="inconsistent">False</property>
<property name="draw_indicator">True</property> <property name="draw_indicator">True</property>
<property name="group">recent</property>
</widget> </widget>
<packing> <packing>
<property name="padding">0</property> <property name="padding">0</property>
@ -5738,7 +5759,7 @@ Other</property>
<property name="active">False</property> <property name="active">False</property>
<property name="inconsistent">False</property> <property name="inconsistent">False</property>
<property name="draw_indicator">True</property> <property name="draw_indicator">True</property>
<property name="group">existing</property> <property name="group">recent</property>
</widget> </widget>
<packing> <packing>
<property name="padding">0</property> <property name="padding">0</property>