ui improvements (file transfers)

This commit is contained in:
ingvar1995 2016-04-01 16:38:33 +03:00
parent 9ad2adaf5a
commit aa940f92e5
6 changed files with 22 additions and 21 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 91 KiB

After

Width:  |  Height:  |  Size: 112 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 114 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 118 KiB

View File

@ -138,7 +138,7 @@ class FileTransferItem(QtGui.QListWidget):
def __init__(self, file_name, size, time, user, friend_number, file_number, state, parent=None): def __init__(self, file_name, size, time, user, friend_number, file_number, state, parent=None):
QtGui.QListWidget.__init__(self, parent) QtGui.QListWidget.__init__(self, parent)
self.resize(QtCore.QSize(600, 50)) self.resize(QtCore.QSize(620, 50))
if state != FILE_TRANSFER_MESSAGE_STATUS['CANCELLED']: if state != FILE_TRANSFER_MESSAGE_STATUS['CANCELLED']:
self.setStyleSheet('QWidget { background-color: green; }') self.setStyleSheet('QWidget { background-color: green; }')
else: else:
@ -152,16 +152,14 @@ class FileTransferItem(QtGui.QListWidget):
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 if len(user) <= 14 else user[:11] + '...') self.name.setText(user if len(user) <= 14 else user[:11] + '...')
self.name.setStyleSheet('QLabel { color: black; }') self.name.setStyleSheet('QLabel { color: black; }')
self.time = QtGui.QLabel(self) self.time = QtGui.QLabel(self)
self.time.setGeometry(QtCore.QRect(550, 2, 50, 46)) self.time.setGeometry(QtCore.QRect(570, 2, 50, 46))
font.setPointSize(10) font.setPointSize(10)
font.setBold(False) font.setBold(False)
self.time.setFont(font) self.time.setFont(font)
self.time.setObjectName("time")
self.time.setText(convert_time(time)) self.time.setText(convert_time(time))
self.time.setStyleSheet('QLabel { color: black; }') self.time.setStyleSheet('QLabel { color: black; }')
@ -173,6 +171,7 @@ class FileTransferItem(QtGui.QListWidget):
self.cancel.setIconSize(QtCore.QSize(30, 30)) self.cancel.setIconSize(QtCore.QSize(30, 30))
self.cancel.setVisible(state > 1) self.cancel.setVisible(state > 1)
self.cancel.clicked.connect(lambda: self.cancel_transfer(friend_number, file_number)) self.cancel.clicked.connect(lambda: self.cancel_transfer(friend_number, file_number))
self.cancel.setStyleSheet('QPushButton:hover { border: 1px solid #3A3939; }')
self.accept = QtGui.QPushButton(self) self.accept = QtGui.QPushButton(self)
self.accept.setGeometry(QtCore.QRect(450, 2, 46, 46)) self.accept.setGeometry(QtCore.QRect(450, 2, 46, 46))
@ -182,10 +181,12 @@ class FileTransferItem(QtGui.QListWidget):
self.accept.setIconSize(QtCore.QSize(30, 30)) self.accept.setIconSize(QtCore.QSize(30, 30))
self.accept.clicked.connect(lambda: self.accept_transfer(friend_number, file_number, size)) self.accept.clicked.connect(lambda: self.accept_transfer(friend_number, file_number, size))
self.accept.setVisible(state == FILE_TRANSFER_MESSAGE_STATUS['INCOMING_NOT_STARTED']) self.accept.setVisible(state == FILE_TRANSFER_MESSAGE_STATUS['INCOMING_NOT_STARTED'])
self.accept.setStyleSheet('QPushButton:hover { border: 1px solid #3A3939; }')
self.pb = QtGui.QProgressBar(self) self.pb = QtGui.QProgressBar(self)
self.pb.setGeometry(QtCore.QRect(100, 15, 100, 20)) self.pb.setGeometry(QtCore.QRect(100, 15, 100, 20))
self.pb.setValue(0) self.pb.setValue(0)
self.pb.setStyleSheet('QProgressBar { background-color: #302F2F; }')
if state < 2: if state < 2:
self.pb.setVisible(False) self.pb.setVisible(False)
@ -193,7 +194,6 @@ class FileTransferItem(QtGui.QListWidget):
self.file_name.setGeometry(QtCore.QRect(210, 2, 230, 46)) self.file_name.setGeometry(QtCore.QRect(210, 2, 230, 46))
font.setPointSize(12) font.setPointSize(12)
self.file_name.setFont(font) self.file_name.setFont(font)
self.file_name.setObjectName("time")
file_size = size / 1024 file_size = size / 1024
if not file_size: if not file_size:
file_size = '{}B'.format(size) file_size = '{}B'.format(size)

View File

@ -169,8 +169,9 @@ class Contact(object):
avatar_path = 'avatar.png' avatar_path = 'avatar.png'
os.chdir(curr_directory() + '/images/') os.chdir(curr_directory() + '/images/')
pixmap = QtGui.QPixmap(QtCore.QSize(64, 64)) pixmap = QtGui.QPixmap(QtCore.QSize(64, 64))
pixmap.scaled(64, 64, QtCore.Qt.KeepAspectRatio) pixmap.load(avatar_path)
self._widget.avatar_label.setPixmap(avatar_path) self._widget.avatar_label.setScaledContents(False)
self._widget.avatar_label.setPixmap(pixmap.scaled(64, 64, QtCore.Qt.KeepAspectRatio))
self._widget.avatar_label.repaint() self._widget.avatar_label.repaint()
def reset_avatar(self): def reset_avatar(self):
@ -473,8 +474,9 @@ class Profile(Contact, Singleton):
if not os.path.isfile(avatar_path): # load default image if not os.path.isfile(avatar_path): # load default image
avatar_path = curr_directory() + '/images/avatar.png' avatar_path = curr_directory() + '/images/avatar.png'
pixmap = QtGui.QPixmap(QtCore.QSize(64, 64)) pixmap = QtGui.QPixmap(QtCore.QSize(64, 64))
pixmap.scaled(64, 64, QtCore.Qt.KeepAspectRatio) pixmap.load(avatar_path)
self._screen.account_avatar.setPixmap(avatar_path) self._screen.account_avatar.setScaledContents(False)
self._screen.account_avatar.setPixmap(pixmap.scaled(64, 64, QtCore.Qt.KeepAspectRatio))
self._screen.account_avatar.repaint() self._screen.account_avatar.repaint()
except: # no friend found. ignore except: # no friend found. ignore
log('Incorrect friend value: ' + str(value)) log('Incorrect friend value: ' + str(value))

View File

@ -22,16 +22,6 @@
* THE SOFTWARE. * THE SOFTWARE.
*/ */
QProgressBar:horizontal {
border: 1px solid #3A3939;
text-align: center;
padding: 1px;
background: #201F1F;
}
QProgressBar::chunk:horizontal {
background-color: qlineargradient(spread:reflect, x1:1, y1:0.545, x2:1, y2:0, stop:0 rgba(28, 66, 111, 255), stop:1 rgba(37, 87, 146, 255));
}
QToolTip QToolTip
{ {
border: 1px solid #3A3939; border: 1px solid #3A3939;
@ -63,6 +53,16 @@ QWidget:item:selected
background-color: #A9A9A9; background-color: #A9A9A9;
} }
QProgressBar:horizontal {
border: 1px solid #3A3939;
text-align: center;
padding: 1px;
background: #201F1F;
}
QProgressBar::chunk:horizontal {
background-color: qlineargradient(spread:reflect, x1:1, y1:0.545, x2:1, y2:0, stop:0 rgba(28, 66, 111, 255), stop:1 rgba(37, 87, 146, 255));
}
QCheckBox QCheckBox
{ {
spacing: 5px; spacing: 5px;
@ -1267,5 +1267,4 @@ QPushButton:hover
#toxygen #toxygen
{ {
color: #A9A9A9; color: #A9A9A9;
} }