forked from CoderWanFeng/python-office
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathKeywordTableWindow.py
More file actions
48 lines (41 loc) · 1.36 KB
/
Copy pathKeywordTableWindow.py
File metadata and controls
48 lines (41 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# coding:utf-8
from customizeWindowPyfile.ui2pyFile.ui_keywordtablewindow import Ui_keywordTableWindow
import sys
from PyQt5.QtWidgets import QApplication, QDialog
from PyQt5.QtCore import pyqtSignal
class KeywordTableWindow(QDialog):
confirmSignal = pyqtSignal(dict)
def __init__(self, parent = None):
super().__init__(parent)
self.ui = Ui_keywordTableWindow()
self.ui.setupUi(self)
self.setWindowTitle('请输入关键词和替换词')
self.ui.confirmButton.clicked.connect(self.sendKeywordDir)
def test(self):
print('debug1')
print(str(self.ui.tableWidget.item(0, 0).text()))
def sendKeywordDir(self):
print('字典发送成功')
keywordDir = self.getValue()
self.confirmSignal.emit(keywordDir)
self.destroy()
def getValue(self):
colom = list(range(9))
row = list(range(2))
print(colom)
print(row)
dir = {}
print(type(dir))
j = 0
for i in colom:
# for j in row:
if self.ui.tableWidget.item(i,j) != None:
dir[self.ui.tableWidget.item(i,j).text()] = self.ui.tableWidget.item(i,j+1).text()
print(dir)
return dir
if __name__ == '__main__':
app = QApplication(sys.argv)
form = KeywordTableWindow()
form.show()
form.test()
sys.exit(app.exec_())