1

updating bindings

This commit is contained in:
Alex Yatskov 2011-10-27 07:24:55 -07:00
parent 65ee3466ad
commit 0f84f444fb
2 changed files with 23 additions and 26 deletions

View File

@ -73,31 +73,26 @@ class MainWindowReader(QtGui.QMainWindow, Ui_MainWindowReader):
if self.preferences.generalFindUpdates: if self.preferences.generalFindUpdates:
self.updateFinder.start() self.updateFinder.start()
bindings = [ self.actionOpen.triggered.connect(self.onActionOpen)
(self.actionOpen, 'triggered()', self.onActionOpen), self.actionPreferences.triggered.connect(self.onActionPreferences)
(self.actionPreferences, 'triggered()', self.onActionPreferences), self.actionAbout.triggered.connect(self.onActionAbout)
(self.actionAbout, 'triggered()', self.onActionAbout), self.actionZoomIn.triggered.connect(self.onActionZoomIn)
(self.actionZoomIn, 'triggered()', self.onActionZoomIn), self.actionZoomOut.triggered.connect(self.onActionZoomOut)
(self.actionZoomOut, 'triggered()', self.onActionZoomOut), self.actionZoomReset.triggered.connect(self.onActionZoomReset)
(self.actionZoomReset, 'triggered()', self.onActionZoomReset), self.actionFind.triggered.connect(self.onActionFind)
(self.actionFind, 'triggered()', self.onActionFind), self.actionFindNext.triggered.connect(self.onActionFindNext)
(self.actionFindNext, 'triggered()', self.onActionFindNext), self.actionToggleWrap.toggled.connect(self.onActionToggleWrap)
(self.actionToggleWrap, 'toggled(bool)', self.onActionToggleWrap), self.actionCopyDefinition.triggered.connect(self.onActionCopyDefinition)
(self.actionCopyDefinition, 'triggered()', self.onActionCopyDefinition), self.actionCopyAllDefinitions.triggered.connect(self.onActionCopyAllDefinitions)
(self.actionCopyAllDefinitions, 'triggered()', self.onActionCopyAllDefinitions), self.actionCopySentence.triggered.connect(self.onActionCopySentence)
(self.actionCopySentence, 'triggered()', self.onActionCopySentence), self.actionHomepage.triggered.connect(self.onActionHomepage)
(self.actionHomepage, 'triggered()', self.onActionHomepage), self.actionFeedback.triggered.connect(self.onActionFeedback)
(self.actionFeedback, 'triggered()', self.onActionFeedback), self.textDefinitions.anchorClicked.connect(self.onDefinitionsAnchorClicked)
(self.textDefinitions, 'anchorClicked(const QUrl&)', self.onDefinitionsAnchorClicked), self.textDefinitionSearch.returnPressed.connect(self.onDefinitionSearchReturn)
(self.textDefinitionSearch, 'returnPressed()', self.onDefinitionSearchReturn), self.listDefinitions.itemDoubleClicked.connect(self.onDefinitionDoubleClicked)
(self.listDefinitions, 'itemDoubleClicked(QListWidgetItem *)', self.onDefinitionDoubleClicked), self.dockDefinitions.visibilityChanged.connect(self.onVisibilityChanged)
(self.dockDefinitions, 'visibilityChanged(bool)', self.onVisibilityChanged), self.dockAnki.visibilityChanged.connect(self.onVisibilityChanged)
(self.dockAnki, 'visibilityChanged(bool)', self.onVisibilityChanged), self.updateFinder.updateResult.connect(self.onUpdaterSearchResult)
(self.updateFinder, 'updateSearchResult', self.onUpdaterSearchResult)
]
for action, signal, callback in bindings:
self.connect(action, QtCore.SIGNAL(signal), callback)
def applyPreferences(self): def applyPreferences(self):

View File

@ -23,6 +23,8 @@ from constants import constants
class UpdateFinder(QtCore.QThread): class UpdateFinder(QtCore.QThread):
updateResult = QtCore.pyqtSignal(str)
def run(self): def run(self):
latest = None latest = None
try: try:
@ -35,4 +37,4 @@ class UpdateFinder(QtCore.QThread):
except: except:
pass pass
finally: finally:
self.emit(QtCore.SIGNAL('updateSearchResult'), latest) self.updateResult.emit(latest)