-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathunic.py
More file actions
executable file
·49 lines (36 loc) · 899 Bytes
/
unic.py
File metadata and controls
executable file
·49 lines (36 loc) · 899 Bytes
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
49
#!python3.8
# pyuic5 ./unic_ui.ui -o ./unic_ui.py
# qtDesigner
import sys
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtWidgets import QMainWindow
from unic_ui import Ui_MainWindow
app = QtWidgets.QApplication(sys.argv)
window = QMainWindow()
ui = Ui_MainWindow()
ui.setupUi(window)
def unique(list1):
# insert the list to the set
list_set = set(list1)
# convert the set to the list
unique_list = (list(list_set))
return unique_list
def operatetext():
text = ui.plainTextEdit.toPlainText()
if (ui.checkBox_2.checkState()):
text = text.lower()
lines = text.splitlines()
u_lines = unique(lines)
if (ui.checkBox_1.checkState()):
u_lines.sort()
ui.plainTextEdit.setPlainText("\n".join(u_lines))
ui.plainTextEdit.repaint()
#clicks
ui.pushButton.clicked.connect(operatetext)
window.show()
sys.exit(app.exec_())
# 123
# asd
# ASD
# qwe
# QWE