Added support for default directories.

svn: r190
This commit is contained in:
Don Allingham 2001-06-28 15:20:41 +00:00
parent 7d3b6d8873
commit 4be37b520e
2 changed files with 196 additions and 10 deletions

View File

@ -97,6 +97,8 @@ attr_name = ""
status_bar = 0
paper_preference = None
output_preference = None
report_dir = "."
db_dir = "."
#-------------------------------------------------------------------------
#
@ -148,6 +150,8 @@ def loadConfig(call):
global _callback
global paper_preference
global output_preference
global report_dir
global db_dir
global status_bar
_callback = call
@ -166,6 +170,14 @@ def loadConfig(call):
output_preference = gnome.config.get_string("/gramps/config/outputPreference")
_name_format = gnome.config.get_int("/gramps/config/nameFormat")
report_dir = gnome.config.get_string("/gramps/config/ReportDirectory")
db_dir = gnome.config.get_string("/gramps/config/DbDirectory")
if report_dir == None:
report_dir = "."
if db_dir == None:
db_dir = "."
name = gnome.config.get_string("/gramps/researcher/name")
addr = gnome.config.get_string("/gramps/researcher/addr")
city = gnome.config.get_string("/gramps/researcher/city")
@ -298,6 +310,8 @@ def on_propertybox_apply(obj,page):
global paper_preference
global output_preference
global show_detail
global report_dir
global db_dir
if page != -1:
return
@ -317,7 +331,15 @@ def on_propertybox_apply(obj,page):
status_bar = 1
else:
status_bar = 2
dbdir_temp = prefsTop.get_widget("dbdir").get_full_path(1)
if os.path.isdir(dbdir_temp):
dbdir = dbdir_temp
repdir_temp = prefsTop.get_widget("repdir").get_full_path(1)
if os.path.isdir(repdir_temp):
repdir = repdir_temp
paper_preference = paper_obj.get_data("d")
output_preference = output_obj.get_data("d")
@ -330,6 +352,8 @@ def on_propertybox_apply(obj,page):
gnome.config.set_string("/gramps/config/outputPreference",output_preference)
gnome.config.set_bool("/gramps/config/autoLoad",autoload)
gnome.config.set_bool("/gramps/config/DisplayAltNames",hide_altnames)
gnome.config.set_string("/gramps/config/ReportDirectory",repdir)
gnome.config.set_string("/gramps/config/DbDirectory",dbdir)
# search for the active date format selection
@ -569,6 +593,9 @@ def display_preferences_box():
prefsTop.get_widget(ODDBGCOLOR).set_sensitive(ListColors.get_enable())
prefsTop.get_widget(EVENBGCOLOR).set_sensitive(ListColors.get_enable())
prefsTop.get_widget(EVENFGCOLOR).set_sensitive(ListColors.get_enable())
prefsTop.get_widget("dbdir").gtk_entry().set_text(db_dir)
prefsTop.get_widget("repdir").gtk_entry().set_text(report_dir)
pbox.set_modified(0)
pbox.show()

View File

@ -212,7 +212,7 @@
<widget>
<class>GtkTable</class>
<name>table23</name>
<rows>3</rows>
<rows>2</rows>
<columns>2</columns>
<homogeneous>False</homogeneous>
<row_spacing>0</row_spacing>
@ -282,8 +282,8 @@
<right_attach>2</right_attach>
<top_attach>0</top_attach>
<bottom_attach>1</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xpad>5</xpad>
<ypad>5</ypad>
<xexpand>True</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
@ -305,8 +305,8 @@
<right_attach>2</right_attach>
<top_attach>1</top_attach>
<bottom_attach>2</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xpad>5</xpad>
<ypad>5</ypad>
<xexpand>True</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
@ -333,7 +333,7 @@
<widget>
<class>GtkTable</class>
<name>table24</name>
<rows>2</rows>
<rows>1</rows>
<columns>2</columns>
<homogeneous>False</homogeneous>
<row_spacing>0</row_spacing>
@ -377,8 +377,8 @@
<right_attach>2</right_attach>
<top_attach>0</top_attach>
<bottom_attach>1</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xpad>5</xpad>
<ypad>5</ypad>
<xexpand>True</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
@ -1343,7 +1343,7 @@
<widget>
<class>GtkTable</class>
<name>table25</name>
<rows>3</rows>
<rows>2</rows>
<columns>2</columns>
<homogeneous>False</homogeneous>
<row_spacing>0</row_spacing>
@ -1464,6 +1464,165 @@ AbiWord
<xpad>0</xpad>
<ypad>0</ypad>
</widget>
<widget>
<class>GtkTable</class>
<name>table26</name>
<rows>2</rows>
<columns>2</columns>
<homogeneous>False</homogeneous>
<row_spacing>0</row_spacing>
<column_spacing>0</column_spacing>
<widget>
<class>GtkLabel</class>
<name>label206</name>
<label>Default report directory</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>1</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
<child>
<left_attach>0</left_attach>
<right_attach>1</right_attach>
<top_attach>1</top_attach>
<bottom_attach>2</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>False</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>False</yfill>
</child>
</widget>
<widget>
<class>GnomeFileEntry</class>
<name>dbdir</name>
<history_id>dbdir</history_id>
<max_saved>10</max_saved>
<title>Gramps - Select default database directory</title>
<directory>True</directory>
<modal>False</modal>
<child>
<left_attach>1</left_attach>
<right_attach>2</right_attach>
<top_attach>0</top_attach>
<bottom_attach>1</bottom_attach>
<xpad>5</xpad>
<ypad>5</ypad>
<xexpand>True</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>False</yfill>
</child>
<widget>
<class>GtkEntry</class>
<child_name>GnomeEntry:entry</child_name>
<name>combo-entry1</name>
<tooltip>The default directory for storing databases</tooltip>
<can_focus>True</can_focus>
<signal>
<name>changed</name>
<handler>on_object_toggled</handler>
<object>propertybox</object>
<last_modification_time>Thu, 28 Jun 2001 13:50:08 GMT</last_modification_time>
</signal>
<editable>True</editable>
<text_visible>True</text_visible>
<text_max_length>0</text_max_length>
<text></text>
</widget>
</widget>
<widget>
<class>GnomeFileEntry</class>
<name>repdir</name>
<history_id>repdir</history_id>
<max_saved>10</max_saved>
<title>Gramps - Select default report directory</title>
<directory>True</directory>
<modal>False</modal>
<child>
<left_attach>1</left_attach>
<right_attach>2</right_attach>
<top_attach>1</top_attach>
<bottom_attach>2</bottom_attach>
<xpad>5</xpad>
<ypad>5</ypad>
<xexpand>True</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>False</yfill>
</child>
<widget>
<class>GtkEntry</class>
<child_name>GnomeEntry:entry</child_name>
<name>entry1</name>
<tooltip>The default directory for the output of many report generators</tooltip>
<can_focus>True</can_focus>
<signal>
<name>changed</name>
<handler>on_object_toggled</handler>
<object>propertybox</object>
<last_modification_time>Thu, 28 Jun 2001 13:49:30 GMT</last_modification_time>
</signal>
<editable>True</editable>
<text_visible>True</text_visible>
<text_max_length>0</text_max_length>
<text></text>
</widget>
</widget>
<widget>
<class>GtkLabel</class>
<name>label205</name>
<label>Default database directory</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>1</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
<child>
<left_attach>0</left_attach>
<right_attach>1</right_attach>
<top_attach>0</top_attach>
<bottom_attach>1</bottom_attach>
<xpad>5</xpad>
<ypad>5</ypad>
<xexpand>False</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>False</yfill>
</child>
</widget>
</widget>
<widget>
<class>GtkLabel</class>
<child_name>Notebook:tab</child_name>
<name>label207</name>
<label>Directories</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
</widget>
</widget>
</widget>