mirror of
https://github.com/onionshare/onionshare.git
synced 2025-01-27 06:47:07 -05:00
Move all stylesheets definitions into Common, so now we no longer have blocks of css spread across the GUI code, and it's easier to re-use stylesheets
This commit is contained in:
parent
23821ebae6
commit
4d5f1a34cd
@ -132,6 +132,195 @@ class Common(object):
|
||||
r = random.SystemRandom()
|
||||
return '-'.join(r.choice(wordlist) for _ in range(2))
|
||||
|
||||
def define_css(self):
|
||||
"""
|
||||
This defines all of the stylesheets used in GUI mode, to avoid repeating code.
|
||||
This method is only called in GUI mode.
|
||||
"""
|
||||
self.css = {
|
||||
# OnionShareGui styles
|
||||
'mode_switcher_selected_style': """
|
||||
QPushButton {
|
||||
color: #ffffff;
|
||||
background-color: #4e064f;
|
||||
border: 0;
|
||||
border-right: 1px solid #69266b;
|
||||
font-weight: bold;
|
||||
border-radius: 0;
|
||||
}""",
|
||||
|
||||
'mode_switcher_unselected_style': """
|
||||
QPushButton {
|
||||
color: #ffffff;
|
||||
background-color: #601f61;
|
||||
border: 0;
|
||||
font-weight: normal;
|
||||
border-radius: 0;
|
||||
}""",
|
||||
|
||||
'settings_button': """
|
||||
QPushButton {
|
||||
background-color: #601f61;
|
||||
border: 0;
|
||||
border-left: 1px solid #69266b;
|
||||
border-radius: 0;
|
||||
}""",
|
||||
|
||||
'server_status_indicator_label': """
|
||||
QLabel {
|
||||
font-style: italic;
|
||||
color: #666666;
|
||||
padding: 2px;
|
||||
}""",
|
||||
|
||||
'status_bar': """
|
||||
QStatusBar {
|
||||
font-style: italic;
|
||||
color: #666666;
|
||||
}
|
||||
QStatusBar::item {
|
||||
border: 0px;
|
||||
}""",
|
||||
|
||||
# Common styles between ShareMode and ReceiveMode and their child widgets
|
||||
'mode_info_label': """
|
||||
QLabel {
|
||||
font-size: 12px;
|
||||
color: #666666;
|
||||
}
|
||||
""",
|
||||
|
||||
'server_status_url': """
|
||||
QLabel {
|
||||
background-color: #ffffff;
|
||||
color: #000000;
|
||||
padding: 10px;
|
||||
border: 1px solid #666666;
|
||||
}
|
||||
""",
|
||||
|
||||
'server_status_url_buttons': """
|
||||
QPushButton {
|
||||
color: #3f7fcf;
|
||||
}
|
||||
""",
|
||||
|
||||
'server_status_button_stopped': """
|
||||
QPushButton {
|
||||
background-color: #5fa416;
|
||||
color: #ffffff;
|
||||
padding: 10px;
|
||||
border: 0;
|
||||
border-radius: 5px;
|
||||
}""",
|
||||
|
||||
'server_status_button_working': """
|
||||
QPushButton {
|
||||
background-color: #4c8211;
|
||||
color: #ffffff;
|
||||
padding: 10px;
|
||||
border: 0;
|
||||
border-radius: 5px;
|
||||
font-style: italic;
|
||||
}""",
|
||||
|
||||
'server_status_button_started': """
|
||||
QPushButton {
|
||||
background-color: #d0011b;
|
||||
color: #ffffff;
|
||||
padding: 10px;
|
||||
border: 0;
|
||||
border-radius: 5px;
|
||||
}""",
|
||||
|
||||
'downloads_uploads_label': """
|
||||
QLabel {
|
||||
font-weight: bold;
|
||||
font-size 14px;
|
||||
text-align: center;
|
||||
}""",
|
||||
|
||||
'downloads_uploads_progress_bar': """
|
||||
QProgressBar {
|
||||
border: 1px solid #4e064f;
|
||||
background-color: #ffffff !important;
|
||||
text-align: center;
|
||||
color: #9b9b9b;
|
||||
font-size: 12px;
|
||||
}
|
||||
QProgressBar::chunk {
|
||||
background-color: #4e064f;
|
||||
width: 10px;
|
||||
}""",
|
||||
|
||||
# Share mode and child widget styles
|
||||
'share_zip_progess_bar': """
|
||||
QProgressBar {
|
||||
border: 1px solid #4e064f;
|
||||
background-color: #ffffff !important;
|
||||
text-align: center;
|
||||
color: #9b9b9b;
|
||||
}
|
||||
QProgressBar::chunk {
|
||||
border: 0px;
|
||||
background-color: #4e064f;
|
||||
width: 10px;
|
||||
}""",
|
||||
|
||||
'share_filesize_warning': """
|
||||
QLabel {
|
||||
padding: 10px 0;
|
||||
font-weight: bold;
|
||||
color: #333333;
|
||||
}
|
||||
""",
|
||||
|
||||
'share_file_selection_drop_here_label': """
|
||||
QLabel {
|
||||
color: #999999;
|
||||
}""",
|
||||
|
||||
'share_file_selection_drop_count_label': """
|
||||
QLabel {
|
||||
color: #ffffff;
|
||||
background-color: #f44449;
|
||||
font-weight: bold;
|
||||
padding: 5px 10px;
|
||||
border-radius: 10px;
|
||||
}""",
|
||||
|
||||
'share_file_list_drag_enter': """
|
||||
FileList {
|
||||
border: 3px solid #538ad0;
|
||||
}
|
||||
""",
|
||||
|
||||
'share_file_list_drag_leave': """
|
||||
FileList {
|
||||
border: none;
|
||||
}
|
||||
""",
|
||||
|
||||
'share_file_list_item_size': """
|
||||
QLabel {
|
||||
color: #666666;
|
||||
font-size: 11px;
|
||||
}""",
|
||||
|
||||
# Settings dialog
|
||||
'settings_version': """
|
||||
QLabel {
|
||||
color: #666666;
|
||||
}""",
|
||||
|
||||
'settings_tor_status': """
|
||||
QLabel {
|
||||
background-color: #ffffff;
|
||||
color: #000000;
|
||||
padding: 10px;
|
||||
}"""
|
||||
}
|
||||
|
||||
@staticmethod
|
||||
def random_string(num_bytes, output_len=None):
|
||||
"""
|
||||
|
@ -53,6 +53,7 @@ def main():
|
||||
The main() function implements all of the logic that the GUI version of onionshare uses.
|
||||
"""
|
||||
common = Common()
|
||||
common.define_css()
|
||||
|
||||
strings.load_strings(common)
|
||||
print(strings._('version_string').format(common.version))
|
||||
|
@ -80,23 +80,6 @@ class OnionShareGui(QtWidgets.QMainWindow):
|
||||
self.system_tray.show()
|
||||
|
||||
# Mode switcher, to switch between share files and receive files
|
||||
self.mode_switcher_selected_style = """
|
||||
QPushButton {
|
||||
color: #ffffff;
|
||||
background-color: #4e064f;
|
||||
border: 0;
|
||||
border-right: 1px solid #69266b;
|
||||
font-weight: bold;
|
||||
border-radius: 0;
|
||||
}"""
|
||||
self.mode_switcher_unselected_style = """
|
||||
QPushButton {
|
||||
color: #ffffff;
|
||||
background-color: #601f61;
|
||||
border: 0;
|
||||
font-weight: normal;
|
||||
border-radius: 0;
|
||||
}"""
|
||||
self.share_mode_button = QtWidgets.QPushButton(strings._('gui_mode_share_button', True));
|
||||
self.share_mode_button.setFixedHeight(50)
|
||||
self.share_mode_button.clicked.connect(self.share_mode_clicked)
|
||||
@ -109,13 +92,7 @@ class OnionShareGui(QtWidgets.QMainWindow):
|
||||
self.settings_button.setFixedHeight(50)
|
||||
self.settings_button.setIcon( QtGui.QIcon(self.common.get_resource_path('images/settings.png')) )
|
||||
self.settings_button.clicked.connect(self.open_settings)
|
||||
self.settings_button.setStyleSheet("""
|
||||
QPushButton {
|
||||
background-color: #601f61;
|
||||
border: 0;
|
||||
border-left: 1px solid #69266b;
|
||||
border-radius: 0;
|
||||
}""")
|
||||
self.settings_button.setStyleSheet(self.common.css['settings_button'])
|
||||
mode_switcher_layout = QtWidgets.QHBoxLayout();
|
||||
mode_switcher_layout.setSpacing(0)
|
||||
mode_switcher_layout.addWidget(self.share_mode_button)
|
||||
@ -129,7 +106,7 @@ class OnionShareGui(QtWidgets.QMainWindow):
|
||||
self.server_status_image_label = QtWidgets.QLabel()
|
||||
self.server_status_image_label.setFixedWidth(20)
|
||||
self.server_status_label = QtWidgets.QLabel('')
|
||||
self.server_status_label.setStyleSheet('QLabel { font-style: italic; color: #666666; padding: 2px; }')
|
||||
self.server_status_label.setStyleSheet(self.common.css['server_status_indicator_label'])
|
||||
server_status_indicator_layout = QtWidgets.QHBoxLayout()
|
||||
server_status_indicator_layout.addWidget(self.server_status_image_label)
|
||||
server_status_indicator_layout.addWidget(self.server_status_label)
|
||||
@ -139,15 +116,7 @@ class OnionShareGui(QtWidgets.QMainWindow):
|
||||
# Status bar
|
||||
self.status_bar = QtWidgets.QStatusBar()
|
||||
self.status_bar.setSizeGripEnabled(False)
|
||||
self.status_bar.setStyleSheet("""
|
||||
QStatusBar {
|
||||
font-style: italic;
|
||||
color: #666666;
|
||||
}
|
||||
|
||||
QStatusBar::item {
|
||||
border: 0px;
|
||||
}""")
|
||||
self.status_bar.setStyleSheet(self.common.css['status_bar'])
|
||||
self.status_bar.addPermanentWidget(self.server_status_indicator)
|
||||
self.setStatusBar(self.status_bar)
|
||||
|
||||
@ -223,14 +192,14 @@ class OnionShareGui(QtWidgets.QMainWindow):
|
||||
# Based on the current mode, switch the mode switcher button styles,
|
||||
# and show and hide widgets to switch modes
|
||||
if self.mode == self.MODE_SHARE:
|
||||
self.share_mode_button.setStyleSheet(self.mode_switcher_selected_style)
|
||||
self.receive_mode_button.setStyleSheet(self.mode_switcher_unselected_style)
|
||||
self.share_mode_button.setStyleSheet(self.common.css['mode_switcher_selected_style'])
|
||||
self.receive_mode_button.setStyleSheet(self.common.css['mode_switcher_unselected_style'])
|
||||
|
||||
self.share_mode.show()
|
||||
self.receive_mode.hide()
|
||||
else:
|
||||
self.share_mode_button.setStyleSheet(self.mode_switcher_unselected_style)
|
||||
self.receive_mode_button.setStyleSheet(self.mode_switcher_selected_style)
|
||||
self.share_mode_button.setStyleSheet(self.common.css['mode_switcher_unselected_style'])
|
||||
self.receive_mode_button.setStyleSheet(self.common.css['mode_switcher_selected_style'])
|
||||
|
||||
self.share_mode.hide()
|
||||
self.receive_mode.show()
|
||||
@ -414,7 +383,7 @@ class OnionShareGui(QtWidgets.QMainWindow):
|
||||
|
||||
elif event["type"] == Web.REQUEST_CANCELED:
|
||||
mode.handle_request_canceled(event)
|
||||
|
||||
|
||||
elif event["type"] == Web.REQUEST_CLOSE_SERVER:
|
||||
mode.handle_request_close_server(event)
|
||||
|
||||
|
@ -60,10 +60,10 @@ class ReceiveMode(Mode):
|
||||
self.info_show_uploads.setToolTip(strings._('gui_uploads_window_tooltip', True))
|
||||
|
||||
self.info_in_progress_uploads_count = QtWidgets.QLabel()
|
||||
self.info_in_progress_uploads_count.setStyleSheet('QLabel { font-size: 12px; color: #666666; }')
|
||||
self.info_in_progress_uploads_count.setStyleSheet(self.common.css['mode_info_label'])
|
||||
|
||||
self.info_completed_uploads_count = QtWidgets.QLabel()
|
||||
self.info_completed_uploads_count.setStyleSheet('QLabel { font-size: 12px; color: #666666; }')
|
||||
self.info_completed_uploads_count.setStyleSheet(self.common.css['mode_info_label'])
|
||||
|
||||
self.update_uploads_completed()
|
||||
self.update_uploads_in_progress()
|
||||
|
@ -43,7 +43,7 @@ class Uploads(QtWidgets.QScrollArea):
|
||||
self.vbar = self.verticalScrollBar()
|
||||
|
||||
uploads_label = QtWidgets.QLabel(strings._('gui_uploads', True))
|
||||
uploads_label.setStyleSheet('QLabel { font-weight: bold; font-size 14px; text-align: center; }')
|
||||
uploads_label.setStyleSheet(self.common.css['downloads_uploads_label'])
|
||||
self.no_uploads_label = QtWidgets.QLabel(strings._('gui_no_uploads', True))
|
||||
|
||||
self.uploads_layout = QtWidgets.QVBoxLayout()
|
||||
|
@ -90,16 +90,15 @@ class ServerStatus(QtWidgets.QWidget):
|
||||
self.url.setWordWrap(True)
|
||||
self.url.setMinimumHeight(60)
|
||||
self.url.setMinimumSize(self.url.sizeHint())
|
||||
self.url.setStyleSheet('QLabel { background-color: #ffffff; color: #000000; padding: 10px; border: 1px solid #666666; }')
|
||||
self.url.setStyleSheet(self.common.css['server_status_url'])
|
||||
|
||||
url_buttons_style = 'QPushButton { color: #3f7fcf; }'
|
||||
self.copy_url_button = QtWidgets.QPushButton(strings._('gui_copy_url', True))
|
||||
self.copy_url_button.setFlat(True)
|
||||
self.copy_url_button.setStyleSheet(url_buttons_style)
|
||||
self.copy_url_button.setStyleSheet(self.common.css['server_status_url_buttons'])
|
||||
self.copy_url_button.clicked.connect(self.copy_url)
|
||||
self.copy_hidservauth_button = QtWidgets.QPushButton(strings._('gui_copy_hidservauth', True))
|
||||
self.copy_hidservauth_button.setFlat(True)
|
||||
self.copy_hidservauth_button.setStyleSheet(url_buttons_style)
|
||||
self.copy_hidservauth_button.setStyleSheet(self.common.css['server_status_url_buttons'])
|
||||
self.copy_hidservauth_button.clicked.connect(self.copy_hidservauth)
|
||||
url_buttons_layout = QtWidgets.QHBoxLayout()
|
||||
url_buttons_layout.addWidget(self.copy_url_button)
|
||||
@ -187,17 +186,13 @@ class ServerStatus(QtWidgets.QWidget):
|
||||
self.copy_hidservauth_button.hide()
|
||||
|
||||
# Button
|
||||
button_stopped_style = 'QPushButton { background-color: #5fa416; color: #ffffff; padding: 10px; border: 0; border-radius: 5px; }'
|
||||
button_working_style = 'QPushButton { background-color: #4c8211; color: #ffffff; padding: 10px; border: 0; border-radius: 5px; font-style: italic; }'
|
||||
button_started_style = 'QPushButton { background-color: #d0011b; color: #ffffff; padding: 10px; border: 0; border-radius: 5px; }'
|
||||
|
||||
if self.mode == ServerStatus.MODE_SHARE and self.file_selection.get_num_files() == 0:
|
||||
self.server_button.hide()
|
||||
else:
|
||||
self.server_button.show()
|
||||
|
||||
if self.status == self.STATUS_STOPPED:
|
||||
self.server_button.setStyleSheet(button_stopped_style)
|
||||
self.server_button.setStyleSheet(self.common.css['server_status_button_stopped'])
|
||||
self.server_button.setEnabled(True)
|
||||
if self.mode == ServerStatus.MODE_SHARE:
|
||||
self.server_button.setText(strings._('gui_share_start_server', True))
|
||||
@ -207,7 +202,7 @@ class ServerStatus(QtWidgets.QWidget):
|
||||
if self.common.settings.get('shutdown_timeout'):
|
||||
self.shutdown_timeout_container.show()
|
||||
elif self.status == self.STATUS_STARTED:
|
||||
self.server_button.setStyleSheet(button_started_style)
|
||||
self.server_button.setStyleSheet(self.common.css['server_status_button_started'])
|
||||
self.server_button.setEnabled(True)
|
||||
if self.mode == ServerStatus.MODE_SHARE:
|
||||
self.server_button.setText(strings._('gui_share_stop_server', True))
|
||||
@ -221,13 +216,13 @@ class ServerStatus(QtWidgets.QWidget):
|
||||
self.server_button.setToolTip(strings._('gui_receive_stop_server_shutdown_timeout_tooltip', True).format(self.timeout))
|
||||
|
||||
elif self.status == self.STATUS_WORKING:
|
||||
self.server_button.setStyleSheet(button_working_style)
|
||||
self.server_button.setStyleSheet(self.common.css['server_status_button_working'])
|
||||
self.server_button.setEnabled(True)
|
||||
self.server_button.setText(strings._('gui_please_wait'))
|
||||
if self.common.settings.get('shutdown_timeout'):
|
||||
self.shutdown_timeout_container.hide()
|
||||
else:
|
||||
self.server_button.setStyleSheet(button_working_style)
|
||||
self.server_button.setStyleSheet(self.common.css['server_status_button_working'])
|
||||
self.server_button.setEnabled(False)
|
||||
self.server_button.setText(strings._('gui_please_wait'))
|
||||
if self.common.settings.get('shutdown_timeout'):
|
||||
|
@ -360,7 +360,7 @@ class SettingsDialog(QtWidgets.QDialog):
|
||||
self.cancel_button = QtWidgets.QPushButton(strings._('gui_settings_button_cancel', True))
|
||||
self.cancel_button.clicked.connect(self.cancel_clicked)
|
||||
version_label = QtWidgets.QLabel('OnionShare {0:s}'.format(self.common.version))
|
||||
version_label.setStyleSheet('color: #666666')
|
||||
version_label.setStyleSheet(self.common.css['settings_version'])
|
||||
self.help_button = QtWidgets.QPushButton(strings._('gui_settings_button_help', True))
|
||||
self.help_button.clicked.connect(self.help_clicked)
|
||||
buttons_layout = QtWidgets.QHBoxLayout()
|
||||
@ -372,7 +372,7 @@ class SettingsDialog(QtWidgets.QDialog):
|
||||
|
||||
# Tor network connection status
|
||||
self.tor_status = QtWidgets.QLabel()
|
||||
self.tor_status.setStyleSheet('background-color: #ffffff; color: #000000; padding: 10px')
|
||||
self.tor_status.setStyleSheet(self.common.css['settings_tor_status'])
|
||||
self.tor_status.hide()
|
||||
|
||||
# Layout
|
||||
@ -430,7 +430,7 @@ class SettingsDialog(QtWidgets.QDialog):
|
||||
self.receive_allow_receiver_shutdown_checkbox.setCheckState(QtCore.Qt.Checked)
|
||||
else:
|
||||
self.receive_allow_receiver_shutdown_checkbox.setCheckState(QtCore.Qt.Unchecked)
|
||||
|
||||
|
||||
receive_public_mode = self.old_settings.get('receive_public_mode')
|
||||
if receive_public_mode:
|
||||
self.receive_public_mode_checkbox.setCheckState(QtCore.Qt.Checked)
|
||||
|
@ -64,7 +64,7 @@ class ShareMode(Mode):
|
||||
# Filesize warning
|
||||
self.filesize_warning = QtWidgets.QLabel()
|
||||
self.filesize_warning.setWordWrap(True)
|
||||
self.filesize_warning.setStyleSheet('padding: 10px 0; font-weight: bold; color: #333333;')
|
||||
self.filesize_warning.setStyleSheet(self.common.css['share_filesize_warning'])
|
||||
self.filesize_warning.hide()
|
||||
|
||||
# Downloads
|
||||
@ -74,7 +74,7 @@ class ShareMode(Mode):
|
||||
|
||||
# Information about share, and show downloads button
|
||||
self.info_label = QtWidgets.QLabel()
|
||||
self.info_label.setStyleSheet('QLabel { font-size: 12px; color: #666666; }')
|
||||
self.info_label.setStyleSheet(self.common.css['mode_info_label'])
|
||||
|
||||
self.info_show_downloads = QtWidgets.QToolButton()
|
||||
self.info_show_downloads.setIcon(QtGui.QIcon(self.common.get_resource_path('images/download_window_gray.png')))
|
||||
@ -83,10 +83,10 @@ class ShareMode(Mode):
|
||||
self.info_show_downloads.setToolTip(strings._('gui_downloads_window_tooltip', True))
|
||||
|
||||
self.info_in_progress_downloads_count = QtWidgets.QLabel()
|
||||
self.info_in_progress_downloads_count.setStyleSheet('QLabel { font-size: 12px; color: #666666; }')
|
||||
self.info_in_progress_downloads_count.setStyleSheet(self.common.css['mode_info_label'])
|
||||
|
||||
self.info_completed_downloads_count = QtWidgets.QLabel()
|
||||
self.info_completed_downloads_count.setStyleSheet('QLabel { font-size: 12px; color: #666666; }')
|
||||
self.info_completed_downloads_count.setStyleSheet(self.common.css['mode_info_label'])
|
||||
|
||||
self.update_downloads_completed()
|
||||
self.update_downloads_in_progress()
|
||||
@ -153,7 +153,7 @@ class ShareMode(Mode):
|
||||
Step 2 in starting the server. Zipping up files.
|
||||
"""
|
||||
# Add progress bar to the status bar, indicating the compressing of files.
|
||||
self._zip_progress_bar = ZipProgressBar(0)
|
||||
self._zip_progress_bar = ZipProgressBar(self.common, 0)
|
||||
self.filenames = []
|
||||
for index in range(self.file_selection.file_list.count()):
|
||||
self.filenames.append(self.file_selection.file_list.item(index).filename)
|
||||
@ -377,26 +377,15 @@ class ShareMode(Mode):
|
||||
class ZipProgressBar(QtWidgets.QProgressBar):
|
||||
update_processed_size_signal = QtCore.pyqtSignal(int)
|
||||
|
||||
def __init__(self, total_files_size):
|
||||
def __init__(self, common, total_files_size):
|
||||
super(ZipProgressBar, self).__init__()
|
||||
self.common = common
|
||||
|
||||
self.setMaximumHeight(20)
|
||||
self.setMinimumWidth(200)
|
||||
self.setValue(0)
|
||||
self.setFormat(strings._('zip_progress_bar_format'))
|
||||
cssStyleData ="""
|
||||
QProgressBar {
|
||||
border: 1px solid #4e064f;
|
||||
background-color: #ffffff !important;
|
||||
text-align: center;
|
||||
color: #9b9b9b;
|
||||
}
|
||||
|
||||
QProgressBar::chunk {
|
||||
border: 0px;
|
||||
background-color: #4e064f;
|
||||
width: 10px;
|
||||
}"""
|
||||
self.setStyleSheet(cssStyleData)
|
||||
self.setStyleSheet(self.common.css['share_zip_progess_bar'])
|
||||
|
||||
self._total_files_size = total_files_size
|
||||
self._processed_size = 0
|
||||
|
@ -39,19 +39,7 @@ class Download(object):
|
||||
self.progress_bar.setMinimum(0)
|
||||
self.progress_bar.setMaximum(total_bytes)
|
||||
self.progress_bar.setValue(0)
|
||||
self.progress_bar.setStyleSheet("""
|
||||
QProgressBar {
|
||||
border: 1px solid #4e064f;
|
||||
background-color: #ffffff !important;
|
||||
text-align: center;
|
||||
color: #9b9b9b;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
QProgressBar::chunk {
|
||||
background-color: #4e064f;
|
||||
width: 10px;
|
||||
}""")
|
||||
self.progress_bar.setStyleSheet(self.common.css['downloads_uploads_progress_bar'])
|
||||
self.progress_bar.total_bytes = total_bytes
|
||||
|
||||
# start at 0
|
||||
@ -110,7 +98,7 @@ class Downloads(QtWidgets.QScrollArea):
|
||||
self.vbar = self.verticalScrollBar()
|
||||
|
||||
downloads_label = QtWidgets.QLabel(strings._('gui_downloads', True))
|
||||
downloads_label.setStyleSheet('QLabel { font-weight: bold; font-size 14px; text-align: center; }')
|
||||
downloads_label.setStyleSheet(self.common.css['downloads_uploads_label'])
|
||||
self.no_downloads_label = QtWidgets.QLabel(strings._('gui_no_downloads', True))
|
||||
|
||||
self.downloads_layout = QtWidgets.QVBoxLayout()
|
||||
|
@ -42,7 +42,7 @@ class DropHereLabel(QtWidgets.QLabel):
|
||||
self.setPixmap(QtGui.QPixmap.fromImage(QtGui.QImage(self.common.get_resource_path('images/logo_transparent.png'))))
|
||||
else:
|
||||
self.setText(strings._('gui_drag_and_drop', True))
|
||||
self.setStyleSheet('color: #999999;')
|
||||
self.setStyleSheet(self.common.css['share_file_selection_drop_here_label'])
|
||||
|
||||
self.hide()
|
||||
|
||||
@ -66,7 +66,7 @@ class DropCountLabel(QtWidgets.QLabel):
|
||||
self.setAcceptDrops(True)
|
||||
self.setAlignment(QtCore.Qt.AlignCenter)
|
||||
self.setText(strings._('gui_drag_and_drop', True))
|
||||
self.setStyleSheet('color: #ffffff; background-color: #f44449; font-weight: bold; padding: 5px 10px; border-radius: 10px;')
|
||||
self.setStyleSheet(self.common.css['share_file_selection_drop_count_label'])
|
||||
self.hide()
|
||||
|
||||
def dragEnterEvent(self, event):
|
||||
@ -158,7 +158,7 @@ class FileList(QtWidgets.QListWidget):
|
||||
dragEnterEvent for dragging files and directories into the widget.
|
||||
"""
|
||||
if event.mimeData().hasUrls:
|
||||
self.setStyleSheet('FileList { border: 3px solid #538ad0; }')
|
||||
self.setStyleSheet(self.common.css['share_file_list_drag_enter'])
|
||||
count = len(event.mimeData().urls())
|
||||
self.drop_count.setText('+{}'.format(count))
|
||||
|
||||
@ -173,7 +173,7 @@ class FileList(QtWidgets.QListWidget):
|
||||
"""
|
||||
dragLeaveEvent for dragging files and directories into the widget.
|
||||
"""
|
||||
self.setStyleSheet('FileList { border: none; }')
|
||||
self.setStyleSheet(self.common.css['share_file_list_drag_leave'])
|
||||
self.drop_count.hide()
|
||||
event.accept()
|
||||
self.update()
|
||||
@ -201,7 +201,7 @@ class FileList(QtWidgets.QListWidget):
|
||||
else:
|
||||
event.ignore()
|
||||
|
||||
self.setStyleSheet('border: none;')
|
||||
self.setStyleSheet(self.common.css['share_file_list_drag_leave'])
|
||||
self.drop_count.hide()
|
||||
|
||||
self.files_dropped.emit()
|
||||
@ -238,7 +238,7 @@ class FileList(QtWidgets.QListWidget):
|
||||
# Item's filename attribute and size labels
|
||||
item.filename = filename
|
||||
item_size = QtWidgets.QLabel(size_readable)
|
||||
item_size.setStyleSheet('QLabel { color: #666666; font-size: 11px; }')
|
||||
item_size.setStyleSheet(self.common.css['share_file_list_item_size'])
|
||||
|
||||
item.basename = os.path.basename(filename.rstrip('/'))
|
||||
# Use the basename as the method with which to sort the list
|
||||
|
Loading…
x
Reference in New Issue
Block a user