1

Small fixups and tweaks

Former-commit-id: 8de377f8989f696a3a0db9ddb5830ab414634c24
This commit is contained in:
Alex Yatskov 2013-11-09 18:49:31 -08:00
parent 21b7c734a4
commit c8d6ec9cd7
9 changed files with 35 additions and 35 deletions

View File

@ -1,7 +1,7 @@
#!/usr/bin/env python #!/usr/bin/env python
# #
# Copyright (C) 2011 Alex Yatskov # Copyright (C) 2013 Alex Yatskov
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@ -17,6 +17,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
import codecs import codecs
import optparse import optparse
import os import os

View File

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright (C) 2011 Alex Yatskov # Copyright (C) 2013 Alex Yatskov
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@ -17,8 +17,8 @@
from PyQt4 import QtGui from PyQt4 import QtGui
from constants import constants
from gen import about_ui from gen import about_ui
import constants
class DialogAbout(QtGui.QDialog, about_ui.Ui_DialogAbout): class DialogAbout(QtGui.QDialog, about_ui.Ui_DialogAbout):
@ -27,5 +27,5 @@ class DialogAbout(QtGui.QDialog, about_ui.Ui_DialogAbout):
self.setupUi(self) self.setupUi(self)
text = unicode(self.labelVersion.text()) text = unicode(self.labelVersion.text())
text = text.format(constants['version']) text = text.format(constants.c['appVersion'])
self.labelVersion.setText(text) self.labelVersion.setText(text)

View File

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright (C) 2011 Alex Yatskov # Copyright (C) 2013 Alex Yatskov
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@ -16,8 +16,8 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
import aqt
import anki import anki
import aqt
class Anki: class Anki:

View File

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright (C) 2011 Alex Yatskov # Copyright (C) 2013 Alex Yatskov
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@ -16,10 +16,9 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
constants = { c = {
'version': '0.07b', 'appVersion': '0.10b',
'urlFeedback': 'http://foosoft.net/comments/',
'urlUpdates': 'http://foosoft.net/pub/projects/yomichan/updates.xml',
'urlHomepage': 'http://foosoft.net/yomichan/', 'urlHomepage': 'http://foosoft.net/yomichan/',
'urlFeedback': 'http://foosoft.net/comments/' 'urlUpdates': 'http://foosoft.net/pub/projects/yomichan/updates.xml',
} }

View File

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright (C) 2011 Alex Yatskov # Copyright (C) 2013 Alex Yatskov
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@ -16,9 +16,9 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
import os
from xml.dom import minidom
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from xml.dom import minidom
import os
class Preferences: class Preferences:

View File

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright (C) 2011 Alex Yatskov # Copyright (C) 2013 Alex Yatskov
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by

View File

@ -16,15 +16,15 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
import os
import tarfile
from PyQt4 import QtGui, QtCore from PyQt4 import QtGui, QtCore
from preferences import DialogPreferences
from update import UpdateFinder
from about import DialogAbout from about import DialogAbout
from constants import constants
from gen import reader_ui from gen import reader_ui
from preferences import DialogPreferences
import constants
import os
import reader_util import reader_util
import tarfile
import update
class MainWindowReader(QtGui.QMainWindow, reader_ui.Ui_MainWindowReader): class MainWindowReader(QtGui.QMainWindow, reader_ui.Ui_MainWindowReader):
@ -47,7 +47,7 @@ class MainWindowReader(QtGui.QMainWindow, reader_ui.Ui_MainWindowReader):
self.dockAnki.setEnabled(bool(anki)) self.dockAnki.setEnabled(bool(anki))
self.preferences = preferences self.preferences = preferences
self.updateFinder = UpdateFinder() self.updateFinder = update.UpdateFinder()
self.state = self.State() self.state = self.State()
self.language = language self.language = language
self.addedFacts = list() self.addedFacts = list()
@ -235,12 +235,12 @@ class MainWindowReader(QtGui.QMainWindow, reader_ui.Ui_MainWindowReader):
def onActionHomepage(self): def onActionHomepage(self):
url = QtCore.QUrl(constants['urlHomepage']) url = QtCore.QUrl(constants.c['urlHomepage'])
QtGui.QDesktopServices().openUrl(url) QtGui.QDesktopServices().openUrl(url)
def onActionFeedback(self): def onActionFeedback(self):
url = QtCore.QUrl(constants['urlFeedback']) url = QtCore.QUrl(constants.c['urlFeedback'])
QtGui.QDesktopServices().openUrl(url) QtGui.QDesktopServices().openUrl(url)
@ -285,12 +285,12 @@ class MainWindowReader(QtGui.QMainWindow, reader_ui.Ui_MainWindowReader):
def onUpdaterSearchResult(self, result): def onUpdaterSearchResult(self, result):
if result and unicode(result) > constants['version']: if result and unicode(result) > constants.c['appVersion']:
QtGui.QMessageBox.information( QtGui.QMessageBox.information(
self, self,
'Yomichan', 'Yomichan',
'A new version of Yomichan is available for download!\n\nYou can download this update ({0} > {1}) ' \ 'A new version of Yomichan is available for download!\n\nYou can download this update ({0} > {1}) ' \
'from "Shared Plugins" in Anki or directly from the Yomichan homepage.'.format(constants['version'], result) 'from "Shared Plugins" in Anki or directly from the Yomichan homepage.'.format(constants.c['appVersion'], result)
) )
@ -447,7 +447,7 @@ class MainWindowReader(QtGui.QMainWindow, reader_ui.Ui_MainWindowReader):
if markup['reading']: if markup['reading']:
summary = u'{expression} [{reading}]'.format(**markup) summary = u'{expression} [{reading}]'.format(**markup)
else: else:
summary = expression summary = markup['expression']
self.addedFacts.append(factId) self.addedFacts.append(factId)
self.listDefinitions.addItem(summary) self.listDefinitions.addItem(summary)

View File

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright (C) 2011 Alex Yatskov # Copyright (C) 2013 Alex Yatskov
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@ -16,10 +16,10 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
import urllib2
from xml.dom import minidom
from PyQt4 import QtCore from PyQt4 import QtCore
from constants import constants from xml.dom import minidom
import constants
import urllib2
class UpdateFinder(QtCore.QThread): class UpdateFinder(QtCore.QThread):
@ -28,7 +28,7 @@ class UpdateFinder(QtCore.QThread):
def run(self): def run(self):
latest = None latest = None
try: try:
fp = urllib2.urlopen(constants['urlUpdates']) fp = urllib2.urlopen(constants.c['urlUpdates'])
data = fp.read() data = fp.read()
doc = minidom.parseString(data) doc = minidom.parseString(data)
root = doc.documentElement root = doc.documentElement
@ -37,4 +37,4 @@ class UpdateFinder(QtCore.QThread):
except: except:
pass pass
finally: finally:
self.updateResult.emit(latest or constants['version']) self.updateResult.emit(latest or constants.c['appVersion'])

View File

@ -1,7 +1,7 @@
#!/usr/bin/env python2 #!/usr/bin/env python2
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright (C) 2011 Alex Yatskov # Copyright (C) 2013 Alex Yatskov
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@ -17,11 +17,11 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
import sys
from PyQt4 import QtGui, QtCore from PyQt4 import QtGui, QtCore
from yomi_base import japanese from yomi_base import japanese
from yomi_base.preference_data import Preferences from yomi_base.preference_data import Preferences
from yomi_base.reader import MainWindowReader from yomi_base.reader import MainWindowReader
import sys
class Yomichan: class Yomichan: