Merge branch 'disable_delete_buttons_on_running_server' of https://github.com/mig5/onionshare into mig5-disable_delete_buttons_on_running_server

This commit is contained in:
Micah Lee 2018-02-07 09:05:40 -08:00
commit acf5c1bb88
No known key found for this signature in database
GPG Key ID: 403C2657CD994F73
2 changed files with 14 additions and 6 deletions

View File

@ -205,16 +205,16 @@ class FileList(QtWidgets.QListWidget):
self.takeItem(itemrow)
self.files_updated.emit()
item_button = QtWidgets.QPushButton()
item_button.setDefault(False)
item_button.setFlat(True)
item_button.setIcon( QtGui.QIcon(common.get_resource_path('images/file_delete.png')) )
item_button.clicked.connect(delete_item)
item.item_button = QtWidgets.QPushButton()
item.item_button.setDefault(False)
item.item_button.setFlat(True)
item.item_button.setIcon( QtGui.QIcon(common.get_resource_path('images/file_delete.png')) )
item.item_button.clicked.connect(delete_item)
# Create an item widget to display on the item
item_widget_layout = QtWidgets.QHBoxLayout()
item_widget_layout.addStretch()
item_widget_layout.addWidget(item_button)
item_widget_layout.addWidget(item.item_button)
item_widget = QtWidgets.QWidget()
item_widget.setLayout(item_widget_layout)

View File

@ -182,6 +182,14 @@ class ServerStatus(QtWidgets.QWidget):
self.copy_url_button.hide()
self.copy_hidservauth_button.hide()
# Hide the FileList delete buttons when a share is running
if self.status == self.STATUS_STARTED or self.status == self.STATUS_WORKING:
for index in range(self.file_selection.file_list.count()):
self.file_selection.file_list.item(index).item_button.hide()
else:
for index in range(self.file_selection.file_list.count()):
self.file_selection.file_list.item(index).item_button.show()
# 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; }'