diff --git a/src/AddMedia.py b/src/AddMedia.py
index b96a2f8a0..df92379af 100644
--- a/src/AddMedia.py
+++ b/src/AddMedia.py
@@ -63,6 +63,7 @@ class AddMediaObject:
self.description = self.glade.get_widget("photoDescription")
self.image = self.glade.get_widget("image")
self.update = update
+ self.temp_name = ""
self.glade.signal_autoconnect({
"on_savephoto_clicked" : self.on_savephoto_clicked,
@@ -104,6 +105,15 @@ class AddMediaObject:
def on_name_changed(self,obj):
filename = self.glade.get_widget("fname").get_text()
+
+ basename = os.path.basename(filename)
+ (root,ext) = os.path.splitext(basename)
+ old_title = self.description.get_text()
+
+ if old_title == "" or old_title == self.temp_name:
+ self.description.set_text(root)
+ self.temp_name = root
+
if os.path.isfile(filename):
type = utils.get_mime_type(filename)
if type[0:5] == "image":
diff --git a/src/Config.py b/src/Config.py
index d77cb6f85..a805c624b 100644
--- a/src/Config.py
+++ b/src/Config.py
@@ -793,7 +793,21 @@ def get_config_color(name,defval):
return defval
else:
return (r,g,b)
-
+
+def get_sort_cols(name,col,dir):
+ c = get_int("/gramps/sort/%s_col" % name)
+ if c == None:
+ c = col
+ d = get_int("/gramps/sort/%s_dir" % name)
+ if d == None:
+ d = dir
+ return (c,d)
+
+def save_sort_cols(name,col,dir):
+ set_int("/gramps/sort/%s_col" % name, col)
+ set_int("/gramps/sort/%s_dir" % name, dir)
+ sync()
+
#-------------------------------------------------------------------------
#
#
diff --git a/src/ImageSelect.py b/src/ImageSelect.py
index d1769b7dc..c932aa7b3 100644
--- a/src/ImageSelect.py
+++ b/src/ImageSelect.py
@@ -81,6 +81,7 @@ class ImageSelect:
self.image = self.glade.get_widget("image")
self.description = self.glade.get_widget("photoDescription")
self.external = self.glade.get_widget("private")
+ self.temp_name = ""
self.glade.signal_autoconnect({
"on_savephoto_clicked" : self.on_savephoto_clicked,
@@ -99,6 +100,15 @@ class ImageSelect:
#-------------------------------------------------------------------------
def on_name_changed(self, obj):
filename = self.fname.get_text()
+
+ basename = os.path.basename(filename)
+ (root,ext) = os.path.splitext(basename)
+ old_title = self.description.get_text()
+
+ if old_title == "" or old_title == self.temp_name:
+ self.description.set_text(root)
+ self.temp_name = root
+
if os.path.isfile(filename):
type = utils.get_mime_type(filename)
if type[0:5] == "image":
@@ -114,7 +124,7 @@ class ImageSelect:
#-------------------------------------------------------------------------
def on_savephoto_clicked(self, obj):
filename = self.glade.get_widget("photosel").get_full_path(0)
- description = self.glade.get_widget("photoDescription").get_text()
+ description = self.description.get_text()
if os.path.exists(filename) == 0:
GnomeErrorDialog(_("That is not a valid file name."));
diff --git a/src/MediaView.py b/src/MediaView.py
index 43e23d50c..acbe5ffb8 100644
--- a/src/MediaView.py
+++ b/src/MediaView.py
@@ -51,8 +51,6 @@ class MediaView:
self.sort_arrow = [self.mdescr_arrow, self.mid_arrow,
self.mtype_arrow, self.mpath_arrow]
self.sort_map = [5,1,2,3,-1]
- self.sort_col = 5
- self.sort_dir = GTK.SORT_ASCENDING
self.media_list.connect('click-column',self.click_column)
self.mid_arrow.hide()
@@ -76,6 +74,24 @@ class MediaView:
self.media_list.set_column_visibility(5,0)
self.media_list.connect('button-press-event',self.on_button_press_event)
+ # Restore the previous sort column
+
+ self.sort_col,self.sort_dir = Config.get_sort_cols("media",0,GTK.SORT_ASCENDING)
+ self.media_list.set_sort_type(self.sort_dir)
+ self.media_list.set_sort_column(self.sort_map[self.sort_col])
+ self.set_arrow(self.sort_col)
+
+ def set_arrow(self,column):
+ for a in self.sort_arrow:
+ a.hide()
+
+ a = self.sort_arrow[column]
+ a.show()
+ if self.sort_dir == GTK.SORT_ASCENDING:
+ a.set(GTK.ARROW_DOWN,2)
+ else:
+ a.set(GTK.ARROW_UP,2)
+
def click_column(self,obj,column):
new_col = self.sort_map[column]
@@ -95,19 +111,12 @@ class MediaView:
else:
self.sort_dir = GTK.SORT_ASCENDING
- for a in self.sort_arrow:
- a.hide()
-
- a = self.sort_arrow[column]
- a.show()
- if self.sort_dir == GTK.SORT_ASCENDING:
- a.set(GTK.ARROW_DOWN,2)
- else:
- a.set(GTK.ARROW_UP,2)
-
+ self.set_arrow(column)
+
obj.set_sort_type(self.sort_dir)
obj.set_sort_column(new_col)
- self.sort_col = new_col
+ self.sort_col = column
+ Config.save_sort_cols("media",self.sort_col,self.sort_dir)
obj.sort()
if data:
row = obj.find_row_from_data(data)
diff --git a/src/PlaceView.py b/src/PlaceView.py
index c67567b9b..e12bf2e8c 100644
--- a/src/PlaceView.py
+++ b/src/PlaceView.py
@@ -45,12 +45,9 @@ class PlaceView:
self.country_arrow = glade.get_widget("country_arrow")
self.update_display= update
- self.place_arrows = [ self.place_arrow, self.place_id_arrow, self.parish_arrow,
- self.city_arrow, self.county_arrow, self.state_arrow,
- self.country_arrow ]
-
- self.sort_column = 0
- self.sort_direct = GTK.SORT_ASCENDING
+ self.sort_arrow = [ self.place_arrow, self.place_id_arrow, self.parish_arrow,
+ self.city_arrow, self.county_arrow, self.state_arrow,
+ self.country_arrow ]
self.place_list.set_column_visibility(7,0)
self.place_list.set_column_visibility(8,0)
@@ -59,12 +56,17 @@ class PlaceView:
self.place_list.set_column_visibility(11,0)
self.place_list.set_column_visibility(12,0)
self.place_list.set_column_visibility(13,0)
- self.place_list.set_sort_column(self.sort_column+7)
- self.place_list.set_sort_type(self.sort_direct)
self.place_list.connect('button-press-event',self.on_button_press_event)
self.place_list.connect('select-row',self.select_row)
self.active = None
+ # Restore the previous sort column
+
+ self.sort_col,self.sort_dir = Config.get_sort_cols("place",0,GTK.SORT_ASCENDING)
+ self.place_list.set_sort_column(self.sort_col+7)
+ self.place_list.set_sort_type(self.sort_dir)
+ self.set_arrow(self.sort_col)
+
def load_places(self):
if len(self.place_list.selection) == 0:
current_row = 0
@@ -126,6 +128,17 @@ class PlaceView:
EditPlace.EditPlace(self.active,self.db,
self.update_display_after_edit)
+ def set_arrow(self,column):
+ for a in self.sort_arrow:
+ a.hide()
+
+ a = self.sort_arrow[column]
+ a.show()
+ if self.sort_dir == GTK.SORT_ASCENDING:
+ a.set(GTK.ARROW_DOWN,2)
+ else:
+ a.set(GTK.ARROW_UP,2)
+
def on_click_column(self,obj,column):
obj.freeze()
if len(obj.selection):
@@ -133,23 +146,22 @@ class PlaceView:
else:
sel = None
- for a in self.place_arrows:
+ for a in self.sort_arrow:
a.hide()
- arrow = self.place_arrows[column]
- if self.sort_column == column:
+ arrow = self.sort_arrow[column]
+ if self.sort_col == column:
if self.sort_direct == GTK.SORT_DESCENDING:
self.sort_direct = GTK.SORT_ASCENDING
- arrow.set(GTK.ARROW_DOWN,2)
else:
self.sort_direct = GTK.SORT_DESCENDING
- arrow.set(GTK.ARROW_UP,2)
else:
self.sort_direct = GTK.SORT_ASCENDING
- arrow.set(GTK.ARROW_DOWN,2)
- self.sort_column = column
+ self.sort_col = column
+ self.set_arrow(column)
self.place_list.set_sort_type(self.sort_direct)
- self.place_list.set_sort_column(self.sort_column + 7)
- arrow.show()
+ self.place_list.set_sort_column(self.sort_col + 7)
+ Config.save_sort_cols("place",self.sort_col,self.sort_direct)
+
self.place_list.sort()
if sel:
self.place_list.moveto(self.place_list.find_row_from_data(sel))
diff --git a/src/SourceView.py b/src/SourceView.py
index 77127c4d4..8737a9d3d 100644
--- a/src/SourceView.py
+++ b/src/SourceView.py
@@ -66,11 +66,26 @@ class SourceView:
self.id_arrow.hide()
self.author_arrow.hide()
self.sort_map = [3,1,4,-1]
- self.sort_dir = GTK.SORT_ASCENDING
- self.sort_col = 3
self.sort_arrow = [self.title_arrow, self.id_arrow, self.author_arrow]
self.source_list.connect('click-column',self.click_column)
+
+ self.sort_col,self.sort_dir = Config.get_sort_cols("source",3,GTK.SORT_ASCENDING)
+ self.source_list.set_sort_type(self.sort_dir)
+ self.source_list.set_sort_column(self.sort_map[self.sort_col])
+ self.set_arrow(self.sort_col)
+
+ def set_arrow(self,column):
+ for a in self.sort_arrow:
+ a.hide()
+
+ a = self.sort_arrow[column]
+ a.show()
+ if self.sort_dir == GTK.SORT_ASCENDING:
+ a.set(GTK.ARROW_DOWN,2)
+ else:
+ a.set(GTK.ARROW_UP,2)
+
def click_column(self,obj,column):
new_col = self.sort_map[column]
@@ -90,19 +105,12 @@ class SourceView:
else:
self.sort_dir = GTK.SORT_ASCENDING
- for a in self.sort_arrow:
- a.hide()
-
- a = self.sort_arrow[column]
- a.show()
- if self.sort_dir == GTK.SORT_ASCENDING:
- a.set(GTK.ARROW_DOWN,2)
- else:
- a.set(GTK.ARROW_UP,2)
+ self.set_arrow(column)
obj.set_sort_type(self.sort_dir)
obj.set_sort_column(new_col)
self.sort_col = new_col
+ Config.save_sort_cols("source",self.sort_col,self.sort_dir)
obj.sort()
if data:
row = obj.find_row_from_data(data)
diff --git a/src/gramps.glade b/src/gramps.glade
index c4f6fe29a..ee4e0e6ac 100644
--- a/src/gramps.glade
+++ b/src/gramps.glade
@@ -3339,32 +3339,6 @@
-
- GtkLabel
- label271
-
- GTK_JUSTIFY_CENTER
- False
- 0.5
- 0.5
- 0
- 0
-
- 1
- 2
- 2
- 3
- 0
- 0
- False
- False
- False
- False
- True
- False
-
-
-
GtkLabel
label272
@@ -3573,32 +3547,6 @@
-
- GtkLabel
- label266
-
- GTK_JUSTIFY_CENTER
- False
- 1
- 0
- 0
- 2
-
- 0
- 1
- 2
- 3
- 5
- 0
- False
- False
- False
- False
- True
- False
-
-
-
GtkLabel
label265
@@ -3703,6 +3651,58 @@
False
+
+
+ GtkLabel
+ label266
+
+ GTK_JUSTIFY_CENTER
+ False
+ 1
+ 0
+ 0
+ 2
+
+ 0
+ 1
+ 2
+ 3
+ 5
+ 0
+ False
+ True
+ False
+ False
+ True
+ True
+
+
+
+
+ GtkLabel
+ label271
+
+ GTK_JUSTIFY_CENTER
+ False
+ 0.5
+ 0
+ 0
+ 0
+
+ 1
+ 2
+ 2
+ 3
+ 0
+ 0
+ False
+ True
+ False
+ False
+ True
+ True
+
+
diff --git a/src/gramps_main.py b/src/gramps_main.py
index bd1fe40ec..e87746fe6 100755
--- a/src/gramps_main.py
+++ b/src/gramps_main.py
@@ -111,7 +111,7 @@ deathArrow = None
dateArrow = None
merge_button = None
-sort_column = 5
+sort_column = 0
sort_direct = SORT_ASCENDING
DataFilter = Filter.Filter("")
c_birth_order = 0
@@ -156,7 +156,6 @@ def find_goto_to(person):
#-------------------------------------------------------------------------
def on_merge_activate(obj):
"""Calls up the merge dialog for the selection"""
-
page = notebook.get_current_page()
if page == 0:
if len(person_list.selection) != 2:
@@ -729,39 +728,42 @@ def on_person_list_select_row(obj,row,b,c):
# orientation, and then call apply_filter to redraw the list
#
#-------------------------------------------------------------------------
+
def on_person_list_click_column(obj,column):
- if column == 0:
- change_sort(5,nameArrow)
- elif column == 1:
- change_sort(1,idArrow)
- elif column == 2:
- change_sort(2,genderArrow)
- elif column == 3:
- change_sort(6,dateArrow)
- elif column == 4:
- change_sort(7,deathArrow)
- else:
- return
-
- sort_person_list()
- if id2col.has_key(active_person):
- row = person_list.find_row_from_data(id2col[active_person])
- person_list.moveto(row)
+ change_sort(column)
#-------------------------------------------------------------------------
#
#
#
#-------------------------------------------------------------------------
-def change_sort(column,arrow):
- global sort_direct
- global sort_column
+col_map = [ 5, 1, 2, 6, 7 ]
- for a in [ nameArrow, genderArrow, deathArrow, dateArrow, idArrow ]:
+def set_sort_arrow(column,direct):
+ col_arr = [ nameArrow, idArrow, genderArrow, dateArrow, deathArrow]
+
+ arrow = col_arr[column]
+ for a in col_arr:
if arrow != a:
a.hide()
arrow.show()
+ if direct == SORT_ASCENDING:
+ arrow.set(GTK.ARROW_DOWN,2)
+ else:
+ arrow.set(GTK.ARROW_UP,2)
+def change_sort(column):
+ global sort_direct
+ global sort_column
+
+ col_arr = [ nameArrow, idArrow, genderArrow, dateArrow, deathArrow]
+
+ arrow = col_arr[column]
+ for a in col_arr:
+ if arrow != a:
+ a.hide()
+ arrow.show()
+
if sort_column == column:
if sort_direct == SORT_DESCENDING:
sort_direct = SORT_ASCENDING
@@ -773,8 +775,15 @@ def change_sort(column,arrow):
sort_direct = SORT_ASCENDING
arrow.set(GTK.ARROW_DOWN,2)
sort_column = column
+
+ person_list.set_sort_column(col_map[column])
person_list.set_sort_type(sort_direct)
- person_list.set_sort_column(sort_column)
+
+ sort_person_list()
+ if id2col.has_key(active_person):
+ row = person_list.find_row_from_data(id2col[active_person])
+ person_list.moveto(row)
+ Config.save_sort_cols("person",sort_column,sort_direct)
#-------------------------------------------------------------------------
#
@@ -1855,6 +1864,7 @@ def main(arg):
global topWindow, preview, merge_button
global nameArrow, dateArrow, deathArrow, idArrow, genderArrow
global cNameArrow, cDateArrow
+ global sort_column, sort_direct
rc_parse(const.gtkrcFile)
database = RelDataBase()
@@ -1864,6 +1874,8 @@ def main(arg):
Filter.load_filters(const.filtersDir)
Filter.load_filters(os.path.expanduser("~/.gramps/filters"))
+ (sort_column,sort_direct) = Config.get_sort_cols("person",sort_column,sort_direct)
+
gtop = libglade.GladeXML(const.gladeFile, "gramps")
Plugins.build_report_menu(gtop.get_widget("reports_menu"),menu_report)
@@ -1896,9 +1908,6 @@ def main(arg):
person_list.set_column_visibility(5,0)
person_list.set_column_visibility(6,0)
person_list.set_column_visibility(7,0)
- person_list.set_sort_column(sort_column)
- person_list.set_sort_type(sort_direct)
-
fw = gtop.get_widget('filter')
filter_list.set_menu(Filter.build_filter_menu(on_filter_name_changed,fw))
@@ -1908,6 +1917,9 @@ def main(arg):
topWindow.set_icon(GtkPixmap(topWindow,const.icon))
person_list.column_titles_active()
+ set_sort_arrow(sort_column,sort_direct)
+
+ Config.loadConfig(full_update)
gtop.signal_autoconnect({
"delete_event" : delete_event,
@@ -1986,7 +1998,6 @@ def main(arg):
"on_writing_extensions_activate" : on_writing_extensions_activate,
})
- Config.loadConfig(full_update)
person_list.set_column_visibility(1,Config.id_visible)
notebook.set_show_tabs(Config.usetabs)
diff --git a/src/imagesel.glade b/src/imagesel.glade
index 2497a35c4..1144abb5d 100644
--- a/src/imagesel.glade
+++ b/src/imagesel.glade
@@ -232,7 +232,7 @@
GtkLabel
label118
-
+
GTK_JUSTIFY_CENTER
False
1
@@ -502,58 +502,6 @@
0
0
-
- GtkLabel
- label126
-
- GTK_JUSTIFY_CENTER
- False
- 1
- 0.5
- 5
- 5
-
- 0
- 1
- 1
- 2
- 0
- 0
- False
- False
- False
- False
- True
- False
-
-
-
-
- GtkLabel
- label128
-
- GTK_JUSTIFY_CENTER
- False
- 0
- 0.5
- 0
- 0
-
- 1
- 2
- 1
- 2
- 0
- 0
- False
- False
- False
- False
- True
- False
-
-
-
GtkLabel
label129
@@ -609,9 +557,10 @@
GtkLabel
description
+ 350
- GTK_JUSTIFY_CENTER
- False
+ GTK_JUSTIFY_LEFT
+ True
0
0.5
0
@@ -636,7 +585,7 @@
GtkLabel
path
- GTK_JUSTIFY_CENTER
+ GTK_JUSTIFY_LEFT
False
0
0.5
@@ -836,6 +785,58 @@
False
+
+
+ GtkLabel
+ label126
+
+ GTK_JUSTIFY_CENTER
+ False
+ 1
+ 0
+ 5
+ 5
+
+ 0
+ 1
+ 1
+ 2
+ 0
+ 0
+ False
+ True
+ False
+ False
+ True
+ True
+
+
+
+
+ GtkLabel
+ label128
+
+ GTK_JUSTIFY_CENTER
+ False
+ 0
+ 0
+ 0
+ 5
+
+ 1
+ 2
+ 1
+ 2
+ 0
+ 0
+ False
+ True
+ False
+ False
+ True
+ True
+
+
@@ -1683,7 +1684,7 @@
GtkLabel
label148
-
+
GTK_JUSTIFY_CENTER
False
1