* src/DbPrompter.py (DbPrompter): Use Combo to list multiple rcecent files
* src/gramps.glade: Use Combo to list multiple rcecent files svn: r5381
This commit is contained in:
parent
246aa995a6
commit
666cc08475
@ -1,3 +1,7 @@
|
||||
2005-11-09 Martin Hawlisch <Martin.Hawlisch@gmx.de>
|
||||
* src/DbPrompter.py (DbPrompter): Use Combo to list multiple rcecent files
|
||||
* src/gramps.glade: Use Combo to list multiple rcecent files
|
||||
|
||||
2005-11-08 Martin Hawlisch <Martin.Hawlisch@gmx.de>
|
||||
* src/DbPrompter.py (DbPrompter): Give possibility to open
|
||||
the recent file
|
||||
|
@ -96,28 +96,42 @@ class DbPrompter:
|
||||
recent = opendb.get_widget("recent")
|
||||
existing = opendb.get_widget("existing")
|
||||
new = opendb.get_widget("new")
|
||||
filelist = opendb.get_widget("filelist")
|
||||
|
||||
# write in recent file
|
||||
# write in recent file into UI
|
||||
gramps_rf = RecentFiles.GrampsRecentFiles()
|
||||
gramps_rf.gramps_recent_files.sort()
|
||||
gramps_rf.gramps_recent_files.reverse()
|
||||
self.recent_files = []
|
||||
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:
|
||||
# if recent files have been stored
|
||||
cell = gtk.CellRendererText()
|
||||
filelist.pack_start(cell,True)
|
||||
filelist.add_attribute(cell,'text',0)
|
||||
store = gtk.ListStore(str)
|
||||
for item in gramps_rf.gramps_recent_files:
|
||||
try:
|
||||
filename = os.path.basename(item.get_path())
|
||||
filetype = get_mime_type(item.get_path())
|
||||
node = store.append()
|
||||
store.set(node,0,unicode(filename))
|
||||
self.recent_files.append( (item.get_path(), filetype))
|
||||
except RuntimeError:
|
||||
pass # ignore no longer existing files
|
||||
if self.recent_files:
|
||||
filelist.set_model(store)
|
||||
filelist.set_active(0)
|
||||
else:
|
||||
recent.set_sensitive(False)
|
||||
self.recent_file = None
|
||||
filelist.set_sensitive(False)
|
||||
else:
|
||||
recent.set_sensitive(False)
|
||||
self.recent_file = None
|
||||
filelist.set_sensitive(False)
|
||||
|
||||
if want_new:
|
||||
new.set_active(True)
|
||||
else:
|
||||
if not self.recent_file:
|
||||
if not self.recent_files:
|
||||
existing.set_active(True)
|
||||
|
||||
while 1:
|
||||
@ -127,13 +141,13 @@ class DbPrompter:
|
||||
if response == gtk.RESPONSE_OK:
|
||||
if recent.get_active():
|
||||
try:
|
||||
if open_native(self.parent,self.recent_file,self.recent_filetype):
|
||||
(filename,filetype) = self.recent_files[filelist.get_active()]
|
||||
if open_native(self.parent,filename,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,
|
||||
|
@ -5707,17 +5707,43 @@ Other</property>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkRadioButton" id="recent">
|
||||
<property name="border_width">5</property>
|
||||
<widget class="GtkHBox" id="hbox107">
|
||||
<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>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">0</property>
|
||||
|
||||
<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>
|
||||
<widget class="GtkComboBox" id="filelist">
|
||||
<property name="visible">True</property>
|
||||
<property name="add_tearoffs">False</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
|
Loading…
Reference in New Issue
Block a user