Merge pull request #762 from mig5/textwrap_upload_filename_widget

#704 wrap the upload filename label if too long
This commit is contained in:
Micah Lee 2018-09-19 18:33:30 -07:00 committed by GitHub
commit d0d4d61008
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -19,6 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
""" """
import os import os
import subprocess import subprocess
import textwrap
from datetime import datetime from datetime import datetime
from PyQt5 import QtCore, QtWidgets, QtGui from PyQt5 import QtCore, QtWidgets, QtGui
@ -306,10 +307,7 @@ class Uploads(QtWidgets.QScrollArea):
try: try:
for upload in self.uploads.values(): for upload in self.uploads.values():
for item in upload.files.values(): for item in upload.files.values():
if item.filename_label_width > width: item.filename_label.setText(textwrap.fill(item.filename, 30))
item.filename_label.setText(item.filename[:25] + '[...]') item.adjustSize()
item.adjustSize()
if width > item.filename_label_width:
item.filename_label.setText(item.filename)
except: except:
pass pass