1

Removing some pointless indirection

This commit is contained in:
Alex Yatskov 2012-12-23 17:53:48 -08:00
parent 1a56e5c2a2
commit 01f516c9d1
2 changed files with 6 additions and 10 deletions

View File

@ -38,7 +38,7 @@ class MainWindowReader(QtGui.QMainWindow):
self.archiveIndex = None self.archiveIndex = None
def __init__(self, parent, preferences, languages, filename=None, anki=None, closed=None, updated=None): def __init__(self, parent, preferences, language, filename=None, anki=None, closed=None, updated=None):
QtGui.QMainWindow.__init__(self, parent) QtGui.QMainWindow.__init__(self, parent)
uic.loadUi(buildResPath('ui/reader.ui'), self) uic.loadUi(buildResPath('ui/reader.ui'), self)
@ -49,7 +49,7 @@ class MainWindowReader(QtGui.QMainWindow):
self.preferences = preferences self.preferences = preferences
self.updateFinder = UpdateFinder() self.updateFinder = UpdateFinder()
self.state = self.State() self.state = self.State()
self.languages = languages self.language = language
self.addedFacts = list() self.addedFacts = list()
self.anki = anki self.anki = anki
self.closed = closed self.closed = closed
@ -271,7 +271,7 @@ class MainWindowReader(QtGui.QMainWindow):
def onDefinitionSearchReturn(self): def onDefinitionSearchReturn(self):
text = unicode(self.textDefinitionSearch.text()) text = unicode(self.textDefinitionSearch.text())
definitions, length = self.language().wordSearch( definitions, length = self.language.wordSearch(
text, text,
self.preferences.searchResultMax, self.preferences.searchResultMax,
self.preferences.searchGroupByExp self.preferences.searchGroupByExp
@ -496,7 +496,7 @@ class MainWindowReader(QtGui.QMainWindow):
return return
contentSampleFlat = contentSample.replace('\n', unicode()) contentSampleFlat = contentSample.replace('\n', unicode())
definitionsMatched, lengthMatched = self.language().wordSearch( definitionsMatched, lengthMatched = self.language.wordSearch(
contentSampleFlat, contentSampleFlat,
self.preferences.searchResultMax, self.preferences.searchResultMax,
self.preferences.searchGroupByExp self.preferences.searchGroupByExp
@ -574,7 +574,3 @@ class MainWindowReader(QtGui.QMainWindow):
def setStatus(self, status): def setStatus(self, status):
self.statusBar.showMessage(status) self.statusBar.showMessage(status)
def language(self):
return self.languages['Japanese']

View File

@ -27,7 +27,7 @@ from yomi_base.reader import MainWindowReader
class Yomichan: class Yomichan:
def __init__(self): def __init__(self):
self.languages = {'Japanese': japanese.initLanguage()} self.language = japanese.initLanguage()
self.preferences = Preferences() self.preferences = Preferences()
self.preferences.load() self.preferences.load()
@ -57,7 +57,7 @@ class YomichanPlugin(Yomichan):
self.window = MainWindowReader( self.window = MainWindowReader(
self.parent, self.parent,
self.preferences, self.preferences,
self.languages, self.language,
None, None,
self.anki, self.anki,
self.onWindowClose self.onWindowClose