scrollbars fix

This commit is contained in:
ingvar1995 2016-03-24 21:52:27 +03:00
parent 89a1af8a41
commit d557c7cf8f
4 changed files with 27 additions and 16 deletions

View File

@ -6,6 +6,7 @@ from util import curr_directory
class MessageEdit(QtGui.QPlainTextEdit): class MessageEdit(QtGui.QPlainTextEdit):
def __init__(self, text, width, parent=None): def __init__(self, text, width, parent=None):
super(MessageEdit, self).__init__(parent) super(MessageEdit, self).__init__(parent)
self.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) self.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
@ -34,12 +35,12 @@ class MessageEdit(QtGui.QPlainTextEdit):
self.setTextInteractionFlags(QtCore.Qt.TextSelectableByMouse | QtCore.Qt.LinksAccessibleByMouse) self.setTextInteractionFlags(QtCore.Qt.TextSelectableByMouse | QtCore.Qt.LinksAccessibleByMouse)
class MessageItem(QtGui.QListWidget): class MessageItem(QtGui.QWidget):
""" """
Message in messages list Message in messages list
""" """
def __init__(self, text, time, user='', message_type=TOX_MESSAGE_TYPE['NORMAL'], parent=None): def __init__(self, text, time, user='', message_type=TOX_MESSAGE_TYPE['NORMAL'], parent=None):
QtGui.QListWidget.__init__(self, parent) QtGui.QWidget.__init__(self, parent)
self.name = QtGui.QLabel(self) self.name = QtGui.QLabel(self)
self.name.setGeometry(QtCore.QRect(0, 2, 95, 20)) self.name.setGeometry(QtCore.QRect(0, 2, 95, 20))
self.name.setTextFormat(QtCore.Qt.PlainText) self.name.setTextFormat(QtCore.Qt.PlainText)
@ -80,12 +81,12 @@ class MessageItem(QtGui.QListWidget):
return max(self.h, 25) return max(self.h, 25)
class ContactItem(QtGui.QListWidget): class ContactItem(QtGui.QWidget):
""" """
Contact in friends list Contact in friends list
""" """
def __init__(self, parent=None): def __init__(self, parent=None):
QtGui.QListWidget.__init__(self, parent) QtGui.QWidget.__init__(self, parent)
self.setBaseSize(QtCore.QSize(250, 70)) self.setBaseSize(QtCore.QSize(250, 70))
self.avatar_label = QtGui.QLabel(self) self.avatar_label = QtGui.QLabel(self)
self.avatar_label.setGeometry(QtCore.QRect(3, 3, 64, 64)) self.avatar_label.setGeometry(QtCore.QRect(3, 3, 64, 64))
@ -148,11 +149,12 @@ class StatusCircle(QtGui.QWidget):
paint.end() paint.end()
class FileTransferItem(QtGui.QListWidget): class FileTransferItem(QtGui.QWidget):
def __init__(self, file_name, size, time, user, friend_number, file_number, show_accept, parent=None): def __init__(self, file_name, size, time, user, friend_number, file_number, show_accept, parent=None):
QtGui.QListWidget.__init__(self, parent) QtGui.QWidget.__init__(self, parent)
self.resize(QtCore.QSize(600, 50)) self.resize(QtCore.QSize(600, 50))
self.setStyleSheet('QListWidget { background-color: green; }') self.setStyleSheet('QWidget { background-color: green; }')
self.name = QtGui.QLabel(self) self.name = QtGui.QLabel(self)
self.name.setGeometry(QtCore.QRect(0, 15, 95, 20)) self.name.setGeometry(QtCore.QRect(0, 15, 95, 20))

View File

@ -12,37 +12,28 @@ class LoginScreen(QtGui.QWidget):
self.initUI() self.initUI()
def initUI(self): def initUI(self):
self.setObjectName("login")
self.resize(400, 200) self.resize(400, 200)
self.setMinimumSize(QtCore.QSize(400, 200)) self.setMinimumSize(QtCore.QSize(400, 200))
self.setMaximumSize(QtCore.QSize(400, 200)) self.setMaximumSize(QtCore.QSize(400, 200))
self.setBaseSize(QtCore.QSize(400, 200)) self.setBaseSize(QtCore.QSize(400, 200))
self.new_profile = QtGui.QPushButton(self) self.new_profile = QtGui.QPushButton(self)
self.new_profile.setGeometry(QtCore.QRect(20, 150, 171, 27)) self.new_profile.setGeometry(QtCore.QRect(20, 150, 171, 27))
self.new_profile.setObjectName("new_profile")
self.new_profile.clicked.connect(self.create_profile) self.new_profile.clicked.connect(self.create_profile)
self.label = QtGui.QLabel(self) self.label = QtGui.QLabel(self)
self.label.setGeometry(QtCore.QRect(20, 70, 101, 17)) self.label.setGeometry(QtCore.QRect(20, 70, 101, 17))
self.label.setObjectName("label")
self.new_name = QtGui.QPlainTextEdit(self) self.new_name = QtGui.QPlainTextEdit(self)
self.new_name.setGeometry(QtCore.QRect(20, 100, 171, 31)) self.new_name.setGeometry(QtCore.QRect(20, 100, 171, 31))
self.new_name.setObjectName("new_name")
self.load_profile = QtGui.QPushButton(self) self.load_profile = QtGui.QPushButton(self)
self.load_profile.setGeometry(QtCore.QRect(220, 150, 161, 27)) self.load_profile.setGeometry(QtCore.QRect(220, 150, 161, 27))
self.load_profile.setObjectName("load_profile")
self.load_profile.clicked.connect(self.load_ex_profile) self.load_profile.clicked.connect(self.load_ex_profile)
self.default = QtGui.QCheckBox(self) self.default = QtGui.QCheckBox(self)
self.default.setGeometry(QtCore.QRect(220, 110, 131, 22)) self.default.setGeometry(QtCore.QRect(220, 110, 131, 22))
self.default.setObjectName("default")
self.groupBox = QtGui.QGroupBox(self) self.groupBox = QtGui.QGroupBox(self)
self.groupBox.setGeometry(QtCore.QRect(210, 40, 181, 151)) self.groupBox.setGeometry(QtCore.QRect(210, 40, 181, 151))
self.groupBox.setObjectName("groupBox")
self.comboBox = QtGui.QComboBox(self.groupBox) self.comboBox = QtGui.QComboBox(self.groupBox)
self.comboBox.setGeometry(QtCore.QRect(10, 30, 161, 27)) self.comboBox.setGeometry(QtCore.QRect(10, 30, 161, 27))
self.comboBox.setObjectName("comboBox")
self.groupBox_2 = QtGui.QGroupBox(self) self.groupBox_2 = QtGui.QGroupBox(self)
self.groupBox_2.setGeometry(QtCore.QRect(10, 40, 191, 151)) self.groupBox_2.setGeometry(QtCore.QRect(10, 40, 191, 151))
self.groupBox_2.setObjectName("groupBox_2")
self.toxygen = QtGui.QLabel(self) self.toxygen = QtGui.QLabel(self)
self.groupBox.raise_() self.groupBox.raise_()
self.groupBox_2.raise_() self.groupBox_2.raise_()

View File

@ -200,15 +200,18 @@ class MainWindow(QtGui.QMainWindow):
def setup_left_center(self, widget): def setup_left_center(self, widget):
self.friends_list = QtGui.QListWidget(widget) self.friends_list = QtGui.QListWidget(widget)
self.friends_list.setObjectName("friends_list")
self.friends_list.setGeometry(0, 0, 270, 250) self.friends_list.setGeometry(0, 0, 270, 250)
self.friends_list.clicked.connect(self.friend_click) self.friends_list.clicked.connect(self.friend_click)
self.friends_list.setContextMenuPolicy(QtCore.Qt.CustomContextMenu) self.friends_list.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
self.friends_list.connect(self.friends_list, QtCore.SIGNAL("customContextMenuRequested(QPoint)"), self.friends_list.connect(self.friends_list, QtCore.SIGNAL("customContextMenuRequested(QPoint)"),
self.friend_right_click) self.friend_right_click)
self.friends_list.setVerticalScrollMode(QtGui.QAbstractItemView.ScrollPerPixel)
def setup_right_center(self, widget): def setup_right_center(self, widget):
self.messages = QtGui.QListWidget(widget) self.messages = QtGui.QListWidget(widget)
self.messages.setGeometry(0, 0, 620, 250) self.messages.setGeometry(0, 0, 620, 250)
self.messages.setVerticalScrollMode(QtGui.QAbstractItemView.ScrollPerPixel)
def initUI(self, tox): def initUI(self, tox):
self.setMinimumSize(920, 520) self.setMinimumSize(920, 520)

View File

@ -1251,3 +1251,18 @@ QPushButton:hover
{ {
background-color: #4A4949; background-color: #4A4949;
} }
QListWidget QListWidgetItem:selected
{
background-color: #4A4949;
}
#friends_list:item:selected
{
background-color: #A9A9A9;
}
#toxygen
{
color: #006400;
}