diff --git a/wquery/context.py b/wquery/context.py
index 4ea1b54..ee7b796 100644
--- a/wquery/context.py
+++ b/wquery/context.py
@@ -28,7 +28,7 @@
from .lang import _
from .odds import get_model_byId, get_ord_from_fldname
-VERSION = '20170416001'
+VERSION = 'V4.0.20170506'
CONFIG_FILENAME = '.wqcfg'
diff --git a/wquery/lang.py b/wquery/lang.py
index 3ed60f3..ac3978f 100644
--- a/wquery/lang.py
+++ b/wquery/lang.py
@@ -37,13 +37,23 @@
'DICT_FIELDS': {'zh_CN': u'字典字段', 'en': u'Dict fields', 'fr': u'Champ de dico'},
'RADIOS_DESC': {'zh_CN': u'单选框选中为待查询单词字段', 'en': u'Word field needs to be selected.', 'fr': u'Champ de mot doit d\'être sélectionné. '},
'NO_QUERY_WORD': {'zh_CN': u'查询字段无单词', 'en': u'No word is found in the query field', 'fr': u'Aucun est trouvé dans le champ'},
- 'CSS_NOT_FOUND': {'zh_CN': u'没有找到CSS文件,请手动选择', 'en': u'No valid css stylesheets found, please choose the file', 'fr': u'Aucun fichier de style CSS valide, veuillez choisir le fichier'}
+ 'CSS_NOT_FOUND': {'zh_CN': u'没有找到CSS文件,请手动选择', 'en': u'No valid css stylesheets found, please choose the file', 'fr': u'Aucun fichier de style CSS valide, veuillez choisir le fichier'},
+ 'ABOUT': {'zh_CN': u'关于'},
+ 'REPOSITORY': {'zh_CN': u'项目地址'},
+ 'FEEDBACK': {'zh_CN': u'反馈'},
+ 'VERSION': {'zh_CN': u'版本'}
}
def _(key, lang=currentLang):
if lang != 'zh_CN' and lang != 'en' and lang != 'fr':
lang = 'en' # fallback
+
+ def disp(s):
+ return '{first_character}{others}'.format(first_character=s[0].upper(), others=s[1:].lower())
+
+ if not trans.has_key(key) or not trans[key].has_key(lang):
+ return disp(key)
return trans[key][lang]
diff --git a/wquery/ui.py b/wquery/ui.py
index 6e4bbe0..f7b4de7 100644
--- a/wquery/ui.py
+++ b/wquery/ui.py
@@ -28,7 +28,7 @@
from aqt.studydeck import StudyDeck
from aqt.utils import shortcut, showInfo
-from .context import config
+from .context import config, VERSION
from .lang import _, _sl
from .odds import get_model_byId, get_ord_from_fldname
from .service import service_manager
@@ -140,8 +140,11 @@ def build(self):
self.main_layout.addWidget(scroll_area)
# add description of radio buttons AND ok button
bottom_layout = QHBoxLayout()
+ about_btn = QPushButton(_('ABOUT'))
+ about_btn.clicked.connect(self.show_about)
btnbox = QDialogButtonBox(QDialogButtonBox.Ok, Qt.Horizontal, self)
btnbox.accepted.connect(self.accept)
+ bottom_layout.addWidget(about_btn)
bottom_layout.addWidget(QLabel(_("RADIOS_DESC")))
bottom_layout.addWidget(btnbox)
self.main_layout.addLayout(bottom_layout)
@@ -156,6 +159,13 @@ def build(self):
# build fields -- dicts layout
self.build_mappings_layout(model)
+ def show_about(self):
+ info = u'{t0}
{version}
{t1}
{url}
{t2}
{feedback0}
{feedback1}'.format(
+ t0=_('VERSION'), version=VERSION,
+ t1=_('REPOSITORY'), url=u'https://github.com/finalion/WordQuery',
+ t2=_('FEEDBACK'), feedback0=u'https://github.com/finalion/WordQuery/issues', feedback1=u'finalion@gmail.com')
+ QMessageBox.about(self, _('ABOUT'), info)
+
def show_fm_dialog(self):
fm_dialog = FoldersManageDialog(self)
fm_dialog.activateWindow()
@@ -302,12 +312,12 @@ def add_dict_layout(self, i, **kwargs):
kwargs:
word_checked dict fld_name dict_field
"""
- word_checked, dict_name, dict_unique, fld_name, dict_field =\
- kwargs.get('word_checked', False), \
- kwargs.get('dict', _('NOT_DICT_FIELD')), \
- kwargs.get('dict_unique', ''),\
- kwargs.get('fld_name', ''), \
- kwargs.get('dict_field', '')
+ word_checked, dict_name, dict_unique, fld_name, dict_field = (
+ kwargs.get('word_checked', False),
+ kwargs.get('dict', _('NOT_DICT_FIELD')),
+ kwargs.get('dict_unique', ''),
+ kwargs.get('fld_name', ''),
+ kwargs.get('dict_field', ''),)
fldname_label = QRadioButton(fld_name)
fldname_label.setMinimumSize(100, 0)