From 1fb3dcb76e413e9a40383f38a0a4ac669d3ae721 Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Thu, 14 Oct 2021 14:53:30 +1100 Subject: Removing h-client subdir. --- h-client/COPYRIGHT.txt | 16 - h-client/License.txt | 201 --- h-client/README.txt | 49 - h-client/credits.txt | 49 - h-client/hclient.py | 1117 ---------------- h-client/hlibrary.py | 1055 ---------------- h-client/img/devices/big/3G-card.png | Bin 2789 -> 0 bytes h-client/img/devices/big/acquisition-card.png | Bin 4273 -> 0 bytes h-client/img/devices/big/bluetooth.png | Bin 3027 -> 0 bytes h-client/img/devices/big/fingerprint-reader.png | Bin 4669 -> 0 bytes h-client/img/devices/big/printer.png | Bin 2004 -> 0 bytes h-client/img/devices/big/scanner.png | Bin 2327 -> 0 bytes h-client/img/devices/big/soundcard.png | Bin 3153 -> 0 bytes h-client/img/devices/big/unknown.png | Bin 3913 -> 0 bytes h-client/img/devices/big/videocard.png | Bin 5131 -> 0 bytes h-client/img/devices/big/webcam.png | Bin 3441 -> 0 bytes h-client/img/devices/big/wifi.png | Bin 5531 -> 0 bytes h-client/img/devices/small/3G-card.png | Bin 1123 -> 0 bytes h-client/img/devices/small/acquisition-card.png | Bin 4075 -> 0 bytes h-client/img/devices/small/bluetooth.png | Bin 1046 -> 0 bytes h-client/img/devices/small/fingerprint-reader.png | Bin 1314 -> 0 bytes h-client/img/devices/small/printer.png | Bin 877 -> 0 bytes h-client/img/devices/small/scanner.png | Bin 856 -> 0 bytes h-client/img/devices/small/soundcard.png | Bin 1051 -> 0 bytes h-client/img/devices/small/unknown.png | Bin 1222 -> 0 bytes h-client/img/devices/small/videocard.png | Bin 3855 -> 0 bytes h-client/img/devices/small/webcam.png | Bin 1236 -> 0 bytes h-client/img/devices/small/wifi.png | Bin 1331 -> 0 bytes h-client/img/icon.png | Bin 518 -> 0 bytes h-client/img/title_png.png | Bin 1071 -> 0 bytes h-client/odict.py | 1399 --------------------- h-client/test.py | 69 - 32 files changed, 3955 deletions(-) delete mode 100755 h-client/COPYRIGHT.txt delete mode 100755 h-client/License.txt delete mode 100644 h-client/README.txt delete mode 100644 h-client/credits.txt delete mode 100644 h-client/hclient.py delete mode 100644 h-client/hlibrary.py delete mode 100755 h-client/img/devices/big/3G-card.png delete mode 100755 h-client/img/devices/big/acquisition-card.png delete mode 100755 h-client/img/devices/big/bluetooth.png delete mode 100644 h-client/img/devices/big/fingerprint-reader.png delete mode 100755 h-client/img/devices/big/printer.png delete mode 100755 h-client/img/devices/big/scanner.png delete mode 100755 h-client/img/devices/big/soundcard.png delete mode 100755 h-client/img/devices/big/unknown.png delete mode 100755 h-client/img/devices/big/videocard.png delete mode 100755 h-client/img/devices/big/webcam.png delete mode 100755 h-client/img/devices/big/wifi.png delete mode 100755 h-client/img/devices/small/3G-card.png delete mode 100755 h-client/img/devices/small/acquisition-card.png delete mode 100755 h-client/img/devices/small/bluetooth.png delete mode 100644 h-client/img/devices/small/fingerprint-reader.png delete mode 100755 h-client/img/devices/small/printer.png delete mode 100755 h-client/img/devices/small/scanner.png delete mode 100755 h-client/img/devices/small/soundcard.png delete mode 100755 h-client/img/devices/small/unknown.png delete mode 100755 h-client/img/devices/small/videocard.png delete mode 100755 h-client/img/devices/small/webcam.png delete mode 100755 h-client/img/devices/small/wifi.png delete mode 100644 h-client/img/icon.png delete mode 100644 h-client/img/title_png.png delete mode 100644 h-client/odict.py delete mode 100644 h-client/test.py diff --git a/h-client/COPYRIGHT.txt b/h-client/COPYRIGHT.txt deleted file mode 100755 index c06e43b..0000000 --- a/h-client/COPYRIGHT.txt +++ /dev/null @@ -1,16 +0,0 @@ -h-client, a client for an h-source server (such as http://www.h-node.com) -Copyright (C) 2011 Antonio Gallo - - -h-client 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. - -h-client 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 h-client. If not, see . diff --git a/h-client/License.txt b/h-client/License.txt deleted file mode 100755 index 404896a..0000000 --- a/h-client/License.txt +++ /dev/null @@ -1,201 +0,0 @@ -GNU GENERAL PUBLIC LICENSE - -Version 3, 29 June 2007 - -Copyright © 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/h-client/README.txt b/h-client/README.txt deleted file mode 100644 index ae78e6e..0000000 --- a/h-client/README.txt +++ /dev/null @@ -1,49 +0,0 @@ - -== Introduction == - -h-client, a client for an h-source server (such as http://www.h-node.com) - - -== Requirements == - -python - -make sure you have the following python modules installed: - - pycurl - urllib - htmlentitydefs - xml.dom - pygtk - - -== Use the client == - - -Extract the tarball inside a folder of your filesystem. - -Move to the just extracted folder. - -Type the following command: - -python hclient.py - - - -h-client, a client for an h-source server (such as http://www.h-node.com) -Copyright (C) 2011 Antonio Gallo - - -h-client 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. - -h-client 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 h-client. If not, see . - diff --git a/h-client/credits.txt b/h-client/credits.txt deleted file mode 100644 index 53d35a4..0000000 --- a/h-client/credits.txt +++ /dev/null @@ -1,49 +0,0 @@ -Icons: - -icons taken from the H2O Icon Theme 0.0.5 (http://kde-look.org/content/show.php/ACUN+Simgeleri?content=83018), licensed under the GNU GPL license: - -img/devices/small/unknown.png -img/devices/small/soundcard.png -img/devices/small/wifi.png -img/devices/small/printer.png -img/devices/small/scanner.png -img/devices/small/webcam.png -img/devices/small/bluetooth.png - -img/devices/big/unknown.png -img/devices/big/soundcard.png -img/devices/big/wifi.png -img/devices/big/printer.png -img/devices/big/scanner.png -img/devices/big/webcam.png -img/devices/big/bluetooth.png - -icons taken from the Crystal Projects icons (http://www.everaldo.com/crystal/?action=downloads), licensed under the LGPL license - -img/devices/small/videocard.png -img/devices/small/3G-card.png -img/devices/small/acquisition-card.png.png - -img/devices/big/videocard.png -img/devices/big/3G-card.png -img/devices/big/acquisition-card.png.png - - - -Fingerprint icons: - -The fingerprint icons (listed below) are a derived work from a wikipedia fingerprint icon (http://en.wikipedia.org/wiki/File:Fingerprint_picture.svg) licensed under Creative Commons Attribution-Share Alike 3.0 Unported (http://creativecommons.org/licenses/by-sa/3.0/deed.en) -img/devices/small/fingerprint-reader.png -img/devices/big/fingerprint-reader.png - - - -Libraries: - -odict.py -Copyright (C) 2005 Nicola Larosa, Michael Foord -python library to manage ordered dictionaries -licensed under the terms of the BSD license -E-mail: nico AT tekNico DOT net, fuzzyman AT voidspace DOT org DOT uk -Documentation at http://www.voidspace.org.uk/python/odict.html - diff --git a/h-client/hclient.py b/h-client/hclient.py deleted file mode 100644 index cc4e150..0000000 --- a/h-client/hclient.py +++ /dev/null @@ -1,1117 +0,0 @@ -# -*- coding: utf-8 -*- -# h-client, a client for an h-source server (such as http://www.h-node.com) -# Copyright (C) 2011 Antonio Gallo -# -# -# h-client 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. -# -# h-client 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 h-client. If not, see . - -import pygtk -pygtk.require('2.0') -import gtk - -from hlibrary import * - -class hclient: - - #the device that has to be displaced in the right window - currentDevice = None - currentDeviceCode = None - - #get the active text from a combo - #combo: the gtk combo instance - #default: default value if the active index < 0 - def getActive(self, combo, default = 'not-specified'): - model = combo.get_model() - active = combo.get_active() - if active < 0: - return default - else: - return model[active][0] - - #update the current device object by taking the values from the entries - def applyChanges(self,widget): - self.currentDevice.setModel(self.modelNameEntry.get_text()) - - otherNamesBuffer = self.otherNamesText.get_buffer() - startiter, enditer = otherNamesBuffer.get_bounds() - self.currentDevice.setOtherNames(otherNamesBuffer.get_text(startiter, enditer)) - - self.currentDevice.setSubtype(self.getActive(self.subtypeCombo)) - - self.currentDevice.setYear(self.getActive(self.commYearCombo)) - - self.currentDevice.setInterface(self.getActive(self.interfaceCombo)) - - self.currentDevice.setDistributions([]) - self.currentDevice.addDistributions(self.distributionEntry.get_text()) - - self.currentDevice.setKernel(self.kernelEntry.get_text()) - - self.currentDevice.setHowItWorks(self.getActive(self.howItWorksCombo)) - - self.currentDevice.setDriver(self.driverEntry.get_text()) - - descriptionBuffer = self.descriptionText.get_buffer() - startiter, enditer = descriptionBuffer.get_bounds() - self.currentDevice.setDescription(descriptionBuffer.get_text(startiter, enditer)) - - - #reset the modifications - def resetChanges(self,widget): - self.setEntries() - - - #set the device that has to be displaced in the right window - #and fill the entries - def setCurrentDevice(self, selection): - model, path = selection.get_selected() - if path: - #get the code: - code = model.get_value(path, 1) - - if code in self.client.devices: - - #set the current device - self.currentDevice = self.client.devices[code][0] - self.currentDeviceCode = code - #get the device - - #device = self.client.devices[code][0] - - self.setEntries() - - #make sensitive the apply button - if self.currentDevice.getType() != 'unknown': - self.enableButtons() - else: - self.disableButtons() - - self.setDeviceInfoLabel() - - else: - #make non sensitive the apply button - self.disableButtons() - self.currentDevice = None - self.currentDeviceCode = None - - #self.updateStatus() - - #enable the bottom buttons - def enableButtons(self): - self.applyButton.set_sensitive(True) - self.resetButton.set_sensitive(True) - self.submitButton.set_sensitive(True) - - #disable the bottom buttons - def disableButtons(self): - self.applyButton.set_sensitive(False) - self.resetButton.set_sensitive(False) - self.submitButton.set_sensitive(False) - - #set the top label - def setDeviceInfoLabel(self): - if self.currentDeviceCode != None: - self.bigIcon.set_from_file("img/devices/big/"+self.currentDevice.getIcon()) - if self.client.devices[self.currentDeviceCode][2] == 'insert': - self.deviceInfoLabel.set_markup("this device is not present in the server database,\n would you like to insert it?") - else: - self.deviceInfoLabel.set_markup("this device is already present in the server database,\n would you like to update it?") - - #set the pyGTK device entries - def setEntries(self): - if self.currentDevice != None: - #set the type entry - self.setTypeEntry() - #set the model entry - self.setModelEntry() - #set the other names entry - self.setOtherNamesEntry() - #set the vendorid:productid entry - self.setVendorIdProductIDCode() - #set the subtype entry (in the case of printers) - self.setSubtypeEntry() - #set the commercialization year entry - self.setCommYearEntry() - #set the interface entry - self.setInterfaceEntry() - #set the distribution entry - self.setDistributionEntry() - #set the kernel entry - self.setKernelEntry() - #set the howItWorks entry - self.setHowItWorksEntry() - #set the driver entry - self.setDriverEntry() - #set the description entry - self.setDescriptionEntry() - - - #set the subtype entry (in the case pf printers) - def setTypeEntry(self): - if self.currentDevice.getType() in self.client.getTypes(): - index = self.client.getTypes().index(self.currentDevice.getType()) - else: - index = 0 - - self.typeCombo.set_active(index) - - #set the model name entry - def setModelEntry(self): - self.modelNameEntry.set_text(self.currentDevice.getModel()) - - #set the other names entry - def setOtherNamesEntry(self): - textbuffer = gtk.TextBuffer(table=None) - textbuffer.set_text(self.currentDevice.getOtherNames()) - self.otherNamesText.set_buffer(textbuffer) - - #set the vendorid:productid entry - def setVendorIdProductIDCode(self): - self.vendorIdProductIdEntry.set_text(self.currentDevice.getVendorId() + ':' + self.currentDevice.getProductId()) - - - #set the subtype entry (in the case pf printers) - def setSubtypeEntry(self): - self.subtypeCombo.get_model().clear() - for subtype in self.currentDevice.getSubtypes(): - self.subtypeCombo.append_text(subtype) - - if self.currentDevice.getSubtype() in self.currentDevice.getSubtypes(): - index = self.currentDevice.getSubtypes().index(self.currentDevice.getSubtype()) - else: - index = 0 - - self.subtypeCombo.set_active(index) - - - #set the year of commercialization - def setCommYearEntry(self): - self.commYearCombo.get_model().clear() - for year in self.currentDevice.getYears(): - self.commYearCombo.append_text(year) - - if self.currentDevice.getYear() in self.currentDevice.getYears(): - index = self.currentDevice.getYears().index(self.currentDevice.getYear()) - else: - index = 0 - - self.commYearCombo.set_active(index) - - - #set the interface - def setInterfaceEntry(self): - self.interfaceCombo.get_model().clear() - for interface in self.currentDevice.getInterfaces(): - self.interfaceCombo.append_text(interface) - - if self.currentDevice.getInterface() in self.currentDevice.getInterfaces(): - index = self.currentDevice.getInterfaces().index(self.currentDevice.getInterface()) - else: - index = 0 - - self.interfaceCombo.set_active(index) - - - #set the distribution entry - def setDistributionEntry(self): - self.distributionEntry.set_text(self.currentDevice.createDistroEntry()) - - - #set the kernel libre entry - def setKernelEntry(self): - self.kernelEntry.set_text(self.currentDevice.getKernel()) - - - #set the howItWorks entry - def setHowItWorksEntry(self): - self.howItWorksCombo.get_model().clear() - for option in self.currentDevice.getHowItWorksOptions(): - self.howItWorksCombo.append_text(option) - - if self.currentDevice.getHowItWorks() in self.currentDevice.getHowItWorksOptions(): - index = self.currentDevice.getHowItWorksOptions().index(self.currentDevice.getHowItWorks()) - else: - index = 0 - - self.howItWorksCombo.set_active(index) - - #set the driver entry - def setDriverEntry(self): - self.driverEntry.set_text(self.currentDevice.getDriver()) - - - #set the description entry - def setDescriptionEntry(self): - textbuffer = gtk.TextBuffer(table=None) - textbuffer.set_text(self.currentDevice.getDescription()) - self.descriptionText.set_buffer(textbuffer) - - - #set the node - def setNode(self,widget): - self.client.logout() - self.client.errors = [] - self.client.setNode(self.serverEntry.get_text()) - self.updateStatus() - self.synchronize(None) - self.prefWindow.destroy() - - #close the preferences window - def closePref(self,widget): - self.prefWindow.destroy() - - #login to the server - def login(self,widget): - self.client.login(self.usernameEntry.get_text(),self.passwordEntry.get_text()) - self.updateStatus() - - if self._submitFlag: - if self.client.isLogged(): - self.applyChanges(None) - if self.client.submit(self.currentDeviceCode): - self.synchronize(None) - else: - self.printErrors() - - self._submitFlag = False - - #self.printErrors() - self.loginWindow.destroy() - - #submit data to the server - def submit(self,widget): - self.applyChanges(None) - self.licenseNoticeWindow.destroy() - - if self.client.isLogged(): - if self.client.submit(self.currentDeviceCode): - self.synchronize(None) - else: - self.printErrors() - else: - self._submitFlag = True - self.openLoginWindow(None) - - - - #logout to the server - def logout(self,widget): - self.client.logout() - self.updateStatus() - #self.printErrors() - - #close the login window - def closeLoginWindow(self,widget): - self._submitFlag = False - self.updateStatus() - self.loginWindow.destroy() - - #close the license notice window - def closeLicenseNoticeWindow(self,widget): - self.licenseNoticeWindow.destroy() - - #open the dialog with the software info - def openInfoWindow(self,widget): - about = gtk.AboutDialog() - about.set_program_name("h-node client") - #about.set_version("") - about.set_copyright("(c) Antonio Gallo") - about.set_comments("simple client for h-node.com, licensed under the GPLv3") - about.set_website("http://www.h-node.com") - #about.set_logo(gtk.gdk.pixbuf_new_from_file("battery.png")) - about.run() - about.destroy() - - #close the window containing the list of allowed distribusions - def closeDistroHelperWindow(self,widget): - self.distroHelperWindow.destroy() - - #update the distribution entry - def setDistributions(self,widget): - self.currentDevice.setDistributions(self._tempDistributions) - self.distributionEntry.set_text(self.currentDevice.createDistroEntry()) - self.distroHelperWindow.destroy() - - #add a distrocode to the self._tempDistributions property - def addTempDistribution(self,widget,data): - if widget.get_active(): - self._tempDistributions.append(data) - else: - try: - del self._tempDistributions[self._tempDistributions.index(data)] - except: - pass - - #print self._tempDistributions - - - #window containing the list of allowed distribusions - def openDistroHelperWindow(self,widget,data,a = None,b = None): - - #used to temporarily save the list of distributions from the distribution entry or from the distribution checkButtons - self._tempDistributions = [] - - self.distroHelperWindow = gtk.Window(gtk.WINDOW_TOPLEVEL) - self.distroHelperWindow.set_title("choose the distribution") - self.distroHelperWindow.set_position(gtk.WIN_POS_CENTER) - self.distroHelperWindow.set_icon_from_file("img/icon.png") - self.distroHelperWindow.set_size_request(300, -1) - self.distroHelperWindow.set_transient_for(self.window) - self.distroHelperWindow.set_modal(True) - - self.vboxCh = gtk.VBox(False, 0) - self.vboxCh.set_border_width(10) - self.distroHelperWindow.add(self.vboxCh) - - #fill the self._tempDistributions list with the distros already contained inside the distribution entry - checkedDistros = self.distributionEntry.get_text().split(',') - - for distro in checkedDistros: - if distro != '' and self.client.distroIsAllowed(distro.lstrip().rstrip()): - self._tempDistributions.append(distro.lstrip().rstrip()) - - #create and pack the checkButtons - for distroCode,distroLabel in self.client.allowedDistros.iteritems(): - chbutton = gtk.CheckButton(distroLabel) - if distroCode in self._tempDistributions: - chbutton.set_active(True) - chbutton.connect("clicked", self.addTempDistribution,distroCode) - self.vboxCh.pack_start(chbutton, True, True, 2) - - hbox = gtk.HBox(False, 0) - hbox.set_border_width(10) - applyButton = gtk.Button(stock=gtk.STOCK_APPLY) - closeButton = gtk.Button(stock=gtk.STOCK_CANCEL) - applyButton.connect("clicked", self.setDistributions) - closeButton.connect("clicked", self.closeDistroHelperWindow) - hbox.pack_end(applyButton, False, True, 0) - hbox.pack_end(closeButton, False, True, 3) - self.vboxCh.pack_start(hbox, False, True, 0) - - self.distroHelperWindow.show_all() - - #start the window containing the license notice - def openLicenseNoticeWindow(self,widget): - result = self.client.getLicenseNotice(); - - if result: - #window for preferences - self.licenseNoticeWindow = gtk.Window(gtk.WINDOW_TOPLEVEL) - self.licenseNoticeWindow.set_title("license notice") - self.licenseNoticeWindow.set_position(gtk.WIN_POS_CENTER) - self.licenseNoticeWindow.set_icon_from_file("img/icon.png") - self.licenseNoticeWindow.set_size_request(300, -1) - self.licenseNoticeWindow.set_transient_for(self.window) - self.licenseNoticeWindow.set_modal(True) - - vbox = gtk.VBox(False, 0) - vbox.set_border_width(10) - self.licenseNoticeWindow.add(vbox) - - - #print result - ##if result - - #description input - sw = gtk.ScrolledWindow() - #sw.set_shadow_type(gtk.SHADOW_ETCHED_IN) - sw.set_policy(gtk.POLICY_NEVER, gtk.POLICY_NEVER) - - noticeText = gtk.TextView() - #noticeText.set_decorated(False) - noticeText.set_editable(False) - #noticeText.modify_base(gtk.STATE_NORMAL, gtk.gdk.Color(50,100,150) ) - noticeText.modify_base(gtk.STATE_NORMAL, gtk.gdk.color_parse("#a3a3a3") ) - - noticeText.set_wrap_mode(gtk.WRAP_CHAR) - - textbuffer = gtk.TextBuffer(table=None) - textbuffer.set_text(result) - noticeText.set_buffer(textbuffer) - - sw.add(noticeText) - #sw.show() - #sw.show_all() - - vbox.pack_start(sw, False, True, 5) - - hbox = gtk.HBox(False, 0) - hbox.set_border_width(10) - applyButton = gtk.Button(stock=gtk.STOCK_APPLY) - closeButton = gtk.Button(stock=gtk.STOCK_CANCEL) - applyButton.connect("clicked", self.submit) - closeButton.connect("clicked", self.closeLicenseNoticeWindow) - hbox.pack_end(applyButton, False, True, 0) - hbox.pack_end(closeButton, False, True, 3) - vbox.pack_start(hbox, False, True, 0) - - self.licenseNoticeWindow.show_all() - else: - self.printErrors() - - - #start the login window - def openLoginWindow(self,widget): - - #window for preferences - self.loginWindow = gtk.Window(gtk.WINDOW_TOPLEVEL) - self.loginWindow.set_title("login") - self.loginWindow.set_position(gtk.WIN_POS_CENTER) - self.loginWindow.set_icon_from_file("img/icon.png") - self.loginWindow.set_size_request(300, -1) - self.loginWindow.set_transient_for(self.window) - self.loginWindow.set_modal(True) - - self.window.connect("delete_event", self.delete_event_login) - - #self.prefWindow.set_size_request(300, -1) - - vbox = gtk.VBox(False, 0) - - self.loginWindow.add(vbox) - - table = gtk.Table(4, 2, True) - table.set_border_width(10) - - label = gtk.Label("login to the server") - label.set_use_markup(True) - - vbox.pack_start(label, False, True, 0) - - vbox.pack_start(table, False, True, 0) - - ### username - usernameLabel = gtk.Label("username:") - usernameLabel.set_alignment(0.95,0.5) - #add the label - table.attach(usernameLabel, 0, 1, 0, 1) - - self.usernameEntry = gtk.Entry() - #add the input to the table - table.attach(self.usernameEntry, 1, 2, 0, 1) - - ### password - passwordLabel = gtk.Label("password:") - passwordLabel.set_alignment(0.95,0.5) - #add the label - table.attach(passwordLabel, 0, 1, 1, 2) - - self.passwordEntry = gtk.Entry() - self.passwordEntry.set_visibility(False) - - #add the input to the table - table.attach(self.passwordEntry, 1, 2, 1, 2) - - ### create new account - label = gtk.Label("Create new account") - label.set_use_markup(True) - label.set_alignment(0.98,0.5) - #add the label - table.attach(label, 0, 2, 2, 3) - - ### request new password - label = gtk.Label("Request new password") - label.set_use_markup(True) - label.set_alignment(0.98,0.5) - #add the label - table.attach(label, 0, 2, 3, 4) - - - hbox = gtk.HBox(False, 0) - hbox.set_border_width(10) - applyButton = gtk.Button(stock=gtk.STOCK_APPLY) - closeButton = gtk.Button(stock=gtk.STOCK_CANCEL) - applyButton.connect("clicked", self.login) - closeButton.connect("clicked", self.closeLoginWindow) - hbox.pack_end(applyButton, False, True, 0) - hbox.pack_end(closeButton, False, True, 3) - vbox.pack_start(hbox, False, True, 0) - - self.loginWindow.show_all() - - - #start the preferences window - def openPrefWindow(self,widget): - #window for preferences - self.prefWindow = gtk.Window(gtk.WINDOW_TOPLEVEL) - self.prefWindow.set_title("preferences") - self.prefWindow.set_position(gtk.WIN_POS_CENTER) - self.prefWindow.set_icon_from_file("img/icon.png") - self.prefWindow.set_size_request(300, -1) - self.prefWindow.set_transient_for(self.window) - self.prefWindow.set_modal(True) - - vbox = gtk.VBox(False, 0) - - self.prefWindow.add(vbox) - - table = gtk.Table(1, 2, True) - table.set_border_width(10) - - vbox.pack_start(table, False, True, 0) - - ### server - serverLabel = gtk.Label("Server URL:") - #add the label - table.attach(serverLabel, 0, 1, 0, 1) - - self.serverEntry = gtk.Entry() - self.serverEntry.set_text(self.client.getNode()) - #add the input to the table - table.attach(self.serverEntry, 1, 2, 0, 1) - - hbox = gtk.HBox(False, 0) - hbox.set_border_width(10) - applyButton = gtk.Button(stock=gtk.STOCK_APPLY) - closeButton = gtk.Button(stock=gtk.STOCK_CLOSE) - applyButton.connect("clicked", self.setNode) - closeButton.connect("clicked", self.closePref) - hbox.pack_end(applyButton, False, True, 0) - hbox.pack_end(closeButton, False, True, 3) - vbox.pack_start(hbox, False, True, 0) - #applyButton.connect("clicked", self.applyChanges) - - self.prefWindow.show_all() - - #synchronize with the server XML database - def synchronize(self,widget): - self.client.sync() - self.printErrors() - #print self.client.errors - self.setEntries() - self.setDeviceInfoLabel() - self.setDeviceTree() - - - def printErrors(self): - #destroy the error bar HBox - if hasattr(self, "errorBarHBox"): - self.errorBarHBox.destroy() - - if len(self.client.errors) > 0: - - self.client.errors = list(set(self.client.errors)) - #self.errorBar.set_shadow_type(gtk.SHADOW_ETCHED_IN) - - self.errorBarHBox = gtk.HBox(False, 0) - for error in self.client.errors: - label = gtk.Label(error) - self.errorBarHBox.pack_start(label, False, True, 10) - - self.errorBar.add_with_viewport(self.errorBarHBox) - - self.errorBar.show_all() - - self.client.errors = [] - - #check if the user is logged - #hide or show the login/logout buttons - def updateStatus(self): - if self.client.isLogged() == True: - self.loginButton.hide() - self.logoutButton.show() - info = self.client.getUserInfo() - if info != False: - self.statusLabel.set_markup("hello "+info['username']+", you are logged in") - - if self.currentDeviceCode != None: - self.submitButton.set_sensitive(True) - - else: - self.loginButton.show() - self.logoutButton.hide() - self.statusLabel.set_markup("you are not logged in") - - self.printErrors() - - #delete event of the login window - def delete_event_login(self, widget, event, data=None): - self._submitFlag = False - return False - - - #update the devices' tree - def setDeviceTree(self): - - #get the current selection - ts, itera = self.tree.get_selection().get_selected() - if itera: - path = ts.get_path(itera) - - self.treestore = gtk.TreeStore(str,str,int,gtk.gdk.Pixbuf,int) - - pci = self.treestore.append(None, ["Your PCI Devices","",800,gtk.gdk.pixbuf_new_from_file('img/title_png.png'),4]) - usb = self.treestore.append(None, ["Your USB Devices","",800,gtk.gdk.pixbuf_new_from_file('img/title_png.png'),4]) - for key,dev in self.client.devices.iteritems(): - - if key[0] == 'p': - self.treestore.append(pci, [dev[0].getType(),key,400,gtk.gdk.pixbuf_new_from_file('img/devices/small/'+dev[0].getIcon()),4]) - - if key[0] == 'u': - self.treestore.append(usb, [dev[0].getType(),key,400,gtk.gdk.pixbuf_new_from_file('img/devices/small/'+dev[0].getIcon()),4]) - - self.tree.set_model(self.treestore) - - selection = self.tree.get_selection() - selection.connect('changed', self.setCurrentDevice) - - self.tree.expand_all() - - #select the device on the tree - if itera: - self.tree.get_selection().select_path(path) - else: - #select the first device - self.tree.get_selection().select_path(0) - ts, itera = self.tree.get_selection().get_selected() - if itera: - next = ts.iter_nth_child(itera, 0) - path = ts.get_path(next) - self.tree.get_selection().select_path(path) - - - def delete_event(self, widget, event, data=None): - self.client.logout() - os.system('rm -f tmp/cookies.txt') - os.system('rm -f tmp/temp') - gtk.main_quit() - return False - - def __init__(self): - - #does it have to submit after the login? - self._submitFlag = False - - #start the client object - self.client = Client('www.sandbox.h-node.com') - self.client.createDevices() - - # Create the main window - self.window = gtk.Window(gtk.WINDOW_TOPLEVEL) - - self.window.set_title("h-client") - - self.window.set_icon_from_file("img/icon.png") - self.window.set_size_request(700, -1) - self.window.set_position(gtk.WIN_POS_CENTER) - - self.window.connect("delete_event", self.delete_event) - - #self.window.set_border_width(0) - - vbox = gtk.VBox(False, 0) - - #add the bottom box - self.window.add(vbox) - - self.centerWindow = gtk.HBox(False, 0) - self.bottomWindow = gtk.HBox(False, 0) - - self.errorBar = gtk.ScrolledWindow() - self.errorBar.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_NEVER) - self.errorBar.set_border_width(5) - self.errorBar.set_size_request(-1,50) - self.bottomWindow.add(self.errorBar) - self.errorBarHBox = gtk.HBox(False, 0) - self.errorBar.add_with_viewport(self.errorBarHBox) - self.errorBar.show_all() - - ## build the toolbar ## - toolbar = gtk.Toolbar() - toolbar.set_tooltips(True) - #toolbar.set_style(gtk.TOOLBAR_BOTH) - - pref = gtk.ToolButton(gtk.STOCK_PREFERENCES) - pref.set_tooltip_text('Preferences') - pref.connect("clicked", self.openPrefWindow) - sync = gtk.ToolButton(gtk.STOCK_REFRESH) - sync.set_tooltip_text('Synchronize with the server: this will override the entries of your devices') - sync.connect("clicked", self.synchronize) - info = gtk.ToolButton(gtk.STOCK_INFO) - info.set_tooltip_text('Information') - info.connect("clicked",self.openInfoWindow); - - toolbar.insert(sync, 0) - toolbar.insert(pref, 1) - toolbar.insert(info, 2) - toolbar.show_all() - - vbox.pack_start(toolbar, True, True, 0) - - - vbox.pack_start(self.centerWindow, True, True, 0) - vbox.pack_start(self.bottomWindow, True, True, 0) - vbox.show() - - - ## build the left window ## - - #start the left vertical box - self.leftWindow = gtk.VBox(False, 0) - #self.leftWindow.set_border_width(5) - - self.centerWindow.pack_start(self.leftWindow, True, True, 0) - - #treeFrame.add(self.leftWindow) - #self.centerWindow.pack_start(self.rframe, True, True, 5) - - #self.leftWindow.pack_start(gtk.Label("Your hardware:"), False, True, 5) - - self.tree = gtk.TreeView() - self.tree.set_headers_visible(False) - - self.devices = gtk.TreeViewColumn("Your PCI and USB devices") - - device_icon = gtk.CellRendererPixbuf() - self.devices.pack_start(device_icon, True) - self.devices.add_attribute(device_icon, 'pixbuf', 3) - #self.devices.set_cell_data_func(device_icon, self.setTreeViewCell) - - - device_name = gtk.CellRendererText() - self.devices.pack_start(device_name, True) - self.devices.add_attribute(device_name, "text", 0) - self.devices.add_attribute(device_name, "xpad", 4) - self.devices.add_attribute(device_name, "weight", 2) - - - self.tree.append_column(self.devices) - - - treesw = gtk.ScrolledWindow() - treesw.set_size_request(110,401) - treesw.set_shadow_type(gtk.SHADOW_ETCHED_IN) - treesw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) - treesw.add(self.tree) - - self.leftWindow.set_border_width(5) - self.leftWindow.pack_start(treesw, False, True, 0) - - self.leftWindow.show_all() - - #treeFrame.add(self.leftWindow) - - ## build the right window ## - - #right top - rthbox = gtk.HBox(False, 0) - rthbox.set_border_width(5) - #login button - self.loginButton = gtk.Button("Login") - self.loginButton.set_sensitive(True) - self.loginButton.connect("clicked", self.openLoginWindow) - rthbox.pack_start(self.loginButton, False, True, 0) - - #login button - self.logoutButton = gtk.Button("Logout") - self.logoutButton.set_sensitive(True) - self.logoutButton.connect("clicked", self.logout) - rthbox.pack_start(self.logoutButton, False, True, 0) - - #status label - self.statusLabel = gtk.Label("") - self.statusLabel.set_use_markup(True) - rthbox.pack_end(self.statusLabel, False, True, 0) - - #top image - self.tihbox = gtk.HBox(False, 0) - self.bigIcon = gtk.Image() - self.bigIcon.set_from_file("img/devices/big/unknown.png") - self.tihbox.pack_end(self.bigIcon, False, True, 0) - - self.deviceInfoLabel = gtk.Label("") - self.deviceInfoLabel.set_use_markup(True) - self.tihbox.pack_start(self.deviceInfoLabel, False, True, 3) - - #create the entries - - notebook = gtk.Notebook() - notebook.set_tab_pos(gtk.POS_TOP) - notebook.show() - label_base = gtk.Label("Base") - label_adv = gtk.Label("Advanced") - - self.rightTable = gtk.Table(5, 2, False) - self.rightTableAdvances = gtk.Table(6, 2, False) - - self.rightTable.set_border_width(5) - self.rightTableAdvances.set_border_width(5) - - self.rightTable.set_row_spacings(3) - self.rightTableAdvances.set_row_spacings(3) - - notebook.append_page(self.rightTable, label_base) - notebook.append_page(self.rightTableAdvances, label_adv) - - ###type entry - #year of commercialization label - self.typeLabel = gtk.Label("Select the device category (if not correct):") - self.typeLabel.set_alignment(0.75,0.5) - #add the label - self.rightTable.attach(self.typeLabel, 0, 1, 0, 1) - - self.typeCombo = gtk.combo_box_new_text() - - for dtype in self.client.getTypes(): - self.typeCombo.append_text(dtype) - - #add the combo to the table - self.rightTable.attach(self.typeCombo, 1, 2, 0, 1) - - ### model - #model name label - self.modelNameLabel = gtk.Label("Model name:") - self.modelNameLabel.set_alignment(0.94,0.5) - #add the label - self.rightTable.attach(self.modelNameLabel, 0, 1, 1, 2) - - #model name input - self.modelNameEntry = gtk.Entry() - #add the input to the table - self.rightTable.attach(self.modelNameEntry, 1, 2, 1, 2) - - - ### other names - #other names label - self.otherNamesLabel = gtk.Label("Possible other names of the device:\n( write one name per row )") - self.otherNamesLabel.set_use_markup(True) - self.otherNamesLabel.set_alignment(0.83,0.5) - self.otherNamesLabel.set_justify(gtk.JUSTIFY_RIGHT) - self.rightTable.attach(self.otherNamesLabel, 0, 1, 2, 3) - - #other names text area - s = gtk.ScrolledWindow() - s.set_shadow_type(gtk.SHADOW_ETCHED_IN) - s.set_size_request(-1,50) - s.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) - - self.otherNamesText = gtk.TextView() - #self.otherNamesText.set_size_request(-1,60) - self.otherNamesText.set_wrap_mode(gtk.WRAP_CHAR) - self.otherNamesText.set_left_margin(5) - self.otherNamesText.set_right_margin(5) - - s.add(self.otherNamesText) - s.show() - s.show_all() - self.rightTable.attach(s, 1, 2, 2, 3) - - - ### vendorid:productid - #vendorid:productid label - self.vendorIdProductIdLabel = gtk.Label("VendorID:productID code:") - self.vendorIdProductIdLabel.set_alignment(0.88,0.5) - #add the label - self.rightTableAdvances.attach(self.vendorIdProductIdLabel, 0, 1, 0, 1) - - #vendorid:productid input - self.vendorIdProductIdEntry = gtk.Entry() - #set as not editable - self.vendorIdProductIdEntry.set_editable(False) - #add the input to the table - self.rightTableAdvances.attach(self.vendorIdProductIdEntry, 1, 2, 0, 1) - - - ###subtype - #subtype label - self.subtypeLabel = gtk.Label("Subtype:") - self.subtypeLabel.set_alignment(0.94,0.5) - #add the label - self.rightTableAdvances.attach(self.subtypeLabel, 0, 1, 1, 2) - - #subtype input - self.subtypeCombo = gtk.combo_box_new_text() - #add the input to the table - self.rightTableAdvances.attach(self.subtypeCombo, 1, 2, 1, 2) - - - ###year of commercialization - #year of commercialization label - self.commYearLabel = gtk.Label("Year of commercialization:") - self.commYearLabel.set_alignment(0.87,0.5) - #add the label - self.rightTableAdvances.attach(self.commYearLabel, 0, 1, 2, 3) - - self.commYearCombo = gtk.combo_box_new_text() - - #add the combo to the table - self.rightTableAdvances.attach(self.commYearCombo, 1, 2, 2, 3) - - - ###interface - #interface label - self.interfaceLabel = gtk.Label("Interface:") - self.interfaceLabel.set_alignment(0.94,0.5) - #add the label - self.rightTableAdvances.attach(self.interfaceLabel, 0, 1, 3, 4) - - self.interfaceCombo = gtk.combo_box_new_text() - - self.interfaceCombo.append_text('not-specified') - - self.interfaceCombo.set_active(0) - - #add the combo to the table - self.rightTableAdvances.attach(self.interfaceCombo, 1, 2, 3, 4) - - - ### distribution - #distribution label - self.distributionLabel = gtk.Label("Distribution used: ") - self.distributionLabel.set_alignment(0.95,0.5) - #add the label - self.rightTable.attach(self.distributionLabel, 0, 1, 3, 4) - - #distribution input - self.distributionEntry = gtk.Entry() - self.distributionEntry.connect("button-press-event", self.openDistroHelperWindow) - - - #add the input - self.rightTable.attach(self.distributionEntry, 1, 2, 3, 4) - - - ### kernel - #kernel label - self.kernelLabel = gtk.Label("Kernel libre version:") - self.kernelLabel.set_alignment(0.92,0.5) - #add the label - self.rightTableAdvances.attach(self.kernelLabel, 0, 1, 4, 5) - - #kernel input - self.kernelEntry = gtk.Entry() - #add the input - self.rightTableAdvances.attach(self.kernelEntry, 1, 2, 4, 5) - - - ###how it works - #how it works label - self.howItWorksLabel = gtk.Label("Does it work?") - self.howItWorksLabel.set_alignment(0.95,0.5) - #add the label - self.rightTable.attach(self.howItWorksLabel, 0, 1, 4, 5) - - self.howItWorksCombo = gtk.combo_box_new_text() - - #add the combo to the table - self.rightTable.attach(self.howItWorksCombo, 1, 2, 4, 5) - - - ### driver - #driver label - self.driverLabel = gtk.Label("Free driver used:") - self.driverLabel.set_alignment(0.94,0.5) - #add the label - self.rightTableAdvances.attach(self.driverLabel, 0, 1, 5, 6) - - #driver input - self.driverEntry = gtk.Entry() - #add the input - self.rightTableAdvances.attach(self.driverEntry, 1, 2, 5, 6) - - - ### description - #description label - self.descriptionLabel = gtk.Label("Description:") - self.descriptionLabel.set_alignment(0,0.5) - - #description input - sw = gtk.ScrolledWindow() - sw.set_shadow_type(gtk.SHADOW_ETCHED_IN) - sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) - - self.descriptionText = gtk.TextView() - self.descriptionText.set_wrap_mode(gtk.WRAP_CHAR) - self.descriptionText.set_left_margin(5) - self.descriptionText.set_right_margin(5) - - sw.add(self.descriptionText) - sw.show() - sw.show_all() - - ##add the input - #self.rightTable.attach(sw, 1, 2, 7, 8) - - self.rightTable.show_all() - - #apply and submit buttons - hboxBelowEntries = gtk.HBox(False, 0) - #apply button - self.applyButton = gtk.Button(stock=gtk.STOCK_APPLY) - self.applyButton.set_sensitive(False) - self.applyButton.connect("clicked", self.applyChanges) - self.applyButton.set_tooltip_text('apply your local modifications: no change will be applied to the server') - #reset button - self.resetButton = gtk.Button(stock=gtk.STOCK_REVERT_TO_SAVED) - self.resetButton.set_sensitive(False) - self.resetButton.connect("clicked", self.resetChanges) - self.resetButton.set_tooltip_text('restore the entries') - #submit button - self.submitButton = gtk.Button("Submit") - self.submitButton.set_sensitive(False) - self.submitButton.connect("clicked", self.openLicenseNoticeWindow) - self.submitButton.set_tooltip_text('submit your modifications to the server') - - #create the device tree - self.setDeviceTree() - - hboxBelowEntries.pack_end(self.applyButton, False, True, 0) - hboxBelowEntries.pack_end(self.resetButton, False, True, 0) - hboxBelowEntries.pack_start(self.submitButton, False, True, 0) - hboxBelowEntries.show_all() - - #lFrame = gtk.Frame() - #lFrame.add(rhbox) - #lFrame.set_border_width(5) - - #start the left vertical box - self.rightWindow = gtk.VBox(False, 0) - - self.rightWindow.pack_start(self.tihbox, True, True, 3) - self.rightWindow.pack_start(notebook, False, True, 3) - self.rightWindow.pack_start(self.descriptionLabel, False, True, 3) - self.rightWindow.pack_start(sw, False, True, 0) - self.rightWindow.pack_start(hboxBelowEntries, False, True, 10) - #self.rightWindow.show_all() - - rhbox = gtk.HBox(False, 0) - rhbox.pack_start(self.rightWindow, True, True, 5) - - - rvbox = gtk.VBox(False, 0) - - rvbox.pack_start(rthbox, True, True, 0) - rvbox.pack_start(rhbox, True, True, 0) - - self.centerWindow.pack_start(rvbox, True, True, 0) - - #self.rframe.add(self.rightWindow) - #self.rframe.set_border_width(30) - - self.centerWindow.show_all() - self.bottomWindow.show_all() - self.leftWindow.show() - self.window.show() - - self.synchronize(None) - self.updateStatus() - - #self.logoutButton.hide() - -def main(): - gtk.main() - -if __name__ == "__main__": - Client = hclient() - main() \ No newline at end of file diff --git a/h-client/hlibrary.py b/h-client/hlibrary.py deleted file mode 100644 index 85faca6..0000000 --- a/h-client/hlibrary.py +++ /dev/null @@ -1,1055 +0,0 @@ -# -*- coding: utf-8 -*- -# h-client, a client for an h-source server (such as http://www.h-node.com) -# Copyright (C) 2011 Antonio Gallo -# -# -# h-client 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. -# -# h-client 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 h-client. If not, see . - -import os -import string -import re -import sys -import pycurl -import urllib -import htmlentitydefs -from xml.dom import minidom -from odict import * - - - -class Device(object): - - #from codename to h-source distro code - _distrosTable = { - 'deltah' : 'gnewsense_2_3', - 'metad' : 'gnewsense_3_0', - 'awen' : 'trisquel_3_5', - 'taranis' : 'trisquel_4_0', - 'slaine' : 'trisquel_4_5' - } - - #list of options for the howItWorks entry - _howItWorksOptions = ['yes','no'] - - #list of subtypes - _subtypes = [] - - #allowed years of commercialization - _years = [ - 'not-specified', - '2011', - '2010', - '2009', - '2008', - '2007', - '2006', - '2005', - '2004', - '2003', - '2002', - '2001', - '2000', - '1999', - '1998', - '1997', - '1996', - '1995', - '1994', - '1993', - '1992' - ] - - #list of interfaces - _interfaces = [] - - _status = True - - errors = [] - - def __init__(self): - self._post = {} - self._type = '' - self._vendor = '' - self._model = '' - self._otherNames = '' - self._kernel = '' - self._distributions = [self.userDistribution()] - self._interface = 'not-specified' - self._year = 'not-specified' - self._vendorId = '' - self._productId = '' - self._howItWorks = '' - self._driver = '' - self._description = '' - self._subtype = 'not-specified' - self._icon = 'unknown.png' - - def setPost(self): - self._post['model'] = self._model - self._post['other_names'] = self._otherNames.replace("\n","\r\n") - self._post['kernel'] = self._kernel - self._post['distribution'] = self.createDistroEntry() - self._post['comm_year'] = self._year - self._post['pci_id'] = self._vendorId + ':' + self._productId - self._post['interface'] = self._interface - self._post['description'] = self._description.replace("\n","\r\n") - self._post['driver'] = self._driver - - #replace the HTML entitites with utf-8 characters - def htmlentitiesDecode(self,string): - for entity,code in htmlentitydefs.name2codepoint.iteritems(): - string = string.replace("&"+entity+";",unichr(code)) - string = string.replace("'","'") - return string.encode('utf-8') - - #get the h-source distro code from the codename - def getDistroCode(self,codenameString): - codenames = self._distrosTable.keys() - for codename in codenames: - if codenameString.find(codename) != -1: - return self._distrosTable[codename] - return '' - - #create the distribution entry - def createDistroEntry(self): - cleanDistros = [] - for distro in self._distributions: - cleanDistros.append(distro.lstrip().rstrip()) - - #remove duplicates - cleanDistros = list(set(cleanDistros)) - #sort the elements - cleanDistros = sorted(cleanDistros) - - dis = ' , '.join(cleanDistros) - #correct a strange python behaviour - if dis != '': - if dis[0] == ' , ': - dis = dis[3:] - return dis - - #add a distribution - def addDistribution(self,distroName): - self._distributions.append(distroName) - - #add many distributions - #distroList: comma separated list of distros (type: string) - def addDistributions(self,distroList): - distros = distroList.split(',') - for distro in distros: - self.addDistribution(distro) - - #get the h-source distro code of the user - def userDistribution(self): - if not os.system('cat /etc/*-release | grep CODENAME > tmp/distro'): - f = open('tmp/distro','r') - row = f.readline().rstrip("\n").lower() - f.close(); - os.system('rm -f tmp/distro') - return self.getDistroCode(row) - else: - self._status = False - self.errors.append('tmp folder not writable') - - def getSubtype(self): - return self._subtype - - def getSubtypes(self): - return self._subtypes - - def getHowItWorksOptions(self): - return self._howItWorksOptions - - def getInterfaces(self): - return self._interfaces - - def getYears(self): - return self._years - - def getType(self): - return self._type - - def getVendor(self): - return self._vendor - - def getModel(self): - return self._model - - def getOtherNames(self): - return self._otherNames - - def getKernel(self): - return self._kernel - - def getDistributions(self): - return self._distributions - - def getInterface(self): - return self._interface - - def getYear(self): - return self._year - - def getVendorId(self): - return self._vendorId - - def getProductId(self): - return self._productId - - def getHowItWorks(self): - return self._howItWorks - - def getDriver(self): - return self._driver - - def getDescription(self): - return self._description - - def getIcon(self): - return self._icon - - def setType(self,ttype): - self._type = ttype - - def setVendor(self,vendor): - self._vendor = vendor - - def setModel(self,model): - self._model = model - - def setOtherNames(self,otherNames): - self._otherNames = otherNames - - def setKernel(self,kernel): - self._kernel = kernel - - def setDistributions(self,distributions): - self._distributions = distributions - - def setInterface(self,interface): - self._interface = interface - - def setYear(self,year): - self._year = year - - def setVendorId(self,vendorId): - self._vendorId = vendorId - - def setProductId(self,productId): - self._productId = productId - - def setHowItWorks(self,howItWorks): - self._howItWorks = howItWorks - - def setDriver(self,driver): - self._driver = driver - - def setDescription(self,description): - self._description = description - - def setSubtype(self,subtype): - self._subtype = subtype - - def setIcon(self,icon): - self._icon = icon - - def getStatus(self): - return self._status - - def getPost(self): - return self._post - -class Videocard(Device): - - def __init__(self): - super(Videocard, self).__init__() - self._type = 'videocard' - self._howItWorks = 'does_not_work' - self._interfaces = ['not-specified','PCI','AGP','PCI-E','ISA','MCA','VLB'] - self._howItWorksOptions = ['works_with_3D','works_without_3D','does_not_work'] - self._icon = 'videocard.png' - - def setPost(self): - super(Videocard, self).setPost() - self._post['video_card_works'] = self._howItWorks - -class Wifi(Device): - - def __init__(self): - super(Wifi, self).__init__() - self._type = 'wifi' - self._howItWorks = 'no' - self._interfaces = ['not-specified','USB','PCI','PCI-E','mini-PCI','mini-PCI-E','ExpressCard','PC-Card'] - self._icon = 'wifi.png' - - def setPost(self): - super(Wifi, self).setPost() - self._post['wifi_works'] = self._howItWorks - -class Soundcard(Device): - - def __init__(self): - super(Soundcard, self).__init__() - self._type = 'soundcard' - self._howItWorks = 'no' - self._interfaces = ['not-specified','PCI','ISA','USB','Firewire','Parallel','PCI-E','PCMCIA'] - self._icon = 'soundcard.png' - - def setPost(self): - super(Soundcard, self).setPost() - self._post['sound_card_works'] = self._howItWorks - -class Printer(Device): - - def __init__(self): - super(Printer, self).__init__() - self._type = 'printer' - self._howItWorks = 'C-None' - self._interfaces = ['not-specified','USB','Serial','Parallel','Firewire','SCSI','Ethernet'] - self._howItWorksOptions = ['A-Full','B-Partial','C-None'] - self._subtypes = ['not-specified','laser','inkjet','other'] - self._icon = 'printer.png' - - def setPost(self): - super(Printer, self).setPost() - self._post['compatibility'] = self._howItWorks - self._post['subtype'] = self._subtype - -class Scanner(Device): - - def __init__(self): - super(Scanner, self).__init__() - self._type = 'scanner' - self._howItWorks = 'C-None' - self._interfaces = ['not-specified','USB','Serial','Parallel','Firewire','SCSI','Ethernet'] - self._howItWorksOptions = ['A-Full','B-Partial','C-None'] - self._icon = 'scanner.png' - - def setPost(self): - super(Scanner, self).setPost() - self._post['compatibility'] = self._howItWorks - -class Threegcard(Device): - - def __init__(self): - super(Threegcard, self).__init__() - self._type = '3G-card' - self._howItWorks = 'no' - self._interfaces = ['not-specified','USB','PCI','PCI-E','mini-PCI','mini-PCI-E','ExpressCard','PC-Card'] - self._icon = '3G-card.png' - - def setPost(self): - super(Threegcard, self).setPost() - self._post['wifi_works'] = self._howItWorks - -class Webcam(Device): - - def __init__(self): - super(Webcam, self).__init__() - self._type = 'webcam' - self._howItWorks = 'no' - self._interfaces = ['not-specified','USB','Firewire','Parallel','Wifi','Serial'] - self._icon = 'webcam.png' - - def setPost(self): - super(Webcam, self).setPost() - self._post['webcam_works'] = self._howItWorks - -class Bluetooth(Device): - - def __init__(self): - super(Bluetooth, self).__init__() - self._type = 'bluetooth' - self._howItWorks = 'no' - self._interfaces = ['not-specified','USB','PCI','PCI-E','mini-PCI','mini-PCI-E','ExpressCard','PC-Card'] - self._icon = 'bluetooth.png' - - def setPost(self): - super(Bluetooth, self).setPost() - self._post['bluetooth_works'] = self._howItWorks - -class Acquisitioncard(Device): - - def __init__(self): - super(Acquisitioncard, self).__init__() - self._type = 'acquisition-card' - self._howItWorks = 'no' - self._interfaces = ['not-specified','USB','PCI','PCI-E','mini-PCI','mini-PCI-E','ExpressCard','PC-Card','Firewire','Parallel','Serial'] - self._icon = 'acquisition-card.png' - - def setPost(self): - super(Acquisitioncard, self).setPost() - self._post['compatibility'] = self._howItWorks - -class Fingerprintreader(Device): - - def __init__(self): - super(Fingerprintreader, self).__init__() - self._type = 'fingerprint-reader' - self._howItWorks = 'no' - self._interfaces = ['not-specified','USB','PCI','PCI-E','mini-PCI','mini-PCI-E','ExpressCard','PC-Card','Firewire','Parallel','Serial'] - self._icon = 'fingerprint-reader.png' - - def setPost(self): - super(Fingerprintreader, self).setPost() - self._post['fingerprint_works'] = self._howItWorks - -class Unknown(Device): - - def __init__(self): - super(Unknown, self).__init__() - self._type = 'unknown' - self._howItWorks = 'no' - self._interfaces = ['not-specified','USB'] - self._icon = 'unknown.png' - - def setPost(self): - super(Unknown, self).setPost() - -#class to carry out http requests by means of pycurl -class Mycurl: - - _post = None - - #set the domain - def __init__(self,domain): - self.contents = '' - self.setDomain(domain) - - def getStatus(self): - return self._status - - def setDomain(self,domain): - self.domain = domain - #check if the trailing slash is present - if len(self.domain) > 1: - if self.domain[len(self.domain)-1] != '/': - self.domain += '/' - - def getDomain(self): - return self.domain - - def setPost(self,post): - self._post = post - - def body_callback(self, buf): - self.contents = self.contents + buf - - #perform the HTTP request - def perform(self,requestUri = ''): - - self.url = self.domain + requestUri; - #print self.url - self.contents = '' - c = pycurl.Curl() - c.setopt(c.URL, self.url) - c.setopt(pycurl.COOKIEFILE, 'tmp/cookies.txt') - c.setopt(pycurl.COOKIEJAR, 'tmp/cookies.txt') - if self._post != None: - c.setopt(c.POSTFIELDS, urllib.urlencode(self._post)) - c.setopt(c.WRITEFUNCTION, self.body_callback) - - try: - c.perform() - result = True - except: - result = False - - #print c.getinfo(c.HTTP_CODE) - #result = False - #if c.getinfo(c.HTTP_CODE) == 200: - #result = True - - c.close() - return result - -class Client: - - devices = {} - - _status = True - errors = [] - - _types = { - '0403' : { - 'type' : 'soundcard', - 'controller': 'soundcards' - }, - '0280' : { - 'type' : 'wifi', - 'controller': 'wifi' - }, - '0300' : { - 'type' : 'videocard', - 'controller': 'videocards' - }, - '070100' : { - 'type' : 'printer', - 'controller': 'printers' - }, - '070101' : { - 'type' : 'printer', - 'controller': 'printers' - }, - '070102' : { - 'type' : 'printer', - 'controller': 'printers' - }, - '070103' : { - 'type' : 'printer', - 'controller': 'printers' - }, - '0701ff' : { - 'type' : 'printer', - 'controller': 'printers' - }, - 'e00101' : { - 'type' : 'bluetooth', - 'controller': 'bluetooth' - }, - '020205' : { - 'type' : '3G-card', - 'controller': 'threegcards' - }, - '0e0100' : { - 'type' : 'webcam', - 'controller': 'webcams' - }, - 'ff0100' : { - 'type' : 'webcam', - 'controller': 'webcams' - }, - '060101' : { - 'type' : 'scanner', - 'controller': 'scanners' - }, - '0d0000' : { - 'type' : 'fingerprint-reader', - 'controller': 'fingerprintreaders' - }, - 'ffffff' : { - 'type' : 'unknown', - 'controller': 'unknown' - } - } - - def __init__(self,url = ''): - - self.request = Mycurl(url) - - #create the allowedDistros ordered dictionary - self.allowedDistros = OrderedDict([ - ('blag_90001','BLAG 90001'), - ('blag_120000','BLAG 120000'), - ('dragora_1_1','Dragora 1.1'), - ('dragora_2_0','Dragora 2.0 Ardi'), - ('dynebolic_2_5_2','Dynebolic 2.5.2 DHORUBA'), - ('gnewsense_2_3','gNewSense 2.3 Deltah'), - ('gnewsense_3_0','gNewSense 3.0 Metad'), - ('musix_2_0','Musix GNU+Linux 2.0 R0'), - ('parabola','Parabola GNU/Linux'), - ('trisquel_3_5','Trisquel 3.5 Awen'), - ('trisquel_4_0','Trisquel 4.0 Taranis'), - ('trisquel_4_5','Trisquel 4.5 Slaine'), - ('ututo_xs_2009','UTUTO XS 2009'), - ('ututo_xs_2010','UTUTO XS 2010'), - ('venenux_0_8','VENENUX 0.8'), - ('venenux_0_8_2','VENENUX-EC 0.8.2')] - ) - - - #get the list of types - def getTypes(self): - types = [] - for Class,struct in self._types.iteritems(): - if struct['type'] not in types: - types.append(struct['type']) - return types - - #check if a distro code is allowed or not - def distroIsAllowed(self,distroCode): - allowedDistroCodes = self.allowedDistros.keys() - if distroCode in allowedDistroCodes: - return True - return False - - def getNode(self): - return self.request.getDomain() - - def setNode(self,domain): - self.request.setDomain(domain) - - #get the type from the Class id - def getType(self, Class): - Classes = self._types.keys() - if Class in Classes: - return self._types[Class]['type'] - return None - - #get the controller from the Class id - def getController(self, Class): - Classes = self._types.keys() - if Class in Classes: - return self._types[Class]['controller'] - return None - - #return a device object - def getObject(self,Class): - if Class == '0403': - return Soundcard() - elif Class == '0280': - return Wifi() - elif Class == '0300': - return Videocard() - elif Class == '070100' or Class == '070101' or Class == '070102' or Class == '070103' or Class == '0701ff': - return Printer() - elif Class == '0e0100' or Class == 'ff0100': - return Webcam() - elif Class == 'e00101': - return Bluetooth() - elif Class == '060101': - return Scanner() - elif Class == '0d0000': - return Fingerprintreader() - elif Class == '020205': - return Threegcard() - elif Class == 'ffffff': - return Unknown() - else: - return None - - def getObjectFromType(self,Type): - if Type == 'soundcard': - return Soundcard() - elif Type == 'wifi': - return Wifi() - elif Type == 'videocard': - return Videocard() - elif Type == 'printer': - return Printer() - elif Type == 'webcam': - return Webcam() - elif Type == 'bluetooth': - return Bluetooth() - elif Type == 'scanner': - return Scanner() - elif Type == 'fingerprint-reader': - return Fingerprintreader() - elif Type == '3G-card': - return Threegcard() - else: - return None - - #get the class from the type - def getClassFromType(self,Type): - for Class,struct in self._types.iteritems(): - if struct['type'] == Type: - return Class - - #get the kernel version - def getKernel(self): - if not os.system('uname -r > tmp/kernel'): - f = open('tmp/kernel','r') - row = f.readline().replace("\n","") - f.close(); - os.system('rm -f tmp/kernel') - return row - else: - self._status = False - self.errors.append('tmp folder not writable') - - #log in - def login(self, username, password): - self.request.setPost({'username' : username, 'password' : password}) - result = self.request.perform('users/login/en') - self.request.setPost(None) - if result: - if self.isLogged(): - return True - else: - self.errors.append("wrong username or password") - else: - self.errors.append("unable to connect to server") - - return False - - #log out - def logout(self): - result = self.request.perform('users/logout/en') - - if result: - return True - else: - self.errors.append("unable to connect to server") - return False - - #get info about the user logged - def getUserInfo(self): - result = self.request.perform('client/userinfo/en') - - if result: - try: - xmldoc = minidom.parseString(self.request.contents) - status = xmldoc.getElementsByTagName("status")[0].childNodes[0].data - - username = '' - token = '' - groups = '' - - if status == 'logged': - username = xmldoc.getElementsByTagName("username")[0].childNodes[0].data - token = xmldoc.getElementsByTagName("token")[0].childNodes[0].data - groups = xmldoc.getElementsByTagName("groups")[0].childNodes[0].data - - return {'status':status,'username':username,'token':token,'groups':groups} - except: - self.errors.append("the server is not up-to-date: unable to parse the xml database") - return False - else: - self.errors.append("unable to connect to server") - return False - - #return True if the user is logged, else return False - def isLogged(self): - info = self.getUserInfo() - - if info != False: - if info['status'] == 'logged': - return True - - return False - - #return the license info - def getLicenseNotice(self): - result = self.request.perform("client/licenseinfo/en"); - if result: - xmldoc = minidom.parseString(self.request.contents) - notice = xmldoc.getElementsByTagName("license_info")[0].childNodes[0].data.encode('utf-8') - return notice - else: - self.errors.append("unable to connect to server") - return False - - - def addLeadingZero(self,string): - if len(string) == 1: - return '0'+string - else: - return string - - - def createDevices(self): - #parse the poutput of the lspci command - if not os.system('lspci -vmmnn > tmp/temp'): - f = open('tmp/temp','r') - - while 1: - row = f.readline() - - if not row: - break - - #get the slot - if row.find('Slot') != -1: - #get the class - row = f.readline().rstrip("\n") - if row: - cl = re.match('Class\:(.*)\[(.*)\]',row,re.I) - if cl: - #get the object - dev = self.getObject(cl.group(2)) - if dev: - #set the type attribute of the device object - dev.setType(self.getType(cl.group(2))) - #get the vendorid - row = f.readline().rstrip("\n") - if row: - vn = re.match('Vendor\:(.*)\[(.*)\]',row,re.I) - if vn: - dev.setVendorId(vn.group(2).lstrip("\t")) - #get the productid - row = f.readline().rstrip("\n") - if row: - pr = re.match('Device\:(.*)\[(.*)\]',row,re.I) - if pr: - dev.setProductId(pr.group(2).lstrip("\t")) - dev.setModel(pr.group(1).lstrip("\t")) - - dev.setKernel(self.getKernel()) - - self.devices['p_' + dev.getVendorId() + ':' + dev.getProductId()] = [dev,cl.group(2),'insert','0'] - - else: - self.errors.append('the lspci -vmmnn output is not a standard output, some products row not found') - else: - self.errors.append('the lspci -vmmnn output is not a standard output, some vendors row not found') - else: - self.errors.append('the lspci -vmmnn output is not a standard output, some class row not found') - - f.close(); - else: - self.errors.append('tmp folder not writable') - - - #parse the output of the lsusb command - if not os.system('lsusb -v > tmp/temp'): - f = open('tmp/temp','r') - - deviceDict = {} - - keyNumber = 0 - usbDeviceIsFound = 'N' - - while 1: - row = f.readline() - crow = row.replace("\n","").lstrip().rstrip() - - if not row: - break - - #clear pid and vid if a new device has been found - if row.find('Device Descriptor:') != -1 and row.find('HID Device Descriptor:') == -1: - usbDeviceIsFound = 'N' - keyNumber = keyNumber + 1 - keyString = str(keyNumber) - deviceDict[keyString] = {} - - #find the vendor - if crow.find('idVendor') != -1: - #print crow - res = re.match('idVendor(.*)0x([a-zA-Z0-9]{4})(.*)',crow,re.I) - if res: - deviceDict[keyString]['vendorId'] = res.group(2).lstrip().rstrip() - deviceDict[keyString]['vendorName'] = res.group(3).lstrip().rstrip() - - #find the product - if crow.find('idProduct') != -1: - #print crow - res = re.match('idProduct(.*)0x([a-zA-Z0-9]{4})(.*)',crow,re.I) - if res: - deviceDict[keyString]['productId'] = res.group(2).lstrip().rstrip() - deviceDict[keyString]['productName'] = res.group(3).lstrip().rstrip() - - if usbDeviceIsFound == 'N': - #find the class - if crow.find('bInterfaceClass') != -1: - #print crow - res = re.match('bInterfaceClass([\s]*)([0-9]*)(.*)',crow,re.I) - if res: - cl = hex(int(res.group(2).lstrip().rstrip())) - deviceDict[keyString]['classId'] = self.addLeadingZero(cl[2:]) - deviceDict[keyString]['className'] = res.group(3).lstrip().rstrip() - - #find the subclass - if crow.find('bInterfaceSubClass') != -1: - #print crow - res = re.match('bInterfaceSubClass([\s]*)([0-9]*)(.*)',crow,re.I) - if res: - cl = hex(int(res.group(2).lstrip().rstrip())) - deviceDict[keyString]['subclassId'] = self.addLeadingZero(cl[2:]) - deviceDict[keyString]['subclassName'] = res.group(3).lstrip().rstrip() - - #find the protocol - if crow.find('bInterfaceProtocol') != -1: - #print crow - res = re.match('bInterfaceProtocol([\s]*)([0-9]*)(.*)',crow,re.I) - if res: - cl = hex(int(res.group(2).lstrip().rstrip())) - deviceDict[keyString]['protocolId'] = self.addLeadingZero(cl[2:]) - deviceDict[keyString]['protocolName'] = res.group(3).lstrip().rstrip() - - currentClassCode = str(deviceDict[keyString]['classId'])+str(deviceDict[keyString]['subclassId'])+str(deviceDict[keyString]['protocolId']) - - if self.getObject(currentClassCode) and currentClassCode != 'ffffff': - usbDeviceIsFound = 'Y' - - f.close(); - - #create the USB devices - for key,value in deviceDict.iteritems(): - Class = str(value['classId']) + str(value['subclassId']) + str(value['protocolId']) - - #get the USB object - dev = self.getObject(Class) - if dev: - dev.setType(self.getType(Class)) - dev.setVendorId(value['vendorId']) - dev.setInterface('USB') - dev.setProductId(value['productId']) - dev.setModel(value['productName']) - - dev.setKernel(self.getKernel()) - - self.devices['u_' + dev.getVendorId() + ':' + dev.getProductId()] = [dev,Class,'insert','0'] - - else: - self.errors.append('tmp folder not writable') - - #change the type of a device - #deviceCode: the code of the device - #nType: the new type of the device - def changeType(self,deviceCode,nType): - dev = self.getObjectFromType(nType) - - if dev != None: - dev.setModel(self.devices[deviceCode][0].getModel()) - dev.setOtherNames(self.devices[deviceCode][0].getOtherNames()) - dev.setKernel(self.devices[deviceCode][0].getKernel()) - dev.setDistributions(self.devices[deviceCode][0].getDistributions()) - dev.setInterface(self.devices[deviceCode][0].getInterface()) - dev.setYear(self.devices[deviceCode][0].getYear()) - dev.setVendorId(self.devices[deviceCode][0].getVendorId()) - dev.setProductId(self.devices[deviceCode][0].getProductId()) - dev.setHowItWorks(self.devices[deviceCode][0].getHowItWorks()) - dev.setDriver(self.devices[deviceCode][0].getDriver()) - dev.setDescription(self.devices[deviceCode][0].getDescription()) - dev.setSubtype(self.devices[deviceCode][0].getSubtype()) - dev.setIcon(nType+".png") - - Class = self.getClassFromType(nType) - self.devices[deviceCode][0] = dev - self.devices[deviceCode][1] = Class - - - #syncronize with the xml database - def sync(self): - - #perform an http request - self.request.contents = '' - - result = self.request.perform('download/all/en') - #print result - if result: - - #loop the found devices - for key,dev in self.devices.iteritems(): - #find the class - #Class = dev[1] - vendorid_productid = key[2:] - - #reset the device params - dev[2] = 'insert' - dev[3] = '0' - - #parse the xml database - try: - xmldoc = minidom.parseString(self.request.contents) - devices = xmldoc.getElementsByTagName("device") - for device in devices: - - #check it is not a notebook - deviceType = device.getElementsByTagName("type")[0].childNodes[0].data.encode('utf-8') - - if deviceType != 'notebook': - code = device.getElementsByTagName("vendorid_productid")[0] - if code.hasChildNodes(): - if code.childNodes[0].data == vendorid_productid: - - if deviceType != dev[0].getType(): - self.changeType(key,deviceType) - - modelName = device.getElementsByTagName("model_name")[0].childNodes[0].data.encode('utf-8') - interface = device.getElementsByTagName("interface")[0].childNodes[0].data.encode('utf-8') - distribution = device.getElementsByTagName("distribution")[0].childNodes[0].data.encode('utf-8') - idDevice = device.getElementsByTagName("id")[0].childNodes[0].data.encode('utf-8') - - if deviceType == 'printer' or deviceType == 'scanner': - works = device.getElementsByTagName("compatibility")[0].childNodes[0].data.encode('utf-8') - - if deviceType == 'printer': - #set the subtype - subtype = device.getElementsByTagName("subtype")[0].childNodes[0].data.encode('utf-8') - dev[0].setSubtype(subtype) - else: - works = device.getElementsByTagName("it_works")[0].childNodes[0].data.encode('utf-8') - - year = device.getElementsByTagName("year")[0].childNodes[0].data.encode('utf-8') - - if device.getElementsByTagName("other_names")[0].hasChildNodes(): - other_names = device.getElementsByTagName("other_names")[0].childNodes[0].data.encode('utf-8') - dev[0].setOtherNames(other_names) - else: - dev[0].setOtherNames('') - - if device.getElementsByTagName("description")[0].hasChildNodes(): - description = device.getElementsByTagName("description")[0].childNodes[0].data.encode('utf-8') - dev[0].setDescription(dev[0].htmlentitiesDecode(description)) - else: - dev[0].setDescription('') - - if device.getElementsByTagName("kernel_libre")[0].hasChildNodes(): - kernel_libre = device.getElementsByTagName("kernel_libre")[0].childNodes[0].data.encode('utf-8') - dev[0].setKernel(kernel_libre) - - if device.getElementsByTagName("driver")[0].hasChildNodes(): - driver = device.getElementsByTagName("driver")[0].childNodes[0].data.encode('utf-8') - dev[0].setDriver(driver) - else: - dev[0].setDriver('') - - #print modelName - dev[0].setModel(modelName) - dev[0].setInterface(interface) - dev[0].setDistributions([]) - dev[0].addDistributions(distribution) - dev[0].setHowItWorks(works) - dev[0].setYear(year) - dev[2] = 'update' - dev[3] = idDevice - except: - self.errors.append("the server is not up-to-date: unable to parse the xml database") - else: - self.errors.append("unable to connect to server") - - - def submit(self,deviceCode = None): - for key,dev in self.devices.iteritems(): - if key == deviceCode or deviceCode == None: - dev[0].setPost() - post = dev[0].getPost() - - #get the node controller - controller = self.getController(dev[1]) - - #get the user info - info = self.getUserInfo() - token = info['token'] - - post['from_client'] = 'yes' - - if dev[2] == 'update': - - post['id_hard'] = dev[3] - post['updateAction'] = 'update' - url = controller + '/update/en/' + token - - elif dev[2] == 'insert': - - post['insertAction'] = 'insert' - url = controller + '/insert/en/' + token - - self.request.setPost(post) - self.request.perform(url.encode('utf-8')) - - #parse the response - xmldoc = minidom.parseString(self.request.contents) - response = xmldoc.getElementsByTagName("status")[0].childNodes[0].data.encode('utf-8') - - notice = xmldoc.getElementsByTagName("notice")[0].childNodes[1].data.encode('utf-8') - self.errors.append(notice.lstrip().rstrip()) - - if response == 'executed': - return True - else: - return False \ No newline at end of file diff --git a/h-client/img/devices/big/3G-card.png b/h-client/img/devices/big/3G-card.png deleted file mode 100755 index 4ae2ba5..0000000 Binary files a/h-client/img/devices/big/3G-card.png and /dev/null differ diff --git a/h-client/img/devices/big/acquisition-card.png b/h-client/img/devices/big/acquisition-card.png deleted file mode 100755 index d39e18a..0000000 Binary files a/h-client/img/devices/big/acquisition-card.png and /dev/null differ diff --git a/h-client/img/devices/big/bluetooth.png b/h-client/img/devices/big/bluetooth.png deleted file mode 100755 index 8f755b9..0000000 Binary files a/h-client/img/devices/big/bluetooth.png and /dev/null differ diff --git a/h-client/img/devices/big/fingerprint-reader.png b/h-client/img/devices/big/fingerprint-reader.png deleted file mode 100644 index ba0e754..0000000 Binary files a/h-client/img/devices/big/fingerprint-reader.png and /dev/null differ diff --git a/h-client/img/devices/big/printer.png b/h-client/img/devices/big/printer.png deleted file mode 100755 index b857d9e..0000000 Binary files a/h-client/img/devices/big/printer.png and /dev/null differ diff --git a/h-client/img/devices/big/scanner.png b/h-client/img/devices/big/scanner.png deleted file mode 100755 index 4501fcf..0000000 Binary files a/h-client/img/devices/big/scanner.png and /dev/null differ diff --git a/h-client/img/devices/big/soundcard.png b/h-client/img/devices/big/soundcard.png deleted file mode 100755 index 3bf4c8a..0000000 Binary files a/h-client/img/devices/big/soundcard.png and /dev/null differ diff --git a/h-client/img/devices/big/unknown.png b/h-client/img/devices/big/unknown.png deleted file mode 100755 index c2ab531..0000000 Binary files a/h-client/img/devices/big/unknown.png and /dev/null differ diff --git a/h-client/img/devices/big/videocard.png b/h-client/img/devices/big/videocard.png deleted file mode 100755 index 507e52a..0000000 Binary files a/h-client/img/devices/big/videocard.png and /dev/null differ diff --git a/h-client/img/devices/big/webcam.png b/h-client/img/devices/big/webcam.png deleted file mode 100755 index 696bc13..0000000 Binary files a/h-client/img/devices/big/webcam.png and /dev/null differ diff --git a/h-client/img/devices/big/wifi.png b/h-client/img/devices/big/wifi.png deleted file mode 100755 index 06a8a18..0000000 Binary files a/h-client/img/devices/big/wifi.png and /dev/null differ diff --git a/h-client/img/devices/small/3G-card.png b/h-client/img/devices/small/3G-card.png deleted file mode 100755 index 97da84a..0000000 Binary files a/h-client/img/devices/small/3G-card.png and /dev/null differ diff --git a/h-client/img/devices/small/acquisition-card.png b/h-client/img/devices/small/acquisition-card.png deleted file mode 100755 index d4d2595..0000000 Binary files a/h-client/img/devices/small/acquisition-card.png and /dev/null differ diff --git a/h-client/img/devices/small/bluetooth.png b/h-client/img/devices/small/bluetooth.png deleted file mode 100755 index c0b3f06..0000000 Binary files a/h-client/img/devices/small/bluetooth.png and /dev/null differ diff --git a/h-client/img/devices/small/fingerprint-reader.png b/h-client/img/devices/small/fingerprint-reader.png deleted file mode 100644 index 5593419..0000000 Binary files a/h-client/img/devices/small/fingerprint-reader.png and /dev/null differ diff --git a/h-client/img/devices/small/printer.png b/h-client/img/devices/small/printer.png deleted file mode 100755 index 6e110de..0000000 Binary files a/h-client/img/devices/small/printer.png and /dev/null differ diff --git a/h-client/img/devices/small/scanner.png b/h-client/img/devices/small/scanner.png deleted file mode 100755 index d7b57e0..0000000 Binary files a/h-client/img/devices/small/scanner.png and /dev/null differ diff --git a/h-client/img/devices/small/soundcard.png b/h-client/img/devices/small/soundcard.png deleted file mode 100755 index d5a7ad4..0000000 Binary files a/h-client/img/devices/small/soundcard.png and /dev/null differ diff --git a/h-client/img/devices/small/unknown.png b/h-client/img/devices/small/unknown.png deleted file mode 100755 index 86b6407..0000000 Binary files a/h-client/img/devices/small/unknown.png and /dev/null differ diff --git a/h-client/img/devices/small/videocard.png b/h-client/img/devices/small/videocard.png deleted file mode 100755 index efffd46..0000000 Binary files a/h-client/img/devices/small/videocard.png and /dev/null differ diff --git a/h-client/img/devices/small/webcam.png b/h-client/img/devices/small/webcam.png deleted file mode 100755 index 8a0b339..0000000 Binary files a/h-client/img/devices/small/webcam.png and /dev/null differ diff --git a/h-client/img/devices/small/wifi.png b/h-client/img/devices/small/wifi.png deleted file mode 100755 index 94c4058..0000000 Binary files a/h-client/img/devices/small/wifi.png and /dev/null differ diff --git a/h-client/img/icon.png b/h-client/img/icon.png deleted file mode 100644 index 7f61564..0000000 Binary files a/h-client/img/icon.png and /dev/null differ diff --git a/h-client/img/title_png.png b/h-client/img/title_png.png deleted file mode 100644 index 8184ebd..0000000 Binary files a/h-client/img/title_png.png and /dev/null differ diff --git a/h-client/odict.py b/h-client/odict.py deleted file mode 100644 index 2c8391d..0000000 --- a/h-client/odict.py +++ /dev/null @@ -1,1399 +0,0 @@ -# odict.py -# An Ordered Dictionary object -# Copyright (C) 2005 Nicola Larosa, Michael Foord -# E-mail: nico AT tekNico DOT net, fuzzyman AT voidspace DOT org DOT uk - -# This software is licensed under the terms of the BSD license. -# http://www.voidspace.org.uk/python/license.shtml -# Basically you're free to copy, modify, distribute and relicense it, -# So long as you keep a copy of the license with it. - -# Documentation at http://www.voidspace.org.uk/python/odict.html -# For information about bugfixes, updates and support, please join the -# Pythonutils mailing list: -# http://groups.google.com/group/pythonutils/ -# Comments, suggestions and bug reports welcome. - -"""A dict that keeps keys in insertion order""" -from __future__ import generators - -__author__ = ('Nicola Larosa ,' - 'Michael Foord ') - -__docformat__ = "restructuredtext en" - -__revision__ = '$Id: odict.py 129 2005-09-12 18:15:28Z teknico $' - -__version__ = '0.2.2' - -__all__ = ['OrderedDict', 'SequenceOrderedDict'] - -import sys -INTP_VER = sys.version_info[:2] -if INTP_VER < (2, 2): - raise RuntimeError("Python v.2.2 or later required") - -import types, warnings - -class OrderedDict(dict): - """ - A class of dictionary that keeps the insertion order of keys. - - All appropriate methods return keys, items, or values in an ordered way. - - All normal dictionary methods are available. Update and comparison is - restricted to other OrderedDict objects. - - Various sequence methods are available, including the ability to explicitly - mutate the key ordering. - - __contains__ tests: - - >>> d = OrderedDict(((1, 3),)) - >>> 1 in d - 1 - >>> 4 in d - 0 - - __getitem__ tests: - - >>> OrderedDict(((1, 3), (3, 2), (2, 1)))[2] - 1 - >>> OrderedDict(((1, 3), (3, 2), (2, 1)))[4] - Traceback (most recent call last): - KeyError: 4 - - __len__ tests: - - >>> len(OrderedDict()) - 0 - >>> len(OrderedDict(((1, 3), (3, 2), (2, 1)))) - 3 - - get tests: - - >>> d = OrderedDict(((1, 3), (3, 2), (2, 1))) - >>> d.get(1) - 3 - >>> d.get(4) is None - 1 - >>> d.get(4, 5) - 5 - >>> d - OrderedDict([(1, 3), (3, 2), (2, 1)]) - - has_key tests: - - >>> d = OrderedDict(((1, 3), (3, 2), (2, 1))) - >>> d.has_key(1) - 1 - >>> d.has_key(4) - 0 - """ - - def __init__(self, init_val=(), strict=False): - """ - Create a new ordered dictionary. Cannot init from a normal dict, - nor from kwargs, since items order is undefined in those cases. - - If the ``strict`` keyword argument is ``True`` (``False`` is the - default) then when doing slice assignment - the ``OrderedDict`` you are - assigning from *must not* contain any keys in the remaining dict. - - >>> OrderedDict() - OrderedDict([]) - >>> OrderedDict({1: 1}) - Traceback (most recent call last): - TypeError: undefined order, cannot get items from dict - >>> OrderedDict({1: 1}.items()) - OrderedDict([(1, 1)]) - >>> d = OrderedDict(((1, 3), (3, 2), (2, 1))) - >>> d - OrderedDict([(1, 3), (3, 2), (2, 1)]) - >>> OrderedDict(d) - OrderedDict([(1, 3), (3, 2), (2, 1)]) - """ - self.strict = strict - dict.__init__(self) - if isinstance(init_val, OrderedDict): - self._sequence = init_val.keys() - dict.update(self, init_val) - elif isinstance(init_val, dict): - # we lose compatibility with other ordered dict types this way - raise TypeError('undefined order, cannot get items from dict') - else: - self._sequence = [] - self.update(init_val) - -### Special methods ### - - def __delitem__(self, key): - """ - >>> d = OrderedDict(((1, 3), (3, 2), (2, 1))) - >>> del d[3] - >>> d - OrderedDict([(1, 3), (2, 1)]) - >>> del d[3] - Traceback (most recent call last): - KeyError: 3 - >>> d[3] = 2 - >>> d - OrderedDict([(1, 3), (2, 1), (3, 2)]) - >>> del d[0:1] - >>> d - OrderedDict([(2, 1), (3, 2)]) - """ - if isinstance(key, types.SliceType): - # FIXME: efficiency? - keys = self._sequence[key] - for entry in keys: - dict.__delitem__(self, entry) - del self._sequence[key] - else: - # do the dict.__delitem__ *first* as it raises - # the more appropriate error - dict.__delitem__(self, key) - self._sequence.remove(key) - - def __eq__(self, other): - """ - >>> d = OrderedDict(((1, 3), (3, 2), (2, 1))) - >>> d == OrderedDict(d) - True - >>> d == OrderedDict(((1, 3), (2, 1), (3, 2))) - False - >>> d == OrderedDict(((1, 0), (3, 2), (2, 1))) - False - >>> d == OrderedDict(((0, 3), (3, 2), (2, 1))) - False - >>> d == dict(d) - False - >>> d == False - False - """ - if isinstance(other, OrderedDict): - # FIXME: efficiency? - # Generate both item lists for each compare - return (self.items() == other.items()) - else: - return False - - def __lt__(self, other): - """ - >>> d = OrderedDict(((1, 3), (3, 2), (2, 1))) - >>> c = OrderedDict(((0, 3), (3, 2), (2, 1))) - >>> c < d - True - >>> d < c - False - >>> d < dict(c) - Traceback (most recent call last): - TypeError: Can only compare with other OrderedDicts - """ - if not isinstance(other, OrderedDict): - raise TypeError('Can only compare with other OrderedDicts') - # FIXME: efficiency? - # Generate both item lists for each compare - return (self.items() < other.items()) - - def __le__(self, other): - """ - >>> d = OrderedDict(((1, 3), (3, 2), (2, 1))) - >>> c = OrderedDict(((0, 3), (3, 2), (2, 1))) - >>> e = OrderedDict(d) - >>> c <= d - True - >>> d <= c - False - >>> d <= dict(c) - Traceback (most recent call last): - TypeError: Can only compare with other OrderedDicts - >>> d <= e - True - """ - if not isinstance(other, OrderedDict): - raise TypeError('Can only compare with other OrderedDicts') - # FIXME: efficiency? - # Generate both item lists for each compare - return (self.items() <= other.items()) - - def __ne__(self, other): - """ - >>> d = OrderedDict(((1, 3), (3, 2), (2, 1))) - >>> d != OrderedDict(d) - False - >>> d != OrderedDict(((1, 3), (2, 1), (3, 2))) - True - >>> d != OrderedDict(((1, 0), (3, 2), (2, 1))) - True - >>> d == OrderedDict(((0, 3), (3, 2), (2, 1))) - False - >>> d != dict(d) - True - >>> d != False - True - """ - if isinstance(other, OrderedDict): - # FIXME: efficiency? - # Generate both item lists for each compare - return not (self.items() == other.items()) - else: - return True - - def __gt__(self, other): - """ - >>> d = OrderedDict(((1, 3), (3, 2), (2, 1))) - >>> c = OrderedDict(((0, 3), (3, 2), (2, 1))) - >>> d > c - True - >>> c > d - False - >>> d > dict(c) - Traceback (most recent call last): - TypeError: Can only compare with other OrderedDicts - """ - if not isinstance(other, OrderedDict): - raise TypeError('Can only compare with other OrderedDicts') - # FIXME: efficiency? - # Generate both item lists for each compare - return (self.items() > other.items()) - - def __ge__(self, other): - """ - >>> d = OrderedDict(((1, 3), (3, 2), (2, 1))) - >>> c = OrderedDict(((0, 3), (3, 2), (2, 1))) - >>> e = OrderedDict(d) - >>> c >= d - False - >>> d >= c - True - >>> d >= dict(c) - Traceback (most recent call last): - TypeError: Can only compare with other OrderedDicts - >>> e >= d - True - """ - if not isinstance(other, OrderedDict): - raise TypeError('Can only compare with other OrderedDicts') - # FIXME: efficiency? - # Generate both item lists for each compare - return (self.items() >= other.items()) - - def __repr__(self): - """ - Used for __repr__ and __str__ - - >>> r1 = repr(OrderedDict((('a', 'b'), ('c', 'd'), ('e', 'f')))) - >>> r1 - "OrderedDict([('a', 'b'), ('c', 'd'), ('e', 'f')])" - >>> r2 = repr(OrderedDict((('a', 'b'), ('e', 'f'), ('c', 'd')))) - >>> r2 - "OrderedDict([('a', 'b'), ('e', 'f'), ('c', 'd')])" - >>> r1 == str(OrderedDict((('a', 'b'), ('c', 'd'), ('e', 'f')))) - True - >>> r2 == str(OrderedDict((('a', 'b'), ('e', 'f'), ('c', 'd')))) - True - """ - return '%s([%s])' % (self.__class__.__name__, ', '.join( - ['(%r, %r)' % (key, self[key]) for key in self._sequence])) - - def __setitem__(self, key, val): - """ - Allows slice assignment, so long as the slice is an OrderedDict - >>> d = OrderedDict() - >>> d['a'] = 'b' - >>> d['b'] = 'a' - >>> d[3] = 12 - >>> d - OrderedDict([('a', 'b'), ('b', 'a'), (3, 12)]) - >>> d[:] = OrderedDict(((1, 2), (2, 3), (3, 4))) - >>> d - OrderedDict([(1, 2), (2, 3), (3, 4)]) - >>> d[::2] = OrderedDict(((7, 8), (9, 10))) - >>> d - OrderedDict([(7, 8), (2, 3), (9, 10)]) - >>> d = OrderedDict(((0, 1), (1, 2), (2, 3), (3, 4))) - >>> d[1:3] = OrderedDict(((1, 2), (5, 6), (7, 8))) - >>> d - OrderedDict([(0, 1), (1, 2), (5, 6), (7, 8), (3, 4)]) - >>> d = OrderedDict(((0, 1), (1, 2), (2, 3), (3, 4)), strict=True) - >>> d[1:3] = OrderedDict(((1, 2), (5, 6), (7, 8))) - >>> d - OrderedDict([(0, 1), (1, 2), (5, 6), (7, 8), (3, 4)]) - - >>> a = OrderedDict(((0, 1), (1, 2), (2, 3)), strict=True) - >>> a[3] = 4 - >>> a - OrderedDict([(0, 1), (1, 2), (2, 3), (3, 4)]) - >>> a[::1] = OrderedDict([(0, 1), (1, 2), (2, 3), (3, 4)]) - >>> a - OrderedDict([(0, 1), (1, 2), (2, 3), (3, 4)]) - >>> a[:2] = OrderedDict([(0, 1), (1, 2), (2, 3), (3, 4), (4, 5)]) - Traceback (most recent call last): - ValueError: slice assignment must be from unique keys - >>> a = OrderedDict(((0, 1), (1, 2), (2, 3))) - >>> a[3] = 4 - >>> a - OrderedDict([(0, 1), (1, 2), (2, 3), (3, 4)]) - >>> a[::1] = OrderedDict([(0, 1), (1, 2), (2, 3), (3, 4)]) - >>> a - OrderedDict([(0, 1), (1, 2), (2, 3), (3, 4)]) - >>> a[:2] = OrderedDict([(0, 1), (1, 2), (2, 3), (3, 4)]) - >>> a - OrderedDict([(0, 1), (1, 2), (2, 3), (3, 4)]) - >>> a[::-1] = OrderedDict([(0, 1), (1, 2), (2, 3), (3, 4)]) - >>> a - OrderedDict([(3, 4), (2, 3), (1, 2), (0, 1)]) - - >>> d = OrderedDict([(0, 1), (1, 2), (2, 3), (3, 4)]) - >>> d[:1] = 3 - Traceback (most recent call last): - TypeError: slice assignment requires an OrderedDict - - >>> d = OrderedDict([(0, 1), (1, 2), (2, 3), (3, 4)]) - >>> d[:1] = OrderedDict([(9, 8)]) - >>> d - OrderedDict([(9, 8), (1, 2), (2, 3), (3, 4)]) - """ - if isinstance(key, types.SliceType): - if not isinstance(val, OrderedDict): - # FIXME: allow a list of tuples? - raise TypeError('slice assignment requires an OrderedDict') - keys = self._sequence[key] - # NOTE: Could use ``range(*key.indices(len(self._sequence)))`` - indexes = range(len(self._sequence))[key] - if key.step is None: - # NOTE: new slice may not be the same size as the one being - # overwritten ! - # NOTE: What is the algorithm for an impossible slice? - # e.g. d[5:3] - pos = key.start or 0 - del self[key] - newkeys = val.keys() - for k in newkeys: - if k in self: - if self.strict: - raise ValueError('slice assignment must be from ' - 'unique keys') - else: - # NOTE: This removes duplicate keys *first* - # so start position might have changed? - del self[k] - self._sequence = (self._sequence[:pos] + newkeys + - self._sequence[pos:]) - dict.update(self, val) - else: - # extended slice - length of new slice must be the same - # as the one being replaced - if len(keys) != len(val): - raise ValueError('attempt to assign sequence of size %s ' - 'to extended slice of size %s' % (len(val), len(keys))) - # FIXME: efficiency? - del self[key] - item_list = zip(indexes, val.items()) - # smallest indexes first - higher indexes not guaranteed to - # exist - item_list.sort() - for pos, (newkey, newval) in item_list: - if self.strict and newkey in self: - raise ValueError('slice assignment must be from unique' - ' keys') - self.insert(pos, newkey, newval) - else: - if key not in self: - self._sequence.append(key) - dict.__setitem__(self, key, val) - - def __getitem__(self, key): - """ - Allows slicing. Returns an OrderedDict if you slice. - >>> b = OrderedDict([(7, 0), (6, 1), (5, 2), (4, 3), (3, 4), (2, 5), (1, 6)]) - >>> b[::-1] - OrderedDict([(1, 6), (2, 5), (3, 4), (4, 3), (5, 2), (6, 1), (7, 0)]) - >>> b[2:5] - OrderedDict([(5, 2), (4, 3), (3, 4)]) - >>> type(b[2:4]) - - """ - if isinstance(key, types.SliceType): - # FIXME: does this raise the error we want? - keys = self._sequence[key] - # FIXME: efficiency? - return OrderedDict([(entry, self[entry]) for entry in keys]) - else: - return dict.__getitem__(self, key) - - __str__ = __repr__ - - def __setattr__(self, name, value): - """ - Implemented so that accesses to ``sequence`` raise a warning and are - diverted to the new ``setkeys`` method. - """ - if name == 'sequence': - warnings.warn('Use of the sequence attribute is deprecated.' - ' Use the keys method instead.', DeprecationWarning) - # NOTE: doesn't return anything - self.setkeys(value) - else: - # FIXME: do we want to allow arbitrary setting of attributes? - # Or do we want to manage it? - object.__setattr__(self, name, value) - - def __getattr__(self, name): - """ - Implemented so that access to ``sequence`` raises a warning. - - >>> d = OrderedDict() - >>> d.sequence - [] - """ - if name == 'sequence': - warnings.warn('Use of the sequence attribute is deprecated.' - ' Use the keys method instead.', DeprecationWarning) - # NOTE: Still (currently) returns a direct reference. Need to - # because code that uses sequence will expect to be able to - # mutate it in place. - return self._sequence - else: - # raise the appropriate error - raise AttributeError("OrderedDict has no '%s' attribute" % name) - - def __deepcopy__(self, memo): - """ - To allow deepcopy to work with OrderedDict. - - >>> from copy import deepcopy - >>> a = OrderedDict([(1, 1), (2, 2), (3, 3)]) - >>> a['test'] = {} - >>> b = deepcopy(a) - >>> b == a - True - >>> b is a - False - >>> a['test'] is b['test'] - False - """ - from copy import deepcopy - return self.__class__(deepcopy(self.items(), memo), self.strict) - - -### Read-only methods ### - - def copy(self): - """ - >>> OrderedDict(((1, 3), (3, 2), (2, 1))).copy() - OrderedDict([(1, 3), (3, 2), (2, 1)]) - """ - return OrderedDict(self) - - def items(self): - """ - ``items`` returns a list of tuples representing all the - ``(key, value)`` pairs in the dictionary. - - >>> d = OrderedDict(((1, 3), (3, 2), (2, 1))) - >>> d.items() - [(1, 3), (3, 2), (2, 1)] - >>> d.clear() - >>> d.items() - [] - """ - return zip(self._sequence, self.values()) - - def keys(self): - """ - Return a list of keys in the ``OrderedDict``. - - >>> d = OrderedDict(((1, 3), (3, 2), (2, 1))) - >>> d.keys() - [1, 3, 2] - """ - return self._sequence[:] - - def values(self, values=None): - """ - Return a list of all the values in the OrderedDict. - - Optionally you can pass in a list of values, which will replace the - current list. The value list must be the same len as the OrderedDict. - - >>> d = OrderedDict(((1, 3), (3, 2), (2, 1))) - >>> d.values() - [3, 2, 1] - """ - return [self[key] for key in self._sequence] - - def iteritems(self): - """ - >>> ii = OrderedDict(((1, 3), (3, 2), (2, 1))).iteritems() - >>> ii.next() - (1, 3) - >>> ii.next() - (3, 2) - >>> ii.next() - (2, 1) - >>> ii.next() - Traceback (most recent call last): - StopIteration - """ - def make_iter(self=self): - keys = self.iterkeys() - while True: - key = keys.next() - yield (key, self[key]) - return make_iter() - - def iterkeys(self): - """ - >>> ii = OrderedDict(((1, 3), (3, 2), (2, 1))).iterkeys() - >>> ii.next() - 1 - >>> ii.next() - 3 - >>> ii.next() - 2 - >>> ii.next() - Traceback (most recent call last): - StopIteration - """ - return iter(self._sequence) - - __iter__ = iterkeys - - def itervalues(self): - """ - >>> iv = OrderedDict(((1, 3), (3, 2), (2, 1))).itervalues() - >>> iv.next() - 3 - >>> iv.next() - 2 - >>> iv.next() - 1 - >>> iv.next() - Traceback (most recent call last): - StopIteration - """ - def make_iter(self=self): - keys = self.iterkeys() - while True: - yield self[keys.next()] - return make_iter() - -### Read-write methods ### - - def clear(self): - """ - >>> d = OrderedDict(((1, 3), (3, 2), (2, 1))) - >>> d.clear() - >>> d - OrderedDict([]) - """ - dict.clear(self) - self._sequence = [] - - def pop(self, key, *args): - """ - No dict.pop in Python 2.2, gotta reimplement it - - >>> d = OrderedDict(((1, 3), (3, 2), (2, 1))) - >>> d.pop(3) - 2 - >>> d - OrderedDict([(1, 3), (2, 1)]) - >>> d.pop(4) - Traceback (most recent call last): - KeyError: 4 - >>> d.pop(4, 0) - 0 - >>> d.pop(4, 0, 1) - Traceback (most recent call last): - TypeError: pop expected at most 2 arguments, got 3 - """ - if len(args) > 1: - raise TypeError, ('pop expected at most 2 arguments, got %s' % - (len(args) + 1)) - if key in self: - val = self[key] - del self[key] - else: - try: - val = args[0] - except IndexError: - raise KeyError(key) - return val - - def popitem(self, i=-1): - """ - Delete and return an item specified by index, not a random one as in - dict. The index is -1 by default (the last item). - - >>> d = OrderedDict(((1, 3), (3, 2), (2, 1))) - >>> d.popitem() - (2, 1) - >>> d - OrderedDict([(1, 3), (3, 2)]) - >>> d.popitem(0) - (1, 3) - >>> OrderedDict().popitem() - Traceback (most recent call last): - KeyError: 'popitem(): dictionary is empty' - >>> d.popitem(2) - Traceback (most recent call last): - IndexError: popitem(): index 2 not valid - """ - if not self._sequence: - raise KeyError('popitem(): dictionary is empty') - try: - key = self._sequence[i] - except IndexError: - raise IndexError('popitem(): index %s not valid' % i) - return (key, self.pop(key)) - - def setdefault(self, key, defval = None): - """ - >>> d = OrderedDict(((1, 3), (3, 2), (2, 1))) - >>> d.setdefault(1) - 3 - >>> d.setdefault(4) is None - True - >>> d - OrderedDict([(1, 3), (3, 2), (2, 1), (4, None)]) - >>> d.setdefault(5, 0) - 0 - >>> d - OrderedDict([(1, 3), (3, 2), (2, 1), (4, None), (5, 0)]) - """ - if key in self: - return self[key] - else: - self[key] = defval - return defval - - def update(self, from_od): - """ - Update from another OrderedDict or sequence of (key, value) pairs - - >>> d = OrderedDict(((1, 0), (0, 1))) - >>> d.update(OrderedDict(((1, 3), (3, 2), (2, 1)))) - >>> d - OrderedDict([(1, 3), (0, 1), (3, 2), (2, 1)]) - >>> d.update({4: 4}) - Traceback (most recent call last): - TypeError: undefined order, cannot get items from dict - >>> d.update((4, 4)) - Traceback (most recent call last): - TypeError: cannot convert dictionary update sequence element "4" to a 2-item sequence - """ - if isinstance(from_od, OrderedDict): - for key, val in from_od.items(): - self[key] = val - elif isinstance(from_od, dict): - # we lose compatibility with other ordered dict types this way - raise TypeError('undefined order, cannot get items from dict') - else: - # FIXME: efficiency? - # sequence of 2-item sequences, or error - for item in from_od: - try: - key, val = item - except TypeError: - raise TypeError('cannot convert dictionary update' - ' sequence element "%s" to a 2-item sequence' % item) - self[key] = val - - def rename(self, old_key, new_key): - """ - Rename the key for a given value, without modifying sequence order. - - For the case where new_key already exists this raise an exception, - since if new_key exists, it is ambiguous as to what happens to the - associated values, and the position of new_key in the sequence. - - >>> od = OrderedDict() - >>> od['a'] = 1 - >>> od['b'] = 2 - >>> od.items() - [('a', 1), ('b', 2)] - >>> od.rename('b', 'c') - >>> od.items() - [('a', 1), ('c', 2)] - >>> od.rename('c', 'a') - Traceback (most recent call last): - ValueError: New key already exists: 'a' - >>> od.rename('d', 'b') - Traceback (most recent call last): - KeyError: 'd' - """ - if new_key == old_key: - # no-op - return - if new_key in self: - raise ValueError("New key already exists: %r" % new_key) - # rename sequence entry - value = self[old_key] - old_idx = self._sequence.index(old_key) - self._sequence[old_idx] = new_key - # rename internal dict entry - dict.__delitem__(self, old_key) - dict.__setitem__(self, new_key, value) - - def setitems(self, items): - """ - This method allows you to set the items in the dict. - - It takes a list of tuples - of the same sort returned by the ``items`` - method. - - >>> d = OrderedDict() - >>> d.setitems(((3, 1), (2, 3), (1, 2))) - >>> d - OrderedDict([(3, 1), (2, 3), (1, 2)]) - """ - self.clear() - # FIXME: this allows you to pass in an OrderedDict as well :-) - self.update(items) - - def setkeys(self, keys): - """ - ``setkeys`` all ows you to pass in a new list of keys which will - replace the current set. This must contain the same set of keys, but - need not be in the same order. - - If you pass in new keys that don't match, a ``KeyError`` will be - raised. - - >>> d = OrderedDict(((1, 3), (3, 2), (2, 1))) - >>> d.keys() - [1, 3, 2] - >>> d.setkeys((1, 2, 3)) - >>> d - OrderedDict([(1, 3), (2, 1), (3, 2)]) - >>> d.setkeys(['a', 'b', 'c']) - Traceback (most recent call last): - KeyError: 'Keylist is not the same as current keylist.' - """ - # FIXME: Efficiency? (use set for Python 2.4 :-) - # NOTE: list(keys) rather than keys[:] because keys[:] returns - # a tuple, if keys is a tuple. - kcopy = list(keys) - kcopy.sort() - self._sequence.sort() - if kcopy != self._sequence: - raise KeyError('Keylist is not the same as current keylist.') - # NOTE: This makes the _sequence attribute a new object, instead - # of changing it in place. - # FIXME: efficiency? - self._sequence = list(keys) - - def setvalues(self, values): - """ - You can pass in a list of values, which will replace the - current list. The value list must be the same len as the OrderedDict. - - (Or a ``ValueError`` is raised.) - - >>> d = OrderedDict(((1, 3), (3, 2), (2, 1))) - >>> d.setvalues((1, 2, 3)) - >>> d - OrderedDict([(1, 1), (3, 2), (2, 3)]) - >>> d.setvalues([6]) - Traceback (most recent call last): - ValueError: Value list is not the same length as the OrderedDict. - """ - if len(values) != len(self): - # FIXME: correct error to raise? - raise ValueError('Value list is not the same length as the ' - 'OrderedDict.') - self.update(zip(self, values)) - -### Sequence Methods ### - - def index(self, key): - """ - Return the position of the specified key in the OrderedDict. - - >>> d = OrderedDict(((1, 3), (3, 2), (2, 1))) - >>> d.index(3) - 1 - >>> d.index(4) - Traceback (most recent call last): - ValueError: list.index(x): x not in list - """ - return self._sequence.index(key) - - def insert(self, index, key, value): - """ - Takes ``index``, ``key``, and ``value`` as arguments. - - Sets ``key`` to ``value``, so that ``key`` is at position ``index`` in - the OrderedDict. - - >>> d = OrderedDict(((1, 3), (3, 2), (2, 1))) - >>> d.insert(0, 4, 0) - >>> d - OrderedDict([(4, 0), (1, 3), (3, 2), (2, 1)]) - >>> d.insert(0, 2, 1) - >>> d - OrderedDict([(2, 1), (4, 0), (1, 3), (3, 2)]) - >>> d.insert(8, 8, 1) - >>> d - OrderedDict([(2, 1), (4, 0), (1, 3), (3, 2), (8, 1)]) - """ - if key in self: - # FIXME: efficiency? - del self[key] - self._sequence.insert(index, key) - dict.__setitem__(self, key, value) - - def reverse(self): - """ - Reverse the order of the OrderedDict. - - >>> d = OrderedDict(((1, 3), (3, 2), (2, 1))) - >>> d.reverse() - >>> d - OrderedDict([(2, 1), (3, 2), (1, 3)]) - """ - self._sequence.reverse() - - def sort(self, *args, **kwargs): - """ - Sort the key order in the OrderedDict. - - This method takes the same arguments as the ``list.sort`` method on - your version of Python. - - >>> d = OrderedDict(((4, 1), (2, 2), (3, 3), (1, 4))) - >>> d.sort() - >>> d - OrderedDict([(1, 4), (2, 2), (3, 3), (4, 1)]) - """ - self._sequence.sort(*args, **kwargs) - -class Keys(object): - # FIXME: should this object be a subclass of list? - """ - Custom object for accessing the keys of an OrderedDict. - - Can be called like the normal ``OrderedDict.keys`` method, but also - supports indexing and sequence methods. - """ - - def __init__(self, main): - self._main = main - - def __call__(self): - """Pretend to be the keys method.""" - return self._main._keys() - - def __getitem__(self, index): - """Fetch the key at position i.""" - # NOTE: this automatically supports slicing :-) - return self._main._sequence[index] - - def __setitem__(self, index, name): - """ - You cannot assign to keys, but you can do slice assignment to re-order - them. - - You can only do slice assignment if the new set of keys is a reordering - of the original set. - """ - if isinstance(index, types.SliceType): - # FIXME: efficiency? - # check length is the same - indexes = range(len(self._main._sequence))[index] - if len(indexes) != len(name): - raise ValueError('attempt to assign sequence of size %s ' - 'to slice of size %s' % (len(name), len(indexes))) - # check they are the same keys - # FIXME: Use set - old_keys = self._main._sequence[index] - new_keys = list(name) - old_keys.sort() - new_keys.sort() - if old_keys != new_keys: - raise KeyError('Keylist is not the same as current keylist.') - orig_vals = [self._main[k] for k in name] - del self._main[index] - vals = zip(indexes, name, orig_vals) - vals.sort() - for i, k, v in vals: - if self._main.strict and k in self._main: - raise ValueError('slice assignment must be from ' - 'unique keys') - self._main.insert(i, k, v) - else: - raise ValueError('Cannot assign to keys') - - ### following methods pinched from UserList and adapted ### - def __repr__(self): return repr(self._main._sequence) - - # FIXME: do we need to check if we are comparing with another ``Keys`` - # object? (like the __cast method of UserList) - def __lt__(self, other): return self._main._sequence < other - def __le__(self, other): return self._main._sequence <= other - def __eq__(self, other): return self._main._sequence == other - def __ne__(self, other): return self._main._sequence != other - def __gt__(self, other): return self._main._sequence > other - def __ge__(self, other): return self._main._sequence >= other - # FIXME: do we need __cmp__ as well as rich comparisons? - def __cmp__(self, other): return cmp(self._main._sequence, other) - - def __contains__(self, item): return item in self._main._sequence - def __len__(self): return len(self._main._sequence) - def __iter__(self): return self._main.iterkeys() - def count(self, item): return self._main._sequence.count(item) - def index(self, item, *args): return self._main._sequence.index(item, *args) - def reverse(self): self._main._sequence.reverse() - def sort(self, *args, **kwds): self._main._sequence.sort(*args, **kwds) - def __mul__(self, n): return self._main._sequence*n - __rmul__ = __mul__ - def __add__(self, other): return self._main._sequence + other - def __radd__(self, other): return other + self._main._sequence - - ## following methods not implemented for keys ## - def __delitem__(self, i): raise TypeError('Can\'t delete items from keys') - def __iadd__(self, other): raise TypeError('Can\'t add in place to keys') - def __imul__(self, n): raise TypeError('Can\'t multiply keys in place') - def append(self, item): raise TypeError('Can\'t append items to keys') - def insert(self, i, item): raise TypeError('Can\'t insert items into keys') - def pop(self, i=-1): raise TypeError('Can\'t pop items from keys') - def remove(self, item): raise TypeError('Can\'t remove items from keys') - def extend(self, other): raise TypeError('Can\'t extend keys') - -class Items(object): - """ - Custom object for accessing the items of an OrderedDict. - - Can be called like the normal ``OrderedDict.items`` method, but also - supports indexing and sequence methods. - """ - - def __init__(self, main): - self._main = main - - def __call__(self): - """Pretend to be the items method.""" - return self._main._items() - - def __getitem__(self, index): - """Fetch the item at position i.""" - if isinstance(index, types.SliceType): - # fetching a slice returns an OrderedDict - return self._main[index].items() - key = self._main._sequence[index] - return (key, self._main[key]) - - def __setitem__(self, index, item): - """Set item at position i to item.""" - if isinstance(index, types.SliceType): - # NOTE: item must be an iterable (list of tuples) - self._main[index] = OrderedDict(item) - else: - # FIXME: Does this raise a sensible error? - orig = self._main.keys[index] - key, value = item - if self._main.strict and key in self and (key != orig): - raise ValueError('slice assignment must be from ' - 'unique keys') - # delete the current one - del self._main[self._main._sequence[index]] - self._main.insert(index, key, value) - - def __delitem__(self, i): - """Delete the item at position i.""" - key = self._main._sequence[i] - if isinstance(i, types.SliceType): - for k in key: - # FIXME: efficiency? - del self._main[k] - else: - del self._main[key] - - ### following methods pinched from UserList and adapted ### - def __repr__(self): return repr(self._main.items()) - - # FIXME: do we need to check if we are comparing with another ``Items`` - # object? (like the __cast method of UserList) - def __lt__(self, other): return self._main.items() < other - def __le__(self, other): return self._main.items() <= other - def __eq__(self, other): return self._main.items() == other - def __ne__(self, other): return self._main.items() != other - def __gt__(self, other): return self._main.items() > other - def __ge__(self, other): return self._main.items() >= other - def __cmp__(self, other): return cmp(self._main.items(), other) - - def __contains__(self, item): return item in self._main.items() - def __len__(self): return len(self._main._sequence) # easier :-) - def __iter__(self): return self._main.iteritems() - def count(self, item): return self._main.items().count(item) - def index(self, item, *args): return self._main.items().index(item, *args) - def reverse(self): self._main.reverse() - def sort(self, *args, **kwds): self._main.sort(*args, **kwds) - def __mul__(self, n): return self._main.items()*n - __rmul__ = __mul__ - def __add__(self, other): return self._main.items() + other - def __radd__(self, other): return other + self._main.items() - - def append(self, item): - """Add an item to the end.""" - # FIXME: this is only append if the key isn't already present - key, value = item - self._main[key] = value - - def insert(self, i, item): - key, value = item - self._main.insert(i, key, value) - - def pop(self, i=-1): - key = self._main._sequence[i] - return (key, self._main.pop(key)) - - def remove(self, item): - key, value = item - try: - assert value == self._main[key] - except (KeyError, AssertionError): - raise ValueError('ValueError: list.remove(x): x not in list') - else: - del self._main[key] - - def extend(self, other): - # FIXME: is only a true extend if none of the keys already present - for item in other: - key, value = item - self._main[key] = value - - def __iadd__(self, other): - self.extend(other) - - ## following methods not implemented for items ## - - def __imul__(self, n): raise TypeError('Can\'t multiply items in place') - -class Values(object): - """ - Custom object for accessing the values of an OrderedDict. - - Can be called like the normal ``OrderedDict.values`` method, but also - supports indexing and sequence methods. - """ - - def __init__(self, main): - self._main = main - - def __call__(self): - """Pretend to be the values method.""" - return self._main._values() - - def __getitem__(self, index): - """Fetch the value at position i.""" - if isinstance(index, types.SliceType): - return [self._main[key] for key in self._main._sequence[index]] - else: - return self._main[self._main._sequence[index]] - - def __setitem__(self, index, value): - """ - Set the value at position i to value. - - You can only do slice assignment to values if you supply a sequence of - equal length to the slice you are replacing. - """ - if isinstance(index, types.SliceType): - keys = self._main._sequence[index] - if len(keys) != len(value): - raise ValueError('attempt to assign sequence of size %s ' - 'to slice of size %s' % (len(name), len(keys))) - # FIXME: efficiency? Would be better to calculate the indexes - # directly from the slice object - # NOTE: the new keys can collide with existing keys (or even - # contain duplicates) - these will overwrite - for key, val in zip(keys, value): - self._main[key] = val - else: - self._main[self._main._sequence[index]] = value - - ### following methods pinched from UserList and adapted ### - def __repr__(self): return repr(self._main.values()) - - # FIXME: do we need to check if we are comparing with another ``Values`` - # object? (like the __cast method of UserList) - def __lt__(self, other): return self._main.values() < other - def __le__(self, other): return self._main.values() <= other - def __eq__(self, other): return self._main.values() == other - def __ne__(self, other): return self._main.values() != other - def __gt__(self, other): return self._main.values() > other - def __ge__(self, other): return self._main.values() >= other - def __cmp__(self, other): return cmp(self._main.values(), other) - - def __contains__(self, item): return item in self._main.values() - def __len__(self): return len(self._main._sequence) # easier :-) - def __iter__(self): return self._main.itervalues() - def count(self, item): return self._main.values().count(item) - def index(self, item, *args): return self._main.values().index(item, *args) - - def reverse(self): - """Reverse the values""" - vals = self._main.values() - vals.reverse() - # FIXME: efficiency - self[:] = vals - - def sort(self, *args, **kwds): - """Sort the values.""" - vals = self._main.values() - vals.sort(*args, **kwds) - self[:] = vals - - def __mul__(self, n): return self._main.values()*n - __rmul__ = __mul__ - def __add__(self, other): return self._main.values() + other - def __radd__(self, other): return other + self._main.values() - - ## following methods not implemented for values ## - def __delitem__(self, i): raise TypeError('Can\'t delete items from values') - def __iadd__(self, other): raise TypeError('Can\'t add in place to values') - def __imul__(self, n): raise TypeError('Can\'t multiply values in place') - def append(self, item): raise TypeError('Can\'t append items to values') - def insert(self, i, item): raise TypeError('Can\'t insert items into values') - def pop(self, i=-1): raise TypeError('Can\'t pop items from values') - def remove(self, item): raise TypeError('Can\'t remove items from values') - def extend(self, other): raise TypeError('Can\'t extend values') - -class SequenceOrderedDict(OrderedDict): - """ - Experimental version of OrderedDict that has a custom object for ``keys``, - ``values``, and ``items``. - - These are callable sequence objects that work as methods, or can be - manipulated directly as sequences. - - Test for ``keys``, ``items`` and ``values``. - - >>> d = SequenceOrderedDict(((1, 2), (2, 3), (3, 4))) - >>> d - SequenceOrderedDict([(1, 2), (2, 3), (3, 4)]) - >>> d.keys - [1, 2, 3] - >>> d.keys() - [1, 2, 3] - >>> d.setkeys((3, 2, 1)) - >>> d - SequenceOrderedDict([(3, 4), (2, 3), (1, 2)]) - >>> d.setkeys((1, 2, 3)) - >>> d.keys[0] - 1 - >>> d.keys[:] - [1, 2, 3] - >>> d.keys[-1] - 3 - >>> d.keys[-2] - 2 - >>> d.keys[0:2] = [2, 1] - >>> d - SequenceOrderedDict([(2, 3), (1, 2), (3, 4)]) - >>> d.keys.reverse() - >>> d.keys - [3, 1, 2] - >>> d.keys = [1, 2, 3] - >>> d - SequenceOrderedDict([(1, 2), (2, 3), (3, 4)]) - >>> d.keys = [3, 1, 2] - >>> d - SequenceOrderedDict([(3, 4), (1, 2), (2, 3)]) - >>> a = SequenceOrderedDict() - >>> b = SequenceOrderedDict() - >>> a.keys == b.keys - 1 - >>> a['a'] = 3 - >>> a.keys == b.keys - 0 - >>> b['a'] = 3 - >>> a.keys == b.keys - 1 - >>> b['b'] = 3 - >>> a.keys == b.keys - 0 - >>> a.keys > b.keys - 0 - >>> a.keys < b.keys - 1 - >>> 'a' in a.keys - 1 - >>> len(b.keys) - 2 - >>> 'c' in d.keys - 0 - >>> 1 in d.keys - 1 - >>> [v for v in d.keys] - [3, 1, 2] - >>> d.keys.sort() - >>> d.keys - [1, 2, 3] - >>> d = SequenceOrderedDict(((1, 2), (2, 3), (3, 4)), strict=True) - >>> d.keys[::-1] = [1, 2, 3] - >>> d - SequenceOrderedDict([(3, 4), (2, 3), (1, 2)]) - >>> d.keys[:2] - [3, 2] - >>> d.keys[:2] = [1, 3] - Traceback (most recent call last): - KeyError: 'Keylist is not the same as current keylist.' - - >>> d = SequenceOrderedDict(((1, 2), (2, 3), (3, 4))) - >>> d - SequenceOrderedDict([(1, 2), (2, 3), (3, 4)]) - >>> d.values - [2, 3, 4] - >>> d.values() - [2, 3, 4] - >>> d.setvalues((4, 3, 2)) - >>> d - SequenceOrderedDict([(1, 4), (2, 3), (3, 2)]) - >>> d.values[::-1] - [2, 3, 4] - >>> d.values[0] - 4 - >>> d.values[-2] - 3 - >>> del d.values[0] - Traceback (most recent call last): - TypeError: Can't delete items from values - >>> d.values[::2] = [2, 4] - >>> d - SequenceOrderedDict([(1, 2), (2, 3), (3, 4)]) - >>> 7 in d.values - 0 - >>> len(d.values) - 3 - >>> [val for val in d.values] - [2, 3, 4] - >>> d.values[-1] = 2 - >>> d.values.count(2) - 2 - >>> d.values.index(2) - 0 - >>> d.values[-1] = 7 - >>> d.values - [2, 3, 7] - >>> d.values.reverse() - >>> d.values - [7, 3, 2] - >>> d.values.sort() - >>> d.values - [2, 3, 7] - >>> d.values.append('anything') - Traceback (most recent call last): - TypeError: Can't append items to values - >>> d.values = (1, 2, 3) - >>> d - SequenceOrderedDict([(1, 1), (2, 2), (3, 3)]) - - >>> d = SequenceOrderedDict(((1, 2), (2, 3), (3, 4))) - >>> d - SequenceOrderedDict([(1, 2), (2, 3), (3, 4)]) - >>> d.items() - [(1, 2), (2, 3), (3, 4)] - >>> d.setitems([(3, 4), (2 ,3), (1, 2)]) - >>> d - SequenceOrderedDict([(3, 4), (2, 3), (1, 2)]) - >>> d.items[0] - (3, 4) - >>> d.items[:-1] - [(3, 4), (2, 3)] - >>> d.items[1] = (6, 3) - >>> d.items - [(3, 4), (6, 3), (1, 2)] - >>> d.items[1:2] = [(9, 9)] - >>> d - SequenceOrderedDict([(3, 4), (9, 9), (1, 2)]) - >>> del d.items[1:2] - >>> d - SequenceOrderedDict([(3, 4), (1, 2)]) - >>> (3, 4) in d.items - 1 - >>> (4, 3) in d.items - 0 - >>> len(d.items) - 2 - >>> [v for v in d.items] - [(3, 4), (1, 2)] - >>> d.items.count((3, 4)) - 1 - >>> d.items.index((1, 2)) - 1 - >>> d.items.index((2, 1)) - Traceback (most recent call last): - ValueError: list.index(x): x not in list - >>> d.items.reverse() - >>> d.items - [(1, 2), (3, 4)] - >>> d.items.reverse() - >>> d.items.sort() - >>> d.items - [(1, 2), (3, 4)] - >>> d.items.append((5, 6)) - >>> d.items - [(1, 2), (3, 4), (5, 6)] - >>> d.items.insert(0, (0, 0)) - >>> d.items - [(0, 0), (1, 2), (3, 4), (5, 6)] - >>> d.items.insert(-1, (7, 8)) - >>> d.items - [(0, 0), (1, 2), (3, 4), (7, 8), (5, 6)] - >>> d.items.pop() - (5, 6) - >>> d.items - [(0, 0), (1, 2), (3, 4), (7, 8)] - >>> d.items.remove((1, 2)) - >>> d.items - [(0, 0), (3, 4), (7, 8)] - >>> d.items.extend([(1, 2), (5, 6)]) - >>> d.items - [(0, 0), (3, 4), (7, 8), (1, 2), (5, 6)] - """ - - def __init__(self, init_val=(), strict=True): - OrderedDict.__init__(self, init_val, strict=strict) - self._keys = self.keys - self._values = self.values - self._items = self.items - self.keys = Keys(self) - self.values = Values(self) - self.items = Items(self) - self._att_dict = { - 'keys': self.setkeys, - 'items': self.setitems, - 'values': self.setvalues, - } - - def __setattr__(self, name, value): - """Protect keys, items, and values.""" - if not '_att_dict' in self.__dict__: - object.__setattr__(self, name, value) - else: - try: - fun = self._att_dict[name] - except KeyError: - OrderedDict.__setattr__(self, name, value) - else: - fun(value) - -if __name__ == '__main__': - if INTP_VER < (2, 3): - raise RuntimeError("Tests require Python v.2.3 or later") - # turn off warnings for tests - warnings.filterwarnings('ignore') - # run the code tests in doctest format - import doctest - m = sys.modules.get('__main__') - globs = m.__dict__.copy() - globs.update({ - 'INTP_VER': INTP_VER, - }) - doctest.testmod(m, globs=globs) - diff --git a/h-client/test.py b/h-client/test.py deleted file mode 100644 index c09d6a2..0000000 --- a/h-client/test.py +++ /dev/null @@ -1,69 +0,0 @@ -# -*- coding: utf-8 -*- -# hlibrary, a python library to manage the database of an h-source node -# Copyright (C) 2011 Antonio Gallo -# -# -# hlibrary 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. -# -# hlibrary 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 hlibrary. If not, see . - -from hlibrary import * - -client = Client() -client.setNode('http://h-source/') -client.createDevices() -#client.request.perform('download/all/it') -#print client.request.url -#client.sync() - -#for key,dev in client.devices.iteritems(): - #print key - #print dev[0].getModel() - #print dev[0].getDistributions() - #print dev[0].getYear() - #print dev[3] - #print dev[0].getHowItWorks() - #print dev[0].getDescription() - #print dev[0].getIcon() - ##dev[0].addDistribution('taranis') - ##dev[0].addDistribution('metad') - ##dev[0].addDistribution('gingo') - ##dev[0].addDistribution('taranis') - #print dev[0].getDistributions() - ##print dev[0].userDistribution() - -client.changeType('u_0846:4260','wifi') - - -for key,dev in client.devices.iteritems(): - print key - print dev[0].getModel() - print dev[0].getType() - print dev[0].getDistributions() - print dev[0].getYear() - print dev[3] - print dev[0].getHowItWorks() - print dev[0].getDescription() - print dev[0].getIcon() - #dev[0].addDistribution('taranis') - #dev[0].addDistribution('metad') - #dev[0].addDistribution('gingo') - #dev[0].addDistribution('taranis') - print dev[0].getDistributions() - #print dev[0].userDistribution() -#client.login('','') -##print client.isLogged() -#client.submit() -#client.logout() - -#client.devices['p_14e4:4311'][0].setPost() -#print client.devices['p_14e4:4311'][0].getPost() \ No newline at end of file -- cgit v1.2.3