mirror of
https://github.com/olivierkes/manuskript.git
synced 2024-06-14 17:04:33 +12:00
Cheatsheet improvements
This commit is contained in:
parent
c7a4ae6072
commit
4d7d54aef8
|
@ -10,6 +10,7 @@ from manuskript.functions import lightBlue
|
||||||
from manuskript.functions import mainWindow
|
from manuskript.functions import mainWindow
|
||||||
from manuskript.ui.cheatSheet_ui import Ui_cheatSheet
|
from manuskript.ui.cheatSheet_ui import Ui_cheatSheet
|
||||||
from manuskript.models import references as Ref
|
from manuskript.models import references as Ref
|
||||||
|
from manuskript.ui.editors.completer import completer
|
||||||
|
|
||||||
|
|
||||||
class cheatSheet(QWidget, Ui_cheatSheet):
|
class cheatSheet(QWidget, Ui_cheatSheet):
|
||||||
|
@ -21,11 +22,13 @@ class cheatSheet(QWidget, Ui_cheatSheet):
|
||||||
self.splitter.setStretchFactor(0, 5)
|
self.splitter.setStretchFactor(0, 5)
|
||||||
self.splitter.setStretchFactor(1, 70)
|
self.splitter.setStretchFactor(1, 70)
|
||||||
|
|
||||||
|
self.txtFilter.textChanged.connect(self.textChanged)
|
||||||
self.txtFilter.textChanged.connect(self.updateListFromData)
|
self.txtFilter.textChanged.connect(self.updateListFromData)
|
||||||
self.txtFilter.returnPressed.connect(self.showInfos)
|
self.txtFilter.returnPressed.connect(self.showInfos)
|
||||||
self.listDelegate = listCompleterDelegate(self)
|
self.listDelegate = listCompleterDelegate(self)
|
||||||
self.list.setItemDelegate(self.listDelegate)
|
self.list.setItemDelegate(self.listDelegate)
|
||||||
self.list.itemActivated.connect(self.showInfos)
|
self.list.itemActivated.connect(self.showInfos)
|
||||||
|
self.list.hide()
|
||||||
self.list.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
|
self.list.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
|
||||||
self.view.linkActivated.connect(self.openLink)
|
self.view.linkActivated.connect(self.openLink)
|
||||||
self.view.linkHovered.connect(self.linkHovered)
|
self.view.linkHovered.connect(self.linkHovered)
|
||||||
|
@ -59,6 +62,12 @@ class cheatSheet(QWidget, Ui_cheatSheet):
|
||||||
|
|
||||||
self.populate()
|
self.populate()
|
||||||
|
|
||||||
|
def textChanged(self, text):
|
||||||
|
if not text:
|
||||||
|
self.list.hide()
|
||||||
|
else:
|
||||||
|
self.list.show()
|
||||||
|
|
||||||
def populate(self):
|
def populate(self):
|
||||||
if self.persoModel:
|
if self.persoModel:
|
||||||
d = []
|
d = []
|
||||||
|
@ -128,6 +137,7 @@ class cheatSheet(QWidget, Ui_cheatSheet):
|
||||||
self.list.setCurrentRow(1)
|
self.list.setCurrentRow(1)
|
||||||
|
|
||||||
def showInfos(self):
|
def showInfos(self):
|
||||||
|
self.list.hide()
|
||||||
i = self.list.currentItem()
|
i = self.list.currentItem()
|
||||||
ref = i.data(Qt.UserRole)
|
ref = i.data(Qt.UserRole)
|
||||||
if ref:
|
if ref:
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
# Form implementation generated from reading ui file 'manuskript/ui/cheatSheet_ui.ui'
|
# Form implementation generated from reading ui file 'manuskript/ui/cheatSheet_ui.ui'
|
||||||
#
|
#
|
||||||
# Created: Mon Feb 8 10:28:58 2016
|
# Created: Mon Feb 8 10:48:00 2016
|
||||||
# by: PyQt5 UI code generator 5.2.1
|
# by: PyQt5 UI code generator 5.2.1
|
||||||
#
|
#
|
||||||
# WARNING! All changes made in this file will be lost!
|
# WARNING! All changes made in this file will be lost!
|
||||||
|
@ -74,5 +74,5 @@ class Ui_cheatSheet(object):
|
||||||
def retranslateUi(self, cheatSheet):
|
def retranslateUi(self, cheatSheet):
|
||||||
_translate = QtCore.QCoreApplication.translate
|
_translate = QtCore.QCoreApplication.translate
|
||||||
cheatSheet.setWindowTitle(_translate("cheatSheet", "Form"))
|
cheatSheet.setWindowTitle(_translate("cheatSheet", "Form"))
|
||||||
self.txtFilter.setPlaceholderText(_translate("cheatSheet", "Filter"))
|
self.txtFilter.setPlaceholderText(_translate("cheatSheet", "Filter (type the name of anything in your project)"))
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="placeholderText">
|
<property name="placeholderText">
|
||||||
<string>Filter</string>
|
<string>Filter (type the name of anything in your project)</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="clearButtonEnabled">
|
<property name="clearButtonEnabled">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
|
|
Loading…
Reference in a new issue