Commit 5f7fb6dd authored by rico.liu's avatar rico.liu

update_pressCommand

parent c616385f
Pipeline #87 failed with stages
...@@ -26,7 +26,7 @@ class Example(Frame): ...@@ -26,7 +26,7 @@ class Example(Frame):
"""TODO 换成更贴切的类名""" """TODO 换成更贴切的类名"""
def __init__(self, parent): def __init__(self, parent):
Frame.__init__(self, parent) Frame.__init__(self, parent)
self.Version = u"YEDDA-V1.0 标注工具" self.Version = u"ZGC_INDEX-V1.0 标注工具"
self.OS = platform.system().lower() self.OS = platform.system().lower()
self.parent = parent self.parent = parent
self.fileName = "" self.fileName = ""
...@@ -35,26 +35,29 @@ class Example(Frame): ...@@ -35,26 +35,29 @@ class Example(Frame):
self.recommendFlag = True self.recommendFlag = True
self.history = deque(maxlen=20) self.history = deque(maxlen=20)
self.currentContent = deque(maxlen=1) self.currentContent = deque(maxlen=1)
self.pressCommand = {'a':"Artifical",
'b':"Event", '''
'c':"Fin-Concept", self.pressCommand = {'1':"Artifical",
'd':"Location", '2':"Event",
'e':"Organization", '3':"Fin-Concept",
'f':"Person", '4':"Location",
'g':"Sector", '5':"Organization",
'h':"Other" '6':"Person",
'7':"Sector",
'8':"Other"
} }
'''
self.allKey = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" self.allKey = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
self.controlCommand = {'q':"unTag", 'ctrl+z':'undo'} self.controlCommand = {'q':"unTag", 'ctrl+z':'undo'}
self.labelEntryList = [] self.labelEntryList = []
self.shortcutLabelList = [] self.shortcutLabelList = []
# 默认 GUI 显示参数 # 默认 GUI 显示参数
if len(self.pressCommand) > 20: #if len(self.pressCommand) > 20:
self.textRow = len(self.pressCommand) # self.textRow = len(self.pressCommand)
else: #else:
self.textRow = 20 # self.textRow = 20
self.textColumn = 5 self.textColumn = 5
self.tagScheme = "BMES" self.tagScheme = "BIO"
self.onlyNP = False ## for exporting sequence self.onlyNP = False ## for exporting sequence
self.keepRecommend = True self.keepRecommend = True
...@@ -77,6 +80,26 @@ class Example(Frame): ...@@ -77,6 +80,26 @@ class Example(Frame):
self.recommendColor = 'lightgreen' self.recommendColor = 'lightgreen'
self.selectColor = 'light salmon' self.selectColor = 'light salmon'
self.textFontStyle = "Times" self.textFontStyle = "Times"
#self.initUI()
def setPressCommand(self,zgcCatCode):
if zgcCatCode == '0101':
self.pressCommand = {'1':"Artifical",
'2':"Event",
'3':"Fin-Concept",
'4':"Location",
'5':"Organization",
'6':"Person",
'7':"Sector",
'8':"Other",
'9':'liuxiaoqi'
}
if len(self.pressCommand) > 20:
self.textRow = len(self.pressCommand)
else:
self.textRow = 20
def run_initUI(self):
self.initUI() self.initUI()
def initUI(self): def initUI(self):
...@@ -104,19 +127,19 @@ class Example(Frame): ...@@ -104,19 +127,19 @@ class Example(Frame):
self.sb['command'] = self.text.yview self.sb['command'] = self.text.yview
# self.sb.pack() # self.sb.pack()
abtn = Button(self, text="Open", command=self.onOpen) abtn = Button(self, text="加载文件", command=self.onOpen)
abtn.grid(row=1, column=self.textColumn +1) abtn.grid(row=1, column=self.textColumn +1)
recButton = Button(self, text="RMOn", command=self.setInRecommendModel) recButton = Button(self, text="推荐开启", command=self.setInRecommendModel)
recButton.grid(row=2, column=self.textColumn +1) recButton.grid(row=2, column=self.textColumn +1)
noRecButton = Button(self, text="RMOff", command=self.setInNotRecommendModel) noRecButton = Button(self, text="推荐关闭", command=self.setInNotRecommendModel)
noRecButton.grid(row=3, column=self.textColumn +1) noRecButton.grid(row=3, column=self.textColumn +1)
ubtn = Button(self, text="ReMap", command=self.renewPressCommand) ubtn = Button(self, text="保存快捷键", command=self.renewPressCommand)
ubtn.grid(row=4, column=self.textColumn +1, pady=4) ubtn.grid(row=4, column=self.textColumn +1, pady=4)
exportbtn = Button(self, text="Export", command=self.generateSequenceFile) exportbtn = Button(self, text="导出anns", command=self.generateSequenceFile)
exportbtn.grid(row=5, column=self.textColumn + 1, pady=4) exportbtn.grid(row=5, column=self.textColumn + 1, pady=4)
cbtn = Button(self, text="Quit", command=self.quit) cbtn = Button(self, text="Quit", command=self.quit)
...@@ -850,6 +873,8 @@ def main(): ...@@ -850,6 +873,8 @@ def main():
root.geometry("1300x700+200+200") root.geometry("1300x700+200+200")
app = Example(root) app = Example(root)
app.setFont(17) app.setFont(17)
app.setPressCommand('0101')
app.run_initUI()
root.mainloop() root.mainloop()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment