-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathshort_gui.py
76 lines (64 loc) · 2.16 KB
/
short_gui.py
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'short_gui.ui'
#
# Created by: PyQt5 UI code generator 5.9.2
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
from final import Big_Dialog
import typo
import pyxhook
import sys,os
from functools import partial
newhook=pyxhook.HookManager()
app = QtWidgets.QApplication(sys.argv)
Dialog = QtWidgets.QDialog()
big_window = Big_Dialog()
big_dialog = QtWidgets.QDialog()
big_window.setupUi(big_dialog)
big_dialog.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint)
class Ui_Dialog(object):
def setupUi(self, Dialog):
Dialog.setObjectName("Dialog")
#Dialog.resize(102, 31)
Dialog.setFixedSize(30, 30)
self.button = QtWidgets.QPushButton(Dialog)
#self.button.setGeometry(QtCore.QRect(0, 0, 92, 35))
self.button.setGeometry(QtCore.QRect(0, 0, 30, 30))
Dialog.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint)
#Dialog.setWindowFlags(QtCore.Qt.CustomizeWindowHint)
#Dialog.setWindowFlags(QtCore.Qt.FramelessWindowHint)
Dialog.setStyleSheet(".QLineEdit {border-radius: 10000px;}")
self.button.setText("")
self.button.setObjectName("button")
self.retranslateUi(Dialog)
QtCore.QMetaObject.connectSlotsByName(Dialog)
def retranslateUi(self, Dialog):
_translate = QtCore.QCoreApplication.translate
Dialog.setWindowTitle(_translate("Dialog", "Dialog"))
def keyPress(event):
global Dialog,newhook,app
if event.Ascii == 96:
newhook.cancel()
Dialog.close()
def show_big_window(big_window_obj):
big_window_obj.exec_()
def set_list(word_list):
big_dialog.show()
big_window.sug_list.clear()
big_window.sug_list.addItems(word_list)
def change_selection():
typo.change('corrector')
big_dialog.hide()
def start_gui():
global Dialog,app
ui = Ui_Dialog()
ui.setupUi(Dialog)
Dialog.show()
ui.button.clicked.connect(partial(show_big_window, big_dialog))
big_window.pushButton.clicked.connect(partial(change_selection))
newhook.KeyDown=keyPress
newhook.HookKeyboard()
newhook.start()
typo.main()
sys.exit(app.exec_())