forked from jobin05/erpnext_tally_migrator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pyqt.py
73 lines (53 loc) · 2.24 KB
/
pyqt.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
import sys
from PyQt5.QtWidgets import QMainWindow, QApplication, QLineEdit, QPushButton
class TallyMigratorWindow(QMainWindow):
def __init__(self):
super().__init__()
self.init_ui()
def init_ui(self):
self.setup_window()
self.setup_textboxes()
self.setup_buttons()
self.center()
self.show()
def setup_window(self):
self.setGeometry(0, 0, 240, 260)
self.setWindowTitle('Tally Migrator')
def setup_textboxes(self):
self.textbox_erpnext_subdomain = QLineEdit(self)
self.textbox_erpnext_subdomain.move(20, 20)
self.textbox_erpnext_subdomain.resize(200, 20)
self.textbox_erpnext_username = QLineEdit(self)
self.textbox_erpnext_username.move(20, 60)
self.textbox_erpnext_username.resize(200, 20)
self.textbox_erpnext_password = QLineEdit(self)
self.textbox_erpnext_password.move(20, 100)
self.textbox_erpnext_password.resize(200, 20)
self.textbox_tally_ip = QLineEdit(self)
self.textbox_tally_ip.move(20, 180)
self.textbox_tally_ip.resize(200, 20)
self.textbox_tally_ip.setText("localhost")
self.textbox_tally_port = QLineEdit(self)
self.textbox_tally_port.move(20, 220)
self.textbox_tally_port.resize(200, 20)
self.textbox_tally_port.setText("9000")
def setup_buttons(self):
self.button_connect = QPushButton('Connect', self)
self.button_connect.move(20, 140)
self.button_connect.resize(200, 20)
self.button_connect.clicked.connect(self.on_click_connect)
# Copied from StackOverflow
# https://stackoverflow.com/questions/20243637/pyqt4-center-window-on-active-screen
# Thanks to Andy
def center(self):
frame = self.frameGeometry()
screen = QApplication.desktop().screenNumber(QApplication.desktop().cursor().pos())
centerPoint = QApplication.desktop().screenGeometry(screen).center()
frame.moveCenter(centerPoint)
self.move(frame.topLeft())
def on_click_connect(self):
print("Clicked Connect")
if __name__ == '__main__':
tall_migrator_app = QApplication(sys.argv)
tally_migrator_window = TallyMigratorWindow()
tall_migrator_app.exec_()