sioyek-python-extensions icon indicating copy to clipboard operation
sioyek-python-extensions copied to clipboard

I can't figure out how to use these addons?

Open sesameman opened this issue 3 years ago • 20 comments
trafficstars

Can I get a document?

sesameman avatar Nov 04 '22 17:11 sesameman

There is some documentation in the readme. You need to first install it using pip:

python -m pip install sioyek

and then add the configuration corresponding to the addon you want to use to your prefs_user.config. For example if you want to use paper_downloader, add this:

new_command _download_paper python -m sioyek.paper_downloader download "%{sioyek_path}" "%{paper_name}"
control_click_command _download_paper

To your config file.

ahrm avatar Nov 04 '22 18:11 ahrm

There is some documentation in the readme. You need to first install it using pip:

python -m pip install sioyek

and then add the configuration corresponding to the addon you want to use to your prefs_user.config. For example if you want to use paper_downloader, add this:

new_command _download_paper python -m sioyek.paper_downloader download "%{sioyek_path}" "%{paper_name}"
control_click_command _download_paper

To your config file.

Thank you for your reply. I follow the steps, but it doesn't work. Maybe it is because of my OS.

And can you add your keyboard shortcut in your video? i don't know what you did.

sesameman avatar Nov 05 '22 03:11 sesameman

What OS are you using. You can always try to run these commands from command line, for example:

python -m sioyek.paper_downloader download "%{sioyek_path}" "%{paper_name}"

(after replacing %{sioyek_path} and %{paper_name} with the correct values). And see if there are any errors. You can bind them to shortcuts the same way you bind normal keys. For example something like this in your keys_user.config:

_download_paper <C-d>

ahrm avatar Nov 05 '22 09:11 ahrm

My system is MacOS 13.0 (22A380).

python -m sioyek.dual_panelify "%{sioyek_path}" "%{file_path}" "%{command_text}"
python -m sioyek.dual_panelify "sioyek" "%{paper_name}" "%{command_text}"
python -m sioyek.dual_panelify "/Applications/sioyek.app" "%{paper_name}" "%{command_text}"
python -m sioyek.dual_panelify "/Applications/sioyek.app/Contents/MacOS/sioyek" "%{paper_name}" "%{command_text}"
python -m sioyek.dual_panelify "/Applications/sioyek.app/Contents/MacOS/sioyek" "/Users/xxx/Desktop/main.pdf" "%{command_text}"
python -m sioyek.dual_panelify "/Applications/sioyek.app/Contents/MacOS/sioyek" "/Users/xxx/Desktop/main.pdf" "%{command_text}"

I tried all these command and nothing happened. Is there anything I need to modify here?

sesameman avatar Nov 06 '22 19:11 sesameman

When you run this manually in command line:

python -m sioyek.dual_panelify "/Applications/sioyek.app/Contents/MacOS/sioyek" "/Users/xxx/Desktop/main.pdf" ""

do you get an error?

ahrm avatar Nov 06 '22 19:11 ahrm

When you run this manually in command line:

python -m sioyek.dual_panelify "/Applications/sioyek.app/Contents/MacOS/sioyek" "/Users/xxx/Desktop/main.pdf" ""

do you get an error?

Sorry i got it wrong earlier what you meant by the command line. I opened Sioyek and pressed :, typed python command into it.

And It may get something wrong with [email protected](brew version) or armMac or dependencies. I have to back to [email protected] to reinstall pip-sioyek. It doesn't work yesterday on my pc, but it works today. I think maybe some packages were fixed. (PS: these pkgs wew got wrong: numpy swig? metadata wheel pypdf? ,etc. )

Thank you so much for helping me!

sesameman avatar Nov 08 '22 20:11 sesameman

Closed to early.

It doesn't work in Sioyek.

# comand line
python3 -m sioyek.dual_panelify "/Applications/sioyek.app/Contents/MacOS/sioyek" "/Users/x/Desktop/main.pdf" ""
# it works

But in Sioyek , I input _dual_panelify2 & _dual_panelify .nothing happened.

# put in pref_user.config
new_command _dual_panelify python3 -m sioyek.dual_panelify "/Applications/sioyek.app/Contents/MacOS/sioyek" "%{file_path}" "%{command_text}"
new_command _dual_panelify2 python3 -m sioyek.dual_panelify "/Applications/sioyek.app/Contents/MacOS/sioyek" "/Users/kangjiayin/Desktop/main.pdf" ""


sesameman avatar Nov 08 '22 20:11 sesameman

I borrowed one of my friends' mac machine and I have found that if you open sioyek using this command:

open /Applications/sioyek.app

it works but when you open it using the GUI it doesn't work.

I am not very familiar with MacOS and how it works so I am not entirely sure what the issue is.

ahrm avatar Nov 09 '22 15:11 ahrm

I borrowed one of my friends' mac machine and I have found that if you open sioyek using this command:

open /Applications/sioyek.app

it works but when you open it using the GUI it doesn't work.

I am not very familiar with MacOS and how it works so I am not entirely sure what the issue is.

I have the same issue here. Only using the command line open /Applications/sioyek.app can enable the extension.

Meanwhile, I found when I embed_annotations, I have the following issue---some highlights show up---which I did not applied.

image

chapter09 avatar Dec 04 '22 17:12 chapter09

Meanwhile, I found when I embed_annotations, I have the following issue---some highlights show up---which I did not applied.

Should be fixed in the latest version of sioyek python package.

ahrm avatar Dec 05 '22 12:12 ahrm

I met the same problem in windows10, I can run the command python -m sioyek.translate "%{sioyek_path}" "%{selected_text}" on windows terminal and got the expect result, but it got nothing by using execute in sioyek. My version is python37 and sioyek Release v2.0.0. I open it by clicking "sioyek.exe". By the way, I test the execute funtion in sioyek. It's ok in my pc, but can't run the above command. I guess there might be something wrong in python module ".sioyek"

justcyl avatar Jan 24 '23 13:01 justcyl

What exactly is your configuration?

ahrm avatar Jan 24 '23 13:01 ahrm

What exactly is your configuration?

which configuration? the python script or sioyek config?

justcyl avatar Jan 25 '23 04:01 justcyl

Both.

ahrm avatar Jan 25 '23 08:01 ahrm

I try again. I found two problems:

  1. If I use python -m sioyek.translate , I fail. But if I use python C:\the path\translate.py , it works in execute in sioyek. Both command can run successfully in windows terminal.
  2. If I import some modules like import translators.server as tss, it will fail. But I can run it successfully in windows terminal. The "fail" I mean is that I run the command in execute in sioyek, but got nothing. I didn't change the sioyek config, and the version is 2.0.0(not protable) the python script is:
import sys
import os
# from googletrans import Translator # I don't want to use it
import translators.server as tss #https://github.com/UlionTse/translators
from .sioyek import Sioyek
if __name__ == '__main__':
    sioyek_path = 'D:\\Downloads\\sioyek-release-windows\\sioyek.exe'
    text = sys.argv[2]
    sioyek = Sioyek(sioyek_path)
    sioyek.set_status_string(tss.baidu(text, to_language='zh'))

justcyl avatar Jan 25 '23 12:01 justcyl

Do you have multiple python versions?

ahrm avatar Jan 25 '23 14:01 ahrm

yes, I have python3.7,python3.9 and pypy3.9, but the default is python3.7 (I type python -V in windows terminal) , and I am sure about that the module was installed at python37.

justcyl avatar Jan 25 '23 14:01 justcyl

Maybe sioyek is using another python version? You could specify the exact path to your python executable in prefs_user.config instead of just using python.

ahrm avatar Jan 25 '23 16:01 ahrm

Thanks for you replys, now I use "C:\ProgramFiles\Python37\python.exe" and the problems are solven.

justcyl avatar Jan 26 '23 03:01 justcyl

I borrowed one of my friends' mac machine and I have found that if you open sioyek using this command:

open /Applications/sioyek.app

it works but when you open it using the GUI it doesn't work.

I am not very familiar with MacOS and how it works so I am not entirely sure what the issue is.

I borrowed one of my friends' mac machine and I have found that if you open sioyek using this command:

open /Applications/sioyek.app

it works but when you open it using the GUI it doesn't work.

I am not very familiar with MacOS and how it works so I am not entirely sure what the issue is.

Try the absolute path to the python executable

new_command _dual_panelify /opt/anaconda3/bin/python -m sioyek.dual_panelify "/Applications/sioyek.app/Contents/MacOS/sioyek" "%{file_path}" "%{command_text}"

TyrannosaurusLjx avatar Sep 24 '24 15:09 TyrannosaurusLjx