News

October 2009 : a new release (bibus 1.5.0)

  • OOo3.1 compatibility
  • Infinite number of file/http links
  • Clever capitalization (lord of war => Lord of War ...)
  • Better handling of journal abbreviations
  • Import/Export filters can be added easily (plugin)
  • journal abbreviations and shortcuts can be easily edited (simple csv file that can be edited in OOo/excel or a text editor)
  • Lot of bug fixes
  • Requires python2.5 (not a problem anymore under Windows since OOo3.1 includes 2.6)
  • Requires wxpython-2.8

Bibus modifications

From Bibus

Jump to: navigation, search


Contents

Introduction

Here are some things you can do by modifying the bibus source code. You can only apply these mods if you use the bibus source distribution (not the win32 exe version). Indentation (tabs, spaces) is very important for python code. Unfortunately, crucial formatting rarely survives copy-paste operations from the web browser to a text-editor (At least with my setup). The bibus code uses tabs. It is important that the number of tabs before each code statement is correct. The modified code should look like what is displayed here (indentation-wise).

copy and rename source file when URL is inserted (bibus 1.2/win)

This mod changes the action bibus takes when you click on the 'URL/file' button in the reference editor window. As with the standard bibus version the fileselect box appears and you have to select the source file (pdf,doc etc). Now instead of simply inserting the filename into the URL field, the selected file is copied to a central location first and renamed. The new filename is the 'id' field (number) of the selected reference padded with zeros to give an 8-digit filename ('00004567.pdf'). Since the reference 'id' is unique, so will be all filenames. This avoids problems with files spread all over the harddisc and duplicate name issues. However there is one drawback with this implementation: Adding an url to a new reference doesn't work. You must first create the ref without url, press ok and then edit it a second time to add the url.

Instructions:

  1. copy-paste the code below into a text editor and save the file as 'urlhandling.py' in the bibus directory.
  2. change the line
    destdir = "\\\\sissi2\\common\\bibus\\files\\"
    to match your directory where you want to have your article pdf/doc files. A single backslash needs to be entered as double backslash ('\\')
  3. change the following part of RefEditor.py:
def getURL(self,event):
		"""Select a file containing the reference"""
		filename = wxFileSelector(_("Please select the file"),BIB.FILES,wildcard=\
		"%s (*.pdf)|*.pdf|%s (*.sxw)|*.sxw|%s (*.doc)|*.doc|%s (*.*)|*.*"\
		%(_("Acrobat file"),\
		_("OpenOffice.org Text Document"),\
		_("Microsoft Word Document"),\
		_("All files")), parent=self )
		if filename:
			if BIB.FILES:
				if not BIB.FILES.endswith(os.sep): BIB.FILES = BIB.FILES   os.sep	# we add / at the end
				if filename.startswith(BIB.FILES):	# We replace the default directory with $FILES
					filename = filename.replace(BIB.FILES,'',1)
					filename = os.path.join('$FILES',filename)
			self.value['URL'].SetValue( urlparse.urlunparse(('file','', filename, '', '', '')) )

into (2 lines added after 'if filename:'):

def getURL(self,event):
		"""Select a file containing the reference"""
		filename = wxFileSelector(_("Please select the file"),BIB.FILES,wildcard=\
		"%s (*.pdf)|*.pdf|%s (*.sxw)|*.sxw|%s (*.doc)|*.doc|%s (*.*)|*.*"\
		%(_("Acrobat file"),\
		_("OpenOffice.org Text Document"),\
		_("Microsoft Word Document"),\
		_("All files")), parent=self )
		if filename:
			import urlhandling
			filename = urlhandling.copy_and_rename(filename, self.ref_id[0])
			if BIB.FILES:
				if not BIB.FILES.endswith(os.sep): BIB.FILES = BIB.FILES   os.sep	# we add / at the end
				if filename.startswith(BIB.FILES):	# We replace the default directory with $FILES
					filename = filename.replace(BIB.FILES,'',1)
					filename = os.path.join('$FILES',filename)
			self.value['URL'].SetValue( urlparse.urlunparse(('file','', filename, '', '', '')) )
# urhandling.py

import shutil

def copy_and_rename(filename,id):
	destdir = "\\\\sissi2\\common\\bibus\\files\\"
	tmp = filename.split('.')
	suf = tmp[-1]
	newname = "%d" % (id)
	newname = destdir + newname + '.' + suf
	shutil.copyfile(filename,newname)

	return newname

That's it! If something goes wrong you can always go back by overwriting the modified 'RefEditor.py' with the one from the bibus source distribution.

Use Gnome's default applications to open URLs (Bibus 1.4.3/Ubuntu 8.10)

Currently Bibus uses Python's webbrowser module to launch all URLs in the system's default web browser. In the Gnome desktop environment however, a more versatile option is available: gnome-open

After replacing this line in RefList.py

webbrowser.open( ":".join( (urltype,urllib.quote(urlpath.replace("$FILES",BIB.FILES).encode(BIB.ENCODING,BIB.ENC_ERRORS)) )), new=1 )

with this line,

os.system("gnome-open " + ":".join( (urltype,urllib.quote(urlpath.replace("$FILES",BIB.FILES).encode(BIB.ENCODING,BIB.ENC_ERRORS)) )) )

the "Open URL" command should more intelligently select an appropriate application to use. On my system for example, web addresses are still opened in the default web browser, but PDFs now use my computer's default PDF viewer, Foxit Reader.

Personal tools