ui: fixes

This commit is contained in:
ingvar1995 2016-06-16 12:29:45 +03:00
parent 96705ed1cc
commit e75190f767
2 changed files with 8 additions and 25 deletions

View File

@ -101,14 +101,13 @@ class MessageItem(QtGui.QWidget):
def __init__(self, text, time, user='', sent=True, message_type=TOX_MESSAGE_TYPE['NORMAL'], parent=None): def __init__(self, text, time, user='', sent=True, message_type=TOX_MESSAGE_TYPE['NORMAL'], parent=None):
QtGui.QWidget.__init__(self, parent) QtGui.QWidget.__init__(self, parent)
self.name = DataLabel(self) self.name = DataLabel(self)
self.name.setGeometry(QtCore.QRect(0, 2, 95, 20)) self.name.setGeometry(QtCore.QRect(2, 2, 95, 20))
self.name.setTextFormat(QtCore.Qt.PlainText) self.name.setTextFormat(QtCore.Qt.PlainText)
font = QtGui.QFont() font = QtGui.QFont()
font.setFamily("Times New Roman") font.setFamily("Times New Roman")
font.setPointSize(11) font.setPointSize(11)
font.setBold(True) font.setBold(True)
self.name.setFont(font) self.name.setFont(font)
self.name.setObjectName("name")
self.name.setText(user) self.name.setText(user)
self.time = QtGui.QLabel(self) self.time = QtGui.QLabel(self)
@ -140,7 +139,6 @@ class MessageItem(QtGui.QWidget):
def mark_as_sent(self): def mark_as_sent(self):
if hasattr(self, 't'): if hasattr(self, 't'):
self.time.setText(self.t) self.time.setText(self.t)
self.time.repaint()
del self.t del self.t
return True return True
return False return False
@ -164,16 +162,13 @@ class ContactItem(QtGui.QWidget):
font.setPointSize(12) font.setPointSize(12)
font.setBold(True) font.setBold(True)
self.name.setFont(font) self.name.setFont(font)
self.name.setObjectName("name")
self.status_message = DataLabel(self) self.status_message = DataLabel(self)
self.status_message.setGeometry(QtCore.QRect(75, 30, 180, 20)) self.status_message.setGeometry(QtCore.QRect(75, 30, 180, 20))
font.setPointSize(10) font.setPointSize(10)
font.setBold(False) font.setBold(False)
self.status_message.setFont(font) self.status_message.setFont(font)
self.status_message.setObjectName("status_message")
self.connection_status = StatusCircle(self) self.connection_status = StatusCircle(self)
self.connection_status.setGeometry(QtCore.QRect(243, 5, 32, 32)) self.connection_status.setGeometry(QtCore.QRect(243, 5, 32, 32))
self.connection_status.setObjectName("connection_status")
class StatusCircle(QtGui.QWidget): class StatusCircle(QtGui.QWidget):

View File

@ -109,7 +109,6 @@ class MainWindow(QtGui.QMainWindow):
self.online_contacts.setCurrentIndex(int(Settings.get_instance()['show_online_friends'])) self.online_contacts.setCurrentIndex(int(Settings.get_instance()['show_online_friends']))
def setup_right_bottom(self, Form): def setup_right_bottom(self, Form):
Form.setObjectName("right_bottom")
Form.resize(650, 60) Form.resize(650, 60)
self.messageEdit = MessageArea(Form, self) self.messageEdit = MessageArea(Form, self)
self.messageEdit.setGeometry(QtCore.QRect(0, 3, 450, 55)) self.messageEdit.setGeometry(QtCore.QRect(0, 3, 450, 55))
@ -160,7 +159,6 @@ class MainWindow(QtGui.QMainWindow):
QtCore.QMetaObject.connectSlotsByName(Form) QtCore.QMetaObject.connectSlotsByName(Form)
def setup_left_top(self, Form): def setup_left_top(self, Form):
Form.setObjectName("left_top")
Form.setCursor(QtCore.Qt.PointingHandCursor) Form.setCursor(QtCore.Qt.PointingHandCursor)
Form.setMinimumSize(QtCore.QSize(270, 100)) Form.setMinimumSize(QtCore.QSize(270, 100))
Form.setMaximumSize(QtCore.QSize(270, 100)) Form.setMaximumSize(QtCore.QSize(270, 100))
@ -191,7 +189,6 @@ class MainWindow(QtGui.QMainWindow):
Form.connection_status.setObjectName("connection_status") Form.connection_status.setObjectName("connection_status")
def setup_right_top(self, Form): def setup_right_top(self, Form):
Form.setObjectName("Form")
Form.resize(650, 100) Form.resize(650, 100)
self.account_avatar = QtGui.QLabel(Form) self.account_avatar = QtGui.QLabel(Form)
self.account_avatar.setGeometry(QtCore.QRect(10, 30, 64, 64)) self.account_avatar.setGeometry(QtCore.QRect(10, 30, 64, 64))
@ -268,33 +265,27 @@ class MainWindow(QtGui.QMainWindow):
main_list = QtGui.QWidget() main_list = QtGui.QWidget()
messages = QtGui.QWidget() messages = QtGui.QWidget()
message_buttons = QtGui.QWidget() message_buttons = QtGui.QWidget()
if not Settings.get_instance()['mirror_mode']:
self.setup_left_center_menu(search) self.setup_left_center_menu(search)
grid.addWidget(search, 1, 0)
self.setup_left_top(name) self.setup_left_top(name)
grid.addWidget(name, 0, 0)
self.setup_right_center(messages) self.setup_right_center(messages)
grid.addWidget(messages, 1, 1, 2, 1)
self.setup_right_top(info) self.setup_right_top(info)
grid.addWidget(info, 0, 1)
self.setup_right_bottom(message_buttons) self.setup_right_bottom(message_buttons)
grid.addWidget(message_buttons, 3, 1)
self.setup_left_center(main_list) self.setup_left_center(main_list)
if not Settings.get_instance()['mirror_mode']:
grid.addWidget(search, 1, 0)
grid.addWidget(name, 0, 0)
grid.addWidget(messages, 1, 1, 2, 1)
grid.addWidget(info, 0, 1)
grid.addWidget(message_buttons, 3, 1)
grid.addWidget(main_list, 2, 0, 2, 1) grid.addWidget(main_list, 2, 0, 2, 1)
grid.setColumnMinimumWidth(1, 500) grid.setColumnMinimumWidth(1, 500)
grid.setColumnMinimumWidth(0, 270) grid.setColumnMinimumWidth(0, 270)
else: else:
self.setup_left_center_menu(search)
grid.addWidget(search, 1, 1) grid.addWidget(search, 1, 1)
self.setup_left_top(name)
grid.addWidget(name, 0, 1) grid.addWidget(name, 0, 1)
self.setup_right_center(messages)
grid.addWidget(messages, 1, 0, 2, 1) grid.addWidget(messages, 1, 0, 2, 1)
self.setup_right_top(info)
grid.addWidget(info, 0, 0) grid.addWidget(info, 0, 0)
self.setup_right_bottom(message_buttons)
grid.addWidget(message_buttons, 3, 0) grid.addWidget(message_buttons, 3, 0)
self.setup_left_center(main_list)
grid.addWidget(main_list, 2, 1, 2, 1) grid.addWidget(main_list, 2, 1, 2, 1)
grid.setColumnMinimumWidth(0, 500) grid.setColumnMinimumWidth(0, 500)
grid.setColumnMinimumWidth(1, 280) grid.setColumnMinimumWidth(1, 280)
@ -388,10 +379,7 @@ class MainWindow(QtGui.QMainWindow):
self.audio_s.show() self.audio_s.show()
def show_menu(self): def show_menu(self):
if hasattr(self, 'menu') and self.menu.isVisible(): if not hasattr(self, 'menu'):
self.menu.hide()
return
elif not hasattr(self, 'menu'):
self.menu = DropdownMenu(self) self.menu = DropdownMenu(self)
self.menu.setGeometry(QtCore.QRect(0 if Settings.get_instance()['mirror_mode'] else 270, self.menu.setGeometry(QtCore.QRect(0 if Settings.get_instance()['mirror_mode'] else 270,
self.height() - 100, self.height() - 100,