Compare commits
3 commits
b4c6f2b4ac
...
d97d396ef3
| Author | SHA1 | Date | |
|---|---|---|---|
| d97d396ef3 | |||
| 0bfbebb21d | |||
| ebff5a8153 |
4 changed files with 30 additions and 8 deletions
12
ctl
12
ctl
|
|
@ -162,12 +162,14 @@ if [ "$1" == "open" ]; then
|
||||||
xdg-open "file://${BASE}/openmedialibrary/static/html/load.html"
|
xdg-open "file://${BASE}/openmedialibrary/static/html/load.html"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
$PYTHON "${NAME}/oml/gtkstatus.py" $@
|
#$PYTHON "${NAME}/oml/gtkstatus.py" $@
|
||||||
exit $?
|
#exit $?
|
||||||
|
"$0" start &
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
$PYTHON "$NAME/oml/gtkstatus.py" $@
|
#$PYTHON "$NAME/oml/gtkstatus.py" $@
|
||||||
exit $?
|
#exit $?
|
||||||
|
"$0" start &
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
exit 0
|
exit 0
|
||||||
|
|
@ -187,7 +189,7 @@ fi
|
||||||
|
|
||||||
if [ "$1" == "ui" ]; then
|
if [ "$1" == "ui" ]; then
|
||||||
shift
|
shift
|
||||||
$PYTHON "$NAME/oml/ui.py" $@
|
$PYTHON "$NAME/oml/ui.py" "$@"
|
||||||
exit $?
|
exit $?
|
||||||
fi
|
fi
|
||||||
if [ "$1" == "init" ]; then
|
if [ "$1" == "init" ]; then
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,18 @@ title = "Open Media Library"
|
||||||
ctl = base + '/ctl'
|
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:
|
class OMLIcon:
|
||||||
menu = None
|
menu = None
|
||||||
icon = None
|
icon = None
|
||||||
|
|
@ -81,7 +93,7 @@ class OMLIcon:
|
||||||
@classmethod
|
@classmethod
|
||||||
def is_running(cls):
|
def is_running(cls):
|
||||||
pid = cls.get_pid()
|
pid = cls.get_pid()
|
||||||
if pid and os.path.exists(pid):
|
if pid and check_pid(pid):
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
|
|
|
||||||
|
|
@ -104,6 +104,7 @@ if __name__ == '__main__':
|
||||||
if len(sys.argv) >= 3:
|
if len(sys.argv) >= 3:
|
||||||
base = sys.argv[2]
|
base = sys.argv[2]
|
||||||
base = os.path.expanduser(base)
|
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':
|
if len(sys.argv) >= 2 and sys.argv[1] == 'folder':
|
||||||
print(ui.selectFolder({}))
|
print(ui.selectFolder({}))
|
||||||
|
|
|
||||||
|
|
@ -11,14 +11,21 @@ Ox.load({
|
||||||
console.log('got', event, 'data', data)
|
console.log('got', event, 'data', data)
|
||||||
if (event == 'selectAnnotation') {
|
if (event == 'selectAnnotation') {
|
||||||
var annotation = annotations.filter(function(a) { return a.id == data.id })[0]
|
var annotation = annotations.filter(function(a) { return a.id == data.id })[0]
|
||||||
|
var delay = 0
|
||||||
if (
|
if (
|
||||||
annotation &&
|
annotation &&
|
||||||
annotation.page &&
|
annotation.page &&
|
||||||
PDFViewerApplication.pdfViewer.currentPageNumber != annotation.page
|
PDFViewerApplication.pdfViewer.currentPageNumber != annotation.page
|
||||||
) {
|
) {
|
||||||
//FIXME: scroll into view
|
|
||||||
PDFViewerApplication.pdfViewer.currentPageNumber = annotation.page;
|
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)
|
selectAnnotation(data.id)
|
||||||
} else if (event == 'addAnnotations') {
|
} else if (event == 'addAnnotations') {
|
||||||
data.annotations.forEach(function(annotation) {
|
data.annotations.forEach(function(annotation) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue