Skip to content

Commit

Permalink
- 兼容本地直接删除插件的操作
Browse files Browse the repository at this point in the history
  • Loading branch information
YaoXuanZhi committed Dec 22, 2024
1 parent 12c8fb1 commit 7cc2288
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,17 @@ ruff format
## ☐ 重构绘图工具模块
由于当初实现的时候,很多绘图工具功能并没有明晰,都是摸索着实现的,所以存在很多硬编码的情况,现在功能基本已稳定,可以重新梳理该功能的行为,计划将拆分为DrawToolProvider、DrawToolSchduler、DrawToolFactory等模块,甚至将它们提炼为一个插件,让绘图工具的实现更灵活,更易扩展

经过测试,其实还可以换一种思路,那就是将Excalidraw、TlDraw之类的web绘图应用使用WebEngineView控件来嵌入到PinEditorWindow上,然后修改绘图层的背景以及取消视图缩放和滚动机制,
,再追加一个演示模式,那就同原生的体验差不多了,同很多web显示echarts思路差不多,不过性能上损耗会有点大,但是考虑到目前主流机器都还是比较不错的,这个方案理论上也可以落地

https://tldraw.dev/examples/use-cases/image-annotator

更进一步,也可以将绘图层模块重新封装成NativeDrawTool、TlDrawEmbedTool、ExcalidrawEmbedTool,可以节省很多开发工作

当下本人比较建议先接入TlDrawEmbedTool,因为它还支持媒体、gif等格式的媒体文件插入并且预览显示,更有妙用

其实考虑到OCR识别之后,也是采用WebEngineView作为文本选择层,那么将它们两者结合起来也不失为一个更好的方案,起码省事多了

## ☐ 增加节点式流程定制化支持
可以让用户通过节点式拖曳定制一些快捷流程,比如某些自动化任务啥的,具体可以参考以下项目
- [pyqt-node-editor](https://gitlab.com/pavel.krupala/pyqt-node-editor)
Expand Down
17 changes: 15 additions & 2 deletions src/plugin/plugin_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,19 @@ def __init__(self, parent=None):
def loadPlugins(self):
self.__loadPluginsInside()
self.__loadPluginsOutside()
self.__clearInvalidPluginCfgs()

def __clearInvalidPluginCfgs(self):
'''清除无效的插件配置(考虑到存在绕过插件UI而直接本地删除插件目录的情况,得兼容下)'''
isSave = False
for attrName in dir(pluginCfg):
attr = getattr(pluginCfg, attrName)
if isinstance(attr, PluginConfigItemEx):
if self.pluginDict.get(attrName) == None:
delattr(pluginCfg, attrName)
isSave = True
if isSave:
pluginCfg.save()

def __loadPluginsInside(self):
internalPath = os.path.join(OsHelper.getInternalPath(), "internal_deps/internal_plugins")
Expand Down Expand Up @@ -103,8 +116,8 @@ def __loadPluginByModuleName(self, moduleName):
self.__filterInterface(module)

def __filterInterface(self, module):
for attr_name in dir(module):
attr = getattr(module, attr_name)
for attrName in dir(module):
attr = getattr(module, attrName)
if (
isinstance(attr, type)
and issubclass(attr, PluginInterface)
Expand Down

0 comments on commit 7cc2288

Please sign in to comment.