diff --git a/ctl b/ctl index 4c05511..805595c 100755 --- a/ctl +++ b/ctl @@ -162,14 +162,12 @@ if [ "$1" == "open" ]; then xdg-open "file://${BASE}/openmedialibrary/static/html/load.html" fi else - #$PYTHON "${NAME}/oml/gtkstatus.py" $@ - #exit $? - "$0" start & + $PYTHON "${NAME}/oml/gtkstatus.py" $@ + exit $? fi else - #$PYTHON "$NAME/oml/gtkstatus.py" $@ - #exit $? - "$0" start & + $PYTHON "$NAME/oml/gtkstatus.py" $@ + exit $? fi fi exit 0 @@ -189,7 +187,7 @@ fi if [ "$1" == "ui" ]; then shift - $PYTHON "$NAME/oml/ui.py" "$@" + $PYTHON "$NAME/oml/ui.py" $@ exit $? fi if [ "$1" == "init" ]; then diff --git a/oml/gtkstatus.py b/oml/gtkstatus.py index d9abb0d..726afc5 100644 --- a/oml/gtkstatus.py +++ b/oml/gtkstatus.py @@ -22,18 +22,6 @@ title = "Open Media Library" ctl = base + '/ctl' -def check_pid(pid): - if not os.path.exists(pid): - return False - try: - with open(pid, 'r') as fd: - pid = int(fd.read().strip()) - os.kill(pid, 0) - except OSError: - return False - else: - return True - class OMLIcon: menu = None icon = None @@ -93,7 +81,7 @@ class OMLIcon: @classmethod def is_running(cls): pid = cls.get_pid() - if pid and check_pid(pid): + if pid and os.path.exists(pid): return True else: return False diff --git a/oml/ui.py b/oml/ui.py index 5b9dc26..ba4630a 100644 --- a/oml/ui.py +++ b/oml/ui.py @@ -104,8 +104,7 @@ if __name__ == '__main__': if len(sys.argv) >= 3: base = sys.argv[2] base = os.path.expanduser(base) - if os.path.exists(base): - os.chdir(base) + os.chdir(base) if len(sys.argv) >= 2 and sys.argv[1] == 'folder': print(ui.selectFolder({})) else: diff --git a/static/reader/pdf.js b/static/reader/pdf.js index 15b4487..6e095f1 100644 --- a/static/reader/pdf.js +++ b/static/reader/pdf.js @@ -11,21 +11,14 @@ Ox.load({ console.log('got', event, 'data', data) if (event == 'selectAnnotation') { var annotation = annotations.filter(function(a) { return a.id == data.id })[0] - var delay = 0 if ( annotation && annotation.page && PDFViewerApplication.pdfViewer.currentPageNumber != annotation.page ) { + //FIXME: scroll into view PDFViewerApplication.pdfViewer.currentPageNumber = annotation.page; - delay = 250 } - setTimeout(function() { - var el = document.querySelector('.a' + annotation.id); - if (el) { - document.querySelector('#viewerContainer').scrollTop = el.offsetTop + el.parentElement.offsetTop - 64; - } - }, delay) selectAnnotation(data.id) } else if (event == 'addAnnotations') { data.annotations.forEach(function(annotation) {