1

Updating main window to function with new UI

Former-commit-id: 1f8103a7b3023592b6a04f603ff13e1df5c317bc
This commit is contained in:
Alex Yatskov 2013-11-10 10:21:25 -08:00
parent ae17b6554e
commit 7a91d8b767
6 changed files with 26 additions and 22 deletions

View File

@ -104,7 +104,7 @@
<addaction name="menuTextSize"/> <addaction name="menuTextSize"/>
<addaction name="separator"/> <addaction name="separator"/>
<addaction name="actionToggleAnki"/> <addaction name="actionToggleAnki"/>
<addaction name="actionToggleVocabulary"/> <addaction name="actionToggleVocab"/>
<addaction name="actionToggleKanji"/> <addaction name="actionToggleKanji"/>
<addaction name="separator"/> <addaction name="separator"/>
<addaction name="actionToggleWrap"/> <addaction name="actionToggleWrap"/>
@ -403,7 +403,7 @@
<string>Toggle word wrap</string> <string>Toggle word wrap</string>
</property> </property>
</action> </action>
<action name="actionToggleVocabulary"> <action name="actionToggleVocab">
<property name="checkable"> <property name="checkable">
<bool>true</bool> <bool>true</bool>
</property> </property>
@ -488,7 +488,7 @@
</resources> </resources>
<connections> <connections>
<connection> <connection>
<sender>actionToggleVocabulary</sender> <sender>actionToggleVocab</sender>
<signal>toggled(bool)</signal> <signal>toggled(bool)</signal>
<receiver>dockVocab</receiver> <receiver>dockVocab</receiver>
<slot>setVisible(bool)</slot> <slot>setVisible(bool)</slot>
@ -542,8 +542,8 @@
<slot>setVisible(bool)</slot> <slot>setVisible(bool)</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>786</x> <x>-1</x>
<y>591</y> <y>-1</y>
</hint> </hint>
<hint type="destinationlabel"> <hint type="destinationlabel">
<x>762</x> <x>762</x>

View File

@ -2,7 +2,7 @@
# Form implementation generated from reading ui file 'ui/about.ui' # 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 # by: PyQt4 UI code generator 4.10
# #
# WARNING! All changes made in this file will be lost! # WARNING! All changes made in this file will be lost!

View File

@ -2,7 +2,7 @@
# Form implementation generated from reading ui file 'ui/preferences.ui' # 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 # by: PyQt4 UI code generator 4.10
# #
# WARNING! All changes made in this file will be lost! # WARNING! All changes made in this file will be lost!

View File

@ -2,7 +2,7 @@
# Form implementation generated from reading ui file 'ui/reader.ui' # 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 # by: PyQt4 UI code generator 4.10
# #
# WARNING! All changes made in this file will be lost! # WARNING! All changes made in this file will be lost!
@ -189,9 +189,9 @@ class Ui_MainWindowReader(object):
self.actionToggleWrap.setCheckable(True) self.actionToggleWrap.setCheckable(True)
self.actionToggleWrap.setChecked(True) self.actionToggleWrap.setChecked(True)
self.actionToggleWrap.setObjectName(_fromUtf8("actionToggleWrap")) self.actionToggleWrap.setObjectName(_fromUtf8("actionToggleWrap"))
self.actionToggleVocabulary = QtGui.QAction(MainWindowReader) self.actionToggleVocab = QtGui.QAction(MainWindowReader)
self.actionToggleVocabulary.setCheckable(True) self.actionToggleVocab.setCheckable(True)
self.actionToggleVocabulary.setObjectName(_fromUtf8("actionToggleVocabulary")) self.actionToggleVocab.setObjectName(_fromUtf8("actionToggleVocab"))
self.actionCopyDefinition = QtGui.QAction(MainWindowReader) self.actionCopyDefinition = QtGui.QAction(MainWindowReader)
icon9 = QtGui.QIcon() icon9 = QtGui.QIcon()
icon9.addPixmap(QtGui.QPixmap(_fromUtf8(":/img/img/icon_copy_definition.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) 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.addAction(self.menuTextSize.menuAction())
self.menuView.addSeparator() self.menuView.addSeparator()
self.menuView.addAction(self.actionToggleAnki) self.menuView.addAction(self.actionToggleAnki)
self.menuView.addAction(self.actionToggleVocabulary) self.menuView.addAction(self.actionToggleVocab)
self.menuView.addAction(self.actionToggleKanji) self.menuView.addAction(self.actionToggleKanji)
self.menuView.addSeparator() self.menuView.addSeparator()
self.menuView.addAction(self.actionToggleWrap) self.menuView.addAction(self.actionToggleWrap)
@ -260,7 +260,7 @@ class Ui_MainWindowReader(object):
self.toolBar.addAction(self.actionFind) self.toolBar.addAction(self.actionFind)
self.retranslateUi(MainWindowReader) 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.actionQuit, QtCore.SIGNAL(_fromUtf8("triggered()")), MainWindowReader.close)
QtCore.QObject.connect(self.actionToggleAnki, QtCore.SIGNAL(_fromUtf8("toggled(bool)")), self.dockAnki.setVisible) 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) 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.actionFindNext.setShortcut(_translate("MainWindowReader", "F3", None))
self.actionToggleWrap.setText(_translate("MainWindowReader", "&Word wrap", None)) self.actionToggleWrap.setText(_translate("MainWindowReader", "&Word wrap", None))
self.actionToggleWrap.setToolTip(_translate("MainWindowReader", "Toggle word wrap", None)) self.actionToggleWrap.setToolTip(_translate("MainWindowReader", "Toggle word wrap", None))
self.actionToggleVocabulary.setText(_translate("MainWindowReader", "&Vocabulary", None)) self.actionToggleVocab.setText(_translate("MainWindowReader", "&Vocabulary", None))
self.actionToggleVocabulary.setToolTip(_translate("MainWindowReader", "Toggle definitions", None)) self.actionToggleVocab.setToolTip(_translate("MainWindowReader", "Toggle definitions", None))
self.actionCopyDefinition.setText(_translate("MainWindowReader", "Copy &definition", None)) self.actionCopyDefinition.setText(_translate("MainWindowReader", "Copy &definition", None))
self.actionCopyDefinition.setShortcut(_translate("MainWindowReader", "Ctrl+D", None)) self.actionCopyDefinition.setShortcut(_translate("MainWindowReader", "Ctrl+D", None))
self.actionCopyAllDefinitions.setText(_translate("MainWindowReader", "Copy &all definitions", None)) self.actionCopyAllDefinitions.setText(_translate("MainWindowReader", "Copy &all definitions", None))

View File

@ -2,7 +2,7 @@
# Resource object code # 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) # by: The Resource Compiler for PyQt (Qt v4.8.4)
# #
# WARNING! All changes made in this file will be lost! # WARNING! All changes made in this file will be lost!

View File

@ -81,9 +81,10 @@ class MainWindowReader(QtGui.QMainWindow, reader_ui.Ui_MainWindowReader):
self.actionHomepage.triggered.connect(self.onActionHomepage) self.actionHomepage.triggered.connect(self.onActionHomepage)
self.actionFeedback.triggered.connect(self.onActionFeedback) self.actionFeedback.triggered.connect(self.onActionFeedback)
self.textDefinitions.anchorClicked.connect(self.onDefinitionsAnchorClicked) 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.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.dockAnki.visibilityChanged.connect(self.onVisibilityChanged)
self.updateFinder.updateResult.connect(self.onUpdaterSearchResult) self.updateFinder.updateResult.connect(self.onUpdaterSearchResult)
@ -131,7 +132,8 @@ class MainWindowReader(QtGui.QMainWindow, reader_ui.Ui_MainWindowReader):
def keyPressEvent(self, event): 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() self.updateSampleFromPosition()
@ -269,7 +271,7 @@ class MainWindowReader(QtGui.QMainWindow, reader_ui.Ui_MainWindowReader):
def onDefinitionSearchReturn(self): def onDefinitionSearchReturn(self):
text = unicode(self.textDefinitionSearch.text()) text = unicode(self.textVocabSearch.text())
self.state.definitions, length = self.language.findTerm(text, True) self.state.definitions, length = self.language.findTerm(text, True)
self.updateDefinitions() self.updateDefinitions()
@ -282,7 +284,8 @@ class MainWindowReader(QtGui.QMainWindow, reader_ui.Ui_MainWindowReader):
def onVisibilityChanged(self, visible): def onVisibilityChanged(self, visible):
self.actionToggleAnki.setChecked(self.dockAnki.isVisible()) 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): def onUpdaterSearchResult(self, result):
@ -469,7 +472,8 @@ class MainWindowReader(QtGui.QMainWindow, reader_ui.Ui_MainWindowReader):
cursor = self.textContent.cursorForPosition(event.pos()) cursor = self.textContent.cursorForPosition(event.pos())
self.state.scanPosition = cursor.position() self.state.scanPosition = cursor.position()
requested = event.buttons() & QtCore.Qt.MidButton or event.modifiers() & QtCore.Qt.ShiftModifier 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() self.updateSampleFromPosition()