2008-01-12 Benny Malengier <benny.malengier@gramps-project.org>

* src/GrampsDisplay.py: open url in standard way
	* src/gramps.py: add comment on use of import gnome
	* README:
	* INSTALL:
	Remove need for gconf, add need for xdg utilities



svn: r9788
This commit is contained in:
Benny Malengier 2008-01-13 00:48:03 +00:00
parent 3dbb428759
commit a6fe002719
5 changed files with 74 additions and 47 deletions

View File

@ -1,3 +1,10 @@
2008-01-12 Benny Malengier <benny.malengier@gramps-project.org>
* src/GrampsDisplay.py: open url in standard way
* src/gramps.py: add comment on use of import gnome
* README:
* INSTALL:
Remove need for gconf, add need for xdg utilities
2008-01-12 Raphael Ackermann <raphael.ackermann@gmail.com> 2008-01-12 Raphael Ackermann <raphael.ackermann@gmail.com>
* src/Config/__init__.py: revert wrong indentation changes * src/Config/__init__.py: revert wrong indentation changes

35
INSTALL
View File

@ -24,16 +24,17 @@ missing.
Regular vs local installation Regular vs local installation
----------------------------- -----------------------------
This version of gramps requires, among others, the two things to be done: This version of gramps requires, among others, the following to be done:
gconf schemas and mime types for gramps MUST be properly installed.
mime types for gramps MUST be properly installed.
The usual ./configure, make, and make install as a root should do the trick. The usual ./configure, make, and make install as a root should do the trick.
But be careful if you're using the non-default options or would like But be careful if you're using the non-default options or would like
to install without being root. to install without being root.
The latter is possible, but you should supply additional arguments to The latter is possible, but you should supply additional arguments to
autogen or configure: autogen or configure:
--with-gconf-source=xml::$HOME/.gconf
--with-gconf-schema-file-dir=$HOME
--with-mime-dir=$HOME/.local/share/mime --with-mime-dir=$HOME/.local/share/mime
--disable-scrollkeeper --disable-scrollkeeper
Most likely, such local install will also need some prefix with write Most likely, such local install will also need some prefix with write
@ -41,30 +42,21 @@ permissions for you:
--prefix=$HOME/my_gramps_path --prefix=$HOME/my_gramps_path
Whether you're doing local install or regular install, Whether you're doing local install or regular install,
YOU MUST INSTALL GCONF SCHEMAS AND MIME TYPES. YOU MUST INSTALL MIME TYPES.
YOU HAVE BEEN WARNED! YOU HAVE BEEN WARNED!
Installing under non-default prefix Installing under non-default prefix
----------------------------------- -----------------------------------
As hinted above, the gconf schemas and mime types for gramps As hinted above, mime types for gramps MUST be properly installed.
MUST be properly installed. The "proper install" means installing The "proper install" means installing
them where gconfd and shared mime system, respectively, will them where the shared mime system will find them.
find them.
By default, gconfd will look in these places:
1. Whatever is returned by running:
$ gconftool-2 --get-default-source
2. The xml::$HOME/.gconf : this is a per-user setup, not system-wide
or xml:merged:$HOME/.gconf : this is a per-user setup, not system-wide
There is a number of ways to let gconfd know where else
to look, but this is outside the scope of installing gramps.
By default, the shared mime systems will look in these places: By default, the shared mime systems will look in these places:
1. /usr/share/mime 1. /usr/share/mime
2. /usr/local/share/mime : this may be broken on some systems 2. /usr/local/share/mime : this may be broken on some systems
3. $HOME/.local/share/mime : this is a per-user setup, not system-wide 3. $HOME/.local/share/mime : this is a per-user setup, not system-wide
Likewise, there's a number of ways to instruct the shared mime system There's a number of ways to instruct the shared mime system
to look in other places, but this is the whole other story. to look in other places, but this is the whole other story.
So if you install some place other than /usr/share, you will most So if you install some place other than /usr/share, you will most
@ -79,16 +71,15 @@ something like --prefix=/usr/local/my_gramps, /var/gramps123/blah, etc.
Packager's issues Packager's issues
------------------ ------------------
The above mentioned gconf schemas and mime types must be installed. The above mime types must be installed.
However, the update-mime-database and the gconftool-2 calls to process However, the update-mime-database to process the newly installed types and schemas must be done in POST-INSTALLATION.
the newly installed types and schemas must be done in POST-INSTALLATION.
In packager's world, the install happens on packager's machine In packager's world, the install happens on packager's machine
into something like /tmp/gramps-tmp. However, the postinstall into something like /tmp/gramps-tmp. However, the postinstall
should happen on the user's machine. should happen on the user's machine.
To assist with that, there's an argument available in configure To assist with that, there's an argument available in configure
(or autogen, which will pass it to configure) which disables (or autogen, which will pass it to configure) which disables
the gconf schema and mime type processing: mime type processing:
--enable-packager-mode --enable-packager-mode
This argument should disable postinstall calls made during This argument should disable postinstall calls made during
make install, and print a nasty warning during configure. make install, and print a nasty warning during configure.

6
README
View File

@ -16,11 +16,15 @@ The following packages are *STRONGLY RECOMMENDED* to be installed:
GraphViz Enable creation of graphs using GraphViz engine GraphViz Enable creation of graphs using GraphViz engine
http://www.graphviz.org http://www.graphviz.org
xdg Freedesktop utilities, eg xdg-open
The following packages are optional The following packages are optional
gtkspell Enable spell checking in the notes gtkspell Enable spell checking in the notes
ttf-freefont More font support in the reports ttf-freefont More font support in the reports
yelp Gnome help browser. You can view our help online too
No longer needed in 3.0:
yelp Gnome help browser. At the moment no help is shipped
with version 3.0.
Documentation Documentation

View File

@ -42,36 +42,55 @@ def help(target, webpage='', section=''):
link + '#' + section link + '#' + section
url(link) url(link)
def url(target): def url(link):
""" """
Open the specified URL in a browser. Attempt using the GNOME system if Open the specified URL in a browser.
available, if not, try to find a browser.
""" """
try: if not run_file(link):
import gnome run_browser(link)
gnome.url_show(target)
except: def run_file(file):
run_browser(target) """
Open a file or url with the default application. This should work
on GNOME, KDE, XFCE, ... as we use a freedesktop application
"""
import os
search = os.environ['PATH'].split(':')
xdgopen = 'xdg-open'
for path in search:
prog = os.path.join(path, xdgopen)
if os.path.isfile(prog):
os.spawnvpe(os.P_NOWAIT, prog, [prog, file], os.environ)
return True
return False
def run_browser(url): def run_browser(url):
""" """
Attempt of find a browswer, and launch with the browser with the Attempt of find a browswer, and launch with the browser with the
specified URL specified URL
Use run_file first!
""" """
import os
search = os.environ['PATH'].split(':')
for browser in ['firefox','konqueror','epiphany','galeon','mozilla']:
for path in search:
prog = os.path.join(path,browser)
if os.path.isfile(prog):
os.spawnvpe(os.P_NOWAIT, prog, [prog, url], os.environ)
return
# If we did not find a browser in the path, try this
try: try:
os.startfile(url) import webbrowser
except: webbrowser.open_new_tab(url)
pass except ImportError:
import os
search = os.environ['PATH'].split(':')
for browser in ['firefox', 'konqueror', 'epiphany',
'galeon', 'mozilla']:
for path in search:
prog = os.path.join(path,browser)
if os.path.isfile(prog):
os.spawnvpe(os.P_NOWAIT, prog, [prog, url], os.environ)
return
# If we did not find a browser in the path, try this
try:
os.startfile(url)
except:
pass

View File

@ -168,6 +168,12 @@ def run():
setup_logging() setup_logging()
try: try:
#This is GNOME initialization code that is necessary for use
# with the other GNOME libraries.
#It only gets called if the user has gnome installed on his/her system.
#There is *no* requirement for it.
#If you don't call this, you are not guaranteed that the other GNOME
#libraries will function properly. I learned this the hard way.
import gnome import gnome
program = gnome.program_init('gramps',const.VERSION, program = gnome.program_init('gramps',const.VERSION,
gnome.libgnome_module_info_get(), gnome.libgnome_module_info_get(),