commit 71b560030aa96e4792f8d208175cf5303b02a8ad Author: josch Date: Tue Jun 24 10:34:08 2014 +0200 initial commit diff --git a/80epydial b/80epydial new file mode 100755 index 0000000..525735a --- /dev/null +++ b/80epydial @@ -0,0 +1,7 @@ +#!/bin/sh -e +# export DISPLAY=:0 +NAME=epydial +PATH=/bin:/usr/bin:/sbin:/usr/sbin; export PATH +TZ=MET; export TZ +cd /usr/share/$NAME +exec python ./$NAME.py > /media/card/$NAME.log 2>&1 diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 0000000..89f3389 --- /dev/null +++ b/AUTHORS @@ -0,0 +1,6 @@ +M. Dietrich +M. Scheller +J. Schauer +S. Apel +T. Gstaedtner +F. Gau diff --git a/COPYING b/COPYING new file mode 100755 index 0000000..bf0f7d3 --- /dev/null +++ b/COPYING @@ -0,0 +1,676 @@ + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + 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. + + + Copyright (C) + + 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 . + +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: + + Copyright (C) + 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 +. + + 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 +. + diff --git a/audio_screen.py b/audio_screen.py new file mode 100755 index 0000000..c579198 --- /dev/null +++ b/audio_screen.py @@ -0,0 +1,212 @@ +#!/usr/bin/env python2.5 +# -*- coding: utf-8 -*- +from __future__ import with_statement +__author__ = "M. Dietrich , F. Gau , Thomas Gstaedner (thomas (a) gstaedtner (.) net)" +__version__ = "prototype" +__copyright__ = "Copyright (c) 2009" +__license__ = "GPL3" + +from epydial import * + +STYLE = """ +DEFAULT='font=Sans font_size=18 align=left color=#808080 wrap=word valign=top' +h1='+ font_size=38 font=Bookman' +/h1='- \\n \\n' +p='+ ' +/p='- \\n \\n' +br='\\n' +red='+ color=#660000' +/red='-' +center='+ align=center' +/center='-' +right='+ align=right' +/right='-' +big='+ font_size=40' +/big='-' +""" + +class AudioScreen(): + toggle = False + volume = 10 + + def register_pyneo_callbacks(self): + PyneoController.register_callback("on_get_music_tags", self.on_get_music_tags) + PyneoController.register_callback("on_get_music_position", self.on_get_music_position) + + def __init__(self, screen_manager): + PyneoController.set_volume(self.volume/100.0) + + self.buttons = {} + self.canvas = screen_manager.get_evas() + + self.bg = evas.Image(self.canvas, pos=(0, 0), size=(WIDTH, HEIGHT), file=PyneoController.set_bg_image) + self.bg.fill = 0, 0, WIDTH, HEIGHT + self.bg.layer = 99 + + def headline_callback(source, event): + if source: + PyneoController.set_playlist_from_dir(MUSIC_FILE_PATH) + print 'headline' + + self.headline = evas.Text(self.canvas, text="music", font=("Sans:style=Bold,Edje-Vera", 60), color="#808080") + self.headline.layer = 99 + self.headline.pos = ((480-self.headline.horiz_advance)/2, 25) + self.headline.on_mouse_up_add(headline_callback) + + self.cover = evas.Image(self.canvas, pos=(10, 120), size=(160, 155), file="%scover.png" % THEME_IMAGES) + self.cover.fill = 0, 0, 160, 155 + self.cover.layer = 99 + + self.title_tags = evas.Textblock(self.canvas, pos=(190, 130), size=(280, 150), ) + self.title_tags.style_set(STYLE) + self.title_tags.layer = 99 + + self.position_tags = evas.Textblock(self.canvas, pos=(16, 300), size=(448, 150), ) + self.position_tags.style_set(STYLE) + self.position_tags.layer = 99 + + self.bargraph = evas.Rectangle(self.canvas, pos=(16, 336), color="#808080") + self.bargraph.layer = 99 + + self.volume_caption = evas.Text(self.canvas, text="volume %d%%" % self.volume, font=("Sans:style=Bold, Edje-Vera", 18), color="#808080") + self.volume_caption.layer = 99 + self.volume_caption.pos = ((480-self.volume_caption.horiz_advance)/2, 432) + + for pos, text in enumerate(["back", "previous", "play", "next"]): + self.buttons[text] = self.init_button(text, (pos+1)*16+pos*100, 524, 100, 100) + + for pos, text in enumerate(["player-minus", "player-plus"]): + self.buttons[text] = self.init_button(text, (pos+1)*16+pos*332, 400, 100, 100) + + def init_button(self, name, x, y, dx, dy): + def button_callback(source, event): + if name == 'back': + PyneoController.show_screen(AUDIOSORT_SCREEN_NAME) + elif name == 'next': + PyneoController.next_music() + elif name == 'previous': + PyneoController.previous_music() + elif name == 'play': + if not self.toggle: + self.buttons['play'].file_set('%spause.png' % THEME_IMAGES) + self.buttons['play'].fill = 0, 0, 100, 100 + PyneoController.play_music() + PyneoController.get_music_tags() + self.toggle = True + elif self.toggle: + self.buttons['play'].file_set('%splay.png' % THEME_IMAGES) + self.buttons['play'].fill = 0, 0, 100, 100 + PyneoController.pause_music() + self.toggle = False + elif name == 'player-plus' and self.volume < 100: + self.volume += 10 + PyneoController.set_volume(self.volume/100.0) + self.volume_caption.text = 'volume %d%%' % self.volume + elif name == 'player-minus' and self.volume > 0: + self.volume -= 10 + PyneoController.set_volume(self.volume/100.0) + self.volume_caption.text = 'volume %d%%' % self.volume + print '--- ', name + button = evas.Image(self.canvas, pos=(x,y), size=(dx,dy), file="%s%s.png" % (THEME_IMAGES, name)) + button.fill = 0, 0, dx, dy + button.layer = 99 + button.on_mouse_up_add(button_callback) + return button + + def cover_search(self, dir, extension): + '''searches in a dir for files with a given file extension''' + path = os.getcwd() # get current path + os.chdir(dir) # change dir + searchstring = '*.%s' % extension # create the string for search + firstfind = glob.glob(searchstring)[0] # get the first image + os.chdir(path) # change back to the dir before + return firstfind + + def on_get_cover(self, status): + '''When a Cover in the music directory exists it will be set''' + dir = status['file'].rsplit('/', 1)[0] # get the dir path out of the status message with filename + extensions = ['jpg', 'jpeg', 'png', 'gif'] # file extension for searching + for i in extensions: + + try: + cover = self.cover_search(dir, i) + print '--- set cover %s from dir' % cover + self.cover.file_set('%s/%s' % (dir, cover)) + self.cover.fill = 0, 0, 160, 160 + break # exit the loop, we need only the first + return True + except IndexError: + print '--- no %s cover found' % i + + return False + + def on_get_amazon_cover(self, status): + cover_name = '%s_%s' % (status['artist'], status['album']) + self.cover_path = COVER_FILE_PATH + cover_name + def update_image(*args): + self.cover.file_set(self.cover_path.encode("utf8")) + x, y = self.cover.image_size + self.cover.fill = 0, 0, 160, 160 + def error(msg): + print '--- error on cover lookup:', msg + + if not os.path.isfile(self.cover_path): + print '--- cover in coverdir not exists' + PyneoController.get_amazon_cover( + '%s %s' % (status['artist'].encode("utf-8"), status['album'].encode("utf-8")), + cover_name, update_image, error) + else: + print '--- cover exists' + update_image() + + def on_get_music_position(self, position, duration): + if position != -1 and duration != -1: + self.position_tags.text_markup_set('%s

%s' % ( + time.ctime(position)[14:][:5], + time.ctime(duration)[14:][:5])) + else: + self.position_tags.text_markup_set('
00:00
00:00
') + self.bargraph.size = position*448/duration, 10 + + def on_get_music_tags(self, status): + tag_unknown = False + for tag in ["artist", "album"]: + if not tag in status: + status[tag] = 'unknown %s' % tag + tag_unknown = True + + if tag_unknown: + self.cover.file_set('%scover.png' % THEME_IMAGES) + self.cover.fill = 0, 0, 160, 160 + print '--- set placeholder' + +# if self.on_get_cover(status) == False: + self.on_get_amazon_cover(status) # get cover from amazon when it exists + + if not 'title' in status: status['title'] = 'unknown title' + self.title_tags.text_markup_set(('%s
%s
%s' % ( + status['artist'], + status['album'], + status['title'])).encode("utf8")) + + def show(self): + self.bg.show() + self.headline.show() + self.cover.show() + self.title_tags.show() + self.position_tags.show() + self.volume_caption.show() + self.bargraph.show() + for text in ["back", "previous", "play", "next", "player-plus", "player-minus"]: + self.buttons[text].show() + + def hide(self): + self.bg.hide() + self.headline.hide() + self.cover.hide() + self.title_tags.hide() + self.position_tags.hide() + self.volume_caption.hide() + self.bargraph.hide() + for text in ["back", "previous", "play", "next", "player-plus", "player-minus"]: + self.buttons[text].hide() diff --git a/audiosort_screen.py b/audiosort_screen.py new file mode 100755 index 0000000..b0f69e8 --- /dev/null +++ b/audiosort_screen.py @@ -0,0 +1,82 @@ +#!/usr/bin/env python2.5 +# -*- coding: utf-8 -*- +from __future__ import with_statement +__author__ = "F. Gau " +__version__ = "prototype" +__copyright__ = "Copyright (c) 2009" +__license__ = "GPL3" + +from epydial import * + +class AudiosortScreen(): + + def register_pyneo_callbacks(self): + PyneoController.register_callback("on_get_playlist", self.on_get_playlist) + + def __init__(self, screen_manager): + self.FONT_COLOR = PyneoController.set_font_color + self.buttons = {} + self.keys = {} + self.canvas = screen_manager.get_evas() + + self.bg = evas.Image(self.canvas, pos=(0, 0), size=(WIDTH, HEIGHT), file=PyneoController.set_bg_image) + self.bg.fill = 0, 0, WIDTH, HEIGHT + self.bg.layer = 99 + + self.headline = evas.Text(self.canvas, text="music", font=("Sans:style=Bold,Edje-Vera", 60), color=self.FONT_COLOR) + self.headline.layer = 99 + self.headline.pos = ((WIDTH-self.headline.horiz_advance)/2, 25) + + for pos, text in enumerate(["back", "previous", "next", "forward"]): + self.buttons[text] = self.init_button(text, (pos+1)*16+pos*100, 524, 100, 100) + + for pos, text in enumerate(["artist", "album", "title"]): + self.keys[text] = self.init_key(text, (pos+1)*100+60) + + def init_key(self, name, y): + def key_callback(source, event): + PyneoController.sort_playlist('asc', name) + print '--- ', name + PyneoController.get_playlist() + PyneoController.show_audio_screen() + key = evas.Text(self.canvas, text=name, font=("Sans:style=Bold,Edje-Vera", 50), color=self.FONT_COLOR) + key.layer = 99 + key.pos = ((WIDTH-key.horiz_advance)/2, y) + key.on_mouse_up_add(key_callback) + return key + + def init_button(self, name, x, y, dx, dy): + def button_callback(source, event): + if name == 'back': + PyneoController.show_dialer_screen() + elif name == 'next': + pass + elif name == 'previous': + pass + elif name == 'forward': + PyneoController.show_audio_screen() + print '--- ', name + button = evas.Image(self.canvas, pos=(x,y), size=(dx,dy), file="%s%s.png" % (THEME_IMAGES, name)) + button.fill = 0, 0, dx, dy + button.layer = 99 + button.on_mouse_up_add(button_callback) + return button + + def on_get_playlist(self, status): + print 'Playlist', status + + def show(self): + self.bg.show() + self.headline.show() + for text in ["back", "previous", "next", "forward"]: + self.buttons[text].show() + for text in ["artist", "album", "title"]: + self.keys[text].show() + + def hide(self): + self.bg.hide() + self.headline.hide() + for text in ["back", "previous", "next", "forward"]: + self.buttons[text].hide() + for text in ["artist", "album", "title"]: + self.keys[text].hide() diff --git a/constants.py b/constants.py new file mode 100644 index 0000000..e241025 --- /dev/null +++ b/constants.py @@ -0,0 +1,51 @@ +WIDTH = 480 +HEIGHT = 640 + +FRAMETIME = 1.0 / 20 +IMAGE_CACHE_SIZE = 6 +FONT_CACHE_SIZE = 2 + +FULLSCREEN = True +APP_TITLE = "epydial" +WM_INFO = ("epydial", "epydial") + +BASE_PATH = '/home/user/epydial' +PIX_FILE_PATH = "/home/user/.pyneo/hon/" +TRACK_FILE_PATH = "%s/"% BASE_PATH +DB_FILE_PATH = "%s/epydial.sqlite"% BASE_PATH +DB_PATH = "%s/"% BASE_PATH +PIX_WEATHER_FILE_PATH = "data/images/stardock_weather/" +MUSIC_FILE_PATH = "/home/user/music/" +COVER_FILE_PATH = "/home/user/.pyneo/cover/" +RINGTONE_FILE = "/usr/share/epydial/data/sounds/ring-ring.wav" +SMSTONE_FILE = "/usr/share/epydial/data/sounds/sms.wav" +ALSA_FILES_PATH = "/usr/share/pyneod/alsastates/neo1973gta02/" +IMAGE_FILES_PATH = "data/images/" +THEME_IMAGES = "data/themes_data/blackwhite/images/" +INI_PATH = "epydial.ini" + +DIALER_SCREEN_NAME = "pyneo/dialer/main" +INFO_BAR_WIDGET = "pyneo/infobar/widget" +INCALL_SCREEN_NAME = "pyneo/dialer/incall" +GSM_STATUS_SCREEN_NAME = "pyneo/gsm/status" +GPS_STATUS_SCREEN_NAME = "pyneo/gps/status" +GPS_MAP_SCREEN_NAME = "pyneo/gps/map" +TIME_SCREEN_NAME = "pyneo/time/screen" +HON_SCREEN_NAME = "pyneo/hon/screen" +LOCK_SCREEN_NAME = "pyneo/lock/screen" +PIX_SCREEN_NAME = "pyneo/pix/screen" +CONTACTS_SCREEN_NAME = "pyneo/contacts/screen" +SMS_SCREEN_NAME = "pyneo/sms/screen" +SMS_DETAIL_SCREEN_NAME = "pyneo/sms/detail" +WEATHER_SCREEN_NAME = "pyneo/weather/screen" +AUDIO_SCREEN_NAME = "pyneo/audio/screen" +AUDIOSORT_SCREEN_NAME = "pyneo/audiosort/screen" +HISTORY_SCREEN_NAME = "pyneo/history/screen" +SETTINGS_SCREEN_NAME = "pyneo/settings/screen" +TIMETABLE_SCREEN_NAME = "pyneo/timetable/screen" +SIMIMPORTER_SCREEN_NAME = "pyneo/simimporter/screen" +WLAN_SCREEN_NAME = "pyneo/wlan/screen" +FONTCOLOR_SCREEN_NAME = "pyneo/fontcolor/screen" +NEWS_SCREEN_NAME = "pyneo/news/screen" + + diff --git a/contacts_screen.py b/contacts_screen.py new file mode 100755 index 0000000..3d93e7f --- /dev/null +++ b/contacts_screen.py @@ -0,0 +1,120 @@ +#!/usr/bin/env python2.5 +# -*- coding: utf-8 -*- +___author__ = "F. Gau , Thomas 'thomasg' Gstaedtner " +_version__ = "prototype" +__copyright__ = "Copyright (c) 2008" +__license__ = "GPL3" + +from epydial import * + +class ContactsScreen(): + def register_pyneo_callbacks(self): + pass + + contact_offset = 0 + detail = False + + def __init__(self, screen_manager): + self.buttons = {} + self.bg_line = {} + self.canvas = screen_manager.get_evas() + + self.bg = evas.Image(self.canvas, pos=(0, 0), size=(WIDTH, HEIGHT), file=PyneoController.set_bg_image) + self.bg.fill = 0, 0, WIDTH, HEIGHT + self.bg.layer = 99 + + self.headline = evas.Text(self.canvas, text="contacts", font=("Sans:style=Bold,Edje-Vera", 60), color="#808080") + self.headline.layer = 99 + self.headline.pos = ((WIDTH-self.headline.horiz_advance)/2, 25) + + self.subheadline = evas.Text(self.canvas, font=("Sans,Edje-Vera", 25), color="#808080") + self.subheadline.layer = 99 + self.subheadline.pos = ((WIDTH-self.subheadline.horiz_advance)/2, 100) + + for pos, text in enumerate(["back", "previous", "next"]): + self.buttons[text] = self.init_button(text, (pos+1)*16+pos*100, 524, 100, 100) + + for i, text in enumerate(["1" ,"2", "3", "4", "5"]): + for j, row in enumerate(["lastname", "bg"]): + self.bg_line[text, row] = self.init_line(row, text, i) + + self.show_contacts() + + def init_line(self, row, name, num): + def button_callback(source, event): + if name == '1' or name == '2' or name == '3' or name == '4' or name == '5': + PyneoController.dialer_text_set(self.bg_line[name, 'lastname'].text.split(',')[1][1:-4]) + PyneoController.show_dialer_screen() + print '---', name + + if row == "bg": + bg = evas.Rectangle(self.canvas, pos=(480/20, (640*2)/9+num*640/9+5), size=((480*18)/20, 640/12), color="#38ffffff") + bg.layer = 99 + bg.on_mouse_up_add(button_callback) + return bg + + if row == "lastname": + lastname = evas.Text(self.canvas, font=("Sans:style=Edje-Vera", 28), color="#808080") + lastname.pos = (480/20+10, (640*2)/9+num*640/9+5) + lastname.layer = 99 + return lastname + + def init_button(self, name, x, y, dx, dy): + def button_callback(source, event): + if name == 'back': + PyneoController.show_dialer_screen() + elif name == 'next': + new_offset = self.contact_offset + 5 + if DatabaseController.get_contact_count() > new_offset: + self.contact_offset = new_offset + self.show_contacts() + elif name == 'previous': + new_offset = self.contact_offset - 5 + if new_offset >= 0: + self.contact_offset = new_offset + self.show_contacts() + pass + print '--- ', name + button = evas.Image(self.canvas, pos=(x,y), size=(dx,dy), file="%s%s.png" % (THEME_IMAGES, name)) + button.fill = 0, 0, dx, dy + button.layer = 99 + button.on_mouse_up_add(button_callback) + return button + + def del_displayed_contacts(self): + x=1 + while x < 6: + self.bg_line[str(x), 'lastname'].text = "" + x += 1 + + def show_contacts(self): + x = 1 + self.del_displayed_contacts() + cursor = DatabaseController.get_contacts(5, self.contact_offset) + for i in cursor: + self.bg_line[str(x), 'lastname'].text = '%s, %s ...' % (i[0], i[1]) + x += 1 + + def show(self): + self.bg.show() + self.headline.show() + self.subheadline.show() + + for pos, text in enumerate(["back", "previous", "next"]): + self.buttons[text].show() + + for i, text in enumerate(["1" ,"2", "3", "4", "5"]): + for j, row in enumerate(["lastname", "bg"]): + self.bg_line[text, row].show() + + def hide(self): + self.bg.hide() + self.headline.hide() + self.subheadline.hide() + + for pos, text in enumerate(["back", "previous", "next"]): + self.buttons[text].hide() + + for i, text in enumerate(["1" ,"2", "3", "4", "5"]): + for j, row in enumerate(["lastname", "bg"]): + self.bg_line[text, row].hide() diff --git a/data/emptycursor b/data/emptycursor new file mode 100644 index 0000000..a968ae1 --- /dev/null +++ b/data/emptycursor @@ -0,0 +1,7 @@ +#define nn1_width 16 +#define nn1_height 16 +static unsigned char nn1_bits[] = { +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + diff --git a/data/images/map/404.png b/data/images/map/404.png new file mode 100644 index 0000000..b5ecdf0 Binary files /dev/null and b/data/images/map/404.png differ diff --git a/data/images/map/arrow.svg b/data/images/map/arrow.svg new file mode 100644 index 0000000..57eeeb3 --- /dev/null +++ b/data/images/map/arrow.svg @@ -0,0 +1,80 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + diff --git a/data/images/map/arrow00.png b/data/images/map/arrow00.png new file mode 100644 index 0000000..2fb189b Binary files /dev/null and b/data/images/map/arrow00.png differ diff --git a/data/images/map/arrow01.png b/data/images/map/arrow01.png new file mode 100644 index 0000000..d866007 Binary files /dev/null and b/data/images/map/arrow01.png differ diff --git a/data/images/map/arrow02.png b/data/images/map/arrow02.png new file mode 100644 index 0000000..9b2c055 Binary files /dev/null and b/data/images/map/arrow02.png differ diff --git a/data/images/map/arrow03.png b/data/images/map/arrow03.png new file mode 100644 index 0000000..fd4dfbe Binary files /dev/null and b/data/images/map/arrow03.png differ diff --git a/data/images/map/arrow04.png b/data/images/map/arrow04.png new file mode 100644 index 0000000..cddbb4e Binary files /dev/null and b/data/images/map/arrow04.png differ diff --git a/data/images/map/arrow05.png b/data/images/map/arrow05.png new file mode 100644 index 0000000..cfb7fe5 Binary files /dev/null and b/data/images/map/arrow05.png differ diff --git a/data/images/map/arrow06.png b/data/images/map/arrow06.png new file mode 100644 index 0000000..cc3d866 Binary files /dev/null and b/data/images/map/arrow06.png differ diff --git a/data/images/map/arrow07.png b/data/images/map/arrow07.png new file mode 100644 index 0000000..2118431 Binary files /dev/null and b/data/images/map/arrow07.png differ diff --git a/data/images/map/arrow08.png b/data/images/map/arrow08.png new file mode 100644 index 0000000..ab0cea5 Binary files /dev/null and b/data/images/map/arrow08.png differ diff --git a/data/images/map/arrow09.png b/data/images/map/arrow09.png new file mode 100644 index 0000000..4a098d2 Binary files /dev/null and b/data/images/map/arrow09.png differ diff --git a/data/images/map/arrow10.png b/data/images/map/arrow10.png new file mode 100644 index 0000000..19203a0 Binary files /dev/null and b/data/images/map/arrow10.png differ diff --git a/data/images/map/arrow11.png b/data/images/map/arrow11.png new file mode 100644 index 0000000..6574b3d Binary files /dev/null and b/data/images/map/arrow11.png differ diff --git a/data/images/map/arrow12.png b/data/images/map/arrow12.png new file mode 100644 index 0000000..d8cf7af Binary files /dev/null and b/data/images/map/arrow12.png differ diff --git a/data/images/map/arrow13.png b/data/images/map/arrow13.png new file mode 100644 index 0000000..bbc5b40 Binary files /dev/null and b/data/images/map/arrow13.png differ diff --git a/data/images/map/arrow14.png b/data/images/map/arrow14.png new file mode 100644 index 0000000..0bf242c Binary files /dev/null and b/data/images/map/arrow14.png differ diff --git a/data/images/map/arrow15.png b/data/images/map/arrow15.png new file mode 100644 index 0000000..c56c8c6 Binary files /dev/null and b/data/images/map/arrow15.png differ diff --git a/data/images/map/arrow16.png b/data/images/map/arrow16.png new file mode 100644 index 0000000..feaaa88 Binary files /dev/null and b/data/images/map/arrow16.png differ diff --git a/data/images/map/arrow17.png b/data/images/map/arrow17.png new file mode 100644 index 0000000..6e1dcb4 Binary files /dev/null and b/data/images/map/arrow17.png differ diff --git a/data/images/map/arrow18.png b/data/images/map/arrow18.png new file mode 100644 index 0000000..a500abc Binary files /dev/null and b/data/images/map/arrow18.png differ diff --git a/data/images/map/arrow19.png b/data/images/map/arrow19.png new file mode 100644 index 0000000..5673e99 Binary files /dev/null and b/data/images/map/arrow19.png differ diff --git a/data/images/map/arrow20.png b/data/images/map/arrow20.png new file mode 100644 index 0000000..f5cff3f Binary files /dev/null and b/data/images/map/arrow20.png differ diff --git a/data/images/map/arrow21.png b/data/images/map/arrow21.png new file mode 100644 index 0000000..7c75f19 Binary files /dev/null and b/data/images/map/arrow21.png differ diff --git a/data/images/map/arrow22.png b/data/images/map/arrow22.png new file mode 100644 index 0000000..cc2ff64 Binary files /dev/null and b/data/images/map/arrow22.png differ diff --git a/data/images/map/arrow23.png b/data/images/map/arrow23.png new file mode 100644 index 0000000..d64056a Binary files /dev/null and b/data/images/map/arrow23.png differ diff --git a/data/images/stardock_weather/0.png b/data/images/stardock_weather/0.png new file mode 100755 index 0000000..3d8c6b4 Binary files /dev/null and b/data/images/stardock_weather/0.png differ diff --git a/data/images/stardock_weather/1.png b/data/images/stardock_weather/1.png new file mode 100755 index 0000000..623e19f Binary files /dev/null and b/data/images/stardock_weather/1.png differ diff --git a/data/images/stardock_weather/10.png b/data/images/stardock_weather/10.png new file mode 100755 index 0000000..a6ffa43 Binary files /dev/null and b/data/images/stardock_weather/10.png differ diff --git a/data/images/stardock_weather/11.png b/data/images/stardock_weather/11.png new file mode 100755 index 0000000..c655869 Binary files /dev/null and b/data/images/stardock_weather/11.png differ diff --git a/data/images/stardock_weather/12.png b/data/images/stardock_weather/12.png new file mode 100755 index 0000000..47677fb Binary files /dev/null and b/data/images/stardock_weather/12.png differ diff --git a/data/images/stardock_weather/13.png b/data/images/stardock_weather/13.png new file mode 100755 index 0000000..3b0a2b2 Binary files /dev/null and b/data/images/stardock_weather/13.png differ diff --git a/data/images/stardock_weather/14.png b/data/images/stardock_weather/14.png new file mode 100755 index 0000000..3d44078 Binary files /dev/null and b/data/images/stardock_weather/14.png differ diff --git a/data/images/stardock_weather/15.png b/data/images/stardock_weather/15.png new file mode 100755 index 0000000..2c4746d Binary files /dev/null and b/data/images/stardock_weather/15.png differ diff --git a/data/images/stardock_weather/16.png b/data/images/stardock_weather/16.png new file mode 100755 index 0000000..04ebaa5 Binary files /dev/null and b/data/images/stardock_weather/16.png differ diff --git a/data/images/stardock_weather/17.png b/data/images/stardock_weather/17.png new file mode 100755 index 0000000..b828449 Binary files /dev/null and b/data/images/stardock_weather/17.png differ diff --git a/data/images/stardock_weather/18.png b/data/images/stardock_weather/18.png new file mode 100755 index 0000000..850d972 Binary files /dev/null and b/data/images/stardock_weather/18.png differ diff --git a/data/images/stardock_weather/19.png b/data/images/stardock_weather/19.png new file mode 100755 index 0000000..864b928 Binary files /dev/null and b/data/images/stardock_weather/19.png differ diff --git a/data/images/stardock_weather/2.png b/data/images/stardock_weather/2.png new file mode 100755 index 0000000..623e19f Binary files /dev/null and b/data/images/stardock_weather/2.png differ diff --git a/data/images/stardock_weather/20.png b/data/images/stardock_weather/20.png new file mode 100755 index 0000000..31a93f2 Binary files /dev/null and b/data/images/stardock_weather/20.png differ diff --git a/data/images/stardock_weather/21.png b/data/images/stardock_weather/21.png new file mode 100755 index 0000000..c476e95 Binary files /dev/null and b/data/images/stardock_weather/21.png differ diff --git a/data/images/stardock_weather/22.png b/data/images/stardock_weather/22.png new file mode 100755 index 0000000..cee5033 Binary files /dev/null and b/data/images/stardock_weather/22.png differ diff --git a/data/images/stardock_weather/23.png b/data/images/stardock_weather/23.png new file mode 100755 index 0000000..dad9aba Binary files /dev/null and b/data/images/stardock_weather/23.png differ diff --git a/data/images/stardock_weather/24.png b/data/images/stardock_weather/24.png new file mode 100755 index 0000000..74d0087 Binary files /dev/null and b/data/images/stardock_weather/24.png differ diff --git a/data/images/stardock_weather/25.png b/data/images/stardock_weather/25.png new file mode 100755 index 0000000..f0f8d70 Binary files /dev/null and b/data/images/stardock_weather/25.png differ diff --git a/data/images/stardock_weather/26.png b/data/images/stardock_weather/26.png new file mode 100755 index 0000000..2caad27 Binary files /dev/null and b/data/images/stardock_weather/26.png differ diff --git a/data/images/stardock_weather/27.png b/data/images/stardock_weather/27.png new file mode 100755 index 0000000..4cbe3b9 Binary files /dev/null and b/data/images/stardock_weather/27.png differ diff --git a/data/images/stardock_weather/28.png b/data/images/stardock_weather/28.png new file mode 100755 index 0000000..c1eb46a Binary files /dev/null and b/data/images/stardock_weather/28.png differ diff --git a/data/images/stardock_weather/29.png b/data/images/stardock_weather/29.png new file mode 100755 index 0000000..c8b27b3 Binary files /dev/null and b/data/images/stardock_weather/29.png differ diff --git a/data/images/stardock_weather/3.png b/data/images/stardock_weather/3.png new file mode 100755 index 0000000..3d8c6b4 Binary files /dev/null and b/data/images/stardock_weather/3.png differ diff --git a/data/images/stardock_weather/30.png b/data/images/stardock_weather/30.png new file mode 100755 index 0000000..edf4f22 Binary files /dev/null and b/data/images/stardock_weather/30.png differ diff --git a/data/images/stardock_weather/31.png b/data/images/stardock_weather/31.png new file mode 100755 index 0000000..dbfbf60 Binary files /dev/null and b/data/images/stardock_weather/31.png differ diff --git a/data/images/stardock_weather/32.png b/data/images/stardock_weather/32.png new file mode 100755 index 0000000..adf7561 Binary files /dev/null and b/data/images/stardock_weather/32.png differ diff --git a/data/images/stardock_weather/3200.png b/data/images/stardock_weather/3200.png new file mode 100755 index 0000000..116ba1a Binary files /dev/null and b/data/images/stardock_weather/3200.png differ diff --git a/data/images/stardock_weather/33.png b/data/images/stardock_weather/33.png new file mode 100755 index 0000000..b86b58b Binary files /dev/null and b/data/images/stardock_weather/33.png differ diff --git a/data/images/stardock_weather/34.png b/data/images/stardock_weather/34.png new file mode 100755 index 0000000..6e68f01 Binary files /dev/null and b/data/images/stardock_weather/34.png differ diff --git a/data/images/stardock_weather/35.png b/data/images/stardock_weather/35.png new file mode 100755 index 0000000..1ec73d2 Binary files /dev/null and b/data/images/stardock_weather/35.png differ diff --git a/data/images/stardock_weather/36.png b/data/images/stardock_weather/36.png new file mode 100755 index 0000000..30affeb Binary files /dev/null and b/data/images/stardock_weather/36.png differ diff --git a/data/images/stardock_weather/37.png b/data/images/stardock_weather/37.png new file mode 100755 index 0000000..9fbc83b Binary files /dev/null and b/data/images/stardock_weather/37.png differ diff --git a/data/images/stardock_weather/38.png b/data/images/stardock_weather/38.png new file mode 100755 index 0000000..3ba20eb Binary files /dev/null and b/data/images/stardock_weather/38.png differ diff --git a/data/images/stardock_weather/39.png b/data/images/stardock_weather/39.png new file mode 100755 index 0000000..7dc38d8 Binary files /dev/null and b/data/images/stardock_weather/39.png differ diff --git a/data/images/stardock_weather/4.png b/data/images/stardock_weather/4.png new file mode 100755 index 0000000..3d8c6b4 Binary files /dev/null and b/data/images/stardock_weather/4.png differ diff --git a/data/images/stardock_weather/40.png b/data/images/stardock_weather/40.png new file mode 100755 index 0000000..921b43b Binary files /dev/null and b/data/images/stardock_weather/40.png differ diff --git a/data/images/stardock_weather/41.png b/data/images/stardock_weather/41.png new file mode 100755 index 0000000..9c1f2f9 Binary files /dev/null and b/data/images/stardock_weather/41.png differ diff --git a/data/images/stardock_weather/42.png b/data/images/stardock_weather/42.png new file mode 100755 index 0000000..9c1f2f9 Binary files /dev/null and b/data/images/stardock_weather/42.png differ diff --git a/data/images/stardock_weather/43.png b/data/images/stardock_weather/43.png new file mode 100755 index 0000000..0e5c264 Binary files /dev/null and b/data/images/stardock_weather/43.png differ diff --git a/data/images/stardock_weather/44.png b/data/images/stardock_weather/44.png new file mode 100755 index 0000000..edf4f22 Binary files /dev/null and b/data/images/stardock_weather/44.png differ diff --git a/data/images/stardock_weather/45.png b/data/images/stardock_weather/45.png new file mode 100755 index 0000000..61e165d Binary files /dev/null and b/data/images/stardock_weather/45.png differ diff --git a/data/images/stardock_weather/46.png b/data/images/stardock_weather/46.png new file mode 100755 index 0000000..8b576ea Binary files /dev/null and b/data/images/stardock_weather/46.png differ diff --git a/data/images/stardock_weather/47.png b/data/images/stardock_weather/47.png new file mode 100755 index 0000000..7c8f0cf Binary files /dev/null and b/data/images/stardock_weather/47.png differ diff --git a/data/images/stardock_weather/5.png b/data/images/stardock_weather/5.png new file mode 100755 index 0000000..cf5e92f Binary files /dev/null and b/data/images/stardock_weather/5.png differ diff --git a/data/images/stardock_weather/6.png b/data/images/stardock_weather/6.png new file mode 100755 index 0000000..1e75173 Binary files /dev/null and b/data/images/stardock_weather/6.png differ diff --git a/data/images/stardock_weather/7.png b/data/images/stardock_weather/7.png new file mode 100755 index 0000000..db55fba Binary files /dev/null and b/data/images/stardock_weather/7.png differ diff --git a/data/images/stardock_weather/8.png b/data/images/stardock_weather/8.png new file mode 100755 index 0000000..884723f Binary files /dev/null and b/data/images/stardock_weather/8.png differ diff --git a/data/images/stardock_weather/9.png b/data/images/stardock_weather/9.png new file mode 100755 index 0000000..a00cbff Binary files /dev/null and b/data/images/stardock_weather/9.png differ diff --git a/data/images/stardock_weather/permission.txt b/data/images/stardock_weather/permission.txt new file mode 100755 index 0000000..318c70f --- /dev/null +++ b/data/images/stardock_weather/permission.txt @@ -0,0 +1,14 @@ +These weather images are (c) 2003 by Stardock Corporation. All rights reserved. + +Permission: +Stardock gives you permission to distribute these images and or icons freely as long as this permission document is included. + +Allowed Uses: +You may use these images with any Stardock related product (such as creating DesktopX objects or ObjectDock or plugins). + +In addition, Stardock licenses this for use with content that is provided free of charge and is not connected to a commercial software product. You may use these images for skins, themes, and other content for freeware software even if it is competitive in nature with Stardock's offerings as long as the copyright notices are included. You may not, however, bundle these images in any way with any software product without Stardock's express permission. + +You may use these images in your website or product as long as this permission.txt is linked somewhere along with Stardock's copyright notice with a link to Stardock's homepage: http://www.stardock.com. + +Designed Use: +These weather images are designed to provide the various weather conditions reported by weather services. It was created for use with Stardock DesktopX (http://www.desktopx.net) and Stardock ObjectDock (http://www.objectdock.com) both of which allow users to monitor the weather conditions from their desktop. \ No newline at end of file diff --git a/data/sounds/ring-ring.wav b/data/sounds/ring-ring.wav new file mode 100644 index 0000000..621825f Binary files /dev/null and b/data/sounds/ring-ring.wav differ diff --git a/data/sounds/sms.wav b/data/sounds/sms.wav new file mode 100644 index 0000000..50d05fa Binary files /dev/null and b/data/sounds/sms.wav differ diff --git a/data/sounds/sms.wav.license b/data/sounds/sms.wav.license new file mode 100644 index 0000000..31126ac --- /dev/null +++ b/data/sounds/sms.wav.license @@ -0,0 +1,14 @@ +File: + Name: "sms.wav" + Url: http://www.freesound.org/samplesViewSingle.php?id=15990 + Date of upload: 2006-02-22 22:31:44 + +Designer / Creator / Uploader: + Name: "heatfuse" + Url: http://www.freesound.org/usersViewSingle.php?id=6807 + +Description: + By "heatfuse" : half-short + +Tags: + beeps buttons website diff --git a/data/themes/default/dialer_incall.edc b/data/themes/default/dialer_incall.edc new file mode 100644 index 0000000..cfc6d98 --- /dev/null +++ b/data/themes/default/dialer_incall.edc @@ -0,0 +1,203 @@ +// incall.edc +// this is a theme for epydial, a pyneo dialer +// +// TODO: make the font colors shinier :) +// +// Signal1: "dialer_incall_send" +// Parameter1.1: "End Call" +// Parameter1.2: "Back To Dialer" +// Parameter1.2: "Hold Call" + +data { + item: "author" "thomasg [thomas (a) gstaedtner (.) net]"; + item: "version" "prototype"; + item: "name" "epydial_default"; +} + +color_classes { + color_class { + name: "button_inactive"; + color: 255 255 255 255; + color2: 25 215 0 255; + color3: 25 215 0 255; + } + color_class { + name: "button_active"; + color: 0 0 0 255; + color2: 0 0 0 255; + color3: 0 0 0 255; + } +} + +spectra { + spectrum { + name: "background"; + color: 80 80 80 255 1; + color: 210 210 210 255 1; + } + spectrum { + name: "button"; + color: 5 5 5 255 1; + color: 110 110 110 255 1; + color: 10 10 10 255 1; + } + spectrum { + name: "button_active"; + color: 15 170 0 255 1; + color: 130 255 0 255 1; + color: 20 200 0 255 1; + } +} + +#define BUTTON(button_number, rel1x, rel1y, rel2x, rel2y, button_caption) \ +part { \ + name: "button_"button_number; \ + type: GRADIENT; \ + description { \ + state: "default" 0; \ + gradient { \ + spectrum: "button"; \ + rel1 { relative: 0 0; offset: 0 0; }; \ + rel2 { relative: 0 0.75; offset: 0 0; }; \ + } \ + fill { \ + spread: 1; \ + angle: 1; \ + size { relative: 1 0; offset: 0 0; }; \ + } \ + rel1 { relative: rel1x rel1y; offset: 0 0; }; \ + rel2 { relative: rel2x rel2y; offset: 0 0; }; \ + } \ + description { \ + state: "default" 0.5; \ + inherit: "default" 0; \ + gradient.spectrum: "button_active"; \ + rel1.offset: 0 -5; \ + rel2.offset: 0 5; \ + } \ + description { \ + state: "default" 1; \ + inherit: "default" 0; \ + } \ +} \ +part { \ + name: "button_accent_"button_number; \ + type: RECT; \ + description { \ + state: "default" 0; \ + color: 25 215 0 255; \ + rel1 { \ + to: "button_"button_number; \ + relative: 0 0.95; \ + } \ + rel2.to: "button_"button_number; \ + } \ +} \ +part { \ + name: "button_"button_number"_caption"; \ + type: TEXT; \ + mouse_events: 0; \ + effect: GLOW; \ + description { \ + state: "default" 0; \ + color_class: "button_inactive"; \ + rel1 { \ + to: "button_"button_number; \ + relative: 0 0; \ + } \ + rel2 { \ + to: "button_"button_number; \ + relative: 1 1; \ + } \ + text { \ + text: button_caption; \ + size: 18; \ + font: "Sans:style=Bold,Edje-Vera"; \ + } \ + } \ +} \ +program { \ + name: "button_"button_number"_signal_emit"; \ + signal: "mouse,down,*"; \ + source: "button_"button_number; \ + action: SIGNAL_EMIT "dialer_incall_send" button_caption; \ +} \ +program { \ + name: "button_"button_number"_animation"; \ + signal: "mouse,down,*"; \ + source: "button_"button_number; \ + action: STATE_SET "default" 0.5; \ + target: "button_"button_number; \ +} \ +program { \ + name: "button_"button_number"_animation_end"; \ + signal: "mouse,up,*"; \ + source: "button_"button_number; \ + action: STATE_SET "default" 1; \ + target: "button_"button_number; \ + transition: DECELERATE 0.1; \ +} + +#define DESIGN_STRIPE(stripe_number, rel1x, rel1y, rel2x, rel2y) \ +part { \ + name: "design_stripe_"stripe_number; \ + type: RECT; \ + description { \ + state: "default" 0; \ + color: 0 0 0 255; \ + rel1 { relative: rel1x rel1y; offset: 0 0; }; \ + rel2 { relative: rel2x rel2y; offset: 0 0; }; \ + } \ +} + +#define DESIGN_SEPERATOR(seperator_number, rel1x, rel1y, rel2x, rel2y) \ +part { \ + name: "design_seperator_"seperator_number; \ + type: RECT; \ + description { \ + state: "defeault" 0; \ + color: 255 255 255 100; \ + rel1 { relative: rel1x rel1y; offset: -0.5 7; }; \ + rel2 { relative: rel2x rel2y; offset: 0.5 -9; }; \ + } \ +} + +collections { + group { + name: "pyneo/dialer/incall"; + min: 100 100; + max: 800 800; + parts { + part { + name: "background"; + type: GRADIENT; + description { + state: "default" 0; + gradient { + spectrum: "background"; + rel1 { relative: 0 0; offset: 0 0; }; + rel2 { relative: 0 1; offset: 0 0; }; + } + fill { + spread: 1; + angle: 1; + size { relative: 1 0; offset: 0 0; }; + } + rel1 { relative: 0 0; offset: 0 0; }; + rel2 { relative: 1 1; offset: 0 0; }; + } + } + + /* stripes - just for design :) */ +/* DESIGN_STRIPE(1, 1/2, 0.18, 1, 0.18); + DESIGN_STRIPE(2, 1/2, 0.22, 1, 0.22); + DESIGN_STRIPE(3, 1/2, 0.26, 1, 0.26); */ + + BUTTON(1, 0.1, 0.2, 0.9, 0.4, "End Call"); + BUTTON(2, 0.1, 0.45, 0.9, 0.65, "Back To Dialer"); + BUTTON(3, 0.1, 0.7, 0.9, 0.9, "Hold Call"); +/* DESIGN_SEPERATOR(1, 1/3, 25/70, 1/3, 35/70); */ +/* DESIGN_SEPERATOR(2, 2/3, 25/70, 2/3, 35/70); */ + } + } +} diff --git a/data/themes/default/dialer_main.edc b/data/themes/default/dialer_main.edc new file mode 100644 index 0000000..3ea3f9c --- /dev/null +++ b/data/themes/default/dialer_main.edc @@ -0,0 +1,578 @@ +// dialer.edc +// this is a theme for epydial, a pyneo dialer +// +// TODO: make the font colors shinier :) +// +// Signal1: "dialer_send" +// Parameter1.1: $"keynumber" +// Parameter1.2: "backspace" +// Parameter1.3: "clear" +// Parameter1.4: "dial" +// Parameter1.5: "#" +// Parameter1.6: "screen_locked" + +data { + item: "author" "thomasg [thomas (a) gstaedtner (.) net]"; + item: "version" "prototype"; + item: "name" "epydial_default"; +} + +color_classes { + color_class { + name: "button_inactive"; + color: 255 255 255 255; + color2: 25 215 0 255; + color3: 25 215 0 255; + } + color_class { + name: "button_active"; + color: 0 0 0 255; + color2: 0 0 0 255; + color3: 0 0 0 255; + } +} + +spectra { + spectrum { + name: "background"; + color: 80 80 80 255 1; + color: 210 210 210 255 1; + } + spectrum { + name: "button"; + color: 5 5 5 255 1; + color: 110 110 110 255 1; + color: 10 10 10 255 1; + } + spectrum { + name: "button_active"; + color: 15 170 0 255 1; + color: 130 255 0 255 1; + color: 20 200 0 255 1; + } +} + +#define BUTTON(button_number, rel1x, rel1y, rel2x, rel2y, button_caption) \ +part { \ + name: "button_"button_number; \ + type: GRADIENT; \ + description { \ + state: "default" 0; \ + gradient { \ + spectrum: "button"; \ + rel1 { relative: 0 0; offset: 0 0; }; \ + rel2 { relative: 0 0.75; offset: 0 0; }; \ + } \ + fill { \ + spread: 1; \ + angle: 1; \ + size { relative: 1 0; offset: 0 0; }; \ + } \ + rel1 { relative: rel1x rel1y; offset: 0 0; }; \ + rel2 { relative: rel2x rel2y; offset: 0 0; }; \ + } \ + description { \ + state: "default" 0.5; \ + inherit: "default" 0; \ + gradient.spectrum: "button_active"; \ + rel1.offset: 0 -5; \ + rel2.offset: 0 5; \ + } \ + description { \ + state: "default" 1; \ + inherit: "default" 0; \ + } \ +} \ +part { \ + name: "button_accent_"button_number; \ + type: RECT; \ + description { \ + state: "default" 0; \ + color: 25 215 0 255; \ + rel1 { \ + to: "button_"button_number; \ + relative: 0 0.95; \ + } \ + rel2.to: "button_"button_number; \ + } \ +} \ +part { \ + name: "button_"button_number"_caption"; \ + type: TEXT; \ + mouse_events: 0; \ + effect: GLOW; \ + description { \ + state: "default" 0; \ + color_class: "button_inactive"; \ + rel1 { \ + to: "button_"button_number; \ + relative: 0 0; \ + } \ + rel2 { \ + to: "button_"button_number; \ + relative: 1 1; \ + } \ + text { \ + text: button_caption; \ + size: 18; \ + font: "Sans:style=Bold,Edje-Vera"; \ + fit: 1 1; \ + } \ + } \ +} \ +program { \ + name: "button_"button_number"_signal_emit"; \ + signal: "mouse,down,*"; \ + source: "button_"button_number; \ + action: SIGNAL_EMIT "dialer_send" button_caption; \ +} \ +program { \ + name: "button_"button_number"_animation"; \ + signal: "mouse,down,*"; \ + source: "button_"button_number; \ + action: STATE_SET "default" 0.5; \ + target: "button_"button_number; \ +} \ +program { \ + name: "button_"button_number"_animation_end"; \ + signal: "mouse,up,*"; \ + source: "button_"button_number; \ + action: STATE_SET "default" 1; \ + target: "button_"button_number; \ + transition: DECELERATE 0.1; \ +} + +#define DESIGN_STRIPE(stripe_number, rel1x, rel1y, rel2x, rel2y) \ +part { \ + name: "design_stripe_"stripe_number; \ + type: RECT; \ + description { \ + state: "default" 0; \ + color: 0 0 0 255; \ + rel1 { relative: rel1x rel1y; offset: 0 0; }; \ + rel2 { relative: rel2x rel2y; offset: 0 0; }; \ + } \ +} + +#define DESIGN_SEPERATOR(seperator_number, rel1x, rel1y, rel2x, rel2y) \ +part { \ + name: "design_seperator_"seperator_number; \ + type: RECT; \ + description { \ + state: "defeault" 0; \ + color: 255 255 255 100; \ + rel1 { relative: rel1x rel1y; offset: -0.5 7; }; \ + rel2 { relative: rel2x rel2y; offset: 0.5 -9; }; \ + } \ +} + +collections { + group { + name: "pyneo/dialer/main"; + min: 100 100; + max: 1000 1000; + script { + public flag_timer_running; + public flag_backspace_sent; + public timer_id; + + public clear_timer() { + set_int(flag_backspace_sent, 0); + set_int(flag_timer_running, 1); + timer_id = timer(2, "clear_send", 1); + } + + public clear_send() { + if (get_int(flag_backspace_sent) == 0) { + set_int(flag_timer_running, 0); + run_program(PROGRAM:"numberdisplay_backspace_emit_signal_clear"); + } + } + + public backspace_send() { + if (get_int(flag_timer_running) == 1) { + cancel_timer(get_int(timer_id)); + set_int(flag_backspace_sent, 1); + run_program(PROGRAM:"numberdisplay_backspace_emit_signal_backspace"); + } + } + public flag_timer_running_hash_key; + public flag_hash_key_sent; + public timer_id_hash_key; + + public clear_timer_hash_key() { + set_int(flag_hash_key_sent, 0); + set_int(flag_timer_running_hash_key, 1); + timer_id_hash_key = timer(2, "clear_send_hash_key", 1); + } + + public clear_send_hash_key() { + if (get_int(flag_hash_key_sent) == 0) { + set_int(flag_timer_running_hash_key, 0); + run_program(PROGRAM:"hash_key_emit_signal_screen_locked"); + } + } + + public hash_key_send() { + if (get_int(flag_timer_running_hash_key) == 1) { + cancel_timer(get_int(timer_id_hash_key)); + set_int(flag_hash_key_sent, 1); + run_program(PROGRAM:"hash_key_emit_signal_#"); + } + } + } + + parts { + part { + name: "background"; + type: GRADIENT; + description { + state: "default" 0; + gradient { + spectrum: "background"; + rel1 { relative: 0 0; offset: 0 0; }; + rel2 { relative: 0 1; offset: 0 0; }; + } + fill { + spread: 1; + angle: 1; + size { relative: 1 0; offset: 0 0; }; + } + rel1 { relative: 0 0; offset: 0 0; }; + rel2 { relative: 1 1; offset: 0 0; }; + } + } + part { + name: "operater_text"; + type: TEXT; + mouse_events: 0; + description { + color_class: "button_inactive"; + state: "default" 0.0; + rel1 { relative: 0 0; } + rel2 { relative: 1/3 1/20; } + text { text, "operator"; font: "Sans"; size, 1; align, 0 0.5; fit, 0 1; } + } + } /* end operator_text */ + part { + name: "time_text"; + type: TEXT; + mouse_events: 0; + description { + color_class: "button_inactive"; + state: "default" 0.0; + rel1 { relative: 1/3 0; } + rel2 { relative: 2/3 1/20; } + text { text, "time"; font: "sans.bold"; size, 1; align, 0.5 0.5; fit, 0 1; } + } + } /* end time_text */ + part { + name: "signalq_text"; + type: TEXT; + mouse_events: 0; + description { + color_class: "button_inactive"; + state: "default" 0.0; + rel1 { relative: 2/3 0; } + rel2 { relative: 1 1/20; } + text { text, "signal"; font: "Sans"; size, 1; align, 1 0.5; fit, 0 1; } + } + } /* end signalq_text */ + + /* stripes - just for design :) */ + DESIGN_STRIPE(1, 1/2, 0.18, 1, 0.18); + DESIGN_STRIPE(2, 1/2, 0.22, 1, 0.22); + DESIGN_STRIPE(3, 1/2, 0.26, 1, 0.26); + + part { + name: "numberdisplay_background"; + type: RECT; + description { + state: "default" 0; + color: 0 0 0 255; + rel1 { relative: 0.02 0.06; offset: 0 0; }; + rel2 { relative: 0.9 0.3; offset: 0 0; }; + } + } + part { + name: "numberdisplay_foreground"; + type: RECT; + description { + state: "default" 0; + color: 255 255 255 255; + rel1 { + to: "numberdisplay_background"; + offset: 2 2; + } + rel2 { + to: "numberdisplay_background"; + offset: -7 -7; + } + } + description { + state: "default" 0.5; + inherit: "default" 0; + color: 150 255 60 255; + rel1.offset: -10 -10; + rel2.offset: 10 10; + } + description { + state: "default" 1; + inherit: "default" 0; + } + + } + program { + name: "numberdisplay_forground_signal_emit"; + signal: "mouse,down,*"; + source: "numberdisplay_foreground"; + action: SIGNAL_EMIT "dialer_send" "dial"; + } + program { + name: "numberdisplay_foreground_animation"; + signal: "mouse,down,*"; + source: "numberdisplay_foreground"; + action: STATE_SET "default" 0.5; + target: "numberdisplay_foreground"; + transition: LINEAR 0.25; + } + program { + name: "numberdisplay_foreground_animation_end"; + signal: "mouse,up,*"; + source: "numberdisplay_foreground"; + action: STATE_SET "default" 1;; + target: "numberdisplay_foreground"; + transition: LINEAR 0.25; + } + part { + name: "numberdisplay_text"; + type: TEXT; + mouse_events: 0; + effect: OUTLINE_SOFT_SHADOW; + description { + state: "default" 0; + color_class: "button_inactive"; + rel1 { + to: "numberdisplay_foreground"; + relative: 0.02 0; + } + rel2 { + to: "numberdisplay_foreground"; + relative: 0.75 1; + } + text { + text: "testmode"; + size: 28; + font: "Sans:style=Bold,Edje-Vera"; + fit: 0 0; + } + } + } + part { + name: "numberdisplay_backspace"; + type: TEXT; + mouse_events: 0; + effect: GLOW; + description { + state: "default" 0; + color_class: "button_inactive"; + rel1 { + to: "numberdisplay_foreground"; + relative: 0.77 0; + } + rel2 { + to: "numberdisplay_foreground"; + relative: 1 1; + } + text { + text: "<"; + size: 18; + font: "Sans:style=Bold,Edje-Vera"; + fit: 1 1; + } + } + } + part { + name: "numberdisplay_backspace_area"; + type: RECT; + description { + state: "default" 0; + color: 0 0 0 0; + rel1 { relative: 2/3 0; offset: 0 0; }; + rel2 { relative: 3/3 22/70; offset: 0 0; }; + } + description { + state: "default" 0.3; + rel1.to: "numberdisplay_foreground"; + rel2.to: "numberdisplay_foreground"; + } + description { + state: "default" 0.6; + inherit: "default" 0.3; + color: 255 0 0 100; + } + description { + state: "default" 1; + inherit: "default" 0; + } + } + program { + name: "numberdisplay_backspace_area_signal_emit"; + signal: "mouse,down,*"; + source: "numberdisplay_backspace_area"; + script { + clear_timer(); + } + } + program { + name: "numberdisplay_backspace_area_signal_stop"; + signal: "mouse,up,*"; + source: "numberdisplay_backspace_area"; + script { + backspace_send(); + } + } + program { + name: "numberdisplay_backspace_emit_signal_backspace"; + action: SIGNAL_EMIT "dialer_send" "backspace"; + } + program { + name: "numberdisplay_backspace_emit_signal_clear"; + action: SIGNAL_EMIT "dialer_send" "clear"; + } + program { + name: "numberdisplay_backspace_area_animation_start"; + signal: "mouse,down,*"; + source: "numberdisplay_backspace_area"; + action: STATE_SET "default" 0.3; + target: "numberdisplay_backspace_area"; + transition: LINEAR 0; + after: "numberdisplay_backspace_area_animation_continue"; + } + program { + name: "numberdisplay_backspace_area_animation_continue"; + action: STATE_SET "default" 0.6; + target: "numberdisplay_backspace_area"; + transition: LINEAR 0.3; + after: "numberdisplay_backspace_area_animation_stop"; + } + program { + name: "numberdisplay_backspace_area_animation_stop"; + action: STATE_SET "default" 1; + target: "numberdisplay_backspace_area"; + transition: LINEAR 0; + } + + /* row 1 */ + BUTTON(1, 0, 25/70, 1/3, 35/70, 1); + BUTTON(2, 1/3, 25/70, 2/3, 35/70, 2); + BUTTON(3, 2/3, 25/70, 3/3, 35/70, 3); + DESIGN_SEPERATOR(1, 1/3, 25/70, 1/3, 35/70); + DESIGN_SEPERATOR(2, 2/3, 25/70, 2/3, 35/70); + + /* row 2 */ + BUTTON(4, 0, 36/70, 1/3, 46/70, 4); + BUTTON(5, 1/3, 36/70, 2/3, 46/70, 5); + BUTTON(6, 2/3, 36/70, 3/3, 46/70, 6); + DESIGN_SEPERATOR(4, 1/3, 36/70, 1/3, 46/70); + DESIGN_SEPERATOR(5, 2/3, 36/70, 2/3, 46/70); + + /* row 3 */ + BUTTON(7, 0, 47/70, 1/3, 57/70, 7); + BUTTON(8, 1/3, 47/70, 2/3, 57/70, 8); + BUTTON(9, 2/3, 47/70, 3/3, 57/70, 9); + DESIGN_SEPERATOR(7, 1/3, 47/70, 1/3, 57/70); + DESIGN_SEPERATOR(8, 2/3, 47/70, 2/3, 57/70); + + /* row 4 */ + BUTTON(10, 0, 58/70 , 1/3, 68/70, "*"); + BUTTON(11, 1/3, 58/70, 2/3, 68/70, 0); + /*BUTTON(12, 2/3, 58/70, 3/3, 68/70, "#");*/ + part { + name: "button_12"; + type: RECT; + description { + state: "default" 0; + color_class: "unvisible"; + rel1 { relative: 2/3 58/70; offset: 0 0; }; + rel2 { relative: 3/3 68/70; offset: 0 0; }; + } + description { + state: "default" 0.5; + inherit: "default" 0; + color_class: "button_active"; + rel1.offset: 0 -5; + rel2.offset: 0 5; + } + description { + state: "default" 1; + inherit: "default" 0; + } + } + part { + name: "button_12_caption"; + type: TEXT; + mouse_events: 0; + description { \ + state: "default" 0; + color_class: "button_inactive"; + rel1 { + to: "button_12"; + relative: 0 0; + } + rel2 { + to: "button_12"; + relative: 1 1; + } + text { + text: "#"; + size: 18; + font: "Sans:style=Bold,Edje-Vera"; + fit: 1 1; + } + } + } + program { + name: "button_12_animation"; + signal: "mouse,down,*"; + source: "button_12"; + action: STATE_SET "default" 0.5; + target: "button_12"; + } + program { + name: "button_12_animation_end"; + signal: "mouse,up,*"; + source: "button_12"; + action: STATE_SET "default" 1; + target: "button_12"; + transition: DECELERATE 0.1; + } + program { + name: "hash_key_signal_emit"; + signal: "mouse,down,*"; + source: "button_12"; + script { + clear_timer_hash_key(); + } + } + program { + name: "hash_key_signal_stop"; + signal: "mouse,up,*"; + source: "button_12"; + script { + hash_key_send(); + } + } + program { + name: "hash_key_emit_signal_#"; + action: SIGNAL_EMIT "dialer_send" "#"; + } + program { + name: "hash_key_emit_signal_screen_locked"; + action: SIGNAL_EMIT "dialer_send" "screen_locked"; + } + DESIGN_SEPERATOR(10, 1/3, 58/70, 1/3, 68/70); + DESIGN_SEPERATOR(11, 2/3, 58/70, 2/3, 68/70); + } + } +} diff --git a/data/themes_data/blackwhite/fonts/Vera.ttf b/data/themes_data/blackwhite/fonts/Vera.ttf new file mode 100755 index 0000000..58cd6b5 Binary files /dev/null and b/data/themes_data/blackwhite/fonts/Vera.ttf differ diff --git a/data/themes_data/blackwhite/fonts/VeraBd.ttf b/data/themes_data/blackwhite/fonts/VeraBd.ttf new file mode 100755 index 0000000..51d6111 Binary files /dev/null and b/data/themes_data/blackwhite/fonts/VeraBd.ttf differ diff --git a/data/themes_data/blackwhite/images/back.png b/data/themes_data/blackwhite/images/back.png new file mode 100644 index 0000000..0470ec2 Binary files /dev/null and b/data/themes_data/blackwhite/images/back.png differ diff --git a/data/themes_data/blackwhite/images/bg.png b/data/themes_data/blackwhite/images/bg.png new file mode 100644 index 0000000..aeb222a Binary files /dev/null and b/data/themes_data/blackwhite/images/bg.png differ diff --git a/data/themes_data/blackwhite/images/bg_old.png b/data/themes_data/blackwhite/images/bg_old.png new file mode 100755 index 0000000..22f6151 Binary files /dev/null and b/data/themes_data/blackwhite/images/bg_old.png differ diff --git a/data/themes_data/blackwhite/images/caller.png b/data/themes_data/blackwhite/images/caller.png new file mode 100755 index 0000000..e660324 Binary files /dev/null and b/data/themes_data/blackwhite/images/caller.png differ diff --git a/data/themes_data/blackwhite/images/cover.png b/data/themes_data/blackwhite/images/cover.png new file mode 100644 index 0000000..3dfa32d Binary files /dev/null and b/data/themes_data/blackwhite/images/cover.png differ diff --git a/data/themes_data/blackwhite/images/forward.png b/data/themes_data/blackwhite/images/forward.png new file mode 100644 index 0000000..74d30ac Binary files /dev/null and b/data/themes_data/blackwhite/images/forward.png differ diff --git a/data/themes_data/blackwhite/images/gps_off.png b/data/themes_data/blackwhite/images/gps_off.png new file mode 100644 index 0000000..46b6571 Binary files /dev/null and b/data/themes_data/blackwhite/images/gps_off.png differ diff --git a/data/themes_data/blackwhite/images/gps_on.png b/data/themes_data/blackwhite/images/gps_on.png new file mode 100644 index 0000000..f339eaa Binary files /dev/null and b/data/themes_data/blackwhite/images/gps_on.png differ diff --git a/data/themes_data/blackwhite/images/info.png b/data/themes_data/blackwhite/images/info.png new file mode 100644 index 0000000..93c5481 Binary files /dev/null and b/data/themes_data/blackwhite/images/info.png differ diff --git a/data/themes_data/blackwhite/images/network.gprs.off.png b/data/themes_data/blackwhite/images/network.gprs.off.png new file mode 100644 index 0000000..ae90642 Binary files /dev/null and b/data/themes_data/blackwhite/images/network.gprs.off.png differ diff --git a/data/themes_data/blackwhite/images/network.gprs.on.png b/data/themes_data/blackwhite/images/network.gprs.on.png new file mode 100644 index 0000000..4e2bff8 Binary files /dev/null and b/data/themes_data/blackwhite/images/network.gprs.on.png differ diff --git a/data/themes_data/blackwhite/images/network.usb.png b/data/themes_data/blackwhite/images/network.usb.png new file mode 100644 index 0000000..cdc773a Binary files /dev/null and b/data/themes_data/blackwhite/images/network.usb.png differ diff --git a/data/themes_data/blackwhite/images/next.png b/data/themes_data/blackwhite/images/next.png new file mode 100644 index 0000000..e6e682c Binary files /dev/null and b/data/themes_data/blackwhite/images/next.png differ diff --git a/data/themes_data/blackwhite/images/no.png b/data/themes_data/blackwhite/images/no.png new file mode 100755 index 0000000..ec17fb3 Binary files /dev/null and b/data/themes_data/blackwhite/images/no.png differ diff --git a/data/themes_data/blackwhite/images/one.png b/data/themes_data/blackwhite/images/one.png new file mode 100644 index 0000000..4b2173a Binary files /dev/null and b/data/themes_data/blackwhite/images/one.png differ diff --git a/data/themes_data/blackwhite/images/pause.png b/data/themes_data/blackwhite/images/pause.png new file mode 100755 index 0000000..391638c Binary files /dev/null and b/data/themes_data/blackwhite/images/pause.png differ diff --git a/data/themes_data/blackwhite/images/phone.incoming.png b/data/themes_data/blackwhite/images/phone.incoming.png new file mode 100644 index 0000000..018cf8f Binary files /dev/null and b/data/themes_data/blackwhite/images/phone.incoming.png differ diff --git a/data/themes_data/blackwhite/images/phone.missed.png b/data/themes_data/blackwhite/images/phone.missed.png new file mode 100644 index 0000000..ff1c7c4 Binary files /dev/null and b/data/themes_data/blackwhite/images/phone.missed.png differ diff --git a/data/themes_data/blackwhite/images/phone.outgoing.png b/data/themes_data/blackwhite/images/phone.outgoing.png new file mode 100644 index 0000000..f9ba989 Binary files /dev/null and b/data/themes_data/blackwhite/images/phone.outgoing.png differ diff --git a/data/themes_data/blackwhite/images/phone.png b/data/themes_data/blackwhite/images/phone.png new file mode 100644 index 0000000..03e3167 Binary files /dev/null and b/data/themes_data/blackwhite/images/phone.png differ diff --git a/data/themes_data/blackwhite/images/play.png b/data/themes_data/blackwhite/images/play.png new file mode 100755 index 0000000..d9c3363 Binary files /dev/null and b/data/themes_data/blackwhite/images/play.png differ diff --git a/data/themes_data/blackwhite/images/player-minus.png b/data/themes_data/blackwhite/images/player-minus.png new file mode 100644 index 0000000..87a3fba Binary files /dev/null and b/data/themes_data/blackwhite/images/player-minus.png differ diff --git a/data/themes_data/blackwhite/images/player-plus.png b/data/themes_data/blackwhite/images/player-plus.png new file mode 100644 index 0000000..19239f7 Binary files /dev/null and b/data/themes_data/blackwhite/images/player-plus.png differ diff --git a/data/themes_data/blackwhite/images/power.off.png b/data/themes_data/blackwhite/images/power.off.png new file mode 100644 index 0000000..4c3ff62 Binary files /dev/null and b/data/themes_data/blackwhite/images/power.off.png differ diff --git a/data/themes_data/blackwhite/images/power.on.png b/data/themes_data/blackwhite/images/power.on.png new file mode 100644 index 0000000..216469b Binary files /dev/null and b/data/themes_data/blackwhite/images/power.on.png differ diff --git a/data/themes_data/blackwhite/images/previous.png b/data/themes_data/blackwhite/images/previous.png new file mode 100644 index 0000000..8c5a82d Binary files /dev/null and b/data/themes_data/blackwhite/images/previous.png differ diff --git a/data/themes_data/blackwhite/images/rotate.png b/data/themes_data/blackwhite/images/rotate.png new file mode 100644 index 0000000..89606a1 Binary files /dev/null and b/data/themes_data/blackwhite/images/rotate.png differ diff --git a/data/themes_data/blackwhite/images/sms.png b/data/themes_data/blackwhite/images/sms.png new file mode 100644 index 0000000..1b9b2e6 Binary files /dev/null and b/data/themes_data/blackwhite/images/sms.png differ diff --git a/data/themes_data/blackwhite/images/speaker_off.png b/data/themes_data/blackwhite/images/speaker_off.png new file mode 100644 index 0000000..13adbdc Binary files /dev/null and b/data/themes_data/blackwhite/images/speaker_off.png differ diff --git a/data/themes_data/blackwhite/images/speaker_on.png b/data/themes_data/blackwhite/images/speaker_on.png new file mode 100644 index 0000000..caa7f46 Binary files /dev/null and b/data/themes_data/blackwhite/images/speaker_on.png differ diff --git a/data/themes_data/blackwhite/images/stop.png b/data/themes_data/blackwhite/images/stop.png new file mode 100644 index 0000000..d9df656 Binary files /dev/null and b/data/themes_data/blackwhite/images/stop.png differ diff --git a/data/themes_data/blackwhite/images/sync_button.png b/data/themes_data/blackwhite/images/sync_button.png new file mode 100644 index 0000000..f5c1f35 Binary files /dev/null and b/data/themes_data/blackwhite/images/sync_button.png differ diff --git a/data/themes_data/blackwhite/images/track_left.png b/data/themes_data/blackwhite/images/track_left.png new file mode 100644 index 0000000..f17063f Binary files /dev/null and b/data/themes_data/blackwhite/images/track_left.png differ diff --git a/data/themes_data/blackwhite/images/track_right.png b/data/themes_data/blackwhite/images/track_right.png new file mode 100644 index 0000000..389cfc6 Binary files /dev/null and b/data/themes_data/blackwhite/images/track_right.png differ diff --git a/data/themes_data/blackwhite/images/yes.png b/data/themes_data/blackwhite/images/yes.png new file mode 100644 index 0000000..3678df3 Binary files /dev/null and b/data/themes_data/blackwhite/images/yes.png differ diff --git a/db_init.py b/db_init.py new file mode 100644 index 0000000..2f73de1 --- /dev/null +++ b/db_init.py @@ -0,0 +1,245 @@ +#!/usr/bin/env python2.5 +# -*- coding: utf-8 -*- +__author__ = "Frank Gau (fgau@pyneo.org), Thomas Gstaedtner (thomas (a) gstaedtner (.) net), Johannes 'josch' Schauer " +__version__ = "prototype" +__copyright__ = "Copyright (c) 2010" +__license__ = "GPL3" + +from sqlite3 import connect +from constants import DB_FILE_PATH + +class DatabaseInit(object): + @classmethod + def init(class_): + connection = connect(DB_FILE_PATH) + cursor = connection.cursor() + + cursor.execute("CREATE TABLE calls (status, number, time)") + cursor.execute("CREATE TABLE contacts (name, number)") + cursor.execute("CREATE TABLE sms (status, number, text, time)") + cursor.execute("CREATE TABLE music (artist, album, title)") + cursor.execute("CREATE TABLE mcc (country, cc, mcc)") + + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Afghanistan', '93', '412')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Albania', '355', '276')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Algeria', '213', '603')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('American Samoa (US)', '684 ', '544')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Andorra', '376', '213')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Angola', '244', '631')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Anguilla', '264 ', '365')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Antigua and Barbuda', '268 ', '344')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Argentina', '54', '722')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Armenia', '374', '283')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Aruba (Netherlands)', '297', '363')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Australia', '61', '505')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Austria', '43', '232')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Azerbaijan', '994', '400')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Bahamas', '242 ', '364')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Bahrain', '973', '426')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Bangladesh', '880', '470')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Barbados', '246 ', '342')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Belarus', '375', '257')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Belgium', '32', '206')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Belize', '501', '702')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Benin', '229', '616')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Bermuda (UK)', '441 ', '350')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Bhutan', '975', '402')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Bolivia', '591', '736')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Bosnia and Herzegovina', '387', '218')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Botswana', '267', '652')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Brazil', '55', '724')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('British Virgin Islands (UK)', '284 ', '348')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Brunei Darussalam', '673', '528')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Bulgaria', '359', '284')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Burkina Faso', '226', '613')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Burundi', '257', '642')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Cambodia', '855', '456')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Cameroon', '237', '624')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Canada', '1', '302')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Cape Verde Islands', '238', '625')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Cayman Islands (UK)', '345 ', '346')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Central African Republic', '236', '623')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Chad', '235', '622')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Chile', '56', '730')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('China (PRC)', '86', '460')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Colombia', '57', '732')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Comoros', '269', '654')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Costa Rica', '506', '712')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Croatia', '385', '219')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Cuba', '53', '368')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Cyprus', '357', '280')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Czech Republic', '420', '230')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Democratic Republic of the Congo', '242', '630')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Denmark', '45', '238')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Djibouti', '253', '638')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Dominica', '767 ', '366')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Dominican Republic', '829 ', '370')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('East Timor', '670', '514')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Ecuador', '593', '740')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Egypt', '20', '602')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('El Salvador', '503', '706')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Equatorial Guinea', '240', '627')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Eritrea', '291', '657')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Estonia', '372', '248')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Ethiopia', '251', '636')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Faroe Islands (Denmark)', '298', '288')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Fiji Islands', '679', '542')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Finland', '358', '244')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('France', '33', '208')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('French Guiana', '594', '742')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('French Polynesia', '689', '547')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Gabonese Republic', '241', '628')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Gambia', '220', '607')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Georgia', '995', '282')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Germany', '49', '262')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Ghana', '233', '620')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Gibraltar (UK)', '350', '266')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Greece', '30', '202')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Greenland (Denmark)', '299', '290')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Grenada', '473 ', '352')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Guadeloupe (France)', '590', '340')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Guam (US)', '671 ', '535')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Guatemala', '502', '704')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Guinea', '224', '611')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Guinea-Bissau', '245', '632')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Guyana', '592', '738')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Haiti', '509', '372')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Honduras', '504', '708')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Hong Kong (PRC)', '852', '454')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Hungary', '36', '216')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Iceland', '354', '274')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('India', '91', '404')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('India', '91', '405')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Indonesia', '62', '510')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Iran', '98', '432')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Iraq', '964', '418')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Ireland', '353', '272')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Israel', '972', '425')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Italy', '39', '222')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Jamaica', '876', '338')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Japan', '81', '441')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Japan', '81', '440')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Jordan', '962', '416')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Kazakhstan', '7', '401')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Kenya', '254', '639')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Kiribati', '686', '545')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Korea, North', '850', '467')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Korea, South', '82', '450')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Kuwait', '965', '419')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Kyrgyz Republic', '996', '437')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Laos', '856', '457')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Latvia', '371', '247')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Lebanon', '961', '415')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Lesotho', '266', '651')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Liberia', '231', '618')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Libya', '218', '606')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Liechtenstein', '423', '295')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Lithuania', '370', '246')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Luxembourg', '352', '270')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Macau (PRC)', '853', '455')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Madagascar', '261', '646')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Malawi', '265', '650')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Malaysia', '60', '502')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Maldives', '960', '472')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Mali Republic', '223', '610')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Malta', '356', '278')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Marshall Islands', '692', '551')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Martinique (France)', '596', '340')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Mauritania', '222', '609')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Mauritius', '230', '617')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Mexico', '52', '334')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Moldova', '373', '259')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Monaco', '377', '212')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Mongolia', '976', '428')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Montenegro', '382', '297')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Montserrat (UK)', '664 ', '354')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Morocco', '212', '604')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Mozambique', '258', '643')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Myanmar', '95', '414')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Namibia', '264', '649')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Nauru', '674', '536')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Nepal', '977', '429')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Netherlands', '31', '204')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Netherlands Antilles (Netherlands)', '599', '362')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('New Caledonia (France)', '687', '546')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('New Zealand', '64', '530')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Nicaragua', '505', '710')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Niger', '227', '614')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Nigeria', '234', '621')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Northern Mariana Islands (US)', '670 ', '534')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Norway', '47', '242')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Oman', '968', '422')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Pakistan', '92', '410')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Palau', '680', '552')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Panama', '507', '714')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Papua New Guinea', '675', '537')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Paraguay', '595', '744')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Peru', '51', '716')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Philippines', '63', '515')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Poland', '48', '260')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Portugal', '351', '268')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Puerto Rico', '939 ', '330')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Qatar', '974', '427')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Romania', '40', '226')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Russia', '7', '250')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Rwandese Republic', '250', '635')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('R�union Island', '262', '647')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Saint Kitts and Nevis', '869', '356')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Saint Lucia', '758' , '358')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Saint Pierre and Miquelon (France)', '508', '308')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Saint Vincent and the Grenadines', '784', '360')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Samoa', '685', '549')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('San Marino', '378', '292')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Saudi Arabia', '966', '420')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Senegal', '221', '608')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Serbia', '381', '220')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Seychelles', '248', '633')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Sierra Leone', '232', '619')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Singapore', '65', '525')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Slovak Republic', '421', '231')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Slovenia', '386', '293')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Solomon Islands', '677', '540')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('South Africa', '27', '655')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Spain', '34', '214')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Sri Lanka', '94', '413')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Sudan', '249', '634')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Suriname', '597', '746')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Swaziland', '268', '653')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Sweden', '46', '240')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Switzerland', '41', '228')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Syria', '963', '417')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('S�o Tom� and Principe', '239', '626')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Taiwan', '886', '466')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Tajikistan', '992', '436')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Tanzania', '255', '640')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Thailand', '66', '520')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Togolese Republic', '228', '615')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Tonga Islands', '676', '539')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Trinidad and Tobago', '868', '374')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Tunisia', '216', '605')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Turkey', '90', '286')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Turkmenistan', '993', '438')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Turks and Caicos Islands (UK)', '649', '376')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Uganda', '256', '641')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Ukraine', '380', '255')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('United Arab Emirates', '971', '424')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('United Kingdom', '44', '235')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('United Kingdom', '44', '234')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('United States of America', '1', '310')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('United States of America', '1', '311')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('United States of America', '1', '312')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('United States of America', '1', '313')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('United States of America', '1', '314')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('United States of America', '1', '315')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('United States of America', '1', '316')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Uruguay', '598', '748')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Uzbekistan', '998', '434')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Vanuatu', '678', '541')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Vatican City State', '379', '225')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Venezuela', '58', '734')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Vietnam', '84', '452')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Wallis and Futuna (France)', '681', '543')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Yemen', '967', '421')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Zambia', '260', '645')") + cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Zimbabwe', '263', '648')") + connection.commit() diff --git a/db_support.py b/db_support.py new file mode 100644 index 0000000..e1dfc47 --- /dev/null +++ b/db_support.py @@ -0,0 +1,132 @@ +#!/usr/bin/env python2.5 +# -*- coding: utf-8 -*- +__author__ = "Frank Gau (fgau@pyneo.org), Thomas Gstaedtner (thomas (a) gstaedtner (.) net), Johannes 'josch' Schauer " +__version__ = "prototype" +__copyright__ = "Copyright (c) 2009" +__license__ = "GPL3" + +from datetime import datetime +from sqlite3 import connect +from constants import DB_FILE_PATH + +class DatabaseController(object): + @classmethod + def init(class_): + class_.connection = connect(DB_FILE_PATH) + class_.cursor = class_.connection.cursor() + + @classmethod + def get_sms_count(class_, status): + class_.cursor.execute("SELECT COUNT(*) FROM sms WHERE status='%s'" % status) + results = [i for i in class_.cursor] + if len(results) == 1: + return results[0][0] + + @classmethod + def get_call_count(class_, status): + if status == 'time': + class_.cursor.execute("SELECT COUNT(*) FROM calls") + else: + class_.cursor.execute("SELECT COUNT(*) FROM calls WHERE status='%s'" % status) + results = [i for i in class_.cursor] + if len(results) == 1: + return results[0][0] + + @classmethod + def get_contact_count(class_): + class_.cursor.execute("SELECT COUNT(*) FROM contacts") + results = [i for i in class_.cursor] + if len(results) == 1: + return results[0][0] + + @classmethod + def get_name_from_number(class_, number): + class_.cursor.execute("SELECT name FROM contacts WHERE number LIKE ? LIMIT 1", ("%%%s"%number,)) + results = [i for i in class_.cursor] + if len(results) == 1: + return results[0][0] + + @classmethod + def get_number_from_name(class_, name): + class_.cursor.execute("SELECT number FROM contacts WHERE name LIKE ? LIMIT 1", ("%%%s%%"%name,)) + results = [i for i in class_.cursor] + if len(results) == 1: + return results[0][0] + + @classmethod + def get_contacts(class_, count, offset): + class_.cursor.execute("SELECT * FROM contacts ORDER BY 'name' LIMIT ? OFFSET ?", (count, offset)) + return class_.cursor + + @classmethod + def get_sms_list(class_, count, offset, status): + class_.cursor.execute("SELECT * FROM sms WHERE status='%s' ORDER BY time DESC LIMIT %s OFFSET %s" %(status, count, offset)) + results = [i for i in class_.cursor] + if len(results): + return results + + @classmethod + def get_allcontacts(class_): + class_.cursor.execute("SELECT name, number FROM contacts") + contactsdb = {} + for name, number in class_.cursor: + contactsdb[name.encode("utf-8")] = number + return contactsdb + + @classmethod + def insert_history(class_, status, number): + class_.cursor.execute('INSERT INTO calls (status, number, time) VALUES (?, ?, ?)', (status, number, datetime.now())) + class_.connection.commit() + + @classmethod + def insert_contact(class_, number, name): + class_.cursor.execute('INSERT INTO contacts (name, number) VALUES (?, ?)', (name, number)) + class_.connection.commit() + + @classmethod + def insert_new_sms(class_, status, number, text, time): + class_.cursor.execute('INSERT INTO sms (status, number, text, time) VALUES (?, ?, ?, ?)', (status, number, text, time)) + class_.connection.commit() + + @classmethod + def del_allcontacts(class_): + class_.cursor.execute("DELETE FROM contacts") + class_.connection.commit() + + @classmethod + def get_country_code(class_, mcc): + class_.cursor.execute("SELECT * FROM mcc WHERE mcc='%s'" % mcc) + results = [i for i in class_.cursor] + if len(results) == 1: + return results + + @classmethod + def mark_sms_read(class_, time): + class_.cursor.execute("UPDATE sms SET status='REC READ' WHERE time='%s'" % time) + class_.connection.commit() + + @classmethod + def get_sms_detail(class_, sms_number, sms_status): + class_.cursor.execute("SELECT * FROM sms WHERE status='%s' ORDER BY time DESC LIMIT 1 OFFSET %s" %(sms_status, sms_number)) + results = [i for i in class_.cursor] + if len(results) == 1: + return results + + @classmethod + def check_for_unread_sms(class_): + class_.cursor.execute("SELECT COUNT(*) FROM sms WHERE status='REC UNREAD'") + for row in class_.cursor: + print 'Count: ', row[0] + return row[0] + + @classmethod + def delete_sms(class_, time): + class_.cursor.execute("DELETE FROM sms WHERE time='%s'" % time) + class_.connection.commit() + + @classmethod + def get_calls(class_, status, limit, offset): + class_.cursor.execute("SELECT * FROM calls WHERE status LIKE ? ORDER by time DESC LIMIT ? OFFSET ?", (status, limit, offset)) + results = [i for i in class_.cursor] + if len(results): + return results diff --git a/dialer_screen.py b/dialer_screen.py new file mode 100644 index 0000000..52ec44d --- /dev/null +++ b/dialer_screen.py @@ -0,0 +1,607 @@ +#!/usr/bin/env python2.5 +# -*- coding: utf-8 -*- +__author__ = "Soeren Apel (abraxa@dar-clan.de), F. Gau (fgau@pyneo.org), Thomas Gstaedtner (thomas (a) gstaedtner (.) net)" +__version__ = "prototype" +__copyright__ = "Copyright (c) 2008" +__license__ = "GPL3" + +from epydial import * + +class InfoBarWidget(object): + def __init__(self, canvas, x, y, w, h, layer): + FONT_COLOR = PyneoController.get_ini_value('info_bar', 'font_color') + FONT_STYLE = PyneoController.get_ini_value('info_bar', 'font_style') + FONT_HEIGHT = int(PyneoController.get_ini_value('info_bar', 'font_height')) + FONT_BG_COLOR = PyneoController.get_ini_value('info_bar', 'font_bg') + + self.bar_bg = evas.Rectangle(canvas, pos=(x,y), size=(w,h/20), color=FONT_BG_COLOR) + self.bar_bg.layer = layer + + self.bar_operator = evas.Text(canvas, font=(FONT_STYLE, FONT_HEIGHT), color=FONT_COLOR) + self.bar_operator.pos = (x+w/80, y) + self.bar_operator.layer = layer + + self.phone_pix = evas.Image(canvas, size=(16,20)) + self.phone_pix.pos = (self.bar_operator.bottom_right_get()[0]+10, y+5) + self.phone_pix.layer = layer + + self.sms_pix = evas.Image(canvas, size=(20,14)) + self.sms_pix.pos = (self.bar_operator.bottom_right_get()[0]+30, y+9) + self.sms_pix.layer = layer + + self.bar_time = evas.Text(canvas, font=(FONT_STYLE, FONT_HEIGHT), color=FONT_COLOR) + self.bar_time.layer = layer + + self.bar_rssi_bat = evas.Text(canvas, font=(FONT_STYLE, FONT_HEIGHT), color=FONT_COLOR) + self.bar_rssi_bat.layer = layer + + def show(self): + self.bar_bg.show() + self.bar_operator.show() + self.bar_time.show() + self.bar_rssi_bat.show() + + def hide(self): + self.bar_bg.hide() + self.bar_operator.hide() + self.bar_time.hide() + self.bar_rssi_bat.hide() + +class Button(evas.Rectangle): + def __init__(self, coords, *args, **kwargs): + super(Button, self).__init__(*args, **kwargs) + self.coords = coords + +class TextCaption(object): + def __init__(self, canvas, x, y, text, caption): + FONT_COLOR = PyneoController.set_font_color + + self.label = evas.Text(canvas, text=text, font=("Sans:style=Bold,Edje-Vera", 50), color=FONT_COLOR) + self.label.layer = 3 + self.label.pass_events = True + self.label.pos = (x*480/3+(480/3-self.label.horiz_advance)/2, 200+y*440/4+(440/4-self.label.vert_advance)/2) + self.caption = evas.Text(canvas, text=caption, font=("Sans", 20), color=FONT_COLOR) + self.caption.layer = 3 + self.caption.pass_events = True + self.caption.pos = (x*480/3+(480/3-self.label.horiz_advance)/2, 200+(y+1)*440/4-self.label.vert_advance/2) + + def show(self): + self.label.show() + self.caption.show() + + def hide(self): + self.label.hide() + self.caption.hide() + +class TextScrollWidget(object): + def __init__(self, canvas, x=0, y=0, w=0, h=0, layer=0, text="", click_handler=None): + FONT_COLOR = PyneoController.set_font_color + + self.pos = (x, y) + self.size = (w, h) + self.layer = layer + self.click_handler = click_handler + + self.bg = evas.Rectangle(canvas, pos=self.pos, size=self.size, color="#00FFFFFF") + self.bg.layer = self.layer + self.bg.on_mouse_down_add(self.on_mouse_down) + self.bg.on_mouse_move_add(self.on_mouse_move) + self.bg.on_mouse_up_add(self.on_mouse_up) + + self.clip = evas.Rectangle(canvas, pos=self.pos, size=self.size, color="#FFFFFF") + self.clip.layer = self.layer + + self.label = evas.Text(canvas, text=text, font=("Sans:style=Bold,Edje-Vera", 50), color=FONT_COLOR) + self.label_y = y+(h-self.label.vert_advance)/2 + self.label.pos = x, self.label_y + self.label.layer = self.layer + self.label.clip_set(self.clip) + self.label.pass_events = True + self.label.show() + self.mouse = 0 + self.start = 0 + self.mouse_down = False + + def get_text(self): + # label.text is None when Empty - not "" + if self.label.text: + return self.label.text + else: + return "" + + def set_text(self, value): + self.label.text = value + self.scroll_to_index(len(value)) + + text = property(fget=get_text, fset=set_text) + + def on_mouse_down(self, source, event): + self.mouse_down = True + self.mouse = self.start = event.position.output[0] + self.text_x, y = self.label.pos + ecore.timer_add(0.3, self.on_click) + + def on_click(self): + if not self.mouse_down: +# if not self.mouse_down and self.start-7 < self.mouse < self.start+7: + self.click_handler() + + def on_mouse_move(self, source, event): + self.mouse = pos = event.position.output[0] + if self.mouse_down: + cw, ch = self.size + cx, cy = self.pos + pos = -self.text_x+cw+cx-pos+self.start + if 0 < pos: + horiz_advance = self.label.horiz_advance + if pos > horiz_advance: + self.label.pos = (cw+cx-horiz_advance, self.label_y) + else: + r = self.label.char_coords_get(pos, 0) + if r is not None: + pos, x, y, w, h = r + self.label.pos = (cw+cx-x, self.label_y) + + def on_mouse_up(self, source, event): + self.mouse_down = False + + def show(self): + self.clip.show() + self.bg.show() + + def hide(self): + self.clip.hide() + self.bg.hide() + + def scroll_to_index(self, index): + """index might be out of bound - in this case it is scrolled to the end + """ + cw, ch = self.size + cx, cy = self.pos + if 0 <= index < len(self.text): + x, y, w, h = self.label.char_pos_get(index) + else: + x = self.label.horiz_advance + self.label.pos = (cw+cx-x, self.label_y) + + def current_index_get(self): + """returns the position of the char that begins at the last char that + can be seen in the clip or when the last char is already at the end + then return the length + """ + text_x, y = self.label.pos + cw, ch = self.size + cx, cy = self.pos + ret = self.label.char_coords_get(-text_x+cw+cx, 0) + if ret is not None: + pos, x, y, w, h = ret + return ord(pos)+1 # workaround for a small bug index != current_index_get(char_pos_get(index)) + else: + return len(self.text) + + def delete_current_char(self): + text = self.text + index = self.current_index_get() + self.label.text = text[:index-1]+text[index:] + cw, ch = self.size + self.scroll_to_index(index-1) + + def insert_at_current_index(self, ch): + text = self.text + index = self.current_index_get() + self.label.text = text[:index]+ch+text[index:] + cw, ch = self.size + self.scroll_to_index(index+1) + +class DialWidget(object): + caption_text = { + (0,0):".,?!",(1,0):"abc",(2,0):"def", + (0,1):"ghi",(1,1):"jklm",(2,1):"nop", + (0,2):"qrs",(1,2):"tuvw",(2,2):"xyz", + (0,3):"+-/%",(1,3):"\\~[{",(2,3):"@&\"$", + } + label_text = [{ + (0,0):"1",(1,0):"2",(2,0):"3", + (0,1):"4",(1,1):"5",(2,1):"6", + (0,2):"7",(1,2):"8",(2,2):"9", + (0,3):"*",(1,3):"0",(2,3):"#", + }, + { + (0,0):"1",(1,0):"?",(2,0):"'", + (0,1):".",(1,1):",",(2,1):":", + (0,2):"!",(1,2):"`",(2,2):"_", + (0,3):"",(1,3):"",(2,3):"", + }, + { + (0,0):"a",(1,0):"2",(2,0):"c", + (0,1):"A",(1,1):"b",(2,1):"C", + (0,2):"",(1,2):"B",(2,2):"", + (0,3):"",(1,3):"",(2,3):"", + }, + { + (0,0):"D",(1,0):"d",(2,0):"3", + (0,1):"E",(1,1):"e",(2,1):"f", + (0,2):"",(1,2):"",(2,2):"F", + (0,3):"",(1,3):"",(2,3):"", + }, + { + (0,0):"i",(1,0):"I",(2,0):"", + (0,1):"4",(1,1):"h",(2,1):"H", + (0,2):"g",(1,2):"G",(2,2):"", + (0,3):"",(1,3):"",(2,3):"", + }, + { + (0,0):"M",(1,0):"m",(2,0):"L", + (0,1):"j",(1,1):"5",(2,1):"l", + (0,2):"J",(1,2):"k",(2,2):"K", + (0,3):"",(1,3):"",(2,3):"", + }, + { + (0,0):"",(1,0):"N",(2,0):"n", + (0,1):"O",(1,1):"o",(2,1):"6", + (0,2):"",(1,2):"P",(2,2):"p", + (0,3):"",(1,3):"",(2,3):"", + }, + { + (0,0):"",(1,0):"",(2,0):"", + (0,1):"s",(1,1):"S",(2,1):"", + (0,2):"7",(1,2):"r",(2,2):"R", + (0,3):"q",(1,3):"Q",(2,3):"", + }, + { + (0,0):"",(1,0):"",(2,0):"", + (0,1):"W",(1,1):"w",(2,1):"V", + (0,2):"t",(1,2):"8",(2,2):"v", + (0,3):"T",(1,3):"u",(2,3):"U", + }, + { + (0,0):"",(1,0):"",(2,0):"", + (0,1):"",(1,1):"X",(2,1):"x", + (0,2):"Y",(1,2):"y",(2,2):"9", + (0,3):"",(1,3):"Z",(2,3):"z", + }, + { + (0,0):"",(1,0):"",(2,0):"", + (0,1):"/",(1,1):"+",(2,1):"|", + (0,2):"(",(1,2):")",(2,2):"%", + (0,3):"*",(1,3):"-",(2,3):";", + }, + { + (0,0):"",(1,0):"",(2,0):"", + (0,1):"{",(1,1):"}",(2,1):"\\", + (0,2):"[",(1,2):"]",(2,2):"\n", + (0,3):"~",(1,3):"0",(2,3):" ", + }, + { + (0,0):"",(1,0):"",(2,0):"", + (0,1):"^",(1,1):"\"",(2,1):"&", + (0,2):"@",(1,2):"<",(2,2):">", + (0,3):"$",(1,3):"=",(2,3):"#", + }] + + def __init__(self, canvas, click_handler): + FONT_COLOR = PyneoController.set_font_color + + self.click_handler = click_handler + + # create labels + self.labelsets = [dict() for i in self.label_text] + for y in range(4): + for x in range(3): + self.labelsets[0][(x,y)] = TextCaption(canvas, x, y, self.label_text[0][(x,y)], self.caption_text[(x,y)]) + for i, labelset in enumerate(self.label_text[1:]): + for y in range(4): + for x in range(3): + label = evas.Text(canvas, text=labelset[(x,y)], font=("Sans:style=Bold,Edje-Vera", 50), color=FONT_COLOR) + label.layer = 3 + label.pass_events = True + label.pos = (x*480/3+(480/3-label.horiz_advance)/2, 200+y*440/4+(440/4-label.vert_advance)/2) + self.labelsets[i+1][(x,y)] = label + # show the default labelset + self.current_layer=0 + for label in self.labelsets[self.current_layer].values(): + label.show() + + # create clickbuttons + self.buttons = dict() + for y in range(4): + for x in range(3): + button = Button((x,y), canvas, pos=(x*480/3,200+y*440/4), size=(480/3,440/4), color="#00000000") + button.layer = 2 + button.pointer_mode_set(evas.EVAS_OBJECT_POINTER_MODE_NOGRAB) + button.on_mouse_down_add(self.on_mouse_down) + button.on_mouse_up_add(self.on_mouse_up) + button.on_mouse_in_add(self.on_mouse_in) + button.on_mouse_out_add(self.on_mouse_out) + button.show() + self.buttons[(x,y)] = button + + # create color rects + self.color_buttons = dict() + for y in range(4): + for x in range(3): + button = Button((x,y), canvas, pos=(x*480/3,200+y*440/4), size=(480/3,440/4), color="#222222") + button.layer = 1 + self.color_buttons[(x,y)] = button + + def on_mouse_down(self, source, event): + for label in self.labelsets[self.current_layer].values(): + label.hide() + x, y = source.coords + self.current_layer = y*3+x+1 + for label in self.labelsets[self.current_layer].values(): + label.show() + self.color_buttons[source.coords].show() + + def on_mouse_up(self, source, event): + x, y = source.coords + letter = self.label_text[self.current_layer][(x,y)] + self.click_handler(letter) + for label in self.labelsets[self.current_layer].values(): + label.hide() + self.current_layer = 0 + for label in self.labelsets[self.current_layer].values(): + label.show() + self.color_buttons[source.coords].hide() + + def on_mouse_in(self, source, event): + self.color_buttons[source.coords].show() + + def on_mouse_out(self, source, event): + self.color_buttons[source.coords].hide() + + def hide(self): + for label in self.labelsets[self.current_layer].values(): + label.hide() + for button in self.buttons.values(): + button.hide() + + def show(self): + for label in self.labelsets[self.current_layer].values(): + label.show() + for button in self.buttons.values(): + button.show() + +class BackspaceButton(evas.Image): + def __init__(self, canvas, x, y, w, h, click_handler, hold_handler=None): + evas.Image.__init__(self, canvas, pos=(x, y), size=(w, h), file="/usr/share/epydial/data/themes_data/blackwhite/images/back.png") + self.fill = 0, 0, w, h + self.layer = 99 + self.on_mouse_up_add(click_handler) + +class DialerScreen(): + number_regex = re.compile("^\+?\d+$") + text = None + + def __init__(self, screen_manager): + canvas = screen_manager.get_evas() + self.text = "" + self.enter_sim_key = False + self.look_screen = False + self.rssi = 0 + + self.info_bar = InfoBarWidget(canvas, 0, 0, WIDTH, HEIGHT, 99, ) + self.dial_input = DialWidget(canvas, click_handler=self.on_dialer_click) + self.backspace_button = BackspaceButton(canvas, 400, 50, 80, 80, click_handler=self.on_backspace) + self.numberdisplay_text = TextScrollWidget(canvas, 0, 40, 400, 160, click_handler=self.on_dial) + self.numberdisplay_text.show() + ecore.timer_add(10, self.display_time) + self.display_time() + + self.bg = evas.Image(canvas, pos=(0, 0), size=(WIDTH, HEIGHT), file=PyneoController.set_bg_image) + self.bg.fill = 0, 0, WIDTH, HEIGHT + self.bg.layer = -10 + + def hide(self): + self.bg.hide() + self.info_bar.hide() + self.dial_input.hide() + self.backspace_button.hide() + self.numberdisplay_text.hide() + + def show(self): + self.bg.show() + self.info_bar.show() + self.dial_input.show() + self.backspace_button.show() + self.numberdisplay_text.show() + + def register_pyneo_callbacks(self): + PyneoController.register_callback("sim_key_required", self.on_sim_key_required) + PyneoController.register_callback("sim_ready", self.on_sim_ready) + PyneoController.register_callback("gsm_registering", self.on_gsm_registering) + PyneoController.register_callback("gsm_operator_change", self.on_gsm_operator_change) + PyneoController.register_callback("gsm_signal_strength_change", self.on_gsm_signal_strength_change) + PyneoController.register_callback("capacity_change", self.on_capacity_change) + PyneoController.register_callback("dialer_text_set", self.on_text_set) + PyneoController.register_callback("set_missed_call_icon", self.on_set_missed_call_icon) + PyneoController.register_callback("set_missed_sms_icon", self.on_set_missed_sms_icon) + + def on_set_missed_call_icon(self, status): + if status == 'true': + self.info_bar.phone_pix.file = "%sphone.png" % THEME_IMAGES + else: + self.info_bar.phone_pix.file = "%sone.png" % THEME_IMAGES + self.info_bar.phone_pix.fill = 0, 0, 16, 20 + self.info_bar.phone_pix.show() + + def on_set_missed_sms_icon(self, status): + if status == 'true': + self.info_bar.sms_pix.file = "%ssms.png" % THEME_IMAGES + else: + self.info_bar.sms_pix.file = "%sone.png" % THEME_IMAGES + self.info_bar.sms_pix.fill = 0, 0, 20, 14 + self.info_bar.sms_pix.show() + + def on_text_set(self, text): + self.text = text + self.numberdisplay_text.text = self.text + + def on_sim_key_required(self, key_type): + print '---', 'opening keyring' + self.numberdisplay_text.text = "Enter " + key_type + self.enter_sim_key = True + + def on_sim_ready(self): + print '---', 'SIM unlocked' +# self.numberdisplay_text.text = "SIM unlocked" + self.text = "" + self.enter_sim_key = False + + def on_gsm_registering(self): + self.numberdisplay_text.text = "Registering ..." + + def on_gsm_operator_change(self, operator): + if (self.numberdisplay_text.text == "Registering ..."): + self.numberdisplay_text.text = "" + self.info_bar.bar_operator.text = operator + self.info_bar.bar_operator.pos = (WIDTH/80, 0) + self.info_bar.phone_pix.pos = (self.info_bar.bar_operator.bottom_right_get()[0]+10, 5) + self.info_bar.sms_pix.pos = (self.info_bar.bar_operator.bottom_right_get()[0]+30, 9) + + def on_capacity_change(self, status): + if status['capacity']: + self.capacity = status['capacity'] + self.info_bar.bar_rssi_bat.text = "%sdBm / %s%%" % (self.rssi, self.capacity) + self.info_bar.bar_rssi_bat.pos = (480-self.info_bar.bar_rssi_bat.horiz_advance-480/80, 0) + else: + self.capacity = None + + def on_gsm_signal_strength_change(self, rssi): + self.rssi = rssi + try: + self.info_bar.bar_rssi_bat.text = "%s dBm / %s%%" % (self.rssi, self.capacity) + self.info_bar.bar_rssi_bat.pos = (480-self.info_bar.bar_rssi_bat.horiz_advance-480/80, 0) + except: pass + + def display_time(self): + now = datetime.now() + self.info_bar.bar_time.text = now.strftime('%H:%M') + self.info_bar.bar_time.pos = ((WIDTH-self.info_bar.bar_time.horiz_advance)/2, 0) + return True + + def on_backspace(self, source, event): + self.numberdisplay_text.delete_current_char() + self.text = self.numberdisplay_text.text + print self.text + + def on_dialer_click(self, letter): + if (self.enter_sim_key & (self.numberdisplay_text.text[:5] == "Enter")): + self.numberdisplay_text.text = "" + self.numberdisplay_text.insert_at_current_index(letter) + self.text = self.numberdisplay_text.text + print self.text + + def on_dial(self): + if PyneoController.gsm_sim_locked(): + print '---', 'send pin' + self.numberdisplay_text.text = "Verifying ..." + PyneoController.gsm_unlock_sim(self.text) + elif self.text == "": + print "--- nothing entered" + elif self.text == "#": + print '--- Lock' + self.text = "" + self.numberdisplay_text.text = "" + PyneoController.show_lock_screen() + elif self.text == "*": + print '--- Settings Screen' + self.text = "" + self.numberdisplay_text.text = "" + PyneoController.show_screen(SETTINGS_SCREEN_NAME) + elif len(self.text) <= 2: + num = int(self.text) + if num == 1: + print '--- Gsm Status' + self.text = "" + self.numberdisplay_text.text = "" + PyneoController.show_screen(GSM_STATUS_SCREEN_NAME) + elif num == 2: + print '--- Gps Status' + self.text = "" + self.numberdisplay_text.text = "" + PyneoController.show_gps_status_screen() + elif num == 3: + print '--- Time Screen' + self.text = "" + self.numberdisplay_text.text = "" +# PyneoController.show_screen(TIME_SCREEN_NAME) + elif num == 4: + print '--- Pix' + self.text = "" + self.numberdisplay_text.text = "" + PyneoController.show_screen(PIX_SCREEN_NAME) + elif num == 5: + print '--- Yahoo Weather Screen' + self.text = "" + self.numberdisplay_text.text = "" + PyneoController.show_screen(WEATHER_SCREEN_NAME) + elif num == 6: + print '--- Hon Screen' + self.text = "" + self.numberdisplay_text.text = "" + PyneoController.show_screen(HON_SCREEN_NAME) + elif num == 7: + print '--- Contacts Screen' + self.text = "" + self.numberdisplay_text.text = "" + PyneoController.show_screen(CONTACTS_SCREEN_NAME) + elif num == 8: + print '--- Sms Screen' + self.text = "" + self.numberdisplay_text.text = "" + PyneoController.show_screen(SMS_SCREEN_NAME) + elif num == 9: + print '--- Audio Screen' + self.text = "" + self.numberdisplay_text.text = "" + PyneoController.show_screen(AUDIOSORT_SCREEN_NAME) + elif num == 0: + print '--- Call History Screen' + self.text = "" + self.numberdisplay_text.text = "" + PyneoController.show_screen(HISTORY_SCREEN_NAME) + elif num == 10: + print '--- Timetable Screen' + self.text = "" + self.numberdisplay_text.text = "" + PyneoController.show_screen(TIMETABLE_SCREEN_NAME) + elif num == 11: + print '--- Wlan Screen' + self.text = "" + self.numberdisplay_text.text = "" + PyneoController.show_screen(WLAN_SCREEN_NAME) + elif num == 12: + print '--- Font Color Screen' + self.text = "" + self.numberdisplay_text.text = "" + PyneoController.show_screen(FONTCOLOR_SCREEN_NAME) + elif num == 13: + print '--- News Screen' + self.text = "" + self.numberdisplay_text.text = "" + PyneoController.show_screen(NEWS_SCREEN_NAME) + else: + tokens = self.text.split(" ") + if len(tokens) == 1: + expression = tokens[0] + number = DatabaseController.get_number_from_name(expression) + if number: + PyneoController.show_incall_screen('outgoing') + PyneoController.gsm_dial(number) + elif re.match(self.number_regex, self.text): + PyneoController.show_incall_screen('outgoing') + PyneoController.gsm_dial(self.text) + else: + from math import * + result = str(eval(expression)) + self.text = result + self.numberdisplay_text.text = result + print "%s = %s"%(expression, result) + elif len(tokens) == 2: + number, name = tokens + DatabaseController.insert_contact(number, name) + self.text = "" + self.numberdisplay_text.text = "" + else: + print "longer token" diff --git a/epydial.ini b/epydial.ini new file mode 100644 index 0000000..4ee96eb --- /dev/null +++ b/epydial.ini @@ -0,0 +1,29 @@ +[theme] +theme = blackwhite +vibrate = off +brightness = 60 +bg_image = /usr/share/epydial/data/themes_data/blackwhite/images/bg.png +font_color = #ff808080 +ringtone_file = /usr/share/epydial/data/sounds/ring-ring.wav +smstone_file = /usr/share/epydial/data/sounds/sms.wav +ringtone_file = /usr/share/epydial/data/sounds/ring-ring.wav +smstone_file = /usr/share/epydial/data/sounds/sms.wav + +[alsa] +alsastate = stereoout + +[map] +map_type = OsmStreet +latitude = 52.5264594 +longitude = 13.4068439 +zoom = 10 + +[status] +missed_calls = false +missed_sms = false + +[info_bar] +font_color = #808080 +font_style = Sans:style=Edje-Vera +font_height = 21 +font_bg = #00808080 diff --git a/epydial.py b/epydial.py new file mode 100755 index 0000000..342ff9e --- /dev/null +++ b/epydial.py @@ -0,0 +1,969 @@ +#!/usr/bin/env python2.5 +# -*- coding: utf-8 -*- +__author__ = ', '.join(( + "Soeren Apel (abraxa@dar-clan.de)", + "Frank Gau (fgau@pyneo.org)", + "Thomas Gstaedtner (thomas (a) gstaedtner (.) net)", + "Johannes 'josch' Schauer ", + )) +__version__ = "prototype" +__copyright__ = "Copyright (c) 2008-2010" +__license__ = "GPLv3" + +from dbus import SystemBus +from os.path import exists, isfile +from os import mkdir, unlink, listdir +from datetime import datetime + +from e_dbus import DBusEcoreMainLoop +import ecore +import ecore.evas +import evas +import edje + +from pyneo.dbus_support import * +from pyneo.sys_support import pr_set_name +from pyneo.cfg_support import ConfigParser + +from ConfigParser import SafeConfigParser +from db_support import DatabaseController +from db_init import DatabaseInit +from constants import WIDTH, HEIGHT, FRAMETIME, IMAGE_CACHE_SIZE, FONT_CACHE_SIZE, FULLSCREEN, APP_TITLE, WM_INFO, BASE_PATH, PIX_FILE_PATH, TRACK_FILE_PATH, DB_FILE_PATH, DB_PATH, PIX_WEATHER_FILE_PATH, MUSIC_FILE_PATH, COVER_FILE_PATH, RINGTONE_FILE, SMSTONE_FILE, ALSA_FILES_PATH, IMAGE_FILES_PATH, THEME_IMAGES, INI_PATH, DIALER_SCREEN_NAME, INFO_BAR_WIDGET, INCALL_SCREEN_NAME, GSM_STATUS_SCREEN_NAME, GPS_STATUS_SCREEN_NAME, GPS_MAP_SCREEN_NAME, TIME_SCREEN_NAME, HON_SCREEN_NAME, LOCK_SCREEN_NAME, PIX_SCREEN_NAME, CONTACTS_SCREEN_NAME, SMS_SCREEN_NAME, SMS_DETAIL_SCREEN_NAME, WEATHER_SCREEN_NAME, AUDIO_SCREEN_NAME, AUDIOSORT_SCREEN_NAME, HISTORY_SCREEN_NAME, SETTINGS_SCREEN_NAME, TIMETABLE_SCREEN_NAME, SIMIMPORTER_SCREEN_NAME, WLAN_SCREEN_NAME, FONTCOLOR_SCREEN_NAME, NEWS_SCREEN_NAME + + +class PyneoController(object): + _dbus_timer = None + _gsm_timer = None + _keyring_timer = None + _gps_timer = None + _hon_timer = None + _callbacks = {} + _calls = {} + + gsm = None + pwr = None + sys = None + gps = None + hon = None + music = None + gsm_wireless = None + gsm_keyring = None + gsm_sms = None + gsm_contacts = None + hon_hotornot = None + ama = None + + gsm_wireless_status = None + gsm_keyring_status = None + + call_type = None + + call = None + callsigs = [] + + @classmethod + def register_callback(class_, event_name, callback): + print "In register_callback: ", event_name + if class_._callbacks.get(event_name, None): + class_._callbacks[event_name].append(callback) + else: + class_._callbacks[event_name] = [callback] + + @classmethod + def notify_callbacks(class_, event_name, *args): + for cb in class_._callbacks.get(event_name, ()): + cb(*args) + + @classmethod + def init(class_): + try: + class_.gsm = object_by_url('dbus:///org/pyneo/GsmDevice') + class_.gprs = object_by_url('dbus:///org/pyneo/net/Gprs') + class_.pwr = object_by_url('dbus:///org/pyneo/System') + class_.sys = object_by_url(class_.pwr.GetDevice('system', dbus_interface=DIN_POWERED)) + class_.gps = object_by_url('dbus:///org/pyneo/GpsLocation') + class_.hon = object_by_url('dbus:///org/pyneo/HotOrNot') + class_.music = object_by_url('dbus:///org/pyneo/Music') + class_.ama = object_by_url('dbus:///org/pyneo/Amazon') + class_.map_tiles = { + 'OsmStreet':object_by_url('dbus:///org/pyneo/mapper/OsmStreet'), + 'OsmCycle':object_by_url('dbus:///org/pyneo/mapper/OsmCycle'), + 'OsmTilesathome':object_by_url('dbus:///org/pyneo/mapper/OsmTilesathome'), + 'CloudmadeMidnight':object_by_url('dbus:///org/pyneo/mapper/CloudmadeMidnight'), + 'OPNV':object_by_url('dbus:///org/pyneo/mapper/OPNV'), + 'GoogleMoon':object_by_url('dbus:///org/pyneo/mapper/GoogleMoon'), + } + class_.map = object_by_url('dbus:///org/pyneo/mapper') + class_.timetable = object_by_url('dbus:///org/pyneo/Timetable') + class_.http = object_by_url('dbus:///org/pyneo/NetHttp') + class_.wlan = object_by_url('dbus:///org/pyneo/WlanDevice') + class_.notify = object_by_url('dbus:///org/pyneo/Notify') + class_.ggl = object_by_url('dbus:///org/pyneo/GoogleLocation') + class_.news = object_by_url('dbus:///org/pyneo/News') + class_.entry = object_by_url('dbus:///org/pyneo/Entry') + + except Exception, e: + print "Pyneo error: " + str(e) + if not class_._dbus_timer: + class_._dbus_timer = ecore.timer_add(5, class_.init) + + # We had an error, keep the timer running if we were called by ecore + return True + + # No error (anymore) + if class_._dbus_timer: class_._dbus_timer.stop() + + # some theme settings + class_.set_bg_image = class_.get_ini_value('theme', 'bg_image') + class_.set_font_color = class_.get_ini_value('theme', 'font_color') + class_.brightness_value = int(class_.get_ini_value('theme', 'brightness')) + + class_.call_type = None + class_.call = None + class_.gsm_net_status = {} + class_.callsigs = [] + class_.alsastate = ['stereoout', 'gsmheadset', 'voipheadset', 'gsmspeakerout', 'gsmhandset'] + class_.alsacurrent = None + class_.vibrate_state = ['on', 'off'] + class_.vibrate_current = None + class_.syslog_state = ['on', 'off'] + if ConfigParser('/etc/pyneod.ini').get_section_config('sys').get('log_debug') == 'False': + class_.syslog_current = 'off' + else: + class_.syslog_current = 'on' + + # Register our own D-Bus callbacks (device status, new calls, power status, new sms, new music title) + class_.pwr.connect_to_signal('Status', class_.on_pwr_status, dbus_interface=DIN_POWERED) + class_.music.connect_to_signal('Status', class_.on_music_status, dbus_interface=DIN_MUSIC) + class_.music.connect_to_signal('Position', class_.on_music_position, dbus_interface=DIN_MUSIC) + class_.map.connect_to_signal('NewFile', class_.on_map_new_file, dbus_interface=DIN_MAP) + class_.gps.connect_to_signal('Position', class_.on_gps_position_status, dbus_interface=DIN_LOCATION) + class_.gprs.connect_to_signal('Status', class_.on_gprs_status, dbus_interface=DIN_NETWORK) + class_.news.connect_to_signal('New', class_.on_rss_news, dbus_interface=DIN_STORAGE) + + ecore.timer_add(1, class_.power_up_gsm) + + @classmethod + def on_rss_news(class_, status): + status = dedbusmap(status) + print "News: " + str(status) + for n in status: + news = object_by_url(n) + class_.notify_callbacks("show_news", dedbusmap(news.GetContent(dbus_interface=DIN_ENTRY, timeout=200))) + + @classmethod + def get_pwr_status(class_): + status = class_.pwr.GetStatus(dbus_interface=DIN_POWERED) + class_.on_pwr_status(status) + + @classmethod + def get_gprs_status(class_): + status = class_.gprs.GetStatus(dbus_interface=DIN_NETWORK) + class_.on_gprs_status(status) + + @classmethod + def get_device_status(class_): + class_.notify_callbacks("device_status", class_.gsm.GetStatus(dbus_interface=DIN_POWERED)) + + @classmethod + def power_status_gsm(class_): + class_.notify_callbacks("power_status_gsm", class_.gsm.GetPower(APP_TITLE, dbus_interface=DIN_POWERED)) + + @classmethod + def get_hon(class_, reply_handler): + def error(msg): + print "error getting hon:", msg + class_.hon.GetImage(dict(gender='w'), reply_handler=reply_handler, error_handler=error, dbus_interface=DIN_VOLATILE_IMAGE) + + @classmethod + def vote_hon(class_, vote): + class_.hon.GetImage(vote, dbus_interface=DIN_VOLATILE_IMAGE) + + @classmethod + def show_sms_detail(class_, number, status): + class_.notify_callbacks("show_sms_detail", number, status) + + @classmethod + def power_up_gsm(class_): + try: + if class_.gsm.GetPower(APP_TITLE, dbus_interface=DIN_POWERED): + print '---', 'gsm device is already on' + else: + class_.gsm.SetPower(APP_TITLE, True, dbus_interface=DIN_POWERED) + print '---', 'switching gsm device on' + class_.gsm_wireless = object_by_url(class_.gsm.GetDevice('wireless', dbus_interface=DIN_POWERED)) + class_.gsm_sms = object_by_url(class_.gsm.GetDevice('shortmessage_storage', dbus_interface=DIN_POWERED)) + class_.gsm_contacts = object_by_url(class_.gsm.GetDevice('phonebook_storage', dbus_interface=DIN_POWERED)) + + except Exception, e: + print "GSM error: " + str(e) + if not class_._gsm_timer: + class_._gsm_timer = ecore.timer_add(5, class_.power_up_gsm) + + # We had an error, keep the timer running if we were called by ecore + return True + + # No error (anymore) + if class_._gsm_timer: class_._gsm_timer.stop() + + class_.gsm_wireless.connect_to_signal('Status', class_.on_gsm_wireless_status, dbus_interface=DIN_WIRELESS) + class_.gsm_wireless.connect_to_signal('New', class_.check_new_call, dbus_interface=DIN_WIRELESS) + class_.gsm_sms.connect_to_signal('New', class_.check_new_sms, dbus_interface=DIN_STORAGE) + + class_.get_gsm_keyring() + + @classmethod + def power_down_gsm(class_): + class_.gsm.SetPower(APP_TITLE, False, dbus_interface=DIN_POWERED) + class_.power_status_gsm() + + @classmethod + def get_gsm_keyring(class_): + try: + class_.gsm_keyring = object_by_url(class_.gsm_wireless.GetKeyring(dbus_interface=DIN_AUTHORIZED)) + + except Exception, e: + print "SIM error: " + str(e) + if not class_._keyring_timer: + class_._keyring_timer = ecore.timer_add(5, class_.get_gsm_keyring) + + # We had an error, keep the timer running if we were called by ecore + return True + + # No error (anymore) + if class_._keyring_timer: class_._keyring_timer.stop() + + class_.gsm_keyring.connect_to_signal("Opened", class_.on_gsm_keyring_status, dbus_interface=DIN_KEYRING) + + # Inquire SIM status and act accordingly to the initial state + status = class_.gsm_keyring.GetOpened(dbus_interface=DIN_KEYRING) + class_.on_gsm_keyring_status(status) + + @classmethod + def gsm_sim_locked(class_): + return class_.gsm_keyring_status['code'] != 'READY' + + @classmethod + def gsm_unlock_sim(class_, key): + class_.gsm_keyring.Open(key, dbus_interface=DIN_KEYRING) + + @classmethod + def gsm_dial(class_, number): + class_.call_type = 'outgoing' + if class_.alsacurrent == 'stereoout': + class_.set_state_file('gsmhandset') + elif class_.alsacurrent == 'voipheadset': + class_.set_state_file('gsmheadset') + try: + name = class_.gsm_wireless.Initiate(number, dbus_interface=DIN_VOICE_CALL_INITIATOR, timeout=200) + class_.call = object_by_url(name) + except Exception, e: + print "Dial error: " + str(e) + class_.set_state_file(class_.alsacurrent) + class_.notify_callbacks("gsm_phone_call_end") + + @classmethod + def gsm_hangup(class_): + class_.set_state_file(class_.alsacurrent) + class_.dialer_text_set("") + class_.call = object_by_url('dbus:///org/pyneo/gsmdevice/Call/1') + class_.call.Hangup(dbus_interface=DIN_VOICE_CALL) + + @classmethod + def gsm_accept(class_, number): + class_.call_type = 'incoming' + class_.sys.Vibrate(0, 0, 0, dbus_interface=DIN_SYSTEM) + if class_.alsacurrent == 'stereoout': + class_.set_state_file('gsmhandset') + elif class_.alsacurrent == 'voipheadset': + class_.set_state_file('gsmheadset') + class_.call.Accept(dbus_interface=DIN_VOICE_CALL) + + @classmethod + def gsm_details(class_): + class_.notify_callbacks("gsm_details", class_.gsm_wireless.GetStatus(dbus_interface=DIN_WIRELESS)) + + @classmethod + def on_gsm_wireless_status(class_, status_map): + status = dedbusmap(status_map) + print 'GSM NET Status: %s'%status + + if 'stat' in status: + nw_status = status['stat'] + + if nw_status == 0: + class_.notify_callbacks("gsm_unregistered") + elif nw_status in (1, 5): + class_.notify_callbacks("gsm_registered") + elif nw_status == 2: + class_.notify_callbacks("gsm_registering") + elif nw_status == 3: + class_.notify_callbacks("gsm_reg_denied") + elif nw_status == 4: + raise NotImplementedError("GSM registration has unknown state") + + for text in ['rssi', 'oper', 'lac', 'ci', 'mcc']: + if text in status: + class_.gsm_net_status[text] = status[text] + if text == 'rssi': + class_.notify_callbacks("gsm_signal_strength_change", status['rssi']) + if text == 'oper': + class_.notify_callbacks("gsm_operator_change", status['oper']) + if text == 'mcc': + results = DatabaseController.get_country_code(str(status['mcc'])) + class_.gsm_net_status['cc'] = results[0][1] + class_.gsm_net_status['country'] = results[0][0] + class_.notify_callbacks("gsm_details", class_.gsm_net_status) + + @classmethod + def on_gsm_keyring_status(class_, status_map): + status = dedbusmap(status_map) + class_.gsm_keyring_status = status + print "SIM Status: " + str(status) + + if status["code"] == "READY": + class_.notify_callbacks("sim_ready") + + # Try registering on the network + res = dedbusmap(class_.gsm_wireless.GetStatus(dbus_interface=DIN_WIRELESS, )) + if not res['stat'] in (1, 5, ): + print '---', 'registering to gsm network' + class_.gsm_wireless.Register(dbus_interface=DIN_WIRELESS, timeout=200) + res = dedbusmap(class_.gsm_wireless.GetStatus(dbus_interface=DIN_WIRELESS, )) + else: + print '---', 'already registered' + else: + class_.notify_callbacks("sim_key_required", status["code"]) + + @classmethod + def activate_gprs(class_): + status = class_.gprs.Activate(True, dbus_interface=DIN_NETWORK) + class_.on_gprs_status(status) + + @classmethod + def deactivate_gprs(class_): + status = class_.gprs.Activate(False, dbus_interface=DIN_NETWORK) + class_.on_gprs_status(status) + + @classmethod + def power_status_gps(class_): + class_.notify_callbacks("power_status_gps", class_.gps.GetPower(APP_TITLE, dbus_interface=DIN_POWERED)) + + @classmethod + def power_up_gps(class_): + print 'power_up_gps' + try: + if class_.gps.GetPower(APP_TITLE, dbus_interface=DIN_POWERED): + print '---', 'gps device is already on' + else: + class_.gps.SetPower(APP_TITLE, True, dbus_interface=DIN_POWERED) + print '---', 'switching gps device on' + + except Exception, e: + print "GPS error: " + str(e) + if not class_._gps_timer: + class_._gps_timer = ecore.timer_add(5, class_.power_up_gps) + + # We had an error, keep the timer running if we were called by ecore + return True + + # No error (anymore) + if class_._gps_timer: class_._gps_timer.stop() + + class_.notify_callbacks("power_status_gps", class_.gps.GetPower(APP_TITLE, dbus_interface=DIN_POWERED)) + + status = class_.gps.GetPosition(dbus_interface=DIN_LOCATION) + class_.on_gps_position_status(status) + + @classmethod + def power_down_gps(class_): + class_.gps.SetPower(APP_TITLE, False, dbus_interface=DIN_POWERED) + class_.notify_callbacks("power_status_gps", class_.gps.GetPower(APP_TITLE, dbus_interface=DIN_POWERED)) + + @classmethod + def on_gps_position_status(class_, status): + status = dedbusmap(status) + print "GPS Status: " + str(status) + class_.notify_callbacks("gps_position_change", status) + + @classmethod + def on_gprs_status(class_, status): + status = dedbusmap(status) + print "GPRS Status: " + str(status) + class_.notify_callbacks("gprs_status", status) + + @classmethod + def on_map_new_file(class_, newmap): + newmap = dedbusmap(newmap) + class_.notify_callbacks("on_map_new_file", newmap) + + @classmethod + def map_request_tiles(class_, latitude, longitude, zoom, map_type): + class_.map_tiles.get(map_type, "OsmStreet").RequestMap(dict(latitude=latitude,longitude=longitude,zoom=zoom,delta_x=480,delta_y=640), dbus_interface=DIN_MAP) + + @classmethod + def on_pwr_status(class_, status_map): + status = dedbusmap(status_map) + print "POWER Status: " + str(status) + class_.notify_callbacks("capacity_change", status) + class_.notify_callbacks("pwr_status_change", status) + + @classmethod + def show_dialer_screen(class_): + class_.pwr.GetStatus(dbus_interface=DIN_POWERED) + class_.notify_callbacks("show_dialer_screen") + + @classmethod + def show_gsm_status_screen(class_): + class_.notify_callbacks("show_gsm_status_screen") + + @classmethod + def show_gps_status_screen(class_): + class_.notify_callbacks("show_gps_status_screen") + + @classmethod + def show_gps_map_screen(class_): + class_.notify_callbacks("show_gps_map_screen") + + @classmethod + def show_incall_screen(class_, calling_type): + class_.call_type = calling_type + print "CALLING_TYPE: ", class_.call_type + class_.notify_callbacks("gsm_phone_call_start") + + @classmethod + def show_lock_screen(class_): + class_.notify_callbacks("show_lock_screen") + + @classmethod + def brightness_change(class_, status): + class_.brightness_value += status + if class_.brightness_value > 100: class_.brightness_value = 100 + if class_.brightness_value < 0: class_.brightness_value = 0 + class_.sys.SetBrightness(class_.brightness_value, dbus_interface=DIN_SYSTEM) + class_.notify_callbacks("brightness_change", class_.brightness_value) + + @classmethod + def scan_operator(class_, reply_handler, error_handler): + class_.gsm_wireless.Scan(timeout=100.0, reply_handler=reply_handler, error_handler=error_handler, dbus_interface=DIN_WIRELESS, ) + + @classmethod + def scan_wireless(class_): + class_.notify_callbacks("scan_wireless", dedbusmap(class_.wlan.Scan(timeout=100.0, dbus_interface=DIN_WIRELESS, ))) + + @classmethod + def check_new_call(class_, newmap): + def CallStatus(newmap): + newmap = dedbusmap(newmap) + class_.notify_callbacks("gsm_phone_ringing") + if newmap['number']: + class_.notify_callbacks("gsm_number_display", newmap['number']) + else: + class_.notify_callbacks("gsm_number_display", 'restricted') + print '---', 'CallStatus' + + def CallRing(newmap): + newmap = dedbusmap(newmap) + class_.notify_callbacks("gsm_phone_ringing") + if newmap['number']: + class_.notify_callbacks("gsm_number_display", newmap['number']) + else: + class_.notify_callbacks("gsm_number_display", 'restricted') + print '---', 'CallRing', newmap + + def CallEnd(newmap): + class_.notify.StopTone('ring') + class_.sys.Vibrate(0, 0, 0, dbus_interface=DIN_SYSTEM) + class_.notify_callbacks("gsm_phone_call_end") + class_.set_state_file('stereoout') + newmap = dedbusmap(newmap) + print '---', 'CallEnd' + if class_.call: + class_.call = None + while class_.callsigs: + class_.callsigs.pop().remove() + + DatabaseController.insert_history(class_.call_type, newmap['number']) + if class_.call_type == 'missed': + PyneoController.set_missed_call_icon('true') + cp = ConfigParser(INI_PATH) + cp.get_section_config('status').set('missed_calls', 'true') + cp.save() + class_.dialer_text_set("") + class_.call_type = None + class_.gsm_wireless.GetStatus(dbus_interface=DIN_WIRELESS) + + newmap = dedbusmap(newmap) + print '---', 'CallNew: ', class_.call_type + if not class_.call_type: + class_.notify.PlayTone('ring') + if PyneoController.vibrate_current == 'on': + class_.sys.Vibrate(800, 200, 0, dbus_interface=DIN_SYSTEM) + if class_.call_type == 'outgoing' or class_.call_type == 'incoming': + pass + else: + class_.call_type = 'missed' + for n, v in newmap.items(): + class_.call = object_by_url(n) + class_.callsigs.append(class_.call.connect_to_signal('Ring', CallRing, dbus_interface=DIN_VOICE_CALL, )) + class_.callsigs.append(class_.call.connect_to_signal('Status', CallStatus, dbus_interface=DIN_VOICE_CALL, )) + class_.callsigs.append(class_.call.connect_to_signal('End', CallEnd, dbus_interface=DIN_VOICE_CALL, )) + + @classmethod + def set_missed_call_icon(class_, status): + print "Set Missed Call Icon: ", status + class_.notify_callbacks("set_missed_call_icon", status) + + @classmethod + def on_music_status(class_, newmap): + newmap = dedbusmap(newmap) + print 'Music Status: %s' %newmap + class_.notify_callbacks("on_get_music_tags", newmap) + + @classmethod + def on_music_position(class_, position, duration): + print 'Music Position: %d:%d'%(position, duration) + class_.notify_callbacks("on_get_music_position", position, duration) + + @classmethod + def check_new_sms(class_, newmap): + class_.notify.PlayTone('sms') + res = dedbusmap(newmap) + for n in res: + sm = object_by_url(n) + content = dedbusmap(sm.GetContent(dbus_interface=DIN_ENTRY, timeout=200)) + DatabaseController.insert_new_sms('REC UNREAD', content['from_msisdn'], content['text'].encode('utf-8'), content['time']) + print '--- NEW SMS:', content['from_msisdn'], content['time'], content['text'].encode('utf-8') +# class_.gsm_sms.DeleteAll(dbus_interface=DIN_STORAGE, timeout=200) + + @classmethod + def first_check_new_sms(class_): + try: + res = class_.gsm_sms.ListAll(dbus_interface=DIN_STORAGE) + for n in res: + sm = object_by_url(n) + content = dedbusmap(sm.GetContent(dbus_interface=DIN_ENTRY)) + DatabaseController.insert_new_sms('REC UNREAD', content['from_msisdn'], content['text'].encode('utf-8'), content['time']) + except: + print '--- NULL new sms' +# class_.gsm_sms.DeleteAll(dbus_interface=DIN_STORAGE) + + @ classmethod + def get_phbook_raw(class_, reply_handler, error_handler): + ''' Get the raw output of the phonebook_storage ''' + print '-----', 'get the raw phonebook storage output' + class_.gsm_contacts.ListAll(reply_handler=reply_handler, error_handler=error_handler, dbus_interface=DIN_STORAGE) # list all contacts and phonebooks + + @classmethod + def get_phbook(class_, phbook_raw): + """ Get the simcontacts as dict{name:number} """ + + print '-----', 'get phonebookstorage, sim contacts' + contactssim = {} # create a empty dictionary + for n in phbook_raw: + pbe = object_by_url(n) + content = dedbusmap(pbe.GetContent()) + if content['phonebook'] == "SM": # SM is the phonebook with the sim contacts + contactssim[content['text'].encode('utf-8')] = content['number'] # name and number from => contactssim dict + return contactssim + + @classmethod + def show_screen(class_, screen): + print '--- show ', screen + class_.notify_callbacks("show_screen", screen) + + @classmethod + def vibrate_start(class_): + class_.sys.Vibrate(10, 3, 1, dbus_interface=DIN_SYSTEM) + + @classmethod + def vibrate_stop(class_): + class_.sys.Vibrate(0, 0, 0, dbus_interface=DIN_SYSTEM) + + @classmethod + def show_audio_screen(class_): + class_.notify_callbacks("show_audio_screen") + + @classmethod + def play_music(class_): + class_.music.Play(dbus_interface=DIN_MUSIC) + + @classmethod + def stop_music(class_): + class_.music.Stop(dbus_interface=DIN_MUSIC) + + @classmethod + def pause_music(class_): + class_.music.Pause(dbus_interface=DIN_MUSIC) + + @classmethod + def next_music(class_): + class_.music.Next(dbus_interface=DIN_MUSIC) + @classmethod + def previous_music(class_): + class_.music.Previous(dbus_interface=DIN_MUSIC) + + @classmethod + def set_playlist_from_dir(class_, path): + class_.music.SetPlaylistFromDir(path, 'true', dbus_interface=DIN_MUSIC) + + @classmethod + def get_music_tags(class_): + class_.notify_callbacks("on_get_music_tags", class_.music.GetStatus(dbus_interface=DIN_MUSIC)) + + @classmethod + def set_volume(class_, status): + class_.music.SetVolume(status, dbus_interface=DIN_MUSIC) + + @classmethod + def set_tone(class_, themename, tone, sound_file): + class_.notify.SetTone(themename, tone, sound_file, dbus_interface=DIN_NOTIFY) + + @classmethod + def set_tone_volume(class_, themename, tone, status): + class_.notify.SetToneVolume(themename, tone, status, dbus_interface=DIN_NOTIFY) + + @classmethod + def play_tone(class_, tone): + class_.notify.PlayTone(tone, dbus_interface=DIN_NOTIFY) + + @classmethod + def stop_tone(class_, tone): + class_.notify.StopTone(tone, dbus_interface=DIN_NOTIFY) + + @classmethod + def create_theme(class_, themename): + class_.notify.CreateTheme(themename, dbus_interface=DIN_NOTIFY) + + @classmethod + def delete_theme(class_, themename): + class_.notify.DeleteTheme(themename, dbus_interface=DIN_NOTIFY) + + @classmethod + def set_current_theme(class_, themename): + class_.notify.SetCurrentTheme(themename, dbus_interface=DIN_NOTIFY) + + @classmethod + def set_tone_times(class_, themename, tone, times): + class_.notify.SetToneTimes(themename, tone, times, dbus_interface=DIN_NOTIFY) + + @classmethod + def get_song_duration(class_): + class_.notify_callbacks('on_get_song_duration', class_.music.GetSongDuration(dbus_interface=DIN_MUSIC)) + + @classmethod + def get_song_position(class_): + class_.notify_callbacks('on_get_song_position', class_.music.GetSongPosition(dbus_interface=DIN_MUSIC)) + + @classmethod + def set_state_file(class_, status): + assert status in class_.alsastate + print '--- Set ALSA state to', status + class_.sys.SetAudioState(status, dbus_interface=DIN_SYSTEM) + class_.alsacurrent = status + + @classmethod + def sort_playlist(class_, order, key): + class_.music.SortPlaylist(order, key, dbus_interface=DIN_MUSIC) + print '--- Sort Playlist', order, key + + @classmethod + def get_playlist(class_): + class_.notify_callbacks('on_get_playlist', class_.music.GetPlaylist(dbus_interface=DIN_MUSIC)) + + @classmethod + def get_amazon_cover(class_, searchwords, file_name, reply_handler, error_handler): + class_.ama.SearchCover(searchwords, file_name, reply_handler=reply_handler, error_handler=error_handler, dbus_interface='org.pyneo.AlbumCoverLookup') + + @classmethod + def get_track(class_, start, destination, reply_handler, error_handler): + class_.timetable.GetTracks(dict(start=start, destination=destination), reply_handler=reply_handler, error_handler=error_handler, dbus_interface='org.pyneo.Timetable') + + @classmethod + def db_check(class_): + if not isfile(DB_FILE_PATH): + DatabaseInit.init() + print '--- Add sqlite db' + + @classmethod + def path_check(class_, path): + if not exists(path): + mkdir(path) + print '--- Add missing directory' + + @classmethod + def dialer_text_set(class_, text): + class_.notify_callbacks('dialer_text_set', text) + + @classmethod + def urlread(class_, url, reply_handler): + filename = "/tmp/"+url + def readurl(newmap): + content = open(filename).read() + unlink(filename) + reply_handler(content) + def error(msg): + print "error getting url %s: %s" % (url, msg) + class_.http.Request({ + 'url':url, + 'cachefilename':filename, + }, reply_handler=readurl, error_handler=error, dbus_interface=DIN_NETPROTOCOLS) + + @classmethod + def set_track_record(class_, track_file): + class_.gps.SetRecord(track_file, dbus_interface=DIN_LOCATION) + + @classmethod + def set_debug_log(class_, status): + if status == 'off': + class_.sys.SetDebugLog(False, dbus_interface=DIN_SYSTEM) + else: + class_.sys.SetDebugLog(True, dbus_interface=DIN_SYSTEM) + class_.notify_callbacks('set_syslog_txt', status) + + @classmethod + def reload_font_color(class_): + class_.set_font_color = class_.get_ini_value('theme', 'font_color') + + @classmethod + def get_geocoding(class_, lat, lon): + class_.notify_callbacks('on_get_geocoding', class_.ggl.GeoCoding(lat, lon, dbus_interface=DIN_LOCATION)) + + @classmethod + def powered_news(class_, status): + class_.news.SetPower(APP_TITLE, status, dbus_interface=DIN_POWERED) + print '--- SetPower News Daemon', status + + @classmethod + def set_missed_medium_icon(class_, status, medium): + class_.notify_callbacks("set_missed_medium_icon", status, medium) + print '--- SetMissedMediumIcon', status, medium + + @classmethod + def get_ini_value(class_, section, control): + cp = ConfigParser(INI_PATH) + return cp.get_section_config(section).get(control) + + @classmethod + def set_ini_value(class_, section, control, value): + cp = ConfigParser(INI_PATH) + cp.get_section_config(section).set(control, value) + cp.save() + +from dialer_screen import * +from incall_screen import * +from gsm_status_screen import * +from gps_status_screen import * +from gps_map_screen import * +#from time_screen import * +from hon_screen import * +from lock_screen import * +from pix_screen import * +from contacts_screen import * +from sms_screen import * +from sms_detail import * +from weather_screen import * +from audio_screen import * +from history_screen import * +from settings_screen import * +from timetable_screen import * +from simimporter_screen import * +from wlan_screen import * +from fontcolor_screen import * +from audiosort_screen import * +from news_screen import * + +class Dialer(object): + screens = None + evas_canvas = None + system_bus = None + + def __init__(self): + # Initialize the GUI +# edje.frametime_set(FRAMETIME) + self.evas_canvas = EvasCanvas(FULLSCREEN) + + self.screens = {} + + # Register our own callbacks + PyneoController.register_callback("gsm_phone_ringing", self.on_ringing) + PyneoController.register_callback("gsm_phone_call_start", self.on_call_start) + PyneoController.register_callback("gsm_phone_call_end", self.on_call_end) + PyneoController.register_callback("show_gps_status_screen", self.on_gps_status_screen) + PyneoController.register_callback("show_gps_map_screen", self.on_gps_map_screen) + PyneoController.register_callback("show_dialer_screen", self.on_call_end) + PyneoController.register_callback("show_lock_screen", self.on_lock_screen) + PyneoController.register_callback("show_audio_screen", self.on_audio_screen) + PyneoController.register_callback("show_screen", self.on_show_screen) + + # Initialize the D-Bus interface to pyneo + dbus_ml = DBusEcoreMainLoop() + self.system_bus = SystemBus(mainloop=dbus_ml) + PyneoController.init() + PyneoController.path_check(DB_PATH) + PyneoController.db_check() + DatabaseController.init() + + self.init_screen(DIALER_SCREEN_NAME, DialerScreen) + PyneoController.show_dialer_screen() + PyneoController.brightness_change(0) + + ecore.timer_add(1, self.load_screens) + + def load_screens(self): + self.init_screen(INCALL_SCREEN_NAME, InCallScreen) + self.init_screen(GPS_STATUS_SCREEN_NAME, GpsStatusScreen) + self.init_screen(GPS_MAP_SCREEN_NAME, GpsMapScreen) + self.init_screen(AUDIO_SCREEN_NAME, AudioScreen) + + PyneoController.power_status_gps() + + try: + PyneoController.create_theme('blackwhite') + PyneoController.set_tone('blackwhite', 'ring', PyneoController.get_ini_value('theme', 'ringtone_file')) + PyneoController.set_tone('blackwhite', 'sms', PyneoController.get_ini_value('theme', 'smstone_file')) + PyneoController.set_tone_volume('blackwhite', 'ring', 0.3) + PyneoController.set_tone_volume('blackwhite', 'sms', 0.9) + PyneoController.set_tone_times('blackwhite', 'sms', 3) + PyneoController.set_current_theme('blackwhite') + PyneoController.set_state_file(PyneoController.get_ini_value('alsa', 'alsastate')) + PyneoController.vibrate_current = PyneoController.get_ini_value('theme', 'vibrate') + PyneoController.set_missed_medium_icon(PyneoController.get_ini_value('status', 'missed_calls'), 'calls') + PyneoController.set_missed_medium_icon(PyneoController.get_ini_value('status', 'missed_sms'), 'sms') + except Exception, error: + print "ERROR: unable to load theme things: %s" % error + + self.init_screen(LOCK_SCREEN_NAME, LockScreen) + PyneoController.power_status_gsm() + + def init_screen(self, screen_name, constructor): + if screen_name in self.screens.keys(): + return + + try: + instance = constructor(self) + self.screens[screen_name] = instance + self.evas_canvas.evas_obj.data[screen_name] = instance + + # register the screen default callbacks + instance.register_pyneo_callbacks() + except Exception, error: + print "ERROR: screen %s failed to load, reason: %s" % (screen_name, error) + + def show_screen(self, screen_name): + if screen_name not in self.screens.keys(): + print "screen %s not available"%screen_name + else: + for (name, screen) in self.screens.items(): + if name == screen_name: + screen.show() + else: + screen.hide() + + def get_evas(self): + return self.evas_canvas.evas_obj.evas + + def on_ringing(self): + self.show_screen(INCALL_SCREEN_NAME) + + def on_call_start(self): + self.show_screen(INCALL_SCREEN_NAME) + + def on_call_end(self): + self.show_screen(DIALER_SCREEN_NAME) + + def on_gps_status_screen(self): + self.show_screen(GPS_STATUS_SCREEN_NAME) + + def on_gps_map_screen(self): + self.show_screen(GPS_MAP_SCREEN_NAME) + + def on_lock_screen(self): + self.show_screen(LOCK_SCREEN_NAME) + + def on_sms_screen_detail(self): + self.show_screen(SMS_DETAIL_SCREEN_NAME) + + def on_audio_screen(self): + self.show_screen(AUDIO_SCREEN_NAME) + + def on_show_screen(self, screen): + if screen == WEATHER_SCREEN_NAME: + self.init_screen(screen, WeatherScreen) + elif screen == WLAN_SCREEN_NAME: + self.init_screen(screen, WlanScreen) + elif screen == TIMETABLE_SCREEN_NAME: + self.init_screen(screen, TimetableScreen) + elif screen == SIMIMPORTER_SCREEN_NAME: + self.init_screen(screen, SimImporter) + elif screen == SETTINGS_SCREEN_NAME: + self.init_screen(screen, SettingsScreen) + elif screen == HON_SCREEN_NAME: + self.init_screen(screen, HonScreen) + elif screen == PIX_SCREEN_NAME: + self.init_screen(screen, PixScreen) + elif screen == TIME_SCREEN_NAME: + self.init_screen(screen, TimeScreen) + elif screen == SMS_SCREEN_NAME: + self.init_screen(screen, SmsScreen) + elif screen == FONTCOLOR_SCREEN_NAME: + self.init_screen(screen, FontcolorScreen) + elif screen == AUDIOSORT_SCREEN_NAME: + self.init_screen(screen, AudiosortScreen) + elif screen == NEWS_SCREEN_NAME: + self.init_screen(screen, NewsScreen) + elif screen == GSM_STATUS_SCREEN_NAME: + self.init_screen(screen, GsmStatusScreen) + elif screen == HISTORY_SCREEN_NAME: + self.init_screen(screen, HistoryScreen) + elif screen == CONTACTS_SCREEN_NAME: + self.init_screen(screen, ContactsScreen) + elif screen == SMS_DETAIL_SCREEN_NAME: + self.init_screen(screen, SmsDetail) + self.show_screen(screen) + +class EvasCanvas(object): + def __init__(self, fullscreen, engine_name="x11"): + if engine_name == "x11": + engine = ecore.evas.SoftwareX11 + elif engine_name == "x11": + print "warning: x11-16 is not supported, falling back to x11" + engine = ecore.evas.SoftwareX11 + else: + raise Exception("unknwon engine %s"% engine_name) + + self.evas_obj = engine(w=WIDTH, h=HEIGHT) + if not self.evas_obj.evas: + raise Exception("e did not init") + self.evas_obj.callback_delete_request = self.on_delete_request + self.evas_obj.callback_resize = self.on_resize + + self.evas_obj.title = APP_TITLE + self.evas_obj.name_class = WM_INFO + self.evas_obj.fullscreen = fullscreen +# self.evas_obj.size = str(WIDTH) + 'x' + str(HEIGHT) + self.evas_obj.evas.image_cache_set(IMAGE_CACHE_SIZE*1024*1024) + self.evas_obj.evas.font_cache_set(FONT_CACHE_SIZE*1024*1024) + self.evas_obj.show() + + def on_resize(self, evas_obj): + x, y, w, h = evas_obj.evas.viewport + size = (w, h) + for key in evas_obj.data.keys(): + evas_obj.data[key].size = size + + def on_delete_request(self, evas_obj): + ecore.main_loop_quit() + + +if __name__ == "__main__": + Dialer() + ecore.main_loop_begin() + +''' +export LDFLAGS="$LDFLAGS -L/opt/e17/lib" +export PKG_CONFIG_PATH="/opt/e17/lib/pkgconfig:$PKG_CONFIG_PATH" +export PATH="$PATH:/opt/e17/bin" +export PYTHONPATH="/home/fgau/usr/lib/python2.5/site-packages" +''' + diff --git a/fontcolor_screen.py b/fontcolor_screen.py new file mode 100644 index 0000000..7b070d5 --- /dev/null +++ b/fontcolor_screen.py @@ -0,0 +1,144 @@ +#!/usr/bin/env python2.5 +# -*- coding: utf-8 -*- +__author__ = "M. Dietrich , F. Gau (fgau@pyneo.org), Thomas Gstaedtner (thomas (a) gstaedtner (.) net), Johannes 'josch' Schauer " +__version__ = "prototype" +__copyright__ = "Copyright (c) 2009" +__license__ = "GPL3" + +from epydial import * + +class FontcolorScreen(): + def register_pyneo_callbacks(self): + pass + + def __init__(self, screen_manager): + FONT_COLOR = PyneoController.set_font_color + self.red = int(FONT_COLOR[3:5], 16) + self.green = int(FONT_COLOR[5:7], 16) + self.blue = int(FONT_COLOR[7:], 16) + self.alpha = int(FONT_COLOR[1:3], 16) + self.buttons = {} + self.settings = {} + self.canvas = screen_manager.get_evas() + + self.bg = evas.Image(self.canvas, pos=(0, 0), size=(WIDTH, HEIGHT), file=PyneoController.set_bg_image) + self.bg.fill = 0, 0, WIDTH, HEIGHT + self.bg.layer = 97 + + self.headline = evas.Text(self.canvas, text="colors", font=("Sans:style=Bold,Edje-Vera", 60), color=FONT_COLOR) + self.headline.layer = 99 + self.headline.pos = ((480-self.headline.horiz_advance)/2, 25) + + for pos, text in enumerate(["back", "forward", "yes"]): + self.buttons[text] = self.init_button(text, (pos+1)*16+pos*100, 524, 100, 100) + + for pos, text in enumerate(["red", "green", "blue", "alpha"]): + for i, row in enumerate(["left", "right", "description", "box", "plus", "minus"]): + self.settings[text, row] = self.init_settings(row, text, (pos+1)*25+pos*75+100) + + self.set_bar_description('red', self.red) + self.set_bar_description('green', self.green) + self.set_bar_description('blue', self.blue) + self.set_bar_description('alpha', self.alpha) + + def set_bar_description(self, color, status): + self.settings[color, 'description'].text = '%s: %s' % (color, status) + x, y = self.settings[color, 'description'].pos_get() + self.settings[color, 'description'].pos = ((WIDTH-self.settings[color, 'description'].horiz_advance)/2, y) + + def init_settings(self, row, name, y): + FONT_COLOR = PyneoController.set_font_color + def button_callback(source, event): + if name == 'red' and row == 'right': + if self.red != 255: + self.red += 1 + elif name == 'red' and row == 'left': + if self.red != 0: + self.red -= 1 + elif name == 'green' and row == 'right': + if self.green != 255: + self.green += 1 + elif name == 'green' and row == 'left': + if self.green != 0: + self.green -= 1 + elif name == 'blue' and row == 'right': + if self.blue != 255: + self.blue += 1 + elif name == 'blue' and row == 'left': + if self.blue != 0: + self.blue -= 1 + elif name == 'alpha' and row == 'right': + if self.alpha != 255: + self.alpha += 1 + elif name == 'alpha' and row == 'left': + if self.alpha != 0: + self.alpha -= 1 + self.set_bar_description('red', self.red) + self.set_bar_description('green', self.green) + self.set_bar_description('blue', self.blue) + self.set_bar_description('alpha', self.alpha) + self.headline.color_set(self.red, self.green, self.blue, self.alpha) + print '--- ', name, row + if row == 'left': + bg_left = evas.Rectangle(self.canvas, pos=(0,y), size=(WIDTH/2,80), color="#00ffffff") + bg_left.layer = 99 + bg_left.on_mouse_up_add(button_callback) + return bg_left + if row == 'right': + bg_right = evas.Rectangle(self.canvas, pos=(WIDTH/2,y), size=(WIDTH/2,80), color="#00ffffff") + bg_right.layer = 99 + bg_right.on_mouse_up_add(button_callback) + return bg_right + if row == 'description': + description = evas.Text(self.canvas, font=("Sans:style=Edje-Vera", 18), color=FONT_COLOR) + description.text = '%s:' % name + description.pos = ((WIDTH-description.horiz_advance)/2, y+26) + description.layer = 99 + return description + if row == 'box': + box = evas.Rectangle(self.canvas, pos=(WIDTH/4,y+20), size=(WIDTH/2,40), color='#%02x%02x%02x%02x' % (self.alpha/2, self.red, self.green, self.blue)) + box.layer = 98 + return box + if row == 'plus': + plus = evas.Text(self.canvas, text="+", pos=(420,y), font=("Sans:style=Edje-Vera", 46), color=FONT_COLOR) + plus.layer = 98 + return plus + if row == 'minus': + minus = evas.Text(self.canvas, text="-", pos=(40, y), font=("Sans:style='Edje-Vera", 46), color=FONT_COLOR) + minus.layer = 98 + return minus + + def init_button(self, name, x, y, dx, dy): + def button_callback(source, event): + if name == 'back': + PyneoController.show_screen(SETTINGS_SCREEN_NAME) + elif name == 'forward': + PyneoController.show_screen(SIMIMPORTER_SCREEN_NAME) + elif name == "yes": + PyneoController.set_ini_value('theme', 'font_color', '#%02x%02x%02x%02x' % (self.alpha, self.red, self.green, self.blue)) + PyneoController.reload_font_color() +# PyneoController.show_screen(FONTCOLOR_SCREEN_NAME) + print '--- ', name + button = evas.Image(self.canvas, pos=(x,y), size=(dx,dy), file="%s%s.png" % (THEME_IMAGES, name)) + button.fill = 0, 0, dx, dy + button.layer = 99 + button.on_mouse_up_add(button_callback) + return button + + def show(self): + self.bg.show() + self.headline.show() + for text in ["red", "green", "blue", "alpha"]: + for row in ["left", "right", "description", "box", "plus", "minus"]: + self.settings[text, row].show() + for text in ["back", "forward", "yes"]: + self.buttons[text].show() + + def hide(self): + self.bg.hide() + self.headline.hide() + for text in ["red", "green", "blue", "alpha"]: + for row in ["left", "right", "description", "box", "plus", "minus"]: + self.settings[text, row].hide() + for text in ["back", "forward", "yes"]: + self.buttons[text].hide() diff --git a/gps_map_screen.py b/gps_map_screen.py new file mode 100644 index 0000000..cb9c064 --- /dev/null +++ b/gps_map_screen.py @@ -0,0 +1,346 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +__author__ = "Johannes 'josch' Schauer , M. Dietrich , F. Gau " +__version__ = "prototype" +__copyright__ = "Copyright (c) 2008 J. Schauer, 2008 M. Dietrich" +__license__ = "GPLv3" + +from pyneo.codings import decode_json +import re +import evas +from edje import decorators +import math +from epydial import * + +class GpsMapScreen(): + + def register_pyneo_callbacks(self): + PyneoController.register_callback("gps_position_change", self.on_gps_position_change) + PyneoController.register_callback("on_map_new_file", self.on_map_new_file) + PyneoController.register_callback("on_get_geocoding", self.on_get_geocoding) + + class Tile(evas.Image): + def __init__(self, canvas): + evas.Image.__init__(self, canvas) + self.pass_events = True + #we need this to store the original position while the zoom animations + self.position = (0, 0) + self.size = 256, 256 + self.fill = 0, 0, 256, 256 + + def set_position(self, x, y): + self.position = (x, y) + self.move(x, y) + + def __init__(self, screen_manager, latitude=0.0, longitude=0.0, zoom=0.0, map_type="OsmStreet"): + self.canvas = screen_manager.get_evas() + +# self.pass_events = True +# self.position = (0, 0) + self.size = 480, 640 +# self.fill = 0, 0, 256, 256 + +# def set_position(self, x, y): +# self.position = (x, y) +# self.move(x, y) + + self.buttons = {} + + self.config = ConfigParser(INI_PATH).get_section_config('map') + self.map_type = self.config.get("map_type") or map_type + + self.pymapd_cache = ConfigParser('/etc/pyneod.ini').get_section_config('map').get('cache_directory') + self.cache_directory = '/'.join([self.pymapd_cache, self.map_type, "%d/%d/%d"]) + + #mouse position + self.x_pos, self.y_pos = (0, 0) + + #global variable for zooming + self.zoom_step = 0.0 + + #initial latitude, longitude, zoom + self.latitude = latitude or float(self.config.get('latitude')) + self.longitude = longitude or float(self.config.get('longitude')) + self.altitude = 0.0 + self.kph = 0.0 + self.course = 0.0 + self.x = 0 + self.y = 0 + self.zoom = zoom or int(self.config.get('zoom')) + self.offset_x = 0 + self.offset_y = 0 + + self.overlay = evas.Text(self.canvas, font=("Sans:style=Bold, Edje-Vera", 24), color="#808080") + self.overlay_text = "lat:%0.4f lon:%0.4f a:%0.f v:%0.f" + self.overlay.layer = 2 + self.overlay.on_mouse_up_add(self.on_edje_signal_dialer_status_triggered) + + self.geo_text = evas.Text(self.canvas, font=("Sans:style=Bold, Edje-Vera", 18), color="#808080") + self.geo_text.layer = 2 + self.geo_text.pos = (0, 30) + + self.pinpoint = evas.Rectangle(self.canvas, pos=(238, 318), size=(4, 4), color="#ff0000") + self.pinpoint.layer = 2 + + self.arrow = evas.Image(self.canvas) + self.arrow.geometry = 190, 270, 100, 100 + self.arrow.fill = 0, 0, 100, 100 + self.arrow.layer = 2 + self.arrow.pass_events = True + + for pos, text in enumerate(["back", "player-minus", "player-plus", "info"]): + self.buttons[text] = self.init_button(text, (pos+1)*16+pos*100, 524, 100, 100) + + #calculate size of tile raster + self.border_x = int(math.ceil(self.size[0]/256.0)) + self.border_y = int(math.ceil(self.size[1]/256.0)) + + self.mouse_down = False + + self.animate = False + self.fix = False + + self.icons = [] + self.init_icons() + self.set_current_tile(self.latitude, self.longitude, self.zoom) + + def init_button(self, name, x, y, dx, dy): + def button_callback(source, event): + if name == 'back': + PyneoController.show_gps_status_screen() + elif name == "player-minus" and not self.animate: + ecore.timer_add(0.05, self.animate_zoom_out) + elif name == "player-plus" and not self.animate: + ecore.timer_add(0.05, self.animate_zoom_in) + elif name == "info": + PyneoController.get_geocoding(self.latitude, self.longitude) + print '---', name + button = evas.Image(self.canvas, pos=(x,y), size=(dx,dy), file="%s%s.png" % (THEME_IMAGES, name)) + button.fill = 0, 0, dx, dy + button.layer = 2 + button.on_mouse_up_add(button_callback) + return button + + def on_gps_position_change(self, status): + if status: + self.fix = True + self.altitude = float(status.get('altitude', self.altitude)) + self.kph = float(status.get('speed', self.kph)) + if status.get('course', 0): + self.course = float(status.get('course', self.course)) + self.arrow.show() + self.arrow.file_set('/'.join([IMAGE_FILES_PATH, "map", "arrow%02d.png"%(round(self.course/15)%24)])) + else: + self.course = 0.0 + if not self.animate: + self.latitude = float(status.get('latitude', self.latitude)) + self.longitude = float(status.get('longitude', self.longitude)) + self.arrow.file_set('/'.join([IMAGE_FILES_PATH, "map", "arrow%02d.png"%int(self.course/15)])) + self.set_current_tile(self.latitude, self.longitude, self.zoom) + else: + self.fix = False + self.altitude = 0.0 + self.kph = 0.0 + self.course = 0.0 + self.arrow.hide() + if not self.animate: + self.overlay.text = self.overlay_text%(self.latitude, self.longitude, self.altitude, self.kph) + + def on_get_geocoding(self, status): + address_text = re.findall(r'address.*?\n', status['geo'].encode('utf-8')) + self.geo_text.text = address_text[0][11:] +# m = decode_json(status['geo']) +# for item in m('Placemark'): +# print 'MMMMMM:', item + + def on_edje_signal_dialer_status_triggered(self, edje, emission, source): + if source == "label" and not self.animate: + maps_avail = PyneoController.map_tiles.keys() + self.map_type = maps_avail[(maps_avail.index(self.map_type)+1)%len(maps_avail)] + self.cache_directory = '/'.join([self.pymapd_cache, self.map_type, "%d/%d/%d"]) + self.init_redraw() + print '--- map type: ', self.map_type + + def on_map_new_file(self, d): + for filename, info in d.items(): + if info.get("state") != "DOWNLOADED": + print "ERROR", filename, info + else: + assert filename.startswith('file://') + filename = filename[7:] + parts = filename.split("/") + x = int(parts[-2]) + y = int(parts[-1]) + + for icon in self.not_downloaded_tiles: + if icon.x == x and icon.y == y: + icon.file_set(filename) + + def hide(self): + for icon in self.icons: + icon.hide() + self.overlay.hide() + self.geo_text.hide() + self.arrow.hide() + self.pinpoint.hide() + for text in ["back", "player-plus", "player-minus", "info"]: + self.buttons[text].hide() + # when to store current settings permanently? + # self.config.set('map_type', self.map_type) + # self.config.set('longitude', self.longitude) + # self.config.set('latitude', self.latitude) + # self.config.set('zoom', self.zoom) + # self.config.config.save() + + def show(self): + for icon in self.icons: + icon.show() + self.overlay.show() + self.geo_text.show() + self.pinpoint.show() + if self.fix: + self.arrow.show() + for text in ["back", "player-plus", "player-minus", "info"]: + self.buttons[text].show() + + #jump to coordinates + def set_current_tile(self, latitude, longitude, zoom): + #update shown coordinates everytime they change + self.overlay.text = self.overlay_text%(latitude, longitude, self.altitude, self.kph) +# self.overlay.part_text_set("zoom", str(zoom)) + + x = (longitude+180)/360 * 2**zoom + y = (1-math.log(math.tan(latitude*math.pi/180) + 1/math.cos(latitude*math.pi/180))/math.pi)/2 * 2**zoom + offset_x, offset_y = int((x-int(x))*256), int((y-int(y))*256) + #only redraw if x, y, zoom, offset_x or offset_y differ from before + if int(x) != int(self.x) \ + or int(y) != int(self.y) \ + or zoom != self.zoom \ + or offset_x != self.offset_x \ + or offset_y != self.offset_y: + self.zoom = zoom + self.x = x + self.y = y + self.offset_x, self.offset_y = offset_x, offset_y + self.init_redraw() + + def init_icons(self): + #clean up + for icon in self.icons: + icon.delete() + self.icons = [] + #fill + for i in xrange((2*self.border_x+1)*(2*self.border_y+1)): + self.icons.append(GpsMapScreen.Tile(self.canvas)) + + def init_redraw(self): + self.not_downloaded_tiles = [] + for i in xrange(2*self.border_x+1): + for j in xrange(2*self.border_y+1): + k = (2*self.border_y+1)*i+j + x = int(self.x)+i-self.border_x + y = int(self.y)+j-self.border_y + self.icons[k].x = x + self.icons[k].y = y + self.icons[k].set_position((i-self.border_x)*256+self.size[0]/2-self.offset_x, (j-self.border_y)*256+self.size[1]/2-self.offset_y) + + filename = self.cache_directory%(self.zoom, self.x+i-self.border_x, self.y+j-self.border_y) + if exists(filename): + self.icons[k].file_set(filename) + else: + self.icons[k].file_set('/'.join([IMAGE_FILES_PATH, "map", "404.png"])) + self.not_downloaded_tiles.append(self.icons[k]) + self.current_pos = (0, 0) + + if self.not_downloaded_tiles: + PyneoController.map_request_tiles(self.latitude, self.longitude, self.zoom, self.map_type) + + def update_coordinates(self): + x = int(self.x) + (self.offset_x-self.current_pos[0])/256.0 + y = int(self.y) + (self.offset_y-self.current_pos[1])/256.0 + self.longitude = (x*360)/2**self.zoom-180 + n = math.pi*(1-2*y/2**self.zoom) + self.latitude = 180/math.pi*math.atan(0.5*(math.exp(n)-math.exp(-n))) + self.overlay.text = self.overlay_text%(self.latitude, self.longitude, self.altitude, self.kph) +# self.overlay.part_text_set("zoom", str(self.zoom)) + + def zoom_in(self, zoom): + for icon in self.icons: + x = (1+zoom)*(icon.position[0]-self.size[0]/2)+self.size[0]/2 + y = (1+zoom)*(icon.position[1]-self.size[1]/2)+self.size[1]/2 + icon.geometry = int(x), int(y), 256+int(256*zoom), 256+int(256*zoom) + icon.fill = 0, 0, 256+int(256*zoom), 256+int(256*zoom) + + def zoom_out(self, zoom): + for icon in self.icons: + x = (1-zoom*0.5)*(icon.position[0]-self.size[0]/2)+self.size[0]/2 + y = (1-zoom*0.5)*(icon.position[1]-self.size[1]/2)+self.size[1]/2 + icon.geometry = int(x), int(y), 256-int(256*zoom*0.5), 256-int(256*zoom*0.5) + icon.fill = 0, 0, 256-int(256*zoom*0.5), 256-int(256*zoom*0.5) + + def animate_zoom_in(self): + if self.zoom < 18: + self.animate = True + if self.zoom_step < 1.0: + self.zoom_in(self.zoom_step) + self.zoom_step+=0.125 + return True + + self.zoom_step = 0.0 + self.set_current_tile(self.latitude, self.longitude, self.zoom+1) + for icon in self.icons: + icon.size = 256, 256 + icon.fill = 0, 0, 256, 256 + self.animate = False + return False + + def animate_zoom_out(self): + if self.zoom > 5: + self.animate = True + if self.zoom_step < 1.0: + self.zoom_out(self.zoom_step) + self.zoom_step+=0.125 + return True + + self.zoom_step = 0.0 + self.set_current_tile(self.latitude, self.longitude, self.zoom-1) + for icon in self.icons: + icon.size = 256, 256 + icon.fill = 0, 0, 256, 256 + self.animate = False + return False + + @decorators.signal_callback("mouse,down,1", "*") + def on_mouse_down(self, emission, source): + if not self.animate: + self.x_pos, self.y_pos = self.canvas.pointer_canvas_xy + self.mouse_down = True + + @decorators.signal_callback("mouse,up,1", "*") + def on_mouse_up(self, emission, source): + self.mouse_down = False + if not self.animate: + #redraw if moved further than one tile in each direction 'cause the preoload will only download one tile further than requested + if abs(self.current_pos[0]) > 256 or abs(self.current_pos[1]) > 256: + self.x = int(self.x) + (self.offset_x-self.current_pos[0])/256.0 + self.y = int(self.y) + (self.offset_y-self.current_pos[1])/256.0 + self.offset_x, self.offset_y = int((self.x-int(self.x))*256), int((self.y-int(self.y))*256) + self.update_coordinates() + self.init_redraw() + if abs(self.current_pos[0]) > 0 or abs(self.current_pos[1]) > 0: + #on mouse up + move: update current coordinates + self.update_coordinates() + if self.not_downloaded_tiles: + PyneoController.map_request_tiles(self.latitude, self.longitude, self.zoom, self.map_type) + + @decorators.signal_callback("mouse,move", "*") + def on_mouse_move(self, emission, source): + if self.mouse_down and not self.animate and not self.fix: + x_pos, y_pos = self.canvas.pointer_canvas_xy + delta_x = self.x_pos - x_pos + delta_y = self.y_pos - y_pos + self.x_pos, self.y_pos = x_pos, y_pos + for icon in self.icons: + icon.set_position(icon.pos[0]-delta_x, icon.pos[1]-delta_y) + self.current_pos = (self.current_pos[0]-delta_x, self.current_pos[1]-delta_y) +# vim:tw=0:nowrap diff --git a/gps_status_screen.py b/gps_status_screen.py new file mode 100644 index 0000000..c88ef2d --- /dev/null +++ b/gps_status_screen.py @@ -0,0 +1,146 @@ +#!/usr/bin/env python2.5 +# -*- coding: utf-8 -*- +__author__ = "Soeren Apel (abraxa@dar-clan.de), F. Gau (fgau@pyneo.org), Thomas Gstaedner (thomas (a) gstaedtner (.) net)" +__version__ = "prototype" +__copyright__ = "Copyright (c) 2008" +__license__ = "GPL3" + +from epydial import * + +STYLE = """ +DEFAULT='font=Sans font_size=20 align=left color=#808080 wrap=word valign=top' +h1='+ font_size=38 font=Bookman' +/h1='- \\n \\n' +p='+ ' +/p='- \\n \\n' +br='\\n' +red='+ color=#660000' +/red='-' +center='+ align=center' +/center='-' +big='+ font_size=40' +/big='-' +""" + +class GpsStatusScreen(): + def register_pyneo_callbacks(self): + PyneoController.register_callback("power_status_gps", self.on_power_status_gps) + PyneoController.register_callback("gps_position_change", self.on_gps_position_change) + + def __init__(self, screen_manager): + status_track = "off" + file_track = None + trackpoints = None + track_timer = None + self.buttons = {} + self.canvas = screen_manager.get_evas() + + self.bg = evas.Image(self.canvas, pos=(0, 0), size=(WIDTH, HEIGHT), file=PyneoController.set_bg_image) + self.bg.fill = 0, 0, WIDTH, HEIGHT + self.bg.layer = 99 + + self.headline = evas.Text(self.canvas, text="gps status", font=("Sans:style=Bold,Edje-Vera", 60), color="#808080") + self.headline.layer = 99 + self.headline.pos = ((480-self.headline.horiz_advance)/2, 25) + + self.fix_txt = evas.Text(self.canvas, text="nix fix", font=("Sans:style=Bold,Edje-Vera", 60), color="#808080") + self.fix_txt.layer = 98 + self.fix_txt.pos =((WIDTH-self.fix_txt.horiz_advance)/2, (HEIGHT-self.fix_txt.vert_advance)/2) + + self.tb_gps = evas.Textblock(self.canvas, pos=(10,110), size=(600,210), ) + self.tb_gps.layer = 99 + self.tb_gps.style_set(STYLE) + + for pos, text in enumerate(["back", "gps_on", "forward"]): + self.buttons[text] = self.init_button(text, (pos+1)*16+pos*100, 524, 100, 100) + + PyneoController.power_status_gps() + + def init_button(self, name, x, y, dx, dy): + def button_callback(source, event): + if name == 'back': + PyneoController.show_dialer_screen() + elif name == 'forward': + PyneoController.show_gps_map_screen() + elif name == 'gps_on' and self.p_status == 'off': + PyneoController.power_up_gps() +# PyneoController. + elif name == 'gps_on' and self.p_status == 'on': + PyneoController.power_down_gps() + self.tb_gps.text_markup_set("") + self.fix_txt.layer = 98 + print '--- ', name + button = evas.Image(self.canvas, pos=(x,y), size=(dx,dy), file="%s%s.png" % (THEME_IMAGES, name)) + button.fill = 0, 0, dx, dy + button.layer = 99 + button.on_mouse_up_add(button_callback) + return button + + def on_power_status_gps(self, status): + if status: self.p_status = 'on' + else: self.p_status = 'off' + self.buttons['gps_on'].file = '%s/gps_%s.png' % (THEME_IMAGES, self.p_status) + + def on_gps_position_change(self, status): + if status: + if status.get('course', 0): + course = status.get('course', 0) + else: + course = 0 + self.fix_txt.layer = 98 + self.tb_gps.text_markup_set("fix: %s
long/lat: %0.4f/%0.4f
altitude: %0.f
kph/course: %0.f/%0.f
satellites: %s" + % (status.get('fix', 0), status.get('longitude', 0), status.get('latitude', 0), + status.get('altitude', 0), status.get('speed', 0), course, status.get('satellites', 0))) + +# if self.status_track == "on" and status['latitude'] and status['longitude']: +# self.trackpoints += 1 +# self.track_timer += 1 +# self.file_track.write('%s,%s,%s\n' %(self.trackpoints, status['latitude'], status['longitude'])) +# self.part_text_set("gps_track", "track log: on
trackpoints: %s" %self.trackpoints) +# if self.track_timer == 60: +# self.file_track.flush() +# self.track_timer = 0 + +# if not status: + else: + self.tb_gps.text_markup_set('') + self.fix_txt.layer = 99 + + def start_tracking(self): + self.status_track = "on" +# self.part_text_set("gps_track", "track log: on") + + if not os.path.exists(TRACK_FILE_PATH): + os.mkdir(TRACK_FILE_PATH) + self.file_track = open(TRACK_FILE_PATH + 'track.log', 'w') + self.trackpoints = self.track_timer = 0 + + def stop_tracking(self): + self.status_track = "off" +# self.part_text_set("gps_track", "track log: off") + self.file_track.close() + self.trackpoints = self.track_timer = 0 + + def show(self): + self.bg.show() + self.headline.show() + self.fix_txt.show() + self.tb_gps.show() + for text in ["back", "gps_on", "forward"]: + self.buttons[text].show() + + def hide(self): + self.bg.hide() + self.headline.hide() + self.fix_txt.hide() + self.tb_gps.hide() + for text in ["back", "gps_on", "forward"]: + self.buttons[text].hide() + +# @edje.decorators.signal_callback("mouse,up,1", "*") +# def on_edje_signal_dialer_status_triggered(self, emission, source): +# status = self.part_text_get("button_11_caption") +# if source == "headline" and self.status_track == "off": +# self.start_tracking() +# elif source == "headline" and self.status_track == "on": +# self.stop_tracking() diff --git a/gsm_status_screen.py b/gsm_status_screen.py new file mode 100644 index 0000000..01d96b1 --- /dev/null +++ b/gsm_status_screen.py @@ -0,0 +1,165 @@ +#!/usr/bin/env python2.5 +# -*- coding: utf-8 -*- +__author__ = "Soeren Apel (abraxa@dar-clan.de), F. Gau (fgau@pyneo.org), Thomas Gstaedner (thomas (a) gstaedtner (.) net)" +__version__ = "prototype" +__copyright__ = "Copyright (c) 2008" +__license__ = "GPL3" + +from epydial import * + +STYLE = """ +DEFAULT='font=Sans font_size=18 align=left color=#808080 wrap=word valign=top' +h1='+ font_size=38 font=Bookman' +/h1='- \\n \\n' +p='+ ' +/p='- \\n \\n' +br='\\n' +red='+ color=#660000' +/red='-' +center='+ align=center' +/center='-' +big='+ font_size=40' +/big='-' +""" + +class GsmStatusScreen(): + + def register_pyneo_callbacks(self): + PyneoController.register_callback("power_status_gsm", self.on_power_status_gsm) + PyneoController.register_callback("device_status", self.on_device_status) + PyneoController.register_callback("gsm_details", self.on_gsm_details) + PyneoController.register_callback("gprs_status", self.on_gprs_status) + + PyneoController.get_device_status() + PyneoController.gsm_details() + PyneoController.get_gprs_status() + PyneoController.power_status_gsm() + + def __init__(self, screen_manager): + self.buttons = {} + self.canvas = screen_manager.get_evas() + + self.bg = evas.Image(self.canvas, pos=(0, 0), size=(WIDTH, HEIGHT), file=PyneoController.set_bg_image) + self.bg.fill = 0, 0, WIDTH, HEIGHT + self.bg.layer = 99 + + def headline_callback(source, event): + if source: + print '--- start scanning' + self.headline.text = 'scanning' + self.headline.pos = ((WIDTH-self.headline.horiz_advance)/2, 25) + self.on_scan_operator() + + self.headline = evas.Text(self.canvas, text="gsm status", font=("Sans:style=Bold,Edje-Vera", 60), color="#808080") + self.headline.layer = 99 + self.headline.pos = ((WIDTH-self.headline.horiz_advance)/2, 25) + self.headline.on_mouse_up_add(headline_callback) + + self.tb_device = evas.Textblock(self.canvas, pos=(10, 110), size=(460, 200), ) + self.tb_device.layer = 99 + self.tb_device.style_set(STYLE) + + self.tb_operator = evas.Textblock(self.canvas, pos=(10, 330), size=(230, 200), ) + self.tb_operator.layer = 99 + self.tb_operator.style_set(STYLE) + + self.tb_gsm_status = evas.Textblock(self.canvas, pos=(240, 330), size=(230, 200), ) + self.tb_gsm_status.layer = 99 + self.tb_gsm_status.style_set(STYLE) + + for pos, text in enumerate(["back", "network.usb", "network.gprs.on", "power.on"]): + self.buttons[text] = self.init_button(text, (pos+1)*16+pos*100, 524, 100, 100) + + def init_button(self, name, x, y, dx, dy): + self.p_status = 'on' + self.g_status = 'off' + + def button_callback(source, event): + if name == 'back': + PyneoController.show_dialer_screen() + elif name == 'power.on' and self.p_status == 'on': + PyneoController.power_down_gsm() + print '--- ', name, self.p_status + elif name == 'power.on' and self.p_status == 'off': + PyneoController.power_up_gsm() + print '--- ', name, self.p_status + elif name == 'network.usb': + pass + elif name == 'network.gprs.on' and self.g_status == 'off': + PyneoController.activate_gprs() + print '--- ', name, self.g_status + elif name == 'network.gprs.on' and self.g_status == 'on': + PyneoController.deactivate_gprs() + print '--- ', name, self.g_status + button = evas.Image(self.canvas, pos=(x,y), size=(dx,dy), file="%s%s.png" % (THEME_IMAGES, name)) + button.fill = 0, 0, dx, dy + button.layer = 99 + button.on_mouse_up_add(button_callback) + return button + + def show(self): + self.bg.show() + self.headline.show() + self.tb_device.show() + self.tb_operator.show() + self.tb_gsm_status.show() + for text in ["back", "network.usb", "network.gprs.on", "power.on"]: + self.buttons[text].show() + + def hide(self): + self.bg.hide() + self.headline.hide() + self.tb_device.hide() + self.tb_operator.hide() + self.tb_gsm_status.hide() + for text in ["back", "network.usb", "network.gprs.on", "power.on"]: + self.buttons[text].hide() + + def on_gprs_status(self, status): + if status: self.g_status = 'on' + else: self.g_status = 'off' + print '--- gprs is ', self.g_status + self.buttons['network.gprs.on'].file = '%snetwork.gprs.%s.png' % (THEME_IMAGES, self.g_status) +# status = status.get("device", "off") +# print '--- network device is ', status +# self.part_text_set("button_13_caption", status) + + def on_scan_operator(self): + def error_cb(msg): + print "error:", msg + + def ok_cb(status): + operator = 'scan operator:
' + for n, v in status.items(): + operator += v['oper'] + '
' + print 'provider', n, ':', v['oper'] + self.headline.text = "gsm status" + self.headline.pos = ((WIDTH-self.headline.horiz_advance)/2, 25) + self.tb_operator.text_markup_set(operator) + + PyneoController.scan_operator(ok_cb, error_cb) + + def on_device_status(self, status): + self.tb_device.text_markup_set( + "imei: %s
model: %s
revision: %s
manufacturer: %s" % ( + status['imei'], + status['model'], + status['revision'], + status['manufacturer'])) + + def on_gsm_details(self, status): + self.tb_gsm_status.text_markup_set( + "operator: %s
rssi: %s
lac/ci: %s/%s
mcc/cc: %s/%s
country: %s" % ( + status['oper'], + status['rssi'], + status['lac'], + status['ci'], + status['mcc'], + status['cc'], + status['country'])) + + def on_power_status_gsm(self, status): + if status: self.p_status = 'on' + else: self.p_status = 'off' + print '--- gsm device is ', self.p_status + self.buttons['power.on'].file = '%spower.%s.png' % (THEME_IMAGES, self.p_status) diff --git a/history_screen.py b/history_screen.py new file mode 100755 index 0000000..c2fbc25 --- /dev/null +++ b/history_screen.py @@ -0,0 +1,169 @@ +#!/usr/bin/env python2.5 +# -*- coding: utf-8 -*- +__author__ = "F. Gau , Thomas 'thomasg' Gstaedtner " +__version__ = "prototype" +__copyright__ = "Copyright (c) 2009" +__license__ = "GPL3" + +from epydial import * + +STYLE = """ +DEFAULT='font=Sans font_size=22 align=left color=#808080 wrap=word valign=top' +p='+ ' +/p='- \\n \\n' +br='\\n' +center='+ align=center' +/center='-' +""" + +class HistoryScreen(): + calls_offset = 0 + sorted_by = ['time', 'missed', 'incoming', 'outgoing'] + sorted_by_state = 'time' + + def register_pyneo_callbacks(self): + pass + + def __init__(self, screen_manager): + self.buttons = {} + self.bg_line = {} + self.canvas = screen_manager.get_evas() + + PyneoController.set_missed_call_icon('false') + PyneoController.set_ini_value('status', 'missed_calls', 'false') + + self.bg = evas.Image(self.canvas, pos=(0, 0), size=(WIDTH, HEIGHT), file=PyneoController.set_bg_image) + self.bg.fill = 0, 0, WIDTH, HEIGHT + self.bg.layer = 99 + + def headline_callback(source, event): + self.sorted_by_state = self.sorted_by[(self.sorted_by.index(self.sorted_by_state)+1)%len(self.sorted_by)] + self.calls_offset = 0 + self.subheadline.text = ('sorted by: %s' % self.sorted_by_state) + self.subheadline.pos = ((WIDTH-self.subheadline.horiz_advance)/2, 100) + self.show_calls() + + self.headline = evas.Text(self.canvas, text="call history", font=("Sans:style=Bold,Edje-Vera", 60), color="#808080") + self.headline.layer = 99 + self.headline.pos = ((WIDTH-self.headline.horiz_advance)/2, 25) + self.headline.on_mouse_up_add(headline_callback) + + self.subheadline = evas.Text(self.canvas, font=("Sans,Edje-Vera", 25), color="#808080") + self.subheadline.layer = 99 + + for pos, text in enumerate(["back", "previous", "next"]): + self.buttons[text] = self.init_button(text, (pos+1)*16+pos*100, 524, 100, 100) + + for i, text in enumerate(["1" ,"2", "3", "4", "5"]): + for j, row in enumerate(["status", "date", "number", "bg"]): + self.bg_line[text, row] = self.init_line(row, text, i) + + self.show_calls() + + def init_line(self, row, name, num): + def button_callback(source, event): + if name == '1' or name == '2' or name == '3' or name == '4' or name == '5': + PyneoController.dialer_text_set(self.bg_line[name, 'number'].text) + PyneoController.show_dialer_screen() + print '---', name + + if row == "status": + status = evas.Image(self.canvas, size=(33,33)) + status.pos = (480/20+10, (640+2)/9+num*640/9+85) + status.layer = 99 + return status + + if row == "date": + date = evas.Text(self.canvas, font=("Sans:style=Edje-Vera", 18), color="#808080") + date.pos = (480/20+50, (640*2)/9+num*640/9+5) + date.layer = 99 + return date + + if row == "number": + content = evas.Text(self.canvas, font=("Sans:style=Edje-Vera", 18), color="#808080") + content.pos = (480/20+50, (640*2)/9+num*640/9+30) + content.layer = 99 + return content + + if row == "bg": + bg = evas.Rectangle(self.canvas, pos=(480/20, (640*2)/9+num*640/9+5), size=((480*18)/20, 640/12), color="#38ffffff") + bg.layer = 99 + bg.on_mouse_up_add(button_callback) + return bg + + def init_button(self, name, x, y, dx, dy): + def button_callback(source, event): + if name == 'back': + PyneoController.show_dialer_screen() + elif name == 'next': + new_offset = self.calls_offset + 5 + if DatabaseController.get_call_count(self.sorted_by_state) > new_offset: + self.calls_offset = new_offset + self.show_calls() + elif name == 'previous': + new_offset = self.calls_offset - 5 + if new_offset >= 0: + self.calls_offset = new_offset + self.show_calls() + print '--- ', name + button = evas.Image(self.canvas, pos=(x,y), size=(dx,dy), file="%s%s.png" %(THEME_IMAGES, name)) + button.fill = 0, 0, dx, dy + button.layer = 99 + button.on_mouse_up_add(button_callback) + return button + + def del_displayed_calls(self): + x = 1 + while x < 6: + self.bg_line[str(x), 'status'].file_set('%sone.png' %THEME_IMAGES) + self.bg_line[str(x), 'status'].fill = 0, 0, 33, 33 + self.bg_line[str(x), 'date'].text = "" + self.bg_line[str(x), 'number'].text = "" + x += 1 + + def show_calls(self): + x = 1 + self.del_displayed_calls() + self.subheadline.text = ("sorted by: %s" % self.sorted_by_state) + self.subheadline.pos = ((WIDTH-self.subheadline.horiz_advance)/2, 100) + if self.sorted_by_state == 'time': + calls = DatabaseController.get_calls('%', 5, self.calls_offset) + else: + calls = DatabaseController.get_calls(self.sorted_by_state, 5, self.calls_offset) + + for i in calls: + self.bg_line[str(x), 'status'].file_set('%sphone.%s.png' %(THEME_IMAGES,i[0])) + self.bg_line[str(x), 'status'].fill = 0, 0 ,33, 33 + self.bg_line[str(x), 'date'].text = i[2][:16] + number = i[1] + name = DatabaseController.get_name_from_number(i[1]) + print 'name:', name + if name: + self.bg_line[str(x), 'number'].text = name + else: + self.bg_line[str(x), 'number'].text = number + x += 1 + + def show(self): + self.bg.show() + self.headline.show() + self.subheadline.show() + + for pos, text in enumerate(["back", "previous", "next"]): + self.buttons[text].show() + + for i, text in enumerate(["1" ,"2", "3", "4", "5"]): + for j, row in enumerate(["status", "date", "number", "bg"]): + self.bg_line[text, row].show() + + def hide(self): + self.bg.hide() + self.headline.hide() + self.subheadline.hide() + + for pos, text in enumerate(["back", "previous", "next"]): + self.buttons[text].hide() + + for i, text in enumerate(["1" ,"2", "3", "4", "5"]): + for j, row in enumerate(["status", "date", "number", "bg"]): + self.bg_line[text, row].hide() diff --git a/hon_screen.py b/hon_screen.py new file mode 100644 index 0000000..d83ec8d --- /dev/null +++ b/hon_screen.py @@ -0,0 +1,118 @@ +#!/usr/bin/env python2.5 +# -*- coding: utf-8 -*- +__author__ = "M. Dietrich , F. Gau (fgau@pyneo.org), Thomas Gstaedtner (thomas (a) gstaedtner (.) net), Johannes 'josch' Schauer " +__version__ = "prototype" +__copyright__ = "Copyright (c) 2009" +__license__ = "GPL3" + +from epydial import * +from shutil import copy + +class HonScreen(): + def register_pyneo_callbacks(self): + pass + + def __init__(self, screen_manager): + self.fullscreen = False + self.rotation = False + self.buttons = {} + self.canvas = screen_manager.get_evas() + + self.image = evas.Image(self.canvas, ) + self.image.pass_events = True + self.image.layer = 100 + PyneoController.get_hon(self.get_hon_cb) + + def background_callback(source, event): + if self.fullscreen: + if self.rotation: + self.image.rotate(3) + self.rotation = False + self.set_image_size(20, 140, 440, 380) + self.fullscreen = False + else: + x, y = self.image.image_size + if x > y: + self.image.rotate(1) + self.rotation = True + self.set_image_size(0, 0, 480, 640) + self.fullscreen = True + + self.bg = evas.Image(self.canvas, pos=(0, 0), size=(WIDTH, HEIGHT), file=PyneoController.set_bg_image) + self.bg.fill = 0, 0, WIDTH, HEIGHT + self.bg.layer = 99 + self.bg.on_mouse_up_add(background_callback) + + self.headline = evas.Text(self.canvas, text="hot or not", font=("Sans:style=Bold,Edje-Vera", 60), color="#808080") + self.headline.layer = 99 + self.headline.pos = ((480-self.headline.horiz_advance)/2, 25) + + self.subheadline = evas.Text(self.canvas, text="nick ???", font=("Sans:style=Bold,Edje-Vera", 22), color="#808080") + self.subheadline.layer = 99 + self.subheadline.pos = ((WIDTH-self.subheadline.horiz_advance)/2, 110) + + for pos, text in enumerate(["back", "previous", "next"]): + self.buttons[text] = self.init_button(text, (pos+1)*16+pos*100, 524, 100, 100) + + def init_button(self, name, x, y, dx, dy): + def button_callback(source, event): + if name == 'back': + PyneoController.show_dialer_screen() + elif name == 'next': + PyneoController.vote_hon(self.nothot) + PyneoController.get_hon(self.get_hon_cb) + elif name == 'previous': + PyneoController.vote_hon(self.hot) + copy(self.image.file[0], "%s/%s.jpg"%(PIX_FILE_PATH, self.nick)) + PyneoController.get_hon(self.get_hon_cb) + print '--- ', name + button = evas.Image(self.canvas, pos=(x,y), size=(dx,dy), file="/usr/share/epydial/data/themes_data/blackwhite/images/%s.png" % name) + button.fill = 0, 0, dx, dy + button.layer = 99 + button.on_mouse_up_add(button_callback) + return button + + def get_hon_cb(self, status): + img = object_by_url(status['img']).read() + pix = status['img'] + assert pix.startswith('file://') + pix = pix[7:] + self.nick = status['nick'] + self.subheadline.text = ('nick: %s' % self.nick) + self.subheadline.pos = ((WIDTH-self.subheadline.horiz_advance)/2, 110) + self.hot = dict(url=status['hot']) + self.nothot = dict(url=status['nothot']) + + self.image.file_set(pix) + self.set_image_size(20, 140, 440, 380) + print 'img: ', self.image.file[0] + + def set_image_size(self, x1, y1, dx, dy): + x, y = self.image.image_size + if x * dy > y * dx: + y = y * dx / x + x = dx + else: + x = x * dy / y + y = dy + print 'x, y, dx, dy: ', x, y, dx, dy + self.image.geometry = x1+(dx-x)/2, y1+(dy-y)/2, x, y + self.image.fill = 0, 0, x, y + + def hide(self): + self.bg.hide() + self.headline.hide() + self.subheadline.hide() + self.image.hide() + + for pos, text in enumerate(["back", "previous", "next"]): + self.buttons[text].hide() + + def show(self): + self.bg.show() + self.headline.show() + self.subheadline.show() + self.image.show() + + for pos, text in enumerate(["back", "previous", "next"]): + self.buttons[text].show() diff --git a/incall_screen.py b/incall_screen.py new file mode 100644 index 0000000..a856afc --- /dev/null +++ b/incall_screen.py @@ -0,0 +1,84 @@ +#!/usr/bin/env python2.5 +# -*- coding: utf-8 -*- +__author__ = "Soeren Apel (abraxa@dar-clan.de), Frank Gau (fgau@gau-net.de), Thomas Gstaedtner (thomas (a) gstaedtner (.) net)" +__version__ = "prototype" +__copyright__ = "Copyright (c) 2008" +__license__ = "GPL3" + +from epydial import * + +class InCallScreen(): + def register_pyneo_callbacks(self): + PyneoController.register_callback("gsm_number_display", self.on_gsm_number_display) + + def on_gsm_number_display(self, number): + self.number = number + print 'SELF.NUMBER: ', self.number + self.speaker = True + name = DatabaseController.get_name_from_number(self.number) + if name: + self.number_text.text = name + else: + self.number_text.text = self.number + self.headline.text = 'call %s' % PyneoController.call_type + self.headline.pos = ((WIDTH-self.headline.horiz_advance)/2, 25) + self.number_text.pos = ((WIDTH-self.number_text.horiz_advance)/2, (HEIGHT-self.number_text.vert_advance)/2) + + def __init__(self, screen_manager): + self.canvas = screen_manager.get_evas() + self.buttons = {} + + self.bg = evas.Image(self.canvas, pos=(0, 0), size=(WIDTH, HEIGHT), file=PyneoController.set_bg_image) + self.bg.fill = 0, 0, WIDTH, HEIGHT + self.bg.layer = 99 + + self.headline = evas.Text(self.canvas, text="call", font=("Sans:style=Bold,Edje-Vera", 60), color="#808080") + self.headline.layer = 99 + + self.number_text = evas.Text(self.canvas, font=("Sans:style=Bold,Edje-Vera", 30), color="#808080") + self.number_text.layer = 99 + + for pos, text in enumerate(["yes", "no", "speaker_off"]): + self.buttons[text] = self.init_button(text, (pos+1)*16+pos*100, 524, 100, 100) + + def button_callback(self, source, event): + if source.name == 'yes': + PyneoController.stop_tone('ring') + PyneoController.gsm_accept(self.number) + elif source.name == 'no': + PyneoController.stop_tone('ring') + PyneoController.gsm_hangup() + PyneoController.show_dialer_screen() + elif source.name == 'speaker_off' and self.speaker: + PyneoController.set_state_file('gsmspeakerout') + self.buttons['speaker_off'].file = '%sspeaker_on.png' % THEME_IMAGES + self.speaker = False + elif source.name == 'speaker_off' and not self.speaker: + PyneoController.set_state_file('gsmhandset') + self.buttons['speaker_off'].file = '%sspeaker_off.png' % THEME_IMAGES + self.speaker = True + print '--- ', source.name + + def init_button(self, name, x, y, dx, dy): + button = evas.Image(self.canvas, pos=(x,y), size=(dx,dy), file="%s%s.png" % (THEME_IMAGES, name)) + button.fill = 0, 0, dx, dy + button.layer = 99 + button.on_mouse_up_add(self.button_callback) + button.name = name + return button + + def show(self): + self.bg.show() + self.headline.show() + self.number_text.show() + + for pos, text in enumerate(["yes", "no", "speaker_off"]): + self.buttons[text].show() + + def hide(self): + self.bg.hide() + self.headline.hide() + self.number_text.hide() + + for pos, text in enumerate(["yes", "no", "speaker_off"]): + self.buttons[text].hide() diff --git a/init_sqlite.py b/init_sqlite.py new file mode 100644 index 0000000..6618bf5 --- /dev/null +++ b/init_sqlite.py @@ -0,0 +1,237 @@ +#!/usr/bin/env python2.5 +# -*- coding: utf-8 -*- + +from sqlite3 import connect +from constants import DB_FILE_PATH + +connection = connect(DB_FILE_PATH) +cursor = connection.cursor() + +cursor.execute("CREATE TABLE calls (status, number, time)") +cursor.execute("CREATE TABLE contacts (name, number)") +cursor.execute("CREATE TABLE sms (status, number, text, time)") +cursor.execute("CREATE TABLE music (artist, album, title)") +cursor.execute("CREATE TABLE mcc (country, cc, mcc)") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Afghanistan', '93', '412')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Albania', '355', '276')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Algeria', '213', '603')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('American Samoa (US)', '684 ', '544')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Andorra', '376', '213')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Angola', '244', '631')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Anguilla', '264 ', '365')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Antigua and Barbuda', '268 ', '344')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Argentina', '54', '722')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Armenia', '374', '283')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Aruba (Netherlands)', '297', '363')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Australia', '61', '505')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Austria', '43', '232')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Azerbaijan', '994', '400')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Bahamas', '242 ', '364')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Bahrain', '973', '426')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Bangladesh', '880', '470')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Barbados', '246 ', '342')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Belarus', '375', '257')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Belgium', '32', '206')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Belize', '501', '702')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Benin', '229', '616')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Bermuda (UK)', '441 ', '350')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Bhutan', '975', '402')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Bolivia', '591', '736')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Bosnia and Herzegovina', '387', '218')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Botswana', '267', '652')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Brazil', '55', '724')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('British Virgin Islands (UK)', '284 ', '348')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Brunei Darussalam', '673', '528')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Bulgaria', '359', '284')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Burkina Faso', '226', '613')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Burundi', '257', '642')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Cambodia', '855', '456')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Cameroon', '237', '624')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Canada', '1', '302')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Cape Verde Islands', '238', '625')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Cayman Islands (UK)', '345 ', '346')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Central African Republic', '236', '623')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Chad', '235', '622')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Chile', '56', '730')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('China (PRC)', '86', '460')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Colombia', '57', '732')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Comoros', '269', '654')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Costa Rica', '506', '712')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Croatia', '385', '219')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Cuba', '53', '368')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Cyprus', '357', '280')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Czech Republic', '420', '230')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Democratic Republic of the Congo', '242', '630')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Denmark', '45', '238')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Djibouti', '253', '638')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Dominica', '767 ', '366')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Dominican Republic', '829 ', '370')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('East Timor', '670', '514')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Ecuador', '593', '740')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Egypt', '20', '602')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('El Salvador', '503', '706')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Equatorial Guinea', '240', '627')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Eritrea', '291', '657')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Estonia', '372', '248')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Ethiopia', '251', '636')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Faroe Islands (Denmark)', '298', '288')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Fiji Islands', '679', '542')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Finland', '358', '244')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('France', '33', '208')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('French Guiana', '594', '742')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('French Polynesia', '689', '547')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Gabonese Republic', '241', '628')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Gambia', '220', '607')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Georgia', '995', '282')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Germany', '49', '262')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Ghana', '233', '620')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Gibraltar (UK)', '350', '266')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Greece', '30', '202')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Greenland (Denmark)', '299', '290')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Grenada', '473 ', '352')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Guadeloupe (France)', '590', '340')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Guam (US)', '671 ', '535')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Guatemala', '502', '704')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Guinea', '224', '611')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Guinea-Bissau', '245', '632')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Guyana', '592', '738')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Haiti', '509', '372')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Honduras', '504', '708')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Hong Kong (PRC)', '852', '454')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Hungary', '36', '216')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Iceland', '354', '274')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('India', '91', '404')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('India', '91', '405')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Indonesia', '62', '510')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Iran', '98', '432')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Iraq', '964', '418')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Ireland', '353', '272')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Israel', '972', '425')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Italy', '39', '222')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Jamaica', '876', '338')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Japan', '81', '441')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Japan', '81', '440')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Jordan', '962', '416')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Kazakhstan', '7', '401')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Kenya', '254', '639')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Kiribati', '686', '545')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Korea, North', '850', '467')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Korea, South', '82', '450')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Kuwait', '965', '419')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Kyrgyz Republic', '996', '437')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Laos', '856', '457')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Latvia', '371', '247')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Lebanon', '961', '415')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Lesotho', '266', '651')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Liberia', '231', '618')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Libya', '218', '606')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Liechtenstein', '423', '295')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Lithuania', '370', '246')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Luxembourg', '352', '270')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Macau (PRC)', '853', '455')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Madagascar', '261', '646')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Malawi', '265', '650')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Malaysia', '60', '502')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Maldives', '960', '472')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Mali Republic', '223', '610')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Malta', '356', '278')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Marshall Islands', '692', '551')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Martinique (France)', '596', '340')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Mauritania', '222', '609')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Mauritius', '230', '617')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Mexico', '52', '334')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Moldova', '373', '259')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Monaco', '377', '212')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Mongolia', '976', '428')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Montenegro', '382', '297')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Montserrat (UK)', '664 ', '354')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Morocco', '212', '604')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Mozambique', '258', '643')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Myanmar', '95', '414')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Namibia', '264', '649')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Nauru', '674', '536')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Nepal', '977', '429')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Netherlands', '31', '204')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Netherlands Antilles (Netherlands)', '599', '362')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('New Caledonia (France)', '687', '546')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('New Zealand', '64', '530')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Nicaragua', '505', '710')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Niger', '227', '614')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Nigeria', '234', '621')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Northern Mariana Islands (US)', '670 ', '534')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Norway', '47', '242')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Oman', '968', '422')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Pakistan', '92', '410')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Palau', '680', '552')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Panama', '507', '714')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Papua New Guinea', '675', '537')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Paraguay', '595', '744')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Peru', '51', '716')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Philippines', '63', '515')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Poland', '48', '260')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Portugal', '351', '268')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Puerto Rico', '939 ', '330')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Qatar', '974', '427')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Romania', '40', '226')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Russia', '7', '250')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Rwandese Republic', '250', '635')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('R�union Island', '262', '647')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Saint Kitts and Nevis', '869' ,'356')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Saint Lucia', '758' ,'358')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Saint Pierre and Miquelon (France)', '508', '308')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Saint Vincent and the Grenadines', '784', '360')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Samoa', '685', '549')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('San Marino', '378', '292')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Saudi Arabiai', '966', '420')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Senegal', '221', '608')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Serbiai', '381', '220')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Seychelles', '248', '633')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Sierra Leone', '232', '619')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Singapore', '65', '525')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Slovak Republic', '421', '231')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Slovenia', '386', '293')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Solomon Islands', '677', '540')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('South Africa', '27', '655')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Spain', '34', '214')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Sri Lanka', '94', '413')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Sudan', '249', '634')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Suriname', '597', '746')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Swaziland', '268', '653')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Sweden', '46', '240')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Switzerland', '41', '228')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Syria', '963', '417')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('S�o Tom� and Principe', '239', '626')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Taiwan', '886', '466')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Tajikistan', '992', '436')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Tanzania', '255', '640')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Thailand', '66', '520')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Togolese Republic', '228', '615')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Tonga Islands', '676', '539')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Trinidad and Tobago', '868', '374')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Tunisia', '216', '605')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Turkey', '90', '286')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Turkmenistan', '993', '438')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Turks and Caicos Islands (UK)', '649', '376')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Uganda', '256', '641')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Ukraine', '380', '255')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('United Arab Emirates', '971', '424')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('United Kingdom', '44', '235')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('United Kingdom', '44', '234')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('United States of America', '1', '310')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('United States of America', '1', '311')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('United States of America', '1', '312')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('United States of America', '1', '313')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('United States of America', '1', '314')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('United States of America', '1', '315')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('United States of America', '1', '316')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Uruguay', '598', '748')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Uzbekistan', '998', '434')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Vanuatu', '678', '541')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Vatican City State', '379', '225')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Venezuela', '58', '734')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Vietnam', '84', '452')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Wallis and Futuna (France)', '681', '543')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Yemen', '967', '421')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Zambia', '260', '645')") +cursor.execute("INSERT INTO mcc (country, cc, mcc) VALUES ('Zimbabwe', '263', '648')") +connection.commit() diff --git a/lock_screen.py b/lock_screen.py new file mode 100644 index 0000000..eee9e88 --- /dev/null +++ b/lock_screen.py @@ -0,0 +1,74 @@ +#!/usr/bin/env python2.5 +# -*- coding: utf-8 -*- +__author__ = "Johannes 'josch' Schauer , F. Gau " +__version__ = "prototype" +__copyright__ = "Copyright (c) 2009 J. Schauer" +__license__ = "GPL3" + +# Todo: synchron with other clock => numberdisplay_text + +from epydial import * + +class LockScreen(): + def register_pyneo_callbacks(self): + pass + + def __init__(self, screen_manager): + self.canvas = screen_manager.get_evas() + + self.bg = evas.Rectangle(self.canvas, pos=(0,0), size=(WIDTH, HEIGHT), color="#bb000000") + self.bg.on_mouse_up_add(self.on_mouse_up) + self.bg.layer = 99 + + self.button = evas.Rectangle(self.canvas, pos=(0,0), size=(WIDTH/3,HEIGHT/3), color="#00000000") + self.button.on_mouse_up_add(self.on_mouse_up) + self.button.layer = 100 + + self.label = evas.Text(self.canvas, text="screen locked", font=("sans serif", 50), color="#808080") + self.label.layer = 100 + self.label.pass_events = True + self.label.pos = ((WIDTH-self.label.horiz_advance)/2, (HEIGHT-self.label.vert_advance)/2) + + self.time_label = evas.Text(self.canvas, text="clock", font=("sans serif", 30), color="#808080") + self.time_label.layer = 100 + self.time_label.pass_events = True + + self.state = 0 + + ecore.timer_add(10.0, self.display_time) + self.display_time() + + def on_mouse_up(self, source, event): + if source == self.bg: + self.state = 0 + self.button.pos = (0, 0) + else: + if self.state == 0: + self.button.pos = ((WIDTH*2)/3, 0) + elif self.state == 1: + self.button.pos = ((WIDTH*2)/3, (HEIGHT*2)/3) + elif self.state == 2: + self.button.pos = (0, (HEIGHT*2)/3) + else: + self.button.pos = (0, 0) + PyneoController.show_dialer_screen() + self.state = (self.state+1)%4 + + def show(self): + self.bg.show() + self.button.show() + self.label.show() + self.time_label.show() + + def hide(self): + self.bg.hide() + self.button.hide() + self.label.hide() + self.time_label.hide() + + def display_time(self): + now = datetime.now() + datetimestring = now.strftime('%a, %d %b %Y %H:%M') + self.time_label.pos = ((WIDTH-self.time_label.horiz_advance)/2, (HEIGHT-self.time_label.vert_advance)/2+50) + self.time_label.text_set(datetimestring) + return True diff --git a/news_screen.py b/news_screen.py new file mode 100755 index 0000000..3468f5f --- /dev/null +++ b/news_screen.py @@ -0,0 +1,110 @@ +#!/usr/bin/env python2.5 +# -*- coding: utf-8 -*- +from __future__ import with_statement +__author__ = "F. Gau " +__version__ = "prototype" +__copyright__ = "Copyright (c) 2009" +__license__ = "GPL3" + +from epydial import * + +STYLE = """ +DEFAULT='font=Sans font_size=18 align=left color=#808080 wrap=word valign=top' +h1='+ font_size=38 font=Bookman' +/h1='- \\n \\n' +p='+ ' +/p='- \\n \\n' +br='\\n' +red='+ color=#660000' +/red='-' +center='+ align=center' +/center='-' +big='+ font_size=40' +/big='-' +""" + +class NewsScreen(): + + def register_pyneo_callbacks(self): + PyneoController.register_callback("show_news", self.on_show_news) + + def __init__(self, screen_manager): + self.FONT_COLOR = PyneoController.set_font_color + self.buttons = {} + self.keys = {} + self.canvas = screen_manager.get_evas() + + self.bg = evas.Image(self.canvas, pos=(0, 0), size=(WIDTH, HEIGHT), file=PyneoController.set_bg_image) + self.bg.fill = 0, 0, WIDTH, HEIGHT + self.bg.layer = 99 + + self.headline = evas.Text(self.canvas, text="news", font=("Sans:style=Bold,Edje-Vera", 60), color=self.FONT_COLOR) + self.headline.layer = 99 + self.headline.pos = ((WIDTH-self.headline.horiz_advance)/2, 25) + + self.tb_device = evas.Textblock(self.canvas, pos=(120, 110), size=(350, 400), ) + self.tb_device.layer = 99 + self.tb_device.style_set(STYLE) + + self.image = evas.Image(self.canvas, ) + self.image.pass_events = True + self.image.layer = 99 + + for pos, text in enumerate(["back", "previous", "next", "power.on"]): + self.buttons[text] = self.init_button(text, (pos+1)*16+pos*100, 524, 100, 100) + + def init_button(self, name, x, y, dx, dy): + def button_callback(source, event): + if name == 'back': + PyneoController.show_dialer_screen() + elif name == 'next': + pass + elif name == 'previous': + pass + elif name == 'power.on': + PyneoController.powered_news('true') + print '--- ', name + button = evas.Image(self.canvas, pos=(x,y), size=(dx,dy), file="%s%s.png" % (THEME_IMAGES, name)) + button.fill = 0, 0, dx, dy + button.layer = 99 + button.on_mouse_up_add(button_callback) + return button + + def on_show_news(self, status): + self.tb_device.text_markup_set( + "%s, %s
%s" % ( + status['created'].encode('utf-8'), + status['origin'].encode('utf-8'), + status['title'].encode('utf-8'))) + if 'image' in status: + print 'IMAGE PATH: ', status['image'][7:] + self.image.file_set(status['image'][7:]) + self.set_image_size(10, 10, 100, 300) + + def set_image_size(self, x1, y1, dx, dy): + x, y = self.image.image_size + if x * dy > y * dx: + y = y * dx / x + x = dx + else: + x = x * dy / y + y = dy + print 'x, y, dx, dy: ', x, y, dx, dy + self.image.geometry = x1+(dx-x)/2, y1+(dy-y)/2, x, y + self.image.fill = 0, 0, x, y + + def show(self): + self.bg.show() + self.headline.show() + self.tb_device.show() + self.image.show() + for text in ["back", "previous", "next", "power.on"]: + self.buttons[text].show() + + def hide(self): + self.bg.hide() + self.headline.hide() + self.tb_device.hide() + self.image.hide() + for text in ["back", "previous", "next", "power.on"]: + self.buttons[text].hide() diff --git a/pix_screen.py b/pix_screen.py new file mode 100755 index 0000000..4b90e23 --- /dev/null +++ b/pix_screen.py @@ -0,0 +1,147 @@ +#!/usr/bin/env python2.5 +# -*- coding: utf-8 -*- +__author__ = "F. Gau (fgau@pyneo.org), Thomas Gstaedtner (thomas (a) gstaedtner (.) net), Johannes 'josch' Schauer " +__version__ = "prototype" +__copyright__ = "Copyright (c) 2009" +__license__ = "GPL3" + +from epydial import * + +class PixScreen(): + def register_pyneo_callbacks(self): + pass + + pix_pointer = 0 + + def __init__(self, screen_manager): + self.FONT_COLOR = PyneoController.set_font_color + self.fullscreen = False + self.rotation = False + self.buttons = {} + self.canvas = screen_manager.get_evas() + + self.image = evas.Image(self.canvas, ) + self.image.pass_events = True + self.image.layer = 100 + + def background_callback(source, event): + if self.fullscreen: + if self.rotation: + self.image.rotate(3) + self.rotation = False + self.set_image_size(20, 140, 440, 380) + self.fullscreen = False + else: + x, y = self.image.image_size + if x > y: + self.image.rotate(1) + self.rotation = True + self.set_image_size(0, 0, WIDTH, HEIGHT) + self.fullscreen = True + + self.bg = evas.Image(self.canvas, pos=(0, 0), size=(WIDTH, HEIGHT), file=PyneoController.set_bg_image) + self.bg.fill = 0, 0, WIDTH, HEIGHT + self.bg.layer = 99 + self.bg.on_mouse_up_add(background_callback) + + def headline_callback(source, event): + if source: + self.bg_popup.show() + self.save_popup.show() + self.buttons["yes"].show() + self.buttons["no"].show() + + self.headline = evas.Text(self.canvas, text="pix viewer", font=("Sans:style=Bold,Edje-Vera", 60), color=self.FONT_COLOR) + self.headline.layer = 99 + self.headline.pos = ((WIDTH-self.headline.horiz_advance)/2, 25) + self.headline.on_mouse_up_add(headline_callback) + + self.subheadline = evas.Text(self.canvas, font=("Sans:style=Bold,Edje-Vera", 22), color=self.FONT_COLOR) + + self.bg_popup = evas.Rectangle(self.canvas, pos=(0,0), size=(WIDTH,HEIGHT), color="#bb000000") + self.bg_popup.layer = 100 + + self.save_popup = evas.Text(self.canvas, text="save as background?", font=("Sans:style=Bold,Edje-Vera", 25), color=self.FONT_COLOR) + self.save_popup.layer = 100 + self.save_popup.pos = ((WIDTH-self.save_popup.horiz_advance)/2, (HEIGHT-self.save_popup.vert_advance)/2) + + self.subheadline.layer = 99 + self.subheadline.pos = ((WIDTH-self.subheadline.horiz_advance)/2, 110) + + for pos, text in enumerate(["back", "previous", "next", "rotate"]): + self.buttons[text] = self.init_button(text, (pos+1)*16+pos*100, 524, 100, 100, 99) + + self.buttons["yes"] = self.init_button("yes", 16, 408, 100, 100, 100) + self.buttons["no"] = self.init_button("no", 364, 408, 100, 100, 100) + + self.objects = listdir(PIX_FILE_PATH) + if self.objects: + self.on_get_pix() + + def init_button(self, name, x, y, dx, dy, layer): + def button_callback(source, event): + if name == 'back': + PyneoController.show_dialer_screen() + elif name == 'next': + if self.objects: + self.pix_pointer = (self.pix_pointer+1)%len(self.objects) + self.on_get_pix() + elif name == 'previous': + if self.objects: + self.pix_pointer = (self.pix_pointer-1)%len(self.objects) + self.on_get_pix() + elif name == 'rotate': + self.image.rotate(1) + self.set_image_size(20, 140, 440, 380) + elif name == 'no': + self.hide_popup() + elif name == 'yes': + self.hide_popup() + PyneoController.set_ini_value('theme', 'bg_image', PIX_FILE_PATH + self.subheadline.text) + print '--- ', name + button = evas.Image(self.canvas, pos=(x,y), size=(dx,dy), file="%s%s.png" % (THEME_IMAGES, name)) + button.fill = 0, 0, dx, dy + button.layer = layer + button.on_mouse_up_add(button_callback) + return button + + def on_get_pix(self): + self.subheadline.text = self.objects[self.pix_pointer] + self.subheadline.pos = ((WIDTH-self.subheadline.horiz_advance)/2, 110) + self.image.file_set(PIX_FILE_PATH + self.objects[self.pix_pointer]) + self.set_image_size(20, 140, 440, 380) + + def set_image_size(self, x1, y1, dx, dy): + x, y = self.image.image_size + if x * dy > y * dx: + y = y * dx / x + x = dx + else: + x = x * dy / y + y = dy + print 'x, y, dx, dy: ', x, y, dx, dy + self.image.geometry = x1+(dx-x)/2, y1+(dy-y)/2, x, y + self.image.fill = 0, 0, x, y + + def hide_popup(self): + self.buttons["yes"].hide() + self.buttons["no"].hide() + self.bg_popup.hide() + self.save_popup.hide() + + def hide(self): + self.bg.hide() + self.headline.hide() + self.subheadline.hide() + self.image.hide() + for text in ["back", "previous", "next", "rotate"]: + self.buttons[text].hide() + + def show(self): + self.bg.show() + self.headline.show() + self.subheadline.show() + self.objects = listdir(PIX_FILE_PATH) + self.image.show() + for text in ["back", "previous", "next", "rotate"]: + self.buttons[text].show() diff --git a/settings_screen.py b/settings_screen.py new file mode 100644 index 0000000..ec49ec0 --- /dev/null +++ b/settings_screen.py @@ -0,0 +1,179 @@ +#!/usr/bin/env python2.5 +# -*- coding: utf-8 -*- +__author__ = "M. Dietrich , F. Gau (fgau@pyneo.org), Thomas Gstaedtner (thomas (a) gstaedtner (.) net), Johannes 'josch' Schauer " +__version__ = "prototype" +__copyright__ = "Copyright (c) 2009" +__license__ = "GPL3" + +from epydial import * + +class SettingsScreen(): + def register_pyneo_callbacks(self): + PyneoController.register_callback("brightness_change", self.on_brightness_change) + + def __init__(self, screen_manager): + self.FONT_COLOR = PyneoController.set_font_color + self.red = int(self.FONT_COLOR[3:5], 16) + self.green = int(self.FONT_COLOR[5:7], 16) + self.blue = int(self.FONT_COLOR[7:], 16) + self.alpha = int(self.FONT_COLOR[1:3], 16) + + self.state_type = PyneoController.alsacurrent + self.vibrate_type = PyneoController.vibrate_current + self.syslog_type = PyneoController.syslog_current + self.buttons = {} + self.settings = {} + self.canvas = screen_manager.get_evas() + + self.bg = evas.Image(self.canvas, pos=(0, 0), size=(WIDTH, HEIGHT), file=PyneoController.set_bg_image) + self.bg.fill = 0, 0, WIDTH, HEIGHT + self.bg.layer = 97 + + self.headline = evas.Text(self.canvas, text="settings", font=("Sans:style=Bold,Edje-Vera", 60), color=self.FONT_COLOR) + self.headline.layer = 99 + self.headline.pos = ((480-self.headline.horiz_advance)/2, 25) + + for pos, text in enumerate(["back", "forward"]): + self.buttons[text] = self.init_button(text, (pos+1)*16+pos*100, 524, 100, 100) + + for pos, text in enumerate(["syslog", "vibrate", "state", "brightness"]): + for i, row in enumerate(["left", "right", "description", "box", "plus", "minus"]): + self.settings[text, row] = self.init_settings(row, text, (pos+1)*25+pos*75+100) + + self.settings['syslog', 'description'].text = 'syslog: %s' % self.syslog_type + x, y = self.settings['syslog', 'description'].pos_get() + self.settings['syslog', 'description'].pos = ((WIDTH-self.settings['syslog', 'description'].horiz_advance)/2, y) + + self.settings['vibrate', 'description'].text = 'vibrate: %s' % self.vibrate_type + x, y = self.settings['vibrate', 'description'].pos_get() + self.settings['vibrate', 'description'].pos = ((WIDTH-self.settings['vibrate', 'description'].horiz_advance)/2, y) + + self.settings['state', 'description'].text = 'state: %s' % self.state_type + x, y = self.settings['state', 'description'].pos_get() + self.settings['state', 'description'].pos = ((WIDTH-self.settings['state', 'description'].horiz_advance)/2, y) + + self.settings['brightness', 'description'].text = 'brightness: %s%%' % PyneoController.brightness_value + x, y = self.settings['brightness', 'description'].pos_get() + self.settings['brightness', 'description'].pos = ((WIDTH-self.settings['brightness', 'description'].horiz_advance)/2, y) + + PyneoController.brightness_change(0) + + def init_settings(self, row, name, y): + def button_callback(source, event): + if name == 'brightness' and row == 'right': + PyneoController.brightness_change(10) + elif name == 'brightness' and row == 'left': + PyneoController.brightness_change(-10) + elif name == 'state' and row == 'right': + states_avail = PyneoController.alsastate + self.state_type = states_avail[(states_avail.index(self.state_type)+1)%len(states_avail)] + PyneoController.set_state_file(self.state_type) + self.settings['state', 'description'].text = 'state: %s' % self.state_type + x, y = self.settings['state', 'description'].pos_get() + self.settings['state', 'description'].pos = ((WIDTH-self.settings['state', 'description'].horiz_advance)/2, y) + elif name == 'state' and row == 'left': + states_avail = PyneoController.alsastate + self.state_type = states_avail[(states_avail.index(self.state_type)-1)%len(states_avail)] + PyneoController.set_state_file(self.state_type) + self.settings['state', 'description'].text = 'state: %s' % self.state_type + x, y = self.settings['state', 'description'].pos_get() + self.settings['state', 'description'].pos = ((WIDTH-self.settings['state', 'description'].horiz_advance)/2, y) + elif name == 'vibrate' and row == 'right': + states_avail = PyneoController.vibrate_state + self.vibrate_type = states_avail[(states_avail.index(self.vibrate_type)+1)%len(states_avail)] + PyneoController.vibrate_current = self.vibrate_type + self.settings['vibrate', 'description'].text = 'vibrate: %s' % self.vibrate_type + x, y = self.settings['vibrate', 'description'].pos_get() + self.settings['vibrate', 'description'].pos = ((WIDTH-self.settings['vibrate', 'description'].horiz_advance)/2, y) + elif name == 'vibrate' and row == 'left': + states_avail = PyneoController.vibrate_state + self.vibrate_type = states_avail[(states_avail.index(self.vibrate_type)-1)%len(states_avail)] + PyneoController.vibrate_current = self.vibrate_type + self.settings['vibrate', 'description'].text = 'vibrate: %s' % self.vibrate_type + x, y = self.settings['vibrate', 'description'].pos_get() + self.settings['vibrate', 'description'].pos = ((WIDTH-self.settings['vibrate', 'description'].horiz_advance)/2, y) + elif name == 'syslog' and row == 'right': + states_avail = PyneoController.syslog_state + self.syslog_type = states_avail[(states_avail.index(self.syslog_type)+1)%len(states_avail)] + PyneoController.syslog_current = self.syslog_type + PyneoController.set_debug_log(self.syslog_type) + self.settings['syslog', 'description'].text = 'syslog: %s' % self.syslog_type + x, y = self.settings['syslog', 'description'].pos_get() + self.settings['syslog', 'description'].pos = ((WIDTH-self.settings['syslog', 'description'].horiz_advance)/2, y) + elif name == 'syslog' and row == 'left': + states_avail = PyneoController.syslog_state + self.syslog_type = states_avail[(states_avail.index(self.syslog_type)-1)%len(states_avail)] + PyneoController.syslog_current = self.syslog_type + PyneoController.set_debug_log(self.syslog_type) + self.settings['syslog', 'description'].text = 'syslog: %s' % self.syslog_type + x, y = self.settings['syslog', 'description'].pos_get() + self.settings['syslog', 'description'].pos = ((WIDTH-self.settings['syslog', 'description'].horiz_advance)/2, y) + print '--- ', name, row + if row == 'left': + bg_left = evas.Rectangle(self.canvas, pos=(0,y), size=(WIDTH/2,80), color='#00ffffff') + bg_left.layer = 99 + bg_left.on_mouse_up_add(button_callback) + return bg_left + if row == 'right': + bg_right = evas.Rectangle(self.canvas, pos=(WIDTH/2,y), size=(WIDTH/2,80), color='#00ffffff') + bg_right.layer = 99 + bg_right.on_mouse_up_add(button_callback) + return bg_right + if row == 'description': + description = evas.Text(self.canvas, font=("Sans:style=Edje-Vera", 18), color=self.FONT_COLOR) + description.text = '%s:' % name + description.pos = ((WIDTH-description.horiz_advance)/2, y+26) + description.layer = 99 + return description + if row == 'box': + box = evas.Rectangle(self.canvas, pos=(WIDTH/4,y+20), size=(WIDTH/2,40), color='#%02x%02x%02x%02x' % (self.alpha/2, self.red, self.green, self.blue)) + box.layer = 98 + return box + if row == 'plus': + plus = evas.Text(self.canvas, text="+", pos=(420,y), font=("Sans:style=Edje-Vera", 46), color=self.FONT_COLOR) + plus.layer = 98 + return plus + if row == 'minus': + minus = evas.Text(self.canvas, text="-", pos=(40, y), font=("Sans:style='Edje-Vera", 46), color=self.FONT_COLOR) + minus.layer = 98 + return minus + + def init_button(self, name, x, y, dx, dy): + def button_callback(source, event): + if name == 'back': + PyneoController.show_dialer_screen() + elif name == 'forward': + PyneoController.show_screen(FONTCOLOR_SCREEN_NAME) + print '--- ', name + button = evas.Image(self.canvas, pos=(x,y), size=(dx,dy), file="/usr/share/epydial/data/themes_data/blackwhite/images/%s.png" % name) + button.fill = 0, 0, dx, dy + button.layer = 99 + button.on_mouse_up_add(button_callback) + return button + + def show(self): + self.bg.show() + self.headline.show() + + for pos, text in enumerate(["syslog", "vibrate", "state", "brightness"]): + for i, row in enumerate(["left", "right", "description", "box", "plus", "minus"]): + self.settings[text, row].show() + + for pos, text in enumerate(["back", "forward"]): + self.buttons[text].show() + + def hide(self): + self.bg.hide() + self.headline.hide() + + for pos, text in enumerate(["syslog", "vibrate", "state", "brightness"]): + for i, row in enumerate(["left", "right", "description", "box", "plus", "minus"]): + self.settings[text, row].hide() + + for pos, text in enumerate(["back", "forward"]): + self.buttons[text].hide() + + def on_brightness_change(self, status): + self.settings['brightness', 'description'].text = 'brightness: %s%%' % status + x, y = self.settings['brightness', 'description'].pos_get() + self.settings['brightness', 'description'].pos = ((WIDTH-self.settings['brightness', 'description'].horiz_advance)/2, y) diff --git a/setup_files/.xinitrc b/setup_files/.xinitrc new file mode 100644 index 0000000..ac2a543 --- /dev/null +++ b/setup_files/.xinitrc @@ -0,0 +1,12 @@ +#!/bin/bash + +export DISPLAY=:0 + +xsetroot -cursor /usr/share/epydial/data/emptycursor /usr/share/epydial/data/emptycursor + +cd /usr/share/epydial + +while /bin/true; do + ./epydial.py + sleep 5 +done diff --git a/setup_files/install_epydial b/setup_files/install_epydial new file mode 100755 index 0000000..39a2dd4 --- /dev/null +++ b/setup_files/install_epydial @@ -0,0 +1,5 @@ +#!/bin/bash + +cp .xinitrc /root/ +cp xserver-nodm /etc/init.d/ +ln -s /etc/init.d/xserver-nodm /etc/rc2.d/S99xserver-nodm diff --git a/setup_files/xserver-nodm b/setup_files/xserver-nodm new file mode 100755 index 0000000..00779c3 --- /dev/null +++ b/setup_files/xserver-nodm @@ -0,0 +1,49 @@ +#!/bin/sh + +killproc() { # kill the named process(es) + pid=`/bin/ps -e x | + /bin/grep $1 | + /bin/grep -v grep | + /bin/sed -e 's/^ *//' -e 's/ .*//'` + [ "$pid" != "" ] && kill $pid +} + +for x in $(cat /proc/cmdline); do + case $x in + x11=false) + echo "X Server disabled" + exit 0; + ;; + esac +done + +case "$1" in + start) + # We don't want this script to block the rest of the boot process + if [ "$2" != "background" ]; then + $0 $1 background & + else + . /etc/profile + + echo "Starting Xserver" + xinit /root/.xinitrc -- /usr/bin/X -br :0 vt1 & + fi + ;; + + stop) + echo "Stopping XServer" + killproc xinit + ;; + + restart) + $0 stop + sleep 1 + $0 start + ;; + + *) + echo "usage: $0 { start | stop | restart }" + ;; +esac + +exit 0 diff --git a/simimporter_screen.py b/simimporter_screen.py new file mode 100755 index 0000000..e113b7b --- /dev/null +++ b/simimporter_screen.py @@ -0,0 +1,141 @@ +#!/usr/bin/env python2.5 +# -*- coding: utf-8 -*- +__author__ = "Patrick Beck (pbeck (a) yourse (.) de)" +__version__ = "prototype" +__copyright__ = "Copyright (c) 2009" +__license__ = "GPL3" + +# TODO +# the description text will not be displayed always - sometimes on the half of the text will be displayed +# you can test it when you go back and forward + +from epydial import * + +STYLE = """ +DEFAULT='font=Sans font_size=18 align=left color=#ffffff wrap=word valign=top' +h1='+ font_size=38 font=Bookman' +/h1='- \\n \\n' +p='+ ' +/p='- \\n \\n' +br='\\n' +red='+ color=#660000' +/red='-' +center='+ align=center' +/center='-' +big='+ font_size=40' +/big='-' +""" + +class SimImporter(): + + def register_pyneo_callbacks(self): + pass + + def __init__(self, screen_manager): + self.FONT_COLOR = PyneoController.set_font_color + self.red = int(self.FONT_COLOR[3:5], 16) + self.green = int(self.FONT_COLOR[5:7], 16) + self.blue = int(self.FONT_COLOR[7:], 16) + self.alpha = int(self.FONT_COLOR[1:3], 16) + + self.buttons = {} + self.canvas = screen_manager.get_evas() + + self.bg = evas.Image(self.canvas, pos=(0, 0), size=(WIDTH, HEIGHT), file=PyneoController.set_bg_image) + self.bg.fill = 0, 0, WIDTH, HEIGHT + self.bg.layer = 97 + + self.headline = evas.Text(self.canvas, text="SIM - Importer", font=("Sans:style=Bold,Edje-Vera", 50), color=self.FONT_COLOR) + self.headline.layer = 99 + self.headline.pos = ((WIDTH-self.headline.horiz_advance)/2, 25) + + self.description_background = evas.Rectangle(self.canvas, pos=(0,135), size=(480,100), color='#%02x%02x%02x%02x' % (self.alpha/2, self.red, self.green, self.blue)) + self.description_background.layer = 99 + + self.description = evas.Textblock(self.canvas, pos=(0,155), size=(480,100), color=self.FONT_COLOR ) + self.description.layer = 99 + text = '%s%s' % ('
SIM - Importer synchronize contacts from

', '
your sim-card to your phonebook database
') + self.description.text_markup_set(text) + self.description.style_set(STYLE) + + self.status = evas.Textblock(self.canvas, pos=(0,480), size=(480,50), ) + self.status.layer = 99 + self.status.style_set(STYLE) + + for pos, text in enumerate(["back"]): + self.buttons[text] = self.init_button(text, (pos+1)*16+pos*100, 524, 100, 100) + + self.buttons["sync_button"] = self.init_button("sync_button", 88,300, 303, 120) + + def init_button(self, name, x, y, dx, dy): + + def button_callback(source, event): + if name == 'sync_button': + self.status.text_markup_set("
Syncing started ...
") + self.on_get_phbook() + elif name == 'back': + self.status.text_markup_set("") + PyneoController.show_screen(FONTCOLOR_SCREEN_NAME) + print name + + button = evas.Image(self.canvas, pos=(x,y), size=(dx,dy), file="%s%s.png" % (THEME_IMAGES, name)) + button.fill = 0, 0, dx, dy + button.layer = 99 + button.on_mouse_up_add(button_callback) + return button + + def on_get_phbook(self): + def error_cb(msg): + self.status.text_markup_set("
Not possible to get the sim contacts
") # it's none when a error comes up + + def ok_cb(status): + contactssim = PyneoController.get_phbook(status) + self.check_db(contactssim) # when all right, go over to check the database + PyneoController.get_phbook_raw(ok_cb, error_cb) + + def show(self): + self.bg.show() + self.headline.show() + self.description_background.show() + self.description.show() + self.status.show() + for text in ["sync_button", "back"]: + self.buttons[text].show() + + def hide(self): + self.bg.hide() + self.headline.hide() + self.description_background.hide() + self.description.hide() + self.status.hide() + for text in ["sync_button", "back"]: + self.buttons[text].hide() + + def check_db(self, contactssim): # check if the contacts already in the database + print '-----', 'check if the contacts new' + print '-----', 'Connecting to the database - to read' + contactsdb = DatabaseController.get_allcontacts() + + newsimcontacts = {} + + for i in contactssim: # compare the two dicts, if not in database => add it + if not i in contactsdb: + newsimcontacts[i] = contactssim[i] + + if not newsimcontacts: + self.status.text_markup_set("
All contacts already in your phonebook
") + print '-----', 'All contacts already in your phonebook' + else: + self.sync_with_db(newsimcontacts) + + def sync_with_db(self, newsimcontacts): + print '-----', 'add the new contacts to the datbase' + + print 'Connecting to the database' + print 'This contacts are added to the database' + + for key, item in newsimcontacts.iteritems(): # split the dict into name and number + DatabaseController.insert_contact(item, key) # Databasecontroller to add contacts to the db through epydial + print key, ':', item + + self.status.text_markup_set("
All new contacts added to the database
") diff --git a/sms_detail.py b/sms_detail.py new file mode 100644 index 0000000..8838018 --- /dev/null +++ b/sms_detail.py @@ -0,0 +1,143 @@ +#!/usr/bin/env python2.5 +# -*- coding: utf-8 -*- +__author__ = "Soeren Apel (abraxa@dar-clan.de), Frank Gau (fgau@pyneo.org), Thomas Gstaedtner (thomas (a) gstaedtner (.) net)" +__version__ = "prototype" +__copyright__ = "Copyright (c) 2008" +__license__ = "GPL3" + +from epydial import * + +STYLE = """ +DEFAULT='font=Sans font_size=22 align=left color=#808080 wrap=word valign=top' +p='+ ' +/p='- \\n \\n' +br='\\n' +center='+ align=center' +/center='-' +""" + +class SmsDetail(): + + def __init__(self, screen_manager): + + self.buttons = {} + self.header = {} + self.canvas = screen_manager.get_evas() + + self.bg = evas.Image(self.canvas, pos=(0, 0), size=(WIDTH, HEIGHT), file=PyneoController.set_bg_image) + self.bg.fill = 0, 0, WIDTH, HEIGHT + self.bg.layer = 99 + + self.headline = evas.Text(self.canvas, text="sms detail", font=("Sans:style=Bold,Edje-Vera", 60), color="#808080") + self.headline.layer = 99 + self.headline.pos = ((WIDTH-self.headline.horiz_advance)/2, 25) + + self.bg_popup = evas.Rectangle(self.canvas, pos=(0,0), size=(WIDTH,HEIGHT), color="#bb000000") + self.bg_popup.layer = 100 + + self.save_popup = evas.Text(self.canvas, text="delete sms?", font=("Sans:style=Bold,Edje-Vera", 25), color="#808080") + self.save_popup.layer = 100 + self.save_popup.pos = ((WIDTH-self.save_popup.horiz_advance)/2, (HEIGHT-self.save_popup.vert_advance)/2) + + self.tb = evas.Textblock(self.canvas, pos=(10, 240), size=(460, 260), ) + self.tb.layer = 99 + self.tb.style_set(STYLE) + + for pos, text in enumerate(["back", "previous", "next", "no"]): + self.buttons[text] = self.init_button(text, (pos+1)*16+pos*100, 524, 100, 100, 99) + + self.buttons["yes"] = self.init_button("yes", 16, 408, 100, 100, 100) + self.buttons["nono"] = self.init_button("nono", 364, 408, 100, 100, 100) + + for pos, row in enumerate(["sms_from", "sms_time", "sms_status"]): + self.header[row] = self.init_header(row, 10, pos+150) + + def init_header(self, row, x, y): + if row == 'sms_from': + sms_from = evas.Text(self.canvas, font=("Sans:style=Edje-Vera", 18), color="#808080") + sms_from.pos = (10, y+10) + sms_from.text = 'from:' + sms_from.layer = 99 + return sms_from + if row == 'sms_time': + sms_time = evas.Text(self.canvas, font=("Sans:style=Edje-Vera", 18), color="#808080") + sms_time.pos = (10, y+30) + sms_time.text = 'time:' + sms_time.layer = 99 + return sms_time + if row == 'sms_status': + sms_status = evas.Text(self.canvas, font=("Sans:style=Edje-Vera", 18), color="#808080") + sms_status.pos = (10, y+50) + sms_status.text = 'status:' + sms_status.layer = 99 + return sms_status + + def init_button(self, name, x, y, dx, dy, layer): + def button_callback(source, event): + if name == 'back': + PyneoController.show_dialer_screen() + elif name == 'next': + pass + elif name == 'previous': + pass + elif name == 'no': + self.bg_popup.show() + self.save_popup.show() + self.buttons["yes"].show() + self.buttons["nono"].show() + elif name == 'nono': + self.hide_popup() + elif name == 'yes': + DatabaseController.delete_sms(self.header['sms_time'].text[6:]) + self.hide_popup() + PyneoController.dialer_screen() + print '--- ', name + if name == 'nono': + button = evas.Image(self.canvas, pos=(x,y), size=(dx,dy), file="%sno.png" % THEME_IMAGES) + else: + button = evas.Image(self.canvas, pos=(x,y), size=(dx,dy), file="%s%s.png" % (THEME_IMAGES, name)) + button.fill = 0, 0, dx, dy + button.layer = layer + button.on_mouse_up_add(button_callback) + return button + + def register_pyneo_callbacks(self): + PyneoController.register_callback("show_sms_detail", self.on_show_sms_detail) + + def on_show_sms_detail(self, sms_number, sms_status): + results = DatabaseController.get_sms_detail(sms_number, sms_status) + self.header['sms_from'].text = 'from: %s' %results[0][1] + self.header['sms_time'].text = 'time: %s' %results[0][3] + self.header['sms_status'].text = 'status: %s' %results[0][0] + self.tb.text_markup_set(results[0][2].encode('utf8')) + name = DatabaseController.get_name_from_number(results[0][1]) + if name: + self.header['sms_from'].text = 'from: %s' %name + if results[0][0] == 'REC UNREAD': + DatabaseController.mark_sms_read(results[0][3]) + + def hide_popup(self): + self.bg_popup.hide() + self.save_popup.hide() + self.buttons["yes"].hide() + self.buttons["nono"].hide() + + def show(self): + self.bg.show() + self.headline.show() + self.tb.show() + for text in ["back", "previous", "next", "no"]: + self.buttons[text].show() + + for pos, row in enumerate(["sms_from", "sms_time", "sms_status"]): + self.header[row].show() + + def hide(self): + self.bg.hide() + self.headline.hide() + self.tb.hide() + for text in ["back", "previous", "next", "no"]: + self.buttons[text].hide() + + for row in ["sms_from", "sms_time", "sms_status"]: + self.header[row].hide() diff --git a/sms_screen.py b/sms_screen.py new file mode 100644 index 0000000..7b8494c --- /dev/null +++ b/sms_screen.py @@ -0,0 +1,178 @@ +#!/usr/bin/env python2.5 +# -*- coding: utf-8 -*- +__author__ = "F. Gau (fgau@pyneo.org), Thomas Gstaedtner (thomas (a) gstaedtner (.) net)" +__version__ = "prototype" +__copyright__ = "Copyright (c) 2008" +__license__ = "GPL3" + +from epydial import * + +STYLE = """ +DEFAULT='font=Sans font_size=22 align=left color=#808080 wrap=word valign=top' +p='+ ' +/p='- \\n \\n' +br='\\n' +center='+ align=center' +/center='-' +""" + +class SmsScreen(): + def register_pyneo_callbacks(self): + pass + + sms_offset = 0 + sorted_by = 'REC UNREAD' + detail = False + + def __init__(self, screen_manager): + self.buttons = {} + self.bg_line = {} + self.canvas = screen_manager.get_evas() + + self.bg = evas.Image(self.canvas, pos=(0, 0), size=(WIDTH, HEIGHT), file=PyneoController.set_bg_image) + self.bg.fill = 0, 0, WIDTH, HEIGHT + self.bg.layer = 99 + + def headline_callback(source, event): + if self.sorted_by == "REC UNREAD": + self.sorted_by = 'REC READ' + else: + self.sorted_by = 'REC UNREAD' + self.sms_offset = 0 + self.subheadline.text = ('sorted by: %s' % self.sorted_by) + self.subheadline.pos = ((WIDTH-self.subheadline.horiz_advance)/2, 100) + self.show_sms() + + self.headline = evas.Text(self.canvas, text="sms", font=("Sans:style=Bold,Edje-Vera", 60), color="#808080") + self.headline.layer = 99 + self.headline.pos = ((WIDTH-self.headline.horiz_advance)/2, 25) + self.headline.on_mouse_up_add(headline_callback) + + self.subheadline = evas.Text(self.canvas, font=("Sans,Edje-Vera", 25), color="#808080") + self.subheadline.layer = 99 + self.subheadline.pos = ((WIDTH-self.subheadline.horiz_advance)/2, 100) + + for pos, text in enumerate(["back", "previous", "next"]): + self.buttons[text] = self.init_button(text, (pos+1)*16+pos*100, 524, 100, 100) + + for i, text in enumerate(["1" ,"2", "3", "4", "5"]): + for j, row in enumerate(["date", "content", "bg"]): + self.bg_line[text, row] = self.init_line(row, text, i) + + if DatabaseController.check_for_unread_sms() == 0: + self.sorted_by = 'REC READ' + else: + self.sorted_by = 'REC UNREAD' + + self.show_sms() + + def init_line(self, row, name, num): + def button_callback(source, event): + if name == "1": + PyneoController.show_screen(SMS_DETAIL_SCREEN_NAME) + PyneoController.show_sms_detail(self.sms_offset, self.sorted_by) + if name == "2": + self.sms_offset += 1 + PyneoController.show_screen(SMS_DETAIL_SCREEN_NAME) + PyneoController.show_sms_detail(self.sms_offset, self.sorted_by) + if name == "3": + self.sms_offset += 2 + PyneoController.show_screen(SMS_DETAIL_SCREEN_NAME) + PyneoController.show_sms_detail(self.sms_offset, self.sorted_by) + if name == "4": + self.sms_offset += 3 + PyneoController.show_screen(SMS_DETAIL_SCREEN_NAME) + PyneoController.show_sms_detail(self.sms_offset, self.sorted_by) + if name == "5": + self.sms_offset += 4 + PyneoController.show_screen(SMS_DETAIL_SCREEN_NAME) + PyneoController.show_sms_detail(self.sms_offset, self.sorted_by) + print '---', name + + if row == "bg": + bg = evas.Rectangle(self.canvas, pos=(480/20, (640*2)/9+num*640/9+5), size=((480*18)/20, 640/12), color="#38ffffff") + bg.layer = 99 + bg.on_mouse_up_add(button_callback) + return bg + + if row == "date": + date = evas.Text(self.canvas, font=("Sans:style=Edje-Vera", 18), color="#808080") + date.pos = (480/20+10, (640*2)/9+num*640/9+5) + date.layer = 99 + return date + + if row == "content": + content = evas.Text(self.canvas, font=("Sans:style=Edje-Vera", 18), color="#808080") + content.pos = (480/20+10, (640*2)/9+num*640/9+30) + content.layer = 99 + return content + + + def init_button(self, name, x, y, dx, dy): + def button_callback(source, event): + if name == 'back': + PyneoController.show_dialer_screen() + elif name == 'next': + new_offset = self.sms_offset + 5 + if DatabaseController.get_sms_count(self.sorted_by) > new_offset: + self.sms_offset = new_offset + self.show_sms() + elif name == 'previous': + new_offset = self.sms_offset -5 + if new_offset >= 0: + self.sms_offset = new_offset + self.show_sms() + print '--- ', name + button = evas.Image(self.canvas, pos=(x,y), size=(dx,dy), file="%s%s.png" % (THEME_IMAGES, name)) + button.fill = 0, 0, dx, dy + button.layer = 99 + button.on_mouse_up_add(button_callback) + return button + + def del_displayed_sms(self): + x=1 + while x < 6: + self.bg_line[str(x), 'date'].text = "" + self.bg_line[str(x), 'content'].text = "" + x += 1 + + def show_sms(self): + x = 1 + self.detail = False + self.del_displayed_sms() + self.subheadline.text = ('sorted by: %s' % self.sorted_by) + self.subheadline.pos = ((WIDTH-self.subheadline.horiz_advance)/2, 100) + cursor = DatabaseController.get_sms_list(5, self.sms_offset, self.sorted_by) + for i in cursor: + number = i[1] + name = DatabaseController.get_name_from_number(i[1]) + if name: + self.bg_line[str(x), 'date'].text = ("%s, %s" %(i[3][:14], name)) + else: + self.bg_line[str(x), 'date'].text = ("%s, %s" %(i[3][:14], number)) + self.bg_line[str(x), 'content'].text = i[2][:37].encode('utf8') + ' ...' + x += 1 + + def show(self): + self.bg.show() + self.headline.show() + self.subheadline.show() + + for pos, text in enumerate(["back", "previous", "next"]): + self.buttons[text].show() + + for i, text in enumerate(["1" ,"2", "3", "4", "5"]): + for j, row in enumerate(["date", "content", "bg"]): + self.bg_line[text, row].show() + + def hide(self): + self.bg.hide() + self.headline.hide() + self.subheadline.hide() + + for pos, text in enumerate(["back", "previous", "next"]): + self.buttons[text].hide() + + for i, text in enumerate(["1" ,"2", "3", "4", "5"]): + for j, row in enumerate(["date", "content", "bg"]): + self.bg_line[text, row].hide() diff --git a/time_screen.py b/time_screen.py new file mode 100644 index 0000000..bbc7acc --- /dev/null +++ b/time_screen.py @@ -0,0 +1,37 @@ +#!/usr/bin/env python2.5 +# -*- coding: utf-8 -*- +__author__ = "F. Gau (fgau@gau-net.de), Johannes 'josch' Schauer " +__version__ = "prototype" +__copyright__ = "Copyright (c) 2009" +__license__ = "GPL3" + +from epydial import * + +class TimeScreen(EdjeGroup): + def __init__(self, screen_manager): + EdjeGroup.__init__(self, screen_manager, TIME_SCREEN_NAME) + self.alarm = "00:00" + self.stopwatch_state = 0 + + def register_pyneo_callbacks(self): + pass + #PyneoController.register_callback("brightness_change", self.on_brightness_change) + + @edje.decorators.signal_callback("mouse,up,1", "*") + def on_edje_signal_settings_screen_triggered(self, emission, source): + if source == "back": + PyneoController.show_dialer_screen() + elif source == "alarm": + PyneoController.dialer_text_set("alarm %s"%self.alarm) + PyneoController.show_dialer_screen() + elif source == "countdown": + PyneoController.dialer_text_set("count %s"%self.alarm) + PyneoController.show_dialer_screen() + elif source == "stopwatch": + if self.stopwatch_state == 0: + self.stopwatch_state = 1 + elif self.stopwatch_state == 1: + self.stopwatch_state = 2 + elif self.stopwatch_state == 2: + self.stopwatch_state = 0 + print source diff --git a/timetable_screen.py b/timetable_screen.py new file mode 100644 index 0000000..7a6ebae --- /dev/null +++ b/timetable_screen.py @@ -0,0 +1,116 @@ +#!/usr/bin/env python2.5 +# -*- coding: utf-8 -*- +__author__ = "Johannes 'josch' Schauer " +__version__ = "prototype" +__copyright__ = "Copyright (c) 2009 J. Schauer" +__license__ = "GPL3" + +from epydial import * + +class Station(object): + def __init__(self, canvas, num, station, arrival=None, arrival_track=None, departure=None, departure_track=None, train_type=None, train_id=None): + self.rect = evas.Rectangle(canvas, pos=(480/20, (640*2)/11+num*640/7), size=((480*18)/20, 640/9), color="#38ffffff") + self.rect.layer = 2 + + if arrival: + arrival = datetime.strptime(arrival, "%Y-%m-%dT%H:%M:%S").strftime("%H:%M") + label1_text = ("%s %s Gl. %s"%(station, arrival, arrival_track)).encode("utf8") + else: + label1_text = station + self.label1 = evas.Text(canvas, text=label1_text, font=("Sans,Edje-Vera", 26), color="#80ffffff") + self.label1.layer = 3 + self.label1.pass_events = True + self.label1.pos = (480/20+4, (640*2)/11+num*640/7+2) + + if departure: + departure = datetime.strptime(departure, "%Y-%m-%dT%H:%M:%S").strftime("%H:%M") + label2_text = "%s Gl. %s - %s %s"%(departure, departure_track, train_type, train_id) + else: + label2_text = "" + self.label2 = evas.Text(canvas, text=label2_text, font=("Sans,Edje-Vera", 26), color="#80ffffff") + self.label2.layer = 3 + self.label2.pass_events = True + self.label2.pos = (480/20+4, (640*2)/11+num*640/7+34) + + def show(self): + self.rect.show() + self.label1.show() + self.label2.show() + + def hide(self): + self.rect.hide() + self.label1.hide() + self.label2.hide() + +class TimetableScreen(object): + def register_pyneo_callbacks(self): + pass + + def __init__(self, screen_manager): + self.buttons = {} + self.visible = False + self.canvas = screen_manager.get_evas() + + self.bg = evas.Image(self.canvas, pos=(0, 0), size=(WIDTH, HEIGHT), file=PyneoController.set_bg_image) + self.bg.fill = 0, 0, WIDTH, HEIGHT + self.bg.layer = 0 + + self.headline = evas.Text(self.canvas, font=("Sans,Edje-Vera", 40), color="#808080") + self.headline.layer = 1 + + self.subheadline = evas.Text(self.canvas, font=("Sans:style=Bold,Edje-Vera", 30), color="#808080") + self.subheadline.layer = 1 + + for pos, text, action in ((0, "back", lambda source, event: PyneoController.show_dialer_screen()), + (2, "previous", lambda source, event: None), + (3, "next", lambda source, event: None)): + self.buttons[text] = self.init_button(text, (pos+1)*16+pos*100, 524, 100, 100, action) + + self.stations = list() + self.get_tracks() + + def init_button(self, name, x, y, dx, dy, action): + button = evas.Image(self.canvas, pos=(x,y), size=(dx,dy), file="/usr/share/epydial/data/themes_data/blackwhite/images/%s.png" % name) + button.fill = 0, 0, dx, dy + button.layer = 99 + button.on_mouse_up_add(action) + return button + + def get_tracks(self): + def ok_cb(newmap): + newmap =dedbusmap(newmap) + arrival = datetime.strptime(newmap['arrival'], "%Y-%m-%dT%H:%M:%S").strftime("%H:%M") + departure = datetime.strptime(newmap['departure'], "%Y-%m-%dT%H:%M:%S").strftime("%H:%M") + self.subheadline.text = "%s - %s (%s EUR)"%(departure, arrival, round(newmap.get('cost', 0)/100.0, 2)) + self.subheadline.pos = ((480-self.subheadline.horiz_advance)/2, 70) + for num, s in enumerate(newmap['stations']): + self.stations.append(Station(self.canvas, num, **s)) + if self.visible: + for station in self.stations: + station.show() + def error_cb(msg): + print "error:", msg + self.headline.text = "Karlsruhe - Düsseldorf" + self.headline.pos = ((480-self.headline.horiz_advance)/2, 12) + PyneoController.get_track("Karlsruhe", "Düsseldorf", ok_cb, error_cb) + + + def show(self): + self.visible = True + self.bg.show() + self.headline.show() + self.subheadline.show() + for station in self.stations: + station.show() + for button in self.buttons.values(): + button.show() + + def hide(self): + self.visible = False + self.bg.hide() + self.headline.hide() + self.subheadline.hide() + for station in self.stations: + station.hide() + for button in self.buttons.values(): + button.hide() diff --git a/weather_screen.py b/weather_screen.py new file mode 100755 index 0000000..caec961 --- /dev/null +++ b/weather_screen.py @@ -0,0 +1,140 @@ +#!/usr/bin/env python2.5 +# -*- coding: utf-8 -*- +__author__ = "Soeren Apel (abraxa@dar-clan.de), Frank Gau (fgau@gau-net.de), Thomas Gstaedner (thomas (a) gstaedtner (.) net)" +__version__ = "prototype" +__copyright__ = "Copyright (c) 2008" +__license__ = "GPL3" + +TEMP_UNIT = 'c' + +WEATHER_URL = 'http://xml.weather.yahoo.com/forecastrss?p=%s&u=%s' +WEATHER_NS = 'http://xml.weather.yahoo.com/ns/rss/1.0' + +from epydial import * +import urllib +from xml.dom import minidom + +class WeatherScreen(): + def register_pyneo_callbacks(self): + pass + + def __init__(self, screen_manager): + self.zip_code = ['GMXX0007', 'GMXX0028', 'GMXX0049', 'GMXX0063', 'GMXX0096', 'GMXX0040'] + self.state_type = self.zip_code[0] + self.buttons = {} + self.contents = {} + self.canvas = screen_manager.get_evas() + + self.bg = evas.Image(self.canvas, pos=(0, 0), size=(WIDTH, HEIGHT), file=PyneoController.set_bg_image) + self.bg.fill = 0, 0, WIDTH, HEIGHT + self.bg.layer = 99 + + self.headline = evas.Text(self.canvas, text="weather", font=("Sans:style=Bold,Edje-Vera", 60), color="#808080") + self.headline.layer = 99 + self.headline.pos = ((480-self.headline.horiz_advance)/2, 25) + + self.subheadline = evas.Text(self.canvas, font=("Sans:style=Bold,Edje-Vera", 30), color="#808080") + self.subheadline.layer = 99 + + for pos, text in enumerate(["back", "previous", "next"]): + self.buttons[text] = self.init_button(text, (pos+1)*16+pos*100, 524, 100, 100) + + for pos, text in enumerate(["current", "forecast"]): + for i, row in enumerate(["pix", "date", "temp", "condition"]): + self.contents[text, row] = self.init_content(row, text, 10, (pos+1)*150) + + self.weather_for_zip(self.state_type, TEMP_UNIT) + + def init_content(self, row, name, x, y): + if row == 'pix': + weather_pix = evas.Image(self.canvas, pos=(340,y), size=(120,120)) + weather_pix.fill = 0, 0, 120, 120 + weather_pix.layer = 99 + return weather_pix + if row == 'date': + date = evas.Text(self.canvas, font=("Sans:style=Edje-Vera", 18), color="#808080") + date.pos = (10, y+10) + date.layer = 99 + return date + if row == 'temp': + high_low = evas.Text(self.canvas, font=("Sans:style=Edje-Vera", 18), color="#808080") + high_low.pos = (10, y+30) + high_low.layer = 99 + return high_low + elif row == 'condition': + condition = evas.Text(self.canvas, font=("Sans:style=Edje-Vera", 18), color="#808080") + condition.pos = (10, y+50) + condition.layer = 99 + return condition + + def init_button(self, name, x, y, dx, dy): + def button_callback(source, event): + if name == 'back': + PyneoController.show_dialer_screen() + elif name == 'next': + states_avail = self.zip_code + self.state_type = states_avail[(states_avail.index(self.state_type)+1)%len(states_avail)] + self.weather_for_zip(self.state_type, TEMP_UNIT) + elif name == 'previous': + states_avail = self.zip_code + self.state_type = states_avail[(states_avail.index(self.state_type)-1)%len(states_avail)] + self.weather_for_zip(self.state_type, TEMP_UNIT) + print '--- ', name + button = evas.Image(self.canvas, pos=(x,y), size=(dx,dy), file="/usr/share/epydial/data/themes_data/blackwhite/images/%s.png" % name) + button.fill = 0, 0, dx, dy + button.layer = 99 + button.on_mouse_up_add(button_callback) + return button + + def weather_for_zip(self, zip_code, unit): + url = WEATHER_URL % (zip_code, unit) + def parse(content): + dom = minidom.parse(urllib.urlopen(url)) + forecasts = [] + for node in dom.getElementsByTagNameNS(WEATHER_NS, 'forecast'): + forecasts.append({ + 'date': node.getAttribute('date'), + 'low': node.getAttribute('low'), + 'high': node.getAttribute('high'), + 'condition': node.getAttribute('text'), + 'code': node.getAttribute('code'), + }) + ycondition = dom.getElementsByTagNameNS(WEATHER_NS, 'condition')[0] + + self.subheadline.text = dom.getElementsByTagName('title')[0].firstChild.data[17:] + self.subheadline.pos = ((480-self.subheadline.horiz_advance)/2, 110) + self.contents['current', 'pix'].file_set('%s%s.png' % (PIX_WEATHER_FILE_PATH, ycondition.getAttribute('code'))) + self.contents['current', 'pix'].fill = 0, 0, 120, 120 + self.contents['current', 'date'].text = ('date: %s' % ycondition.getAttribute('date')) + self.contents['current', 'temp'].text = ('current temp: %s' % ycondition.getAttribute('temp')) + self.contents['current', 'condition'].text = ('condition: %s' % ycondition.getAttribute('text')) + self.contents['forecast', 'pix'].file_set('%s%s.png' % (PIX_WEATHER_FILE_PATH, forecasts[1]['code'])) + self.contents['forecast', 'pix'].fill = 0, 0, 120, 120 + self.contents['forecast', 'date'].text = ('date: %s' % (forecasts[1]['date'])) + self.contents['forecast', 'temp'].text = ('temp low/high: %s/%s' % (forecasts[1]['low'], forecasts[1]['high'])) + self.contents['forecast', 'condition'].text = ('condition: %s' % (forecasts[1]['condition'])) + PyneoController.urlread(url, parse) + + def show(self): + self.bg.show() + self.headline.show() + self.subheadline.show() + + for pos, text in enumerate(["back", "previous", "next"]): + self.buttons[text].show() + + for pos, text in enumerate(["current", "forecast"]): + for i, row in enumerate(["pix", "date", "temp", "condition"]): + self.contents[text, row].show() + + def hide(self): + self.bg.hide() + self.headline.hide() + self.subheadline.hide() + + for pos, text in enumerate(["back", "previous", "next"]): + self.buttons[text].hide() + + for pos, text in enumerate(["current", "forecast"]): + for i, row in enumerate(["pix", "date", "temp", "condition"]): + self.contents[text, row].hide() diff --git a/wlan_screen.py b/wlan_screen.py new file mode 100755 index 0000000..56a2607 --- /dev/null +++ b/wlan_screen.py @@ -0,0 +1,83 @@ +#!/usr/bin/env python2.5 +# -*- coding: utf-8 -*- +__author__ = "Soeren Apel (abraxa@dar-clan.de), F. Gau (fgau@pyneo.org), Thomas Gstaedner (thomas (a) gstaedtner (.) net)" +__version__ = "prototype" +__copyright__ = "Copyright (c) 2008" +__license__ = "GPL3" + +from epydial import * + +STYLE = """ +DEFAULT='font=Sans font_size=20 align=left color=#808080 wrap=word valign=top' +h1='+ font_size=38 font=Bookman' +/h1='- \\n \\n' +p='+ ' +/p='- \\n \\n' +br='\\n' +red='+ color=#660000' +/red='-' +center='+ align=center' +/center='-' +big='+ font_size=40' +/big='-' +""" + +class WlanScreen(): + def register_pyneo_callbacks(self): + PyneoController.register_callback("scan_wireless", self.on_scan_wireless) + + def on_scan_wireless(self, status): + wireless = 'networks:

' + for n, v in status.items(): + wireless += '%s, %s, %s, %s, %s
' % (n, v['essid'], v['encryption_key'], v['quality'], v['channel']) + print 'network', n, v['essid'], v['quality'], v['encryption_key'], v['address'] + self.tb.text_markup_set(wireless) + + def __init__(self, screen_manager): + self.buttons = {} + self.contents = {} + self.canvas = screen_manager.get_evas() + + self.bg = evas.Image(self.canvas, pos=(0, 0), size=(WIDTH, HEIGHT), file=PyneoController.set_bg_image) + self.bg.fill = 0, 0, WIDTH, HEIGHT + self.bg.layer = 99 + + self.headline = evas.Text(self.canvas, text="wlan", font=("Sans:style=Bold,Edje-Vera", 60), color="#808080") + self.headline.layer = 99 + self.headline.pos = ((480-self.headline.horiz_advance)/2, 25) + + self.tb = evas.Textblock(self.canvas, pos=(10, 100), size=(460, 600), ) + self.tb.layer = 99 + self.tb.style_set(STYLE) + + for pos, text in enumerate(["back", "previous", "next"]): + self.buttons[text] = self.init_button(text, (pos+1)*16+pos*100, 524, 100, 100) + + def init_button(self, name, x, y, dx, dy): + def button_callback(source, event): + if name == 'back': + PyneoController.show_dialer_screen() + elif name == 'next': + PyneoController.scan_wireless() + elif name == 'previous': + pass + print '--- ', name + button = evas.Image(self.canvas, pos=(x,y), size=(dx,dy), file="%s%s.png" % (THEME_IMAGES, name)) + button.fill = 0, 0, dx, dy + button.layer = 99 + button.on_mouse_up_add(button_callback) + return button + + def show(self): + self.bg.show() + self.headline.show() + self.tb.show() + for text in ["back", "previous", "next"]: + self.buttons[text].show() + + def hide(self): + self.bg.hide() + self.headline.hide() + self.tb.hide() + for text in ["back", "previous", "next"]: + self.buttons[text].hide()