Skip to content

Commit

Permalink
添加复制一言功能
Browse files Browse the repository at this point in the history
  • Loading branch information
zk-wz committed Apr 4, 2022
1 parent ad7dd9f commit 77cce94
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 3 deletions.
3 changes: 2 additions & 1 deletion __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@
Yiyan_Settings,
Yiyan,

Nothing]
Nothing,
Copy_text]



Expand Down
17 changes: 17 additions & 0 deletions operators.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,23 @@
from datetime import datetime
from . import imgapi_spider
import random
import subprocess

class Copy_text(bpy.types.Operator):
bl_idname = "bangumi.copy_text"
bl_label = "CopyText"
bl_description = "Copy Text"
bl_options = {"REGISTER"}

@classmethod
def poll(cls, context):
return True

def execute(self, context):
subprocess.run("clip", universal_newlines=True, input=context.scene.bangumi_property.yiyan,encoding="gbk")
self.report({'INFO'}, "文本已复制")
return {"FINISHED"}


class Nothing(bpy.types.Operator):
bl_idname = "bangumi.nothing"
Expand Down
Binary file modified src/bangumi_info
Binary file not shown.
Binary file modified src/bilibili_info
Binary file not shown.
4 changes: 2 additions & 2 deletions ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ def draw_header(self,context):

def draw(self, context):
layout = self.layout.box().column(align=True)
layout.operator("bangumi.nothing",text=context.scene.bangumi_property.yiyan,emboss=False)
layout.operator("bangumi.copy_text",text=context.scene.bangumi_property.yiyan,emboss=False)
layout.operator("bangumi.nothing",text=context.scene.bangumi_property.yiyan_source,emboss=False)


Expand Down Expand Up @@ -267,7 +267,7 @@ class Yiyan(bpy.types.Panel,Bangumi_Panel):

def draw(self, context):
layout = self.layout.box().column(align=True)
layout.operator("bangumi.nothing",text=context.scene.bangumi_property.yiyan,emboss=False)
layout.operator("bangumi.copy_text",text=context.scene.bangumi_property.yiyan,emboss=False)
layout.operator("bangumi.nothing",text=context.scene.bangumi_property.yiyan_source,emboss=False)


Expand Down

0 comments on commit 77cce94

Please sign in to comment.