我正在開發一個使用inkscape來操作SVG的影片SVG工具,我需要更新inkscape以顯示影片SVG的選定狀態,以便讓用戶進行更改(它是一個外部工具而不是插件)。
例如:一個矩形從 x:100 變為 x:300,當矩形在 x:200 時用戶暫停影片,然后工具將 SVG 狀態保存為 x:200,唯一的問題是inkscape 沒有重繪 ,所以我需要關閉并打開inkscape,或者手動轉到檔案>恢復。
我一直在調查,發現有一個稱為 FileRevert 的動詞(在 1.2 中洗掉動詞之前),我嘗試使用 1.1 版并使用 inkscape GUI 打開此命令:
inkscape --verb FileRevert test.svg
這是命令的完整輸出:(最后的完整日志)
user@user:~/Desktop$ ./ink2.AppImage --verb FileRevert test.svg
WARNING: ignoring verb FileRevert - GUI required for this verb.
** (org.inkscape.Inkscape:6946): CRITICAL **: 08:40:38.988: static void Inkscape::FileVerb::perform(SPAction*, void*): assertion 'ensure_desktop_valid(action)' failed
所以錯誤似乎是沒有檢測到 GUI,idk 如果我必須告訴 cli GUI 在哪里或從 GUI 打開 inkscape,但我嘗試了這個并且終端被阻止,直到你關閉 inkscape。
然后我嘗試了 inkscape 1.2 動作,因為檔案說所有動詞都可以作為動作使用:

但是 --action-list 中沒有 FileRevert 操作,而且在 1.2 發行說明中也沒有關于 FileRevert 任何棄用的資訊,因此很難猜測發生了什么。
這是使用操作嘗試 FileRevert 的輸出:(最后的完整日志)
user@user:~/Desktop$ ./ink.AppImage --actions="FileRevert" test.svg
InkscapeApplication::parse_actions: could not find action for: FileRevert
所以它似乎無法找到 FileRevert 操作,這可能意味著它不受支持或不推薦使用。
我使用 linux mint 以防萬一。
歡迎任何幫助,或者我的問題的任何替代解決方案...... atm 我正在考慮如此糟糕的替代方案,比如每次你想重繪 它時自動關閉和重新打開inkscape,或者選擇inkscape視窗并觸發一個熱鍵來恢復檔案。
謝謝!
完整日志 1.1 動詞嘗試:
user@user:~/Desktop$ ./ink2.AppImage --verb FileRevert test.svg
Setting _INKSCAPE_GC=disable as a workaround for broken libgc
Gtk-Message: 08:40:38.030: Failed to load module "xapp-gtk3-module"
** (org.inkscape.Inkscape:6946): WARNING **: 08:40:38.964: <svg:rect id="">: CSS Style property: "stroke-width" with default value (1) not needed.
** (org.inkscape.Inkscape:6946): WARNING **: 08:40:38.964: <svg:rect id="rect786">: CSS Style property: "stroke-width" with default value (1) not needed.
** (org.inkscape.Inkscape:6946): WARNING **: 08:40:38.964: <svg:rect id="rect786">: CSS Style property: "stroke-width" with default value (1) not needed.
WARNING: ignoring verb FileRevert - GUI required for this verb.
** (org.inkscape.Inkscape:6946): CRITICAL **: 08:40:38.988: static void Inkscape::FileVerb::perform(SPAction*, void*): assertion 'ensure_desktop_valid(action)' failed
完整日志 1.2 操作嘗試:
user@user:~/Desktop$ ./ink.AppImage --actions="FileRevert" test.svg
Setting _INKSCAPE_GC=disable as a workaround for broken libgc
Gtk-Message: 08:49:36.363: Failed to load module "xapp-gtk3-module"
InkscapeApplication::parse_actions: could not find action for: FileRevert
** (org.inkscape.Inkscape:7139): WARNING **: 08:49:37.377: <svg:rect id="">: CSS Style property: "stroke-width" with default value (1) not needed.
** (org.inkscape.Inkscape:7139): WARNING **: 08:49:37.377: <svg:rect id="rect786">: CSS Style property: "stroke-width" with default value (1) not needed.
** (org.inkscape.Inkscape:7139): WARNING **: 08:49:37.378: <svg:rect id="rect786">: CSS Style property: "stroke-width" with default value (1) not needed.
編輯:在 Inkscape 中作業和更新的工具演示: https ://www.youtube.com/watch?v=fDAIVKd19YU
uj5u.com熱心網友回復:
似乎在 Inkscape 的 1.2.x 及更高版本中未實作 file_revert 操作。請參閱此處的問題。
但是,我建議改用dbus。下面是一個關于在運行 inkscape 時如何使用 dbus 恢復檔案的示例:
gdbus call --session --dest org.inkscape.Inkscape --object-path /org/inkscape/Inkscape/window/1 --method org.gtk.Actions.Activate document-revert [] {}
要獲取可以通過 dbus 呼叫的操作串列,請運行以下命令:
gdbus call --session --dest org.inkscape.Inkscape --object-path /org/inkscape/Inkscape/window/1 --method org.gtk.Actions.List
除了終端,您還可以在 C 、Python 等代碼上使用 dbus。有關系結串列,請參見:此處。
使用 C 的示例:請參見此處:https ://github.com/makercrew/dbus-sample
對于 Python,請參閱:https ://wiki.python.org/moin/DbusExamples
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/516161.html
標籤:svg墨景
