Remove edit mode
This commit is contained in:
parent
8d9072193c
commit
08c09bcb0f
@ -32,6 +32,7 @@ actions-replay-audio = Replay Audio
|
||||
actions-reposition = Reposition
|
||||
actions-save = Save
|
||||
actions-search = Search
|
||||
actions-select = Select
|
||||
actions-shortcut-key = Shortcut key: { $val }
|
||||
actions-suspend-card = Suspend Card
|
||||
actions-set-due-date = Set Due Date
|
||||
|
@ -12,6 +12,5 @@
|
||||
<file>icons/flag.svg</file>
|
||||
<file>icons/select.svg</file>
|
||||
<file>icons/magnifying_glass.svg</file>
|
||||
<file>icons/edit.svg</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
@ -1,83 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="64"
|
||||
height="64"
|
||||
viewBox="0 0 16.933333 16.933334"
|
||||
version="1.1"
|
||||
id="svg8"
|
||||
inkscape:version="1.0.2-2 (e86c870879, 2021-01-15)"
|
||||
sodipodi:docname="edit.svg">
|
||||
<defs
|
||||
id="defs2" />
|
||||
<sodipodi:namedview
|
||||
id="base"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="8.3298966"
|
||||
inkscape:cx="30.544751"
|
||||
inkscape:cy="35.370349"
|
||||
inkscape:document-units="mm"
|
||||
inkscape:current-layer="layer1"
|
||||
inkscape:document-rotation="0"
|
||||
showgrid="true"
|
||||
units="px"
|
||||
inkscape:window-width="1920"
|
||||
inkscape:window-height="1017"
|
||||
inkscape:window-x="-8"
|
||||
inkscape:window-y="-8"
|
||||
inkscape:window-maximized="1"
|
||||
gridtolerance="10000"
|
||||
objecttolerance="51"
|
||||
guidetolerance="51"
|
||||
inkscape:snap-global="true">
|
||||
<inkscape:grid
|
||||
type="xygrid"
|
||||
id="grid833" />
|
||||
</sodipodi:namedview>
|
||||
<metadata
|
||||
id="metadata5">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title />
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
inkscape:label="Ebene 1"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1">
|
||||
<path
|
||||
id="rect883"
|
||||
style="fill:none;fill-opacity:1;stroke:#000000;stroke-width:1.207;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
d="m 11.90625,11.1125 0,5.027083 H 0.79375 V 2.6458333 l 7.14375,0"
|
||||
sodipodi:nodetypes="ccccc" />
|
||||
<path
|
||||
id="rect899"
|
||||
style="fill:none;fill-opacity:1;stroke:#000000;stroke-width:1.12547;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
d="M 12.890429,1.8932006 6.7920163,7.763537 6.0854167,10.558572 8.8427916,9.8939896 14.941202,4.0236502 12.890429,1.8932006 l 1.198378,-1.1535612 2.050776,2.130452 -1.198381,1.1535588"
|
||||
sodipodi:nodetypes="ccccccccc" />
|
||||
<rect
|
||||
style="fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:0.904716;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
id="rect3362"
|
||||
width="0.9508357"
|
||||
height="2.3770893"
|
||||
x="8.6597252"
|
||||
y="10.528829"
|
||||
ry="0.089140847"
|
||||
transform="rotate(-43.602828)" />
|
||||
</g>
|
||||
</svg>
|
Before Width: | Height: | Size: 2.8 KiB |
@ -33,7 +33,6 @@ from aqt.utils import (
|
||||
class SidebarTool(Enum):
|
||||
SELECT = auto()
|
||||
SEARCH = auto()
|
||||
EDIT = auto()
|
||||
|
||||
|
||||
class SidebarItemType(Enum):
|
||||
@ -277,10 +276,9 @@ class SidebarModel(QAbstractItemModel):
|
||||
|
||||
|
||||
class SidebarToolbar(QToolBar):
|
||||
_tools: Tuple[Tuple[SidebarTool, str, str], ...] = (
|
||||
(SidebarTool.SEARCH, ":/icons/magnifying_glass.svg", "search"),
|
||||
(SidebarTool.SELECT, ":/icons/select.svg", "select"),
|
||||
(SidebarTool.EDIT, ":/icons/edit.svg", "edit"),
|
||||
_tools: Tuple[Tuple[SidebarTool, str, TR.V], ...] = (
|
||||
(SidebarTool.SEARCH, ":/icons/magnifying_glass.svg", TR.ACTIONS_SEARCH),
|
||||
(SidebarTool.SELECT, ":/icons/select.svg", TR.ACTIONS_SELECT),
|
||||
)
|
||||
|
||||
def __init__(self, sidebar: SidebarTreeView) -> None:
|
||||
@ -293,7 +291,9 @@ class SidebarToolbar(QToolBar):
|
||||
|
||||
def _setup_tools(self) -> None:
|
||||
for row in self._tools:
|
||||
action = self.addAction(theme_manager.icon_from_resources(row[1]), row[2])
|
||||
action = self.addAction(
|
||||
theme_manager.icon_from_resources(row[1]), tr(row[2])
|
||||
)
|
||||
action.setCheckable(True)
|
||||
self._action_group.addAction(action)
|
||||
saved = self.sidebar.col.get_config("sidebarTool", 0)
|
||||
@ -368,6 +368,7 @@ class SidebarTreeView(QTreeView):
|
||||
self.setIndentation(15)
|
||||
self.setAutoExpandDelay(600)
|
||||
self.setDragDropOverwriteMode(False)
|
||||
self.setEditTriggers(QAbstractItemView.EditKeyPressed)
|
||||
|
||||
qconnect(self.expanded, self._on_expansion)
|
||||
qconnect(self.collapsed, self._on_collapse)
|
||||
@ -393,24 +394,14 @@ class SidebarTreeView(QTreeView):
|
||||
@tool.setter
|
||||
def tool(self, tool: SidebarTool) -> None:
|
||||
self._tool = tool
|
||||
if tool == SidebarTool.SELECT:
|
||||
selection_mode = QAbstractItemView.ExtendedSelection
|
||||
drag_drop_mode = QAbstractItemView.NoDragDrop
|
||||
edit_triggers = QAbstractItemView.EditKeyPressed
|
||||
elif tool == SidebarTool.SEARCH:
|
||||
if tool == SidebarTool.SEARCH:
|
||||
selection_mode = QAbstractItemView.SingleSelection
|
||||
drag_drop_mode = QAbstractItemView.NoDragDrop
|
||||
edit_triggers = QAbstractItemView.EditKeyPressed
|
||||
elif tool == SidebarTool.EDIT:
|
||||
else:
|
||||
selection_mode = QAbstractItemView.ExtendedSelection
|
||||
drag_drop_mode = QAbstractItemView.InternalMove
|
||||
edit_triggers = cast(
|
||||
QAbstractItemView.EditTriggers,
|
||||
QAbstractItemView.DoubleClicked | QAbstractItemView.EditKeyPressed,
|
||||
)
|
||||
self.setSelectionMode(selection_mode)
|
||||
self.setDragDropMode(drag_drop_mode)
|
||||
self.setEditTriggers(edit_triggers)
|
||||
|
||||
def model(self) -> SidebarModel:
|
||||
return super().model()
|
||||
|
Loading…
Reference in New Issue
Block a user