Adds: go-up button. See #157

This commit is contained in:
Olivier Keshavjee 2017-10-14 21:39:16 +02:00
parent 742e24dbd2
commit a6123292ae
9 changed files with 77 additions and 15 deletions

View file

@ -0,0 +1,4 @@
<svg width="256" xmlns="http://www.w3.org/2000/svg" height="256" viewBox="0 0 256 256" xmlns:xlink="http://www.w3.org/1999/xlink">
<path style="fill:#268bd2;fill-rule:evenodd" d="M 256 128.019531 C 255.988281 198.703125 198.683594 256 128 256 C 57.316406 256 0.0117188 198.703125 0 128.019531 C -0.0117188 57.320312 57.300781 0 128 0 C 198.699219 0 256.011719 57.320312 256 128.019531 Z "/>
<path style="fill:#fff;fill-opacity:.902" d="M 130.5 48.054688 C 123.066406 47.8125 116.398438 52.046875 113.5 59.054688 C 110.601562 66.0625 112.171875 74.273438 117.5 79.554688 L 149 112.054688 L 48 112.054688 L 48 144.054688 L 149 144.054688 L 117.5 176.554688 C 110.488281 183.753906 110.488281 195.351562 117.5 202.554688 C 124.511719 209.753906 135.988281 209.753906 143 202.554688 L 202.5 141.054688 C 205.914062 137.597656 208 132.953125 208 128.054688 C 208 123.15625 205.914062 118.511719 202.5 115.054688 L 143 53.554688 C 139.773438 50.144531 135.175781 48.199219 130.5 48.054688 Z "/>
</svg>

After

Width:  |  Height:  |  Size: 996 B

View file

@ -0,0 +1,4 @@
<svg width="256" xmlns="http://www.w3.org/2000/svg" height="256" viewBox="0 0 256 256" xmlns:xlink="http://www.w3.org/1999/xlink">
<path style="fill:#268bd2;fill-rule:evenodd" d="M 127.980469 0 C 57.296875 0.0117188 0 57.316406 0 128 C 0 198.683594 57.296875 255.988281 127.980469 256 C 198.679688 256.011719 256 198.699219 256 128 C 256 57.300781 198.679688 -0.0117188 127.980469 0 Z "/>
<path style="fill:#fff;fill-opacity:.902" d="M 207.945312 125.5 C 208.1875 132.933594 203.953125 139.601562 196.945312 142.5 C 189.9375 145.398438 181.726562 143.828125 176.445312 138.5 L 143.945312 107 L 143.945312 208 L 111.945312 208 L 111.945312 107 L 79.445312 138.5 C 72.246094 145.511719 60.648438 145.511719 53.445312 138.5 C 46.246094 131.488281 46.246094 120.011719 53.445312 113 L 114.945312 53.5 C 118.402344 50.085938 123.046875 48 127.945312 48 C 132.84375 48 137.488281 50.085938 140.945312 53.5 L 202.445312 113 C 205.855469 116.226562 207.800781 120.824219 207.945312 125.5 Z "/>
</svg>

After

Width:  |  Height:  |  Size: 993 B

View file

@ -304,9 +304,16 @@ class MainWindow(QMainWindow, Ui_MainWindow):
self.txtWorldPassion.setCurrentModelIndex(index)
self.txtWorldConflict.setCurrentModelIndex(index)
# ###############################################################################
# # LOAD AND SAVE
# ###############################################################################
###############################################################################
# EDITOR
###############################################################################
def openIndex(self, index):
self.treeRedacOutline.setCurrentIndex(index)
###############################################################################
# LOAD AND SAVE
###############################################################################
def loadProject(self, project, loadFromFile=True):
"""Loads the project ``project``.

View file

@ -28,6 +28,7 @@ class mainEditor(QWidget, Ui_mainEditor):
# Connections --------------------------------------------------------
self.btnGoUp.clicked.connect(self.goToParentItem)
self.sldCorkSizeFactor.valueChanged.connect(
self.setCorkSizeFactor, AUC)
self.btnRedacFolderCork.toggled.connect(
@ -151,6 +152,11 @@ class mainEditor(QWidget, Ui_mainEditor):
def openIndexes(self, indexes, newTab=False):
for i in indexes:
self.setCurrentModelIndex(i, newTab)
def goToParentItem(self):
idx = self.currentEditor().currentIndex
from manuskript.functions import MW
MW.treeRedacOutline.setCurrentIndex(idx.parent())
def setCurrentModelIndex(self, index, newTab=False, tabWidget=None):

View file

@ -2,7 +2,7 @@
# Form implementation generated from reading ui file 'manuskript/ui/editors/mainEditor_ui.ui'
#
# Created: Sun Apr 10 11:19:00 2016
# Created: Sat Oct 14 21:30:36 2017
# by: PyQt5 UI code generator 5.2.1
#
# WARNING! All changes made in this file will be lost!
@ -27,6 +27,13 @@ class Ui_mainEditor(object):
self.verticalLayout.addWidget(self.tabSplitter)
self.horizontalLayout_19 = QtWidgets.QHBoxLayout()
self.horizontalLayout_19.setObjectName("horizontalLayout_19")
self.btnGoUp = QtWidgets.QPushButton(mainEditor)
self.btnGoUp.setText("")
icon = QtGui.QIcon.fromTheme("go-up")
self.btnGoUp.setIcon(icon)
self.btnGoUp.setFlat(True)
self.btnGoUp.setObjectName("btnGoUp")
self.horizontalLayout_19.addWidget(self.btnGoUp)
self.btnRedacFolderText = QtWidgets.QPushButton(mainEditor)
self.btnRedacFolderText.setCheckable(True)
self.btnRedacFolderText.setFlat(True)
@ -96,6 +103,8 @@ class Ui_mainEditor(object):
def retranslateUi(self, mainEditor):
_translate = QtCore.QCoreApplication.translate
mainEditor.setWindowTitle(_translate("mainEditor", "Form"))
self.btnGoUp.setToolTip(_translate("mainEditor", "Go to parent item"))
self.btnGoUp.setShortcut(_translate("mainEditor", "Alt+Up"))
self.btnRedacFolderText.setText(_translate("mainEditor", "Text"))
self.btnRedacFolderCork.setText(_translate("mainEditor", "Index cards"))
self.btnRedacFolderOutline.setText(_translate("mainEditor", "Outline"))

View file

@ -41,6 +41,25 @@
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_19">
<item>
<widget class="QPushButton" name="btnGoUp">
<property name="toolTip">
<string>Go to parent item</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset theme="go-up"/>
</property>
<property name="shortcut">
<string>Alt+Up</string>
</property>
<property name="flat">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnRedacFolderText">
<property name="text">

View file

@ -2,7 +2,7 @@
# Form implementation generated from reading ui file 'manuskript/ui/mainWindow.ui'
#
# Created: Sat Oct 14 20:38:54 2017
# Created: Sat Oct 14 21:07:22 2017
# by: PyQt5 UI code generator 5.2.1
#
# WARNING! All changes made in this file will be lost!
@ -1339,18 +1339,18 @@ class Ui_MainWindow(object):
self.actAbout.setText(_translate("MainWindow", "&About"))
self.actAbout.setToolTip(_translate("MainWindow", "About Manuskript"))
from manuskript.ui.views.basicItemView import basicItemView
from manuskript.ui.editors.mainEditor import mainEditor
from manuskript.ui.views.treeView import treeView
from manuskript.ui.views.outlineView import outlineView
from manuskript.ui.views.textEditCompleter import textEditCompleter
from manuskript.ui.views.metadataView import metadataView
from manuskript.ui.views.storylineView import storylineView
from manuskript.ui.views.lineEditView import lineEditView
from manuskript.ui.welcome import welcome
from manuskript.ui.search import search
from manuskript.ui.views.characterTreeView import characterTreeView
from manuskript.ui.cheatSheet import cheatSheet
from manuskript.ui.views.lineEditView import lineEditView
from manuskript.ui.views.basicItemView import basicItemView
from manuskript.ui.views.outlineView import outlineView
from manuskript.ui.views.storylineView import storylineView
from manuskript.ui.views.treeView import treeView
from manuskript.ui.views.textEditView import textEditView
from manuskript.ui.views.textEditCompleter import textEditCompleter
from manuskript.ui.editors.mainEditor import mainEditor
from manuskript.ui.views.sldImportance import sldImportance
from manuskript.ui.views.plotTreeView import plotTreeView
from manuskript.ui.cheatSheet import cheatSheet
from manuskript.ui.views.characterTreeView import characterTreeView

View file

@ -53,7 +53,7 @@ class corkView(QListView, dndView, outlineBasics):
parent = idx.parent()
from manuskript.functions import MW
MW.treeRedacOutline.setCurrentIndex(parent)
MW.openIndex(parent)
#self.setRootIndex(parent)
else:
r = QListView.mouseDoubleClickEvent(self, event)

View file

@ -38,6 +38,13 @@ class outlineBasics(QAbstractItemView):
menu = QMenu(self)
# Add / remove items
self.actOpen = QAction(QIcon.fromTheme("go-right"), qApp.translate("outlineBasic", "Open Item"), menu)
self.actOpen.triggered.connect(self.openItem)
menu.addAction(self.actOpen)
menu.addSeparator()
# Add / remove items
self.actAddFolder = QAction(QIcon.fromTheme("folder-new"), qApp.translate("outlineBasics", "New Folder"), menu)
self.actAddFolder.triggered.connect(self.addFolder)
@ -133,6 +140,7 @@ class outlineBasics(QAbstractItemView):
self.actAddText.setEnabled(False)
if len(sel) == 0:
self.actOpen.setEnabled(False)
self.actCopy.setEnabled(False)
self.actCut.setEnabled(False)
self.actDelete.setEnabled(False)
@ -142,6 +150,11 @@ class outlineBasics(QAbstractItemView):
return menu
def openItem(self):
idx = self.currentIndex()
from manuskript.functions import MW
MW.openIndex(idx)
def addFolder(self):
self.addItem("folder")