fix qmenu action args bug
This commit is contained in:
parent
39d90a5a44
commit
0948929ffe
@ -158,8 +158,8 @@ def customize_addcards():
|
|||||||
menu = QMenu(self)
|
menu = QMenu(self)
|
||||||
menu.addAction(
|
menu.addAction(
|
||||||
_("ALL_FIELDS"),
|
_("ALL_FIELDS"),
|
||||||
lambda: query_from_editor_fields(self.editor),
|
lambda: query_from_editor_fields(self.editor))
|
||||||
QKeySequence(my_shortcut))
|
# ,QKeySequence(my_shortcut))
|
||||||
# default options
|
# default options
|
||||||
mid = self.editor.note.model()['id']
|
mid = self.editor.note.model()['id']
|
||||||
conf = config.get_maps(mid)
|
conf = config.get_maps(mid)
|
||||||
@ -238,8 +238,8 @@ def context_menu():
|
|||||||
|
|
||||||
submenu = menu.addMenu(_('QUERY'))
|
submenu = menu.addMenu(_('QUERY'))
|
||||||
submenu.addAction(
|
submenu.addAction(
|
||||||
_('ALL_FIELDS'), lambda: query_from_editor_fields(web_view.editor),
|
_('ALL_FIELDS'), lambda: query_from_editor_fields(web_view.editor))
|
||||||
QKeySequence(my_shortcut))
|
# ,QKeySequence(my_shortcut))
|
||||||
if len(curr_flds) > 0:
|
if len(curr_flds) > 0:
|
||||||
# quer hook method
|
# quer hook method
|
||||||
def query_from_editor_hook(i):
|
def query_from_editor_hook(i):
|
||||||
|
|||||||
@ -37,9 +37,9 @@ __all__ = ['DictManageDialog']
|
|||||||
|
|
||||||
|
|
||||||
class DictManageDialog(Dialog):
|
class DictManageDialog(Dialog):
|
||||||
'''
|
"""
|
||||||
Dictionary manager window. enabled or disabled dictionary, and setting params of dictionary.
|
Dictionary manager window. enabled or disabled dictionary, and setting params of dictionary.
|
||||||
'''
|
"""
|
||||||
|
|
||||||
def __init__(self, parent, title=u'Dictionary Manager'):
|
def __init__(self, parent, title=u'Dictionary Manager'):
|
||||||
super(DictManageDialog, self).__init__(parent, title)
|
super(DictManageDialog, self).__init__(parent, title)
|
||||||
@ -60,7 +60,7 @@ class DictManageDialog(Dialog):
|
|||||||
self.build()
|
self.build()
|
||||||
|
|
||||||
def build(self):
|
def build(self):
|
||||||
''' '''
|
""" """
|
||||||
# labels
|
# labels
|
||||||
f = QFont()
|
f = QFont()
|
||||||
f.setBold(True)
|
f.setBold(True)
|
||||||
@ -143,7 +143,7 @@ class DictManageDialog(Dialog):
|
|||||||
row['check_btn'].setChecked(b)
|
row['check_btn'].setChecked(b)
|
||||||
|
|
||||||
def on_edit(self, path):
|
def on_edit(self, path):
|
||||||
'''edit dictionary file'''
|
"""edit dictionary file"""
|
||||||
d = QDialog(self)
|
d = QDialog(self)
|
||||||
frm = Ui_Dialog()
|
frm = Ui_Dialog()
|
||||||
frm.setupUi(d)
|
frm.setupUi(d)
|
||||||
@ -154,10 +154,10 @@ class DictManageDialog(Dialog):
|
|||||||
else:
|
else:
|
||||||
frm.text.setPlainText(unicode(open(path).read(), "utf8"))
|
frm.text.setPlainText(unicode(open(path).read(), "utf8"))
|
||||||
d.accepted.connect(lambda: self.on_accept_edit(path, frm))
|
d.accepted.connect(lambda: self.on_accept_edit(path, frm))
|
||||||
d.exec_()
|
d.exec()
|
||||||
|
|
||||||
def on_accept_edit(self, path, frm):
|
def on_accept_edit(self, path, frm):
|
||||||
'''save dictionary file'''
|
"""save dictionary file"""
|
||||||
# 2x3 compatible
|
# 2x3 compatible
|
||||||
if sys.hexversion >= 0x03000000:
|
if sys.hexversion >= 0x03000000:
|
||||||
open(path, "w", encoding='utf-8').write(frm.text.toPlainText())
|
open(path, "w", encoding='utf-8').write(frm.text.toPlainText())
|
||||||
@ -165,12 +165,12 @@ class DictManageDialog(Dialog):
|
|||||||
open(path, "w").write(frm.text.toPlainText().encode("utf8"))
|
open(path, "w").write(frm.text.toPlainText().encode("utf8"))
|
||||||
|
|
||||||
def accept(self):
|
def accept(self):
|
||||||
'''ok button clicked'''
|
"""ok button clicked"""
|
||||||
self.save()
|
self.save()
|
||||||
super(DictManageDialog, self).accept()
|
super(DictManageDialog, self).accept()
|
||||||
|
|
||||||
def save(self):
|
def save(self):
|
||||||
'''save config to file'''
|
"""save config to file"""
|
||||||
data = dict()
|
data = dict()
|
||||||
dicts = {}
|
dicts = {}
|
||||||
for row in self._options:
|
for row in self._options:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user