4 new revisions:
Revision: 0378e51bb1a1
Author: Marcel Stimberg <
marcel...@gmail.com>
Date: Sun Jun 24 05:30:19 2012
Log: remove some no longer needed imports and variables
http://code.google.com/p/gpapers/source/detail?r=0378e51bb1a1
Revision: 41c5057fa2f4
Author: Marcel Stimberg <
marcel...@gmail.com>
Date: Sun Jun 24 05:30:58 2012
Log: add external services to README
http://code.google.com/p/gpapers/source/detail?r=41c5057fa2f4
Revision: 6e9c3a0c0cdd
Author: Marcel Stimberg <
marcel...@gmail.com>
Date: Sun Jun 24 05:59:19 2012
Log: display status message while importing from url
http://code.google.com/p/gpapers/source/detail?r=6e9c3a0c0cdd
Revision: a4b08a034b1e
Author: Marcel Stimberg <
marcel...@gmail.com>
Date: Sun Jun 24 06:26:42 2012
Log: some more status info + maximize window in the beginning
http://code.google.com/p/gpapers/source/detail?r=a4b08a034b1e
==============================================================================
Revision: 0378e51bb1a1
Author: Marcel Stimberg <
marcel...@gmail.com>
Date: Sun Jun 24 05:30:19 2012
Log: remove some no longer needed imports and variables
http://code.google.com/p/gpapers/source/detail?r=0378e51bb1a1
Modified:
/gpapers/__init__.py
/gpapers/gPapers/models.py
/gpapers/importer/__init__.py
/gpapers/importer/bibtex.py
/gpapers/importer/google_scholar.py
/gpapers/importer/jstor.py
/gpapers/importer/pdf_file.py
/gpapers/importer/pubmed.py
=======================================
--- /gpapers/__init__.py Sun Jun 10 08:50:27 2012
+++ /gpapers/__init__.py Sun Jun 24 05:30:19 2012
@@ -20,20 +20,16 @@
# You should have received a copy of the GNU General Public License
# along with gPapers. If not, see <
http://www.gnu.org/licenses/>.
-import commands
from datetime import datetime, timedelta, date
import math
import mimetypes
import os
import sys
import thread
-import threading
-import time
import traceback
from gi.repository import Gio
from gi.repository import GObject
-from gi.repository import GLib
from gi.repository import Gdk
from gi.repository import Gtk
from gi.repository import GdkPixbuf
@@ -48,14 +44,13 @@
from django.db.models import Q
from django.template import defaultfilters
from django.db.models.signals import post_save, post_delete
-from django.dispatch import receiver
-
-from gpapers.logger import *
+
+from gpapers.logger import log_level_debug, log_warn, log_info, log_debug
from gpapers.importer import bibtex, pdf_file
import gpapers.desktop
from gpapers.gPapers.models import *
import gpapers.importer as importer
-from gpapers.importer import pango_escape, get_md5_hexdigest_from_data
+from gpapers.importer import pango_escape
from gpapers.importer import pubmed, google_scholar, jstor
log_level_debug()
@@ -142,13 +137,11 @@
def fetch_citations_via_urls(urls):
log_info('trying to fetch: %s' % str(urls))
- t = thread.start_new_thread(import_citations, (urls,))
-
+ thread.start_new_thread(import_citations, (urls,))
def fetch_citations_via_references(references):
log_info('trying to fetch: %s' % str(references))
- t = thread.start_new_thread(import_citations_via_references,
(references,))
-
+ thread.start_new_thread(import_citations_via_references, (references,))
def import_citations(urls):
for url in urls:
@@ -1263,7 +1256,6 @@
if event.button == 3:
x = int(event.x)
y = int(event.y)
- time = event.time
pthinfo = treeview.get_path_at_pos(x, y)
if pthinfo is not None:
path, col, cellx, celly = pthinfo
@@ -1285,7 +1277,6 @@
y = int(event.y)
x_percent = 1.0 * x / pdf_preview.get_allocated_width()
y_percent = 1.0 * y / pdf_preview.get_allocated_height()
- time = event.time
#print 'x, y, x_percent, y_percent, time', x, y, x_percent,
y_percent, time
# are we clicking on a bookmark?
@@ -1370,7 +1361,6 @@
if event.button == 3:
x = int(event.x)
y = int(event.y)
- time = event.time
pthinfo = treeview.get_path_at_pos(x, y)
if pthinfo is not None:
path, col, cellx, celly = pthinfo
@@ -1397,7 +1387,6 @@
if event.button == 3:
x = int(event.x)
y = int(event.y)
- time = event.time
pthinfo = treeview.get_path_at_pos(x, y)
if pthinfo is not None:
path, col, cellx, celly = pthinfo
@@ -1435,7 +1424,6 @@
if event.button == 3:
x = int(event.x)
y = int(event.y)
- time = event.time
pthinfo = treeview.get_path_at_pos(x, y)
if pthinfo is not None:
path, col, cellx, celly = pthinfo
@@ -1459,7 +1447,6 @@
if event.button == 3:
x = int(event.x)
y = int(event.y)
- time = event.time
pthinfo = treeview.get_path_at_pos(x, y)
if pthinfo is not None:
path, col, cellx, celly = pthinfo
@@ -1480,7 +1467,6 @@
if event.button == 3:
x = int(event.x)
y = int(event.y)
- time = event.time
pthinfo = treeview.get_path_at_pos(x, y)
if pthinfo is not None:
path, col, cellx, celly = pthinfo
@@ -1565,12 +1551,10 @@
else: # assume a paper id, i.e. rearranging papers in a
collection
drop_info = treeview.get_dest_row_at_pos(x, y)
if self.current_playlist and drop_info:
- model = treeview.get_model()
path, position = drop_info
path_idx = path.get_indices()[0]
playlist = self.current_playlist
paper_list = list(playlist.papers.all())
- l = []
for i in range(0, len(paper_list)):
paper = paper_list[i]
if str(
paper.id) == str(data):
@@ -1602,7 +1586,6 @@
try:
target_path, drop_position = treeview.get_dest_row_at_pos(x, y)
model, source = treeview.get_selection().get_selected()
- target = model.get_iter(target_path)
if len(target_path) > 1 and target_path[0] == 0:
treeview.enable_model_drag_dest([LEFT_PANE_ADD_TO_PLAYLIST_DND_ACTION],
Gdk.DragAction.MOVE)
else:
@@ -2336,7 +2319,6 @@
if event.button == 3:
x = int(event.x)
y = int(event.y)
- time = event.time
pthinfo = treeview.get_path_at_pos(x, y)
if pthinfo is not None:
path, col, cellx, celly = pthinfo
@@ -2825,7 +2807,6 @@
if event.button == 3:
x = int(event.x)
y = int(event.y)
- time = event.time
pthinfo = treeview.get_path_at_pos(x, y)
if pthinfo is not None:
path, col, cellx, celly = pthinfo
@@ -2849,7 +2830,6 @@
if event.button == 3:
x = int(event.x)
y = int(event.y)
- time = event.time
pthinfo = treeview.get_path_at_pos(x, y)
if pthinfo is not None:
path, col, cellx, celly = pthinfo
@@ -2875,7 +2855,6 @@
if event.button == 3:
x = int(event.x)
y = int(event.y)
- time = event.time
pthinfo = treeview.get_path_at_pos(x, y)
if pthinfo is not None:
path, col, cellx, celly = pthinfo
=======================================
--- /gpapers/gPapers/models.py Sun Jun 3 15:16:42 2012
+++ /gpapers/gPapers/models.py Sun Jun 24 05:30:19 2012
@@ -15,7 +15,7 @@
# with this program; if not, write to the Free Software Foundation,
Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-import hashlib, os, re, traceback
+import hashlib, os
from datetime import datetime
from django.db import models
=======================================
--- /gpapers/importer/__init__.py Mon Jun 4 14:59:38 2012
+++ /gpapers/importer/__init__.py Sun Jun 24 05:30:19 2012
@@ -17,38 +17,23 @@
# You should have received a copy of the GNU General Public License
# along with gPapers. If not, see <
http://www.gnu.org/licenses/>.
-import commands
-import dircache
-import getopt
-import math
import os
import re
-import string
-import sys
-import thread
-import threading
-import time
import traceback
-from datetime import date, datetime, timedelta
-from time import strptime
from htmlentitydefs import name2codepoint as n2cp
import urllib
import urlparse
import hashlib
-import gi
-from gi.repository import GObject
from gi.repository import Gio
from gi.repository import Gdk
from gi.repository import Gtk
-from gi.repository import Pango
from gi.repository import Soup
from django.template import defaultfilters
import BeautifulSoup
from gpapers.logger import *
from gpapers.gPapers.models import Paper
-import bibtex
active_threads = None
=======================================
--- /gpapers/importer/bibtex.py Sun Jun 3 15:22:03 2012
+++ /gpapers/importer/bibtex.py Sun Jun 24 05:30:19 2012
@@ -33,9 +33,7 @@
# Matthew Brett 2010
# Simplified BSD license
-import re
from gpapers.logger import log_info, log_debug
-import pprint
from pyparsing import (Regex, Suppress, ZeroOrMore, Group, Optional,
Forward,
SkipTo, CaselessLiteral, Dict)
=======================================
--- /gpapers/importer/google_scholar.py Sun Jun 3 15:22:03 2012
+++ /gpapers/importer/google_scholar.py Sun Jun 24 05:30:19 2012
@@ -24,7 +24,6 @@
from gi.repository import Soup # @UnresolvedImport
import BeautifulSoup
-from django.template import defaultfilters
from gpapers.logger import log_debug, log_info, log_error
from gpapers.importer.bibtex import paper_info_from_bibtex
=======================================
--- /gpapers/importer/jstor.py Mon Jun 4 14:59:38 2012
+++ /gpapers/importer/jstor.py Sun Jun 24 05:30:19 2012
@@ -21,7 +21,6 @@
from BeautifulSoup import BeautifulStoneSoup
from gpapers.importer import SimpleWebSearchProvider
-from gpapers.gPapers.models import Paper
from gpapers.logger import *
QUERY_STRING = '
http://dfr.jstor.org/sru/?version=1.1&' + \
=======================================
--- /gpapers/importer/pdf_file.py Sat Jun 2 10:50:52 2012
+++ /gpapers/importer/pdf_file.py Sun Jun 24 05:30:19 2012
@@ -26,7 +26,7 @@
from pdfminer.layout import LAParams
from pdfminer.converter import TextConverter
-from gpapers.logger import log_debug, log_info, log_error
+from gpapers.logger import log_debug
# A DOI consists of a numeric prefix starting with "10." followed by "/"
and
# a more or less arbitrary suffix
=======================================
--- /gpapers/importer/pubmed.py Mon Jun 4 15:17:55 2012
+++ /gpapers/importer/pubmed.py Sun Jun 24 05:30:19 2012
@@ -69,7 +69,7 @@
def _summaries_received(self, message, callback, error_callback):
if not message.status_code == Soup.KnownStatusCode.OK:
- error_callback('Pubmed replied with error code %d.' %
message.status_code, user_data)
+ error_callback('Pubmed replied with error code %d.' %
message.status_code)
else:
response_data = message.response_body.flatten().get_data()
parsed_response =
BeautifulSoup.BeautifulStoneSoup(response_data)
==============================================================================
Revision: 41c5057fa2f4
Author: Marcel Stimberg <
marcel...@gmail.com>
Date: Sun Jun 24 05:30:58 2012
Log: add external services to README
http://code.google.com/p/gpapers/source/detail?r=41c5057fa2f4
Modified:
/README
=======================================
--- /README Mon Apr 9 13:44:00 2012
+++ /README Sun Jun 24 05:30:58 2012
@@ -16,12 +16,21 @@
In addition, gPapers contains code from the following sources:
-deseb
-
http://code.google.com/p/deseb/
- Written by Derek Anderson, published under a BSD license
desktop
http://pypi.python.org/pypi/desktop
Written by Paul Boddie, published under LGPLv3
pyparsing parser for BibTeX
http://pastebin.com/ZzU19NLJ
Written by Matthew Brett, published under a simplified BSD license
+
+External Services
+=================
+gPapers is using the following external web services to allow searching for
+literature and to download metadata.
+
+Google Scholar:
http://scholar.google.com/
+Pubmed:
http://www.ncbi.nlm.nih.gov/pubmed/
+JSTOR's Data for Research (DfR) service:
http://dfr.jstor.org
+
+The DOI service for resolving DOIs and downloading metadata:
http://dx.doi.org/
+
==============================================================================
Revision: 6e9c3a0c0cdd
Author: Marcel Stimberg <
marcel...@gmail.com>
Date: Sun Jun 24 05:59:19 2012
Log: display status message while importing from url
http://code.google.com/p/gpapers/source/detail?r=6e9c3a0c0cdd
Modified:
/gpapers/__init__.py
=======================================
--- /gpapers/__init__.py Sun Jun 24 05:30:19 2012
+++ /gpapers/__init__.py Sun Jun 24 05:59:19 2012
@@ -145,8 +145,15 @@
def import_citations(urls):
for url in urls:
- importer.import_citation(url,
callback=main_gui.refresh_middle_pane_search)
- main_gui.refresh_middle_pane_search()
+
+ # display status message and delete it afterwards
+ main_gui.active_threads[url] = 'Importing %s' % url
+ def my_callback():
+ if url in main_gui.active_threads:
+ del main_gui.active_threads[url]
+ main_gui.refresh_middle_pane_search()
+
+ importer.import_citation(url, callback=my_callback)
def import_citations_via_references(references):
@@ -311,7 +318,7 @@
return pub_year
else:
# Get the value of the respective attribute
- return str(getattr(paper, attribute.lower()))
+ return unicode(getattr(paper, attribute.lower()))
def render_paper_text_attribute(column, cell, model, iter, attribute):
@@ -440,7 +447,7 @@
response = dialog.run()
if response == Gtk.ResponseType.OK:
url = entry.get_text()
- importer.active_threads[url] = 'Importing URL'
+ importer.active_threads[url] = 'Importing %s' % url
importer.import_from_url(url, self.document_imported)
dialog.destroy()
==============================================================================
Revision: a4b08a034b1e
Author: Marcel Stimberg <
marcel...@gmail.com>
Date: Sun Jun 24 06:26:42 2012
Log: some more status info + maximize window in the beginning
http://code.google.com/p/gpapers/source/detail?r=a4b08a034b1e
Modified:
/gpapers/__init__.py
=======================================
--- /gpapers/__init__.py Sun Jun 24 05:59:19 2012
+++ /gpapers/__init__.py Sun Jun 24 06:26:42 2012
@@ -100,11 +100,11 @@
def truncate_long_str(s, max_length=96):
- s = str(s)
+ s = unicode(s)
if len(s) < max_length:
return s
else:
- return s[0:max_length] + '...'
+ return s[0:max_length] + u'…'
def set_model_from_list(cb, items):
@@ -365,6 +365,7 @@
Callback function that is called when new bibtex data for a paper
arrives. Writes the information to the paper object and saves it.
'''
+ log_debug('Received bibtex data for doi %s: %s' % (doi,
bibtex_data))
try:
# Get the paper for the DOI -- should be only one!
paper = Paper.objects.get(doi=doi)
@@ -383,17 +384,21 @@
dictionary with document metadata, `paper_data` is the PDF itself.
'''
- if user_data in importer.active_threads:
- del importer.active_threads[str(user_data)]
+ if user_data in self.active_threads:
+ del self.active_threads[str(user_data)]
if paper_data is None and paper_info is None:
# FIXME: This should be handled via an error callback
return
if paper_data is not None:
+
# Get some info from the PDF:
+ self.active_threads[str(user_data)] = 'Extracting data from
PDF'
paper_info_pdf = pdf_file.get_paper_info_from_pdf(paper_data)
-
+ del self.active_threads[str(user_data)]
+
+ log_debug('in document_imported: paper_info is %s' %
paper_info)
# Add everything that is not already known
if paper_info is None:
paper_info = paper_info_pdf
@@ -611,6 +616,7 @@
post_save.connect(receiver_wrapper, sender=Paper, weak=False)
post_delete.connect(receiver_wrapper, sender=Paper, weak=False)
+ self.main_window.maximize()
self.main_window.show()
def init_busy_notifier(self):