mirror of
https://github.com/onionshare/onionshare.git
synced 2024-12-28 08:49:30 -05:00
Remove delete button, use delete X's instead
This commit is contained in:
parent
e17dbd4fdd
commit
0bb9bf649d
@ -201,6 +201,7 @@ Section "install"
|
|||||||
File "${BINPATH}\share\html\index.html"
|
File "${BINPATH}\share\html\index.html"
|
||||||
|
|
||||||
SetOutPath "$INSTDIR\share\images"
|
SetOutPath "$INSTDIR\share\images"
|
||||||
|
File "${BINPATH}\share\images\file_delete.png"
|
||||||
File "${BINPATH}\share\images\logo.png"
|
File "${BINPATH}\share\images\logo.png"
|
||||||
File "${BINPATH}\share\images\logo_transparent.png"
|
File "${BINPATH}\share\images\logo_transparent.png"
|
||||||
File "${BINPATH}\share\images\logo_grayscale.png"
|
File "${BINPATH}\share\images\logo_grayscale.png"
|
||||||
@ -379,6 +380,7 @@ FunctionEnd
|
|||||||
Delete "$INSTDIR\share\html\404.html"
|
Delete "$INSTDIR\share\html\404.html"
|
||||||
Delete "$INSTDIR\share\html\denied.html"
|
Delete "$INSTDIR\share\html\denied.html"
|
||||||
Delete "$INSTDIR\share\html\index.html"
|
Delete "$INSTDIR\share\html\index.html"
|
||||||
|
Delete "$INSTDIR\share\images\file_delete.png"
|
||||||
Delete "$INSTDIR\share\images\logo.png"
|
Delete "$INSTDIR\share\images\logo.png"
|
||||||
Delete "$INSTDIR\share\images\logo_transparent.png"
|
Delete "$INSTDIR\share\images\logo_transparent.png"
|
||||||
Delete "$INSTDIR\share\images\logo_grayscale.png"
|
Delete "$INSTDIR\share\images\logo_grayscale.png"
|
||||||
|
@ -80,7 +80,7 @@ class FileList(QtWidgets.QListWidget):
|
|||||||
self.setIconSize(QtCore.QSize(32, 32))
|
self.setIconSize(QtCore.QSize(32, 32))
|
||||||
self.setSortingEnabled(True)
|
self.setSortingEnabled(True)
|
||||||
self.setMinimumHeight(200)
|
self.setMinimumHeight(200)
|
||||||
self.setSelectionMode(QtWidgets.QAbstractItemView.ExtendedSelection)
|
self.setSelectionMode(QtWidgets.QAbstractItemView.NoSelection)
|
||||||
|
|
||||||
self.filenames = []
|
self.filenames = []
|
||||||
|
|
||||||
@ -198,8 +198,21 @@ class FileList(QtWidgets.QListWidget):
|
|||||||
item.setToolTip(size)
|
item.setToolTip(size)
|
||||||
item.setIcon(icon)
|
item.setIcon(icon)
|
||||||
|
|
||||||
|
# Item's delete button
|
||||||
|
def delete_item():
|
||||||
|
itemrow = self.row(item)
|
||||||
|
self.filenames.pop(itemrow)
|
||||||
|
self.takeItem(itemrow)
|
||||||
|
self.files_updated.emit()
|
||||||
|
self.update()
|
||||||
|
|
||||||
|
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)
|
||||||
|
|
||||||
# Create an item widget to display on the item
|
# Create an item widget to display on the item
|
||||||
item_button = QtWidgets.QPushButton('x')
|
|
||||||
item_widget_layout = QtWidgets.QHBoxLayout()
|
item_widget_layout = QtWidgets.QHBoxLayout()
|
||||||
item_widget_layout.addStretch()
|
item_widget_layout.addStretch()
|
||||||
item_widget_layout.addWidget(item_button)
|
item_widget_layout.addWidget(item_button)
|
||||||
@ -214,8 +227,7 @@ class FileList(QtWidgets.QListWidget):
|
|||||||
|
|
||||||
class FileSelection(QtWidgets.QVBoxLayout):
|
class FileSelection(QtWidgets.QVBoxLayout):
|
||||||
"""
|
"""
|
||||||
The list of files and folders in the GUI, as well as buttons to add and
|
The list of files and folders in the GUI, as well as button to add files and folders.
|
||||||
delete the files and folders.
|
|
||||||
"""
|
"""
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super(FileSelection, self).__init__()
|
super(FileSelection, self).__init__()
|
||||||
@ -229,11 +241,9 @@ class FileSelection(QtWidgets.QVBoxLayout):
|
|||||||
# buttons
|
# buttons
|
||||||
self.add_button = QtWidgets.QPushButton(strings._('gui_add', True))
|
self.add_button = QtWidgets.QPushButton(strings._('gui_add', True))
|
||||||
self.add_button.clicked.connect(self.add)
|
self.add_button.clicked.connect(self.add)
|
||||||
self.delete_button = QtWidgets.QPushButton(strings._('gui_delete', True))
|
|
||||||
self.delete_button.clicked.connect(self.delete)
|
|
||||||
button_layout = QtWidgets.QHBoxLayout()
|
button_layout = QtWidgets.QHBoxLayout()
|
||||||
|
button_layout.addStretch()
|
||||||
button_layout.addWidget(self.add_button)
|
button_layout.addWidget(self.add_button)
|
||||||
button_layout.addWidget(self.delete_button)
|
|
||||||
|
|
||||||
# add the widgets
|
# add the widgets
|
||||||
self.addWidget(self.file_list)
|
self.addWidget(self.file_list)
|
||||||
@ -248,17 +258,9 @@ class FileSelection(QtWidgets.QVBoxLayout):
|
|||||||
# all buttons should be disabled if the server is on
|
# all buttons should be disabled if the server is on
|
||||||
if self.server_on:
|
if self.server_on:
|
||||||
self.add_button.setEnabled(False)
|
self.add_button.setEnabled(False)
|
||||||
self.delete_button.setEnabled(False)
|
|
||||||
else:
|
else:
|
||||||
self.add_button.setEnabled(True)
|
self.add_button.setEnabled(True)
|
||||||
|
|
||||||
# delete button should be disabled if item isn't selected
|
|
||||||
current_item = self.file_list.currentItem()
|
|
||||||
if not current_item:
|
|
||||||
self.delete_button.setEnabled(False)
|
|
||||||
else:
|
|
||||||
self.delete_button.setEnabled(True)
|
|
||||||
|
|
||||||
# update the file list
|
# update the file list
|
||||||
self.file_list.update()
|
self.file_list.update()
|
||||||
|
|
||||||
@ -273,18 +275,6 @@ class FileSelection(QtWidgets.QVBoxLayout):
|
|||||||
|
|
||||||
self.update()
|
self.update()
|
||||||
|
|
||||||
def delete(self):
|
|
||||||
"""
|
|
||||||
Delete button clicked
|
|
||||||
"""
|
|
||||||
selected = self.file_list.selectedItems()
|
|
||||||
for item in selected:
|
|
||||||
itemrow = self.file_list.row(item)
|
|
||||||
self.file_list.filenames.pop(itemrow)
|
|
||||||
self.file_list.takeItem(itemrow)
|
|
||||||
self.file_list.files_updated.emit()
|
|
||||||
self.update()
|
|
||||||
|
|
||||||
def server_started(self):
|
def server_started(self):
|
||||||
"""
|
"""
|
||||||
Gets called when the server starts.
|
Gets called when the server starts.
|
||||||
|
BIN
share/images/file_delete.png
Normal file
BIN
share/images/file_delete.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 182 B |
Loading…
Reference in New Issue
Block a user