-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTebNoApp.py
43 lines (31 loc) · 1.37 KB
/
TebNoApp.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
from PyQt5.QtWidgets import QWidget, QApplication
from PyQt5 import QtGui, QtCore
from TebNo import Ui_TebNoContainer
from database import TableHandling
from OSHandling import OSHandling
class TebNoWindow(QWidget, Ui_TebNoContainer):
def __init__(self):
super().__init__()
# TableHandling.tablesCreating()
self.setupUi(self)
self.nationalCode.installEventFilter(self)
self.phoneNumber.installEventFilter(self)
self.birthDate.installEventFilter(self)
self.setWindowTitle("طبنو")
self.setWindowIcon(QtGui.QIcon(':/images/TebNoLogo.png'))
self.show()
def eventFilter(self, source, event):
if event.type() == QtCore.QEvent.MouseButtonPress:
if source == self.nationalCode:
self.nationalCode.setFocus(QtCore.Qt.MouseFocusReason)
self.nationalCode.setCursorPosition(0)
return True
if source == self.phoneNumber:
self.phoneNumber.setFocus(QtCore.Qt.MouseFocusReason)
self.phoneNumber.setCursorPosition(0)
return True
if source == self.birthDate:
self.birthDate.setFocus(QtCore.Qt.MouseFocusReason)
self.birthDate.setCursorPosition(1)
return True
return super().eventFilter(source, event)