Updating main window to function with new UI
Former-commit-id: 1f8103a7b3023592b6a04f603ff13e1df5c317bc
This commit is contained in:
parent
ae17b6554e
commit
7a91d8b767
10
ui/reader.ui
10
ui/reader.ui
@ -104,7 +104,7 @@
|
||||
<addaction name="menuTextSize"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionToggleAnki"/>
|
||||
<addaction name="actionToggleVocabulary"/>
|
||||
<addaction name="actionToggleVocab"/>
|
||||
<addaction name="actionToggleKanji"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionToggleWrap"/>
|
||||
@ -403,7 +403,7 @@
|
||||
<string>Toggle word wrap</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionToggleVocabulary">
|
||||
<action name="actionToggleVocab">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
@ -488,7 +488,7 @@
|
||||
</resources>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>actionToggleVocabulary</sender>
|
||||
<sender>actionToggleVocab</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>dockVocab</receiver>
|
||||
<slot>setVisible(bool)</slot>
|
||||
@ -542,8 +542,8 @@
|
||||
<slot>setVisible(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>786</x>
|
||||
<y>591</y>
|
||||
<x>-1</x>
|
||||
<y>-1</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>762</x>
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
# Form implementation generated from reading ui file 'ui/about.ui'
|
||||
#
|
||||
# Created: Sun Nov 10 10:14:42 2013
|
||||
# Created: Sun Nov 10 10:19:58 2013
|
||||
# by: PyQt4 UI code generator 4.10
|
||||
#
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
# Form implementation generated from reading ui file 'ui/preferences.ui'
|
||||
#
|
||||
# Created: Sun Nov 10 10:14:42 2013
|
||||
# Created: Sun Nov 10 10:19:59 2013
|
||||
# by: PyQt4 UI code generator 4.10
|
||||
#
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
# Form implementation generated from reading ui file 'ui/reader.ui'
|
||||
#
|
||||
# Created: Sun Nov 10 10:14:42 2013
|
||||
# Created: Sun Nov 10 10:19:59 2013
|
||||
# by: PyQt4 UI code generator 4.10
|
||||
#
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
@ -189,9 +189,9 @@ class Ui_MainWindowReader(object):
|
||||
self.actionToggleWrap.setCheckable(True)
|
||||
self.actionToggleWrap.setChecked(True)
|
||||
self.actionToggleWrap.setObjectName(_fromUtf8("actionToggleWrap"))
|
||||
self.actionToggleVocabulary = QtGui.QAction(MainWindowReader)
|
||||
self.actionToggleVocabulary.setCheckable(True)
|
||||
self.actionToggleVocabulary.setObjectName(_fromUtf8("actionToggleVocabulary"))
|
||||
self.actionToggleVocab = QtGui.QAction(MainWindowReader)
|
||||
self.actionToggleVocab.setCheckable(True)
|
||||
self.actionToggleVocab.setObjectName(_fromUtf8("actionToggleVocab"))
|
||||
self.actionCopyDefinition = QtGui.QAction(MainWindowReader)
|
||||
icon9 = QtGui.QIcon()
|
||||
icon9.addPixmap(QtGui.QPixmap(_fromUtf8(":/img/img/icon_copy_definition.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||
@ -243,7 +243,7 @@ class Ui_MainWindowReader(object):
|
||||
self.menuView.addAction(self.menuTextSize.menuAction())
|
||||
self.menuView.addSeparator()
|
||||
self.menuView.addAction(self.actionToggleAnki)
|
||||
self.menuView.addAction(self.actionToggleVocabulary)
|
||||
self.menuView.addAction(self.actionToggleVocab)
|
||||
self.menuView.addAction(self.actionToggleKanji)
|
||||
self.menuView.addSeparator()
|
||||
self.menuView.addAction(self.actionToggleWrap)
|
||||
@ -260,7 +260,7 @@ class Ui_MainWindowReader(object):
|
||||
self.toolBar.addAction(self.actionFind)
|
||||
|
||||
self.retranslateUi(MainWindowReader)
|
||||
QtCore.QObject.connect(self.actionToggleVocabulary, QtCore.SIGNAL(_fromUtf8("toggled(bool)")), self.dockVocab.setVisible)
|
||||
QtCore.QObject.connect(self.actionToggleVocab, QtCore.SIGNAL(_fromUtf8("toggled(bool)")), self.dockVocab.setVisible)
|
||||
QtCore.QObject.connect(self.actionQuit, QtCore.SIGNAL(_fromUtf8("triggered()")), MainWindowReader.close)
|
||||
QtCore.QObject.connect(self.actionToggleAnki, QtCore.SIGNAL(_fromUtf8("toggled(bool)")), self.dockAnki.setVisible)
|
||||
QtCore.QObject.connect(self.actionToggleKanji, QtCore.SIGNAL(_fromUtf8("toggled(bool)")), self.dockKanji.setVisible)
|
||||
@ -308,8 +308,8 @@ class Ui_MainWindowReader(object):
|
||||
self.actionFindNext.setShortcut(_translate("MainWindowReader", "F3", None))
|
||||
self.actionToggleWrap.setText(_translate("MainWindowReader", "&Word wrap", None))
|
||||
self.actionToggleWrap.setToolTip(_translate("MainWindowReader", "Toggle word wrap", None))
|
||||
self.actionToggleVocabulary.setText(_translate("MainWindowReader", "&Vocabulary", None))
|
||||
self.actionToggleVocabulary.setToolTip(_translate("MainWindowReader", "Toggle definitions", None))
|
||||
self.actionToggleVocab.setText(_translate("MainWindowReader", "&Vocabulary", None))
|
||||
self.actionToggleVocab.setToolTip(_translate("MainWindowReader", "Toggle definitions", None))
|
||||
self.actionCopyDefinition.setText(_translate("MainWindowReader", "Copy &definition", None))
|
||||
self.actionCopyDefinition.setShortcut(_translate("MainWindowReader", "Ctrl+D", None))
|
||||
self.actionCopyAllDefinitions.setText(_translate("MainWindowReader", "Copy &all definitions", None))
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
# Resource object code
|
||||
#
|
||||
# Created: Sun Nov 10 10:14:42 2013
|
||||
# Created: Sun Nov 10 10:19:59 2013
|
||||
# by: The Resource Compiler for PyQt (Qt v4.8.4)
|
||||
#
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
|
@ -81,9 +81,10 @@ class MainWindowReader(QtGui.QMainWindow, reader_ui.Ui_MainWindowReader):
|
||||
self.actionHomepage.triggered.connect(self.onActionHomepage)
|
||||
self.actionFeedback.triggered.connect(self.onActionFeedback)
|
||||
self.textDefinitions.anchorClicked.connect(self.onDefinitionsAnchorClicked)
|
||||
self.textDefinitionSearch.returnPressed.connect(self.onDefinitionSearchReturn)
|
||||
self.textVocabSearch.returnPressed.connect(self.onDefinitionSearchReturn)
|
||||
self.listDefinitions.itemDoubleClicked.connect(self.onDefinitionDoubleClicked)
|
||||
self.dockDefinitions.visibilityChanged.connect(self.onVisibilityChanged)
|
||||
self.dockVocab.visibilityChanged.connect(self.onVisibilityChanged)
|
||||
self.dockKanji.visibilityChanged.connect(self.onVisibilityChanged)
|
||||
self.dockAnki.visibilityChanged.connect(self.onVisibilityChanged)
|
||||
self.updateFinder.updateResult.connect(self.onUpdaterSearchResult)
|
||||
|
||||
@ -131,7 +132,8 @@ class MainWindowReader(QtGui.QMainWindow, reader_ui.Ui_MainWindowReader):
|
||||
|
||||
|
||||
def keyPressEvent(self, event):
|
||||
if self.dockDefinitions.isVisible() and event.key() == QtCore.Qt.Key_Shift:
|
||||
visible = self.dockVocab.isVisible() or self.dockKanji.isVisible()
|
||||
if visible and event.key() == QtCore.Qt.Key_Shift:
|
||||
self.updateSampleFromPosition()
|
||||
|
||||
|
||||
@ -269,7 +271,7 @@ class MainWindowReader(QtGui.QMainWindow, reader_ui.Ui_MainWindowReader):
|
||||
|
||||
|
||||
def onDefinitionSearchReturn(self):
|
||||
text = unicode(self.textDefinitionSearch.text())
|
||||
text = unicode(self.textVocabSearch.text())
|
||||
self.state.definitions, length = self.language.findTerm(text, True)
|
||||
self.updateDefinitions()
|
||||
|
||||
@ -282,7 +284,8 @@ class MainWindowReader(QtGui.QMainWindow, reader_ui.Ui_MainWindowReader):
|
||||
|
||||
def onVisibilityChanged(self, visible):
|
||||
self.actionToggleAnki.setChecked(self.dockAnki.isVisible())
|
||||
self.actionToggleDefinitions.setChecked(self.dockDefinitions.isVisible())
|
||||
self.actionToggleVocab.setChecked(self.dockVocab.isVisible())
|
||||
self.actionToggleKanji.setChecked(self.dockKanji.isVisible())
|
||||
|
||||
|
||||
def onUpdaterSearchResult(self, result):
|
||||
@ -469,7 +472,8 @@ class MainWindowReader(QtGui.QMainWindow, reader_ui.Ui_MainWindowReader):
|
||||
cursor = self.textContent.cursorForPosition(event.pos())
|
||||
self.state.scanPosition = cursor.position()
|
||||
requested = event.buttons() & QtCore.Qt.MidButton or event.modifiers() & QtCore.Qt.ShiftModifier
|
||||
if self.dockDefinitions.isVisible() and requested:
|
||||
visible = self.dockVocab.isVisible() or self.dockKanji.isVisible()
|
||||
if visible and requested:
|
||||
self.updateSampleFromPosition()
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user