2016-02-17 21:47:43 +01:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
|
|
|
import sys
|
|
|
|
from PySide import QtGui, QtCore
|
|
|
|
|
|
|
|
|
2016-02-21 15:32:38 +01:00
|
|
|
class MainWindow(QtGui.QMainWindow):
|
2016-02-17 21:47:43 +01:00
|
|
|
|
|
|
|
def __init__(self):
|
|
|
|
super(MainWindow, self).__init__()
|
|
|
|
self.initUI()
|
|
|
|
|
2016-02-21 15:32:38 +01:00
|
|
|
def setup_menu(self, MainWindow):
|
|
|
|
self.menubar = QtGui.QMenuBar(MainWindow)
|
|
|
|
self.menubar.setObjectName("menubar")
|
|
|
|
self.menuProfile = QtGui.QMenu(self.menubar)
|
|
|
|
self.menuProfile.setObjectName("menuProfile")
|
|
|
|
self.menuSettings = QtGui.QMenu(self.menubar)
|
|
|
|
self.menuSettings.setObjectName("menuSettings")
|
|
|
|
self.menuAbout = QtGui.QMenu(self.menubar)
|
|
|
|
self.menuAbout.setObjectName("menuAbout")
|
|
|
|
self.statusbar = QtGui.QStatusBar(MainWindow)
|
|
|
|
self.statusbar.setObjectName("statusbar")
|
|
|
|
self.actionAdd_friend = QtGui.QAction(MainWindow)
|
|
|
|
self.actionAdd_friend.setObjectName("actionAdd_friend")
|
|
|
|
self.actionProfile_settings = QtGui.QAction(MainWindow)
|
|
|
|
self.actionProfile_settings.setObjectName("actionProfile_settings")
|
|
|
|
self.actionPrivacy_settings = QtGui.QAction(MainWindow)
|
|
|
|
self.actionPrivacy_settings.setObjectName("actionPrivacy_settings")
|
|
|
|
self.actionInterface_settings = QtGui.QAction(MainWindow)
|
|
|
|
self.actionInterface_settings.setObjectName("actionInterface_settings")
|
|
|
|
self.actionNotifications = QtGui.QAction(MainWindow)
|
|
|
|
self.actionNotifications.setObjectName("actionNotifications")
|
|
|
|
self.actionNetwork = QtGui.QAction(MainWindow)
|
|
|
|
self.actionNetwork.setObjectName("actionNetwork")
|
|
|
|
self.actionAbout_program = QtGui.QAction(MainWindow)
|
|
|
|
self.actionAbout_program.setObjectName("actionAbout_program")
|
|
|
|
self.actionSettings = QtGui.QAction(MainWindow)
|
|
|
|
self.actionSettings.setObjectName("actionSettings")
|
|
|
|
self.menuProfile.addAction(self.actionAdd_friend)
|
|
|
|
self.menuProfile.addAction(self.actionSettings)
|
|
|
|
self.menuSettings.addAction(self.actionPrivacy_settings)
|
|
|
|
self.menuSettings.addAction(self.actionInterface_settings)
|
|
|
|
self.menuSettings.addAction(self.actionNotifications)
|
|
|
|
self.menuSettings.addAction(self.actionNetwork)
|
|
|
|
self.menuAbout.addAction(self.actionAbout_program)
|
2016-02-21 21:25:37 +01:00
|
|
|
self.actionAbout_program.triggered.connect(self.about_program)
|
2016-02-21 15:32:38 +01:00
|
|
|
self.menubar.addAction(self.menuProfile.menuAction())
|
|
|
|
self.menubar.addAction(self.menuSettings.menuAction())
|
|
|
|
self.menubar.addAction(self.menuAbout.menuAction())
|
|
|
|
|
|
|
|
self.menuProfile.setTitle(QtGui.QApplication.translate("MainWindow", "Profile", None, QtGui.QApplication.UnicodeUTF8))
|
|
|
|
self.menuSettings.setTitle(QtGui.QApplication.translate("MainWindow", "Settings", None, QtGui.QApplication.UnicodeUTF8))
|
|
|
|
self.menuAbout.setTitle(QtGui.QApplication.translate("MainWindow", "About", None, QtGui.QApplication.UnicodeUTF8))
|
|
|
|
self.actionAdd_friend.setText(QtGui.QApplication.translate("MainWindow", "Add contact", None, QtGui.QApplication.UnicodeUTF8))
|
|
|
|
self.actionProfile_settings.setText(QtGui.QApplication.translate("MainWindow", "Profile", None, QtGui.QApplication.UnicodeUTF8))
|
|
|
|
self.actionPrivacy_settings.setText(QtGui.QApplication.translate("MainWindow", "Privacy", None, QtGui.QApplication.UnicodeUTF8))
|
|
|
|
self.actionInterface_settings.setText(QtGui.QApplication.translate("MainWindow", "Interface", None, QtGui.QApplication.UnicodeUTF8))
|
|
|
|
self.actionNotifications.setText(QtGui.QApplication.translate("MainWindow", "Notifications", None, QtGui.QApplication.UnicodeUTF8))
|
|
|
|
self.actionNetwork.setText(QtGui.QApplication.translate("MainWindow", "Network", None, QtGui.QApplication.UnicodeUTF8))
|
|
|
|
self.actionAbout_program.setText(QtGui.QApplication.translate("MainWindow", "About program", None, QtGui.QApplication.UnicodeUTF8))
|
|
|
|
self.actionSettings.setText(QtGui.QApplication.translate("MainWindow", "Settings", None, QtGui.QApplication.UnicodeUTF8))
|
|
|
|
QtCore.QMetaObject.connectSlotsByName(MainWindow)
|
|
|
|
|
2016-02-21 21:25:37 +01:00
|
|
|
def about_program(self):
|
|
|
|
import util
|
|
|
|
msgBox = QtGui.QMessageBox()
|
|
|
|
msgBox.setWindowTitle("About")
|
|
|
|
msgBox.setText("Toxygen is pythonic Tox client. Version: " + util.program_version)
|
|
|
|
msgBox.exec_()
|
|
|
|
|
2016-02-18 15:02:00 +01:00
|
|
|
def setup_right_bottom(self, Form):
|
|
|
|
Form.setObjectName("right_bottom")
|
|
|
|
Form.resize(500, 150)
|
|
|
|
Form.setMinimumSize(QtCore.QSize(100, 50))
|
|
|
|
self.messageEdit = QtGui.QTextEdit(Form)
|
|
|
|
self.messageEdit.setGeometry(QtCore.QRect(20, 20, 311, 111))
|
|
|
|
self.messageEdit.setObjectName("messageEdit")
|
|
|
|
self.screenshotButton = QtGui.QPushButton(Form)
|
|
|
|
self.screenshotButton.setGeometry(QtCore.QRect(340, 10, 98, 61))
|
|
|
|
self.screenshotButton.setObjectName("screenshotButton")
|
|
|
|
self.fileTransferButton = QtGui.QPushButton(Form)
|
|
|
|
self.fileTransferButton.setGeometry(QtCore.QRect(340, 80, 98, 61))
|
|
|
|
self.fileTransferButton.setObjectName("fileTransferButton")
|
|
|
|
self.sendMessageButton = QtGui.QPushButton(Form)
|
|
|
|
self.sendMessageButton.setGeometry(QtCore.QRect(440, 10, 51, 131))
|
|
|
|
self.sendMessageButton.setObjectName("sendMessageButton")
|
|
|
|
self.screenshotButton.setText(QtGui.QApplication.translate("Form", "Screenshot", None, QtGui.QApplication.UnicodeUTF8))
|
|
|
|
self.fileTransferButton.setText(QtGui.QApplication.translate("Form", "File transfer", None, QtGui.QApplication.UnicodeUTF8))
|
|
|
|
self.sendMessageButton.setText(QtGui.QApplication.translate("Form", "Send", None, QtGui.QApplication.UnicodeUTF8))
|
|
|
|
QtCore.QMetaObject.connectSlotsByName(Form)
|
|
|
|
|
|
|
|
def setup_left_center(self, Form):
|
|
|
|
Form.setObjectName("left_center")
|
|
|
|
Form.resize(500, 80)
|
|
|
|
self.online_contacts = QtGui.QCheckBox(Form)
|
|
|
|
self.online_contacts.setGeometry(QtCore.QRect(0, 20, 141, 22))
|
|
|
|
self.online_contacts.setObjectName("online_contacts")
|
|
|
|
self.lineEdit = QtGui.QLineEdit(Form)
|
|
|
|
self.lineEdit.setGeometry(QtCore.QRect(0, 40, 140, 28))
|
|
|
|
self.lineEdit.setObjectName("lineEdit")
|
|
|
|
self.online_contacts.setText(QtGui.QApplication.translate("Form", "Online contacts", None, QtGui.QApplication.UnicodeUTF8))
|
|
|
|
QtCore.QMetaObject.connectSlotsByName(Form)
|
|
|
|
|
2016-02-17 21:47:43 +01:00
|
|
|
def setup_left_top(self, Form):
|
2016-02-18 15:02:00 +01:00
|
|
|
Form.setObjectName("left_top")
|
2016-02-17 21:47:43 +01:00
|
|
|
Form.resize(500, 300)
|
|
|
|
Form.setMinimumSize(QtCore.QSize(250, 100))
|
|
|
|
Form.setMaximumSize(QtCore.QSize(250, 100))
|
|
|
|
Form.setBaseSize(QtCore.QSize(2500, 100))
|
|
|
|
self.graphicsView = QtGui.QGraphicsView(Form)
|
|
|
|
self.graphicsView.setGeometry(QtCore.QRect(10, 20, 64, 64))
|
|
|
|
self.graphicsView.setMinimumSize(QtCore.QSize(64, 64))
|
|
|
|
self.graphicsView.setMaximumSize(QtCore.QSize(64, 64))
|
|
|
|
self.graphicsView.setBaseSize(QtCore.QSize(64, 64))
|
|
|
|
self.graphicsView.setObjectName("graphicsView")
|
|
|
|
self.label = QtGui.QLabel(Form)
|
|
|
|
self.label.setGeometry(QtCore.QRect(80, 30, 191, 17))
|
|
|
|
font = QtGui.QFont()
|
|
|
|
font.setFamily("Times New Roman")
|
|
|
|
font.setPointSize(18)
|
|
|
|
font.setWeight(75)
|
|
|
|
font.setBold(True)
|
|
|
|
self.label.setFont(font)
|
|
|
|
self.label.setObjectName("label")
|
|
|
|
self.label_2 = QtGui.QLabel(Form)
|
|
|
|
self.label_2.setGeometry(QtCore.QRect(80, 60, 191, 17))
|
|
|
|
font = QtGui.QFont()
|
|
|
|
font.setFamily("Times New Roman")
|
|
|
|
font.setPointSize(16)
|
|
|
|
font.setWeight(50)
|
|
|
|
font.setBold(False)
|
|
|
|
self.label_2.setFont(font)
|
|
|
|
self.label_2.setObjectName("label_2")
|
|
|
|
self.graphicsView_2 = QtGui.QGraphicsView(Form)
|
|
|
|
self.graphicsView_2.setGeometry(QtCore.QRect(200, 34, 64, 64))
|
|
|
|
self.graphicsView_2.setMinimumSize(QtCore.QSize(32, 32))
|
|
|
|
self.graphicsView_2.setMaximumSize(QtCore.QSize(32, 32))
|
|
|
|
self.graphicsView_2.setBaseSize(QtCore.QSize(32, 32))
|
|
|
|
self.graphicsView_2.setObjectName("graphicsView_2")
|
|
|
|
|
2016-02-18 15:02:00 +01:00
|
|
|
def setup_right_top(self, Form):
|
|
|
|
Form.setObjectName("Form")
|
|
|
|
Form.resize(495, 111)
|
|
|
|
self.graphicsView = QtGui.QGraphicsView(Form)
|
|
|
|
self.graphicsView.setGeometry(QtCore.QRect(10, 20, 64, 64))
|
|
|
|
self.graphicsView.setObjectName("graphicsView")
|
|
|
|
self.account_name = QtGui.QLabel(Form)
|
|
|
|
self.account_name.setGeometry(QtCore.QRect(100, 20, 211, 17))
|
|
|
|
font = QtGui.QFont()
|
|
|
|
font.setWeight(75)
|
|
|
|
font.setBold(True)
|
|
|
|
self.account_name.setFont(font)
|
|
|
|
self.account_name.setObjectName("account_name")
|
|
|
|
self.account_status = QtGui.QLabel(Form)
|
|
|
|
self.account_status.setGeometry(QtCore.QRect(100, 50, 211, 17))
|
|
|
|
font = QtGui.QFont()
|
|
|
|
font.setWeight(50)
|
|
|
|
font.setBold(False)
|
|
|
|
self.account_status.setFont(font)
|
|
|
|
self.account_status.setObjectName("account_status")
|
|
|
|
self.callButton = QtGui.QPushButton(Form)
|
|
|
|
self.callButton.setGeometry(QtCore.QRect(380, 30, 98, 27))
|
|
|
|
self.callButton.setObjectName("callButton")
|
|
|
|
self.account_name.setText(QtGui.QApplication.translate("Form", "TextLabel", None, QtGui.QApplication.UnicodeUTF8))
|
|
|
|
self.account_status.setText(QtGui.QApplication.translate("Form", "TextLabel", None, QtGui.QApplication.UnicodeUTF8))
|
|
|
|
self.callButton.setText(QtGui.QApplication.translate("Form", "Start call", None, QtGui.QApplication.UnicodeUTF8))
|
|
|
|
QtCore.QMetaObject.connectSlotsByName(Form)
|
2016-02-17 21:47:43 +01:00
|
|
|
|
2016-02-18 15:02:00 +01:00
|
|
|
def initUI(self):
|
2016-02-21 15:32:38 +01:00
|
|
|
main = QtGui.QWidget()
|
2016-02-17 21:47:43 +01:00
|
|
|
grid = QtGui.QGridLayout()
|
2016-02-18 15:02:00 +01:00
|
|
|
search = QtGui.QWidget()
|
2016-02-18 17:15:38 +01:00
|
|
|
grid.setColumnStretch(1, 1)
|
2016-02-18 15:02:00 +01:00
|
|
|
self.setup_left_center(search)
|
|
|
|
grid.addWidget(search, 1, 0)
|
2016-02-17 21:47:43 +01:00
|
|
|
name = QtGui.QWidget()
|
|
|
|
self.setup_left_top(name)
|
|
|
|
grid.addWidget(name, 0, 0)
|
2016-02-18 15:02:00 +01:00
|
|
|
info = QtGui.QWidget()
|
|
|
|
self.setup_right_top(info)
|
|
|
|
grid.addWidget(info, 0, 1)
|
|
|
|
message = QtGui.QWidget()
|
|
|
|
self.setup_right_bottom(message)
|
|
|
|
grid.addWidget(message, 2, 1)
|
2016-02-21 15:32:38 +01:00
|
|
|
main.setLayout(grid)
|
|
|
|
self.setup_menu(main)
|
|
|
|
self.setCentralWidget(main)
|
2016-02-18 15:02:00 +01:00
|
|
|
self.setMinimumSize(800, 400)
|
|
|
|
self.setGeometry(400, 400, 800, 400)
|
2016-02-17 21:47:43 +01:00
|
|
|
self.setWindowTitle('Toxygen')
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
app = QtGui.QApplication(sys.argv)
|
|
|
|
ex = MainWindow()
|
|
|
|
sys.exit(app.exec_())
|