initial commit from hg
7
.gitignore
vendored
Normal file
|
@ -0,0 +1,7 @@
|
|||
*.pyc
|
||||
*~
|
||||
*.mo
|
||||
*\#
|
||||
build
|
||||
dist
|
||||
ankiqt/forms
|
676
COPYING
Normal file
|
@ -0,0 +1,676 @@
|
|||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
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
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
||||
|
3
CREDITS
Normal file
|
@ -0,0 +1,3 @@
|
|||
Many people have contributed bug reports, patches and feature suggestions.
|
||||
Thanks also to those who have donated or provided translations. Further detail
|
||||
is available in the changelog.
|
6072
ChangeLog.old
Normal file
38
README
Normal file
|
@ -0,0 +1,38 @@
|
|||
Anki for Linux
|
||||
-------------------------------------
|
||||
|
||||
Prerequisites:
|
||||
|
||||
1. A recent python (2.4 should be fine)
|
||||
2. libqt4.2+
|
||||
3. python-qt/pyqt 4.2+
|
||||
4. sqlalchemy 0.4.1+
|
||||
5. simplejson 1.7.3+
|
||||
6: pysqlite2 1.3.0 or python2.5
|
||||
|
||||
If your version of Debian/Ubuntu is not new enough, it will include an old
|
||||
copy of python-qt. You must have at least python-qt 4.2 to run Anki.
|
||||
|
||||
For graph generation:
|
||||
|
||||
1. python-numpy (numpy)
|
||||
2. python-matplotlib (matplotlib)
|
||||
|
||||
The most recent release of matplotlib is broken. Downgrade for now.
|
||||
|
||||
For furigana generation:
|
||||
|
||||
1. kakasi
|
||||
|
||||
To install:
|
||||
|
||||
1. cd; tar xzf ankiqt<...>.tgz
|
||||
2. cd ankit<...>/libanki
|
||||
3. sudo python setup.py install
|
||||
4. cd ..; sudo python setup.py install
|
||||
5. anki
|
||||
|
||||
For more information and the latest version, please see the website at:
|
||||
|
||||
http://ichi2.net/anki/
|
||||
|
5
README.development
Normal file
|
@ -0,0 +1,5 @@
|
|||
You need to have the python-pyqt development packages installed (specifically,
|
||||
you need the binary pyuic4).
|
||||
|
||||
After you check out, run tools/build_ui.sh first, then change into the ankiqt
|
||||
dir and run ../tools/translate.sh. Do the same for the libanki dir. Then ./anki
|
27
README.translating
Normal file
|
@ -0,0 +1,27 @@
|
|||
Interface translations for Anki are greatly appreciated.
|
||||
|
||||
There are two files you need to create a copy of:
|
||||
|
||||
1. ankiqt/ankiqt/locale/messages.pot
|
||||
2. libanki/anki/locale/messages.pot
|
||||
|
||||
You should copy each file to the locale directory using the name of your
|
||||
locale + ".po", for example for Japanese:
|
||||
|
||||
ankiqt_ja_JP.po
|
||||
libanki_ja_JP.po
|
||||
|
||||
Note that the 'messages' files may be out of date. On Unix, you can generate
|
||||
the latest copies by going into the 'ankiqt' or 'anki' directory, and running
|
||||
../tools/translate.sh. You'll need the gettext tools installed. If you don't
|
||||
have access to them, send me a mail and I'll put the latest copy of the files
|
||||
online.
|
||||
|
||||
One you have finished translating the files, taking care to use the same number
|
||||
of \n characters, you can build the files into a 'message catalog' by running
|
||||
'translate.sh' again. If you're on Windows, email me the files and I'll do it
|
||||
for you.
|
||||
|
||||
If your language was not supported by Anki before, the interface will need to
|
||||
be updated too. All you need to do is search for 'supportedLanguages' in
|
||||
ankiqt/ankiqt/ui/preferences.py and add your language name and code.
|
21
anki
Executable file
|
@ -0,0 +1,21 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import os, sys
|
||||
|
||||
if __name__ == "__main__":
|
||||
try:
|
||||
modDir=os.path.dirname(os.path.abspath(__file__))
|
||||
runningDir=os.path.split(modDir)[0]
|
||||
except NameError:
|
||||
# py2exe
|
||||
runningDir=os.path.dirname(sys.argv[0])
|
||||
modDir=runningDir
|
||||
|
||||
# set up paths for local development
|
||||
sys.path.insert(0, os.path.join(modDir, "libanki"))
|
||||
sys.path.insert(0, os.path.join(os.path.join(modDir, ".."), "libanki"))
|
||||
|
||||
import ankiqt
|
||||
#import profile
|
||||
#profile.run("ankiqt.run()", sort="cumulative")
|
||||
ankiqt.run()
|
2
anki.bat
Normal file
|
@ -0,0 +1,2 @@
|
|||
python anki
|
||||
pause
|
11
anki.desktop
Normal file
|
@ -0,0 +1,11 @@
|
|||
[Desktop Entry]
|
||||
Name=Anki
|
||||
Comment=An intelligent spaced-repetition memory training program
|
||||
GenericName=Language Learning Flashcards
|
||||
Exec=anki %f
|
||||
TryExec=anki
|
||||
Icon=anki
|
||||
Categories=Education;Languages;KDE
|
||||
Terminal=false
|
||||
Type=Application
|
||||
Version=1.0
|
101
ankiqt/__init__.py
Normal file
|
@ -0,0 +1,101 @@
|
|||
# Copyright: Damien Elmes <anki@ichi2.net>
|
||||
# License: GNU GPL, version 3 or later; http://www.gnu.org/copyleft/gpl.html
|
||||
|
||||
import os, sys, optparse, re
|
||||
from PyQt4.QtCore import *
|
||||
from PyQt4.QtGui import *
|
||||
|
||||
appName="Anki"
|
||||
appVersion="0.9.8.1"
|
||||
appWebsite="http://ichi2.net/anki/download/"
|
||||
appHelpSite="http://ichi2.net/anki/wiki/Documentation"
|
||||
appIssueTracker="http://code.google.com/p/anki/issues/list"
|
||||
appForum="http://groups.google.com/group/ankisrs/topics"
|
||||
modDir=os.path.dirname(os.path.abspath(__file__))
|
||||
runningDir=os.path.split(modDir)[0]
|
||||
# py2exe
|
||||
if hasattr(sys, "frozen"):
|
||||
sys.path.append(modDir)
|
||||
modDir = os.path.dirname(sys.argv[0])
|
||||
|
||||
# we bundle icons_rc as part of the anki source
|
||||
sys.path.append(os.path.dirname(__file__))
|
||||
import forms
|
||||
import config
|
||||
import ui
|
||||
|
||||
# App initialisation
|
||||
##########################################################################
|
||||
|
||||
def run():
|
||||
# put anki home in c:\anki on win32 if not available
|
||||
if sys.platform == "win32":
|
||||
path = os.path.expanduser("~")
|
||||
if path[0] == "~" or not os.access(path, os.R_OK | os.W_OK):
|
||||
os.environ['HOME'] = "c:\\anki"
|
||||
try:
|
||||
os.mkdir("c:\\anki")
|
||||
except OSError:
|
||||
pass
|
||||
|
||||
app = QApplication(sys.argv)
|
||||
if not sys.platform.startswith("darwin"):
|
||||
app.setStyle("plastique")
|
||||
|
||||
# setup paths for forms, icons
|
||||
sys.path.append(modDir)
|
||||
# jpeg module
|
||||
rd = runningDir
|
||||
if sys.platform.startswith("darwin"):
|
||||
rd = os.path.abspath(runningDir + "/../../..")
|
||||
QCoreApplication.setLibraryPaths(QStringList([rd]))
|
||||
else:
|
||||
QCoreApplication.addLibraryPath(runningDir)
|
||||
|
||||
import anki
|
||||
if anki.version != appVersion:
|
||||
print "You have libanki %s, but this is ankiqt %s" % (
|
||||
anki.version, appVersion)
|
||||
print "\nPlease install the latest libanki."
|
||||
return
|
||||
|
||||
# parse args
|
||||
parser = optparse.OptionParser()
|
||||
parser.usage = "%prog [<deck.anki>]"
|
||||
parser.add_option("-c", "--config", help="path to config dir",
|
||||
default=os.path.expanduser("~/.anki"))
|
||||
(opts, args) = parser.parse_args(sys.argv[1:])
|
||||
|
||||
# configuration
|
||||
import ankiqt.config
|
||||
conf = ankiqt.config.Config(
|
||||
unicode(os.path.abspath(opts.config), sys.getfilesystemencoding()))
|
||||
|
||||
# backups
|
||||
from anki import DeckStorage
|
||||
DeckStorage.backupDir = os.path.join(conf.configPath,
|
||||
"backups")
|
||||
|
||||
# load main window
|
||||
ui.importAll()
|
||||
ui.dialogs.registerDialogs()
|
||||
mw = ui.main.AnkiQt(app, conf, args)
|
||||
try:
|
||||
styleFile = open(opts.config + ".css")
|
||||
mw.setStyleSheet(styleFile.read())
|
||||
except (IOError, OSError):
|
||||
pass
|
||||
|
||||
import platform
|
||||
if (platform.processor() != "powerpc" and
|
||||
platform.architecture()[0] == "32bit"):
|
||||
try:
|
||||
import psyco
|
||||
psyco.profile()
|
||||
except ImportError:
|
||||
print "Installing python-psyco is strongly recommended."
|
||||
|
||||
app.exec_()
|
||||
|
||||
if __name__ == "__main__":
|
||||
run()
|
157
ankiqt/config.py
Normal file
|
@ -0,0 +1,157 @@
|
|||
# Copyright: Damien Elmes <anki@ichi2.net>
|
||||
# License: GNU GPL, version 3 or later; http://www.gnu.org/copyleft/gpl.html
|
||||
|
||||
# User configuration handling
|
||||
##########################################################################
|
||||
|
||||
from PyQt4.QtGui import *
|
||||
from PyQt4.QtCore import *
|
||||
import os, sys, cPickle, locale, types
|
||||
|
||||
# compatability
|
||||
def unpickleWxFont(*args):
|
||||
pass
|
||||
def pickleWxFont(*args):
|
||||
pass
|
||||
|
||||
class Config(dict):
|
||||
|
||||
configDbName = "config.db"
|
||||
|
||||
def __init__(self, configPath):
|
||||
self.configPath = configPath
|
||||
if sys.platform == "win32":
|
||||
if self.configPath.startswith("~"):
|
||||
# windows sucks
|
||||
self.configPath = "c:\\anki"
|
||||
self.load()
|
||||
|
||||
def defaults(self):
|
||||
fields = {
|
||||
'syncOnLoad': False,
|
||||
'syncOnClose': False,
|
||||
'checkForUpdates': True,
|
||||
'interfaceLang': "",
|
||||
'syncUsername': "",
|
||||
'syncPassword': "",
|
||||
'showFontPreview': True,
|
||||
'showToolbar': True,
|
||||
'recentDeckPaths': [],
|
||||
'saveAfterAnswer': True,
|
||||
'saveAfterAnswerNum': 30,
|
||||
'saveAfterAdding': True,
|
||||
'saveAfterAddingNum': 10,
|
||||
'saveOnClose': True,
|
||||
'mainWindowSize': QSize(550, 625),
|
||||
'mainWindowPos': QPoint(100, 100),
|
||||
'easeButtonStyle': 'standard',
|
||||
'easeButtonHeight': 'standard',
|
||||
'suppressUpdate': False,
|
||||
'suppressEstimates': False,
|
||||
'suppressLastCardInterval': False,
|
||||
'suppressLastCardContent': False,
|
||||
'showTray': False,
|
||||
'showTimer': True,
|
||||
'editCurrentOnly': True,
|
||||
'showSuspendedCards': True,
|
||||
}
|
||||
for (k,v) in fields.items():
|
||||
if not self.has_key(k):
|
||||
self[k] = v
|
||||
if not self['interfaceLang']:
|
||||
# guess interface and target languages
|
||||
(lang, enc) = locale.getdefaultlocale()
|
||||
self['interfaceLang'] = lang
|
||||
self.initFonts()
|
||||
|
||||
def initFonts(self):
|
||||
defaultColours = {
|
||||
'lastCard': "#0077FF",
|
||||
'background': "#FFFFFF",
|
||||
'interface': "#000000",
|
||||
}
|
||||
defaultSizes = {
|
||||
'interface': 12,
|
||||
'lastCard': 14,
|
||||
'edit': 12,
|
||||
'other': 24,
|
||||
}
|
||||
# fonts
|
||||
for n in ("interface", "lastCard", "edit"):
|
||||
if not self.get(n + "FontFamily", None):
|
||||
self[n + "FontFamily"] = "Arial"
|
||||
self[n + "FontSize"] = defaultSizes.get(n, defaultSizes['other'])
|
||||
# colours
|
||||
for n in ("interface", "lastCard", "background"):
|
||||
color = n + "Colour"
|
||||
if not color in self:
|
||||
self[color] = defaultColours[n]
|
||||
|
||||
def getDbPath(self):
|
||||
return os.path.join(self.configPath, self.configDbName)
|
||||
|
||||
def makeAnkiDir(self):
|
||||
base = self.configPath
|
||||
os.mkdir(base)
|
||||
os.mkdir(os.path.join(base, "plugins"))
|
||||
os.mkdir(os.path.join(base, "backups"))
|
||||
|
||||
def save(self):
|
||||
path = self.getDbPath()
|
||||
# write to a temp file
|
||||
from tempfile import mkstemp
|
||||
(fd, tmpname) = mkstemp(dir=os.path.dirname(path))
|
||||
tmpfile = os.fdopen(fd, 'w')
|
||||
cPickle.dump(dict(self), tmpfile)
|
||||
tmpfile.close()
|
||||
# the write was successful, delete config file (if exists) and rename
|
||||
if os.path.exists(path):
|
||||
os.unlink(path)
|
||||
os.rename(tmpname, path)
|
||||
|
||||
def load(self):
|
||||
base = self.configPath
|
||||
db = self.getDbPath()
|
||||
if not os.path.exists(base):
|
||||
self.makeAnkiDir()
|
||||
# maybe move .anki config file to .anki/config.db
|
||||
if os.path.isfile(base):
|
||||
oldfile = open(base)
|
||||
contents = oldfile.read()
|
||||
oldfile.close()
|
||||
# write to a tempfile as a backup
|
||||
from tempfile import mkstemp
|
||||
(fd, tmpname) = mkstemp()
|
||||
file = os.fdopen(fd, "w")
|
||||
file.write(contents)
|
||||
file.close()
|
||||
os.unlink(base)
|
||||
self.makeAnkiDir()
|
||||
from shutil import copyfile
|
||||
copyfile(tmpname, db)
|
||||
# load config
|
||||
try:
|
||||
f = open(db)
|
||||
self.update(cPickle.load(f))
|
||||
except (IOError, EOFError):
|
||||
# config file was corrupted previously
|
||||
pass
|
||||
self.defaults()
|
||||
# fix old recent deck path list
|
||||
for n in range(len(self['recentDeckPaths'])):
|
||||
s = self['recentDeckPaths'][n]
|
||||
if not isinstance(s, types.UnicodeType):
|
||||
self['recentDeckPaths'][n] = unicode(s, sys.getfilesystemencoding())
|
||||
# fix old locale settings
|
||||
if self["interfaceLang"] == "ja":
|
||||
self["interfaceLang"]="ja_JP"
|
||||
elif self["interfaceLang"] == "fr":
|
||||
self["interfaceLang"]="fr_FR"
|
||||
elif self["interfaceLang"] == "en":
|
||||
self["interfaceLang"]="en_US"
|
||||
elif self["interfaceLang"] == "de":
|
||||
self["interfaceLang"]="de_DE"
|
||||
elif self["interfaceLang"] == "es":
|
||||
self["interfaceLang"]="es_ES"
|
||||
elif not self["interfaceLang"]:
|
||||
self["interfaceLang"]="en_US"
|
6537
ankiqt/icons_rc.py
Normal file
2658
ankiqt/locale/ankiqt_cs_CZ.po
Normal file
2281
ankiqt/locale/ankiqt_de_DE.po
Normal file
2787
ankiqt/locale/ankiqt_es_ES.po
Normal file
2817
ankiqt/locale/ankiqt_fr_FR.po
Normal file
2713
ankiqt/locale/ankiqt_ja_JP.po
Normal file
2425
ankiqt/locale/ankiqt_ko_KR.po
Normal file
2069
ankiqt/locale/messages.pot
Normal file
69
ankiqt/ui/__init__.py
Normal file
|
@ -0,0 +1,69 @@
|
|||
# Copyright: Damien Elmes <anki@ichi2.net>
|
||||
# License: GNU GPL, version 3 or later; http://www.gnu.org/copyleft/gpl.html
|
||||
|
||||
def importAll():
|
||||
# a hack
|
||||
import main
|
||||
import about
|
||||
import unsaved
|
||||
import help
|
||||
import preferences
|
||||
import addcards
|
||||
import lookup
|
||||
import sync
|
||||
import view
|
||||
import cardlist
|
||||
import update
|
||||
import importing
|
||||
import exporting
|
||||
import status
|
||||
import deckproperties
|
||||
import modelproperties
|
||||
import modelchooser
|
||||
import displayproperties
|
||||
import utils
|
||||
import facteditor
|
||||
import tagedit
|
||||
import tray
|
||||
|
||||
class DialogManager(object):
|
||||
|
||||
def __init__(self):
|
||||
self.modelessDialogs = {}
|
||||
|
||||
def registerDialog(self, name, klass):
|
||||
self.modelessDialogs[name] = (klass, None)
|
||||
|
||||
def open(self, name, obj):
|
||||
self.modelessDialogs[name] = (
|
||||
self.modelessDialogs[name][0], obj)
|
||||
|
||||
def close(self, name):
|
||||
self.modelessDialogs[name] = (
|
||||
self.modelessDialogs[name][0], None)
|
||||
|
||||
def get(self, name, *args):
|
||||
(klass, obj) = self.modelessDialogs[name]
|
||||
if obj:
|
||||
return obj
|
||||
else:
|
||||
return klass(*args)
|
||||
|
||||
def closeAll(self):
|
||||
for (n, (klass, obj)) in self.modelessDialogs.items():
|
||||
if obj:
|
||||
obj.hide()
|
||||
self.close(n)
|
||||
|
||||
# since we load the graphs dynamically, we need a proxy for this
|
||||
def graphProxy(self, *args):
|
||||
import graphs
|
||||
return graphs.intervalGraph(*args)
|
||||
|
||||
def registerDialogs(self):
|
||||
self.registerDialog("AddCards", addcards.AddCards)
|
||||
self.registerDialog("CardList", cardlist.EditDeck)
|
||||
self.registerDialog("DisplayProperties", displayproperties.DisplayProperties)
|
||||
self.registerDialog("Graphs", self.graphProxy)
|
||||
|
||||
dialogs = DialogManager()
|
21
ankiqt/ui/about.py
Normal file
|
@ -0,0 +1,21 @@
|
|||
# Copyright: Damien Elmes <anki@ichi2.net>
|
||||
# License: GNU GPL, version 3 or later; http://www.gnu.org/copyleft/gpl.html
|
||||
|
||||
from PyQt4.QtGui import *
|
||||
import ankiqt.forms
|
||||
from ankiqt import appVersion
|
||||
|
||||
def show(parent):
|
||||
dialog = QDialog(parent)
|
||||
abt = ankiqt.forms.about.Ui_About()
|
||||
abt.setupUi(dialog)
|
||||
abt.label.setText(_("""
|
||||
<h1>Anki</h1>
|
||||
<img src=":/icons/anki.png">
|
||||
<p>
|
||||
<span>Anki is a spaced repetition flashcard program designed to maximise your
|
||||
memory potential.<p/>It's free and licensed under the GPL.<p/>
|
||||
Version %s<br>
|
||||
<a href="http://ichi2.net/anki/">Visit website</a></span>
|
||||
""") % appVersion)
|
||||
dialog.exec_()
|
129
ankiqt/ui/addcards.py
Normal file
|
@ -0,0 +1,129 @@
|
|||
# Copyright: Damien Elmes <anki@ichi2.net>
|
||||
# License: GNU GPL, version 3 or later; http://www.gnu.org/copyleft/gpl.html
|
||||
|
||||
from PyQt4.QtGui import *
|
||||
from PyQt4.QtCore import *
|
||||
import sys, re
|
||||
import ankiqt.forms
|
||||
import anki
|
||||
from anki.facts import Fact
|
||||
from anki.errors import *
|
||||
from anki.utils import stripHTML
|
||||
from ankiqt import ui
|
||||
|
||||
class AddCards(QDialog):
|
||||
|
||||
def __init__(self, parent):
|
||||
QDialog.__init__(self, parent, Qt.Window)
|
||||
self.parent = parent
|
||||
self.config = parent.config
|
||||
self.dialog = ankiqt.forms.addcards.Ui_AddCards()
|
||||
self.dialog.setupUi(self)
|
||||
self.setupEditor()
|
||||
self.addChooser()
|
||||
self.addHelp()
|
||||
self.addButtons()
|
||||
self.setupStatus()
|
||||
self.modelChanged(self.parent.deck.currentModel)
|
||||
self.addedItems = 0
|
||||
self.show()
|
||||
ui.dialogs.open("AddCards", self)
|
||||
|
||||
def setupEditor(self):
|
||||
self.editor = ui.facteditor.FactEditor(self,
|
||||
self.dialog.fieldsArea,
|
||||
self.parent.deck)
|
||||
self.editor.onFactValid = self.onValid
|
||||
self.editor.onFactInvalid = self.onInvalid
|
||||
|
||||
def addChooser(self):
|
||||
self.modelChooser = ui.modelchooser.ModelChooser(self,
|
||||
self.parent,
|
||||
self.parent.deck,
|
||||
self.modelChanged)
|
||||
self.dialog.modelArea.setLayout(self.modelChooser)
|
||||
|
||||
def addHelp(self):
|
||||
self.help = ui.help.HelpArea(self.dialog.helpFrame,
|
||||
self.config)
|
||||
self.help.showHideableKey("add")
|
||||
|
||||
def addButtons(self):
|
||||
self.addButton = QPushButton(_("&Add cards"))
|
||||
self.dialog.buttonBox.addButton(self.addButton,
|
||||
QDialogButtonBox.ActionRole)
|
||||
self.addButton.setShortcut(_("Ctrl+Return"))
|
||||
self.addButton.setDefault(True)
|
||||
s = QShortcut(QKeySequence(_("Ctrl+Enter")), self)
|
||||
s.connect(s, SIGNAL("activated()"), self.addButton, SLOT("click()"))
|
||||
s = QShortcut(QKeySequence(_("Alt+A")), self)
|
||||
s.connect(s, SIGNAL("activated()"), self.addButton, SLOT("click()"))
|
||||
self.connect(self.addButton, SIGNAL("clicked()"), self.addCards)
|
||||
self.closeButton = QPushButton(_("Close"))
|
||||
self.dialog.buttonBox.addButton(self.closeButton,
|
||||
QDialogButtonBox.RejectRole)
|
||||
|
||||
def setupStatus(self):
|
||||
"Make the status background the same colour as the frame."
|
||||
p = self.dialog.statusGroup.palette()
|
||||
c = unicode(p.color(QPalette.Window).name())
|
||||
self.dialog.status.setStyleSheet(
|
||||
"* { background: %s; color: #000000; }" % c)
|
||||
|
||||
def modelChanged(self, model):
|
||||
oldFact = self.editor.fact
|
||||
# create a new fact
|
||||
fact = self.parent.deck.newFact()
|
||||
fact.tags = self.parent.deck.lastTags
|
||||
# set the new fact
|
||||
self.editor.setFact(fact, check=True)
|
||||
|
||||
def onValid(self, fact):
|
||||
self.addButton.setEnabled(True)
|
||||
|
||||
def onInvalid(self, fact):
|
||||
self.addButton.setEnabled(False)
|
||||
|
||||
def addCards(self):
|
||||
fact = self.editor.fact
|
||||
cards = self.parent.deck.addFact(fact)
|
||||
self.dialog.status.append(_("Added %(num)d card(s) for '%(str)s'.") % {
|
||||
"num": len(cards),
|
||||
# we're guaranteed that all fields will exist now
|
||||
"str": stripHTML(fact[fact.fields[0].name]),
|
||||
})
|
||||
self.parent.updateTitleBar()
|
||||
# start a new fact
|
||||
f = self.parent.deck.newFact()
|
||||
f.tags = self.parent.deck.lastTags
|
||||
self.editor.setFact(f, check=True)
|
||||
self.maybeSave()
|
||||
|
||||
def closeEvent(self, evt):
|
||||
if self.onClose():
|
||||
evt.accept()
|
||||
else:
|
||||
evt.ignore()
|
||||
|
||||
def reject(self):
|
||||
if self.onClose():
|
||||
QDialog.reject(self)
|
||||
|
||||
def onClose(self):
|
||||
if (self.editor.fieldsAreBlank() or
|
||||
ui.utils.askUser(_("Close and lose current input?"),
|
||||
self)):
|
||||
ui.dialogs.close("AddCards")
|
||||
self.parent.deck.s.flush()
|
||||
self.parent.moveToState("auto")
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
def maybeSave(self):
|
||||
"Increment added count and maybe save deck."
|
||||
self.addedItems += 1
|
||||
if not self.parent.config['saveAfterAdding']:
|
||||
return
|
||||
if (self.addedItems % self.parent.config['saveAfterAddingNum']) == 0:
|
||||
self.parent.saveDeck()
|
647
ankiqt/ui/cardlist.py
Normal file
|
@ -0,0 +1,647 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Copyright: Damien Elmes <anki@ichi2.net>
|
||||
# License: GNU GPL, version 3 or later; http://www.gnu.org/copyleft/gpl.html
|
||||
|
||||
from PyQt4.QtGui import *
|
||||
from PyQt4.QtCore import *
|
||||
import time, types, sys, re
|
||||
from operator import attrgetter
|
||||
import anki, anki.utils, ankiqt.forms
|
||||
from ankiqt import ui
|
||||
from anki.cards import cardsTable, Card
|
||||
from anki.facts import factsTable, fieldsTable, Fact
|
||||
from anki.utils import fmtTimeSpan, parseTags, findTag, addTags, deleteTags, \
|
||||
stripHTML
|
||||
from anki.errors import *
|
||||
from anki.db import *
|
||||
|
||||
# Deck editor
|
||||
##########################################################################
|
||||
|
||||
class DeckModel(QAbstractTableModel):
|
||||
|
||||
def __init__(self, parent, deck):
|
||||
QAbstractTableModel.__init__(self)
|
||||
self.parent = parent
|
||||
self.deck = deck
|
||||
self.filterTag = None
|
||||
self.sortKey = None
|
||||
# column title, display accessor, sort attr
|
||||
self.columns = [("", self.currentQuestion,
|
||||
self.currentQuestion),
|
||||
("", self.currentAnswer,
|
||||
self.currentAnswer),
|
||||
(" "*20, self.nextDue,
|
||||
"nextTime")]
|
||||
self.searchStr = ""
|
||||
self.tag = None
|
||||
self.cards = []
|
||||
self.deleted = {}
|
||||
|
||||
# Model interface
|
||||
######################################################################
|
||||
|
||||
def rowCount(self, index):
|
||||
return len(self.cards)
|
||||
|
||||
def columnCount(self, index):
|
||||
return len(self.columns)
|
||||
|
||||
def data(self, index, role):
|
||||
if not index.isValid():
|
||||
return QVariant()
|
||||
if role == Qt.FontRole and index.column() == 2:
|
||||
f = QFont()
|
||||
f.setPixelSize(12)
|
||||
return QVariant(f)
|
||||
elif role == Qt.DisplayRole or role == Qt.EditRole:
|
||||
#s = self.columns[index.column()][1](self.getCardID(index))
|
||||
s = self.columns[index.column()][1](index)
|
||||
s = s.replace("<br>", u" ")
|
||||
s = s.replace("\n", u" ")
|
||||
s = stripHTML(s)
|
||||
s = re.sub("\[sound:[^]]+\]", "", s)
|
||||
s = s.strip()
|
||||
return QVariant(s)
|
||||
elif role == Qt.SizeHintRole:
|
||||
if index.column() == 2:
|
||||
return QVariant(20)
|
||||
else:
|
||||
return QVariant()
|
||||
|
||||
def headerData(self, section, orientation, role):
|
||||
if orientation == Qt.Vertical:
|
||||
return QVariant()
|
||||
elif role == Qt.DisplayRole:
|
||||
return QVariant(self.columns[section][0])
|
||||
else:
|
||||
return QVariant()
|
||||
|
||||
def flags(self, index):
|
||||
return Qt.ItemFlag(Qt.ItemIsEnabled |
|
||||
Qt.ItemIsSelectable)
|
||||
|
||||
# Filtering
|
||||
######################################################################
|
||||
|
||||
def showMatching(self):
|
||||
if not self.sortKey:
|
||||
self.cards = []
|
||||
return
|
||||
# show current card or last?
|
||||
card = None
|
||||
if self.searchStr == u"<current>" and self.parent.currentCard:
|
||||
card = self.parent.currentCard
|
||||
elif self.searchStr == u"<last>" and self.parent.lastCard:
|
||||
card = self.parent.lastCard
|
||||
if card:
|
||||
self.cards = [[card.id, card.priority, card.question,
|
||||
card.answer, card.due, card.reps, card.factId]]
|
||||
self.reset()
|
||||
return
|
||||
# searching
|
||||
searchLimit = ""
|
||||
if self.searchStr:
|
||||
searchLimit = "cards.factId in (%s)" % (
|
||||
",".join([str(x) for x in self.deck.s.column0(
|
||||
"select factId from fields where value like :val",
|
||||
val="%" + self.searchStr + "%")]))
|
||||
# tags
|
||||
tagLimit = ""
|
||||
if self.tag:
|
||||
tagLimit = "cards.id in (%s)" % (
|
||||
",".join([str(id) for (id, tags, pri) in self.deck.tagsList()
|
||||
if findTag(self.tag, parseTags(tags))]))
|
||||
# sorting
|
||||
sort = ""
|
||||
ads = []
|
||||
if searchLimit: ads.append(searchLimit)
|
||||
if tagLimit: ads.append(tagLimit)
|
||||
if not self.parent.config['showSuspendedCards']:
|
||||
ads.append("cards.priority != 0")
|
||||
ads = " and ".join(ads)
|
||||
if isinstance(self.sortKey, types.StringType):
|
||||
# card property
|
||||
if self.sortKey == "ease":
|
||||
sort = ("order by cards.reps = 0, "
|
||||
"cards.noCount / (cards.reps + 0.001) desc, "
|
||||
"cards.reps")
|
||||
else:
|
||||
sort = "order by cards." + self.sortKey
|
||||
if self.sortKey in ("question", "answer"):
|
||||
sort += " collate nocase"
|
||||
query = ("select id, priority, question, answer, due, "
|
||||
"reps, factId from cards ")
|
||||
if ads:
|
||||
query += "where %s " % ads
|
||||
query += sort
|
||||
else:
|
||||
# field value
|
||||
ret = self.deck.s.all(
|
||||
"select id, numeric from fieldModels where name = :name",
|
||||
name=self.sortKey[1])
|
||||
fields = ",".join([str(x[0]) for x in ret])
|
||||
# if multiple models have the same field, use the first numeric bool
|
||||
numeric = ret[0][1]
|
||||
if numeric:
|
||||
order = "cast(fields.value as real)"
|
||||
else:
|
||||
order = "fields.value collate nocase"
|
||||
if ads:
|
||||
ads = " and " + ads
|
||||
query = ("select cards.id, cards.priority, cards.question, "
|
||||
"cards.answer, cards.due, cards.reps, cards.factId "
|
||||
"from fields, cards where fields.fieldModelId in (%s) "
|
||||
"and fields.factId = cards.factId" + ads +
|
||||
" order by cards.ordinal, %s") % (fields, order)
|
||||
# run the query
|
||||
self.cards = self.deck.s.all(query)
|
||||
self.reset()
|
||||
|
||||
# Tools
|
||||
######################################################################
|
||||
|
||||
def getCardID(self, index):
|
||||
return self.cards[index.row()][0]
|
||||
|
||||
def getCard(self, index):
|
||||
return self.deck.s.query(Card).get(self.getCardID(index))
|
||||
|
||||
def isDeleted(self, id):
|
||||
return id in self.deleted
|
||||
|
||||
def cardIndex(self, card):
|
||||
"Return the index of CARD, if currently displayed."
|
||||
return self.cards.index(card)
|
||||
|
||||
def currentQuestion(self, index):
|
||||
return self.cards[index.row()][2]
|
||||
|
||||
def currentAnswer(self, index):
|
||||
return self.cards[index.row()][3]
|
||||
|
||||
def nextDue(self, index):
|
||||
d = self.cards[index.row()][4]
|
||||
reps = self.cards[index.row()][5]
|
||||
secs = d - time.time()
|
||||
if secs <= 0:
|
||||
if not reps:
|
||||
return _("(new card)")
|
||||
else:
|
||||
return _("%s ago") % fmtTimeSpan(abs(secs), pad=0)
|
||||
else:
|
||||
return _("in %s") % fmtTimeSpan(secs, pad=0)
|
||||
|
||||
class StatusDelegate(QItemDelegate):
|
||||
|
||||
def __init__(self, parent, model):
|
||||
QItemDelegate.__init__(self, parent)
|
||||
self.model = model
|
||||
|
||||
def paint(self, painter, option, index):
|
||||
row = self.model.cards[index.row()]
|
||||
standard = True
|
||||
# tagged
|
||||
if row[1] == 0:
|
||||
brush = QBrush(QColor("#ffffaa"))
|
||||
standard = False
|
||||
if self.model.isDeleted(row[0]):
|
||||
brush = QBrush(QColor("#ffaaaa"))
|
||||
standard = False
|
||||
if standard:
|
||||
QItemDelegate.paint(self, painter, option, index)
|
||||
return
|
||||
# custom render
|
||||
painter.save()
|
||||
painter.fillRect(option.rect, brush)
|
||||
data = self.model.data(index, Qt.DisplayRole)
|
||||
self.drawDisplay(painter, option, option.rect, data.toString())
|
||||
painter.restore()
|
||||
|
||||
class EditDeck(QDialog):
|
||||
|
||||
def __init__(self, parent):
|
||||
QDialog.__init__(self, parent, Qt.Window)
|
||||
self.parent = parent
|
||||
self.deck = self.parent.deck
|
||||
self.config = parent.config
|
||||
self.origModTime = parent.deck.modified
|
||||
self.dialog = ankiqt.forms.cardlist.Ui_EditDeck()
|
||||
self.dialog.setupUi(self)
|
||||
# flush all changes before we load
|
||||
self.deck.s.flush()
|
||||
self.model = DeckModel(self.parent, self.parent.deck)
|
||||
self.dialog.tableView.setSortingEnabled(False)
|
||||
self.dialog.tableView.setModel(self.model)
|
||||
self.dialog.tableView.setItemDelegate(StatusDelegate(self, self.model))
|
||||
self.dialog.tableView.selectionModel()
|
||||
self.dialog.tableView.setFont(QFont(
|
||||
self.config['editFontFamily'],
|
||||
self.config['editFontSize']))
|
||||
self.dialog.tableView.update()
|
||||
self.setupButtons()
|
||||
self.setupFilter()
|
||||
self.setupSort()
|
||||
self.setupHeaders()
|
||||
self.setupEditor()
|
||||
self.setupCardInfo()
|
||||
self.dialog.filterEdit.setFocus()
|
||||
ui.dialogs.open("CardList", self)
|
||||
self.drawTags()
|
||||
self.updateFilterLabel()
|
||||
self.show()
|
||||
self.selectLastCard()
|
||||
|
||||
def findCardInDeckModel( self, model, card ):
|
||||
for i, thisCard in enumerate( model.cards ):
|
||||
if thisCard.id == card.id:
|
||||
return i
|
||||
return -1
|
||||
|
||||
def selectLastCard(self):
|
||||
"Show the row corresponding to the current card."
|
||||
if self.parent.config['editCurrentOnly']:
|
||||
if self.parent.currentCard:
|
||||
self.dialog.filterEdit.setText("<current>")
|
||||
self.dialog.filterEdit.selectAll()
|
||||
self.updateSearch()
|
||||
if not self.parent.config['editCurrentOnly']:
|
||||
if self.parent.currentCard:
|
||||
currentCardIndex = self.findCardInDeckModel(
|
||||
self.model, self.parent.currentCard )
|
||||
if currentCardIndex >= 0:
|
||||
self.dialog.tableView.selectRow( currentCardIndex )
|
||||
self.dialog.tableView.scrollTo(
|
||||
self.model.index(currentCardIndex,0),
|
||||
self.dialog.tableView.PositionAtTop )
|
||||
|
||||
|
||||
def setupFilter(self):
|
||||
self.filterTimer = None
|
||||
self.currentTag = None
|
||||
self.connect(self.dialog.filterEdit,
|
||||
SIGNAL("textChanged(QString)"),
|
||||
self.filterTextChanged)
|
||||
self.connect(self.dialog.filterEdit,
|
||||
SIGNAL("returnPressed()"),
|
||||
self.showFilterNow)
|
||||
self.setTabOrder(self.dialog.filterEdit, self.dialog.tableView)
|
||||
self.connect(self.dialog.tagList, SIGNAL("activated(int)"),
|
||||
self.tagChanged)
|
||||
|
||||
def setupSort(self):
|
||||
self.sortIndex = 0
|
||||
self.drawSort()
|
||||
self.connect(self.dialog.sortBox, SIGNAL("activated(int)"),
|
||||
self.sortChanged)
|
||||
self.sortChanged(self.sortIndex, refresh=False)
|
||||
|
||||
def drawTags(self):
|
||||
tags = self.deck.allTags()
|
||||
self.alltags = tags
|
||||
self.alltags.sort()
|
||||
self.dialog.tagList.clear()
|
||||
self.dialog.tagList.addItems(QStringList(
|
||||
[_('All tags')] + self.alltags))
|
||||
if self.currentTag:
|
||||
try:
|
||||
idx = self.alltags.index(self.currentTag) + 1
|
||||
except ValueError:
|
||||
idx = 0
|
||||
self.dialog.tagList.setCurrentIndex(idx)
|
||||
|
||||
def drawSort(self):
|
||||
self.sortList = [
|
||||
_("Question"),
|
||||
_("Answer"),
|
||||
_("Creation date"),
|
||||
_("Modified date"),
|
||||
_("Due date"),
|
||||
_("Interval"),
|
||||
_("Answer count"),
|
||||
_("Difficulty"),
|
||||
]
|
||||
self.sortFields = sorted(self.deck.allFields())
|
||||
self.sortList.extend([_("Field '%s'") % f for f in self.sortFields])
|
||||
self.dialog.sortBox.clear()
|
||||
self.dialog.sortBox.addItems(QStringList(self.sortList))
|
||||
self.dialog.sortBox.setCurrentIndex(self.sortIndex)
|
||||
|
||||
def sortChanged(self, idx, refresh=True):
|
||||
if idx == 0:
|
||||
self.sortKey = "question"
|
||||
elif idx == 1:
|
||||
self.sortKey = "answer"
|
||||
elif idx == 2:
|
||||
self.sortKey = "created"
|
||||
elif idx == 3:
|
||||
self.sortKey = "modified"
|
||||
elif idx == 4:
|
||||
self.sortKey = "due"
|
||||
elif idx == 5:
|
||||
self.sortKey = "interval"
|
||||
elif idx == 6:
|
||||
self.sortKey = "reps"
|
||||
elif idx == 7:
|
||||
self.sortKey = "ease"
|
||||
else:
|
||||
self.sortKey = ("field", self.sortFields[idx-8])
|
||||
self.sortIndex = idx
|
||||
self.model.sortKey = self.sortKey
|
||||
if refresh:
|
||||
self.model.showMatching()
|
||||
self.updateFilterLabel()
|
||||
|
||||
def tagChanged(self, idx):
|
||||
if idx == 0:
|
||||
self.currentTag = None
|
||||
else:
|
||||
self.currentTag = self.alltags[idx-1]
|
||||
if unicode(self.dialog.filterEdit.text()) in (
|
||||
u"<current>", u"<last>"):
|
||||
self.dialog.filterEdit.blockSignals(True)
|
||||
self.dialog.filterEdit.setText("")
|
||||
self.dialog.filterEdit.blockSignals(False)
|
||||
self.updateSearch()
|
||||
|
||||
def updateFilterLabel(self):
|
||||
self.setWindowTitle(_("Anki - Edit Deck (%(cur)d "
|
||||
"of %(tot)d cards shown)") %
|
||||
{"cur": len(self.model.cards),
|
||||
"tot": self.deck.cardCount()})
|
||||
|
||||
def filterTextChanged(self):
|
||||
interval = 500
|
||||
if self.filterTimer:
|
||||
self.filterTimer.setInterval(interval)
|
||||
else:
|
||||
self.filterTimer = QTimer(self)
|
||||
self.filterTimer.setSingleShot(True)
|
||||
self.filterTimer.start(interval)
|
||||
self.connect(self.filterTimer, SIGNAL("timeout()"), self.updateSearch)
|
||||
|
||||
def showFilterNow(self):
|
||||
if self.filterTimer:
|
||||
self.filterTimer.stop()
|
||||
self.updateSearch()
|
||||
|
||||
def updateSearch(self):
|
||||
self.model.searchStr = unicode(self.dialog.filterEdit.text())
|
||||
self.model.tag = self.currentTag
|
||||
self.model.showMatching()
|
||||
self.updateFilterLabel()
|
||||
self.filterTimer = None
|
||||
if self.model.cards:
|
||||
self.dialog.cardInfoGroup.show()
|
||||
self.dialog.fieldsArea.show()
|
||||
self.dialog.tableView.selectionModel().setCurrentIndex(
|
||||
self.model.index(0, 0),
|
||||
QItemSelectionModel.Select | QItemSelectionModel.Rows)
|
||||
else:
|
||||
self.dialog.cardInfoGroup.hide()
|
||||
self.dialog.fieldsArea.hide()
|
||||
|
||||
def setupHeaders(self):
|
||||
self.dialog.tableView.verticalHeader().hide()
|
||||
self.dialog.tableView.horizontalHeader().hide()
|
||||
for i in range(2):
|
||||
self.dialog.tableView.horizontalHeader().setResizeMode(i, QHeaderView.Stretch)
|
||||
self.dialog.tableView.horizontalHeader().setResizeMode(2, QHeaderView.ResizeToContents)
|
||||
|
||||
def setupButtons(self):
|
||||
# buttons
|
||||
self.connect(self.dialog.factsButton,
|
||||
SIGNAL("clicked()"),
|
||||
self.factsMenu)
|
||||
self.connect(self.dialog.cardsButton,
|
||||
SIGNAL("clicked()"),
|
||||
self.cardsMenu)
|
||||
# menus
|
||||
self.connect(self.dialog.action_Delete_card, SIGNAL("triggered()"), self.deleteCards)
|
||||
self.connect(self.dialog.actionAdd_fact_tag, SIGNAL("triggered()"), self.addFactTags)
|
||||
self.connect(self.dialog.actionAdd_card_tag, SIGNAL("triggered()"), self.addCardTags)
|
||||
self.connect(self.dialog.actionDelete_fact_tag, SIGNAL("triggered()"), self.deleteFactTags)
|
||||
self.connect(self.dialog.actionDelete_card_tag, SIGNAL("triggered()"), self.deleteCardTags)
|
||||
self.connect(self.dialog.actionAdd_Missing_Cards, SIGNAL("triggered()"), self.addMissingCards)
|
||||
self.connect(self.dialog.actionDelete_Fact, SIGNAL("triggered()"), self.deleteFacts)
|
||||
self.connect(self.dialog.actionResetCardProgress, SIGNAL("triggered()"), self.resetCardProgress)
|
||||
self.connect(self.dialog.actionResetFactProgress, SIGNAL("triggered()"), self.resetFactProgress)
|
||||
self.parent.runHook('editor.setupButtons', self)
|
||||
|
||||
def factsMenu(self):
|
||||
menu = QMenu(self)
|
||||
menu.addAction(self.dialog.actionAdd_fact_tag)
|
||||
menu.addAction(self.dialog.actionDelete_fact_tag)
|
||||
menu.addSeparator()
|
||||
menu.addAction(self.dialog.actionAdd_Missing_Cards)
|
||||
menu.addSeparator()
|
||||
menu.addAction(self.dialog.actionResetFactProgress)
|
||||
menu.addAction(self.dialog.actionDelete_Fact)
|
||||
self.parent.runHook('editor.factsMenu', self, menu)
|
||||
menu.exec_(self.dialog.factsButton.mapToGlobal(QPoint(0,0)))
|
||||
|
||||
def cardsMenu(self):
|
||||
menu = QMenu(self)
|
||||
menu.addAction(self.dialog.actionAdd_card_tag)
|
||||
menu.addAction(self.dialog.actionDelete_card_tag)
|
||||
menu.addSeparator()
|
||||
menu.addAction(self.dialog.actionResetCardProgress)
|
||||
menu.addAction(self.dialog.action_Delete_card)
|
||||
self.parent.runHook('editor.cardsMenu', self, menu)
|
||||
menu.exec_(self.dialog.cardsButton.mapToGlobal(QPoint(0,0)))
|
||||
|
||||
def deleteCards(self):
|
||||
cards = self.selectedCards()
|
||||
self.dialog.tableView.selectionModel().blockSignals(True)
|
||||
self.dialog.tableView.selectionModel().clear()
|
||||
self.dialog.tableView.selectionModel().blockSignals(False)
|
||||
for id in cards:
|
||||
if id in self.model.deleted:
|
||||
del self.model.deleted[id]
|
||||
else:
|
||||
self.model.deleted[id] = True
|
||||
self.model.emit(SIGNAL("layoutChanged()"))
|
||||
|
||||
def deleteFacts(self):
|
||||
cardIds = self.selectedFactsAsCards()
|
||||
self.dialog.tableView.selectionModel().blockSignals(True)
|
||||
self.dialog.tableView.selectionModel().clear()
|
||||
self.dialog.tableView.selectionModel().blockSignals(False)
|
||||
for id in cardIds:
|
||||
if id in self.model.deleted:
|
||||
del self.model.deleted[id]
|
||||
else:
|
||||
self.model.deleted[id] = True
|
||||
self.model.emit(SIGNAL("layoutChanged()"))
|
||||
|
||||
def selectedCards(self):
|
||||
return [self.model.cards[idx.row()][0] for idx in
|
||||
self.dialog.tableView.selectionModel().selectedRows()]
|
||||
|
||||
def selectedFacts(self):
|
||||
return self.deck.s.column0("""
|
||||
select distinct factId from cards
|
||||
where id in (%s)""" % ",".join([
|
||||
str(self.model.cards[idx.row()][0]) for idx in
|
||||
self.dialog.tableView.selectionModel().selectedRows()]))
|
||||
|
||||
def selectedFactsAsCards(self):
|
||||
return self.deck.s.column0(
|
||||
"select id from cards where factId in (%s)" %
|
||||
",".join([str(s) for s in self.selectedFacts()]))
|
||||
|
||||
def setupEditor(self):
|
||||
self.editor = ui.facteditor.FactEditor(self,
|
||||
self.dialog.fieldsArea,
|
||||
self.deck)
|
||||
self.editor.onChange = self.textChanged
|
||||
self.editor.onFactValid = self.onFactValid
|
||||
self.editor.onFactInvalid = self.onFactInvalid
|
||||
self.connect(self.dialog.tableView.selectionModel(),
|
||||
SIGNAL("currentRowChanged(QModelIndex, QModelIndex)"),
|
||||
self.rowChanged)
|
||||
|
||||
def onFactValid(self, fact):
|
||||
self.dialog.tableView.setEnabled(True)
|
||||
self.dialog.searchGroup.setEnabled(True)
|
||||
self.dialog.sortGroup.setEnabled(True)
|
||||
|
||||
def onFactInvalid(self, fact):
|
||||
self.dialog.tableView.setEnabled(False)
|
||||
self.dialog.searchGroup.setEnabled(False)
|
||||
self.dialog.sortGroup.setEnabled(False)
|
||||
|
||||
def rowChanged(self, current, previous):
|
||||
self.currentRow = current
|
||||
self.currentCard = self.model.getCard(current)
|
||||
self.deck.s.flush()
|
||||
self.deck.s.refresh(self.currentCard)
|
||||
self.deck.s.refresh(self.currentCard.fact)
|
||||
fact = self.currentCard.fact
|
||||
self.editor.setFact(fact, True)
|
||||
self.showCardInfo(self.currentCard)
|
||||
|
||||
def setupCardInfo(self):
|
||||
self.currentCard = None
|
||||
self.cardInfoGrid = QGridLayout(self.dialog.cardInfoGroup)
|
||||
self.cardInfoGrid.setMargin(6)
|
||||
# card
|
||||
l = QLabel(_("<b>Tags</b>"))
|
||||
self.cardInfoGrid.addWidget(l, 0, 0)
|
||||
self.cardStaticTags = QLabel()
|
||||
self.cardStaticTags.setWordWrap(True)
|
||||
self.cardInfoGrid.addWidget(self.cardStaticTags, 1, 0)
|
||||
l = QLabel(_("<b>Card-specific tags</b>"))
|
||||
self.cardInfoGrid.addWidget(l, 2, 0)
|
||||
self.cardTags = QLineEdit()
|
||||
self.connect(self.cardTags, SIGNAL("textChanged(QString)"), self.saveCardInfo)
|
||||
self.cardInfoGrid.addWidget(self.cardTags, 3, 0)
|
||||
l = QLabel(_("<b>Statistics</b>"))
|
||||
self.cardInfoGrid.addWidget(l, 4, 0)
|
||||
self.cardStats = QLabel()
|
||||
self.cardInfoGrid.addWidget(self.cardStats, 5, 0)
|
||||
item = QSpacerItem(20, 20, QSizePolicy.Expanding,
|
||||
QSizePolicy.Expanding)
|
||||
self.cardInfoGrid.addItem(item, 6, 0)
|
||||
|
||||
def updateStaticTags(self):
|
||||
card = self.currentCard
|
||||
self.cardStaticTags.setText(
|
||||
", ".join(parseTags(
|
||||
card.fact.model.tags + "," +
|
||||
card.cardModel.name + "," +
|
||||
card.fact.tags)))
|
||||
|
||||
def showCardInfo(self, card):
|
||||
self.cardTags.setText(card.tags)
|
||||
self.updateStaticTags()
|
||||
# stats
|
||||
next = time.time() - card.due
|
||||
if next > 0:
|
||||
next = "%s ago" % anki.utils.fmtTimeSpan(next)
|
||||
else:
|
||||
next = "in %s" % anki.utils.fmtTimeSpan(abs(next))
|
||||
self.cardStats.setText(
|
||||
_("Created: %(c)s ago<br>"
|
||||
"Next due: %(n)s<br>"
|
||||
"Interval: %(i)0.0f days<br>"
|
||||
"Average: %(a)s<br>"
|
||||
"Total: %(t)s<br>"
|
||||
"Reviews: %(cor)d/%(tot)d<br>"
|
||||
"Successive: %(suc)d")% {
|
||||
"c": fmtTimeSpan(time.time() - card.created),
|
||||
"n": next,
|
||||
"i": card.interval,
|
||||
"a": fmtTimeSpan(card.averageTime),
|
||||
"t": fmtTimeSpan(card.reviewTime),
|
||||
"cor": card.yesCount,
|
||||
"tot": card.reps,
|
||||
"suc": card.successive,
|
||||
})
|
||||
|
||||
def saveCardInfo(self, text):
|
||||
if self.currentCard:
|
||||
tags = unicode(text)
|
||||
if self.currentCard.tags != tags:
|
||||
self.currentCard.tags = tags
|
||||
self.currentCard.setModified()
|
||||
self.deck.setModified()
|
||||
|
||||
def textChanged(self, field):
|
||||
self.updateStaticTags()
|
||||
self.model.emit(SIGNAL("layoutChanged()"))
|
||||
self.deck.setModified()
|
||||
|
||||
def addFactTags(self):
|
||||
tags = ui.utils.getText(_("Enter tag(s) to add to each fact:"), self)
|
||||
if tags: self.deck.addFactTags(self.selectedFacts(), tags)
|
||||
self.updateAfterCardChange()
|
||||
|
||||
def addCardTags(self):
|
||||
tags = ui.utils.getText(_("Enter tag(s) to add to each card:"), self)
|
||||
if tags: self.deck.addCardTags(self.selectedCards(), tags)
|
||||
self.updateAfterCardChange()
|
||||
|
||||
def deleteFactTags(self):
|
||||
tags = ui.utils.getText(_("Enter tag(s) to delete from each fact:"), self)
|
||||
if tags: self.deck.deleteFactTags(self.selectedFacts(), tags)
|
||||
self.updateAfterCardChange()
|
||||
|
||||
def deleteCardTags(self):
|
||||
tags = ui.utils.getText(_("Enter tag(s) to delete from each card:"), self)
|
||||
if tags: self.deck.deleteCardTags(self.selectedCards(), tags)
|
||||
self.updateAfterCardChange()
|
||||
|
||||
def updateAfterCardChange(self, reset=False):
|
||||
"Refresh info like stats on current card"
|
||||
self.rowChanged(self.currentRow, None)
|
||||
if reset:
|
||||
self.updateSearch()
|
||||
|
||||
def addMissingCards(self):
|
||||
for id in self.selectedFacts():
|
||||
self.deck.addMissingCards(self.deck.s.query(Fact).get(id))
|
||||
self.updateSearch()
|
||||
|
||||
def resetCardProgress(self):
|
||||
self.deck.resetCards(self.selectedCards())
|
||||
self.updateAfterCardChange(reset=True)
|
||||
|
||||
def resetFactProgress(self):
|
||||
self.deck.resetCards(self.selectedFactsAsCards())
|
||||
self.updateAfterCardChange(reset=True)
|
||||
|
||||
def accept(self):
|
||||
self.hide()
|
||||
self.deck.deleteCards(self.model.deleted.keys())
|
||||
if len(self.model.deleted):
|
||||
self.parent.setStatus(
|
||||
_("%(del)d deleted.") %
|
||||
{"del": len(self.model.deleted)})
|
||||
if self.origModTime != self.deck.modified:
|
||||
self.parent.reset()
|
||||
ui.dialogs.close("CardList")
|
||||
QDialog.accept(self)
|
||||
|
||||
def reject(self):
|
||||
self.accept()
|
188
ankiqt/ui/deckproperties.py
Normal file
|
@ -0,0 +1,188 @@
|
|||
# Copyright: Damien Elmes <anki@ichi2.net>
|
||||
# License: GNU GPL, version 3 or later; http://www.gnu.org/copyleft/gpl.html
|
||||
|
||||
from PyQt4.QtGui import *
|
||||
from PyQt4.QtCore import *
|
||||
import sys, re
|
||||
import ankiqt.forms
|
||||
import anki
|
||||
from ankiqt import ui
|
||||
from anki.utils import parseTags
|
||||
from anki.deck import newCardOrderLabels, newCardSchedulingLabels
|
||||
|
||||
class DeckProperties(QDialog):
|
||||
|
||||
def __init__(self, parent):
|
||||
QDialog.__init__(self, parent, Qt.Window)
|
||||
self.parent = parent
|
||||
self.d = parent.deck
|
||||
self.origMod = self.d.modified
|
||||
self.dialog = ankiqt.forms.deckproperties.Ui_DeckProperties()
|
||||
self.dialog.setupUi(self)
|
||||
self.resize(100, 100)
|
||||
self.dialog.newCardOrder.insertItems(
|
||||
0, QStringList(newCardOrderLabels().values()))
|
||||
self.dialog.newCardScheduling.insertItems(
|
||||
0, QStringList(newCardSchedulingLabels().values()))
|
||||
self.readData()
|
||||
self.connect(self.dialog.modelsAdd, SIGNAL("clicked()"), self.onAdd)
|
||||
self.connect(self.dialog.modelsEdit, SIGNAL("clicked()"), self.onEdit)
|
||||
self.connect(self.dialog.modelsDelete, SIGNAL("clicked()"), self.onDelete)
|
||||
self.show()
|
||||
|
||||
def readData(self):
|
||||
# description
|
||||
self.dialog.deckDescription.setText(self.d.description)
|
||||
# syncing
|
||||
sn = self.d.syncName
|
||||
if sn:
|
||||
self.dialog.doSync.setCheckState(Qt.Checked)
|
||||
self.dialog.syncName.setText(sn)
|
||||
else:
|
||||
self.dialog.doSync.setCheckState(Qt.Unchecked)
|
||||
self.dialog.syncName.setText(self.d.name())
|
||||
# priorities
|
||||
self.dialog.highPriority.setText(self.d.highPriority)
|
||||
self.dialog.medPriority.setText(self.d.medPriority)
|
||||
self.dialog.lowPriority.setText(self.d.lowPriority)
|
||||
self.dialog.postponing.setText(self.d.suspended)
|
||||
# scheduling
|
||||
for type in ("hard", "mid", "easy"):
|
||||
v = getattr(self.d, type + "IntervalMin")
|
||||
getattr(self.dialog, type + "Min").setText("%0.3f" % v)
|
||||
v = getattr(self.d, type + "IntervalMax")
|
||||
getattr(self.dialog, type + "Max").setText("%0.3f" % v)
|
||||
self.dialog.delay0.setText(unicode(self.d.delay0/60.0))
|
||||
self.dialog.delay1.setText(unicode(self.d.delay1/60.0))
|
||||
self.dialog.delay2.setText(unicode(self.d.delay2/60.0))
|
||||
self.dialog.collapse.setCheckState(self.d.collapseTime
|
||||
and Qt.Checked or Qt.Unchecked)
|
||||
self.dialog.failedCardMax.setText(unicode(self.d.failedCardMax))
|
||||
self.dialog.newCardsPerDay.setText(unicode(self.d.newCardsPerDay))
|
||||
self.dialog.newCardOrder.setCurrentIndex(self.d.newCardOrder)
|
||||
self.dialog.newCardScheduling.setCurrentIndex(self.d.newCardSpacing)
|
||||
# models
|
||||
self.updateModelsList()
|
||||
|
||||
def updateModelsList(self):
|
||||
self.dialog.modelsList.clear()
|
||||
self.models = []
|
||||
for model in self.d.models:
|
||||
name = _("%(name)s [%(facts)d facts]") % {
|
||||
'name': model.name,
|
||||
'facts': self.d.modelUseCount(model),
|
||||
}
|
||||
self.models.append((name, model))
|
||||
self.models.sort()
|
||||
for (name, model) in self.models:
|
||||
item = QListWidgetItem(name)
|
||||
self.dialog.modelsList.addItem(item)
|
||||
if model == self.d.currentModel:
|
||||
self.dialog.modelsList.setCurrentItem(item)
|
||||
|
||||
def onAdd(self):
|
||||
m = ui.modelchooser.AddModel(self, self.parent).getModel()
|
||||
if m:
|
||||
self.d.addModel(m)
|
||||
self.updateModelsList()
|
||||
|
||||
def onEdit(self):
|
||||
model = self.selectedModel()
|
||||
if not model:
|
||||
return
|
||||
ui.modelproperties.ModelProperties(self, model, self.parent)
|
||||
self.updateModelsList()
|
||||
|
||||
def onDelete(self):
|
||||
model = self.selectedModel()
|
||||
row = self.dialog.modelsList.currentRow()
|
||||
if not model:
|
||||
return
|
||||
if len(self.d.models) < 2:
|
||||
ui.utils.showWarning(_("Please add another model first."),
|
||||
parent=self)
|
||||
return
|
||||
count = self.d.modelUseCount(model)
|
||||
if count:
|
||||
if not ui.utils.askUser(
|
||||
_("This model is used by %d facts.\n"
|
||||
"Are you sure you want to delete it?\n"
|
||||
"If you delete it, these cards will be lost.")
|
||||
% count, parent=self):
|
||||
return
|
||||
self.d.deleteModel(model)
|
||||
self.updateModelsList()
|
||||
self.dialog.modelsList.setCurrentRow(row)
|
||||
|
||||
def selectedModel(self):
|
||||
row = self.dialog.modelsList.currentRow()
|
||||
if row == -1:
|
||||
return None
|
||||
return self.models[self.dialog.modelsList.currentRow()][1]
|
||||
|
||||
def updateField(self, obj, field, value):
|
||||
if getattr(obj, field) != value:
|
||||
setattr(obj, field, value)
|
||||
self.d.setModified()
|
||||
|
||||
def reject(self):
|
||||
# description
|
||||
self.updateField(self.d, 'description',
|
||||
unicode(self.dialog.deckDescription.toPlainText()))
|
||||
# syncing
|
||||
if self.dialog.doSync.checkState() == Qt.Checked:
|
||||
self.updateField(self.d, 'syncName',
|
||||
unicode(self.dialog.syncName.text()))
|
||||
else:
|
||||
self.updateField(self.d, 'syncName', None)
|
||||
# scheduling
|
||||
minmax = ("Min", "Max")
|
||||
for type in ("hard", "mid", "easy"):
|
||||
v = getattr(self.dialog, type + "Min").text()
|
||||
try:
|
||||
v = float(v)
|
||||
except ValueError:
|
||||
continue
|
||||
self.updateField(self.d, type + "IntervalMin", v)
|
||||
v = getattr(self.dialog, type + "Max").text()
|
||||
try:
|
||||
v = float(v)
|
||||
except ValueError:
|
||||
continue
|
||||
self.updateField(self.d, type + "IntervalMax", v)
|
||||
try:
|
||||
v = float(self.dialog.delay0.text()) * 60.0
|
||||
self.updateField(self.d, 'delay0', v)
|
||||
v = float(self.dialog.delay1.text()) * 60.0
|
||||
self.updateField(self.d, 'delay1', v)
|
||||
v = float(self.dialog.delay2.text()) * 60.0
|
||||
self.updateField(self.d, 'delay2', v)
|
||||
v = int(self.dialog.failedCardMax.text())
|
||||
self.updateField(self.d, 'failedCardMax', v)
|
||||
v = int(self.dialog.newCardsPerDay.text())
|
||||
self.updateField(self.d, 'newCardsPerDay', v)
|
||||
except ValueError:
|
||||
pass
|
||||
self.updateField(self.d, 'collapseTime',
|
||||
self.dialog.collapse.isChecked() and 1 or 0)
|
||||
self.updateField(self.d,
|
||||
"highPriority",
|
||||
unicode(self.dialog.highPriority.text()))
|
||||
self.updateField(self.d,
|
||||
"medPriority",
|
||||
unicode(self.dialog.medPriority.text()))
|
||||
self.updateField(self.d,
|
||||
"lowPriority",
|
||||
unicode(self.dialog.lowPriority.text()))
|
||||
self.updateField(self.d,
|
||||
"suspended",
|
||||
unicode(self.dialog.postponing.text()))
|
||||
# new card order
|
||||
self.updateField(self.d, "newCardOrder",
|
||||
self.dialog.newCardOrder.currentIndex())
|
||||
self.updateField(self.d, "newCardSpacing",
|
||||
self.dialog.newCardScheduling.currentIndex())
|
||||
# mark deck dirty and close
|
||||
if self.origMod != self.d.modified:
|
||||
self.parent.reset()
|
||||
QDialog.reject(self)
|
287
ankiqt/ui/displayproperties.py
Normal file
|
@ -0,0 +1,287 @@
|
|||
# Copyright: Damien Elmes <anki@ichi2.net>
|
||||
# License: GNU GPL, version 3 or later; http://www.gnu.org/copyleft/gpl.html
|
||||
|
||||
from PyQt4.QtGui import *
|
||||
from PyQt4.QtCore import *
|
||||
import sys, re
|
||||
import ankiqt.forms
|
||||
import anki
|
||||
from anki.models import *
|
||||
from anki.facts import *
|
||||
from anki.fonts import toCanonicalFont
|
||||
from anki.cards import Card
|
||||
from ankiqt import ui
|
||||
|
||||
class DisplayProperties(QDialog):
|
||||
|
||||
def __init__(self, parent, main=None):
|
||||
QDialog.__init__(self, parent, Qt.Window)
|
||||
if not main:
|
||||
main = parent
|
||||
self.parent = parent
|
||||
self.main = main
|
||||
self.deck = main.deck
|
||||
self.ignoreUpdate = False
|
||||
if sys.platform.startswith("darwin"):
|
||||
# mac widgets don't show colours
|
||||
self.plastiqueStyle = QStyleFactory.create("plastique")
|
||||
self.dialog = ankiqt.forms.displayproperties.Ui_DisplayProperties()
|
||||
self.dialog.setupUi(self)
|
||||
self.model = self.deck.currentModel
|
||||
self.setupChooser()
|
||||
self.setupCards()
|
||||
self.setupFields()
|
||||
self.setupPreview()
|
||||
self.show()
|
||||
ui.dialogs.open("DisplayProperties", self)
|
||||
|
||||
def setupChooser(self):
|
||||
self.modelChooser = ui.modelchooser.ModelChooser(self,
|
||||
self.main,
|
||||
self.main.deck,
|
||||
self.modelChanged,
|
||||
cards=False)
|
||||
self.dialog.modelArea.setLayout(self.modelChooser)
|
||||
|
||||
def modelChanged(self, model):
|
||||
self.model = model
|
||||
self.drawCards()
|
||||
self.drawFields()
|
||||
|
||||
def setupPreview(self):
|
||||
self.connect(self.dialog.preview, SIGNAL("clicked()"),
|
||||
self.previewClicked)
|
||||
if self.main.config['showFontPreview']:
|
||||
self.dialog.preview.setChecked(True)
|
||||
else:
|
||||
self.dialog.preview.setChecked(False)
|
||||
self.previewClicked()
|
||||
|
||||
def previewClicked(self):
|
||||
if self.dialog.preview.isChecked():
|
||||
self.dialog.previewGroup.show()
|
||||
self.setMaximumWidth(16777215)
|
||||
self.setMinimumWidth(790)
|
||||
self.main.config['showFontPreview'] = True
|
||||
else:
|
||||
self.dialog.previewGroup.hide()
|
||||
self.setMinimumWidth(350)
|
||||
self.setMaximumWidth(350)
|
||||
self.main.config['showFontPreview'] = False
|
||||
|
||||
def setupCards(self):
|
||||
self.connect(self.dialog.cardList, SIGNAL("activated(int)"),
|
||||
self.cardChanged)
|
||||
for type in ("question", "answer"):
|
||||
self.connect(self.cwidget("Font", type),
|
||||
SIGNAL("currentFontChanged(QFont)"),
|
||||
self.saveCard)
|
||||
self.connect(self.cwidget("Size", type),
|
||||
SIGNAL("valueChanged(int)"),
|
||||
self.saveCard)
|
||||
w = self.cwidget("Colour", type)
|
||||
if sys.platform.startswith("darwin"):
|
||||
w.setStyle(self.plastiqueStyle)
|
||||
self.connect(w,
|
||||
SIGNAL("clicked()"),
|
||||
lambda w=w, t=type: self.chooseColour(w, t))
|
||||
self.connect(self.cwidget("Align", type),
|
||||
SIGNAL("activated(int)"),
|
||||
self.saveCard)
|
||||
# set the background colour to the current system-wide background colour
|
||||
p = QPalette()
|
||||
p.setColor(QPalette.Base, QColor(self.main.config['backgroundColour']))
|
||||
self.dialog.question.setPalette(p)
|
||||
self.dialog.answer.setPalette(p)
|
||||
self.drawCards()
|
||||
|
||||
def drawCards(self):
|
||||
self.dialog.cardList.clear()
|
||||
self.dialog.cardList.addItems(
|
||||
QStringList([c.name for c in self.model.cardModels]))
|
||||
for t in ("question", "answer"):
|
||||
self.cwidget("Align", t).clear()
|
||||
self.cwidget("Align", t).addItems(
|
||||
QStringList(alignmentLabels().values()))
|
||||
self.cardChanged(0)
|
||||
|
||||
def cardChanged(self, idx):
|
||||
self.card = self.model.cardModels[idx]
|
||||
self.readCard()
|
||||
self.drawQuestionAndAnswer()
|
||||
|
||||
def readCard(self):
|
||||
card = self.card
|
||||
self.card = None
|
||||
for type in ("question", "answer"):
|
||||
self.cwidget("Font", type).setCurrentFont(QFont(
|
||||
getattr(card, type + "FontFamily")))
|
||||
self.cwidget("Size", type).setValue(
|
||||
getattr(card, type + "FontSize"))
|
||||
self.cwidget("Colour", type).setPalette(QPalette(QColor(
|
||||
getattr(card, type + "FontColour"))))
|
||||
self.cwidget("Align", type).setCurrentIndex(
|
||||
getattr(card, type + "Align"))
|
||||
self.card = card
|
||||
|
||||
def saveCard(self):
|
||||
if not self.card:
|
||||
return
|
||||
for type in ("question", "answer"):
|
||||
setattr(self.card, type + "FontFamily", toCanonicalFont(unicode(
|
||||
self.cwidget("Font", type).currentFont().family())))
|
||||
setattr(self.card, type + "FontSize", int(
|
||||
self.cwidget("Size", type).value()))
|
||||
setattr(self.card, type + "Align", int(
|
||||
self.cwidget("Align", type).currentIndex()))
|
||||
w = self.cwidget("Colour", type)
|
||||
c = w.palette().window().color()
|
||||
setattr(self.card, type + "FontColour", unicode(c.name()))
|
||||
self.card.model.setModified()
|
||||
self.deck.setModified()
|
||||
self.drawQuestionAndAnswer()
|
||||
|
||||
def cwidget(self, name, type):
|
||||
"Return a card widget."
|
||||
return getattr(self.dialog, type + name)
|
||||
|
||||
def setupFields(self):
|
||||
self.connect(self.dialog.fieldList, SIGNAL("currentRowChanged(int)"),
|
||||
self.fieldChanged)
|
||||
for type in ("quiz", "edit"):
|
||||
self.connect(self.fwidget("fontFamily", type),
|
||||
SIGNAL("currentFontChanged(QFont)"),
|
||||
self.saveField)
|
||||
self.connect(self.fwidget("fontSize", type),
|
||||
SIGNAL("valueChanged(int)"),
|
||||
self.saveField)
|
||||
self.connect(self.fwidget("useFamily", type),
|
||||
SIGNAL("stateChanged(int)"),
|
||||
self.saveField)
|
||||
self.connect(self.fwidget("useSize", type),
|
||||
SIGNAL("stateChanged(int)"),
|
||||
self.saveField)
|
||||
if type == "quiz":
|
||||
self.connect(self.fwidget("useColour", type),
|
||||
SIGNAL("stateChanged(int)"),
|
||||
self.saveField)
|
||||
w = self.fwidget("fontColour", type)
|
||||
if sys.platform.startswith("darwin"):
|
||||
w.setStyle(self.plastiqueStyle)
|
||||
self.connect(w,
|
||||
SIGNAL("clicked()"),
|
||||
lambda w=w, t=type: self.chooseColour(w, t))
|
||||
self.currentField = None
|
||||
self.drawFields()
|
||||
|
||||
def drawFields(self):
|
||||
self.dialog.fieldList.clear()
|
||||
n = 1
|
||||
self.ignoreUpdate = True
|
||||
for field in self.model.fieldModels:
|
||||
item = QListWidgetItem(
|
||||
_("Field %(num)d: %(name)s") % {
|
||||
'num': n,
|
||||
'name': field.name,
|
||||
})
|
||||
self.dialog.fieldList.addItem(item)
|
||||
n += 1
|
||||
self.dialog.fieldList.setCurrentRow(0)
|
||||
self.fieldChanged(0)
|
||||
self.ignoreUpdate = False
|
||||
|
||||
def fwidget(self, name, type):
|
||||
"Return a field widget."
|
||||
if type == "edit":
|
||||
return getattr(self.dialog, name+"Edit")
|
||||
else:
|
||||
return getattr(self.dialog, name)
|
||||
|
||||
def fieldChanged(self, idx):
|
||||
self.saveField()
|
||||
self.currentField = None
|
||||
field = self.model.fieldModels[idx]
|
||||
for type in ("quiz", "edit"):
|
||||
# family
|
||||
if getattr(field, type + 'FontFamily'):
|
||||
self.fwidget("useFamily", type).setCheckState(Qt.Checked)
|
||||
self.fwidget("fontFamily", type).setCurrentFont(QFont(
|
||||
getattr(field, type + 'FontFamily')))
|
||||
else:
|
||||
self.fwidget("useFamily", type).setCheckState(Qt.Unchecked)
|
||||
self.fwidget("fontFamily", type).hide()
|
||||
# size
|
||||
if getattr(field, type + 'FontSize'):
|
||||
self.fwidget("useSize", type).setCheckState(Qt.Checked)
|
||||
self.fwidget("fontSize", type).setValue(
|
||||
getattr(field, type + 'FontSize'))
|
||||
else:
|
||||
self.fwidget("useSize", type).setCheckState(Qt.Unchecked)
|
||||
self.fwidget("fontSize", type).hide()
|
||||
# colour
|
||||
if type == "quiz":
|
||||
if getattr(field, type + 'FontColour'):
|
||||
self.fwidget("useColour", type).setCheckState(Qt.Checked)
|
||||
self.fwidget("fontColour", type).setPalette(QPalette(QColor(
|
||||
getattr(field, type + 'FontColour'))))
|
||||
else:
|
||||
self.fwidget("useColour", type).setCheckState(Qt.Unchecked)
|
||||
self.fwidget("fontColour", type).hide()
|
||||
self.currentField = field
|
||||
|
||||
def saveField(self, *args):
|
||||
if self.ignoreUpdate:
|
||||
return
|
||||
field = self.currentField
|
||||
if not field:
|
||||
return
|
||||
for type in ("quiz", "edit"):
|
||||
# family
|
||||
if self.fwidget("useFamily", type).isChecked():
|
||||
setattr(field, type + 'FontFamily', toCanonicalFont(unicode(
|
||||
self.fwidget("fontFamily", type).currentFont().family())))
|
||||
else:
|
||||
setattr(field, type + 'FontFamily', None)
|
||||
# size
|
||||
if self.fwidget("useSize", type).isChecked():
|
||||
setattr(field, type + 'FontSize',
|
||||
int(self.fwidget("fontSize", type).value()))
|
||||
else:
|
||||
setattr(field, type + 'FontSize', None)
|
||||
# colour
|
||||
if type == "quiz":
|
||||
if self.fwidget("useColour", type).isChecked():
|
||||
w = self.fwidget("fontColour", type)
|
||||
c = w.palette().window().color()
|
||||
setattr(field, type + 'FontColour', str(c.name()))
|
||||
else:
|
||||
setattr(field, type + 'FontColour', None)
|
||||
field.model.setModified()
|
||||
self.deck.setModified()
|
||||
self.drawQuestionAndAnswer()
|
||||
|
||||
def chooseColour(self, button, type):
|
||||
new = QColorDialog.getColor(button.palette().window().color(), self)
|
||||
if new.isValid():
|
||||
button.setPalette(QPalette(new))
|
||||
self.saveField()
|
||||
self.saveCard()
|
||||
|
||||
def drawQuestionAndAnswer(self):
|
||||
f = self.deck.newFact()
|
||||
f.tags = u""
|
||||
for field in f.fields:
|
||||
f[field.name] = field.name
|
||||
f.model = self.model
|
||||
c = Card(f, self.card)
|
||||
t = "<br><center>" + c.htmlQuestion + "</center>"
|
||||
self.dialog.question.setText(
|
||||
"<style>\n" + c.css() + "</style>\n" + t)
|
||||
t = "<br><center>" + c.htmlAnswer + "</center>"
|
||||
self.dialog.answer.setText(
|
||||
"<style>\n" + c.css() + "</style>\n" + t)
|
||||
self.main.updateViews(self.main.state)
|
||||
|
||||
def reject(self):
|
||||
ui.dialogs.close("DisplayProperties")
|
||||
QDialog.reject(self)
|
63
ankiqt/ui/exporting.py
Normal file
|
@ -0,0 +1,63 @@
|
|||
# Copyright: Damien Elmes <anki@ichi2.net>
|
||||
# License: GNU GPL, version 3 or later; http://www.gnu.org/copyleft/gpl.html
|
||||
|
||||
from PyQt4.QtGui import *
|
||||
from PyQt4.QtCore import *
|
||||
import anki, ankiqt
|
||||
from anki.exporting import exporters
|
||||
from anki.utils import parseTags
|
||||
from ankiqt import ui
|
||||
|
||||
class ExportDialog(QDialog):
|
||||
|
||||
def __init__(self, parent):
|
||||
QDialog.__init__(self, parent)
|
||||
self.parent = parent
|
||||
self.deck = parent.deck
|
||||
self.dialog = ankiqt.forms.exporting.Ui_ExportDialog()
|
||||
self.dialog.setupUi(self)
|
||||
self.exporter = None
|
||||
self.setup()
|
||||
self.exec_()
|
||||
|
||||
def setup(self):
|
||||
self.dialog.format.insertItems(
|
||||
0, QStringList(list(zip(*exporters())[0])))
|
||||
self.connect(self.dialog.format, SIGNAL("activated(int)"),
|
||||
self.exporterChanged)
|
||||
self.exporterChanged(0)
|
||||
# fragile
|
||||
self.tags = ui.tagedit.TagEdit(self)
|
||||
self.tags.setDeck(self.deck)
|
||||
self.dialog.gridlayout.addWidget(self.tags,1,1)
|
||||
self.setTabOrder(self.dialog.format,
|
||||
self.tags)
|
||||
self.setTabOrder(self.tags,
|
||||
self.dialog.includeScheduling)
|
||||
# save button
|
||||
b = QPushButton(_("Export to..."))
|
||||
self.dialog.buttonBox.addButton(b, QDialogButtonBox.AcceptRole)
|
||||
|
||||
def exporterChanged(self, idx):
|
||||
self.exporter = exporters()[idx][1](self.deck)
|
||||
if hasattr(self.exporter, "includeSchedulingInfo"):
|
||||
self.dialog.includeScheduling.show()
|
||||
else:
|
||||
self.dialog.includeScheduling.hide()
|
||||
if hasattr(self.exporter, "includeTags"):
|
||||
self.dialog.includeTags.show()
|
||||
else:
|
||||
self.dialog.includeTags.hide()
|
||||
|
||||
def accept(self):
|
||||
file = ui.utils.getSaveFile(self, _("Choose file to export to"), "export",
|
||||
self.exporter.key, self.exporter.ext)
|
||||
if file:
|
||||
self.exporter.includeSchedulingInfo = (
|
||||
self.dialog.includeScheduling.isChecked())
|
||||
self.exporter.includeTags = (
|
||||
self.dialog.includeTags.isChecked())
|
||||
self.exporter.limitTags = parseTags(unicode(self.tags.text()))
|
||||
self.exporter.exportInto(file)
|
||||
self.parent.setStatus(_("%d exported.") % self.exporter.count)
|
||||
QDialog.accept(self)
|
560
ankiqt/ui/facteditor.py
Normal file
|
@ -0,0 +1,560 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Copyright: Damien Elmes <anki@ichi2.net>
|
||||
# License: GNU GPL, version 3 or later; http://www.gnu.org/copyleft/gpl.html
|
||||
|
||||
from PyQt4.QtGui import *
|
||||
from PyQt4.QtCore import *
|
||||
import re, os, sys
|
||||
from anki.utils import parseTags, stripHTML, tidyHTML
|
||||
import anki.sound
|
||||
from ankiqt import ui
|
||||
|
||||
class FactEditor(object):
|
||||
"""An editor for new/existing facts.
|
||||
|
||||
The fact is updated as it is edited.
|
||||
Extra widgets can be added to 'fieldsGrid' to represent card-specific
|
||||
information, etc."""
|
||||
|
||||
def __init__(self, parent, widget, deck=None):
|
||||
self.widget = widget
|
||||
self.parent = parent
|
||||
self.deck = deck
|
||||
self.fact = None
|
||||
self.fontChanged = False
|
||||
self.setupFields()
|
||||
self.checkTimer = None
|
||||
self.onChange = None
|
||||
self.onFactValid = None
|
||||
self.onFactInvalid = None
|
||||
self.lastFocusedEdit = None
|
||||
|
||||
def setFact(self, fact, noFocus=False, check=False):
|
||||
"Make FACT the current fact."
|
||||
self.fact = fact
|
||||
self.factState = None
|
||||
if self.needToRedraw():
|
||||
self.drawFields(noFocus, check)
|
||||
else:
|
||||
self.updateFields(check)
|
||||
if not noFocus:
|
||||
# update focus to first field
|
||||
self.fields[self.fact.fields[0].name][1].setFocus()
|
||||
self.fontChanged = False
|
||||
|
||||
def setupFields(self):
|
||||
self.fields = {}
|
||||
# top level vbox
|
||||
self.fieldsBox = QVBoxLayout(self.widget)
|
||||
self.fieldsBox.setMargin(5)
|
||||
self.fieldsBox.setSpacing(3)
|
||||
# icons
|
||||
self.iconsBox = QHBoxLayout()
|
||||
self.fieldsBox.addLayout(self.iconsBox)
|
||||
# scrollarea
|
||||
self.fieldsScroll = QScrollArea()
|
||||
self.fieldsScroll.setWidgetResizable(True)
|
||||
self.fieldsScroll.setLineWidth(0)
|
||||
self.fieldsScroll.setFrameStyle(0)
|
||||
self.fieldsScroll.setFocusPolicy(Qt.NoFocus)
|
||||
self.fieldsBox.addWidget(self.fieldsScroll)
|
||||
self.iconsBox.setMargin(0)
|
||||
self.iconsBox.addItem(QSpacerItem(20,20, QSizePolicy.Expanding))
|
||||
# button styles for mac
|
||||
self.plastiqueStyle = QStyleFactory.create("plastique")
|
||||
# bold
|
||||
self.bold = QPushButton()
|
||||
self.bold.setCheckable(True)
|
||||
self.bold.connect(self.bold, SIGNAL("toggled(bool)"), self.toggleBold)
|
||||
self.bold.setIcon(QIcon(":/icons/text_bold.png"))
|
||||
self.bold.setToolTip(_("Bold text (Ctrl+b)"))
|
||||
self.bold.setShortcut(_("Ctrl+b"))
|
||||
self.bold.setFocusPolicy(Qt.NoFocus)
|
||||
self.bold.setEnabled(False)
|
||||
self.iconsBox.addWidget(self.bold)
|
||||
self.bold.setStyle(self.plastiqueStyle)
|
||||
# italic
|
||||
self.italic = QPushButton(self.widget)
|
||||
self.italic.setCheckable(True)
|
||||
self.italic.connect(self.italic, SIGNAL("toggled(bool)"), self.toggleItalic)
|
||||
self.italic.setIcon(QIcon(":/icons/text_italic.png"))
|
||||
self.italic.setToolTip(_("Italic text (Ctrl+i)"))
|
||||
self.italic.setShortcut(_("Ctrl+i"))
|
||||
self.italic.setFocusPolicy(Qt.NoFocus)
|
||||
self.italic.setEnabled(False)
|
||||
self.iconsBox.addWidget(self.italic)
|
||||
self.italic.setStyle(self.plastiqueStyle)
|
||||
# underline
|
||||
self.underline = QPushButton(self.widget)
|
||||
self.underline.setCheckable(True)
|
||||
self.underline.connect(self.underline, SIGNAL("toggled(bool)"), self.toggleUnderline)
|
||||
self.underline.setIcon(QIcon(":/icons/text_under.png"))
|
||||
self.underline.setToolTip(_("Underline text (Ctrl+u)"))
|
||||
self.underline.setShortcut(_("Ctrl+u"))
|
||||
self.underline.setFocusPolicy(Qt.NoFocus)
|
||||
self.underline.setEnabled(False)
|
||||
self.iconsBox.addWidget(self.underline)
|
||||
self.underline.setStyle(self.plastiqueStyle)
|
||||
# foreground color - not working on mac
|
||||
self.foreground = QPushButton()
|
||||
self.foreground.connect(self.foreground, SIGNAL("clicked()"), self.selectForeground)
|
||||
self.foreground.setToolTip(_("Foreground colour (Ctrl+r)"))
|
||||
self.foreground.setShortcut(_("Ctrl+r"))
|
||||
self.foreground.setFocusPolicy(Qt.NoFocus)
|
||||
self.foreground.setEnabled(False)
|
||||
self.foreground.setFixedWidth(30)
|
||||
self.foregroundFrame = QFrame()
|
||||
self.foregroundFrame.setAutoFillBackground(True)
|
||||
hbox = QHBoxLayout()
|
||||
hbox.addWidget(self.foregroundFrame)
|
||||
hbox.setMargin(5)
|
||||
self.foreground.setLayout(hbox)
|
||||
self.iconsBox.addWidget(self.foreground)
|
||||
self.foreground.setStyle(self.plastiqueStyle)
|
||||
# pictures
|
||||
spc = QSpacerItem(10,10)
|
||||
self.iconsBox.addItem(spc)
|
||||
self.addPicture = QPushButton(self.widget)
|
||||
self.addPicture.connect(self.addPicture, SIGNAL("clicked()"), self.onAddPicture)
|
||||
self.addPicture.setFocusPolicy(Qt.NoFocus)
|
||||
self.addPicture.setShortcut(_("Ctrl+p"))
|
||||
self.addPicture.setIcon(QIcon(":/icons/colors.png"))
|
||||
self.addPicture.setEnabled(False)
|
||||
self.addPicture.setToolTip(_("Add a picture (Ctrl+p)"))
|
||||
self.iconsBox.addWidget(self.addPicture)
|
||||
self.addPicture.setStyle(self.plastiqueStyle)
|
||||
# sounds
|
||||
self.addSound = QPushButton(self.widget)
|
||||
self.addSound.connect(self.addSound, SIGNAL("clicked()"), self.onAddSound)
|
||||
self.addSound.setFocusPolicy(Qt.NoFocus)
|
||||
self.addSound.setShortcut(_("Ctrl+s"))
|
||||
self.addSound.setEnabled(False)
|
||||
self.addSound.setIcon(QIcon(":/icons/text-speak.png"))
|
||||
self.addSound.setToolTip(_("Add audio (Ctrl+s)"))
|
||||
self.iconsBox.addWidget(self.addSound)
|
||||
self.addSound.setStyle(self.plastiqueStyle)
|
||||
# latex
|
||||
spc = QSpacerItem(10,10)
|
||||
self.iconsBox.addItem(spc)
|
||||
self.latex = QPushButton(self.widget)
|
||||
self.latex.connect(self.latex, SIGNAL("clicked()"), self.insertLatex)
|
||||
self.latex.setToolTip(_("Latex (Ctrl+l)"))
|
||||
self.latex.setShortcut(_("Ctrl+l"))
|
||||
self.latex.setIcon(QIcon(":/icons/tex.png"))
|
||||
self.latex.setFocusPolicy(Qt.NoFocus)
|
||||
self.latex.setEnabled(False)
|
||||
self.iconsBox.addWidget(self.latex)
|
||||
self.latex.setStyle(self.plastiqueStyle)
|
||||
# latex eqn
|
||||
self.latexEqn = QPushButton(self.widget)
|
||||
self.latexEqn.connect(self.latexEqn, SIGNAL("clicked()"), self.insertLatexEqn)
|
||||
self.latexEqn.setToolTip(_("Latex equation (Ctrl+e)"))
|
||||
self.latexEqn.setShortcut(_("Ctrl+e"))
|
||||
self.latexEqn.setIcon(QIcon(":/icons/math_sqrt.png"))
|
||||
self.latexEqn.setFocusPolicy(Qt.NoFocus)
|
||||
self.latexEqn.setEnabled(False)
|
||||
self.iconsBox.addWidget(self.latexEqn)
|
||||
self.latexEqn.setStyle(self.plastiqueStyle)
|
||||
# latex math env
|
||||
self.latexMathEnv = QPushButton(self.widget)
|
||||
self.latexMathEnv.connect(self.latexMathEnv, SIGNAL("clicked()"),
|
||||
self.insertLatexMathEnv)
|
||||
self.latexMathEnv.setToolTip(_("Latex math environment (Ctrl+m)"))
|
||||
self.latexMathEnv.setShortcut(_("Ctrl+m"))
|
||||
self.latexMathEnv.setIcon(QIcon(":/icons/math_matrix.png"))
|
||||
self.latexMathEnv.setFocusPolicy(Qt.NoFocus)
|
||||
self.latexMathEnv.setEnabled(False)
|
||||
self.iconsBox.addWidget(self.latexMathEnv)
|
||||
self.latexMathEnv.setStyle(self.plastiqueStyle)
|
||||
|
||||
self.fieldsFrame = None
|
||||
self.widget.setLayout(self.fieldsBox)
|
||||
self.updatingFields = False
|
||||
|
||||
def _makeGrid(self):
|
||||
"Rebuild the grid to avoid trigging QT bugs."
|
||||
self.fieldsFrame = QFrame()
|
||||
self.fieldsFrame.setFrameStyle(0)
|
||||
self.fieldsFrame.setLineWidth(0)
|
||||
self.fieldsGrid = QGridLayout(self.fieldsFrame)
|
||||
self.fieldsFrame.setLayout(self.fieldsGrid)
|
||||
self.fieldsGrid.setMargin(0)
|
||||
|
||||
def drawFields(self, noFocus=False, check=False):
|
||||
self.parent.setUpdatesEnabled(False)
|
||||
self._makeGrid()
|
||||
# add entries for each field
|
||||
fields = self.fact.fields
|
||||
self.fields = {}
|
||||
n = 0
|
||||
first = None
|
||||
for field in fields:
|
||||
# label
|
||||
l = QLabel(field.name)
|
||||
self.fieldsGrid.addWidget(l, n, 0)
|
||||
# edit widget
|
||||
w = FactEdit(self)
|
||||
w.setTabChangesFocus(True)
|
||||
w.setAcceptRichText(True)
|
||||
w.setMinimumSize(20, 60)
|
||||
w.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
|
||||
w.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
|
||||
self.fieldsGrid.addWidget(w, n, 1)
|
||||
self.fields[field.name] = (field, w)
|
||||
# catch changes
|
||||
w.connect(w, SIGNAL("textChanged()"),
|
||||
lambda f=field, w=w: self.fieldChanged(f, w))
|
||||
w.connect(w, SIGNAL("currentCharFormatChanged(QTextCharFormat)"),
|
||||
lambda w=w: self.formatChanged(w))
|
||||
n += 1
|
||||
# tags
|
||||
self.fieldsGrid.addWidget(QLabel(_("Tags")), n, 0)
|
||||
self.tags = ui.tagedit.TagEdit(self.parent)
|
||||
self.tags.connect(self.tags, SIGNAL("textChanged(QString)"),
|
||||
self.onTagChange)
|
||||
# update available tags
|
||||
self.tags.setDeck(self.deck)
|
||||
self.fieldsGrid.addWidget(self.tags, n, 1)
|
||||
# status warning
|
||||
n += 1
|
||||
self.warning = QLabel()
|
||||
self.warning.setFixedHeight(20)
|
||||
self.warning.setOpenExternalLinks(True)
|
||||
self.fieldsGrid.addWidget(self.warning, n, 1)
|
||||
# update fields
|
||||
self.updateFields(check)
|
||||
self.parent.setUpdatesEnabled(True)
|
||||
self.fieldsScroll.setWidget(self.fieldsFrame)
|
||||
|
||||
def needToRedraw(self):
|
||||
if len(self.fact.fields) != len(self.fields):
|
||||
return True
|
||||
for field in self.fact.fields:
|
||||
if field.name not in self.fields:
|
||||
return True
|
||||
return self.fontChanged
|
||||
|
||||
def updateFields(self, check=True, font=True):
|
||||
"Update field text (if changed) and font/colours."
|
||||
self.updatingFields = True
|
||||
# text
|
||||
for (name, (field, w)) in self.fields.items():
|
||||
new = self.fact[name]
|
||||
old = tidyHTML(unicode(w.toHtml()))
|
||||
# only update if something has changed, to preserve the cursor
|
||||
if new != old:
|
||||
w.setHtml(new)
|
||||
if font:
|
||||
# apply fonts
|
||||
font = QFont()
|
||||
# family
|
||||
family = (field.fieldModel.editFontFamily or
|
||||
field.fieldModel.quizFontFamily)
|
||||
if family:
|
||||
font.setFamily(family)
|
||||
# size
|
||||
size = (field.fieldModel.editFontSize or
|
||||
field.fieldModel.quizFontSize)
|
||||
if size:
|
||||
font.setPixelSize(size)
|
||||
w.setFont(font)
|
||||
self.tags.blockSignals(True)
|
||||
self.tags.setText(self.fact.tags)
|
||||
self.tags.blockSignals(False)
|
||||
self.updatingFields = False
|
||||
if check:
|
||||
self.checkValid()
|
||||
|
||||
def fieldChanged(self, field, widget):
|
||||
if self.updatingFields:
|
||||
return
|
||||
value = tidyHTML(unicode(widget.toHtml()))
|
||||
if value and not value.strip():
|
||||
widget.setText("")
|
||||
value = u""
|
||||
self.fact[field.name] = value
|
||||
self.fact.setModified(textChanged=True)
|
||||
self.deck.setModified()
|
||||
self.fact.onKeyPress(field, value)
|
||||
# the keypress handler may have changed something, so update all
|
||||
self.updateFields(font=False)
|
||||
if self.onChange:
|
||||
self.onChange(field)
|
||||
self.scheduleCheck()
|
||||
self.formatChanged(None)
|
||||
|
||||
def scheduleCheck(self):
|
||||
if not self.deck:
|
||||
return
|
||||
interval = 200
|
||||
if self.checkTimer:
|
||||
self.checkTimer.setInterval(interval)
|
||||
else:
|
||||
self.checkTimer = QTimer(self.parent)
|
||||
self.checkTimer.setSingleShot(True)
|
||||
self.checkTimer.start(interval)
|
||||
self.parent.connect(self.checkTimer, SIGNAL("timeout()"),
|
||||
self.checkValid)
|
||||
|
||||
def checkValid(self):
|
||||
empty = []
|
||||
dupe = []
|
||||
for field in self.fact.fields:
|
||||
p = QPalette()
|
||||
p.setColor(QPalette.Text, QColor("#000000"))
|
||||
if not self.fact.fieldValid(field):
|
||||
empty.append(field)
|
||||
p.setColor(QPalette.Base, QColor("#ffffcc"))
|
||||
self.fields[field.name][1].setPalette(p)
|
||||
elif not self.fact.fieldUnique(field, self.deck.s):
|
||||
dupe.append(field)
|
||||
p.setColor(QPalette.Base, QColor("#ffcccc"))
|
||||
self.fields[field.name][1].setPalette(p)
|
||||
else:
|
||||
p.setColor(QPalette.Base, QColor("#ffffff"))
|
||||
self.fields[field.name][1].setPalette(p)
|
||||
self.checkTimer = None
|
||||
# call relevant hooks
|
||||
invalid = len(empty+dupe)
|
||||
if self.factState != "valid" and not invalid:
|
||||
if self.onFactValid:
|
||||
self.onFactValid(self.fact)
|
||||
self.factState = "valid"
|
||||
elif self.factState != "invalid" and invalid:
|
||||
if self.onFactInvalid:
|
||||
self.onFactInvalid(self.fact)
|
||||
self.factState = "invalid"
|
||||
if invalid:
|
||||
self.warning.setText(_(
|
||||
"Some fields are "
|
||||
"<a href=http://ichi2.net/anki/wiki/Key_Terms_and_Concepts"
|
||||
"#head-6ba367d55922a618ab147debfbac98635d1a4dc2>missing</a>"
|
||||
" or not "
|
||||
"<a href=http://ichi2.net/anki/wiki/Key_Terms_and_Concepts"
|
||||
"#head-0c33560cb828fde1c19af1cd260388457b57812a>unique</a>."))
|
||||
else:
|
||||
self.warning.setText(_("All fields valid"))
|
||||
|
||||
def onTagChange(self, text):
|
||||
if not self.updatingFields:
|
||||
self.fact.tags = unicode(text)
|
||||
if self.onChange:
|
||||
self.onChange(None)
|
||||
|
||||
def focusField(self, fieldName):
|
||||
self.fields[fieldName][1].setFocus()
|
||||
|
||||
def formatChanged(self, fmt):
|
||||
w = self.focusedEdit()
|
||||
if not w or w.textCursor().hasSelection():
|
||||
return
|
||||
else:
|
||||
self.bold.setChecked(w.fontWeight() == QFont.Bold)
|
||||
self.italic.setChecked(w.fontItalic())
|
||||
self.underline.setChecked(w.fontUnderline())
|
||||
self.foregroundFrame.setPalette(QPalette(w.textColor()))
|
||||
|
||||
def resetFormatButtons(self):
|
||||
self.bold.setChecked(False)
|
||||
self.italic.setChecked(False)
|
||||
self.underline.setChecked(False)
|
||||
|
||||
def enableButtons(self, val=True):
|
||||
self.bold.setEnabled(val)
|
||||
self.italic.setEnabled(val)
|
||||
self.underline.setEnabled(val)
|
||||
self.foreground.setEnabled(val)
|
||||
self.addPicture.setEnabled(val)
|
||||
self.addSound.setEnabled(val)
|
||||
self.latex.setEnabled(val)
|
||||
self.latexEqn.setEnabled(val)
|
||||
self.latexMathEnv.setEnabled(val)
|
||||
|
||||
def disableButtons(self):
|
||||
self.enableButtons(False)
|
||||
|
||||
def focusedEdit(self):
|
||||
for (name, (field, w)) in self.fields.items():
|
||||
if w.hasFocus():
|
||||
return w
|
||||
return None
|
||||
|
||||
def toggleBold(self, bool):
|
||||
w = self.focusedEdit()
|
||||
if w:
|
||||
self.fontChanged = True
|
||||
w.setFontWeight(bool and QFont.Bold or QFont.Normal)
|
||||
|
||||
def toggleItalic(self, bool):
|
||||
w = self.focusedEdit()
|
||||
if w:
|
||||
self.fontChanged = True
|
||||
w.setFontItalic(bool)
|
||||
|
||||
def toggleUnderline(self, bool):
|
||||
w = self.focusedEdit()
|
||||
if w:
|
||||
self.fontChanged = True
|
||||
w.setFontUnderline(bool)
|
||||
|
||||
def selectForeground(self):
|
||||
w = self.focusedEdit()
|
||||
if w:
|
||||
# we lose the selection when we open the colour dialog on win32,
|
||||
# so we need to save it
|
||||
cursor = w.textCursor()
|
||||
new = QColorDialog.getColor(w.textColor(), self.parent)
|
||||
if new.isValid():
|
||||
w.setTextCursor(cursor)
|
||||
self.foregroundFrame.setPalette(QPalette(new))
|
||||
w.setTextColor(new)
|
||||
# now we clear the selection
|
||||
cursor.clearSelection()
|
||||
w.setTextCursor(cursor)
|
||||
self.fontChanged = True
|
||||
|
||||
def insertLatex(self):
|
||||
w = self.focusedEdit()
|
||||
if w:
|
||||
self.deck.mediaDir(create=True)
|
||||
w.insertHtml("[latex][/latex]")
|
||||
w.moveCursor(QTextCursor.PreviousWord)
|
||||
w.moveCursor(QTextCursor.PreviousCharacter)
|
||||
w.moveCursor(QTextCursor.PreviousCharacter)
|
||||
|
||||
def insertLatexEqn(self):
|
||||
w = self.focusedEdit()
|
||||
if w:
|
||||
self.deck.mediaDir(create=True)
|
||||
w.insertHtml("[$][/$]")
|
||||
w.moveCursor(QTextCursor.PreviousWord)
|
||||
w.moveCursor(QTextCursor.PreviousCharacter)
|
||||
w.moveCursor(QTextCursor.PreviousCharacter)
|
||||
|
||||
def insertLatexMathEnv(self):
|
||||
w = self.focusedEdit()
|
||||
if w:
|
||||
self.deck.mediaDir(create=True)
|
||||
w.insertHtml("[$$][/$$]")
|
||||
w.moveCursor(QTextCursor.PreviousWord)
|
||||
w.moveCursor(QTextCursor.PreviousCharacter)
|
||||
w.moveCursor(QTextCursor.PreviousCharacter)
|
||||
|
||||
def fieldsAreBlank(self):
|
||||
for (field, widget) in self.fields.values():
|
||||
value = tidyHTML(unicode(widget.toHtml()))
|
||||
if value:
|
||||
return False
|
||||
return True
|
||||
|
||||
def onAddPicture(self):
|
||||
if not self.hasMediaDir():
|
||||
return
|
||||
# get this before we open the dialog
|
||||
w = self.focusedEdit()
|
||||
key = _("Images (*.jpg *.png *.gif *.tiff *.svg *.tif *.jpeg)")
|
||||
file = ui.utils.getFile(self.parent, _("Add an image"), "picture", key)
|
||||
if not file:
|
||||
return
|
||||
path = self.deck.addMedia(file)
|
||||
w.insertHtml('<img src="%s">' % path)
|
||||
|
||||
def onAddSound(self):
|
||||
if not self.hasMediaDir():
|
||||
return
|
||||
# get this before we open the dialog
|
||||
w = self.focusedEdit()
|
||||
key = _("Sounds (*.mp3 *.ogg *.wav)")
|
||||
file = ui.utils.getFile(self.parent, _("Add audio"), "audio", key)
|
||||
if not file:
|
||||
return
|
||||
anki.sound.play(file)
|
||||
path = self.deck.addMedia(file)
|
||||
w.insertHtml('[sound:%s]' % path)
|
||||
|
||||
def hasMediaDir(self):
|
||||
if self.deck.mediaDir(create=True):
|
||||
return True
|
||||
ui.utils.showInfo("Please save your deck first.", self.parent)
|
||||
return False
|
||||
|
||||
class FactEdit(QTextEdit):
|
||||
|
||||
def __init__(self, parent, *args):
|
||||
QTextEdit.__init__(self, *args)
|
||||
self.parent = parent
|
||||
|
||||
def insertFromMimeData(self, source):
|
||||
if source.hasText():
|
||||
self.insertPlainText(source.text())
|
||||
elif source.hasHtml():
|
||||
self.insertHtml(self.simplyHTML(unicode(source.html())))
|
||||
|
||||
def simplifyHTML(self, html):
|
||||
"Remove all style information and P tags."
|
||||
html = re.sub("\n", " ", html)
|
||||
html = re.sub("<br ?/?>", "\n", html)
|
||||
html = re.sub("<p ?/?>", "\n\n", html)
|
||||
html = re.sub('<style type="text/css">.*?</style>', "", html)
|
||||
html = stripHTML(html)
|
||||
html = html.replace("\n", "<br>")
|
||||
html = re.sub("\s\s+", " ", html).strip()
|
||||
return html
|
||||
|
||||
def focusOutEvent(self, evt):
|
||||
QTextEdit.focusOutEvent(self, evt)
|
||||
self.parent.lastFocusedEdit = self
|
||||
self.parent.resetFormatButtons()
|
||||
self.parent.disableButtons()
|
||||
|
||||
# this shouldn't be necessary if/when we move away from kakasi
|
||||
def mouseDoubleClickEvent(self, evt):
|
||||
r = QRegExp("\\{(.*[|,].*)\\}")
|
||||
r.setMinimal(True)
|
||||
|
||||
mouseposition = self.textCursor().position()
|
||||
|
||||
blockoffset = 0
|
||||
result = r.indexIn(self.toPlainText(), 0)
|
||||
|
||||
found = ""
|
||||
|
||||
while result != -1:
|
||||
if mouseposition > result and mouseposition < result + r.matchedLength():
|
||||
mouseposition -= result + 1
|
||||
frompos = 0
|
||||
topos = 0
|
||||
|
||||
string = r.cap(1)
|
||||
offset = 0
|
||||
bits = re.split("[|,]", unicode(string))
|
||||
for index in range(0, len(bits)):
|
||||
offset += len(bits[index]) + 1
|
||||
if mouseposition < offset:
|
||||
found = bits[index]
|
||||
break
|
||||
break
|
||||
|
||||
blockoffset= result + r.matchedLength()
|
||||
result = r.indexIn(self.toPlainText(), blockoffset)
|
||||
|
||||
if found == "":
|
||||
QTextEdit.mouseDoubleClickEvent(self,evt)
|
||||
return
|
||||
self.setPlainText(self.toPlainText().replace(result, r.matchedLength(), found))
|
||||
|
||||
def focusInEvent(self, evt):
|
||||
if (self.parent.lastFocusedEdit and
|
||||
self.parent.lastFocusedEdit is not self):
|
||||
# remove selection from previous widget
|
||||
try:
|
||||
cur = self.parent.lastFocusedEdit.textCursor()
|
||||
cur.clearSelection()
|
||||
self.parent.lastFocusedEdit.setTextCursor(cur)
|
||||
except RuntimeError:
|
||||
# old widget was deleted
|
||||
pass
|
||||
self.lastFocusedEdit = None
|
||||
QTextEdit.focusInEvent(self, evt)
|
||||
self.parent.formatChanged(None)
|
||||
self.parent.enableButtons()
|
213
ankiqt/ui/graphs.py
Normal file
|
@ -0,0 +1,213 @@
|
|||
# Copyright: Damien Elmes <anki@ichi2.net>
|
||||
# License: GNU GPL, version 3 or later; http://www.gnu.org/copyleft/gpl.html
|
||||
|
||||
from PyQt4.QtGui import *
|
||||
from PyQt4.QtCore import *
|
||||
import sys
|
||||
import anki, anki.graphs, anki.utils
|
||||
from ankiqt import ui
|
||||
|
||||
from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas
|
||||
from matplotlib import rc
|
||||
rc('font', **{'sans-serif': 'Arial',
|
||||
'serif': 'Arial',
|
||||
'size': 20.0})
|
||||
rc('legend', fontsize=14.0)
|
||||
|
||||
class AnkiFigureCanvas (FigureCanvas):
|
||||
def __init__(self, fig, parent=None):
|
||||
self.fig = fig
|
||||
FigureCanvas.__init__(self, self.fig)
|
||||
self.setParent(parent)
|
||||
|
||||
self.fig.subplots_adjust(left=0.08, right=0.96, bottom=0.15, top=0.95)
|
||||
|
||||
FigureCanvas.setSizePolicy(self,
|
||||
QSizePolicy.Expanding,
|
||||
QSizePolicy.Expanding)
|
||||
FigureCanvas.updateGeometry(self)
|
||||
|
||||
def sizeHint(self):
|
||||
w, h = self.get_width_height()
|
||||
return QSize(w, h)
|
||||
|
||||
def minimumSizeHint(self):
|
||||
return QSize(10, 10)
|
||||
|
||||
# bug in matplotlib
|
||||
def keyReleaseEvent(self, evt):
|
||||
evt.ignore()
|
||||
|
||||
def keyPressEvent(self, evt):
|
||||
evt.ignore()
|
||||
|
||||
class AdjustableFigure(QWidget):
|
||||
|
||||
def __init__(self, figureFunc, range=None):
|
||||
QWidget.__init__(self)
|
||||
self.vbox = QVBoxLayout()
|
||||
self.vbox.setSpacing(2)
|
||||
self.range = range
|
||||
self.figureFunc = figureFunc
|
||||
self.setLayout(self.vbox)
|
||||
self.updateTimer = None
|
||||
self.hbox = QHBoxLayout()
|
||||
self.hbox.addSpacing(10)
|
||||
self.hbox.addStretch(1)
|
||||
|
||||
def addWidget(self, widget):
|
||||
self.vbox.addWidget(widget)
|
||||
|
||||
def addFigure(self):
|
||||
if self.range is None:
|
||||
self.figureCanvas = AnkiFigureCanvas(self.figureFunc())
|
||||
else:
|
||||
self.figureCanvas = AnkiFigureCanvas(self.figureFunc(self.range))
|
||||
self.addWidget(self.figureCanvas)
|
||||
|
||||
def updateFigure(self):
|
||||
self.updateTimer = None
|
||||
self.setUpdatesEnabled(False)
|
||||
idx = self.vbox.indexOf(self.figureCanvas)
|
||||
self.vbox.removeWidget(self.figureCanvas)
|
||||
self.figureCanvas.deleteLater()
|
||||
self.figureCanvas = AnkiFigureCanvas(self.figureFunc(self.range))
|
||||
self.vbox.insertWidget(idx, self.figureCanvas)
|
||||
self.setUpdatesEnabled(True)
|
||||
|
||||
def addSlider(self, label, choices):
|
||||
self.choices = choices
|
||||
self.labelText = label
|
||||
self.label = QLabel()
|
||||
self.label.setFixedWidth(110)
|
||||
self.updateLabel()
|
||||
self.slider = QScrollBar(Qt.Horizontal)
|
||||
self.slider.setFixedWidth(150)
|
||||
self.slider.setRange(0, len(choices) - 1)
|
||||
self.slider.setValue(choices.index(self.range))
|
||||
self.slider.setFocusPolicy(Qt.TabFocus)
|
||||
self.hbox.addWidget(self.label)
|
||||
self.hbox.addWidget(self.slider)
|
||||
self.connect(self.slider, SIGNAL("valueChanged(int)"),
|
||||
self.sliderChanged)
|
||||
|
||||
def updateLabel(self):
|
||||
self.label.setText("%s: %s" % (self.labelText,
|
||||
anki.utils.fmtTimeSpan(self.range*86400)))
|
||||
|
||||
def sliderChanged(self, index):
|
||||
self.range = self.choices[index]
|
||||
self.updateLabel()
|
||||
self.scheduleUpdate()
|
||||
|
||||
def scheduleUpdate(self):
|
||||
if not self.updateTimer:
|
||||
self.updateTimer = QTimer(self)
|
||||
self.updateTimer.setSingleShot(True)
|
||||
self.updateTimer.start(200)
|
||||
self.connect(self.updateTimer, SIGNAL("timeout()"),
|
||||
self.updateFigure)
|
||||
else:
|
||||
self.updateTimer.setInterval(200)
|
||||
|
||||
def addExplanation(self, text):
|
||||
self.explanation = QLabel(text)
|
||||
self.hbox.insertWidget(1, self.explanation)
|
||||
self.vbox.addLayout(self.hbox)
|
||||
|
||||
class IntervalGraph(QDialog):
|
||||
|
||||
def __init__(self, parent, *args):
|
||||
QDialog.__init__(self, parent, Qt.Window)
|
||||
ui.dialogs.open("Graphs", self)
|
||||
self.setAttribute(Qt.WA_DeleteOnClose)
|
||||
|
||||
def reject(self):
|
||||
ui.dialogs.close("Graphs")
|
||||
QDialog.reject(self)
|
||||
|
||||
def intervalGraph(parent, deck):
|
||||
dg = anki.graphs.DeckGraphs(deck)
|
||||
# dialog setup
|
||||
d = IntervalGraph(parent)
|
||||
d.setWindowTitle(_("Deck graphs"))
|
||||
if sys.platform.startswith("darwin"):
|
||||
d.setMinimumSize(740, 680)
|
||||
else:
|
||||
d.setMinimumSize(670, 715)
|
||||
scroll = QScrollArea(d)
|
||||
topBox = QVBoxLayout(d)
|
||||
topBox.addWidget(scroll)
|
||||
frame = QWidget(scroll)
|
||||
vbox = QVBoxLayout(frame)
|
||||
vbox.setMargin(0)
|
||||
vbox.setSpacing(0)
|
||||
frame.setLayout(vbox)
|
||||
|
||||
range = [7, 30, 90, 180, 365, 730, 1095, 1460, 1825]
|
||||
|
||||
# views
|
||||
nextDue = AdjustableFigure(dg.nextDue, 30)
|
||||
nextDue.addWidget(QLabel(_("<h1>Due cards</h1>")))
|
||||
nextDue.addFigure()
|
||||
nextDue.addSlider(_("Period"), range)
|
||||
nextDue.addExplanation(_("The number of cards due each day over the "
|
||||
"period.\n"
|
||||
"Today is 0; cards less than zero are overdue."))
|
||||
|
||||
vbox.addWidget(nextDue)
|
||||
|
||||
cumDue = AdjustableFigure(dg.cumulativeDue, 30)
|
||||
cumDue.addWidget(QLabel(_("<h1>Cumulative view of due cards</h1>")))
|
||||
cumDue.addFigure()
|
||||
cumDue.addSlider(_("Period"), range)
|
||||
cumDue.addExplanation(_("The number of cards due each day, assuming "
|
||||
"no study."))
|
||||
|
||||
vbox.addWidget(cumDue)
|
||||
|
||||
interval = AdjustableFigure(dg.intervalPeriod, 30)
|
||||
interval.addWidget(QLabel(_("<h1>Card intervals</h1>")))
|
||||
interval.addFigure()
|
||||
interval.addSlider(_("Period"), range)
|
||||
interval.addExplanation(_("The number of cards scheduled for a given "
|
||||
"number of days."))
|
||||
vbox.addWidget(interval)
|
||||
|
||||
added = AdjustableFigure(dg.addedRecently, 30)
|
||||
added.addWidget(QLabel(_("<h1>Added cards</h1>")))
|
||||
added.addFigure()
|
||||
added.addSlider(_("Period"), range)
|
||||
added.addExplanation(_("The number of cards added on a given day."))
|
||||
vbox.addWidget(added)
|
||||
|
||||
answered = AdjustableFigure(lambda *args: apply(
|
||||
dg.addedRecently, args + ('firstAnswered',)), 30)
|
||||
answered.addWidget(QLabel(_("<h1>First answered</h1>")))
|
||||
answered.addFigure()
|
||||
answered.addSlider(_("Period"), range)
|
||||
answered.addExplanation(_("The number of cards first answered on a "
|
||||
"given day.\nThis will be different to "
|
||||
"'added cards' if you are\nusing a "
|
||||
"pre-made deck."))
|
||||
vbox.addWidget(answered)
|
||||
|
||||
eases = AdjustableFigure(dg.easeBars)
|
||||
eases.addWidget(QLabel(_("<h1>Card ease</h1>")))
|
||||
eases.addFigure()
|
||||
eases.addExplanation(_("The amount of times you answered a card at "
|
||||
"each ease level."))
|
||||
vbox.addWidget(eases)
|
||||
|
||||
scroll.setWidget(frame)
|
||||
buttonBox = QDialogButtonBox(d)
|
||||
buttonBox.setOrientation(Qt.Horizontal)
|
||||
close = buttonBox.addButton(QDialogButtonBox.Close)
|
||||
close.setDefault(True)
|
||||
|
||||
d.connect(buttonBox, SIGNAL("rejected()"), d.close)
|
||||
|
||||
topBox.addWidget(buttonBox)
|
||||
|
||||
d.show()
|
||||
|
177
ankiqt/ui/help.py
Normal file
|
@ -0,0 +1,177 @@
|
|||
# Copyright: Damien Elmes <anki@ichi2.net>
|
||||
# License: GNU GPL, version 3 or later; http://www.gnu.org/copyleft/gpl.html
|
||||
|
||||
import sys
|
||||
from PyQt4.QtGui import *
|
||||
from PyQt4.QtCore import *
|
||||
import ankiqt.forms
|
||||
|
||||
# Hideable help area widget
|
||||
##########################################################################
|
||||
|
||||
class HelpArea(object):
|
||||
|
||||
helpAreaWidth = 300
|
||||
minAppWidth = 550
|
||||
|
||||
def __init__(self, helpFrame, config, mainWindow=None, focus=None):
|
||||
self.helpFrame = helpFrame
|
||||
self.widget = helpFrame.findChild(QTextBrowser)
|
||||
self.mainWindow = mainWindow
|
||||
if mainWindow:
|
||||
self.focus=mainWindow
|
||||
else:
|
||||
self.focus=focus
|
||||
self.config = config
|
||||
self.widget.connect(self.widget, SIGNAL("anchorClicked(QUrl)"),
|
||||
self.anchorClicked)
|
||||
self.hide()
|
||||
self.data = HelpData()
|
||||
|
||||
def getMinAppWidth(self):
|
||||
if self.config['easeButtonStyle'] == 'compact':
|
||||
return self.minAppWidth - 150
|
||||
return self.minAppWidth
|
||||
|
||||
def show(self):
|
||||
"Show the help area."
|
||||
if self.mainWindow:
|
||||
self.mainWindow.setMinimumWidth(
|
||||
self.getMinAppWidth()+self.helpAreaWidth)
|
||||
self.helpFrame.show()
|
||||
self.widget.show()
|
||||
|
||||
def hide(self):
|
||||
self.currentKey = None
|
||||
self.helpFrame.hide()
|
||||
self.widget.hide()
|
||||
if self.mainWindow:
|
||||
self.mainWindow.setMinimumWidth(self.getMinAppWidth())
|
||||
# force resize
|
||||
g = self.mainWindow.geometry()
|
||||
if g.width() < self.getMinAppWidth():
|
||||
self.mainWindow.setGeometry(QRect(g.left(),
|
||||
g.top(),
|
||||
self.getMinAppWidth(),
|
||||
g.height()))
|
||||
self.mainWindow.runHook("helpChanged")
|
||||
|
||||
def showKey(self, key, noFlush=False, dict=False):
|
||||
"Look up KEY in DATA and show."
|
||||
text = self.data[key]
|
||||
# accomodate some quirks in QTextEdit's html interpreter
|
||||
text = text.strip()
|
||||
if dict:
|
||||
text = text % dict
|
||||
self.showText(text, noFlush, key=key)
|
||||
|
||||
def showHideableKey(self, key, dict=False):
|
||||
"Look up a hideable KEY in DATA and show."
|
||||
if self.config.get("hide:" + key, False):
|
||||
# user requested not to see this key. if previous key was help, we
|
||||
# need to hide it
|
||||
if self.currentKey in self.data:
|
||||
self.hide()
|
||||
return
|
||||
self.showKey(key, noFlush=True, dict=dict)
|
||||
self.addRemover(key)
|
||||
self.flush()
|
||||
|
||||
def showText(self, text, noFlush=False, py={}, key="misc"):
|
||||
self.show()
|
||||
self.buffer = text
|
||||
self.addHider()
|
||||
self.handlers = py
|
||||
if not noFlush:
|
||||
self.flush()
|
||||
self.currentKey = key
|
||||
if self.mainWindow:
|
||||
self.mainWindow.runHook("helpChanged")
|
||||
|
||||
def flush(self):
|
||||
if sys.platform.startswith("darwin"):
|
||||
font = "helvetica"
|
||||
else:
|
||||
font = "arial"
|
||||
# qt seems to ignore font-size on elements like h1
|
||||
style = ("<style>#content { font-family: %s; " +
|
||||
"font-size: 12px; }</style>\n") % font
|
||||
self.widget.setHtml(style + '<div id="content">' +
|
||||
self.buffer + '</div>')
|
||||
|
||||
def addRemover(self, key):
|
||||
self.buffer += (" / <a href=hide:%s>" +
|
||||
_("Don't show this again.")
|
||||
+ "</a>") % key
|
||||
|
||||
def addHider(self):
|
||||
self.buffer += _("<p><a href=hide:>Hide this</a>")
|
||||
|
||||
def anchorClicked(self, url):
|
||||
# prevent the link being handled
|
||||
self.widget.setSource(QUrl(""))
|
||||
addr = unicode(url.toString())
|
||||
if addr.startswith("hide:"):
|
||||
if len(addr) > 5:
|
||||
# hide for good
|
||||
self.config[addr] = True
|
||||
self.hide()
|
||||
elif addr.startswith("py:"):
|
||||
key = addr[3:]
|
||||
if key in self.handlers:
|
||||
self.handlers[key]()
|
||||
else:
|
||||
# open in browser
|
||||
QDesktopServices.openUrl(QUrl(url))
|
||||
if self.focus:
|
||||
self.focus.setFocus()
|
||||
|
||||
# Text strings
|
||||
##########################################################################
|
||||
|
||||
class HelpData(dict):
|
||||
|
||||
def __init__(self):
|
||||
self['learn'] = _("""
|
||||
<h1>Learning new cards</h1>Anki is currently in 'learning mode'.
|
||||
<p>
|
||||
As an alternative to using the mouse, spacebar and the number keys are
|
||||
available.
|
||||
<p>
|
||||
<a href="http://ichi2.net/anki/wiki/Learning_new_cards">More information</a>
|
||||
""")
|
||||
|
||||
self['review'] = _("""
|
||||
<h1>Reviewing</h1>You are currently looking at a card you have seen before.
|
||||
Unlike new cards, it's important to try and review previously seen cards as
|
||||
promptly as possible, in order to ensure your previous effort spent
|
||||
remembering the cards is not wasted.<p> At the bottom of the main window, the
|
||||
"Remaining" figure indicates how many previously reviewed words are waiting
|
||||
for you today. Once this number reaches 0, you can close Anki, or continue
|
||||
studying new cards.""")
|
||||
|
||||
self['finalReview'] = _("""<h1>Final review</h1>You are now being
|
||||
shown cards that are due soon (in the next 5 hours by default). This includes
|
||||
any cards you failed recently. You can answer them now, or come back later -
|
||||
it's up to you.""")
|
||||
|
||||
self['add'] = _("""
|
||||
<h1>Adding cards</h1>
|
||||
Please enter some things you want to learn.
|
||||
<h2>Shortcuts</h2>
|
||||
<table width=230>
|
||||
<tr><td><b>Tab</b></td><td> change between fields.</td></tr>
|
||||
<tr><td><b>Ctrl+Enter</b></td><td> add the current card.</td></tr>
|
||||
<tr><td><b>Esc</b></td><td> close the dialog.</td></tr>
|
||||
<tr><td><b>Ctrl+B</b></td><td> bold</td></tr>
|
||||
<tr><td><b>Ctrl+I</b></td><td> italic</td></tr>
|
||||
<tr><td><b>Ctrl+U</b></td><td> underline</td></tr>
|
||||
<tr><td><b>Alt+1</b></td><td> enable/disable card model 1</td></tr>
|
||||
<tr><td><b>Alt+2</b></td><td> enable/disable card model 2</td></tr>
|
||||
</table>
|
||||
|
||||
<h2>Cards</h2>Depending on the language you selected, more than one card may
|
||||
be generated. This allows you to practice both <b>Production</b> (trying to produce
|
||||
the target idea/phrase yourself), and <b>Recognition</b> (quickly recognizing and
|
||||
understanding the target idea/phrase). To change which cards are automatically
|
||||
generated, click the rightmost button at the top.""")
|
202
ankiqt/ui/importing.py
Normal file
|
@ -0,0 +1,202 @@
|
|||
# Copyright: Damien Elmes <anki@ichi2.net>
|
||||
# License: GNU GPL, version 3 or later; http://www.gnu.org/copyleft/gpl.html
|
||||
|
||||
import os, copy, time
|
||||
from PyQt4.QtGui import *
|
||||
from PyQt4.QtCore import *
|
||||
import anki
|
||||
import anki.importing as importing
|
||||
from anki.errors import *
|
||||
import ankiqt.forms
|
||||
from ankiqt import ui
|
||||
|
||||
class ChangeMap(QDialog):
|
||||
def __init__(self, parent, model, current):
|
||||
QDialog.__init__(self, parent)
|
||||
self.parent = parent
|
||||
self.model = model
|
||||
self.dialog = ankiqt.forms.changemap.Ui_ChangeMap()
|
||||
self.dialog.setupUi(self)
|
||||
n = 0
|
||||
for field in self.model.fieldModels:
|
||||
item = QListWidgetItem(_("Map to %s") % field.name)
|
||||
self.dialog.fields.addItem(item)
|
||||
if current == field.name:
|
||||
self.dialog.fields.setCurrentRow(n)
|
||||
n += 1
|
||||
self.dialog.fields.addItem(QListWidgetItem(_("Discard field")))
|
||||
if current is None:
|
||||
self.dialog.fields.setCurrentRow(n)
|
||||
self.field = None
|
||||
|
||||
def getField(self):
|
||||
self.exec_()
|
||||
return self.field
|
||||
|
||||
def accept(self):
|
||||
row = self.dialog.fields.currentRow()
|
||||
if row < len(self.model.fieldModels):
|
||||
self.field = self.model.fieldModels[row]
|
||||
else:
|
||||
self.field = None
|
||||
QDialog.accept(self)
|
||||
|
||||
class ImportDialog(QDialog):
|
||||
|
||||
def __init__(self, parent):
|
||||
QDialog.__init__(self, parent)
|
||||
self.parent = parent
|
||||
self.dialog = ankiqt.forms.importing.Ui_ImportDialog()
|
||||
self.dialog.setupUi(self)
|
||||
self.setupMappingFrame()
|
||||
self.setupOptions()
|
||||
self.exec_()
|
||||
|
||||
def setupOptions(self):
|
||||
self.file = None
|
||||
self.model = self.parent.deck.currentModel
|
||||
self.modelChooser = ui.modelchooser.ModelChooser(self,
|
||||
self.parent,
|
||||
self.parent.deck,
|
||||
self.modelChanged)
|
||||
self.importerChanged(0)
|
||||
self.connect(self.dialog.type, SIGNAL("activated(int)"),
|
||||
self.importerChanged)
|
||||
self.dialog.type.insertItems(0, QStringList(list(zip(*importing.Importers)[0])))
|
||||
self.connect(self.dialog.file, SIGNAL("clicked()"),
|
||||
self.changeFile)
|
||||
self.dialog.modelArea.setLayout(self.modelChooser)
|
||||
self.connect(self.dialog.importButton, SIGNAL("clicked()"),
|
||||
self.doImport)
|
||||
self.maybePreview()
|
||||
|
||||
def importerChanged(self, idx):
|
||||
self.importerFunc = zip(*importing.Importers)[1][idx]
|
||||
if self.importerFunc.needMapper:
|
||||
self.modelChooser.show()
|
||||
self.dialog.tagDuplicates.show()
|
||||
else:
|
||||
self.modelChooser.hide()
|
||||
self.dialog.tagDuplicates.hide()
|
||||
self.dialog.file.setText(_("Choose file..."))
|
||||
self.file = None
|
||||
self.maybePreview()
|
||||
|
||||
def changeFile(self):
|
||||
key = zip(*importing.Importers)[0][self.dialog.type.currentIndex()]
|
||||
file = ui.utils.getFile(self, _("Import file"), "import", key)
|
||||
if not file:
|
||||
return
|
||||
self.file = unicode(file)
|
||||
self.dialog.file.setText(os.path.basename(self.file))
|
||||
self.maybePreview()
|
||||
|
||||
def maybePreview(self):
|
||||
if self.file and self.model:
|
||||
self.dialog.status.setText("")
|
||||
self.showMapping()
|
||||
else:
|
||||
self.hideMapping()
|
||||
|
||||
def modelChanged(self, model):
|
||||
self.model = model
|
||||
self.maybePreview()
|
||||
|
||||
def doImport(self):
|
||||
self.dialog.status.setText(_("Importing. Anki will freeze for a while.."))
|
||||
t = time.time()
|
||||
while self.parent.app.hasPendingEvents():
|
||||
self.parent.app.processEvents()
|
||||
if time.time() - t > 1:
|
||||
# windows sometimes has pending events permanently?
|
||||
break
|
||||
self.importer.mapping = self.mapping
|
||||
self.importer.tagsToAdd = unicode(self.dialog.tags.text())
|
||||
self.importer.tagDuplicates = self.dialog.tagDuplicates.isChecked()
|
||||
try:
|
||||
self.importer.doImport()
|
||||
except ImportFormatError, e:
|
||||
msg = _("Importing failed.\n")
|
||||
msg += e.data['info']
|
||||
self.dialog.status.setText(msg)
|
||||
return
|
||||
except DeckWrongFormatError, e:
|
||||
msg = _("Import failed: %s") % `e.data`
|
||||
self.dialog.status.setText(msg)
|
||||
return
|
||||
txt = (
|
||||
_("Importing complete. %(num)d cards imported from %(file)s.\n") %
|
||||
{"num": self.importer.total, "file": os.path.basename(self.file)})
|
||||
txt += _("Click the close button or import another file.\n\n")
|
||||
if self.importer.log:
|
||||
txt += _("Log of import:\n") + "\n".join(self.importer.log)
|
||||
self.dialog.status.setText(txt)
|
||||
self.file = None
|
||||
self.maybePreview()
|
||||
self.parent.deck.updateAllPriorities()
|
||||
self.parent.rebuildQueue()
|
||||
|
||||
def setupMappingFrame(self):
|
||||
# qt seems to have a bug with adding/removing from a grid, so we add
|
||||
# to a separate object and add/remove that instead
|
||||
self.mapbox = QVBoxLayout(self.dialog.mappingArea)
|
||||
self.mapwidget = None
|
||||
|
||||
def hideMapping(self):
|
||||
self.dialog.mappingGroup.hide()
|
||||
|
||||
def showMapping(self, keepMapping=False):
|
||||
# first, check that we can read the file
|
||||
try:
|
||||
self.importer = self.importerFunc(self.parent.deck, self.file)
|
||||
if not keepMapping:
|
||||
self.mapping = self.importer.mapping
|
||||
except ImportFormatError, e:
|
||||
self.dialog.status.setText(
|
||||
_("Unable to read file.\n\n%(info)s") % {
|
||||
'type': e.data.get('type', ""),
|
||||
'info': e.data.get('info', ""),
|
||||
})
|
||||
self.file = None
|
||||
self.maybePreview()
|
||||
return
|
||||
self.dialog.mappingGroup.show()
|
||||
if self.importer.fields():
|
||||
self.dialog.mappingArea.show()
|
||||
else:
|
||||
self.dialog.mappingArea.hide()
|
||||
return
|
||||
# set up the mapping grid
|
||||
if self.mapwidget:
|
||||
self.mapbox.removeWidget(self.mapwidget)
|
||||
self.mapwidget.deleteLater()
|
||||
self.mapwidget = QWidget()
|
||||
self.mapbox.addWidget(self.mapwidget)
|
||||
self.grid = QGridLayout(self.mapwidget)
|
||||
self.mapwidget.setLayout(self.grid)
|
||||
self.grid.setMargin(6)
|
||||
self.grid.setSpacing(12)
|
||||
fields = self.importer.fields()
|
||||
for num in range(len(self.mapping)):
|
||||
text = _("Field <b>%d</b> of file is:") % (num + 1)
|
||||
self.grid.addWidget(QLabel(text), num, 0)
|
||||
if self.mapping[num]:
|
||||
text = _("mapped to <b>%s</b>") % self.mapping[num].name
|
||||
else:
|
||||
text = _("<ignored>")
|
||||
self.grid.addWidget(QLabel(text), num, 1)
|
||||
button = QPushButton(_("Change"))
|
||||
self.grid.addWidget(button, num, 2)
|
||||
self.connect(button, SIGNAL("clicked()"),
|
||||
lambda s=self,n=num: s.changeMappingNum(n))
|
||||
|
||||
def changeMappingNum(self, n):
|
||||
f = ChangeMap(self.parent, self.model, self.mapping[n]).getField()
|
||||
try:
|
||||
# make sure we don't have it twice
|
||||
index = self.mapping.index(f)
|
||||
self.mapping[index] = None
|
||||
except ValueError:
|
||||
pass
|
||||
self.mapping[n] = f
|
||||
self.showMapping(keepMapping=True)
|
75
ankiqt/ui/lookup.py
Normal file
|
@ -0,0 +1,75 @@
|
|||
# Copyright: Damien Elmes <anki@ichi2.net>
|
||||
# License: GNU GPL, version 3 or later; http://www.gnu.org/copyleft/gpl.html
|
||||
|
||||
from PyQt4.QtGui import *
|
||||
from PyQt4.QtCore import *
|
||||
import urllib, re
|
||||
import anki
|
||||
|
||||
# Tools - looking up words in the dictionary
|
||||
##########################################################################
|
||||
|
||||
class Lookup(object):
|
||||
|
||||
def __init__(self, main):
|
||||
self.main = main
|
||||
|
||||
def selection(self, function):
|
||||
"Get the selected text and look it up with FUNCTION."
|
||||
text = unicode(self.main.mainWin.mainText.textCursor().selectedText())
|
||||
if "\n" in text:
|
||||
self.main.setStatus(_("Can't look up a selection with a newline."))
|
||||
return
|
||||
text = text.strip()
|
||||
if not text:
|
||||
self.main.setStatus(_("Empty selection."))
|
||||
return
|
||||
function(text)
|
||||
|
||||
def edictKanji(self, text):
|
||||
self.edict(text, True)
|
||||
|
||||
def edict(self, text, kanji=False):
|
||||
"Look up TEXT with edict."
|
||||
if kanji:
|
||||
x="M"
|
||||
else:
|
||||
x="U"
|
||||
baseUrl="http://www.csse.monash.edu.au/~jwb/cgi-bin/wwwjdic.cgi?1M" + x
|
||||
if isJapaneseText(text):
|
||||
baseUrl += "J"
|
||||
else:
|
||||
baseUrl += "E"
|
||||
url = baseUrl + urllib.quote(text.encode("utf-8"))
|
||||
self.main.setStatus(_("Looking %s up on edict..") % text)
|
||||
qurl = QUrl()
|
||||
qurl.setEncodedUrl(url)
|
||||
QDesktopServices.openUrl(qurl)
|
||||
|
||||
def alc(self, text):
|
||||
"Look up TEXT with ALC."
|
||||
newText = urllib.quote(text.encode("utf-8"))
|
||||
url = (
|
||||
"http://eow.alc.co.jp/" +
|
||||
newText +
|
||||
"/UTF-8/?ref=sa")
|
||||
self.main.setStatus(_("Looking %s up on ALC..") % text)
|
||||
qurl = QUrl()
|
||||
qurl.setEncodedUrl(url)
|
||||
QDesktopServices.openUrl(qurl)
|
||||
|
||||
def isJapaneseText(text):
|
||||
"True if 70% of text is a Japanese character."
|
||||
total = len(text)
|
||||
if total == 0:
|
||||
return True
|
||||
jp = 0
|
||||
en = 0
|
||||
for c in text:
|
||||
if ord(c) >= 0x2E00 and ord(c) <= 0x9FFF:
|
||||
jp += 1
|
||||
if re.match("[A-Za-z]", c):
|
||||
en += 1
|
||||
if not jp:
|
||||
return False
|
||||
return ((jp + 1) / float(en + 1)) >= 1.0
|
1345
ankiqt/ui/main.py
Normal file
210
ankiqt/ui/modelchooser.py
Normal file
|
@ -0,0 +1,210 @@
|
|||
# Copyright: Damien Elmes <anki@ichi2.net>
|
||||
# License: GNU GPL, version 3 or later; http://www.gnu.org/copyleft/gpl.html
|
||||
|
||||
from PyQt4.QtGui import *
|
||||
from PyQt4.QtCore import *
|
||||
import anki
|
||||
from anki import stdmodels
|
||||
from anki.models import *
|
||||
from ankiqt import ui
|
||||
import ankiqt.forms
|
||||
|
||||
class ModelChooser(QHBoxLayout):
|
||||
|
||||
def __init__(self, parent, main, deck, onChangeFunc, cards=True):
|
||||
QHBoxLayout.__init__(self)
|
||||
self.parent = parent
|
||||
self.main = main
|
||||
self.deck = deck
|
||||
self.onChangeFunc = onChangeFunc
|
||||
self.setMargin(0)
|
||||
self.setSpacing(6)
|
||||
self.shortcuts = []
|
||||
label = QLabel(_("<b><u>M</u>odel</b>:"))
|
||||
self.addWidget(label)
|
||||
self.models = QComboBox()
|
||||
s = QShortcut(QKeySequence(_("Alt+M")), self.parent)
|
||||
s.connect(s, SIGNAL("activated()"),
|
||||
lambda: self.models.showPopup())
|
||||
self.drawModels()
|
||||
sizePolicy = QSizePolicy(
|
||||
QSizePolicy.Policy(7),
|
||||
QSizePolicy.Policy(0))
|
||||
self.models.setSizePolicy(sizePolicy)
|
||||
self.addWidget(self.models)
|
||||
self.add = QPushButton()
|
||||
self.add.setIcon(QIcon(":/icons/list-add.png"))
|
||||
self.add.setToolTip(_("Add a new model"))
|
||||
self.add.setAutoDefault(False)
|
||||
self.addWidget(self.add)
|
||||
self.connect(self.add, SIGNAL("clicked()"), self.onAdd)
|
||||
self.edit = QPushButton()
|
||||
self.edit.setIcon(QIcon(":/icons/edit.png"))
|
||||
self.edit.setShortcut(_("Alt+E"))
|
||||
self.edit.setToolTip(_("Edit the current model"))
|
||||
self.edit.setAutoDefault(False)
|
||||
self.addWidget(self.edit)
|
||||
self.connect(self.edit, SIGNAL("clicked()"), self.onEdit)
|
||||
self.connect(self.models, SIGNAL("activated(int)"), self.onChange)
|
||||
self.handleCards = False
|
||||
if cards:
|
||||
self.handleCards = True
|
||||
label = QLabel(_("<b><u>C</u>ards</b>:"))
|
||||
self.addWidget(label)
|
||||
self.cards = QPushButton()
|
||||
self.connect(self.cards, SIGNAL("clicked()"), self.onCardChange)
|
||||
s = QShortcut(QKeySequence(_("Alt+C")), self.parent)
|
||||
s.connect(s, SIGNAL("activated()"),
|
||||
self.onCardChange)
|
||||
self.addWidget(self.cards)
|
||||
self.drawCardModels()
|
||||
|
||||
def show(self):
|
||||
for i in range(self.count()):
|
||||
self.itemAt(i).widget().show()
|
||||
|
||||
def hide(self):
|
||||
for i in range(self.count()):
|
||||
self.itemAt(i).widget().hide()
|
||||
|
||||
def onEdit(self):
|
||||
idx = self.models.currentIndex()
|
||||
model = self.deck.models[idx]
|
||||
ui.modelproperties.ModelProperties(self.parent, model, self.main,
|
||||
onFinish=self.onModelEdited)
|
||||
self.drawModels()
|
||||
self.changed(model)
|
||||
|
||||
def onModelEdited(self):
|
||||
self.drawModels()
|
||||
|
||||
def onAdd(self):
|
||||
model = AddModel(self.parent, self.main).getModel()
|
||||
if model:
|
||||
self.deck.addModel(model)
|
||||
self.drawModels()
|
||||
self.changed(model)
|
||||
self.deck.setModified()
|
||||
|
||||
def onChange(self, idx):
|
||||
model = self.deck.models[idx]
|
||||
self.deck.currentModel = model
|
||||
self.changed(model)
|
||||
self.deck.setModified()
|
||||
|
||||
def changed(self, model):
|
||||
self.deck.addModel(model)
|
||||
self.onChangeFunc(model)
|
||||
self.drawCardModels()
|
||||
|
||||
def drawModels(self):
|
||||
self.models.clear()
|
||||
self.models.addItems(QStringList(
|
||||
[m.name for m in self.deck.models]))
|
||||
idx = self.deck.models.index(self.deck.currentModel)
|
||||
self.models.setCurrentIndex(idx)
|
||||
|
||||
def drawCardModels(self):
|
||||
if not self.handleCards:
|
||||
return
|
||||
# remove any shortcuts
|
||||
for s in self.shortcuts:
|
||||
s.setEnabled(False)
|
||||
self.shortcuts = []
|
||||
m = self.deck.currentModel
|
||||
txt = ", ".join([c.name for c in m.cardModels if c.active])
|
||||
if len(txt) > 30:
|
||||
txt = txt[0:30] + "..."
|
||||
self.cards.setText(txt)
|
||||
n = 1
|
||||
for c in m.cardModels:
|
||||
s = QShortcut(QKeySequence("Alt+%d" % n), self.parent)
|
||||
self.parent.connect(s, SIGNAL("activated()"),
|
||||
lambda c=c: self.toggleCard(c))
|
||||
self.shortcuts.append(s)
|
||||
n += 1
|
||||
|
||||
def onCardChange(self):
|
||||
m = QMenu(self.parent)
|
||||
m.setTitle("menu")
|
||||
model = self.deck.currentModel
|
||||
for card in model.cardModels:
|
||||
action = QAction(self.parent)
|
||||
action.setCheckable(True)
|
||||
if card.active:
|
||||
action.setChecked(True)
|
||||
action.setText(card.name)
|
||||
self.connect(action, SIGNAL("toggled(bool)"),
|
||||
lambda b, a=action, c=card: \
|
||||
self.cardChangeTriggered(b,a,c))
|
||||
m.addAction(action)
|
||||
m.exec_(self.cards.mapToGlobal(QPoint(0,0)))
|
||||
|
||||
def cardChangeTriggered(self, bool, action, card):
|
||||
if bool:
|
||||
card.active = True
|
||||
elif self.canDisableModel():
|
||||
card.active = False
|
||||
self.drawCardModels()
|
||||
|
||||
def canDisableModel(self):
|
||||
active = 0
|
||||
model = self.deck.currentModel
|
||||
for c in model.cardModels:
|
||||
if c.active:
|
||||
active += 1
|
||||
if active > 1:
|
||||
return True
|
||||
return False
|
||||
|
||||
def toggleCard(self, card):
|
||||
if not card.active:
|
||||
card.active = True
|
||||
elif self.canDisableModel():
|
||||
card.active = False
|
||||
self.drawCardModels()
|
||||
|
||||
class AddModel(QDialog):
|
||||
|
||||
def __init__(self, parent, main=None, online=False):
|
||||
QDialog.__init__(self, parent)
|
||||
self.parent = parent
|
||||
if not main:
|
||||
main = parent
|
||||
self.main = main
|
||||
self.model = None
|
||||
self.dialog = ankiqt.forms.addmodel.Ui_AddModel()
|
||||
self.dialog.setupUi(self)
|
||||
self.models = {}
|
||||
for name in (
|
||||
"Japanese",
|
||||
"English",
|
||||
"Cantonese",
|
||||
"Mandarin",
|
||||
"Heisig"):
|
||||
# hard code the order so that most common come first
|
||||
m = stdmodels.byName(name)
|
||||
item = QListWidgetItem(m.name)
|
||||
self.dialog.models.addItem(item)
|
||||
self.models[m.name] = m
|
||||
self.dialog.models.setCurrentRow(0)
|
||||
# the list widget will swallow the enter key
|
||||
s = QShortcut(QKeySequence("Return"), self)
|
||||
self.connect(s, SIGNAL("activated()"), self.accept)
|
||||
if not online:
|
||||
self.dialog.loadOnline.setShown(False)
|
||||
|
||||
def getModel(self):
|
||||
self.exec_()
|
||||
return self.model
|
||||
|
||||
def accept(self):
|
||||
if self.dialog.createTemplate.isChecked():
|
||||
self.model = self.models[
|
||||
unicode(self.dialog.models.currentItem().text())]
|
||||
elif self.dialog.createBasic.isChecked():
|
||||
self.model = stdmodels.byName("Basic")
|
||||
else:
|
||||
self.model = "online"
|
||||
QDialog.accept(self)
|
||||
|
474
ankiqt/ui/modelproperties.py
Normal file
|
@ -0,0 +1,474 @@
|
|||
# Copyright: Damien Elmes <anki@ichi2.net>
|
||||
# License: GNU GPL, version 3 or later; http://www.gnu.org/copyleft/gpl.html
|
||||
|
||||
from PyQt4.QtGui import *
|
||||
from PyQt4.QtCore import *
|
||||
import sys, re
|
||||
import ankiqt.forms
|
||||
import anki
|
||||
from anki.models import FieldModel, CardModel
|
||||
from ankiqt import ui
|
||||
|
||||
class ModelProperties(QDialog):
|
||||
|
||||
def __init__(self, parent, model, main=None, onFinish=None):
|
||||
QDialog.__init__(self, parent, Qt.Window)
|
||||
if not main:
|
||||
main = parent
|
||||
self.parent = main
|
||||
self.deck = main.deck
|
||||
self.origModTime = self.deck.modified
|
||||
self.m = model
|
||||
self.onFinish = onFinish
|
||||
self.dialog = ankiqt.forms.modelproperties.Ui_ModelProperties()
|
||||
self.dialog.setupUi(self)
|
||||
self.setupFields()
|
||||
self.setupCards()
|
||||
self.readData()
|
||||
self.show()
|
||||
|
||||
def readData(self):
|
||||
# properties section
|
||||
self.dialog.name.setText(self.m.name)
|
||||
self.dialog.description.setText(self.m.description)
|
||||
self.dialog.tags.setText(self.m.tags)
|
||||
self.dialog.decorators.setText(self.m.features)
|
||||
self.dialog.spacing.setText(str(self.m.spacing))
|
||||
self.dialog.initialSpacing.setText(str(self.m.initialSpacing/60))
|
||||
|
||||
# Fields
|
||||
##########################################################################
|
||||
|
||||
def setupFields(self):
|
||||
self.fieldOrdinalUpdatedIds = []
|
||||
self.ignoreFieldUpdate = False
|
||||
self.currentField = None
|
||||
self.updateFields()
|
||||
self.readCurrentField()
|
||||
self.connect(self.dialog.fieldList, SIGNAL("currentRowChanged(int)"),
|
||||
self.fieldRowChanged)
|
||||
self.connect(self.dialog.tabWidget, SIGNAL("currentChanged(int)"),
|
||||
self.fieldRowChanged)
|
||||
self.connect(self.dialog.fieldAdd, SIGNAL("clicked()"),
|
||||
self.addField)
|
||||
self.connect(self.dialog.fieldDelete, SIGNAL("clicked()"),
|
||||
self.deleteField)
|
||||
self.connect(self.dialog.fieldUp, SIGNAL("clicked()"),
|
||||
self.moveFieldUp)
|
||||
self.connect(self.dialog.fieldDown, SIGNAL("clicked()"),
|
||||
self.moveFieldDown)
|
||||
|
||||
def updateFields(self, row = None):
|
||||
oldRow = self.dialog.fieldList.currentRow()
|
||||
if oldRow == -1:
|
||||
oldRow = 0
|
||||
self.dialog.fieldList.clear()
|
||||
n = 1
|
||||
for field in self.m.fieldModels:
|
||||
label = _("Field %(num)d: %(name)s [%(cards)s non-empty]") % {
|
||||
'num': n,
|
||||
'name': field.name,
|
||||
'cards': self.deck.fieldModelUseCount(field)
|
||||
}
|
||||
item = QListWidgetItem(label)
|
||||
self.dialog.fieldList.addItem(item)
|
||||
n += 1
|
||||
count = self.dialog.fieldList.count()
|
||||
if row != None:
|
||||
self.dialog.fieldList.setCurrentRow(row)
|
||||
else:
|
||||
while (count > 0 and oldRow > (count - 1)):
|
||||
oldRow -= 1
|
||||
self.dialog.fieldList.setCurrentRow(oldRow)
|
||||
self.enableFieldMoveButtons()
|
||||
|
||||
def fieldRowChanged(self):
|
||||
if self.ignoreFieldUpdate:
|
||||
return
|
||||
self.saveCurrentField()
|
||||
self.readCurrentField()
|
||||
|
||||
def readCurrentField(self):
|
||||
if not len(self.m.fieldModels):
|
||||
self.dialog.fieldEditBox.hide()
|
||||
self.dialog.fieldUp.setEnabled(False)
|
||||
self.dialog.fieldDown.setEnabled(False)
|
||||
return
|
||||
else:
|
||||
self.dialog.fieldEditBox.show()
|
||||
self.currentField = self.m.fieldModels[self.dialog.fieldList.currentRow()]
|
||||
field = self.currentField
|
||||
self.dialog.fieldName.setText(field.name)
|
||||
self.dialog.fieldDescription.setText(field.description)
|
||||
self.dialog.fieldUnique.setChecked(field.unique)
|
||||
self.dialog.fieldRequired.setChecked(field.required)
|
||||
self.dialog.fieldFeatures.setText(field.features)
|
||||
self.dialog.numeric.setChecked(field.numeric)
|
||||
|
||||
def enableFieldMoveButtons(self):
|
||||
row = self.dialog.fieldList.currentRow()
|
||||
if row < 1:
|
||||
self.dialog.fieldUp.setEnabled(False)
|
||||
else:
|
||||
self.dialog.fieldUp.setEnabled(True)
|
||||
if row == -1 or row >= (self.dialog.fieldList.count() - 1):
|
||||
self.dialog.fieldDown.setEnabled(False)
|
||||
else:
|
||||
self.dialog.fieldDown.setEnabled(True)
|
||||
|
||||
def saveCurrentField(self):
|
||||
if not self.currentField:
|
||||
return
|
||||
field = self.currentField
|
||||
name = unicode(self.dialog.fieldName.text()).strip()
|
||||
# renames
|
||||
if not name:
|
||||
name = _("Field %d") % (self.m.fieldModels.index(field) + 1)
|
||||
if name != field.name:
|
||||
self.deck.renameFieldModel(self.m, field, name)
|
||||
# the card models will have been updated
|
||||
self.readCurrentCard()
|
||||
self.updateField(field, 'description',
|
||||
unicode(self.dialog.fieldDescription.toPlainText()))
|
||||
self.updateField(field, 'features',
|
||||
unicode(self.dialog.fieldFeatures.text()))
|
||||
# unique, required, numeric
|
||||
self.updateField(field, 'unique',
|
||||
self.dialog.fieldUnique.checkState() == Qt.Checked)
|
||||
self.updateField(field, 'required',
|
||||
self.dialog.fieldRequired.checkState() == Qt.Checked)
|
||||
self.updateField(field, 'numeric',
|
||||
self.dialog.numeric.checkState() == Qt.Checked)
|
||||
self.ignoreFieldUpdate = True
|
||||
self.updateFields()
|
||||
self.ignoreFieldUpdate = False
|
||||
|
||||
def addField(self):
|
||||
f = FieldModel()
|
||||
f.name = _("Field %d") % (len(self.m.fieldModels) + 1)
|
||||
self.deck.addFieldModel(self.m, f)
|
||||
self.updateFields()
|
||||
self.dialog.fieldList.setCurrentRow(len(self.m.fieldModels)-1)
|
||||
self.dialog.fieldName.setFocus()
|
||||
self.dialog.fieldName.selectAll()
|
||||
|
||||
def deleteField(self):
|
||||
row = self.dialog.fieldList.currentRow()
|
||||
if row == -1:
|
||||
return
|
||||
if len(self.m.fieldModels) < 2:
|
||||
ui.utils.showInfo(
|
||||
_("Please add a new field first."))
|
||||
return
|
||||
field = self.m.fieldModels[row]
|
||||
count = self.deck.fieldModelUseCount(field)
|
||||
if count:
|
||||
if not ui.utils.askUser(
|
||||
_("This field is used by %d cards. If you delete it,\n"
|
||||
"all information in this field will be lost.\n"
|
||||
"\nReally delete this field?") % count,
|
||||
parent=self):
|
||||
return
|
||||
self.deck.deleteFieldModel(self.m, field)
|
||||
self.currentField = None
|
||||
self.updateFields()
|
||||
# need to update q/a format
|
||||
self.readCurrentCard()
|
||||
|
||||
def moveFieldUp(self):
|
||||
row = self.dialog.fieldList.currentRow()
|
||||
if row == -1:
|
||||
return
|
||||
if row == 0:
|
||||
return
|
||||
field = self.m.fieldModels[row]
|
||||
tField = self.m.fieldModels[row - 1]
|
||||
self.m.fieldModels.remove(field)
|
||||
self.m.fieldModels.insert(row - 1, field)
|
||||
if field.id not in self.fieldOrdinalUpdatedIds:
|
||||
self.fieldOrdinalUpdatedIds.append(field.id)
|
||||
if tField.id not in self.fieldOrdinalUpdatedIds:
|
||||
self.fieldOrdinalUpdatedIds.append(tField.id)
|
||||
self.ignoreFieldUpdate = True
|
||||
self.updateFields(row - 1)
|
||||
self.ignoreFieldUpdate = False
|
||||
|
||||
def moveFieldDown(self):
|
||||
row = self.dialog.fieldList.currentRow()
|
||||
if row == -1:
|
||||
return
|
||||
if row == len(self.m.fieldModels) - 1:
|
||||
return
|
||||
field = self.m.fieldModels[row]
|
||||
tField = self.m.fieldModels[row + 1]
|
||||
self.m.fieldModels.remove(field)
|
||||
self.m.fieldModels.insert(row + 1, field)
|
||||
if field.id not in self.fieldOrdinalUpdatedIds:
|
||||
self.fieldOrdinalUpdatedIds.append(field.id)
|
||||
if tField.id not in self.fieldOrdinalUpdatedIds:
|
||||
self.fieldOrdinalUpdatedIds.append(tField.id)
|
||||
self.ignoreFieldUpdate = True
|
||||
self.updateFields(row + 1)
|
||||
self.ignoreFieldUpdate = False
|
||||
|
||||
# Cards
|
||||
##########################################################################
|
||||
|
||||
def setupCards(self):
|
||||
self.cardOrdinalUpdatedIds = []
|
||||
self.ignoreCardUpdate = False
|
||||
self.currentCard = None
|
||||
self.updateCards()
|
||||
self.readCurrentCard()
|
||||
self.connect(self.dialog.cardList, SIGNAL("currentRowChanged(int)"),
|
||||
self.cardRowChanged)
|
||||
self.connect(self.dialog.cardAdd, SIGNAL("clicked()"),
|
||||
self.addCard)
|
||||
self.connect(self.dialog.cardDelete, SIGNAL("clicked()"),
|
||||
self.deleteCard)
|
||||
self.connect(self.dialog.cardToggle, SIGNAL("clicked()"),
|
||||
self.toggleCard)
|
||||
self.connect(self.dialog.cardUp, SIGNAL("clicked()"),
|
||||
self.moveCardUp)
|
||||
self.connect(self.dialog.cardDown, SIGNAL("clicked()"),
|
||||
self.moveCardDown)
|
||||
|
||||
def updateCards(self, row = None):
|
||||
oldRow = self.dialog.cardList.currentRow()
|
||||
if oldRow == -1:
|
||||
oldRow = 0
|
||||
self.dialog.cardList.clear()
|
||||
n = 1
|
||||
for card in self.m.cardModels:
|
||||
if card.active:
|
||||
status=""
|
||||
else:
|
||||
status=_("; disabled")
|
||||
label = _("Card %(num)d (%(name)s): used %(cards)d times%(status)s") % {
|
||||
'num': n,
|
||||
'name': card.name,
|
||||
'status': status,
|
||||
'cards': self.deck.cardModelUseCount(card),
|
||||
}
|
||||
item = QListWidgetItem(label)
|
||||
self.dialog.cardList.addItem(item)
|
||||
n += 1
|
||||
count = self.dialog.cardList.count()
|
||||
if row != None:
|
||||
self.dialog.cardList.setCurrentRow(row)
|
||||
else:
|
||||
while (count > 0 and oldRow > (count - 1)):
|
||||
oldRow -= 1
|
||||
self.dialog.cardList.setCurrentRow(oldRow)
|
||||
self.enableCardMoveButtons()
|
||||
|
||||
def cardRowChanged(self):
|
||||
if self.ignoreCardUpdate:
|
||||
return
|
||||
self.saveCurrentCard()
|
||||
self.readCurrentCard()
|
||||
|
||||
def readCurrentCard(self):
|
||||
if not len(self.m.cardModels):
|
||||
self.dialog.cardEditBox.hide()
|
||||
self.dialog.cardToggle.setEnabled(False)
|
||||
self.dialog.cardDelete.setEnabled(False)
|
||||
self.dialog.cardUp.setEnabled(False)
|
||||
self.dialog.cardDown.setEnabled(False)
|
||||
return
|
||||
else:
|
||||
self.dialog.cardEditBox.show()
|
||||
self.dialog.cardToggle.setEnabled(True)
|
||||
self.dialog.cardDelete.setEnabled(True)
|
||||
self.currentCard = self.m.cardModels[self.dialog.cardList.currentRow()]
|
||||
card = self.currentCard
|
||||
self.dialog.cardName.setText(card.name)
|
||||
self.dialog.cardDescription.setText(card.description)
|
||||
self.dialog.cardQuestion.setPlainText(card.qformat.replace("<br>", "\n"))
|
||||
self.dialog.cardAnswer.setPlainText(card.aformat.replace("<br>", "\n"))
|
||||
if card.questionInAnswer:
|
||||
self.dialog.questionInAnswer.setCheckState(Qt.Checked)
|
||||
else:
|
||||
self.dialog.questionInAnswer.setCheckState(Qt.Unchecked)
|
||||
self.updateToggleButtonText(card)
|
||||
|
||||
def enableCardMoveButtons(self):
|
||||
row = self.dialog.cardList.currentRow()
|
||||
if row < 1:
|
||||
self.dialog.cardUp.setEnabled(False)
|
||||
else:
|
||||
self.dialog.cardUp.setEnabled(True)
|
||||
if row == -1 or row >= (self.dialog.cardList.count() - 1):
|
||||
self.dialog.cardDown.setEnabled(False)
|
||||
else:
|
||||
self.dialog.cardDown.setEnabled(True)
|
||||
|
||||
def updateToggleButtonText(self, card):
|
||||
if card.active:
|
||||
self.dialog.cardToggle.setText(_("Disa&ble"))
|
||||
else:
|
||||
self.dialog.cardToggle.setText(_("Ena&ble"))
|
||||
|
||||
def saveCurrentCard(self):
|
||||
if not self.currentCard:
|
||||
return
|
||||
card = self.currentCard
|
||||
newname = unicode(self.dialog.cardName.text())
|
||||
if not newname:
|
||||
newname = _("Card %d") % (self.m.cardModels.index(card) + 1)
|
||||
self.updateField(card, 'name', newname)
|
||||
self.updateField(card, 'description', unicode(
|
||||
self.dialog.cardDescription.toPlainText()))
|
||||
s = unicode(self.dialog.cardQuestion.toPlainText()).strip()
|
||||
s = s.replace("\n", "<br>")
|
||||
changed = self.updateField(card, 'qformat', s)
|
||||
s = unicode(self.dialog.cardAnswer.toPlainText()).strip()
|
||||
s = s.replace("\n", "<br>")
|
||||
changed2 = self.updateField(card, 'aformat', s)
|
||||
changed = changed or changed2
|
||||
self.updateField(card, 'questionInAnswer', self.dialog.questionInAnswer.isChecked())
|
||||
if changed:
|
||||
# need to generate all question/answers for this card
|
||||
self.deck.updateCardsFromModel(self.currentCard)
|
||||
self.ignoreCardUpdate = True
|
||||
self.updateCards()
|
||||
self.ignoreCardUpdate = False
|
||||
|
||||
def updateField(self, obj, field, value):
|
||||
if getattr(obj, field) != value:
|
||||
setattr(obj, field, value)
|
||||
self.m.setModified()
|
||||
self.deck.setModified()
|
||||
return True
|
||||
return False
|
||||
|
||||
def addCard(self):
|
||||
cards = len(self.m.cardModels)
|
||||
name = _("Card %d") % (cards+1)
|
||||
cm = CardModel(name=name)
|
||||
self.m.addCardModel(cm)
|
||||
self.updateCards()
|
||||
self.dialog.cardList.setCurrentRow(len(self.m.cardModels)-1)
|
||||
self.dialog.cardName.setFocus()
|
||||
self.dialog.cardName.selectAll()
|
||||
|
||||
def deleteCard(self):
|
||||
row = self.dialog.cardList.currentRow()
|
||||
if row == -1:
|
||||
return
|
||||
if len (self.m.cardModels) < 2:
|
||||
ui.utils.showWarning(
|
||||
_("Please add a new card first."),
|
||||
parent=self)
|
||||
return
|
||||
card = self.m.cardModels[row]
|
||||
count = self.deck.cardModelUseCount(card)
|
||||
if count:
|
||||
if not ui.utils.askUser(
|
||||
_("This model is used by %d cards. If you delete it,\n"
|
||||
"all the cards will be deleted too. If you just\n"
|
||||
"want to prevent the creation of future cards with\n"
|
||||
"this model, please use the 'disable' button\n"
|
||||
"instead.\n\nReally delete these cards?") % count,
|
||||
parent=self):
|
||||
return
|
||||
self.deck.deleteCardModel(self.m, card)
|
||||
self.updateCards()
|
||||
|
||||
def toggleCard(self):
|
||||
row = self.dialog.cardList.currentRow()
|
||||
if row == -1:
|
||||
return
|
||||
card = self.m.cardModels[row]
|
||||
active = 0
|
||||
for c in self.m.cardModels:
|
||||
if c.active:
|
||||
active += 1
|
||||
if active < 2 and card.active:
|
||||
ui.utils.showWarning(
|
||||
_("Please enable a different model first."),
|
||||
parent=self)
|
||||
return
|
||||
card.active = not card.active
|
||||
self.updateToggleButtonText(card)
|
||||
self.updateCards()
|
||||
self.m.setModified()
|
||||
self.deck.setModified()
|
||||
|
||||
def moveCardUp(self):
|
||||
row = self.dialog.cardList.currentRow()
|
||||
if row == -1:
|
||||
return
|
||||
if row == 0:
|
||||
return
|
||||
card = self.m.cardModels[row]
|
||||
tCard = self.m.cardModels[row - 1]
|
||||
self.m.cardModels.remove(card)
|
||||
self.m.cardModels.insert(row - 1, card)
|
||||
if card.id not in self.cardOrdinalUpdatedIds:
|
||||
self.cardOrdinalUpdatedIds.append(card.id)
|
||||
if tCard.id not in self.cardOrdinalUpdatedIds:
|
||||
self.cardOrdinalUpdatedIds.append(tCard.id)
|
||||
self.ignoreCardUpdate = True
|
||||
self.updateCards(row - 1)
|
||||
self.ignoreCardUpdate = False
|
||||
|
||||
def moveCardDown(self):
|
||||
row = self.dialog.cardList.currentRow()
|
||||
if row == -1:
|
||||
return
|
||||
if row == len(self.m.cardModels) - 1:
|
||||
return
|
||||
card = self.m.cardModels[row]
|
||||
tCard = self.m.cardModels[row + 1]
|
||||
self.m.cardModels.remove(card)
|
||||
self.m.cardModels.insert(row + 1, card)
|
||||
if card.id not in self.cardOrdinalUpdatedIds:
|
||||
self.cardOrdinalUpdatedIds.append(card.id)
|
||||
if tCard.id not in self.cardOrdinalUpdatedIds:
|
||||
self.cardOrdinalUpdatedIds.append(tCard.id)
|
||||
self.ignoreCardUpdate = True
|
||||
self.updateCards(row + 1)
|
||||
self.ignoreCardUpdate = False
|
||||
|
||||
# Cleanup
|
||||
##########################################################################
|
||||
|
||||
def reject(self):
|
||||
"Save user settings on close."
|
||||
# update properties
|
||||
mname = unicode(self.dialog.name.text())
|
||||
if not mname:
|
||||
mname = _("Model")
|
||||
self.updateField(self.m, 'name', mname)
|
||||
self.updateField(self.m, 'description',
|
||||
unicode(self.dialog.description.toPlainText()))
|
||||
self.updateField(self.m, 'tags',
|
||||
unicode(self.dialog.tags.text()))
|
||||
self.updateField(self.m, 'features',
|
||||
unicode(self.dialog.decorators.text()))
|
||||
try:
|
||||
self.updateField(self.m, 'spacing',
|
||||
float(self.dialog.spacing.text()))
|
||||
self.updateField(self.m, 'initialSpacing',
|
||||
float(self.dialog.initialSpacing.text())*60)
|
||||
except ValueError:
|
||||
pass
|
||||
# before field, or it's overwritten
|
||||
self.saveCurrentCard()
|
||||
self.saveCurrentField()
|
||||
# rebuild ordinals if changed
|
||||
if len(self.fieldOrdinalUpdatedIds) > 0:
|
||||
self.deck.rebuildFieldOrdinals(self.m.id, self.fieldOrdinalUpdatedIds)
|
||||
self.m.setModified()
|
||||
self.deck.setModified()
|
||||
if len(self.cardOrdinalUpdatedIds) > 0:
|
||||
self.deck.rebuildCardOrdinals(self.cardOrdinalUpdatedIds)
|
||||
self.m.setModified()
|
||||
self.deck.setModified()
|
||||
# if changed, reset deck
|
||||
if self.origModTime != self.deck.modified:
|
||||
self.parent.reset()
|
||||
if self.onFinish:
|
||||
self.onFinish()
|
||||
QDialog.reject(self)
|
195
ankiqt/ui/preferences.py
Normal file
|
@ -0,0 +1,195 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Copyright: Damien Elmes <anki@ichi2.net>
|
||||
# License: GNU GPL, version 3 or later; http://www.gnu.org/copyleft/gpl.html
|
||||
|
||||
import copy, sys
|
||||
from PyQt4.QtGui import *
|
||||
from PyQt4.QtCore import *
|
||||
import anki, anki.utils
|
||||
from anki.facts import Fact
|
||||
from anki.stdmodels import JapaneseModel
|
||||
from ankiqt import ui
|
||||
import ankiqt.forms
|
||||
|
||||
class Preferences(QDialog):
|
||||
|
||||
def __init__(self, parent, config):
|
||||
QDialog.__init__(self, parent)
|
||||
self.origConfig = config
|
||||
self.parent = parent
|
||||
self.config = copy.copy(self.origConfig)
|
||||
self.origInterfaceLang = self.config['interfaceLang']
|
||||
self.dialog = ankiqt.forms.preferences.Ui_Preferences()
|
||||
self.dialog.setupUi(self)
|
||||
self.supportedLanguages = [
|
||||
(_("English"), "en_US"),
|
||||
(_("Czech"), "cs_CZ"),
|
||||
(_("French"), "fr_FR"),
|
||||
(_("German"), "de_DE"),
|
||||
(_("Japanese"), "ja_JP"),
|
||||
(_("Korean"), "ko_KR"),
|
||||
(_("Spanish"), "es_ES"),
|
||||
]
|
||||
self.setupLang()
|
||||
self.setupFont()
|
||||
self.setupColour()
|
||||
self.setupSync()
|
||||
self.setupSave()
|
||||
self.setupAdvanced()
|
||||
self.show()
|
||||
|
||||
def accept(self):
|
||||
self.updateSync()
|
||||
self.updateSave()
|
||||
self.updateAdvanced()
|
||||
self.config['interfaceLang'] = self.origConfig['interfaceLang']
|
||||
self.origConfig.update(self.config)
|
||||
self.origConfig.save()
|
||||
self.parent.setLang()
|
||||
self.parent.moveToState("auto")
|
||||
self.done(0)
|
||||
|
||||
def reject(self):
|
||||
self.origConfig['interfaceLang'] = self.origInterfaceLang
|
||||
self.parent.setLang()
|
||||
self.done(0)
|
||||
|
||||
def setupLang(self):
|
||||
# interface lang
|
||||
for (lang, code) in self.supportedLanguages:
|
||||
self.dialog.interfaceLang.addItem(lang)
|
||||
self.connect(self.dialog.interfaceLang,
|
||||
SIGNAL("currentIndexChanged(QString)"),
|
||||
self.interfaceLangChanged)
|
||||
self.dialog.interfaceLang.setCurrentIndex(self.codeToIndex(self.config['interfaceLang']))
|
||||
|
||||
def interfaceLangChanged(self):
|
||||
self.origConfig['interfaceLang'] = (
|
||||
self.supportedLanguages[self.dialog.interfaceLang.currentIndex()])[1]
|
||||
self.parent.setLang()
|
||||
self.dialog.retranslateUi(self)
|
||||
|
||||
fonts = (
|
||||
"interface",
|
||||
"lastCard",
|
||||
"edit",
|
||||
)
|
||||
|
||||
def loadCurrentFonts(self):
|
||||
for font in self.fonts:
|
||||
# family init
|
||||
getattr(self.dialog, font + "Family").setCurrentFont(QFont(
|
||||
self.config[font + "FontFamily"]))
|
||||
# size init
|
||||
getattr(self.dialog, font + "Size").setValue(
|
||||
self.config[font + "FontSize"])
|
||||
|
||||
def setupFont(self):
|
||||
self.loadCurrentFonts()
|
||||
for font in self.fonts:
|
||||
# family change
|
||||
family = font + "Family"
|
||||
chngFunc = lambda qfont, type=font: self.familyChanged(qfont, type)
|
||||
self.connect(getattr(self.dialog, family),
|
||||
SIGNAL("currentFontChanged(QFont)"),
|
||||
chngFunc)
|
||||
|
||||
# size change
|
||||
size = font + "Size"
|
||||
chngFunc = lambda size, type=font: self.sizeChanged(size, type)
|
||||
self.connect(getattr(self.dialog, size),
|
||||
SIGNAL("valueChanged(int)"),
|
||||
chngFunc)
|
||||
|
||||
def familyChanged(self, qfont, type):
|
||||
self.config[type + "FontFamily"] = unicode(qfont.family())
|
||||
getattr(self.dialog, type + "Family").setFocus()
|
||||
|
||||
def sizeChanged(self, size, type):
|
||||
self.config[type + "FontSize"] = size
|
||||
getattr(self.dialog, type + "Size").setFocus()
|
||||
|
||||
def setupColour(self):
|
||||
if sys.platform.startswith("darwin"):
|
||||
# mac widgets don't show colours
|
||||
self.plastiqueStyle = QStyleFactory.create("plastique")
|
||||
for c in ("interface", "lastCard", "background"):
|
||||
colour = c + "Colour"
|
||||
button = getattr(self.dialog, colour)
|
||||
if sys.platform.startswith("darwin"):
|
||||
button.setStyle(self.plastiqueStyle)
|
||||
button.setPalette(QPalette(QColor(
|
||||
self.config[colour])))
|
||||
self.connect(button, SIGNAL("clicked()"),
|
||||
lambda b=button, t=c, : self.colourClicked(b, t))
|
||||
|
||||
def colourClicked(self, button, type):
|
||||
new = QColorDialog.getColor(button.palette().window().color(), self)
|
||||
if new.isValid():
|
||||
self.config[type + "Colour"] = str(new.name())
|
||||
button.setPalette(QPalette(new))
|
||||
|
||||
def setupSync(self):
|
||||
self.dialog.syncOnOpen.setChecked(self.config['syncOnLoad'])
|
||||
self.dialog.syncOnClose.setChecked(self.config['syncOnClose'])
|
||||
self.dialog.syncUser.setText(self.config['syncUsername'])
|
||||
self.dialog.syncPass.setText(self.config['syncPassword'])
|
||||
|
||||
def updateSync(self):
|
||||
self.config['syncOnLoad'] = self.dialog.syncOnOpen.isChecked()
|
||||
self.config['syncOnClose'] = self.dialog.syncOnClose.isChecked()
|
||||
self.config['syncUsername'] = unicode(self.dialog.syncUser.text())
|
||||
self.config['syncPassword'] = unicode(self.dialog.syncPass.text())
|
||||
|
||||
def setupSave(self):
|
||||
self.dialog.saveAfterEveryNum.setValue(self.config['saveAfterAnswerNum'])
|
||||
self.dialog.saveAfterEvery.setChecked(self.config['saveAfterAnswer'])
|
||||
self.dialog.saveAfterAdding.setChecked(self.config['saveAfterAdding'])
|
||||
self.dialog.saveAfterAddingNum.setValue(self.config['saveAfterAddingNum'])
|
||||
self.dialog.saveWhenClosing.setChecked(self.config['saveOnClose'])
|
||||
|
||||
def updateSave(self):
|
||||
self.config['saveAfterAnswer'] = self.dialog.saveAfterEvery.isChecked()
|
||||
self.config['saveAfterAnswerNum'] = self.dialog.saveAfterEveryNum.value()
|
||||
self.config['saveAfterAdding'] = self.dialog.saveAfterAdding.isChecked()
|
||||
self.config['saveAfterAddingNum'] = self.dialog.saveAfterAddingNum.value()
|
||||
self.config['saveOnClose'] = self.dialog.saveWhenClosing.isChecked()
|
||||
|
||||
def setupAdvanced(self):
|
||||
self.dialog.showToolbar.setChecked(self.config['showToolbar'])
|
||||
self.dialog.compactEaseButtons.setChecked(
|
||||
self.config['easeButtonStyle'] != 'standard')
|
||||
self.dialog.tallButtons.setChecked(
|
||||
self.config['easeButtonHeight'] != 'standard')
|
||||
self.dialog.suppressEstimates.setChecked(self.config['suppressEstimates'])
|
||||
self.dialog.suppressLastCardInterval.setChecked(self.config['suppressLastCardInterval'])
|
||||
self.dialog.suppressLastCardContent.setChecked(self.config['suppressLastCardContent'])
|
||||
self.dialog.showTray.setChecked(self.config['showTray'])
|
||||
self.dialog.showTimer.setChecked(self.config['showTimer'])
|
||||
self.dialog.editCurrentOnly.setChecked(self.config['editCurrentOnly'])
|
||||
|
||||
def updateAdvanced(self):
|
||||
self.config['showToolbar'] = self.dialog.showToolbar.isChecked()
|
||||
if self.dialog.compactEaseButtons.isChecked():
|
||||
self.config['easeButtonStyle'] = 'compact'
|
||||
else:
|
||||
self.config['easeButtonStyle'] = 'standard'
|
||||
if self.dialog.tallButtons.isChecked():
|
||||
self.config['easeButtonHeight'] = 'tall'
|
||||
else:
|
||||
self.config['easeButtonHeight'] = 'standard'
|
||||
self.config['suppressLastCardInterval'] = self.dialog.suppressLastCardInterval.isChecked()
|
||||
self.config['suppressLastCardContent'] = self.dialog.suppressLastCardContent.isChecked()
|
||||
self.config['showTray'] = self.dialog.showTray.isChecked()
|
||||
self.config['showTimer'] = self.dialog.showTimer.isChecked()
|
||||
self.config['suppressEstimates'] = self.dialog.suppressEstimates.isChecked()
|
||||
self.config['editCurrentOnly'] = self.dialog.editCurrentOnly.isChecked()
|
||||
|
||||
def codeToIndex(self, code):
|
||||
n = 0
|
||||
for (lang, type) in self.supportedLanguages:
|
||||
if code == type:
|
||||
return n
|
||||
n += 1
|
||||
# default to english
|
||||
return self.codeToIndex("en_US")
|
265
ankiqt/ui/status.py
Normal file
|
@ -0,0 +1,265 @@
|
|||
# Copyright: Damien Elmes <anki@ichi2.net>
|
||||
# License: GNU GPL, version 3 or later; http://www.gnu.org/copyleft/gpl.html
|
||||
|
||||
from PyQt4.QtGui import *
|
||||
from PyQt4.QtCore import *
|
||||
import anki
|
||||
import sys, time
|
||||
from ankiqt import ui
|
||||
|
||||
class QClickableLabel(QLabel):
|
||||
url = "http://ichi2.net/anki/wiki/TheTimerAndShortQuestions"
|
||||
def mouseReleaseEvent(self, evt):
|
||||
QDesktopServices.openUrl(QUrl(self.url))
|
||||
|
||||
# Status bar
|
||||
##########################################################################
|
||||
|
||||
class StatusView(object):
|
||||
"Manage the status bar as we transition through various states."
|
||||
|
||||
warnTime = 10
|
||||
|
||||
def __init__(self, parent):
|
||||
self.main = parent
|
||||
self.statusbar = parent.mainWin.statusbar
|
||||
self.shown = []
|
||||
self.hideBorders()
|
||||
self.setState("noDeck")
|
||||
self.thinkingTimer = QTimer(parent)
|
||||
self.thinkingTimer.start(1000)
|
||||
self.timer = None
|
||||
parent.connect(self.thinkingTimer, SIGNAL("timeout()"),
|
||||
self.drawTimer)
|
||||
|
||||
# State control
|
||||
##########################################################################
|
||||
|
||||
def setState(self, state):
|
||||
"Change to STATE, and update the display."
|
||||
self.state = state
|
||||
if self.state == "initial":
|
||||
self.showDeckStatus()
|
||||
self.updateProgressGoal()
|
||||
elif self.state == "noDeck":
|
||||
self.hideDeckStatus()
|
||||
elif self.state in ("showQuestion",
|
||||
"deckFinished",
|
||||
"deckEmpty"):
|
||||
self.redraw()
|
||||
|
||||
# Setup and teardown
|
||||
##########################################################################
|
||||
|
||||
def vertSep(self):
|
||||
spacer = QFrame()
|
||||
spacer.setFrameStyle(QFrame.VLine)
|
||||
spacer.setFrameShadow(QFrame.Plain)
|
||||
return spacer
|
||||
|
||||
def showDeckStatus(self):
|
||||
if self.shown:
|
||||
return
|
||||
progressBarSize = (50, 8)
|
||||
# small spacer
|
||||
self.initialSpace = QWidget()
|
||||
self.addWidget(self.initialSpace, 1)
|
||||
# remaining & eta
|
||||
self.remText = QLabel()
|
||||
self.addWidget(self.remText, 0)
|
||||
self.addWidget(self.vertSep(), 0)
|
||||
self.etaText = QLabel()
|
||||
self.etaText.setToolTip(_(
|
||||
"<h1>Estimated time</h1>"
|
||||
"This is how long it will take to complete the current mode "
|
||||
"at your current pace."))
|
||||
self.addWidget(self.etaText, 0)
|
||||
# progress&retention
|
||||
self.addWidget(self.vertSep(), 0)
|
||||
vbox = QVBoxLayout()
|
||||
vbox.setSpacing(0)
|
||||
vbox.setContentsMargins(0,0,0,0)
|
||||
self.progressBar = QProgressBar()
|
||||
self.progressBar.setFixedSize(*progressBarSize)
|
||||
self.progressBar.setMaximum(100)
|
||||
self.progressBar.setTextVisible(False)
|
||||
vbox.addWidget(self.progressBar, 0)
|
||||
self.retentionBar = QProgressBar()
|
||||
self.retentionBar.setFixedSize(*progressBarSize)
|
||||
self.retentionBar.setMaximum(100)
|
||||
self.retentionBar.setTextVisible(False)
|
||||
vbox.addWidget(self.retentionBar, 0)
|
||||
self.combinedBar = QWidget()
|
||||
self.combinedBar.setLayout(vbox)
|
||||
self.addWidget(self.combinedBar, 0)
|
||||
# timer
|
||||
self.addWidget(self.vertSep(), 0)
|
||||
self.timer = QClickableLabel()
|
||||
self.timer.setText("00:00")
|
||||
if sys.platform.startswith("darwin"):
|
||||
self.timer.setFixedWidth(40)
|
||||
self.addWidget(self.timer)
|
||||
# mac
|
||||
if sys.platform.startswith("darwin"):
|
||||
# we don't want non-coloured, throbbing widgets
|
||||
self.plastiqueStyle = QStyleFactory.create("plastique")
|
||||
self.progressBar.setStyle(self.plastiqueStyle)
|
||||
self.retentionBar.setStyle(self.plastiqueStyle)
|
||||
self.optionsButton = QPushButton()
|
||||
self.optionsButton.setIcon(QIcon(":/icons/configure.png"))
|
||||
self.optionsButton.setFixedSize(20, 20)
|
||||
self.optionsButton.setFocusPolicy(Qt.NoFocus)
|
||||
self.optionsButton.setToolTip(_(
|
||||
"Click this button to customize\n"
|
||||
"the way Anki shows you cards."))
|
||||
self.main.connect(self.optionsButton,
|
||||
SIGNAL("clicked()"),
|
||||
self.onConfigure)
|
||||
self.addWidget(self.optionsButton)
|
||||
self.redraw()
|
||||
|
||||
def addWidget(self, w, stretch=0, perm=True):
|
||||
if perm:
|
||||
self.statusbar.addPermanentWidget(w, stretch)
|
||||
else:
|
||||
self.statusbar.addWidget(w, stretch)
|
||||
self.shown.append(w)
|
||||
|
||||
def hideDeckStatus(self):
|
||||
for w in self.shown:
|
||||
self.statusbar.removeWidget(w)
|
||||
w.setParent(None)
|
||||
self.shown = []
|
||||
|
||||
def hideBorders(self):
|
||||
"Remove the ugly borders QT places on status bar widgets."
|
||||
self.statusbar.setStyleSheet("::item { border: 0; }")
|
||||
|
||||
def updateProgressGoal(self):
|
||||
return
|
||||
stats = self.main.deck.sched.getStats()
|
||||
self.totalPending = stats['pending']
|
||||
|
||||
# Updating
|
||||
##########################################################################
|
||||
|
||||
def redraw(self):
|
||||
p = QPalette()
|
||||
stats = self.main.deck.getStats()
|
||||
remStr = _("Remaining: ")
|
||||
if self.state == "deckFinished":
|
||||
remStr += "<b>0</b>"
|
||||
elif self.state == "deckEmpty":
|
||||
remStr += "<b>0</b>"
|
||||
else:
|
||||
# remaining string, bolded depending on current card
|
||||
if not self.main.currentCard:
|
||||
remStr += "%(failed1)s + %(successive1)s + %(new1)s"
|
||||
else:
|
||||
q = self.main.deck.queueForCard(self.main.currentCard)
|
||||
if q == "failed":
|
||||
remStr += "<u>%(failed1)s</u> %(successive1)s %(new1)s"
|
||||
elif q == "rev":
|
||||
remStr += "%(failed1)s <u>%(successive1)s</u> %(new1)s"
|
||||
else:
|
||||
remStr += "%(failed1)s %(successive1)s <u>%(new1)s</u>"
|
||||
stats['failed1'] = '<font color=#990000>%s</font>' % stats['failed']
|
||||
stats['successive1'] = '<font color=#000000>%s</font>' % stats['successive']
|
||||
stats['new1'] = '<font color=#0000ff>%s</font>' % stats['new']
|
||||
self.remText.setText(remStr % stats)
|
||||
stats['suspended'] = self.main.deck.suspendedCardCount()
|
||||
stats['spaced'] = self.main.deck.spacedCardCount()
|
||||
self.remText.setToolTip(_(
|
||||
"<h1>Remaining cards</h1>"
|
||||
"The number of cards left to answer."
|
||||
"<p/>There are <b>%(failed)d</b> failed cards due soon.<br>"
|
||||
"There are <b>%(successive)d</b> cards awaiting review.<br>"
|
||||
"There are <b>%(new)d</b> new cards.<br>"
|
||||
"There are <b>%(spaced)d</b> spaced cards.<br>"
|
||||
"There are <b>%(suspended)d</b> suspended cards.") % stats)
|
||||
# eta
|
||||
self.etaText.setText(_("ETA: <b>%(timeLeft)s</b>") % stats)
|
||||
# retention & progress bars
|
||||
p.setColor(QPalette.Base, QColor("black"))
|
||||
p.setColor(QPalette.Button, QColor("black"))
|
||||
self.setProgressColour(p, stats['gMatureYes%'])
|
||||
self.retentionBar.setPalette(p)
|
||||
self.retentionBar.setValue(stats['gMatureYes%'])
|
||||
self.setProgressColour(p, stats['dYesTotal%'])
|
||||
self.progressBar.setPalette(p)
|
||||
self.progressBar.setValue(stats['dYesTotal%'])
|
||||
# tooltips
|
||||
stats['avgTime'] = anki.utils.fmtTimeSpan(stats['dAverageTime'], point=2)
|
||||
stats['revTime'] = anki.utils.fmtTimeSpan(stats['dReviewTime'], point=2)
|
||||
tip = _("""<h1>Performance</h1>
|
||||
The top bar shows your performance today. The bottom bar shows your<br>
|
||||
performance on cards scheduled for 21 days or more. The bottom bar should<br>
|
||||
generally be between 80-95%% - lower and you're forgetting mature cards<br>
|
||||
too often, higher and you're spending too much time reviewing.
|
||||
<h2>Reviews today</h2>
|
||||
<b>Correct today: %(dYesTotal%)0.1f%%
|
||||
(%(dYesTotal)d of %(dTotal)d)</b><br>
|
||||
Average time per answer: %(avgTime)s<br>
|
||||
Total review time: %(revTime)s""") % stats
|
||||
stats['avgTime'] = anki.utils.fmtTimeSpan(stats['gAverageTime'], point=2)
|
||||
stats['revTime'] = anki.utils.fmtTimeSpan(stats['gReviewTime'], point=2)
|
||||
tip += _("""<h2>All Reviews</h2>
|
||||
<b>Correct over a month: %(gMatureYes%)0.1f%%
|
||||
(%(gMatureYes)d of %(gMatureTotal)d)</b><br>
|
||||
Average time per answer: %(avgTime)s<br>
|
||||
Total review time: %(revTime)s<br>
|
||||
Correct under a month: %(gYoungYes%)0.1f%%
|
||||
(%(gYoungYes)d of %(gYoungTotal)d)<br>
|
||||
Correct first time: %(gNewYes%)0.1f%%
|
||||
(%(gNewYes)d of %(gNewTotal)d)<br>
|
||||
Total correct: %(gYesTotal%)0.1f%%
|
||||
(%(gYesTotal)d of %(gTotal)d)""") % stats
|
||||
self.combinedBar.setToolTip(tip)
|
||||
if self.main.config['showTimer']:
|
||||
self.timer.setVisible(True)
|
||||
self.drawTimer()
|
||||
self.timer.setToolTip(_("""
|
||||
<h1>Time</h1>
|
||||
Anki tracks how long you spend looking at a card.<br>
|
||||
This time is used to calculate the ETA, but not used<br>
|
||||
for scheduling.<br><br>
|
||||
You should aim to answer each question within<br>
|
||||
10 seconds. Click the timer to learn more."""))
|
||||
else:
|
||||
self.timer.setVisible(False)
|
||||
|
||||
def setProgressColour(self, palette, perc):
|
||||
if perc == 0:
|
||||
palette.setColor(QPalette.Highlight, QColor("black"))
|
||||
elif perc < 50:
|
||||
palette.setColor(QPalette.Highlight, QColor("#ee0000"))
|
||||
elif perc < 65:
|
||||
palette.setColor(QPalette.Highlight, QColor("#ee7700"))
|
||||
elif perc < 75:
|
||||
palette.setColor(QPalette.Highlight, QColor("#eeee00"))
|
||||
else:
|
||||
palette.setColor(QPalette.Highlight, QColor("#00ee00"))
|
||||
|
||||
def drawTimer(self):
|
||||
if not self.main.config['showTimer']:
|
||||
return
|
||||
if not self.timer:
|
||||
return
|
||||
if self.main.state in "showQuestion":
|
||||
t = self.main.currentCard.thinkingTime()
|
||||
if t < 60:
|
||||
if t < StatusView.warnTime:
|
||||
col="#000000"
|
||||
else:
|
||||
col="#FF3300"
|
||||
self.timer.setText('<font color="%s">00:%02d</font>' % (col, t))
|
||||
else:
|
||||
self.timer.setText('<font color="#FF0000"><b>01:00</b></font>')
|
||||
elif self.main.state == "showAnswer":
|
||||
pass
|
||||
else:
|
||||
self.timer.setText("00:00")
|
||||
|
||||
def onConfigure(self):
|
||||
self.main.deckProperties = ui.deckproperties.DeckProperties(self.main)
|
||||
self.main.deckProperties.dialog.qtabwidget.setCurrentIndex(2)
|
171
ankiqt/ui/sync.py
Normal file
|
@ -0,0 +1,171 @@
|
|||
# Copyright: Damien Elmes <anki@ichi2.net>
|
||||
# License: GNU GPL, version 3 or later; http://www.gnu.org/copyleft/gpl.html
|
||||
|
||||
from PyQt4.QtGui import *
|
||||
from PyQt4.QtCore import *
|
||||
import os, types, socket, time
|
||||
import ankiqt
|
||||
import anki
|
||||
from anki.sync import SyncClient, HttpSyncServerProxy
|
||||
from anki.errors import *
|
||||
from anki import DeckStorage
|
||||
import ankiqt.forms
|
||||
|
||||
# Synchronising a deck with a public server
|
||||
##########################################################################
|
||||
|
||||
class Sync(QThread):
|
||||
|
||||
def __init__(self, parent, user, pwd, interactive, create, onlyMerge):
|
||||
QThread.__init__(self)
|
||||
self.parent = parent
|
||||
self.interactive = interactive
|
||||
self.user = user
|
||||
self.pwd = pwd
|
||||
self.create = create
|
||||
self.ok = True
|
||||
self.onlyMerge = onlyMerge
|
||||
|
||||
def setStatus(self, msg, timeout=5000):
|
||||
self.emit(SIGNAL("setStatus"), msg, timeout)
|
||||
|
||||
def run(self):
|
||||
self.syncDeck()
|
||||
|
||||
def error(self, error):
|
||||
self.setStatus(self.getErrorMessage(error))
|
||||
if self.onlyMerge:
|
||||
# new file needs cleaning up
|
||||
self.emit(SIGNAL("cleanNewDeck"))
|
||||
else:
|
||||
self.emit(SIGNAL("syncFinished"))
|
||||
|
||||
def getErrorMessage(self, error):
|
||||
if error.data.get('status') == "invalidUserPass":
|
||||
msg=_("Please double-check your username/password.")
|
||||
elif error.data.get('status') == "oldVersion":
|
||||
msg=_("The sync protocol has changed. Please upgrade.")
|
||||
elif error.data.get('type') == "noResponse":
|
||||
msg=_("Server is down or operation failed.")
|
||||
else:
|
||||
msg=_("Unknown error: %s") % `error.data`
|
||||
return msg
|
||||
|
||||
def connect(self, *args):
|
||||
# connect, check auth
|
||||
proxy = HttpSyncServerProxy(self.user, self.pwd)
|
||||
proxy.connect("ankiqt-" + ankiqt.appVersion)
|
||||
return proxy
|
||||
|
||||
def syncDeck(self):
|
||||
self.setStatus(_("Connecting.."), 0)
|
||||
try:
|
||||
proxy = self.connect()
|
||||
except SyncError, e:
|
||||
return self.error(e)
|
||||
# exists on server?
|
||||
if not proxy.hasDeck(self.parent.syncName):
|
||||
if self.create:
|
||||
try:
|
||||
proxy.createDeck(self.parent.syncName)
|
||||
except SyncError, e:
|
||||
return self.error(e)
|
||||
else:
|
||||
self.emit(SIGNAL("noMatchingDeck"), proxy.decks.keys(),
|
||||
not self.onlyMerge)
|
||||
self.setStatus("")
|
||||
return
|
||||
timediff = abs(proxy.timestamp - time.time())
|
||||
if timediff > 60:
|
||||
self.emit(SIGNAL("syncClockOff"), timediff)
|
||||
return
|
||||
# reconnect
|
||||
try:
|
||||
self.deck = DeckStorage.Deck(self.parent.deckPath, rebuild=False,
|
||||
backup=False, lock=True)
|
||||
client = SyncClient(self.deck)
|
||||
client.setServer(proxy)
|
||||
proxy.deckName = self.parent.syncName
|
||||
# need to do anything?
|
||||
if not client.prepareSync():
|
||||
self.setStatus(_("Sync: nothing to do"))
|
||||
self.deck.close()
|
||||
self.emit(SIGNAL("syncFinished"))
|
||||
return
|
||||
start = time.time()
|
||||
# summary
|
||||
self.setStatus(_("Fetching summary from server.."), 0)
|
||||
sums = client.summaries()
|
||||
# diff
|
||||
self.setStatus(_("Determining differences.."), 0)
|
||||
payload = client.genPayload(sums)
|
||||
# send payload
|
||||
pr = client.payloadChangeReport(payload)
|
||||
self.setStatus("<br>" + pr + "<br>", 0)
|
||||
self.setStatus(_("Sending payload..."), 0)
|
||||
res = client.server.applyPayload(payload)
|
||||
# apply reply
|
||||
self.setStatus(_("Applying reply.."), 0)
|
||||
client.applyPayloadReply(res)
|
||||
# finished. save deck, preserving mod time
|
||||
self.setStatus(_("Sync complete."))
|
||||
self.deck.lastLoaded = self.deck.modified
|
||||
self.deck.s.flush()
|
||||
self.deck.s.commit()
|
||||
# close and send signal to main thread
|
||||
self.deck.close()
|
||||
taken = time.time() - start
|
||||
if taken < 2.5:
|
||||
time.sleep(2.5 - taken)
|
||||
self.emit(SIGNAL("syncFinished"))
|
||||
except Exception, e:
|
||||
self.deck.close()
|
||||
# cheap hack to ensure message is displayed
|
||||
err = `getattr(e, 'data', None) or e`
|
||||
self.setStatus(_("Syncing failed: %(a)s") % {
|
||||
'a': err})
|
||||
time.sleep(3)
|
||||
self.emit(SIGNAL("syncFinished"))
|
||||
|
||||
# Choosing a deck to sync to
|
||||
##########################################################################
|
||||
|
||||
class DeckChooser(QDialog):
|
||||
|
||||
def __init__(self, parent, decks, create):
|
||||
QDialog.__init__(self, parent)
|
||||
self.parent = parent
|
||||
self.decks = decks
|
||||
self.dialog = ankiqt.forms.syncdeck.Ui_DeckChooser()
|
||||
self.dialog.setupUi(self)
|
||||
self.create = create
|
||||
if self.create:
|
||||
self.dialog.decks.addItem(QListWidgetItem(
|
||||
_("Create '%s' on server") % self.parent.syncName))
|
||||
self.decks.sort()
|
||||
for name in decks:
|
||||
name = os.path.splitext(name)[0]
|
||||
item = QListWidgetItem(_("Merge with '%s' on server") % name)
|
||||
self.dialog.decks.addItem(item)
|
||||
self.dialog.decks.setCurrentRow(0)
|
||||
# the list widget will swallow the enter key
|
||||
s = QShortcut(QKeySequence("Return"), self)
|
||||
self.connect(s, SIGNAL("activated()"), self.accept)
|
||||
self.name = None
|
||||
|
||||
def getName(self):
|
||||
self.exec_()
|
||||
return self.name
|
||||
|
||||
def accept(self):
|
||||
idx = self.dialog.decks.currentRow()
|
||||
if self.create:
|
||||
offset = 1
|
||||
else:
|
||||
offset = 0
|
||||
if idx == 0 and self.create:
|
||||
self.name = self.parent.syncName
|
||||
else:
|
||||
self.name = self.decks[self.dialog.decks.currentRow() - offset]
|
||||
self.close()
|
||||
|
53
ankiqt/ui/tagedit.py
Normal file
|
@ -0,0 +1,53 @@
|
|||
# Copyright: Damien Elmes <anki@ichi2.net>
|
||||
# License: GNU GPL, version 3 or later; http://www.gnu.org/copyleft/gpl.html
|
||||
|
||||
from PyQt4.QtGui import *
|
||||
from PyQt4.QtCore import *
|
||||
from anki.utils import parseTags
|
||||
|
||||
class TagEdit(QLineEdit):
|
||||
|
||||
def __init__(self, parent, *args):
|
||||
QLineEdit.__init__(self, parent, *args)
|
||||
self.model = QStringListModel()
|
||||
self.completer = TagCompleter(self.model, parent)
|
||||
self.completer.setCompletionMode(QCompleter.UnfilteredPopupCompletion)
|
||||
self.completer.setCaseSensitivity(Qt.CaseInsensitive)
|
||||
self.setCompleter(self.completer)
|
||||
|
||||
def setDeck(self, deck):
|
||||
"Set the current deck, updating list of available tags."
|
||||
self.deck = deck
|
||||
tags = self.deck.allTags()
|
||||
self.model.setStringList(
|
||||
QStringList(sorted(tags)))
|
||||
|
||||
def keyPressEvent(self, evt):
|
||||
if evt.key() in (Qt.Key_Enter,
|
||||
Qt.Key_Return):
|
||||
evt.accept()
|
||||
cur = self.completer.currentCompletion()
|
||||
if cur and not str(cur).strip().endswith(","):
|
||||
self.setText(self.completer.currentCompletion())
|
||||
else:
|
||||
self.completer.popup().close()
|
||||
else:
|
||||
QLineEdit.keyPressEvent(self, evt)
|
||||
|
||||
class TagCompleter(QCompleter):
|
||||
|
||||
def __init__(self, *args):
|
||||
QCompleter.__init__(self, *args)
|
||||
self.tags = []
|
||||
|
||||
def splitPath(self, str):
|
||||
self.tags = parseTags(unicode(str))
|
||||
if self.tags:
|
||||
return QStringList(self.tags[-1])
|
||||
return QStringList("")
|
||||
|
||||
def pathFromIndex(self, idx):
|
||||
ret = QCompleter.pathFromIndex(self, idx)
|
||||
self.tags = self.tags[0:-1]
|
||||
self.tags.append(unicode(ret))
|
||||
return ", ".join(self.tags)
|
73
ankiqt/ui/tray.py
Normal file
|
@ -0,0 +1,73 @@
|
|||
# Copyright: Richard Colley <richard.colley@rcolley.com>
|
||||
# License: GNU GPL, version 3 or later; http://www.gnu.org/copyleft/gpl.html
|
||||
|
||||
from PyQt4 import QtGui, QtCore
|
||||
Qt = QtCore.Qt
|
||||
|
||||
class AnkiTrayIcon( QtCore.QObject ):
|
||||
"""
|
||||
Enable minimize to tray
|
||||
"""
|
||||
|
||||
def __init__( self, mw ):
|
||||
QtCore.QObject.__init__( self, mw )
|
||||
self.mw = mw
|
||||
self.anki_visible = True
|
||||
if (QtGui.QSystemTrayIcon.isSystemTrayAvailable() and
|
||||
mw.config['showTray']):
|
||||
self.ti = QtGui.QSystemTrayIcon( mw )
|
||||
if self.ti:
|
||||
self.mw.addHook("quit", self.onQuit)
|
||||
self.ti.setIcon( QtGui.QIcon(":/icons/anki.png") )
|
||||
self.ti.setToolTip( "Anki" )
|
||||
|
||||
# hook signls, and Anki state changes
|
||||
mw.addView( self )
|
||||
mw.connect(self.ti, QtCore.SIGNAL("activated(QSystemTrayIcon::ActivationReason)"), lambda i: self.activated(i))
|
||||
mw.connect(self.ti, QtCore.SIGNAL("messageClicked()"), lambda : self.messageClicked())
|
||||
self.ti.show()
|
||||
|
||||
def showMain( self ):
|
||||
self.mw.showNormal()
|
||||
self.mw.activateWindow()
|
||||
self.mw.raise_()
|
||||
self.anki_visible = True
|
||||
|
||||
def hideMain( self ):
|
||||
self.mw.hide()
|
||||
self.anki_visible = False
|
||||
|
||||
def activated( self, reason ):
|
||||
if self.anki_visible:
|
||||
self.hideMain()
|
||||
else:
|
||||
self.showMain()
|
||||
|
||||
def messageClicked( self ):
|
||||
if not self.anki_visible:
|
||||
self.showMain()
|
||||
|
||||
def setToolTip( self, message ):
|
||||
self.ti.setToolTip( message )
|
||||
|
||||
def showMessage( self, message ):
|
||||
if self.ti.supportsMessages():
|
||||
self.ti.showMessage( "Anki", message )
|
||||
|
||||
def setState( self, state ):
|
||||
if state == "showQuestion":
|
||||
if not self.anki_visible:
|
||||
self.showMessage( "A new card is available for review, click this message to display Anki" )
|
||||
self.setToolTip( "Anki - displaying question" )
|
||||
elif state == "showAnswer":
|
||||
self.setToolTip( "Anki - displaying answer" )
|
||||
elif state == "noDeck":
|
||||
self.setToolTip( "Anki - no deck" )
|
||||
elif state == "deckFinished":
|
||||
if self.mw and self.mw.deck:
|
||||
self.setToolTip( "Anki - next card in " + self.mw.deck.earliestTimeStr() )
|
||||
else:
|
||||
self.setToolTip( "Anki" )
|
||||
|
||||
def onQuit(self):
|
||||
self.ti.deleteLater()
|
16
ankiqt/ui/unsaved.py
Normal file
|
@ -0,0 +1,16 @@
|
|||
# Copyright: Damien Elmes <anki@ichi2.net>
|
||||
# License: GNU GPL, version 3 or later; http://www.gnu.org/copyleft/gpl.html
|
||||
|
||||
from PyQt4.QtGui import *
|
||||
import ankiqt.forms
|
||||
|
||||
save = QMessageBox.Save
|
||||
discard = QMessageBox.Discard
|
||||
cancel = QMessageBox.Cancel
|
||||
def ask(parent):
|
||||
return QMessageBox.question(
|
||||
parent, "Anki",
|
||||
_("""<h1>Unsaved changes</h1>There are unsaved
|
||||
changes. Would you like to save them, discard your
|
||||
changes, or cancel?"""),
|
||||
save | discard | cancel)
|
155
ankiqt/ui/update.py
Normal file
|
@ -0,0 +1,155 @@
|
|||
# Copyright: Damien Elmes <anki@ichi2.net>
|
||||
# License: GNU GPL, version 3 or later; http://www.gnu.org/copyleft/gpl.html
|
||||
|
||||
from PyQt4.QtCore import *
|
||||
from PyQt4.QtGui import *
|
||||
import urllib, urllib2, os, sys, time, httplib
|
||||
import anki, anki.utils, anki.lang, anki.stats
|
||||
import ankiqt
|
||||
import simplejson
|
||||
import tempfile
|
||||
|
||||
#baseUrl = "http://localhost:5000/update/"
|
||||
baseUrl = "http://anki.ichi2.net/update/"
|
||||
|
||||
# when requesting latest version number, gather their version, deck size and
|
||||
# average retention ratio for future development
|
||||
# FIXME: add ability to disable in prefs, warn about anonymous sent info
|
||||
class LatestVersionFinder(QThread):
|
||||
|
||||
def __init__(self, main):
|
||||
QThread.__init__(self)
|
||||
self.main = main
|
||||
self.config = main.config
|
||||
# calculate stats before we start a new thread
|
||||
if self.main.deck != None:
|
||||
deckSize = self.main.deck.cardCount()
|
||||
stats = anki.stats.globalStats(self.main.deck.s)
|
||||
deckRecall = "%0.2f" % (
|
||||
(stats.matureEase3 + stats.matureEase4) /
|
||||
float(stats.matureEase0 +
|
||||
stats.matureEase1 +
|
||||
stats.matureEase2 +
|
||||
stats.matureEase3 +
|
||||
stats.matureEase4 + 0.000001) * 100)
|
||||
pending = "(%d, %d)" % (self.main.deck.seenCardCount(),
|
||||
self.main.deck.newCardCount())
|
||||
ct = self.main.deck.created
|
||||
if ct:
|
||||
ol = anki.lang.getLang()
|
||||
anki.lang.setLang("en")
|
||||
age = anki.utils.fmtTimeSpan(abs(
|
||||
time.time() - ct))
|
||||
anki.lang.setLang(ol)
|
||||
else:
|
||||
age = ""
|
||||
plat=sys.platform
|
||||
pver=sys.version
|
||||
else:
|
||||
deckSize = "nodeck"
|
||||
deckRecall = ""
|
||||
pending = ""
|
||||
age = ""
|
||||
plat=""
|
||||
pver=""
|
||||
d = {"ver": ankiqt.appVersion,
|
||||
"size": deckSize,
|
||||
"rec": deckRecall,
|
||||
"pend": pending,
|
||||
"age": age,
|
||||
"pver": pver,
|
||||
"plat": plat,}
|
||||
self.stats = d
|
||||
|
||||
def run(self):
|
||||
if not self.config['checkForUpdates']:
|
||||
return
|
||||
d = self.stats
|
||||
d['proto'] = 2
|
||||
d = urllib.urlencode(d)
|
||||
try:
|
||||
f = urllib2.urlopen(baseUrl + "getQtVersion", d)
|
||||
except (urllib2.URLError, httplib.BadStatusLine):
|
||||
return
|
||||
resp = f.read()
|
||||
if not resp:
|
||||
return
|
||||
resp = simplejson.loads(resp)
|
||||
if resp['latestVersion'] > ankiqt.appVersion:
|
||||
self.emit(SIGNAL("newVerAvail"), resp)
|
||||
diff = resp['currentTime'] - time.time()
|
||||
if abs(diff) > 300:
|
||||
self.emit(SIGNAL("clockIsOff"), diff)
|
||||
|
||||
class Updater(QThread):
|
||||
|
||||
filename = "anki-update.exe"
|
||||
# FIXME: get when checking version number
|
||||
chunkSize = 428027
|
||||
percChange = 5
|
||||
|
||||
def __init__(self):
|
||||
QThread.__init__(self)
|
||||
|
||||
def setStatus(self, msg, timeout=0):
|
||||
self.emit(SIGNAL("statusChanged"), msg, timeout)
|
||||
|
||||
def run(self):
|
||||
dir = tempfile.mkdtemp(prefix="anki-update")
|
||||
os.chdir(dir)
|
||||
filename = os.path.abspath(self.filename)
|
||||
try:
|
||||
f = urllib2.urlopen(baseUrl + "getQt")
|
||||
except urllib2.URLError:
|
||||
self.setStatus(_("Unable to reach server"))
|
||||
return
|
||||
try:
|
||||
newfile = open(filename, "wb")
|
||||
except:
|
||||
self.setStatus(_("Unable to open file"))
|
||||
return
|
||||
perc = 0
|
||||
while 1:
|
||||
self.setStatus(
|
||||
_("Downloading anki updater - %d%% complete.") % perc)
|
||||
resp = f.read(self.chunkSize)
|
||||
if not resp:
|
||||
break
|
||||
newfile.write(resp)
|
||||
perc += self.percChange
|
||||
if perc > 99:
|
||||
perc = 99
|
||||
newfile.close()
|
||||
self.setStatus(_("Updating.."))
|
||||
os.chdir(os.path.dirname(filename))
|
||||
os.system(os.path.basename(filename))
|
||||
self.setStatus(_("Update complete. Please restart Anki."))
|
||||
os.unlink(filename)
|
||||
|
||||
def askAndUpdate(parent, version=None):
|
||||
version = version['latestVersion']
|
||||
baseStr = (
|
||||
_("""<h1>Anki updated</h1>Anki %s has been released.<br>
|
||||
The release notes are
|
||||
<a href="http://ichi2.net/anki/download/index.html#changes">here</a>.
|
||||
<br><br>""") %
|
||||
version)
|
||||
msg = QMessageBox(parent)
|
||||
msg.setStandardButtons(QMessageBox.Yes | QMessageBox.No)
|
||||
msg.setIcon(QMessageBox.Information)
|
||||
msg.setText(baseStr + _("Would you like to download it now?"))
|
||||
button = QPushButton(_("Ignore this update"))
|
||||
msg.addButton(button, QMessageBox.RejectRole)
|
||||
ret = msg.exec_()
|
||||
if msg.clickedButton() == button:
|
||||
# ignore this update
|
||||
parent.config['suppressUpdate'] = version
|
||||
elif ret == QMessageBox.Yes:
|
||||
if sys.platform == "win32":
|
||||
parent.autoUpdate = Updater()
|
||||
parent.connect(parent.autoUpdate,
|
||||
SIGNAL("statusChanged"),
|
||||
parent.setStatus)
|
||||
parent.autoUpdate.start()
|
||||
else:
|
||||
QDesktopServices.openUrl(QUrl(ankiqt.appWebsite))
|
67
ankiqt/ui/utils.py
Normal file
|
@ -0,0 +1,67 @@
|
|||
# Copyright: Damien Elmes <anki@ichi2.net>
|
||||
# License: GNU GPL, version 3 or later; http://www.gnu.org/copyleft/gpl.html
|
||||
|
||||
from PyQt4.QtGui import *
|
||||
from PyQt4.QtCore import *
|
||||
|
||||
import re, os
|
||||
import ankiqt
|
||||
|
||||
def showWarning(text, parent=None):
|
||||
"Show a small warning with an OK button."
|
||||
if not parent:
|
||||
parent = ankiqt.mw
|
||||
QMessageBox.warning(parent, "Anki", text)
|
||||
|
||||
def showInfo(text, parent=None):
|
||||
"Show a small info window with an OK button."
|
||||
if not parent:
|
||||
parent = ankiqt.mw
|
||||
QMessageBox.information(parent, "Anki", text)
|
||||
|
||||
def askUser(text, parent=None):
|
||||
"Show a yes/no question. Return true if yes."
|
||||
if not parent:
|
||||
parent = ankiqt.mw
|
||||
r = QMessageBox.question(parent, "Anki", text,
|
||||
QMessageBox.Yes | QMessageBox.No)
|
||||
return r == QMessageBox.Yes
|
||||
|
||||
def getText(prompt, parent=None):
|
||||
if not parent:
|
||||
parent = ankiqt.mw
|
||||
(text, ok) = QInputDialog.getText(parent, "Anki", prompt)
|
||||
if not ok:
|
||||
return None
|
||||
return unicode(text)
|
||||
|
||||
def getFile(parent, title, dir, key):
|
||||
"Ask the user for a file. Use DIR as config variable."
|
||||
dirkey = dir+"Directory"
|
||||
file = unicode(QFileDialog.getOpenFileName(
|
||||
parent, title, ankiqt.mw.config.get(dirkey, ""), key))
|
||||
if file:
|
||||
dir = os.path.dirname(file)
|
||||
ankiqt.mw.config[dirkey] = dir
|
||||
return file
|
||||
|
||||
def getSaveFile(parent, title, dir, key, ext):
|
||||
"Ask the user for a file to save. Use DIR as config variable."
|
||||
dirkey = dir+"Directory"
|
||||
file = unicode(QFileDialog.getSaveFileName(
|
||||
parent, title, ankiqt.mw.config.get(dirkey, ""), key,
|
||||
None, QFileDialog.DontConfirmOverwrite))
|
||||
if file:
|
||||
# add extension
|
||||
if not file.lower().endswith(ext):
|
||||
file += ext
|
||||
# save new default
|
||||
dir = os.path.dirname(file)
|
||||
ankiqt.mw.config[dirkey] = dir
|
||||
# check if it exists
|
||||
if os.path.exists(file):
|
||||
if not askUser(
|
||||
_("This file exists. Are you sure you want to overwrite it?"),
|
||||
parent):
|
||||
return None
|
||||
return file
|
269
ankiqt/ui/view.py
Normal file
|
@ -0,0 +1,269 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Copyright: Damien Elmes <anki@ichi2.net>
|
||||
# License: GNU GPL, version 3 or later; http://www.gnu.org/copyleft/gpl.html
|
||||
|
||||
from PyQt4.QtGui import *
|
||||
from PyQt4.QtCore import *
|
||||
import anki, anki.utils
|
||||
from anki.sound import playFromText, stripSounds
|
||||
from anki.latex import renderLatex, stripLatex
|
||||
from anki.utils import stripHTML
|
||||
import types, time
|
||||
from ankiqt import ui
|
||||
|
||||
# Views - define the way a user is prompted for questions, etc
|
||||
##########################################################################
|
||||
|
||||
class View(object):
|
||||
"Handle the main window update as we transition through various states."
|
||||
|
||||
def __init__(self, parent, body, frame=None):
|
||||
self.main = parent
|
||||
self.body = body
|
||||
self.frame = frame
|
||||
|
||||
# State control
|
||||
##########################################################################
|
||||
|
||||
def setState(self, state):
|
||||
"Change to STATE, and update the display."
|
||||
self.oldState = getattr(self, 'state', None)
|
||||
self.state = state
|
||||
if self.state == "initial":
|
||||
self.shownLearnHelp = False
|
||||
self.shownReviewHelp = False
|
||||
self.shownFinalHelp = False
|
||||
return
|
||||
elif self.state == "noDeck":
|
||||
self.clearWindow()
|
||||
self.drawNoDeckMessage()
|
||||
self.flush()
|
||||
return
|
||||
self.redisplay()
|
||||
|
||||
def redisplay(self):
|
||||
"Idempotently display the current state (prompt for question, etc)"
|
||||
if self.state == "noDeck":
|
||||
return
|
||||
self.clearWindow()
|
||||
self.setBackgroundColour()
|
||||
self.maybeHelp()
|
||||
if self.main.deck.cardCount():
|
||||
if not self.main.lastCard or (
|
||||
self.main.config['suppressLastCardContent'] and
|
||||
self.main.config['suppressLastCardInterval']):
|
||||
self.buffer += "<br>"
|
||||
else:
|
||||
self.drawTopSection()
|
||||
if self.state == "showQuestion":
|
||||
self.drawQuestion()
|
||||
elif self.state == "showAnswer":
|
||||
if not self.main.currentCard.cardModel.questionInAnswer:
|
||||
self.drawQuestion(nosound=True)
|
||||
self.drawAnswer()
|
||||
elif self.state == "deckEmpty":
|
||||
self.drawDeckEmptyMessage()
|
||||
elif self.state == "deckFinished":
|
||||
self.drawDeckFinishedMessage()
|
||||
self.flush()
|
||||
|
||||
def addStyles(self):
|
||||
# card styles
|
||||
s = "<style>\n"
|
||||
if self.main.currentCard:
|
||||
s += self.main.currentCard.css()
|
||||
# last card
|
||||
for base in ("lastCard", "interface"):
|
||||
family = self.main.config[base + "FontFamily"]
|
||||
size = self.main.config[base + "FontSize"]
|
||||
color = ("; color: " + self.main.config[base + "Colour"])
|
||||
s += ('.%s {font-family: "%s"; font-size: %spx%s}\n' %
|
||||
(base, family, size, color))
|
||||
# standard margins
|
||||
s += "</style>"
|
||||
return s
|
||||
|
||||
def clearWindow(self):
|
||||
self.body.setHtml("")
|
||||
self.buffer = ""
|
||||
|
||||
# Font properties & output
|
||||
##########################################################################
|
||||
|
||||
def flush(self):
|
||||
"Write the current HTML buffer to the screen."
|
||||
self.body.setHtml(self.addStyles() + '<div class="interface">' + self.buffer + "</div>")
|
||||
|
||||
def write(self, text):
|
||||
if type(text) != types.UnicodeType:
|
||||
text = unicode(text, "utf-8")
|
||||
self.buffer += text
|
||||
|
||||
def setBackgroundColour(self):
|
||||
p = QPalette()
|
||||
p.setColor(QPalette.Base, QColor(self.main.config['backgroundColour']))
|
||||
self.body.setPalette(p)
|
||||
if self.frame:
|
||||
p.setColor(QPalette.Background, QColor(self.main.config['backgroundColour']))
|
||||
self.frame.setPalette(p)
|
||||
|
||||
# Question and answer
|
||||
##########################################################################
|
||||
|
||||
def drawQuestion(self, nosound=False):
|
||||
"Show the question."
|
||||
q = self.main.currentCard.htmlQuestion
|
||||
q = renderLatex(self.main.deck, q)
|
||||
self.write(stripSounds(q))
|
||||
if self.state != self.oldState and not nosound:
|
||||
playFromText(q)
|
||||
|
||||
def drawAnswer(self):
|
||||
"Show the answer."
|
||||
a = self.main.currentCard.htmlAnswer
|
||||
a = renderLatex(self.main.deck, a)
|
||||
self.write(stripSounds(a))
|
||||
if self.state != self.oldState:
|
||||
playFromText(a)
|
||||
|
||||
# Top section
|
||||
##########################################################################
|
||||
|
||||
def drawTopSection(self):
|
||||
"Show previous card, next scheduled time, and stats."
|
||||
self.buffer += "<center>"
|
||||
self.drawLastCard()
|
||||
self.buffer += "</center>"
|
||||
|
||||
def drawLastCard(self):
|
||||
"Show the last card if not the current one, and next time."
|
||||
if self.main.lastCard:
|
||||
if not self.main.config['suppressLastCardContent']:
|
||||
if (self.state == "deckFinished" or
|
||||
self.main.currentCard.id != self.main.lastCard.id):
|
||||
q = self.main.lastCard.question.replace("<br>", " ")
|
||||
q = stripHTML(q)
|
||||
if len(q) > 50:
|
||||
q = q[:50] + "..."
|
||||
a = self.main.lastCard.answer.replace("<br>", " ")
|
||||
a = stripHTML(a)
|
||||
if len(a) > 50:
|
||||
a = a[:50] + "..."
|
||||
s = "%s<br>%s" % (q, a)
|
||||
s = stripLatex(s)
|
||||
self.write('<span class="lastCard">%s</span><br>' % s)
|
||||
if not self.main.config['suppressLastCardInterval']:
|
||||
if self.main.lastQuality > 1:
|
||||
msg = _("Well done! This card will appear again in "
|
||||
"<b>%(next)s</b>.") % \
|
||||
{"next":self.main.lastScheduledTime}
|
||||
else:
|
||||
msg = _("This card will appear again in less than "
|
||||
"<b>%(next)s</b>.") % \
|
||||
{"next":self.main.lastScheduledTime}
|
||||
self.write(msg)
|
||||
|
||||
# Help
|
||||
##########################################################################
|
||||
|
||||
def maybeHelp(self):
|
||||
return
|
||||
stats = self.main.deck.sched.getStats()
|
||||
if not stats['pending']:
|
||||
self.main.help.hide()
|
||||
elif (self.main.currentCard and
|
||||
self.main.currentCard.nextTime > time.time()):
|
||||
if not self.shownFinalHelp:
|
||||
self.shownFinalHelp = True
|
||||
self.main.help.showHideableKey("finalReview")
|
||||
elif stats['learnMode']:
|
||||
if not self.shownLearnHelp:
|
||||
if stats['pending'] != 0:
|
||||
self.shownLearnHelp = True
|
||||
self.main.help.showHideableKey("learn")
|
||||
else:
|
||||
if not self.shownReviewHelp:
|
||||
self.shownReviewHelp = True
|
||||
self.main.help.showHideableKey("review")
|
||||
|
||||
# Welcome/empty/finished deck messages
|
||||
##########################################################################
|
||||
|
||||
def drawNoDeckMessage(self):
|
||||
self.write(_("""<h1>Welcome to Anki!</h1>
|
||||
<p>
|
||||
<table width=90%>
|
||||
<tr>
|
||||
<td>
|
||||
Anki is a tool which will help you remember things as quickly and easily as
|
||||
possible. Anki works by asking you questions. After answering a question,
|
||||
Anki will ask how well you remembered. If you made a mistake or had difficulty
|
||||
remembering, Anki will show you the question again after a short amount of
|
||||
time. If you answered the question easily, Anki will wait for a number of days
|
||||
before asking you again. Each time you successfully remember something, the
|
||||
time before you see it again will get bigger.
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<p>
|
||||
<table>
|
||||
|
||||
<tr>
|
||||
<td width=50>
|
||||
<a href="welcome:sample"><img src=":/icons/anki.png"></a>
|
||||
</td>
|
||||
<td valign=middle><h2><a href="welcome:sample">Open a sample deck</a></h2></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<a href="welcome:open"><img src=":/icons/document-open.png"></a>
|
||||
</td>
|
||||
<td valign=middle><h2><a href="welcome:open">Open an existing deck</a></h2></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<a href="welcome:new"><img src=":/icons/document-new.png"></a>
|
||||
</td>
|
||||
<td valign=middle>
|
||||
<h2><a href="welcome:new">Create a new deck</a></h2></td>
|
||||
</tr>
|
||||
</table>
|
||||
<p>
|
||||
<table width=90%>
|
||||
<tr>
|
||||
<td>
|
||||
<h2>Adding material</h2>
|
||||
There are three ways to add material to Anki: typing it in yourself, using a
|
||||
pre-made Anki deck, or importing word lists that you find on the internet.
|
||||
<p>
|
||||
|
||||
For language learning, it's a good idea to add material yourself, from sources
|
||||
like a textbook or a TV show. By adding words that you see or hear in context,
|
||||
you also learn how they are used. While it may be tempting to use a big,
|
||||
pre-made vocabulary list to save time, learning words and grammar in context
|
||||
will ensure you can use them naturally.
|
||||
<p>
|
||||
|
||||
So if you're learning a language, consider adding material you want to learn
|
||||
into Anki by yourself. Initially the time required to type in material may
|
||||
seem daunting, but it's a small amount of time compared to the time you'll
|
||||
save by not forgetting.
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
"""))
|
||||
|
||||
def drawDeckEmptyMessage(self):
|
||||
"Tell the user the deck is empty."
|
||||
self.write(_("""
|
||||
<h1>Empty deck</h1>The current deck has no cards in it. Please select 'Add
|
||||
card' from the Edit menu."""))
|
||||
|
||||
def drawDeckFinishedMessage(self):
|
||||
"Tell the user the deck is finished."
|
||||
self.write("<br><center><table width=250><tr><td align='left'>" +
|
||||
self.main.deck.deckFinishedMsg() +
|
||||
"</td></tr></table></center>")
|
17
ankiqtmac.py
Normal file
|
@ -0,0 +1,17 @@
|
|||
#!/usr/bin/env python
|
||||
#
|
||||
# hack because py2app barfs on a try block
|
||||
#
|
||||
|
||||
import pkg_resources
|
||||
|
||||
import os, sys
|
||||
|
||||
modDir=os.path.dirname(os.path.abspath(__file__))
|
||||
runningDir=os.path.split(modDir)[0]
|
||||
# set up paths for local development
|
||||
sys.path.insert(0, os.path.join(runningDir, "libanki"))
|
||||
sys.path.insert(0, os.path.join(os.path.join(runningDir, ".."), "libanki"))
|
||||
|
||||
import ankiqt
|
||||
ankiqt.run()
|
87
designer/about.ui
Normal file
|
@ -0,0 +1,87 @@
|
|||
<ui version="4.0" >
|
||||
<class>About</class>
|
||||
<widget class="QDialog" name="About" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>224</width>
|
||||
<height>310</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Minimum" hsizetype="Preferred" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
<string>About Anki</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" >
|
||||
<item>
|
||||
<widget class="QLabel" name="label" >
|
||||
<property name="text" >
|
||||
<string/>
|
||||
</property>
|
||||
<property name="alignment" >
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
</property>
|
||||
<property name="wordWrap" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="openExternalLinks" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox" >
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons" >
|
||||
<set>QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../icons.qrc" />
|
||||
</resources>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>About</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>About</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
324
designer/addcards.ui
Normal file
|
@ -0,0 +1,324 @@
|
|||
<ui version="4.0" >
|
||||
<class>AddCards</class>
|
||||
<widget class="QDialog" name="AddCards" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>921</width>
|
||||
<height>553</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
<string>Anki - Add Cards</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>3</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>3</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QGridLayout" >
|
||||
<property name="margin" >
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>3</number>
|
||||
</property>
|
||||
<item row="0" column="0" >
|
||||
<widget class="QWidget" native="1" name="modelArea" />
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="fieldsArea" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy>
|
||||
<hsizetype>5</hsizetype>
|
||||
<vsizetype>7</vsizetype>
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="title" >
|
||||
<string>Fields</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="statusGroup" >
|
||||
<property name="title" >
|
||||
<string>Status</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QTextEdit" name="status" >
|
||||
<property name="enabled" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy>
|
||||
<hsizetype>7</hsizetype>
|
||||
<vsizetype>5</vsizetype>
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximumSize" >
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>50</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="frameShape" >
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="verticalScrollBarPolicy" >
|
||||
<enum>Qt::ScrollBarAlwaysOff</enum>
|
||||
</property>
|
||||
<property name="horizontalScrollBarPolicy" >
|
||||
<enum>Qt::ScrollBarAlwaysOff</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox" >
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons" >
|
||||
<set>QDialogButtonBox::NoButton</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QFrame" name="helpFrame" >
|
||||
<property name="frameShape" >
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="frameShadow" >
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="Line" name="line" >
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QFrame" name="innerHelpFrame" >
|
||||
<property name="palette" >
|
||||
<palette>
|
||||
<active>
|
||||
<colorrole role="Base" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Window" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>255</red>
|
||||
<green>250</green>
|
||||
<blue>230</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</active>
|
||||
<inactive>
|
||||
<colorrole role="Base" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Window" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>255</red>
|
||||
<green>250</green>
|
||||
<blue>230</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</inactive>
|
||||
<disabled>
|
||||
<colorrole role="Base" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>255</red>
|
||||
<green>250</green>
|
||||
<blue>230</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Window" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>255</red>
|
||||
<green>250</green>
|
||||
<blue>230</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</disabled>
|
||||
</palette>
|
||||
</property>
|
||||
<property name="autoFillBackground" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="frameShape" >
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="frameShadow" >
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QTextBrowser" name="help" >
|
||||
<property name="enabled" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy>
|
||||
<hsizetype>1</hsizetype>
|
||||
<vsizetype>7</vsizetype>
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize" >
|
||||
<size>
|
||||
<width>200</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize" >
|
||||
<size>
|
||||
<width>300</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="palette" >
|
||||
<palette>
|
||||
<active>
|
||||
<colorrole role="Base" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>255</red>
|
||||
<green>250</green>
|
||||
<blue>230</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</active>
|
||||
<inactive>
|
||||
<colorrole role="Base" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>255</red>
|
||||
<green>250</green>
|
||||
<blue>230</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</inactive>
|
||||
<disabled>
|
||||
<colorrole role="Base" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>207</red>
|
||||
<green>207</green>
|
||||
<blue>207</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</disabled>
|
||||
</palette>
|
||||
</property>
|
||||
<property name="frameShape" >
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="frameShadow" >
|
||||
<enum>QFrame::Sunken</enum>
|
||||
</property>
|
||||
<property name="horizontalScrollBarPolicy" >
|
||||
<enum>Qt::ScrollBarAlwaysOff</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>buttonBox</tabstop>
|
||||
</tabstops>
|
||||
<resources>
|
||||
<include location="../icons.qrc" />
|
||||
</resources>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>AddCards</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<x>301</x>
|
||||
<y>-1</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
140
designer/addmodel.ui
Normal file
|
@ -0,0 +1,140 @@
|
|||
<ui version="4.0" >
|
||||
<class>AddModel</class>
|
||||
<widget class="QDialog" name="AddModel" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>388</width>
|
||||
<height>363</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
<string>Anki</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" >
|
||||
<item>
|
||||
<widget class="QLabel" name="label" >
|
||||
<property name="text" >
|
||||
<string><h1>What would you like to study?</h1></string>
|
||||
</property>
|
||||
<property name="alignment" >
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<property name="wordWrap" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox" >
|
||||
<property name="title" >
|
||||
<string/>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" >
|
||||
<item>
|
||||
<widget class="QRadioButton" name="createTemplate" >
|
||||
<property name="text" >
|
||||
<string>A pre-made quiz style.</string>
|
||||
</property>
|
||||
<property name="checked" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QListWidget" name="models" >
|
||||
<property name="font" >
|
||||
<font>
|
||||
<pointsize>12</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="editTriggers" >
|
||||
<set>QAbstractItemView::NoEditTriggers</set>
|
||||
</property>
|
||||
<property name="tabKeyNavigation" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="createBasic" >
|
||||
<property name="text" >
|
||||
<string>A simple front-to-back quiz style.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="loadOnline" >
|
||||
<property name="text" >
|
||||
<string>An existing online deck.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox" >
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons" >
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>AddModel</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<x>266</x>
|
||||
<y>353</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>AddModel</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<x>334</x>
|
||||
<y>353</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>createTemplate</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>models</receiver>
|
||||
<slot>setEnabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<x>217</x>
|
||||
<y>71</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<x>213</x>
|
||||
<y>138</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
385
designer/cardlist.ui
Normal file
|
@ -0,0 +1,385 @@
|
|||
<ui version="4.0" >
|
||||
<class>EditDeck</class>
|
||||
<widget class="QDialog" name="EditDeck" >
|
||||
<property name="windowModality" >
|
||||
<enum>Qt::NonModal</enum>
|
||||
</property>
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>710</width>
|
||||
<height>655</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
<string>Anki - Edit Deck</string>
|
||||
</property>
|
||||
<property name="windowIcon" >
|
||||
<iconset resource="../icons.qrc" >:/icons/view_text.png</iconset>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="spacing" >
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="leftMargin" >
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="topMargin" >
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="rightMargin" >
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="bottomMargin" >
|
||||
<number>3</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" >
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="leftMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="searchGroup" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Minimum" hsizetype="Preferred" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize" >
|
||||
<size>
|
||||
<width>400</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="title" >
|
||||
<string>&Search</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" >
|
||||
<property name="spacing" >
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="leftMargin" >
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="topMargin" >
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="rightMargin" >
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="bottomMargin" >
|
||||
<number>3</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="filterEdit" >
|
||||
<property name="text" >
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="tagList" >
|
||||
<property name="minimumSize" >
|
||||
<size>
|
||||
<width>150</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="sortGroup" >
|
||||
<property name="title" >
|
||||
<string>S&ort</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" >
|
||||
<property name="spacing" >
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="leftMargin" >
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="topMargin" >
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="rightMargin" >
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="bottomMargin" >
|
||||
<number>3</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QComboBox" name="sortBox" />
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox" >
|
||||
<property name="title" >
|
||||
<string>Actions on selected..</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" >
|
||||
<property name="spacing" >
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="leftMargin" >
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="topMargin" >
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="rightMargin" >
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="bottomMargin" >
|
||||
<number>3</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QPushButton" name="factsButton" >
|
||||
<property name="text" >
|
||||
<string>Facts..</string>
|
||||
</property>
|
||||
<property name="icon" >
|
||||
<iconset resource="../icons.qrc" >:/icons/Anki_Fact.png</iconset>
|
||||
</property>
|
||||
<property name="autoDefault" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="cardsButton" >
|
||||
<property name="text" >
|
||||
<string>Cards..</string>
|
||||
</property>
|
||||
<property name="icon" >
|
||||
<iconset resource="../icons.qrc" >:/icons/Anki_Card.png</iconset>
|
||||
</property>
|
||||
<property name="autoDefault" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSplitter" name="splitter" >
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<widget class="QTableView" name="tableView" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>4</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="contextMenuPolicy" >
|
||||
<enum>Qt::ActionsContextMenu</enum>
|
||||
</property>
|
||||
<property name="frameShape" >
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="frameShadow" >
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
<property name="horizontalScrollBarPolicy" >
|
||||
<enum>Qt::ScrollBarAlwaysOff</enum>
|
||||
</property>
|
||||
<property name="editTriggers" >
|
||||
<set>QAbstractItemView::NoEditTriggers</set>
|
||||
</property>
|
||||
<property name="tabKeyNavigation" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="alternatingRowColors" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="selectionBehavior" >
|
||||
<enum>QAbstractItemView::SelectRows</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QFrame" name="frame" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Preferred" hsizetype="Preferred" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>2</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="frameShape" >
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="frameShadow" >
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="spacing" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QGridLayout" >
|
||||
<property name="leftMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="horizontalSpacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="verticalSpacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="0" column="1" >
|
||||
<widget class="QGroupBox" name="cardInfoGroup" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Expanding" hsizetype="Preferred" >
|
||||
<horstretch>2</horstretch>
|
||||
<verstretch>2</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize" >
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>300</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="title" >
|
||||
<string>Current Card</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" >
|
||||
<widget class="QGroupBox" name="fieldsArea" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Expanding" hsizetype="Preferred" >
|
||||
<horstretch>7</horstretch>
|
||||
<verstretch>2</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="title" >
|
||||
<string>Current &Fact</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
<action name="action_Delete_card" >
|
||||
<property name="icon" >
|
||||
<iconset resource="../icons.qrc" >:/icons/editdelete.png</iconset>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Toggle Delete</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionAdd_fact_tag" >
|
||||
<property name="icon" >
|
||||
<iconset resource="../icons.qrc" >:/icons/Anki_Add_Tag.png</iconset>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Add Tag..</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionAdd_card_tag" >
|
||||
<property name="icon" >
|
||||
<iconset resource="../icons.qrc" >:/icons/Anki_Add_Tag.png</iconset>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Add Tag..</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionDelete_fact_tag" >
|
||||
<property name="icon" >
|
||||
<iconset resource="../icons.qrc" >:/icons/Anki_Del_Tag.png</iconset>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Delete Tag..</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionDelete_card_tag" >
|
||||
<property name="icon" >
|
||||
<iconset resource="../icons.qrc" >:/icons/Anki_Del_Tag.png</iconset>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Delete Tag..</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionAdd_Missing_Cards" >
|
||||
<property name="icon" >
|
||||
<iconset resource="../icons.qrc" >:/icons/Anki_Card.png</iconset>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Add Missing Active Cards</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionDelete_Fact" >
|
||||
<property name="icon" >
|
||||
<iconset resource="../icons.qrc" >:/icons/editdelete.png</iconset>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Toggle Delete</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionResetCardProgress" >
|
||||
<property name="text" >
|
||||
<string>Reset Progress</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionResetFactProgress" >
|
||||
<property name="text" >
|
||||
<string>Reset Progress</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>fieldsArea</tabstop>
|
||||
</tabstops>
|
||||
<resources>
|
||||
<include location="../icons.qrc" />
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
82
designer/changemap.ui
Normal file
|
@ -0,0 +1,82 @@
|
|||
<ui version="4.0" >
|
||||
<class>ChangeMap</class>
|
||||
<widget class="QDialog" name="ChangeMap" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>391</width>
|
||||
<height>360</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
<string>Change field mapping</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label" >
|
||||
<property name="text" >
|
||||
<string><h1>Available fields</h1>Please choose which field you would like to import into. If you select "Discard field", all data from this field will be lost.</string>
|
||||
</property>
|
||||
<property name="wordWrap" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QListWidget" name="fields" />
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox" >
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons" >
|
||||
<set>QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>ChangeMap</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>ChangeMap</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
666
designer/deckproperties.ui
Normal file
|
@ -0,0 +1,666 @@
|
|||
<ui version="4.0" >
|
||||
<class>DeckProperties</class>
|
||||
<widget class="QDialog" name="DeckProperties" >
|
||||
<property name="windowModality" >
|
||||
<enum>Qt::ApplicationModal</enum>
|
||||
</property>
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>529</width>
|
||||
<height>593</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
<string>Edit deck properties</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout" >
|
||||
<item>
|
||||
<widget class="QTabWidget" name="qtabwidget" >
|
||||
<property name="currentIndex" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab" >
|
||||
<attribute name="title" >
|
||||
<string>Description && Synchronisation</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="margin" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label" >
|
||||
<property name="text" >
|
||||
<string><h1>Deck description</h1></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTextEdit" name="deckDescription" >
|
||||
<property name="minimumSize" >
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>100</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="tabChangesFocus" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_13" >
|
||||
<property name="text" >
|
||||
<string><h1>Synchronisation</h1>Synchronisation lets you use your deck on multiple computers at the same time. You can also use it to study on the web, for when you're not at home. You can also study on your mobile phone if your phone has internet access.</string>
|
||||
</property>
|
||||
<property name="scaledContents" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="wordWrap" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="doSync" >
|
||||
<property name="text" >
|
||||
<string>Synchronize this deck with name:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="syncName" >
|
||||
<property name="enabled" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_4" >
|
||||
<attribute name="title" >
|
||||
<string>Priorities && Suspending</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="margin" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_16" >
|
||||
<property name="text" >
|
||||
<string><h1>Priorities</h1>A comma-separated list of tags to prioritize or deprioritize<a href="http://ichi2.net/anki/wiki/CardDisplayOrderAndPriorities">?</a></string>
|
||||
</property>
|
||||
<property name="openExternalLinks" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_21" >
|
||||
<property name="text" >
|
||||
<string><h2>Very high priority</h2></string>
|
||||
</property>
|
||||
<property name="wordWrap" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="highPriority" />
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_17" >
|
||||
<property name="text" >
|
||||
<string><h2>High priority</h2></string>
|
||||
</property>
|
||||
<property name="wordWrap" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="medPriority" />
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_24" >
|
||||
<property name="text" >
|
||||
<string><h2>Low priority</h2></string>
|
||||
</property>
|
||||
<property name="wordWrap" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lowPriority" />
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_23" >
|
||||
<property name="text" >
|
||||
<string><h2>Suspended</h2></string>
|
||||
</property>
|
||||
<property name="wordWrap" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="postponing" />
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_2" >
|
||||
<attribute name="title" >
|
||||
<string>Scheduling</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2" >
|
||||
<item>
|
||||
<widget class="QLabel" name="label_15" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="MinimumExpanding" hsizetype="Preferred" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string><h1>New cards</h1></string>
|
||||
</property>
|
||||
<property name="wordWrap" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout" >
|
||||
<item>
|
||||
<widget class="QLabel" name="label_11" >
|
||||
<property name="text" >
|
||||
<string><b>Number of new cards per day</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2" >
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="newCardsPerDay" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="newCardOrder" />
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="newCardScheduling" />
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_27" >
|
||||
<property name="text" >
|
||||
<string>Initial times</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QGridLayout" >
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="2" column="2" >
|
||||
<widget class="QLineEdit" name="easyMin" />
|
||||
</item>
|
||||
<item row="1" column="1" >
|
||||
<widget class="QLabel" name="label_6" >
|
||||
<property name="text" >
|
||||
<string>Min</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1" >
|
||||
<widget class="QLabel" name="label_7" >
|
||||
<property name="text" >
|
||||
<string>Min</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="4" >
|
||||
<widget class="QLineEdit" name="midMax" />
|
||||
</item>
|
||||
<item row="2" column="0" >
|
||||
<widget class="QLabel" name="label_4" >
|
||||
<property name="text" >
|
||||
<string><b>Easy</b></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" >
|
||||
<widget class="QLabel" name="label_3" >
|
||||
<property name="text" >
|
||||
<string><b>Medium</b></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="3" >
|
||||
<widget class="QLabel" name="label_10" >
|
||||
<property name="text" >
|
||||
<string>Max</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2" >
|
||||
<widget class="QLineEdit" name="hardMin" />
|
||||
</item>
|
||||
<item row="1" column="2" >
|
||||
<widget class="QLineEdit" name="midMin" />
|
||||
</item>
|
||||
<item row="0" column="3" >
|
||||
<widget class="QLabel" name="label_8" >
|
||||
<property name="text" >
|
||||
<string>Max</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="4" >
|
||||
<widget class="QLineEdit" name="easyMax" />
|
||||
</item>
|
||||
<item row="0" column="4" >
|
||||
<widget class="QLineEdit" name="hardMax" />
|
||||
</item>
|
||||
<item row="0" column="1" >
|
||||
<widget class="QLabel" name="label_5" >
|
||||
<property name="text" >
|
||||
<string>Min</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="3" >
|
||||
<widget class="QLabel" name="label_9" >
|
||||
<property name="text" >
|
||||
<string>Max</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" >
|
||||
<widget class="QLabel" name="label_2" >
|
||||
<property name="minimumSize" >
|
||||
<size>
|
||||
<width>220</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string><b>Hard</b></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_18" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="MinimumExpanding" hsizetype="Preferred" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string><h1>Delay on mistake</h1>The time until Anki shows you a card you got wrong. The default is 10 minutes.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QGridLayout" >
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="0" column="0" >
|
||||
<widget class="QLabel" name="label_20" >
|
||||
<property name="text" >
|
||||
<string><b>Totally forgot (0)</b></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" >
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="0" >
|
||||
<widget class="QLabel" name="label_22" >
|
||||
<property name="text" >
|
||||
<string><b>Made a mistake (1) on a young<a href="http://ichi2.net/anki/wiki/Key_Terms_and_Concepts#head-3b268fd372f260751f5e9020a79d54a4f68e1829">?</a> card</string>
|
||||
</property>
|
||||
<property name="openExternalLinks" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" >
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="2" >
|
||||
<widget class="QLineEdit" name="delay0" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2" >
|
||||
<widget class="QLineEdit" name="delay1" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" >
|
||||
<widget class="QLabel" name="label_19" >
|
||||
<property name="text" >
|
||||
<string><b>Made a mistake (1) on a mature<a href="http://ichi2.net/anki/wiki/Key_Terms_and_Concepts#head-3b268fd372f260751f5e9020a79d54a4f68e1829">?</a> card</b></string>
|
||||
</property>
|
||||
<property name="openExternalLinks" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1" >
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="2" column="2" >
|
||||
<widget class="QLineEdit" name="delay2" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_25" >
|
||||
<property name="text" >
|
||||
<string><h1>Failed card limit & collapsing</h1></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QGridLayout" >
|
||||
<item row="0" column="0" >
|
||||
<widget class="QLabel" name="label_12" >
|
||||
<property name="text" >
|
||||
<string><b>Maximum failed cards<a href="http://ichi2.net/anki/wiki/Key_Terms_and_Concepts#head-e081bb818555df4a9fd06e16e685835a95303e0c">?</a></b></string>
|
||||
</property>
|
||||
<property name="openExternalLinks" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" >
|
||||
<widget class="QLineEdit" name="failedCardMax" />
|
||||
</item>
|
||||
<item row="1" column="0" >
|
||||
<widget class="QLabel" name="label_26" >
|
||||
<property name="text" >
|
||||
<string><b>Show failed cards early<a href="http://ichi2.net/anki/wiki/Key_Terms_and_Concepts#head-c34f83f4acaf3d9a8f59dcff02dd6abec930ebaf">?</a></b></string>
|
||||
</property>
|
||||
<property name="openExternalLinks" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" >
|
||||
<widget class="QCheckBox" name="collapse" >
|
||||
<property name="text" >
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType" >
|
||||
<enum>QSizePolicy::Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_3" >
|
||||
<attribute name="title" >
|
||||
<string>Models</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="margin" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_14" >
|
||||
<property name="text" >
|
||||
<string><h1>Models</h1>Models define what sort of information you're studying, and the way to show it to you. Models range from a simple representation of a single flashcard with a "front" and "back" side, to more complicated domain specific models: a model for Russian verbs may define two verb forms, and test you on both of them.</string>
|
||||
</property>
|
||||
<property name="wordWrap" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QListWidget" name="modelsList" />
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" >
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QPushButton" name="modelsAdd" >
|
||||
<property name="text" >
|
||||
<string>&Add</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="modelsEdit" >
|
||||
<property name="text" >
|
||||
<string>&Edit</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="modelsDelete" >
|
||||
<property name="text" >
|
||||
<string>&Delete</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox" >
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons" >
|
||||
<set>QDialogButtonBox::Close</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>qtabwidget</tabstop>
|
||||
<tabstop>deckDescription</tabstop>
|
||||
<tabstop>doSync</tabstop>
|
||||
<tabstop>syncName</tabstop>
|
||||
<tabstop>highPriority</tabstop>
|
||||
<tabstop>medPriority</tabstop>
|
||||
<tabstop>lowPriority</tabstop>
|
||||
<tabstop>postponing</tabstop>
|
||||
<tabstop>newCardsPerDay</tabstop>
|
||||
<tabstop>newCardOrder</tabstop>
|
||||
<tabstop>newCardScheduling</tabstop>
|
||||
<tabstop>hardMin</tabstop>
|
||||
<tabstop>hardMax</tabstop>
|
||||
<tabstop>midMin</tabstop>
|
||||
<tabstop>midMax</tabstop>
|
||||
<tabstop>easyMin</tabstop>
|
||||
<tabstop>easyMax</tabstop>
|
||||
<tabstop>delay0</tabstop>
|
||||
<tabstop>delay1</tabstop>
|
||||
<tabstop>delay2</tabstop>
|
||||
<tabstop>failedCardMax</tabstop>
|
||||
<tabstop>collapse</tabstop>
|
||||
<tabstop>modelsList</tabstop>
|
||||
<tabstop>modelsAdd</tabstop>
|
||||
<tabstop>modelsEdit</tabstop>
|
||||
<tabstop>modelsDelete</tabstop>
|
||||
<tabstop>buttonBox</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>DeckProperties</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<x>266</x>
|
||||
<y>539</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>DeckProperties</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<x>334</x>
|
||||
<y>539</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>doSync</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>syncName</receiver>
|
||||
<slot>setEnabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<x>58</x>
|
||||
<y>445</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<x>327</x>
|
||||
<y>477</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
677
designer/displayproperties.ui
Normal file
|
@ -0,0 +1,677 @@
|
|||
<ui version="4.0" >
|
||||
<class>DisplayProperties</class>
|
||||
<widget class="QDialog" name="DisplayProperties" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>794</width>
|
||||
<height>700</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy>
|
||||
<hsizetype>5</hsizetype>
|
||||
<vsizetype>3</vsizetype>
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize" >
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>700</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
<string>Fonts and colours</string>
|
||||
</property>
|
||||
<property name="windowIcon" >
|
||||
<iconset resource="../icons.qrc" >:/icons/fonts.png</iconset>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QGridLayout" >
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>12</number>
|
||||
</property>
|
||||
<item row="0" column="0" >
|
||||
<widget class="QFrame" name="frame" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy>
|
||||
<hsizetype>0</hsizetype>
|
||||
<vsizetype>5</vsizetype>
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize" >
|
||||
<size>
|
||||
<width>330</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize" >
|
||||
<size>
|
||||
<width>330</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="frameShape" >
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="frameShadow" >
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>7</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" native="1" name="modelArea" />
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QGridLayout" >
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="1" column="0" >
|
||||
<widget class="QLabel" name="label_3" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy>
|
||||
<hsizetype>0</hsizetype>
|
||||
<vsizetype>5</vsizetype>
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Card:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" >
|
||||
<widget class="QComboBox" name="cardList" />
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_5" >
|
||||
<property name="title" >
|
||||
<string>Card properties</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QGridLayout" >
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>5</number>
|
||||
</property>
|
||||
<item row="0" column="0" >
|
||||
<widget class="QLabel" name="label_6" >
|
||||
<property name="text" >
|
||||
<string>Question font</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1" >
|
||||
<widget class="QPushButton" name="answerColour" >
|
||||
<property name="text" >
|
||||
<string/>
|
||||
</property>
|
||||
<property name="autoDefault" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0" >
|
||||
<widget class="QLabel" name="label_10" >
|
||||
<property name="text" >
|
||||
<string>Answer size</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0" >
|
||||
<widget class="QLabel" name="label_11" >
|
||||
<property name="text" >
|
||||
<string>Answer colour</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0" >
|
||||
<widget class="QLabel" name="label_9" >
|
||||
<property name="text" >
|
||||
<string>Answer font</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1" >
|
||||
<widget class="QFontComboBox" name="answerFont" />
|
||||
</item>
|
||||
<item row="3" column="0" >
|
||||
<widget class="QLabel" name="label_4" >
|
||||
<property name="text" >
|
||||
<string>Question alignment</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" >
|
||||
<widget class="QLabel" name="label_7" >
|
||||
<property name="text" >
|
||||
<string>Question size</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" >
|
||||
<widget class="QSpinBox" name="questionSize" >
|
||||
<property name="maximum" >
|
||||
<number>300</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" >
|
||||
<widget class="QFontComboBox" name="questionFont" />
|
||||
</item>
|
||||
<item row="2" column="1" >
|
||||
<widget class="QPushButton" name="questionColour" >
|
||||
<property name="text" >
|
||||
<string/>
|
||||
</property>
|
||||
<property name="autoDefault" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1" >
|
||||
<widget class="QSpinBox" name="answerSize" >
|
||||
<property name="maximum" >
|
||||
<number>300</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" >
|
||||
<widget class="QLabel" name="label_8" >
|
||||
<property name="text" >
|
||||
<string>Question colour</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0" >
|
||||
<widget class="QLabel" name="label_12" >
|
||||
<property name="text" >
|
||||
<string>Answer alignment</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1" >
|
||||
<widget class="QComboBox" name="questionAlign" />
|
||||
</item>
|
||||
<item row="7" column="1" >
|
||||
<widget class="QComboBox" name="answerAlign" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy>
|
||||
<hsizetype>5</hsizetype>
|
||||
<vsizetype>5</vsizetype>
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox" >
|
||||
<property name="title" >
|
||||
<string>Fields</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QListWidget" name="fieldList" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy>
|
||||
<hsizetype>5</hsizetype>
|
||||
<vsizetype>3</vsizetype>
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize" >
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>60</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label" >
|
||||
<property name="text" >
|
||||
<string> <b>When quizzing/adding/editing</b></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QGridLayout" >
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>5</number>
|
||||
</property>
|
||||
<item row="1" column="0" >
|
||||
<widget class="QCheckBox" name="useSize" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy>
|
||||
<hsizetype>1</hsizetype>
|
||||
<vsizetype>1</vsizetype>
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize" >
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Use custom size</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" >
|
||||
<widget class="QFontComboBox" name="fontFamily" >
|
||||
<property name="minimumSize" >
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" >
|
||||
<widget class="QCheckBox" name="useFamily" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy>
|
||||
<hsizetype>1</hsizetype>
|
||||
<vsizetype>1</vsizetype>
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize" >
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Use custom font</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" >
|
||||
<widget class="QSpinBox" name="fontSize" >
|
||||
<property name="maximum" >
|
||||
<number>300</number>
|
||||
</property>
|
||||
<property name="minimum" >
|
||||
<number>5</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" >
|
||||
<widget class="QCheckBox" name="useColour" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy>
|
||||
<hsizetype>1</hsizetype>
|
||||
<vsizetype>1</vsizetype>
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize" >
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Use custom colour</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1" >
|
||||
<widget class="QPushButton" name="fontColour" >
|
||||
<property name="autoFillBackground" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string/>
|
||||
</property>
|
||||
<property name="autoDefault" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2" >
|
||||
<property name="text" >
|
||||
<string> <b>When adding/editing</b></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QGridLayout" >
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>5</number>
|
||||
</property>
|
||||
<item row="1" column="1" >
|
||||
<widget class="QSpinBox" name="fontSizeEdit" >
|
||||
<property name="maximum" >
|
||||
<number>300</number>
|
||||
</property>
|
||||
<property name="minimum" >
|
||||
<number>5</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" >
|
||||
<widget class="QCheckBox" name="useSizeEdit" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy>
|
||||
<hsizetype>1</hsizetype>
|
||||
<vsizetype>0</vsizetype>
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize" >
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Use custom size</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" >
|
||||
<widget class="QFontComboBox" name="fontFamilyEdit" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy>
|
||||
<hsizetype>1</hsizetype>
|
||||
<vsizetype>0</vsizetype>
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" >
|
||||
<widget class="QCheckBox" name="useFamilyEdit" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy>
|
||||
<hsizetype>1</hsizetype>
|
||||
<vsizetype>0</vsizetype>
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize" >
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Use custom font</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="preview" >
|
||||
<property name="text" >
|
||||
<string>Show preview</string>
|
||||
</property>
|
||||
<property name="checkable" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="autoDefault" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" >
|
||||
<widget class="QGroupBox" name="previewGroup" >
|
||||
<property name="title" >
|
||||
<string>Preview</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QTextEdit" name="question" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy>
|
||||
<hsizetype>7</hsizetype>
|
||||
<vsizetype>3</vsizetype>
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize" >
|
||||
<size>
|
||||
<width>400</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="readOnly" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTextEdit" name="answer" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy>
|
||||
<hsizetype>7</hsizetype>
|
||||
<vsizetype>3</vsizetype>
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="readOnly" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>cardList</tabstop>
|
||||
<tabstop>questionFont</tabstop>
|
||||
<tabstop>questionSize</tabstop>
|
||||
<tabstop>questionColour</tabstop>
|
||||
<tabstop>questionAlign</tabstop>
|
||||
<tabstop>answerFont</tabstop>
|
||||
<tabstop>answerSize</tabstop>
|
||||
<tabstop>answerColour</tabstop>
|
||||
<tabstop>answerAlign</tabstop>
|
||||
<tabstop>fieldList</tabstop>
|
||||
<tabstop>useFamily</tabstop>
|
||||
<tabstop>fontFamily</tabstop>
|
||||
<tabstop>useSize</tabstop>
|
||||
<tabstop>fontSize</tabstop>
|
||||
<tabstop>useColour</tabstop>
|
||||
<tabstop>fontColour</tabstop>
|
||||
<tabstop>useFamilyEdit</tabstop>
|
||||
<tabstop>fontFamilyEdit</tabstop>
|
||||
<tabstop>useSizeEdit</tabstop>
|
||||
<tabstop>fontSizeEdit</tabstop>
|
||||
<tabstop>preview</tabstop>
|
||||
<tabstop>question</tabstop>
|
||||
<tabstop>answer</tabstop>
|
||||
</tabstops>
|
||||
<resources>
|
||||
<include location="../icons.qrc" />
|
||||
</resources>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>useFamily</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>fontFamily</receiver>
|
||||
<slot>setShown(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<x>98</x>
|
||||
<y>448</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<x>197</x>
|
||||
<y>447</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>useSize</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>fontSize</receiver>
|
||||
<slot>setShown(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<x>136</x>
|
||||
<y>471</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<x>233</x>
|
||||
<y>468</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>useColour</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>fontColour</receiver>
|
||||
<slot>setShown(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<x>109</x>
|
||||
<y>501</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<x>261</x>
|
||||
<y>499</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>useFamilyEdit</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>fontFamilyEdit</receiver>
|
||||
<slot>setShown(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<x>118</x>
|
||||
<y>538</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<x>258</x>
|
||||
<y>543</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>useSizeEdit</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>fontSizeEdit</receiver>
|
||||
<slot>setShown(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<x>106</x>
|
||||
<y>569</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<x>165</x>
|
||||
<y>567</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
108
designer/exporting.ui
Normal file
|
@ -0,0 +1,108 @@
|
|||
<ui version="4.0" >
|
||||
<class>ExportDialog</class>
|
||||
<widget class="QDialog" name="ExportDialog" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>295</width>
|
||||
<height>154</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
<string>Export</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" >
|
||||
<item>
|
||||
<layout class="QGridLayout" >
|
||||
<item row="0" column="0" >
|
||||
<widget class="QLabel" name="label" >
|
||||
<property name="minimumSize" >
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string><b>Export format</b>:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" >
|
||||
<widget class="QComboBox" name="format" />
|
||||
</item>
|
||||
<item row="1" column="0" >
|
||||
<widget class="QLabel" name="label_2" >
|
||||
<property name="text" >
|
||||
<string><b>Limit to tags</b>:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" >
|
||||
<item>
|
||||
<widget class="QCheckBox" name="includeScheduling" >
|
||||
<property name="text" >
|
||||
<string>Include scheduling information</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="includeTags" >
|
||||
<property name="text" >
|
||||
<string>Include tags</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox" >
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons" >
|
||||
<set>QDialogButtonBox::Cancel</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>ExportDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>ExportDialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
278
designer/importing.ui
Normal file
|
@ -0,0 +1,278 @@
|
|||
<ui version="4.0" >
|
||||
<class>ImportDialog</class>
|
||||
<widget class="QDialog" name="ImportDialog" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>477</width>
|
||||
<height>484</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
<string>Import</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" >
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox" >
|
||||
<property name="title" >
|
||||
<string>Import options</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="leftMargin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="topMargin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="rightMargin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="bottomMargin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QGridLayout" >
|
||||
<property name="leftMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="horizontalSpacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="verticalSpacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="1" column="0" >
|
||||
<widget class="QLabel" name="label_2" >
|
||||
<property name="text" >
|
||||
<string><b>File to import</b>:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" >
|
||||
<widget class="QPushButton" name="file" >
|
||||
<property name="text" >
|
||||
<string>Choose &file...</string>
|
||||
</property>
|
||||
<property name="default" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" >
|
||||
<widget class="QLabel" name="label" >
|
||||
<property name="text" >
|
||||
<string><b>Type of file</b>:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" >
|
||||
<widget class="QComboBox" name="type" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" >
|
||||
<widget class="QLabel" name="label_4" >
|
||||
<property name="text" >
|
||||
<string>Tags to append:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1" >
|
||||
<widget class="QLineEdit" name="tags" />
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="tagDuplicates" >
|
||||
<property name="text" >
|
||||
<string>Tag facts with duplicate fields instead of deleting</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" native="1" name="modelArea" />
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="mappingGroup" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Preferred" hsizetype="Expanding" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="title" >
|
||||
<string>Field mapping</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" >
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="leftMargin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="topMargin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="rightMargin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="bottomMargin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QGridLayout" >
|
||||
<property name="leftMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="horizontalSpacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="verticalSpacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="0" column="2" >
|
||||
<widget class="QPushButton" name="importButton" >
|
||||
<property name="text" >
|
||||
<string>&Import</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" >
|
||||
<widget class="QFrame" name="mappingArea" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Preferred" hsizetype="Expanding" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="frameShape" >
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow" >
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_2" >
|
||||
<property name="title" >
|
||||
<string>Status</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="leftMargin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="topMargin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="rightMargin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="bottomMargin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QTextEdit" name="status" >
|
||||
<property name="readOnly" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox" >
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons" >
|
||||
<set>QDialogButtonBox::Close</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>type</tabstop>
|
||||
<tabstop>file</tabstop>
|
||||
<tabstop>tags</tabstop>
|
||||
<tabstop>tagDuplicates</tabstop>
|
||||
<tabstop>importButton</tabstop>
|
||||
<tabstop>status</tabstop>
|
||||
<tabstop>buttonBox</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>ImportDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>ImportDialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
76
designer/infodialog.ui
Normal file
|
@ -0,0 +1,76 @@
|
|||
<ui version="4.0" >
|
||||
<class>InfoDialog</class>
|
||||
<widget class="QDialog" name="InfoDialog" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>409</width>
|
||||
<height>284</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
<string>Dialog</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QTextEdit" name="textEdit" >
|
||||
<property name="readOnly" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox" >
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons" >
|
||||
<set>QDialogButtonBox::Close</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>InfoDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>InfoDialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
922
designer/main.ui
Normal file
|
@ -0,0 +1,922 @@
|
|||
<ui version="4.0" >
|
||||
<class>MainWindow</class>
|
||||
<widget class="QMainWindow" name="MainWindow" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>555</width>
|
||||
<height>292</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Preferred" hsizetype="Preferred" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
<string>Anki</string>
|
||||
</property>
|
||||
<property name="windowIcon" >
|
||||
<iconset resource="../icons.qrc" >
|
||||
<normaloff>:/icons/anki.png</normaloff>:/icons/anki.png</iconset>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralwidget" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>57</y>
|
||||
<width>555</width>
|
||||
<height>212</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="MinimumExpanding" hsizetype="MinimumExpanding" >
|
||||
<horstretch>1</horstretch>
|
||||
<verstretch>1</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="autoFillBackground" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" >
|
||||
<property name="spacing" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QFrame" name="mainTextFrame" >
|
||||
<property name="palette" >
|
||||
<palette>
|
||||
<active>
|
||||
<colorrole role="Base" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Window" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</active>
|
||||
<inactive>
|
||||
<colorrole role="Base" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Window" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</inactive>
|
||||
<disabled>
|
||||
<colorrole role="Base" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Window" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</disabled>
|
||||
</palette>
|
||||
</property>
|
||||
<property name="autoFillBackground" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="frameShape" >
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="frameShadow" >
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="spacing" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="margin" >
|
||||
<number>5</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QTextBrowser" name="mainText" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Expanding" hsizetype="MinimumExpanding" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize" >
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>100</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="focusPolicy" >
|
||||
<enum>Qt::ClickFocus</enum>
|
||||
</property>
|
||||
<property name="frameShape" >
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="tabChangesFocus" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="readOnly" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="textInteractionFlags" >
|
||||
<set>Qt::TextBrowserInteraction</set>
|
||||
</property>
|
||||
<property name="openExternalLinks" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" native="1" name="buttonWidget" />
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QFrame" name="helpFrame" >
|
||||
<property name="frameShape" >
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="frameShadow" >
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" >
|
||||
<property name="spacing" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="Line" name="line" >
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QFrame" name="innerHelpFrame" >
|
||||
<property name="palette" >
|
||||
<palette>
|
||||
<active>
|
||||
<colorrole role="Base" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Window" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>255</red>
|
||||
<green>250</green>
|
||||
<blue>230</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</active>
|
||||
<inactive>
|
||||
<colorrole role="Base" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Window" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>255</red>
|
||||
<green>250</green>
|
||||
<blue>230</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</inactive>
|
||||
<disabled>
|
||||
<colorrole role="Base" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>255</red>
|
||||
<green>250</green>
|
||||
<blue>230</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Window" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>207</red>
|
||||
<green>207</green>
|
||||
<blue>207</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</disabled>
|
||||
</palette>
|
||||
</property>
|
||||
<property name="autoFillBackground" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="frameShape" >
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="frameShadow" >
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" >
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="margin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QTextBrowser" name="help" >
|
||||
<property name="enabled" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Expanding" hsizetype="Fixed" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize" >
|
||||
<size>
|
||||
<width>200</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize" >
|
||||
<size>
|
||||
<width>300</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="palette" >
|
||||
<palette>
|
||||
<active>
|
||||
<colorrole role="Base" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>255</red>
|
||||
<green>250</green>
|
||||
<blue>230</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</active>
|
||||
<inactive>
|
||||
<colorrole role="Base" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>255</red>
|
||||
<green>250</green>
|
||||
<blue>230</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</inactive>
|
||||
<disabled>
|
||||
<colorrole role="Base" >
|
||||
<brush brushstyle="SolidPattern" >
|
||||
<color alpha="255" >
|
||||
<red>207</red>
|
||||
<green>207</green>
|
||||
<blue>207</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</disabled>
|
||||
</palette>
|
||||
</property>
|
||||
<property name="frameShape" >
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="frameShadow" >
|
||||
<enum>QFrame::Sunken</enum>
|
||||
</property>
|
||||
<property name="horizontalScrollBarPolicy" >
|
||||
<enum>Qt::ScrollBarAlwaysOff</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QMenuBar" name="menubar" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>555</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuHelp" >
|
||||
<property name="title" >
|
||||
<string>&Help</string>
|
||||
</property>
|
||||
<addaction name="actionStarthere" />
|
||||
<addaction name="separator" />
|
||||
<addaction name="actionReportbug" />
|
||||
<addaction name="actionForum" />
|
||||
<addaction name="separator" />
|
||||
<addaction name="actionAbout" />
|
||||
<addaction name="separator" />
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuEdit" >
|
||||
<property name="title" >
|
||||
<string>&Edit</string>
|
||||
</property>
|
||||
<addaction name="actionUndoAnswer" />
|
||||
<addaction name="separator" />
|
||||
<addaction name="actionAddcards" />
|
||||
<addaction name="actionEditdeck" />
|
||||
<addaction name="separator" />
|
||||
<addaction name="actionDisplayProperties" />
|
||||
<addaction name="actionModelProperties" />
|
||||
<addaction name="actionDeckProperties" />
|
||||
<addaction name="separator" />
|
||||
<addaction name="actionPreferences" />
|
||||
<addaction name="separator" />
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuDeck" >
|
||||
<property name="title" >
|
||||
<string>&Deck</string>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuOpenRecent" >
|
||||
<property name="title" >
|
||||
<string>Open &Recent</string>
|
||||
</property>
|
||||
<property name="icon" >
|
||||
<iconset resource="../icons.qrc" >
|
||||
<normaloff>:/icons/document-open-recent.png</normaloff>:/icons/document-open-recent.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
<addaction name="actionNew" />
|
||||
<addaction name="actionOpen" />
|
||||
<addaction name="menuOpenRecent" />
|
||||
<addaction name="actionImport" />
|
||||
<addaction name="separator" />
|
||||
<addaction name="actionSave" />
|
||||
<addaction name="actionSaveAs" />
|
||||
<addaction name="actionSyncdeck" />
|
||||
<addaction name="actionExport" />
|
||||
<addaction name="separator" />
|
||||
<addaction name="actionClose" />
|
||||
<addaction name="separator" />
|
||||
<addaction name="separator" />
|
||||
<addaction name="actionExit" />
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuTools" >
|
||||
<property name="title" >
|
||||
<string>&Tools</string>
|
||||
</property>
|
||||
<widget class="QMenu" name="menu_Lookup" >
|
||||
<property name="title" >
|
||||
<string>&Lookup</string>
|
||||
</property>
|
||||
<property name="icon" >
|
||||
<iconset resource="../icons.qrc" >
|
||||
<normaloff>:/icons/edit-find.png</normaloff>:/icons/edit-find.png</iconset>
|
||||
</property>
|
||||
<addaction name="actionLookup_expr" />
|
||||
<addaction name="actionLookup_mean" />
|
||||
<addaction name="separator" />
|
||||
<addaction name="actionLookup_as" />
|
||||
<addaction name="actionLookup_es" />
|
||||
<addaction name="actionLookup_esk" />
|
||||
</widget>
|
||||
<addaction name="actionMarkCard" />
|
||||
<addaction name="actionSuspendCard" />
|
||||
<addaction name="separator" />
|
||||
<addaction name="actionRepeatAudio" />
|
||||
<addaction name="actionRepeatQuestionAudio" />
|
||||
<addaction name="actionRepeatAnswerAudio" />
|
||||
<addaction name="separator" />
|
||||
<addaction name="actionGraphs" />
|
||||
<addaction name="actionDstats" />
|
||||
<addaction name="actionKstats" />
|
||||
<addaction name="actionCstats" />
|
||||
<addaction name="separator" />
|
||||
<addaction name="menu_Lookup" />
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuAdvanced" >
|
||||
<property name="title" >
|
||||
<string>&Advanced</string>
|
||||
</property>
|
||||
<addaction name="actionMergeModels" />
|
||||
<addaction name="separator" />
|
||||
<addaction name="actionCheckMediaDatabase" />
|
||||
<addaction name="separator" />
|
||||
<addaction name="actionCheckDatabaseIntegrity" />
|
||||
<addaction name="actionOptimizeDatabase" />
|
||||
</widget>
|
||||
<addaction name="menuDeck" />
|
||||
<addaction name="menuEdit" />
|
||||
<addaction name="menuTools" />
|
||||
<addaction name="menuAdvanced" />
|
||||
<addaction name="menuHelp" />
|
||||
</widget>
|
||||
<widget class="QStatusBar" name="statusbar" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>269</y>
|
||||
<width>555</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QToolBar" name="toolBar" >
|
||||
<property name="enabled" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>23</y>
|
||||
<width>555</width>
|
||||
<height>34</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<attribute name="toolBarArea" >
|
||||
<enum>TopToolBarArea</enum>
|
||||
</attribute>
|
||||
<attribute name="toolBarBreak" >
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<addaction name="actionNew" />
|
||||
<addaction name="actionOpen" />
|
||||
<addaction name="actionSave" />
|
||||
<addaction name="actionSyncdeck" />
|
||||
<addaction name="separator" />
|
||||
<addaction name="actionAddcards" />
|
||||
<addaction name="actionEditdeck" />
|
||||
<addaction name="actionDisplayProperties" />
|
||||
<addaction name="separator" />
|
||||
<addaction name="actionGraphs" />
|
||||
<addaction name="actionDstats" />
|
||||
<addaction name="actionCstats" />
|
||||
<addaction name="separator" />
|
||||
<addaction name="actionRepeatAudio" />
|
||||
<addaction name="actionMarkCard" />
|
||||
</widget>
|
||||
<action name="actionExit" >
|
||||
<property name="icon" >
|
||||
<iconset resource="../icons.qrc" >
|
||||
<normaloff>:/icons/application-exit.png</normaloff>:/icons/application-exit.png</iconset>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>E&xit</string>
|
||||
</property>
|
||||
<property name="shortcut" >
|
||||
<string>Ctrl+Q</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionNew" >
|
||||
<property name="icon" >
|
||||
<iconset resource="../icons.qrc" >
|
||||
<normaloff>:/icons/document-new.png</normaloff>:/icons/document-new.png</iconset>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>&New..</string>
|
||||
</property>
|
||||
<property name="shortcut" >
|
||||
<string>Ctrl+N</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionOpen" >
|
||||
<property name="icon" >
|
||||
<iconset resource="../icons.qrc" >
|
||||
<normaloff>:/icons/document-open.png</normaloff>:/icons/document-open.png</iconset>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>&Open..</string>
|
||||
</property>
|
||||
<property name="shortcut" >
|
||||
<string>Ctrl+O</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionClose" >
|
||||
<property name="icon" >
|
||||
<iconset resource="../icons.qrc" >
|
||||
<normaloff>:/icons/fileclose.png</normaloff>:/icons/fileclose.png</iconset>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>&Close</string>
|
||||
</property>
|
||||
<property name="shortcut" >
|
||||
<string>Ctrl+W</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionSave" >
|
||||
<property name="icon" >
|
||||
<iconset resource="../icons.qrc" >
|
||||
<normaloff>:/icons/document-save.png</normaloff>:/icons/document-save.png</iconset>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>&Save</string>
|
||||
</property>
|
||||
<property name="shortcut" >
|
||||
<string>Ctrl+S</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionSyncdeck" >
|
||||
<property name="icon" >
|
||||
<iconset resource="../icons.qrc" >
|
||||
<normaloff>:/icons/multisynk.png</normaloff>:/icons/multisynk.png</iconset>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Save and S&ync</string>
|
||||
</property>
|
||||
<property name="shortcut" >
|
||||
<string>Ctrl+Y</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionAddcards" >
|
||||
<property name="icon" >
|
||||
<iconset resource="../icons.qrc" >
|
||||
<normaloff>:/icons/list-add.png</normaloff>:/icons/list-add.png</iconset>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>&Add Facts..</string>
|
||||
</property>
|
||||
<property name="toolTip" >
|
||||
<string>Add Cards</string>
|
||||
</property>
|
||||
<property name="shortcut" >
|
||||
<string>Ctrl+A</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionEditdeck" >
|
||||
<property name="icon" >
|
||||
<iconset resource="../icons.qrc" >
|
||||
<normaloff>:/icons/view_text.png</normaloff>:/icons/view_text.png</iconset>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>&Edit Facts..</string>
|
||||
</property>
|
||||
<property name="shortcut" >
|
||||
<string>Ctrl+E</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionPreferences" >
|
||||
<property name="icon" >
|
||||
<iconset resource="../icons.qrc" >
|
||||
<normaloff>:/icons/configure.png</normaloff>:/icons/configure.png</iconset>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>&Preferences..</string>
|
||||
</property>
|
||||
<property name="statusTip" >
|
||||
<string>Application-wide preferences.</string>
|
||||
</property>
|
||||
<property name="shortcut" >
|
||||
<string>Ctrl+P</string>
|
||||
</property>
|
||||
<property name="menuRole" >
|
||||
<enum>QAction::PreferencesRole</enum>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionLookup_expr" >
|
||||
<property name="text" >
|
||||
<string>...&expression on ALC</string>
|
||||
</property>
|
||||
<property name="shortcut" >
|
||||
<string>Ctrl+1</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionLookup_mean" >
|
||||
<property name="text" >
|
||||
<string>...&meaning on ALC</string>
|
||||
</property>
|
||||
<property name="shortcut" >
|
||||
<string>Ctrl+2</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionLookup_as" >
|
||||
<property name="text" >
|
||||
<string>...&selection on ALC</string>
|
||||
</property>
|
||||
<property name="shortcut" >
|
||||
<string>Ctrl+3</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionLookup_es" >
|
||||
<property name="text" >
|
||||
<string>...&word selection on Edict</string>
|
||||
</property>
|
||||
<property name="shortcut" >
|
||||
<string>Ctrl+4</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionLookup_esk" >
|
||||
<property name="text" >
|
||||
<string>...&kanji selection on Edict</string>
|
||||
</property>
|
||||
<property name="shortcut" >
|
||||
<string>Ctrl+5</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionKstats" >
|
||||
<property name="icon" >
|
||||
<iconset resource="../icons.qrc" >
|
||||
<normaloff>:/icons/kanji.png</normaloff>:/icons/kanji.png</iconset>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>&Kanji Statistics</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionDstats" >
|
||||
<property name="icon" >
|
||||
<iconset resource="../icons.qrc" >
|
||||
<normaloff>:/icons/spreadsheet.png</normaloff>:/icons/spreadsheet.png</iconset>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>&Deck Statistics</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionStarthere" >
|
||||
<property name="icon" >
|
||||
<iconset resource="../icons.qrc" >
|
||||
<normaloff>:/icons/go-home.png</normaloff>:/icons/go-home.png</iconset>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>&Start Here..</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionReportbug" >
|
||||
<property name="icon" >
|
||||
<iconset resource="../icons.qrc" >
|
||||
<normaloff>:/icons/kbugbuster.png</normaloff>:/icons/kbugbuster.png</iconset>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>&Report Bug..</string>
|
||||
</property>
|
||||
<property name="whatsThis" >
|
||||
<string>Open the bug tracker.</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionAbout" >
|
||||
<property name="icon" >
|
||||
<iconset resource="../icons.qrc" >
|
||||
<normaloff>:/icons/anki.png</normaloff>:/icons/anki.png</iconset>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>&About..</string>
|
||||
</property>
|
||||
<property name="menuRole" >
|
||||
<enum>QAction::AboutRole</enum>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionCstats" >
|
||||
<property name="icon" >
|
||||
<iconset resource="../icons.qrc" >
|
||||
<normaloff>:/icons/package_games_card.png</normaloff>:/icons/package_games_card.png</iconset>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>&Card Statistics</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionDeckProperties" >
|
||||
<property name="icon" >
|
||||
<iconset resource="../icons.qrc" >
|
||||
<normaloff>:/icons/contents.png</normaloff>:/icons/contents.png</iconset>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>&Deck Properties..</string>
|
||||
</property>
|
||||
<property name="statusTip" >
|
||||
<string>Customize syncing, scheduling, priorities and models.</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionImport" >
|
||||
<property name="icon" >
|
||||
<iconset resource="../icons.qrc" >
|
||||
<normaloff>:/icons/document-import.png</normaloff>:/icons/document-import.png</iconset>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>&Import..</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionGraphs" >
|
||||
<property name="icon" >
|
||||
<iconset resource="../icons.qrc" >
|
||||
<normaloff>:/icons/colorscm.png</normaloff>:/icons/colorscm.png</iconset>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>&Graphs..</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionExport" >
|
||||
<property name="icon" >
|
||||
<iconset resource="../icons.qrc" >
|
||||
<normaloff>:/icons/document-export.png</normaloff>:/icons/document-export.png</iconset>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Expor&t...</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionDisplayProperties" >
|
||||
<property name="icon" >
|
||||
<iconset resource="../icons.qrc" >
|
||||
<normaloff>:/icons/preferences-desktop-font.png</normaloff>:/icons/preferences-desktop-font.png</iconset>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Disp&lay Properties..</string>
|
||||
</property>
|
||||
<property name="statusTip" >
|
||||
<string>Customize fonts, colours and alignment.</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionOpenSamples" >
|
||||
<property name="text" >
|
||||
<string>Open Sa&mple...</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionMarkCard" >
|
||||
<property name="checkable" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="icon" >
|
||||
<iconset resource="../icons.qrc" >
|
||||
<normaloff>:/icons/rating.png</normaloff>:/icons/rating.png</iconset>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>&Mark Card</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionSuspendCard" >
|
||||
<property name="icon" >
|
||||
<iconset resource="../icons.qrc" >
|
||||
<normaloff>:/icons/media-playback-pause.png</normaloff>:/icons/media-playback-pause.png</iconset>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>&Suspend fact</string>
|
||||
</property>
|
||||
<property name="statusTip" >
|
||||
<string>Stop reviewing this card until it's unsuspended in the editor.</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionModelProperties" >
|
||||
<property name="icon" >
|
||||
<iconset resource="../icons.qrc" >
|
||||
<normaloff>:/icons/kpersonalizer.png</normaloff>:/icons/kpersonalizer.png</iconset>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>&Model Properties..</string>
|
||||
</property>
|
||||
<property name="statusTip" >
|
||||
<string>Customize card layout, fields, etc.</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionRepeatQuestionAudio" >
|
||||
<property name="text" >
|
||||
<string>Repeat &Question Audio</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionRepeatAnswerAudio" >
|
||||
<property name="text" >
|
||||
<string>Repeat &Answer Audio</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionRepeatAudio" >
|
||||
<property name="enabled" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="icon" >
|
||||
<iconset resource="../icons.qrc" >
|
||||
<normaloff>:/icons/media-playback-start.png</normaloff>:/icons/media-playback-start.png</iconset>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Repeat las&t audio</string>
|
||||
</property>
|
||||
<property name="shortcut" >
|
||||
<string>Ctrl+R</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionUndoAnswer" >
|
||||
<property name="enabled" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="icon" >
|
||||
<iconset resource="../icons.qrc" >
|
||||
<normaloff>:/icons/edit-undo.png</normaloff>:/icons/edit-undo.png</iconset>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>&Undo last answer</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionForum" >
|
||||
<property name="icon" >
|
||||
<iconset resource="../icons.qrc" >
|
||||
<normaloff>:/icons/view-pim-news.png</normaloff>:/icons/view-pim-news.png</iconset>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>&Forum..</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionSaveAs" >
|
||||
<property name="icon" >
|
||||
<iconset resource="../icons.qrc" >
|
||||
<normaloff>:/icons/document-save-as.png</normaloff>:/icons/document-save-as.png</iconset>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Save &As..</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionCheckDatabaseIntegrity" >
|
||||
<property name="icon" >
|
||||
<iconset resource="../icons.qrc" >
|
||||
<normaloff>:/icons/sqlitebrowser.png</normaloff>:/icons/sqlitebrowser.png</iconset>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Check Database Integrity</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionOptimizeDatabase" >
|
||||
<property name="icon" >
|
||||
<iconset resource="../icons.qrc" >
|
||||
<normaloff>:/icons/games-solve.png</normaloff>:/icons/games-solve.png</iconset>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Optimize Database</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionMergeModels" >
|
||||
<property name="icon" >
|
||||
<iconset resource="../icons.qrc" >
|
||||
<normaloff>:/icons/khtml_kget.png</normaloff>:/icons/khtml_kget.png</iconset>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Merge Models..</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionCheckMediaDatabase" >
|
||||
<property name="icon" >
|
||||
<iconset resource="../icons.qrc" >
|
||||
<normaloff>:/icons/text-speak.png</normaloff>:/icons/text-speak.png</iconset>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Check Media Database..</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../icons.qrc" />
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
782
designer/modelproperties.ui
Normal file
|
@ -0,0 +1,782 @@
|
|||
<ui version="4.0" >
|
||||
<class>ModelProperties</class>
|
||||
<widget class="QDialog" name="ModelProperties" >
|
||||
<property name="windowModality" >
|
||||
<enum>Qt::ApplicationModal</enum>
|
||||
</property>
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>544</width>
|
||||
<height>589</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
<string>Model Properties</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout" >
|
||||
<item>
|
||||
<widget class="QTabWidget" name="tabWidget" >
|
||||
<property name="currentIndex" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>522</width>
|
||||
<height>515</height>
|
||||
</rect>
|
||||
</property>
|
||||
<attribute name="title" >
|
||||
<string>Model properties</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="margin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_7" >
|
||||
<property name="text" >
|
||||
<string><h1>Model properties</h1></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QGridLayout" >
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="0" column="0" >
|
||||
<widget class="QLabel" name="label" >
|
||||
<property name="text" >
|
||||
<string><b>Name</b></string>
|
||||
</property>
|
||||
<property name="alignment" >
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" >
|
||||
<widget class="QLabel" name="label_2" >
|
||||
<property name="text" >
|
||||
<string><b>Description</b></string>
|
||||
</property>
|
||||
<property name="alignment" >
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" >
|
||||
<widget class="QLineEdit" name="name" />
|
||||
</item>
|
||||
<item row="2" column="1" >
|
||||
<widget class="QTextEdit" name="description" >
|
||||
<property name="tabChangesFocus" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0" >
|
||||
<widget class="QLabel" name="label_4" >
|
||||
<property name="text" >
|
||||
<string><b>Features<a href="http://ichi2.net/anki/wiki/Key_Terms_and_Concepts#head-f57a8f871fc97ceb2f6daa43528fd640ee63b4f4">?</a></b></string>
|
||||
</property>
|
||||
<property name="alignment" >
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
</property>
|
||||
<property name="openExternalLinks" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" >
|
||||
<widget class="QLabel" name="label_3" >
|
||||
<property name="text" >
|
||||
<string><b>Tags<a href="http://ichi2.net/anki/wiki/Key_Terms_and_Concepts#head-09efbe5fd6809ae0d90543adf92014b8eb9ef1bf">?</a></b></string>
|
||||
</property>
|
||||
<property name="alignment" >
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
</property>
|
||||
<property name="openExternalLinks" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" >
|
||||
<widget class="QLineEdit" name="tags" />
|
||||
</item>
|
||||
<item row="3" column="0" >
|
||||
<widget class="QLabel" name="label_5" >
|
||||
<property name="text" >
|
||||
<string><b>Card spacing<a href="http://ichi2.net/anki/wiki/Key_Terms_and_Concepts#head-59a81e35b6afb23930005e943068945214d194b3">?</a></b></string>
|
||||
</property>
|
||||
<property name="alignment" >
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
</property>
|
||||
<property name="openExternalLinks" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1" >
|
||||
<layout class="QGridLayout" >
|
||||
<item row="0" column="0" >
|
||||
<widget class="QLabel" name="label_16" >
|
||||
<property name="text" >
|
||||
<string>Minimum spacing<a href="http://ichi2.net/anki/wiki/Key_Terms_and_Concepts#head-4ee3a58e2fdd61da8ef81984213862d3bc0ed4bd">?</a></string>
|
||||
</property>
|
||||
<property name="openExternalLinks" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2" >
|
||||
<widget class="QLineEdit" name="initialSpacing" />
|
||||
</item>
|
||||
<item row="0" column="1" >
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="0" >
|
||||
<widget class="QLabel" name="label_24" >
|
||||
<property name="text" >
|
||||
<string>Minimum interval multiplier<a href="http://ichi2.net/anki/wiki/Key_Terms_and_Concepts#head-51074b785bb6049b44fce9f18fca198100c4d2f7">?</a></string>
|
||||
</property>
|
||||
<property name="openExternalLinks" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2" >
|
||||
<widget class="QLineEdit" name="spacing" />
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="4" column="1" >
|
||||
<widget class="QLineEdit" name="decorators" />
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_2" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>522</width>
|
||||
<height>515</height>
|
||||
</rect>
|
||||
</property>
|
||||
<attribute name="title" >
|
||||
<string>Fields</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="margin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_8" >
|
||||
<property name="text" >
|
||||
<string><h1>Fields</h1></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_10" >
|
||||
<property name="text" >
|
||||
<string>A flashcard is made from a number of fields, like "meaning", "notes", etc.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" >
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QListWidget" name="fieldList" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize" >
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>60</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QPushButton" name="fieldAdd" >
|
||||
<property name="text" >
|
||||
<string>&Add</string>
|
||||
</property>
|
||||
<property name="autoDefault" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="fieldDelete" >
|
||||
<property name="text" >
|
||||
<string>&Delete</string>
|
||||
</property>
|
||||
<property name="autoDefault" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="fieldUp" >
|
||||
<property name="toolTip" >
|
||||
<string>Move selected field up</string>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Move &Up</string>
|
||||
</property>
|
||||
<property name="autoDefault" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="fieldDown" >
|
||||
<property name="toolTip" >
|
||||
<string>Move selected field down</string>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Move Dow&n</string>
|
||||
</property>
|
||||
<property name="autoDefault" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="fieldEditBox" >
|
||||
<property name="title" >
|
||||
<string>Field properties</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="margin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QGridLayout" >
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="2" column="0" >
|
||||
<widget class="QLabel" name="label_18" >
|
||||
<property name="text" >
|
||||
<string><b>Unique?</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" >
|
||||
<widget class="QLineEdit" name="fieldName" />
|
||||
</item>
|
||||
<item row="2" column="1" >
|
||||
<widget class="QCheckBox" name="fieldUnique" >
|
||||
<property name="text" >
|
||||
<string>Prevent me from entering the same thing in this field twice</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" >
|
||||
<widget class="QLabel" name="label_20" >
|
||||
<property name="text" >
|
||||
<string><b>Name</b></string>
|
||||
</property>
|
||||
<property name="alignment" >
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" >
|
||||
<widget class="QLabel" name="label_19" >
|
||||
<property name="text" >
|
||||
<string><b>Description</b></string>
|
||||
</property>
|
||||
<property name="alignment" >
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" >
|
||||
<widget class="QLabel" name="label_17" >
|
||||
<property name="text" >
|
||||
<string><b>Required?</b></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1" >
|
||||
<widget class="QCheckBox" name="fieldRequired" >
|
||||
<property name="text" >
|
||||
<string>Prevent new cards from being added if this field is blank</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0" >
|
||||
<widget class="QLabel" name="label_22" >
|
||||
<property name="text" >
|
||||
<string><b>Features<a href="http://ichi2.net/anki/wiki/Key_Terms_and_Concepts#head-f57a8f871fc97ceb2f6daa43528fd640ee63b4f4">?</a></b></string>
|
||||
</property>
|
||||
<property name="alignment" >
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
</property>
|
||||
<property name="openExternalLinks" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" >
|
||||
<widget class="QTextEdit" name="fieldDescription" >
|
||||
<property name="tabChangesFocus" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1" >
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="spacing" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="fieldFeatures" />
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="4" column="0" >
|
||||
<widget class="QLabel" name="label_21" >
|
||||
<property name="text" >
|
||||
<string><b>Numeric?</b></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1" >
|
||||
<widget class="QCheckBox" name="numeric" >
|
||||
<property name="text" >
|
||||
<string>Sort this field using numeric order instead of string order</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_3" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>522</width>
|
||||
<height>515</height>
|
||||
</rect>
|
||||
</property>
|
||||
<attribute name="title" >
|
||||
<string>Cards</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="margin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_9" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string><h1>Card models</h1></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_11" >
|
||||
<property name="text" >
|
||||
<string>One or more cards are generated for each piece of information you enter into Anki. Here you can control how many cards are generated, and what they look like. Spacing is the amount of time before showing a different card for the same piece of information.</string>
|
||||
</property>
|
||||
<property name="wordWrap" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" >
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QListWidget" name="cardList" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize" >
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>60</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QPushButton" name="cardAdd" >
|
||||
<property name="text" >
|
||||
<string>&Add</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="cardToggle" >
|
||||
<property name="text" >
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="cardDelete" >
|
||||
<property name="text" >
|
||||
<string>&Delete</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="cardUp" >
|
||||
<property name="toolTip" >
|
||||
<string>Move selected card model up</string>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Move &Up</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="cardDown" >
|
||||
<property name="toolTip" >
|
||||
<string>Move selected card model down</string>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Move Dow&n</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="cardEditBox" >
|
||||
<property name="title" >
|
||||
<string>Edit card</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="margin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QGridLayout" >
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="1" column="1" >
|
||||
<widget class="QTextEdit" name="cardDescription" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximumSize" >
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>60</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="horizontalScrollBarPolicy" >
|
||||
<enum>Qt::ScrollBarAlwaysOff</enum>
|
||||
</property>
|
||||
<property name="tabChangesFocus" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" >
|
||||
<widget class="QLabel" name="label_13" >
|
||||
<property name="text" >
|
||||
<string><b>Description</b></string>
|
||||
</property>
|
||||
<property name="alignment" >
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0" >
|
||||
<widget class="QLabel" name="label_23" >
|
||||
<property name="text" >
|
||||
<string><b>Question hiding</b></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1" >
|
||||
<widget class="QCheckBox" name="questionInAnswer" >
|
||||
<property name="text" >
|
||||
<string>Hide the question when showing answer</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1" >
|
||||
<widget class="QTextEdit" name="cardAnswer" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximumSize" >
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>60</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="horizontalScrollBarPolicy" >
|
||||
<enum>Qt::ScrollBarAlwaysOff</enum>
|
||||
</property>
|
||||
<property name="tabChangesFocus" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="acceptRichText" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" >
|
||||
<widget class="QLabel" name="label_15" >
|
||||
<property name="text" >
|
||||
<string><b>Answer format<a href="http://ichi2.net/anki/wiki/Key_Terms_and_Concepts#head-b8916ff117aa0da4a414ce9b9b9be4a232eab2f4">?</a></b></string>
|
||||
</property>
|
||||
<property name="alignment" >
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
</property>
|
||||
<property name="openExternalLinks" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" >
|
||||
<widget class="QLineEdit" name="cardName" />
|
||||
</item>
|
||||
<item row="2" column="1" >
|
||||
<widget class="QTextEdit" name="cardQuestion" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximumSize" >
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>60</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="horizontalScrollBarPolicy" >
|
||||
<enum>Qt::ScrollBarAlwaysOff</enum>
|
||||
</property>
|
||||
<property name="tabChangesFocus" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" >
|
||||
<widget class="QLabel" name="label_12" >
|
||||
<property name="text" >
|
||||
<string><b>Name/tag<a href="http://ichi2.net/anki/wiki/Key_Terms_and_Concepts#head-09efbe5fd6809ae0d90543adf92014b8eb9ef1bf">?</a></b></string>
|
||||
</property>
|
||||
<property name="alignment" >
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
</property>
|
||||
<property name="openExternalLinks" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" >
|
||||
<widget class="QLabel" name="label_14" >
|
||||
<property name="text" >
|
||||
<string><b>Question format<a href="http://ichi2.net/anki/wiki/Key_Terms_and_Concepts#head-b8916ff117aa0da4a414ce9b9b9be4a232eab2f4">?</a></b></string>
|
||||
</property>
|
||||
<property name="alignment" >
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
</property>
|
||||
<property name="openExternalLinks" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox" >
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons" >
|
||||
<set>QDialogButtonBox::Close</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>tabWidget</tabstop>
|
||||
<tabstop>name</tabstop>
|
||||
<tabstop>tags</tabstop>
|
||||
<tabstop>description</tabstop>
|
||||
<tabstop>initialSpacing</tabstop>
|
||||
<tabstop>spacing</tabstop>
|
||||
<tabstop>decorators</tabstop>
|
||||
<tabstop>fieldList</tabstop>
|
||||
<tabstop>fieldAdd</tabstop>
|
||||
<tabstop>fieldDelete</tabstop>
|
||||
<tabstop>fieldUp</tabstop>
|
||||
<tabstop>fieldDown</tabstop>
|
||||
<tabstop>fieldName</tabstop>
|
||||
<tabstop>fieldDescription</tabstop>
|
||||
<tabstop>fieldUnique</tabstop>
|
||||
<tabstop>fieldRequired</tabstop>
|
||||
<tabstop>numeric</tabstop>
|
||||
<tabstop>fieldFeatures</tabstop>
|
||||
<tabstop>cardList</tabstop>
|
||||
<tabstop>cardAdd</tabstop>
|
||||
<tabstop>cardToggle</tabstop>
|
||||
<tabstop>cardDelete</tabstop>
|
||||
<tabstop>cardUp</tabstop>
|
||||
<tabstop>cardDown</tabstop>
|
||||
<tabstop>cardName</tabstop>
|
||||
<tabstop>cardDescription</tabstop>
|
||||
<tabstop>cardQuestion</tabstop>
|
||||
<tabstop>cardAnswer</tabstop>
|
||||
<tabstop>questionInAnswer</tabstop>
|
||||
<tabstop>buttonBox</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>ModelProperties</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>ModelProperties</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
645
designer/preferences.ui
Normal file
|
@ -0,0 +1,645 @@
|
|||
<ui version="4.0" >
|
||||
<class>Preferences</class>
|
||||
<widget class="QDialog" name="Preferences" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>532</width>
|
||||
<height>531</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
<string>Preferences</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2" >
|
||||
<item>
|
||||
<widget class="QTabWidget" name="tabWidget" >
|
||||
<property name="currentIndex" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab_1" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>510</width>
|
||||
<height>449</height>
|
||||
</rect>
|
||||
</property>
|
||||
<attribute name="title" >
|
||||
<string>Language, Fonts and Colours</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout" >
|
||||
<item>
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label" >
|
||||
<property name="text" >
|
||||
<string><h1>Interface language</h1>The language for the user interface: dialogs, menus, etc.</string>
|
||||
</property>
|
||||
<property name="wordWrap" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="interfaceLang" >
|
||||
<property name="minimumSize" >
|
||||
<size>
|
||||
<width>300</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string><h1>Standard fonts</h1>See 'display properties' for deck specific font preferences.</string>
|
||||
</property>
|
||||
<property name="wordWrap" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QGridLayout" >
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="0" column="2" >
|
||||
<widget class="QSpinBox" name="interfaceSize" >
|
||||
<property name="maximum" >
|
||||
<number>300</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" >
|
||||
<widget class="QLabel" name="label_9" >
|
||||
<property name="text" >
|
||||
<string>Last card</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" >
|
||||
<widget class="QFontComboBox" name="interfaceFamily" >
|
||||
<property name="maximumSize" >
|
||||
<size>
|
||||
<width>170</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" >
|
||||
<widget class="QFontComboBox" name="lastCardFamily" >
|
||||
<property name="maximumSize" >
|
||||
<size>
|
||||
<width>170</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" >
|
||||
<widget class="QLabel" name="label_8" >
|
||||
<property name="text" >
|
||||
<string>Interface</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2" >
|
||||
<widget class="QSpinBox" name="lastCardSize" >
|
||||
<property name="maximum" >
|
||||
<number>300</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" >
|
||||
<widget class="QLabel" name="label_10" >
|
||||
<property name="text" >
|
||||
<string>Card editor</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1" >
|
||||
<widget class="QFontComboBox" name="editFamily" >
|
||||
<property name="maximumSize" >
|
||||
<size>
|
||||
<width>170</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2" >
|
||||
<widget class="QSpinBox" name="editSize" >
|
||||
<property name="minimum" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="maximum" >
|
||||
<number>20</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string><h1>Standard colours</h1>These colours are used for all decks.</string>
|
||||
</property>
|
||||
<property name="wordWrap" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QGridLayout" >
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="0" column="1" >
|
||||
<widget class="QPushButton" name="interfaceColour" >
|
||||
<property name="text" >
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" >
|
||||
<widget class="QLabel" name="label_13" >
|
||||
<property name="text" >
|
||||
<string>Interface colour</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" >
|
||||
<widget class="QPushButton" name="lastCardColour" >
|
||||
<property name="text" >
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" >
|
||||
<widget class="QLabel" name="label_14" >
|
||||
<property name="text" >
|
||||
<string>Last card colour</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" >
|
||||
<widget class="QLabel" name="label_15" >
|
||||
<property name="text" >
|
||||
<string>Background colour</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1" >
|
||||
<widget class="QPushButton" name="backgroundColour" >
|
||||
<property name="text" >
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer" >
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_2" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>453</width>
|
||||
<height>443</height>
|
||||
</rect>
|
||||
</property>
|
||||
<attribute name="title" >
|
||||
<string>Autosave and Synchronisation</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="margin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" >
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="spacing" >
|
||||
<number>12</number>
|
||||
</property>
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_4" >
|
||||
<property name="text" >
|
||||
<string><h1>Autosaving</h1>Anki can save your progress automatically.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QGridLayout" >
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="1" column="0" >
|
||||
<widget class="QCheckBox" name="saveAfterEvery" >
|
||||
<property name="text" >
|
||||
<string>Save after answering</string>
|
||||
</property>
|
||||
<property name="checked" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" >
|
||||
<widget class="QSpinBox" name="saveAfterEveryNum" />
|
||||
</item>
|
||||
<item row="0" column="0" >
|
||||
<widget class="QCheckBox" name="saveWhenClosing" >
|
||||
<property name="text" >
|
||||
<string>Save when closing</string>
|
||||
</property>
|
||||
<property name="checked" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2" >
|
||||
<widget class="QLabel" name="label_5" >
|
||||
<property name="text" >
|
||||
<string>cards</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" >
|
||||
<widget class="QCheckBox" name="saveAfterAdding" >
|
||||
<property name="text" >
|
||||
<string>Save after adding</string>
|
||||
</property>
|
||||
<property name="checked" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1" >
|
||||
<widget class="QSpinBox" name="saveAfterAddingNum" />
|
||||
</item>
|
||||
<item row="2" column="2" >
|
||||
<widget class="QLabel" name="label_7" >
|
||||
<property name="text" >
|
||||
<string>facts</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_16" >
|
||||
<property name="text" >
|
||||
<string><h1>Synchronisation</h1>Synchronisation enables you to access your deck from the web and your mobile phone. You can <a href="http://anki.ichi2.net/">create a free account</a>.</string>
|
||||
</property>
|
||||
<property name="wordWrap" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="openExternalLinks" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QGridLayout" >
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="1" column="0" >
|
||||
<widget class="QLabel" name="label_18" >
|
||||
<property name="text" >
|
||||
<string>Password</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" >
|
||||
<widget class="QLabel" name="label_17" >
|
||||
<property name="text" >
|
||||
<string>Username</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" >
|
||||
<widget class="QLineEdit" name="syncUser" />
|
||||
</item>
|
||||
<item row="3" column="0" >
|
||||
<widget class="QCheckBox" name="syncOnClose" >
|
||||
<property name="text" >
|
||||
<string>Sync on close</string>
|
||||
</property>
|
||||
<property name="checked" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" >
|
||||
<widget class="QLineEdit" name="syncPass" >
|
||||
<property name="echoMode" >
|
||||
<enum>QLineEdit::Password</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" >
|
||||
<widget class="QCheckBox" name="syncOnOpen" >
|
||||
<property name="text" >
|
||||
<string>Sync on open</string>
|
||||
</property>
|
||||
<property name="checked" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_3" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>453</width>
|
||||
<height>443</height>
|
||||
</rect>
|
||||
</property>
|
||||
<attribute name="title" >
|
||||
<string>Advanced Settings</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" >
|
||||
<item>
|
||||
<layout class="QGridLayout" >
|
||||
<item row="1" column="0" >
|
||||
<widget class="QCheckBox" name="showToolbar" >
|
||||
<property name="text" >
|
||||
<string>Show toolbar on startup</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" >
|
||||
<widget class="QCheckBox" name="compactEaseButtons" >
|
||||
<property name="text" >
|
||||
<string>Use compact answer button style</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" >
|
||||
<widget class="QLabel" name="label_6" >
|
||||
<property name="text" >
|
||||
<string><h1>Advanced settings</h1></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" >
|
||||
<widget class="QCheckBox" name="tallButtons" >
|
||||
<property name="text" >
|
||||
<string>Tall buttons (for touchscreen)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0" >
|
||||
<widget class="QCheckBox" name="editCurrentOnly" >
|
||||
<property name="text" >
|
||||
<string>Start Edit Deck with only current card selected</string>
|
||||
</property>
|
||||
<property name="checked" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0" >
|
||||
<widget class="QCheckBox" name="suppressEstimates" >
|
||||
<property name="text" >
|
||||
<string>Hide next interval when showing answer buttons</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0" >
|
||||
<widget class="QCheckBox" name="suppressLastCardInterval" >
|
||||
<property name="text" >
|
||||
<string>Hide interval of last card</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0" >
|
||||
<widget class="QCheckBox" name="suppressLastCardContent" >
|
||||
<property name="text" >
|
||||
<string>Hide question/answer of last card</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0" >
|
||||
<widget class="QCheckBox" name="showTray" >
|
||||
<property name="text" >
|
||||
<string>Show tray icon</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="0" >
|
||||
<widget class="QCheckBox" name="showTimer" >
|
||||
<property name="text" >
|
||||
<string>Show timer</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox" >
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons" >
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>tabWidget</tabstop>
|
||||
<tabstop>interfaceLang</tabstop>
|
||||
<tabstop>interfaceFamily</tabstop>
|
||||
<tabstop>interfaceSize</tabstop>
|
||||
<tabstop>lastCardFamily</tabstop>
|
||||
<tabstop>lastCardSize</tabstop>
|
||||
<tabstop>editFamily</tabstop>
|
||||
<tabstop>editSize</tabstop>
|
||||
<tabstop>interfaceColour</tabstop>
|
||||
<tabstop>lastCardColour</tabstop>
|
||||
<tabstop>backgroundColour</tabstop>
|
||||
<tabstop>saveWhenClosing</tabstop>
|
||||
<tabstop>saveAfterEvery</tabstop>
|
||||
<tabstop>saveAfterEveryNum</tabstop>
|
||||
<tabstop>saveAfterAdding</tabstop>
|
||||
<tabstop>saveAfterAddingNum</tabstop>
|
||||
<tabstop>syncUser</tabstop>
|
||||
<tabstop>syncPass</tabstop>
|
||||
<tabstop>syncOnOpen</tabstop>
|
||||
<tabstop>syncOnClose</tabstop>
|
||||
<tabstop>buttonBox</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>Preferences</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<x>266</x>
|
||||
<y>476</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>Preferences</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<x>334</x>
|
||||
<y>476</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>saveAfterEvery</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>saveAfterEveryNum</receiver>
|
||||
<slot>setEnabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<x>94</x>
|
||||
<y>157</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<x>235</x>
|
||||
<y>160</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>saveAfterAdding</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>saveAfterAddingNum</receiver>
|
||||
<slot>setEnabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<x>80</x>
|
||||
<y>178</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<x>174</x>
|
||||
<y>176</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
97
designer/sort.ui
Normal file
|
@ -0,0 +1,97 @@
|
|||
<ui version="4.0" >
|
||||
<class>Sort</class>
|
||||
<widget class="QDialog" name="Sort" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>425</width>
|
||||
<height>358</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
<string>Anki</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>20</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label" >
|
||||
<property name="text" >
|
||||
<string>Please choose a field to sort by.</string>
|
||||
</property>
|
||||
<property name="alignment" >
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<property name="wordWrap" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QListWidget" name="fields" >
|
||||
<property name="font" >
|
||||
<font>
|
||||
<pointsize>12</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="editTriggers" >
|
||||
<set>QAbstractItemView::NoEditTriggers</set>
|
||||
</property>
|
||||
<property name="tabKeyNavigation" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox" >
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons" >
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>Sort</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>Sort</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
97
designer/syncdeck.ui
Normal file
|
@ -0,0 +1,97 @@
|
|||
<ui version="4.0" >
|
||||
<class>DeckChooser</class>
|
||||
<widget class="QDialog" name="DeckChooser" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>484</width>
|
||||
<height>320</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
<string>Anki</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="leftMargin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="topMargin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="rightMargin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="bottomMargin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label" >
|
||||
<property name="text" >
|
||||
<string><h1>Where should we synchronize to?</h1></string>
|
||||
</property>
|
||||
<property name="alignment" >
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QListWidget" name="decks" >
|
||||
<property name="font" >
|
||||
<font>
|
||||
<pointsize>12</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox" >
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons" >
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>DeckChooser</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>DeckChooser</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
228
ez_setup.py
Normal file
|
@ -0,0 +1,228 @@
|
|||
#!python
|
||||
"""Bootstrap setuptools installation
|
||||
|
||||
If you want to use setuptools in your package's setup.py, just include this
|
||||
file in the same directory with it, and add this to the top of your setup.py::
|
||||
|
||||
from ez_setup import use_setuptools
|
||||
use_setuptools()
|
||||
|
||||
If you want to require a specific version of setuptools, set a download
|
||||
mirror, or use an alternate download directory, you can do so by supplying
|
||||
the appropriate options to ``use_setuptools()``.
|
||||
|
||||
This file can also be run as a script to install or upgrade setuptools.
|
||||
"""
|
||||
import sys
|
||||
DEFAULT_VERSION = "0.6c5"
|
||||
DEFAULT_URL = "http://cheeseshop.python.org/packages/%s/s/setuptools/" % sys.version[:3]
|
||||
|
||||
md5_data = {
|
||||
'setuptools-0.6b1-py2.3.egg': '8822caf901250d848b996b7f25c6e6ca',
|
||||
'setuptools-0.6b1-py2.4.egg': 'b79a8a403e4502fbb85ee3f1941735cb',
|
||||
'setuptools-0.6b2-py2.3.egg': '5657759d8a6d8fc44070a9d07272d99b',
|
||||
'setuptools-0.6b2-py2.4.egg': '4996a8d169d2be661fa32a6e52e4f82a',
|
||||
'setuptools-0.6b3-py2.3.egg': 'bb31c0fc7399a63579975cad9f5a0618',
|
||||
'setuptools-0.6b3-py2.4.egg': '38a8c6b3d6ecd22247f179f7da669fac',
|
||||
'setuptools-0.6b4-py2.3.egg': '62045a24ed4e1ebc77fe039aa4e6f7e5',
|
||||
'setuptools-0.6b4-py2.4.egg': '4cb2a185d228dacffb2d17f103b3b1c4',
|
||||
'setuptools-0.6c1-py2.3.egg': 'b3f2b5539d65cb7f74ad79127f1a908c',
|
||||
'setuptools-0.6c1-py2.4.egg': 'b45adeda0667d2d2ffe14009364f2a4b',
|
||||
'setuptools-0.6c2-py2.3.egg': 'f0064bf6aa2b7d0f3ba0b43f20817c27',
|
||||
'setuptools-0.6c2-py2.4.egg': '616192eec35f47e8ea16cd6a122b7277',
|
||||
'setuptools-0.6c3-py2.3.egg': 'f181fa125dfe85a259c9cd6f1d7b78fa',
|
||||
'setuptools-0.6c3-py2.4.egg': 'e0ed74682c998bfb73bf803a50e7b71e',
|
||||
'setuptools-0.6c3-py2.5.egg': 'abef16fdd61955514841c7c6bd98965e',
|
||||
'setuptools-0.6c4-py2.3.egg': 'b0b9131acab32022bfac7f44c5d7971f',
|
||||
'setuptools-0.6c4-py2.4.egg': '2a1f9656d4fbf3c97bf946c0a124e6e2',
|
||||
'setuptools-0.6c4-py2.5.egg': '8f5a052e32cdb9c72bcf4b5526f28afc',
|
||||
'setuptools-0.6c5-py2.3.egg': 'ee9fd80965da04f2f3e6b3576e9d8167',
|
||||
'setuptools-0.6c5-py2.4.egg': 'afe2adf1c01701ee841761f5bcd8aa64',
|
||||
'setuptools-0.6c5-py2.5.egg': 'a8d3f61494ccaa8714dfed37bccd3d5d',
|
||||
}
|
||||
|
||||
import sys, os
|
||||
|
||||
def _validate_md5(egg_name, data):
|
||||
if egg_name in md5_data:
|
||||
from md5 import md5
|
||||
digest = md5(data).hexdigest()
|
||||
if digest != md5_data[egg_name]:
|
||||
print >>sys.stderr, (
|
||||
"md5 validation of %s failed! (Possible download problem?)"
|
||||
% egg_name
|
||||
)
|
||||
sys.exit(2)
|
||||
return data
|
||||
|
||||
|
||||
def use_setuptools(
|
||||
version=DEFAULT_VERSION, download_base=DEFAULT_URL, to_dir=os.curdir,
|
||||
download_delay=15
|
||||
):
|
||||
"""Automatically find/download setuptools and make it available on sys.path
|
||||
|
||||
`version` should be a valid setuptools version number that is available
|
||||
as an egg for download under the `download_base` URL (which should end with
|
||||
a '/'). `to_dir` is the directory where setuptools will be downloaded, if
|
||||
it is not already available. If `download_delay` is specified, it should
|
||||
be the number of seconds that will be paused before initiating a download,
|
||||
should one be required. If an older version of setuptools is installed,
|
||||
this routine will print a message to ``sys.stderr`` and raise SystemExit in
|
||||
an attempt to abort the calling script.
|
||||
"""
|
||||
try:
|
||||
import setuptools
|
||||
if setuptools.__version__ == '0.0.1':
|
||||
print >>sys.stderr, (
|
||||
"You have an obsolete version of setuptools installed. Please\n"
|
||||
"remove it from your system entirely before rerunning this script."
|
||||
)
|
||||
sys.exit(2)
|
||||
except ImportError:
|
||||
egg = download_setuptools(version, download_base, to_dir, download_delay)
|
||||
sys.path.insert(0, egg)
|
||||
import setuptools; setuptools.bootstrap_install_from = egg
|
||||
|
||||
import pkg_resources
|
||||
try:
|
||||
pkg_resources.require("setuptools>="+version)
|
||||
|
||||
except pkg_resources.VersionConflict, e:
|
||||
# XXX could we install in a subprocess here?
|
||||
print >>sys.stderr, (
|
||||
"The required version of setuptools (>=%s) is not available, and\n"
|
||||
"can't be installed while this script is running. Please install\n"
|
||||
" a more recent version first.\n\n(Currently using %r)"
|
||||
) % (version, e.args[0])
|
||||
sys.exit(2)
|
||||
|
||||
def download_setuptools(
|
||||
version=DEFAULT_VERSION, download_base=DEFAULT_URL, to_dir=os.curdir,
|
||||
delay = 15
|
||||
):
|
||||
"""Download setuptools from a specified location and return its filename
|
||||
|
||||
`version` should be a valid setuptools version number that is available
|
||||
as an egg for download under the `download_base` URL (which should end
|
||||
with a '/'). `to_dir` is the directory where the egg will be downloaded.
|
||||
`delay` is the number of seconds to pause before an actual download attempt.
|
||||
"""
|
||||
import urllib2, shutil
|
||||
egg_name = "setuptools-%s-py%s.egg" % (version,sys.version[:3])
|
||||
url = download_base + egg_name
|
||||
saveto = os.path.join(to_dir, egg_name)
|
||||
src = dst = None
|
||||
if not os.path.exists(saveto): # Avoid repeated downloads
|
||||
try:
|
||||
from distutils import log
|
||||
if delay:
|
||||
log.warn("""
|
||||
---------------------------------------------------------------------------
|
||||
This script requires setuptools version %s to run (even to display
|
||||
help). I will attempt to download it for you (from
|
||||
%s), but
|
||||
you may need to enable firewall access for this script first.
|
||||
I will start the download in %d seconds.
|
||||
|
||||
(Note: if this machine does not have network access, please obtain the file
|
||||
|
||||
%s
|
||||
|
||||
and place it in this directory before rerunning this script.)
|
||||
---------------------------------------------------------------------------""",
|
||||
version, download_base, delay, url
|
||||
); from time import sleep; sleep(delay)
|
||||
log.warn("Downloading %s", url)
|
||||
src = urllib2.urlopen(url)
|
||||
# Read/write all in one block, so we don't create a corrupt file
|
||||
# if the download is interrupted.
|
||||
data = _validate_md5(egg_name, src.read())
|
||||
dst = open(saveto,"wb"); dst.write(data)
|
||||
finally:
|
||||
if src: src.close()
|
||||
if dst: dst.close()
|
||||
return os.path.realpath(saveto)
|
||||
|
||||
def main(argv, version=DEFAULT_VERSION):
|
||||
"""Install or upgrade setuptools and EasyInstall"""
|
||||
|
||||
try:
|
||||
import setuptools
|
||||
except ImportError:
|
||||
egg = None
|
||||
try:
|
||||
egg = download_setuptools(version, delay=0)
|
||||
sys.path.insert(0,egg)
|
||||
from setuptools.command.easy_install import main
|
||||
return main(list(argv)+[egg]) # we're done here
|
||||
finally:
|
||||
if egg and os.path.exists(egg):
|
||||
os.unlink(egg)
|
||||
else:
|
||||
if setuptools.__version__ == '0.0.1':
|
||||
# tell the user to uninstall obsolete version
|
||||
use_setuptools(version)
|
||||
|
||||
req = "setuptools>="+version
|
||||
import pkg_resources
|
||||
try:
|
||||
pkg_resources.require(req)
|
||||
except pkg_resources.VersionConflict:
|
||||
try:
|
||||
from setuptools.command.easy_install import main
|
||||
except ImportError:
|
||||
from easy_install import main
|
||||
main(list(argv)+[download_setuptools(delay=0)])
|
||||
sys.exit(0) # try to force an exit
|
||||
else:
|
||||
if argv:
|
||||
from setuptools.command.easy_install import main
|
||||
main(argv)
|
||||
else:
|
||||
print "Setuptools version",version,"or greater has been installed."
|
||||
print '(Run "ez_setup.py -U setuptools" to reinstall or upgrade.)'
|
||||
|
||||
|
||||
|
||||
def update_md5(filenames):
|
||||
"""Update our built-in md5 registry"""
|
||||
|
||||
import re
|
||||
from md5 import md5
|
||||
|
||||
for name in filenames:
|
||||
base = os.path.basename(name)
|
||||
f = open(name,'rb')
|
||||
md5_data[base] = md5(f.read()).hexdigest()
|
||||
f.close()
|
||||
|
||||
data = [" %r: %r,\n" % it for it in md5_data.items()]
|
||||
data.sort()
|
||||
repl = "".join(data)
|
||||
|
||||
import inspect
|
||||
srcfile = inspect.getsourcefile(sys.modules[__name__])
|
||||
f = open(srcfile, 'rb'); src = f.read(); f.close()
|
||||
|
||||
match = re.search("\nmd5_data = {\n([^}]+)}", src)
|
||||
if not match:
|
||||
print >>sys.stderr, "Internal error!"
|
||||
sys.exit(2)
|
||||
|
||||
src = src[:match.start(1)] + repl + src[match.end(1):]
|
||||
f = open(srcfile,'w')
|
||||
f.write(src)
|
||||
f.close()
|
||||
|
||||
|
||||
if __name__=='__main__':
|
||||
if len(sys.argv)>2 and sys.argv[1]=='--md5update':
|
||||
update_md5(sys.argv[2:])
|
||||
else:
|
||||
main(sys.argv[1:])
|
||||
|
||||
|
||||
|
||||
|
||||
|
62
icons.qrc
Normal file
|
@ -0,0 +1,62 @@
|
|||
<RCC>
|
||||
<qresource prefix="/" >
|
||||
<file>icons/document-open-recent.png</file>
|
||||
<file>icons/khtml_kget.png</file>
|
||||
<file>icons/edit-find.png</file>
|
||||
<file>icons/colors.png</file>
|
||||
<file>icons/anki.png</file>
|
||||
<file>icons/Anki_Add_Tag.png</file>
|
||||
<file>icons/Anki_Card.png</file>
|
||||
<file>icons/Anki_Del_Tag.png</file>
|
||||
<file>icons/Anki_Fact.png</file>
|
||||
<file>icons/application-exit.png</file>
|
||||
<file>icons/colorscm.png</file>
|
||||
<file>icons/configure.png</file>
|
||||
<file>icons/contents.png</file>
|
||||
<file>icons/contents2.png</file>
|
||||
<file>icons/document-export.png</file>
|
||||
<file>icons/document-import.png</file>
|
||||
<file>icons/document-new.png</file>
|
||||
<file>icons/document-open-recent.png</file>
|
||||
<file>icons/document-open.png</file>
|
||||
<file>icons/document-save-as.png</file>
|
||||
<file>icons/document-save.png</file>
|
||||
<file>icons/edit-undo.png</file>
|
||||
<file>icons/edit.png</file>
|
||||
<file>icons/editdelete.png</file>
|
||||
<file>icons/fileclose.png</file>
|
||||
<file>icons/folder_image.png</file>
|
||||
<file>icons/folder_sound.png</file>
|
||||
<file>icons/format-stroke-color.png</file>
|
||||
<file>icons/games-solve.png</file>
|
||||
<file>icons/go-home.png</file>
|
||||
<file>icons/help-contents.png</file>
|
||||
<file>icons/help.png</file>
|
||||
<file>icons/image.png</file>
|
||||
<file>icons/kanji.png</file>
|
||||
<file>icons/kbugbuster.png</file>
|
||||
<file>icons/kexi.png</file>
|
||||
<file>icons/kpersonalizer.png</file>
|
||||
<file>icons/list-add.png</file>
|
||||
<file>icons/math_matrix.png</file>
|
||||
<file>icons/math_sqrt.png</file>
|
||||
<file>icons/media-playback-pause.png</file>
|
||||
<file>icons/media-playback-start.png</file>
|
||||
<file>icons/media-playback-stop.png</file>
|
||||
<file>icons/multisynk.png</file>
|
||||
<file>icons/package_games_card.png</file>
|
||||
<file>icons/preferences-desktop-font.png</file>
|
||||
<file>icons/rating.png</file>
|
||||
<file>icons/speaker.png</file>
|
||||
<file>icons/spreadsheet.png</file>
|
||||
<file>icons/sqlitebrowser.png</file>
|
||||
<file>icons/system-shutdown.png</file>
|
||||
<file>icons/tex.png</file>
|
||||
<file>icons/text-speak.png</file>
|
||||
<file>icons/text_bold.png</file>
|
||||
<file>icons/text_italic.png</file>
|
||||
<file>icons/text_under.png</file>
|
||||
<file>icons/view-pim-news.png</file>
|
||||
<file>icons/view_text.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
BIN
icons/Anki_Add_Tag.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
icons/Anki_Card.png
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
icons/Anki_Del_Tag.png
Normal file
After Width: | Height: | Size: 1.7 KiB |
BIN
icons/Anki_Fact.png
Normal file
After Width: | Height: | Size: 2.1 KiB |
BIN
icons/anki.png
Normal file
After Width: | Height: | Size: 1.7 KiB |
BIN
icons/application-exit.png
Normal file
After Width: | Height: | Size: 1.7 KiB |
BIN
icons/colors.png
Normal file
After Width: | Height: | Size: 2.2 KiB |
BIN
icons/colorscm.png
Normal file
After Width: | Height: | Size: 2.4 KiB |
BIN
icons/configure.png
Normal file
After Width: | Height: | Size: 3.3 KiB |
BIN
icons/contents.png
Normal file
After Width: | Height: | Size: 2.4 KiB |
BIN
icons/contents2.png
Normal file
After Width: | Height: | Size: 2.1 KiB |
BIN
icons/document-export.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
icons/document-import.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
icons/document-new.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
icons/document-open-recent.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
BIN
icons/document-open.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
icons/document-save-as.png
Normal file
After Width: | Height: | Size: 2.1 KiB |
BIN
icons/document-save.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
icons/edit-find.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
icons/edit-undo.png
Normal file
After Width: | Height: | Size: 2 KiB |
BIN
icons/edit.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
BIN
icons/editdelete.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
icons/fileclose.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
BIN
icons/folder_image.png
Normal file
After Width: | Height: | Size: 2.5 KiB |
BIN
icons/folder_sound.png
Normal file
After Width: | Height: | Size: 2.7 KiB |
BIN
icons/format-stroke-color.png
Normal file
After Width: | Height: | Size: 1.7 KiB |
BIN
icons/games-solve.png
Normal file
After Width: | Height: | Size: 2.7 KiB |
BIN
icons/go-home.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
icons/help-contents.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
BIN
icons/help.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
icons/image.png
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
icons/kanji.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
icons/kbugbuster.png
Normal file
After Width: | Height: | Size: 1.7 KiB |
BIN
icons/kexi.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
icons/khtml_kget.png
Normal file
After Width: | Height: | Size: 2.1 KiB |
BIN
icons/kpersonalizer.png
Normal file
After Width: | Height: | Size: 2.2 KiB |
BIN
icons/list-add.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
icons/math_matrix.png
Normal file
After Width: | Height: | Size: 637 B |