pax_global_header00006660000000000000000000000064144616571730014530gustar00rootroot0000000000000052 comment=e78a3d5826708b8f4b28ca34e1fc2cbf1df1443d confy-0.7.0/000077500000000000000000000000001446165717300126525ustar00rootroot00000000000000confy-0.7.0/.buildconfig000066400000000000000000000003571446165717300151450ustar00rootroot00000000000000[default] name=Default runtime=host toolchain=default config-opts= run-opts= prefix=/home/fabio/.cache/gnome-builder/install/confy/host app-id= postbuild= prebuild= default=true [default.environment] [default.runtime_environment] LANG=C confy-0.7.0/.editorconfig000066400000000000000000000000531446165717300153250ustar00rootroot00000000000000[*.py] indent_style = space indent_size = 4confy-0.7.0/.gitignore000066400000000000000000000034021446165717300146410ustar00rootroot00000000000000 # Created by https://www.gitignore.io/api/ninja,python # Edit at https://www.gitignore.io/?templates=ninja,python ### Ninja ### .ninja_deps .ninja_log ### Python ### # Byte-compiled / optimized / DLL files __pycache__/ *.py[cod] *$py.class # C extensions *.so # Distribution / packaging .Python build/ develop-eggs/ dist/ downloads/ eggs/ .eggs/ lib/ lib64/ parts/ sdist/ var/ wheels/ pip-wheel-metadata/ share/python-wheels/ *.egg-info/ .installed.cfg *.egg MANIFEST # PyInstaller # Usually these files are written by a python script from a template # before PyInstaller builds the exe, so as to inject date/other infos into it. *.manifest *.spec # Installer logs pip-log.txt pip-delete-this-directory.txt # Unit test / coverage reports htmlcov/ .tox/ .nox/ .coverage .coverage.* .cache nosetests.xml coverage.xml *.cover .hypothesis/ .pytest_cache/ # Translations *.mo *.pot # Scrapy stuff: .scrapy # Sphinx documentation docs/_build/ # PyBuilder target/ # pyenv .python-version # pipenv # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. # However, in case of collaboration, if having platform-specific dependencies or dependencies # having no cross-platform support, pipenv may install dependencies that don't work, or not # install all needed dependencies. #Pipfile.lock # celery beat schedule file celerybeat-schedule # SageMath parsed files *.sage.py # Spyder project settings .spyderproject .spyproject # Rope project settings .ropeproject # Mr Developer .mr.developer.cfg .project .pydevproject # mkdocs documentation /site # mypy .mypy_cache/ .dmypy.json dmypy.json # Pyre type checker .pyre/ # End of https://www.gitignore.io/api/ninja,python work/ *~ .flatpak-builder/ .*env subprojects/blueprint-compilerconfy-0.7.0/CHANGELOG000066400000000000000000000054421446165717300140710ustar00rootroot00000000000000# CHANGELOG ## [0.7.0] ## Changed - Ported to Gtk4/libadwaita - Reviseted user interaction, dialogs and shortcuts ## New - Copy talk detail into clipboard as plaintext from menu or shortcut ## Fixed - Correct day for events that are after UTC midnight (edward) ## [0.6.5] - 2023-06-01 ### Add - French tranlsation, thanks to Irénée Thirion - Swedish translation, thanks to Luna Jernberg ### Fixed - Fix Pentabarf date parsing ### Changed - Flatpak: bump to GNOME Runtime 44 ## [0.6.4] - 2022-08-17 ### Add - Convert markdown links to html hyperlinks - Don't track visited links in labels - Make labels selectable - Margin in loading widget: no more loadbar touching screen edges in mobile ### Changed - Event text justified to left - Use symbolic icon in search placeholder ## [0.6.3] - 2021-12-29 ### Add - Metainfo data about inputs support and screen size requirements ## [0.6.2] - 2021-11-10 ### Fixed - Better icons appearence in sidebar - Squared "Star" buttons ### Changed - Round corners in lists - Use app icon in empty starred page ## [0.6.1] - 2021-07-18 ### Add - Support for adaptive filter in Phosh app drawer ### Fixed - Event progressbar handle events with zero duration (devrtz) (fix ~fabrixxm/confy#18) ### Changed - Store events datetimes as UTC in db, display in current timezone. ## [0.6.0] - 2021-06-12 ### Added - Full-text search in shedule view (fix ~fabrixxm/confy#11) - Full-text search in starred view (fix ~fabrixxm/confy#12) ### Fixed - Add page stack to starred view (fix ~fabrixxm/confy#13) - Move Search Bar revealer out of overlay (fix ~fabrixxm/confy#10) ### Changed - Modify primary menu to better fit GNOME guidelines (seabass) - Move 'star event' button to end of event widget (seabass) ## [0.5.5] - 2020-04-06 ### Added - Open urls with default application per file type, if possible ## [0.5.4] - 20201-02-18 ### Fixed - Use correct file for appstream metadata - Remove more unsupported markup tags from strings - Fix "next up" query and notification ### Changed - Updated flatpack to GNOME Runtime 3.38 ## [0.5.3] - 2021-01-28 ### Added - Event progress indicator in event list row widget ### Fixed - Fix overlapping events query (don't return event ending/starting on same exact time) ## [0.5.2] - 2021-01-17 ### Added - Search in conferences list - Global shortcuts - Shortcuts window ### Changed - Install python module in python's site-lib dir - Fix metadata install path - Fix flatpak manifest: add python deps ## [0.5.1] - 2020-12-30 ### Added - Allow edit user-added conference metadata - Allow remove user-added conferences - Show editing dialog after adding a custom url - Clear cache from preferences dialog ### Changed - Set a maximum size for conferece logo in main page ### Fixed - Small fixes to UI - Support "baseurl" property in pentabarf - Fix XML entities stripping confy-0.7.0/COPYING000066400000000000000000001045141446165717300137120ustar00rootroot00000000000000 GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . confy-0.7.0/README.md000066400000000000000000000020741446165717300141340ustar00rootroot00000000000000 # Confy Conferences schedule viewer for GNOME Navigate Conference schedules, mark favourite talks Built with python3, gtk3, libhandy - [Home Page](https://confy.kirgroup.net) - [Project Page](https://sr.ht/~fabrixxm/Confy) - [Patches and discussions](https://lists.sr.ht/~fabrixxm/confy-dev) - [Tickets](https://todo.sr.ht/~fabrixxm/confy) ## Packages [![Packaging status](https://repology.org/badge/vertical-allrepos/confy.svg)](https://repology.org/project/confy/versions) ## Build Requirements - Gtk3 - libhandy 1 - Python3 - python-gobjects - python-icalendar - meson and ninja ### Build with Gnome Builder Use "Clone repository..." from Open window, press "Run" ### Build from command line git clone https://git.sr.ht/~fabrixxm/confy cd confy meson . _build ninja -C _build ninja -C _build install ## Issues and Patches Send issues to [~fabrixxm/confy@todo.sr.ht](https://todo.sr.ht/~fabrixxm/confy) Send patches to [~fabrixxm/confy-dev@lists.sr.ht](https://lists.sr.ht/~fabrixxm/confy-dev) confy-0.7.0/build-aux/000077500000000000000000000000001446165717300145445ustar00rootroot00000000000000confy-0.7.0/build-aux/meson/000077500000000000000000000000001446165717300156655ustar00rootroot00000000000000confy-0.7.0/build-aux/meson/postinstall.py000077500000000000000000000012141446165717300206140ustar00rootroot00000000000000#!/usr/bin/env python3 from os import environ, path from subprocess import call prefix = environ.get('MESON_INSTALL_PREFIX', '/usr/local') datadir = path.join(prefix, 'share') destdir = environ.get('DESTDIR', '') # Package managers set this so we don't need to run if not destdir: print('Updating icon cache...') call(['gtk-update-icon-cache', '-qtf', path.join(datadir, 'icons', 'hicolor')]) print('Updating desktop database...') call(['update-desktop-database', '-q', path.join(datadir, 'applications')]) print('Compiling GSettings schemas...') call(['glib-compile-schemas', path.join(datadir, 'glib-2.0', 'schemas')]) confy-0.7.0/data/000077500000000000000000000000001446165717300135635ustar00rootroot00000000000000confy-0.7.0/data/data.gresource.xml000066400000000000000000000004671446165717300172220ustar00rootroot00000000000000 icons/scalable/apps/net.kirgroup.confy.svg icons/symbolic/apps/net.kirgroup.confy-symbolic.svg confy-0.7.0/data/icons/000077500000000000000000000000001446165717300146765ustar00rootroot00000000000000confy-0.7.0/data/icons/net.kirgroup.confy.Source.svg000066400000000000000000005572641446165717300224450ustar00rootroot00000000000000 Adwaita Icon Template image/svg+xml GNOME Design Team Adwaita Icon Template battery is full and there is no a/c connected. confy-0.7.0/data/icons/scalable/000077500000000000000000000000001446165717300164445ustar00rootroot00000000000000confy-0.7.0/data/icons/scalable/apps/000077500000000000000000000000001446165717300174075ustar00rootroot00000000000000confy-0.7.0/data/icons/scalable/apps/net.kirgroup.confy.svg000066400000000000000000000211351446165717300236760ustar00rootroot00000000000000 confy-0.7.0/data/icons/symbolic/000077500000000000000000000000001446165717300165175ustar00rootroot00000000000000confy-0.7.0/data/icons/symbolic/apps/000077500000000000000000000000001446165717300174625ustar00rootroot00000000000000confy-0.7.0/data/icons/symbolic/apps/net.kirgroup.confy-symbolic.svg000066400000000000000000000020741446165717300255710ustar00rootroot00000000000000 confy-0.7.0/data/meson.build000066400000000000000000000032031446165717300157230ustar00rootroot00000000000000pkgdatadir = join_paths(get_option('prefix'), get_option('datadir'), meson.project_name()) iconsdir = join_paths(get_option('datadir'), 'icons', 'hicolor') foreach size: ['scalable', 'symbolic'] install_subdir('icons/' + size, install_dir: iconsdir) endforeach gnome = import('gnome') gnome.compile_resources('confy.data', 'data.gresource.xml', gresource_bundle: true, install: true, install_dir: pkgdatadir, ) desktop_file = i18n.merge_file( input: 'net.kirgroup.confy.desktop.in', output: 'net.kirgroup.confy.desktop', type: 'desktop', po_dir: '../po', install: true, install_dir: join_paths(get_option('datadir'), 'applications') ) desktop_utils = find_program('desktop-file-validate', required: false) if desktop_utils.found() test('Validate desktop file', desktop_utils, args: [desktop_file] ) endif metainfo_file = i18n.merge_file( input: 'net.kirgroup.confy.metainfo.xml.in', output: 'net.kirgroup.confy.metainfo.xml', type: 'xml', po_dir: join_paths (meson.source_root(), 'po'), install: true, install_dir: join_paths (get_option ('datadir'), 'metainfo') ) appstream_cli = find_program('appstream-util', required: false) if appstream_cli.found() test('Validate appstream file', appstream_cli, args: ['validate', '--nonet', metainfo_file] ) endif install_data('net.kirgroup.confy.gschema.xml', install_dir: join_paths(get_option('datadir'), 'glib-2.0/schemas') ) compile_schemas = find_program('glib-compile-schemas', required: false) if compile_schemas.found() test('Validate schema file', compile_schemas, args: ['--strict', '--dry-run', meson.current_source_dir()] ) endif confy-0.7.0/data/net.kirgroup.confy.Devel.svg000066400000000000000000000457341446165717300211230ustar00rootroot00000000000000 confy-0.7.0/data/net.kirgroup.confy.desktop.in000066400000000000000000000003171446165717300213300ustar00rootroot00000000000000[Desktop Entry] Name=Confy Exec=confy Terminal=false Type=Application Categories=Utility;GTK; StartupNotify=true Icon=net.kirgroup.confy Keywords=Conference;Organize; X-Purism-FormFactor=Workstation;Mobile; confy-0.7.0/data/net.kirgroup.confy.gschema.xml000066400000000000000000000014221446165717300214560ustar00rootroot00000000000000 2 Events list cache duration App will auto-update cache (if possible) when it's older than setting. 2 Event info cache duration App will auto-update cache (if possible) when it's older than setting. 600 300 confy-0.7.0/data/net.kirgroup.confy.metainfo.xml.in000066400000000000000000000103731446165717300222630ustar00rootroot00000000000000 net.kirgroup.confy Confy Fabio Comuni ~fabrixxm/confy-dev@lists.sr.ht Conference schedules viewer

Confy lets you browse conference schedules.

Browse talks by day, track or room. Select the talks you are interested in and receive notification when they are about to start. View when two or more talks you are interested in overlap.

net.kirgroup.confy.desktop CC-BY-4.0 GPL-3.0-or-later https://confy.kirgroup.net https://todo.sr.ht/~fabrixxm/confy GNOME https://confy.kirgroup.net/appdata/confy1.png https://confy.kirgroup.net/appdata/confy2.png https://confy.kirgroup.net/appdata/confy3.png workstation mobile pointing keyboard touch 360

Updated to Gtk4/libadwaita

Reviseted user interaction, dialogs and shortcuts

Copy talk detail into clipboard as plaintext from menu or shortcut

Fix events that are after UTC midnight

French tranlsation, thanks to Irénée Thirion

Swedish translation, thanks to Luna Jernberg

Fix Pentabarf date parsing

Flatpak: bump Gnome Runtime to verion 44

Convert markdown links to html hyperlinks

Don't track visited links in labels

Make labels selectable

Margin in loading widget: no more loadbar touching screen edges in mobile

Event text justified to left

Use symbolic icon in search placeholder

Update metainfo data with input support and display requirement.

Update appearance to better conform to Gnome

Fix event progressbar for events with zero duration

Display events talks datetimes in current timezone

Declare support for mobile devices in metadata

Search talks in schedule and starred view

Better page navigation in starred view

Varius enhancement to UI to better fit GNOME guidelines

Open urls with default application per file type, if possible.

Fix "next up" query and notification.

Fix text rendering issues with unsupported markup tags.

Add event progress indicator.

Fix overlapping events definition: exclude events ending/starting on same exact time.

confy-0.7.0/makepo.sh000077500000000000000000000002231446165717300144620ustar00rootroot00000000000000#!/bin/bash set -euo pipefail cd "$(dirname "$0")" [ ! -d bld ] && meson setup bld ninja -C bld/ confy-pot ninja -C bld/ confy-update-po rm -r bld confy-0.7.0/meson.build000066400000000000000000000004161446165717300150150ustar00rootroot00000000000000project('confy', version: '0.7.0', meson_version: '>= 0.58.0', default_options: [ 'warning_level=2', ], ) i18n = import('i18n') subdir('data') subdir('src') subdir('po') meson.add_install_script('build-aux/meson/postinstall.py') confy-0.7.0/meson_options.txt000066400000000000000000000000621446165717300163050ustar00rootroot00000000000000#option('devel', type : 'boolean', value : false) confy-0.7.0/net.kirgroup.confy.json000066400000000000000000000020541446165717300173120ustar00rootroot00000000000000{ "app-id": "net.kirgroup.confy", "runtime": "org.gnome.Platform", "runtime-version": "44", "sdk": "org.gnome.Sdk", "command": "confy", "finish-args": [ "--share=network", "--share=ipc", "--socket=fallback-x11", "--socket=wayland", "--device=dri", "--talk-name=org.freedesktop.Notifications" ], "modules": [ { "name": "blueprint", "buildsystem": "meson", "sources": [{ "type": "git", "url": "https://gitlab.gnome.org/jwestman/blueprint-compiler", "tag": "v0.8.1", "commit": "aa7679618e864748f4f4d8f15283906e712752fe" }] }, "python3-icalendar.json", { "name" : "confy", "builddir" : true, "buildsystem" : "meson", "sources" : [ { "type" : "dir", "path" : "." } ], "config-opts" : [] } ] } confy-0.7.0/po/000077500000000000000000000000001446165717300132705ustar00rootroot00000000000000confy-0.7.0/po/LINGUAS000066400000000000000000000000121446165717300143060ustar00rootroot00000000000000fr it sv confy-0.7.0/po/POTFILES000066400000000000000000000021621446165717300144410ustar00rootroot00000000000000src/__init__.py src/config.py.in src/fetcher.py src/local.py src/main.py src/models.py src/networkconnectionmonitor.py src/openwindow.py src/preferences.py src/settings.py src/utils.py src/pages/__init__.py src/pages/details.py src/pages/events.py src/pages/info.py src/pages/list.py src/remotes/__init__.py src/remotes/exceptions.py src/remotes/ics.py src/remotes/pentabarf.py src/widgets/__init__.py src/widgets/datepickerrow.py src/widgets/eventactionrow.py data/net.kirgroup.confy.desktop.in data/net.kirgroup.confy.metainfo.xml.in data/net.kirgroup.confy.gschema.xml src/widgets/eventeditdialog.py src/widgets/inputdialog.py src/widgets/loaderpage.py src/widgets/loadingoverlay.py src/widgets/pageheaderbar.py src/widgets/searchbaroverlay.py src/widgets/sidebar.py src/widgets/starbutton.py src/widgets/weblinkactionrow.py src/mainwindow.blp src/openwindow.blp src/shortcuts.blp src/pages/details.blp src/pages/events.blp src/pages/info.blp src/pages/list.blp src/widgets/eventeditdialog.blp src/widgets/loaderpage.blp src/widgets/pageheaderbar.blp src/widgets/searchbaroverlay.blp src/widgets/sidebar.blp src/widgets/starbutton.blp confy-0.7.0/po/fr.po000066400000000000000000000366401446165717300142500ustar00rootroot00000000000000# Italian translations for confy package. # Copyright (C) 2020-2022 Fabio Comuni, et al. # This file is distributed under the same license as the confy package. # Irénée Thirion , 2022. # msgid "" msgstr "" "Project-Id-Version: confy\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-06-22 15:01+0200\n" "PO-Revision-Date: 2022-09-19 20:32+0200\n" "Last-Translator: Irénée Thirion \n" "Language-Team: ~fabrixxm/confy-dev@lists.sr.ht\n" "Language: fr\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" "X-Generator: Poedit 3.1.1\n" #: src/config.py.in:5 msgid "%A %B %d, %Y" msgstr "" #: src/local.py:151 msgid "Device disconnected and no cached data available." msgstr "Appareil déconnecté et aucune donnée en cache disponible." #. edit existing obj #: src/local.py:284 src/openwindow.py:165 msgid "Event already in list" msgstr "Événement déjà dans la liste" #. Translators: about dialog text; this string should be replaced by a text crediting yourselves and your translation team, or should be left empty. Do not translate literally! #: src/main.py:148 msgid "translator-credits" msgstr "Irénée Thirion " #: src/main.py:149 data/net.kirgroup.confy.metainfo.xml.in:7 msgid "Conference schedules viewer" msgstr "Visionneuse de programmes de conférences" #: src/openwindow.py:55 src/openwindow.py:94 src/openwindow.py:197 msgid "" "Error loading events list:\n" "{}" msgstr "" "Erreur lors du chargement de la liste des événements :\n" "{}" #: src/openwindow.py:91 msgid "Events list updated" msgstr "Liste des événements mise à jour" #: src/openwindow.py:110 #, fuzzy msgid "Delete event \"{}\"?" msgstr "" "Événement supprimé :\n" "{}" #: src/openwindow.py:111 msgid "Event will be removed from event list and related data will be deleted" msgstr "" #: src/openwindow.py:112 src/widgets/inputdialog.py:31 src/openwindow.blp:62 #: src/widgets/eventeditdialog.blp:20 src/widgets/loaderpage.blp:22 msgid "Cancel" msgstr "Annuler" #: src/openwindow.py:113 src/widgets/eventeditdialog.blp:27 msgid "Delete" msgstr "Supprimer" #: src/openwindow.py:147 #, fuzzy msgid "New event: {}" msgstr "" "Nouvel événement :\n" "{}" #: src/openwindow.py:150 src/openwindow.py:170 #, fuzzy msgid "Error: {}" msgstr "" "Erreur :\n" "{}" #: src/preferences.py:48 data/net.kirgroup.confy.gschema.xml:7 msgid "Events list cache duration" msgstr "Durée de la mise en cache de la liste d’événements" #: src/preferences.py:49 #, fuzzy msgid "Try to update list cache when it's older than this." msgstr "" "L’application mettra automatiquement à jour le cache (si possible) lorsqu'il " "sera plus ancien que cela." #: src/preferences.py:54 msgid "Events info cache duration" msgstr "Durée de la mise en cache des informations d’événements" #: src/preferences.py:55 #, fuzzy msgid "Try to update event cache when it's older than this." msgstr "" "L’application mettra automatiquement à jour le cache (si possible) lorsqu'il " "sera plus ancien que cela." #: src/preferences.py:64 msgid "Clear" msgstr "Nettoyer" #: src/preferences.py:68 msgid "Cached data" msgstr "Données en cache" #: src/preferences.py:85 msgid "Confy has {} of cached data" msgstr "Confy a {} de données en cache" #: src/pages/events.py:116 msgid "Talks on {}" msgstr "Conférences sur {}" #: src/pages/events.py:128 msgid "{} Track" msgstr "Thème {}" #: src/pages/events.py:135 msgid "No Room" msgstr "Aucune salle" #: src/pages/events.py:137 msgid "Room {}" msgstr "Salle {}" #: src/pages/events.py:145 src/mainwindow.blp:166 msgid "Starred" msgstr "Étoilé" #: src/pages/events.py:152 #, fuzzy msgid "Search Talks" msgstr "Conférences étoilées" #: src/pages/info.py:31 src/mainwindow.blp:125 #, fuzzy msgid "Event info" msgstr "Modifier les informations" #: src/remotes/__init__.py:35 msgid "Unknown schedule format" msgstr "Format de programme invalide" #: src/remotes/pentabarf.py:54 msgid "Invalid pentabarf format" msgstr "Format pentabarf invalide" #: data/net.kirgroup.confy.desktop.in:3 #: data/net.kirgroup.confy.metainfo.xml.in:4 msgid "Confy" msgstr "Confy" #: data/net.kirgroup.confy.desktop.in:10 msgid "Conference;Organize;" msgstr "Conférence;Organiser;planning;séminaire;rencontre;" #: data/net.kirgroup.confy.metainfo.xml.in:5 msgid "Fabio Comuni" msgstr "Fabio Comuni" #: data/net.kirgroup.confy.metainfo.xml.in:9 msgid "Confy lets you browse conference schedules." msgstr "Confy vous permet de parcourir des programmes de conférences." #: data/net.kirgroup.confy.metainfo.xml.in:12 msgid "" "Browse talks by day, track or room. Select the talks you are interested in " "and receive notification when they are about to start. View when two or more " "talks you are interested in overlap." msgstr "" "Parcourez les conférences par jour, thème ou salle. Sélectionnez les " "conférences qui vous intéressent et recevez une notification lorsqu’elles " "sont sur le point de commencer. Visualisez quand deux ou plusieurs " "conférences qui vous intéressent se chevauchent." #: data/net.kirgroup.confy.metainfo.xml.in:45 msgid "French tranlsation, thanks to Irénée Thirion" msgstr "" #: data/net.kirgroup.confy.metainfo.xml.in:46 msgid "Swedish translation, thanks to Luna Jernberg" msgstr "" #: data/net.kirgroup.confy.metainfo.xml.in:47 msgid "Fix Pentabarf date parsing" msgstr "" #: data/net.kirgroup.confy.metainfo.xml.in:48 msgid "Flatpak: bump Gnome Runtime to verion 44" msgstr "" #: data/net.kirgroup.confy.metainfo.xml.in:53 msgid "Convert markdown links to html hyperlinks" msgstr "" #: data/net.kirgroup.confy.metainfo.xml.in:54 msgid "Don't track visited links in labels" msgstr "" #: data/net.kirgroup.confy.metainfo.xml.in:55 msgid "Make labels selectable" msgstr "" #: data/net.kirgroup.confy.metainfo.xml.in:56 msgid "" "Margin in loading widget: no more loadbar touching screen edges in mobile" msgstr "" #: data/net.kirgroup.confy.metainfo.xml.in:57 msgid "Event text justified to left" msgstr "" #: data/net.kirgroup.confy.metainfo.xml.in:58 msgid "Use symbolic icon in search placeholder" msgstr "" #: data/net.kirgroup.confy.metainfo.xml.in:63 msgid "Update metainfo data with input support and display requirement." msgstr "" "Mise à jour des métadonnées avec le support d’entrée et les exigences " "d’affichage." #: data/net.kirgroup.confy.metainfo.xml.in:68 msgid "Update appearance to better conform to Gnome" msgstr "Mise à jour de l’interface pour mieux correspondre à Gnome" #: data/net.kirgroup.confy.metainfo.xml.in:73 msgid "Fix event progressbar for events with zero duration" msgstr "" "Correction de la barre de progression des événements pour les événements de " "durée nulle" #: data/net.kirgroup.confy.metainfo.xml.in:74 msgid "Display events talks datetimes in current timezone" msgstr "" "Affichage des dates des conférences sur les événements dans le fuseau " "horaire actuel" #: data/net.kirgroup.confy.metainfo.xml.in:75 msgid "Declare support for mobile devices in metadata" msgstr "" "Déclaration de la prise en charge des appareils mobiles dans les métadonnées" #: data/net.kirgroup.confy.metainfo.xml.in:80 msgid "Search talks in schedule and starred view" msgstr "" "Recherche des conférences dans le calendrier et vue des conférences marquées " "d’une étoile" #: data/net.kirgroup.confy.metainfo.xml.in:81 msgid "Better page navigation in starred view" msgstr "" "Meilleure navigation dans la page dans la vue des événements marqués d’une " "étoile" #: data/net.kirgroup.confy.metainfo.xml.in:82 msgid "Varius enhancement to UI to better fit GNOME guidelines" msgstr "" "Diverses améliorations à l’interface pour mieux correspondre aux directives " "de GNOME" #: data/net.kirgroup.confy.metainfo.xml.in:87 msgid "Open urls with default application per file type, if possible." msgstr "" "Ouverture des liens avec l’application par défaut par type de fichier, quand " "c'est possible." #: data/net.kirgroup.confy.metainfo.xml.in:92 msgid "Fix \"next up\" query and notification." msgstr "Correction de la requête et de la notification « prochain »." #: data/net.kirgroup.confy.metainfo.xml.in:93 msgid "Fix text rendering issues with unsupported markup tags." msgstr "" "Correction des problèmes de rendu de textes avec des balises markup non " "prises en charge." #: data/net.kirgroup.confy.metainfo.xml.in:98 msgid "Add event progress indicator." msgstr "Ajout d’un indicateur de la progression de l’événement." #: data/net.kirgroup.confy.metainfo.xml.in:99 msgid "" "Fix overlapping events definition: exclude events ending/starting on same " "exact time." msgstr "" "Correction de la définition d’événements se chevauchant : sont exclus les " "événements qui finissent et commencent au même moment." #: data/net.kirgroup.confy.gschema.xml:8 data/net.kirgroup.confy.gschema.xml:13 msgid "App will auto-update cache (if possible) when it's older than setting." msgstr "" "L’application mettra automatiquement le cache à jour (si possible) lorsqu’il " "sera plus ancien que le paramètre défini." #: data/net.kirgroup.confy.gschema.xml:12 msgid "Event info cache duration" msgstr "Durée de la mise en cache des informations d’événements" #: src/widgets/inputdialog.py:28 #, fuzzy msgid "Add Event from URL" msgstr "Ajouter un événement depuis une URL" #: src/widgets/inputdialog.py:29 msgid "" "Enter URL to event schedule to add it to the list.\n" "Confy supports events in Pentabarf (.xml) or iCal (.ics) format." msgstr "" #: src/widgets/inputdialog.py:32 msgid "Add" msgstr "" #: src/widgets/loadingoverlay.py:37 src/widgets/loadingoverlay.py:42 msgid "Loading…" msgstr "Chargement…" #: src/widgets/loadingoverlay.py:44 #, fuzzy msgid "cancel" msgstr "Annuler" #: src/mainwindow.blp:37 #, fuzzy msgid "Open an Event to start" msgstr "Trouver un événement" #: src/mainwindow.blp:44 src/mainwindow.blp:203 src/shortcuts.blp:31 #: src/shortcuts.blp:44 #, fuzzy msgid "Open Event" msgstr "Trouver un événement" #: src/mainwindow.blp:133 msgid "Days" msgstr "Jours" #: src/mainwindow.blp:144 msgid "Tracks" msgstr "Thèmes" #: src/mainwindow.blp:155 msgid "Rooms" msgstr "Salles" #. separator ? #: src/mainwindow.blp:208 src/openwindow.blp:136 src/shortcuts.blp:14 msgid "Preferences" msgstr "Préférences" #: src/mainwindow.blp:213 src/openwindow.blp:138 src/shortcuts.blp:18 #, fuzzy msgid "Keyboard Shortcuts" msgstr "Raccourcis clavier" #: src/mainwindow.blp:218 src/openwindow.blp:140 #, fuzzy msgid "About Confy" msgstr "À propos de {}" #: src/openwindow.blp:15 #, fuzzy msgid "Events" msgstr "Trouver un événement" #: src/openwindow.blp:20 src/openwindow.blp:126 src/shortcuts.blp:56 #, fuzzy msgid "Add event from URL" msgstr "Ajouter un événement depuis une URL" #: src/openwindow.blp:27 src/openwindow.blp:56 src/shortcuts.blp:48 msgid "Find event" msgstr "Trouver un événement" #: src/openwindow.blp:41 msgid "Refresh events list" msgstr "Rafraîchir la liste des événements" #: src/openwindow.blp:51 src/openwindow.blp:132 #, fuzzy msgid "Edit events" msgstr "Trouver un événement" #: src/openwindow.blp:76 #, fuzzy msgid "No events yet" msgstr "Pas encore de conférences." #: src/openwindow.blp:77 #, fuzzy msgid "Add an event with the add button in title bar." msgstr "" "Ajoutez une conférence avec le bouton ajouter dans la barre supérieure." #: src/openwindow.blp:83 src/pages/events.blp:71 #, fuzzy msgid "No matches" msgstr "Aucune correspondance trouvée" #: src/openwindow.blp:98 msgid "Coming up" msgstr "À venir" #: src/openwindow.blp:108 msgid "Past" msgstr "Passé" #: src/openwindow.blp:128 #, fuzzy msgid "Refresh list" msgstr "Rafraîchir la liste des événements" #: src/openwindow.blp:130 #, fuzzy msgid "Search" msgstr "Conférences étoilées" #: src/shortcuts.blp:10 msgid "Application" msgstr "" #: src/shortcuts.blp:22 msgid "Close" msgstr "" #: src/shortcuts.blp:27 #, fuzzy msgid "Event Window" msgstr "Modifier les informations" #: src/shortcuts.blp:35 msgid "Find talk" msgstr "Trouver une conférence" #: src/shortcuts.blp:39 msgid "Copy talk details to clipboard" msgstr "" #: src/shortcuts.blp:52 #, fuzzy msgid "Reload events list" msgstr "Retourner à la liste des événements" #: src/pages/details.blp:106 #, fuzzy msgid "Conflicts with" msgstr "Conflits avec" #: src/pages/details.blp:139 msgid "Links" msgstr "" #: src/pages/details.blp:155 msgid "Copy to clipboard" msgstr "" #: src/pages/events.blp:61 src/pages/list.blp:36 msgid "Nothing starred yet" msgstr "" #: src/pages/events.blp:62 src/pages/list.blp:37 msgid "Star a talk to be notified when it's about to start." msgstr "" #: src/widgets/eventeditdialog.blp:10 #, fuzzy msgid "Edit event" msgstr "Trouver un événement" #: src/widgets/eventeditdialog.blp:14 msgid "Ok" msgstr "OK" #: src/widgets/eventeditdialog.blp:41 msgid "URL" msgstr "URL" #: src/widgets/eventeditdialog.blp:47 msgid "Title" msgstr "Titre" #: src/widgets/eventeditdialog.blp:52 msgid "Start" msgstr "Début" #: src/widgets/eventeditdialog.blp:56 msgid "End" msgstr "Fin" #: src/widgets/eventeditdialog.blp:60 msgid "Icon URL" msgstr "URL d’icône" #: src/widgets/loaderpage.blp:10 #, fuzzy msgid "Loading..." msgstr "Chargement…" #, fuzzy #~ msgid "Open Conference" #~ msgstr "Modifier la conférence" #~ msgid "Show window menu" #~ msgstr "Afficher le fenêtre du menu" #~ msgid "Error loading event" #~ msgstr "Erreur lors du chargement de l’événement" #~ msgid "Go back" #~ msgstr "Retourner en arrière" #~ msgid "Schedule" #~ msgstr "Programme" #~ msgid "Map" #~ msgstr "Carte" #~ msgid "" #~ "Updated event:\n" #~ "{}" #~ msgstr "" #~ "Événement mis à jour :\n" #~ "{}" #~ msgid "Event schedule updated" #~ msgstr "Programme de l’événement mis à jour" #~ msgid "Next up: {}" #~ msgstr "Suivant : {}" #~ msgid "at {} in {}" #~ msgstr "à {} dans {}" #~ msgid "cache updated" #~ msgstr "cache mis à jour" #~ msgid "Room: {}" #~ msgstr "Salle : {}" #~ msgid "Track: {}" #~ msgstr "Thème : {}" #~ msgid "Links" #~ msgstr "Liens" #~ msgid "You don't have any starred talk yet." #~ msgstr "Vous n’avez pas encore de conférences marquées d’une étoile." #~ msgid "" #~ "Click on the star button to add a talk to this list and to be reminded " #~ "when they are about to start." #~ msgstr "" #~ "Cliquez sur le bouton étoile pour ajouter une conférence à cette liste et " #~ "être notifié lorsqu’elle sera sur le point de commencer." #~ msgid "{}" #~ msgstr "{}" #~ msgid "Loading…" #~ msgstr "Chargement…" #~ msgid "Schedule URL" #~ msgstr "URL du programme" #~ msgid "%b %a %d %Y" #~ msgstr "%b %a %d %Y" #~ msgid "No cache" #~ msgstr "Pas de cache" #~ msgid "One hour" #~ msgstr "Une heure" #~ msgid "One day" #~ msgstr "Un jour" #~ msgid "One week" #~ msgstr "Une semaine" #~ msgid "Quit" #~ msgstr "Quitter" #~ msgid "" #~ "Confy lets you organise your visit - select talks to be reminded of (with " #~ "warnings in case of conflicts)." #~ msgstr "" #~ "Confy vous permet d’organiser votre visite - sélectionnez les conférences " #~ "dont vous voulez vous rappeler (avec des avertissements en cas de " #~ "conflits)" #~ msgid "Conference schedule viewer" #~ msgstr "Visionneuse de programmes de conférence" #~ msgid "Conferences schedule viewer" #~ msgstr "Visionneuse de programmes de conférences" confy-0.7.0/po/it.po000066400000000000000000000314421446165717300142500ustar00rootroot00000000000000# Italian translations for confy package. # Copyright (C) 2020-2022 Fabio Comuni, et al. # This file is distributed under the same license as the confy package. # Fabio Comuni , 2020-2023. # msgid "" msgstr "" "Project-Id-Version: confy\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-06-22 15:01+0200\n" "PO-Revision-Date: 2023-06-06 09:04+0200\n" "Last-Translator: Fabio Comuni \n" "Language-Team: Italian <~fabrixxm/confy-dev@lists.sr.ht>\n" "Language: it\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1)\n" "X-Generator: Gtranslator 42.0\n" #: src/config.py.in:5 msgid "%A %B %d, %Y" msgstr "%A %d %B %Y" #: src/local.py:151 msgid "Device disconnected and no cached data available." msgstr "Dispositivo disconnesso e nessun dato locale disponibile." #. edit existing obj #: src/local.py:284 src/openwindow.py:165 msgid "Event already in list" msgstr "Evento già in lista" #. Translators: about dialog text; this string should be replaced by a text crediting yourselves and your translation team, or should be left empty. Do not translate literally! #: src/main.py:148 msgid "translator-credits" msgstr "Fabio Comuni " #: src/main.py:149 data/net.kirgroup.confy.metainfo.xml.in:7 msgid "Conference schedules viewer" msgstr "Visualizzatore di programmi di conferenze" #: src/openwindow.py:55 src/openwindow.py:94 src/openwindow.py:197 msgid "" "Error loading events list:\n" "{}" msgstr "" "Errore caricando la lista eventi\n" "{}" #: src/openwindow.py:91 msgid "Events list updated" msgstr "Lista eventi aggiornata" #: src/openwindow.py:110 msgid "Delete event \"{}\"?" msgstr "Cancellare l'evento \"{}\"?" #: src/openwindow.py:111 msgid "Event will be removed from event list and related data will be deleted" msgstr "" "L'evento verrà rimosso dalla lista degli eventi e i relativi dati cancellati" #: src/openwindow.py:112 src/widgets/inputdialog.py:31 src/openwindow.blp:62 #: src/widgets/eventeditdialog.blp:20 src/widgets/loaderpage.blp:22 msgid "Cancel" msgstr "Annulla" #: src/openwindow.py:113 src/widgets/eventeditdialog.blp:27 msgid "Delete" msgstr "Rimuovi" #: src/openwindow.py:147 msgid "New event: {}" msgstr "Nuovo evento: {}" #: src/openwindow.py:150 src/openwindow.py:170 msgid "Error: {}" msgstr "Errore: {}" #: src/preferences.py:48 data/net.kirgroup.confy.gschema.xml:7 msgid "Events list cache duration" msgstr "Durata cache lista eventi" #: src/preferences.py:49 msgid "Try to update list cache when it's older than this." msgstr "Prova ad aggiornare la cache quando è più vecchia di." #: src/preferences.py:54 msgid "Events info cache duration" msgstr "Durata cache informazioni eventi" #: src/preferences.py:55 msgid "Try to update event cache when it's older than this." msgstr "Prova ad aggiornare la cache quando è più vecchia di." #: src/preferences.py:64 msgid "Clear" msgstr "Pulisci" #: src/preferences.py:68 msgid "Cached data" msgstr "Dati in cache" #: src/preferences.py:85 msgid "Confy has {} of cached data" msgstr "Confy ha {} di dati in cache" #: src/pages/events.py:116 msgid "Talks on {}" msgstr "Presentazioni il {}" #: src/pages/events.py:128 msgid "{} Track" msgstr "Tema {}" #: src/pages/events.py:135 msgid "No Room" msgstr "Nessuna Stanza" #: src/pages/events.py:137 msgid "Room {}" msgstr "Stanza {}" #: src/pages/events.py:145 src/mainwindow.blp:166 msgid "Starred" msgstr "Preferiti" #: src/pages/events.py:152 msgid "Search Talks" msgstr "Cerca Presentazioni" #: src/pages/info.py:31 src/mainwindow.blp:125 msgid "Event info" msgstr "Informazioni Evento" #: src/remotes/__init__.py:35 msgid "Unknown schedule format" msgstr "Formato programma sconosciuto" #: src/remotes/pentabarf.py:54 msgid "Invalid pentabarf format" msgstr "Formato pentabarf non valido" #: data/net.kirgroup.confy.desktop.in:3 #: data/net.kirgroup.confy.metainfo.xml.in:4 msgid "Confy" msgstr "Confy" #: data/net.kirgroup.confy.desktop.in:10 msgid "Conference;Organize;" msgstr "Conferenze;Organizza;" #: data/net.kirgroup.confy.metainfo.xml.in:5 msgid "Fabio Comuni" msgstr "Fabio Comuni" #: data/net.kirgroup.confy.metainfo.xml.in:9 msgid "Confy lets you browse conference schedules." msgstr "Confy permette di navigare i programmi delle conferenze" #: data/net.kirgroup.confy.metainfo.xml.in:12 msgid "" "Browse talks by day, track or room. Select the talks you are interested in " "and receive notification when they are about to start. View when two or more " "talks you are interested in overlap." msgstr "" "Sfoglia i talk per giorno, traccia o stanza. Seleziona i talk che ti " "interessano e ricevi una notifica quando stanno per iniziare. Visualizza " "quando due o più talk a cui sei interessato si sovrappongono." #: data/net.kirgroup.confy.metainfo.xml.in:45 msgid "French tranlsation, thanks to Irénée Thirion" msgstr "" #: data/net.kirgroup.confy.metainfo.xml.in:46 msgid "Swedish translation, thanks to Luna Jernberg" msgstr "" #: data/net.kirgroup.confy.metainfo.xml.in:47 msgid "Fix Pentabarf date parsing" msgstr "" #: data/net.kirgroup.confy.metainfo.xml.in:48 msgid "Flatpak: bump Gnome Runtime to verion 44" msgstr "" #: data/net.kirgroup.confy.metainfo.xml.in:53 msgid "Convert markdown links to html hyperlinks" msgstr "Converte i link markdown in hyperlink html" #: data/net.kirgroup.confy.metainfo.xml.in:54 msgid "Don't track visited links in labels" msgstr "Non traccia i link visitati nelle etichette" #: data/net.kirgroup.confy.metainfo.xml.in:55 msgid "Make labels selectable" msgstr "Rese le etichette selezionabili" #: data/net.kirgroup.confy.metainfo.xml.in:56 msgid "" "Margin in loading widget: no more loadbar touching screen edges in mobile" msgstr "" "Margini nel widget di progresso caricamento: la barra di progresso non tocca " "più i lati dello schermo in mobile" #: data/net.kirgroup.confy.metainfo.xml.in:57 msgid "Event text justified to left" msgstr "Giustifica il testo delle presentazioni a sinistra" #: data/net.kirgroup.confy.metainfo.xml.in:58 msgid "Use symbolic icon in search placeholder" msgstr "Usa icona simbolica nel segnaposto della ricerca" #: data/net.kirgroup.confy.metainfo.xml.in:63 msgid "Update metainfo data with input support and display requirement." msgstr "" "Aggiornati i metadati con info sul supporto input e le richieste display." #: data/net.kirgroup.confy.metainfo.xml.in:68 msgid "Update appearance to better conform to Gnome" msgstr "" "Aggiornato l'aspetto per meglio conformarsi meglio alle linee guida Gnome" #: data/net.kirgroup.confy.metainfo.xml.in:73 msgid "Fix event progressbar for events with zero duration" msgstr "Sistemata la barra di avanzamento per gli eventi con durata zero" #: data/net.kirgroup.confy.metainfo.xml.in:74 msgid "Display events talks datetimes in current timezone" msgstr "Mostra data e ora dei talk nel fuso orario corrente" #: data/net.kirgroup.confy.metainfo.xml.in:75 msgid "Declare support for mobile devices in metadata" msgstr "Dichiara supporto per device mobili nei metadati" #: data/net.kirgroup.confy.metainfo.xml.in:80 msgid "Search talks in schedule and starred view" msgstr "Ricerca talk nelle viste Programma e Preferiti" #: data/net.kirgroup.confy.metainfo.xml.in:81 msgid "Better page navigation in starred view" msgstr "Navigazione tra pagine migliorata nella vista Preferiti" #: data/net.kirgroup.confy.metainfo.xml.in:82 msgid "Varius enhancement to UI to better fit GNOME guidelines" msgstr "" "Varie migliorie all'interfaccia per conformarsi meglio alle linee guida di " "GNOME" #: data/net.kirgroup.confy.metainfo.xml.in:87 msgid "Open urls with default application per file type, if possible." msgstr "" "Apri utl con l'applcazione di default per il tipo di file, se possibile." #: data/net.kirgroup.confy.metainfo.xml.in:92 msgid "Fix \"next up\" query and notification." msgstr "Sistema query e notifiche \"in arrivo\"" #: data/net.kirgroup.confy.metainfo.xml.in:93 msgid "Fix text rendering issues with unsupported markup tags." msgstr "Sistema i problemi nel rendere il testo a causa di tag non supportati" #: data/net.kirgroup.confy.metainfo.xml.in:98 msgid "Add event progress indicator." msgstr "Aggiunge un indicatore di progresso dei talk" #: data/net.kirgroup.confy.metainfo.xml.in:99 msgid "" "Fix overlapping events definition: exclude events ending/starting on same " "exact time." msgstr "" "Sistema la definizione degli eventi sovrapposti: esclude gli eventi che " "iniziano/finiscono alla stessa identica ora." #: data/net.kirgroup.confy.gschema.xml:8 data/net.kirgroup.confy.gschema.xml:13 msgid "App will auto-update cache (if possible) when it's older than setting." msgstr "" "L'app aggiornerà automaticamente (se possibile) la cache quando è più " "vecchia di quanto impostato" #: data/net.kirgroup.confy.gschema.xml:12 msgid "Event info cache duration" msgstr "Durata cache informazioni evento" #: src/widgets/inputdialog.py:28 msgid "Add Event from URL" msgstr "Aggiungi evento da URL" #: src/widgets/inputdialog.py:29 msgid "" "Enter URL to event schedule to add it to the list.\n" "Confy supports events in Pentabarf (.xml) or iCal (.ics) format." msgstr "" "Inserisci l'indirizzo di un evento da aggiungere alla lista.\n" "Confy supporta eventi in formato Pentabarf (.xml) o iCal (.ics)." #: src/widgets/inputdialog.py:32 msgid "Add" msgstr "Aggiungi" #: src/widgets/loadingoverlay.py:37 src/widgets/loadingoverlay.py:42 msgid "Loading…" msgstr "Caricamento…" #: src/widgets/loadingoverlay.py:44 msgid "cancel" msgstr "annulla" #: src/mainwindow.blp:37 msgid "Open an Event to start" msgstr "Apri un Evento per iniziare" #: src/mainwindow.blp:44 src/mainwindow.blp:203 src/shortcuts.blp:31 #: src/shortcuts.blp:44 msgid "Open Event" msgstr "Apri Evento" #: src/mainwindow.blp:133 msgid "Days" msgstr "Giorni" #: src/mainwindow.blp:144 msgid "Tracks" msgstr "Temi" #: src/mainwindow.blp:155 msgid "Rooms" msgstr "Stanze" #. separator ? #: src/mainwindow.blp:208 src/openwindow.blp:136 src/shortcuts.blp:14 msgid "Preferences" msgstr "Preferenze" #: src/mainwindow.blp:213 src/openwindow.blp:138 src/shortcuts.blp:18 msgid "Keyboard Shortcuts" msgstr "Scorciatoie da tastiera" #: src/mainwindow.blp:218 src/openwindow.blp:140 msgid "About Confy" msgstr "Informazioni su Confy" #: src/openwindow.blp:15 msgid "Events" msgstr "Eventi" #: src/openwindow.blp:20 src/openwindow.blp:126 src/shortcuts.blp:56 msgid "Add event from URL" msgstr "Aggiungi evento da URL" #: src/openwindow.blp:27 src/openwindow.blp:56 src/shortcuts.blp:48 msgid "Find event" msgstr "Trova evento" #: src/openwindow.blp:41 msgid "Refresh events list" msgstr "Aggiorna lista eventi" #: src/openwindow.blp:51 src/openwindow.blp:132 msgid "Edit events" msgstr "Modifica eventi" #: src/openwindow.blp:76 msgid "No events yet" msgstr "Ancora nessun evento" #: src/openwindow.blp:77 msgid "Add an event with the add button in title bar." msgstr "Aggiungi un evento con il bottone \"Aggiungi\" nella barra del titolo." #: src/openwindow.blp:83 src/pages/events.blp:71 msgid "No matches" msgstr "Nessuna corrispondenza" #: src/openwindow.blp:98 msgid "Coming up" msgstr "In arrivo" #: src/openwindow.blp:108 msgid "Past" msgstr "Passate" #: src/openwindow.blp:128 msgid "Refresh list" msgstr "Aggiorna lista" #: src/openwindow.blp:130 msgid "Search" msgstr "Cerca" #: src/shortcuts.blp:10 msgid "Application" msgstr "Applicazione" #: src/shortcuts.blp:22 msgid "Close" msgstr "Chiude" #: src/shortcuts.blp:27 msgid "Event Window" msgstr "Finestra Evento" #: src/shortcuts.blp:35 msgid "Find talk" msgstr "Trova talk" #: src/shortcuts.blp:39 msgid "Copy talk details to clipboard" msgstr "Copia dettagli talk negli appunti" #: src/shortcuts.blp:52 msgid "Reload events list" msgstr "Ricarica lista eventi" #: src/pages/details.blp:106 msgid "Conflicts with" msgstr "In conflitto con" #: src/pages/details.blp:139 msgid "Links" msgstr "Collegametni" #: src/pages/details.blp:155 msgid "Copy to clipboard" msgstr "Copia negli appunti" #: src/pages/events.blp:61 src/pages/list.blp:36 msgid "Nothing starred yet" msgstr "Nessun preferito ancora" #: src/pages/events.blp:62 src/pages/list.blp:37 msgid "Star a talk to be notified when it's about to start." msgstr "" "Metti un talk tra i preferiti per essere notificato quando sta per iniziare." #: src/widgets/eventeditdialog.blp:10 msgid "Edit event" msgstr "Modifica evento" #: src/widgets/eventeditdialog.blp:14 msgid "Ok" msgstr "Ok" #: src/widgets/eventeditdialog.blp:41 msgid "URL" msgstr "URL" #: src/widgets/eventeditdialog.blp:47 msgid "Title" msgstr "Titolo" #: src/widgets/eventeditdialog.blp:52 msgid "Start" msgstr "Inizio" #: src/widgets/eventeditdialog.blp:56 msgid "End" msgstr "Fine" #: src/widgets/eventeditdialog.blp:60 msgid "Icon URL" msgstr "URL icona" #: src/widgets/loaderpage.blp:10 msgid "Loading..." msgstr "Caricamento…" confy-0.7.0/po/meson.build000066400000000000000000000000461446165717300154320ustar00rootroot00000000000000i18n.gettext('confy', preset: 'glib') confy-0.7.0/po/sv.po000066400000000000000000000357331446165717300142730ustar00rootroot00000000000000# Swedish translations for confy package. # Copyright (C) 2020-2022 Fabio Comuni, et al. # This file is distributed under the same license as the confy package. # Luna Jernberg , 2023. # msgid "" msgstr "" "Project-Id-Version: confy\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-06-22 15:01+0200\n" "PO-Revision-Date: 2023-07-04 07:10+0200\n" "Last-Translator: Luna Jernberg \n" "Language-Team: ~fabrixxm/confy-dev@lists.sr.ht\n" "Language: sv\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" "X-Generator: Poedit 3.3.2\n" #: src/config.py.in:5 msgid "%A %B %d, %Y" msgstr "%A %B %d, %Å" #: src/local.py:151 msgid "Device disconnected and no cached data available." msgstr "Enheten är frånkopplad och ingen cachad data tillgänglig." #. edit existing obj #: src/local.py:284 src/openwindow.py:165 msgid "Event already in list" msgstr "Evenemanget finns redan i listan" #. Translators: about dialog text; this string should be replaced by a text crediting yourselves and your translation team, or should be left empty. Do not translate literally! #: src/main.py:148 msgid "translator-credits" msgstr "Luna Jernberg " #: src/main.py:149 data/net.kirgroup.confy.metainfo.xml.in:7 msgid "Conference schedules viewer" msgstr "Konferensscheman visare" #: src/openwindow.py:55 src/openwindow.py:94 src/openwindow.py:197 msgid "" "Error loading events list:\n" "{}" msgstr "" "Fel vid laddning av evenemangslistan:\n" "{}" #: src/openwindow.py:91 msgid "Events list updated" msgstr "Evenemangslistan uppdaterad" #: src/openwindow.py:110 msgid "Delete event \"{}\"?" msgstr "Ta bort evenemang \"{}\"?" #: src/openwindow.py:111 msgid "Event will be removed from event list and related data will be deleted" msgstr "" "Evenemanget kommer att tas bort från evenemangslistan och relaterad data " "kommer att raderas" #: src/openwindow.py:112 src/widgets/inputdialog.py:31 src/openwindow.blp:62 #: src/widgets/eventeditdialog.blp:20 src/widgets/loaderpage.blp:22 msgid "Cancel" msgstr "Avbryt" #: src/openwindow.py:113 src/widgets/eventeditdialog.blp:27 msgid "Delete" msgstr "Ta bort" #: src/openwindow.py:147 msgid "New event: {}" msgstr "Nytt evenemang : {}" #: src/openwindow.py:150 src/openwindow.py:170 msgid "Error: {}" msgstr "Fel : {}" #: src/preferences.py:48 data/net.kirgroup.confy.gschema.xml:7 msgid "Events list cache duration" msgstr "Evenemangslistans cachelängd" #: src/preferences.py:49 msgid "Try to update list cache when it's older than this." msgstr "Försök att uppdatera listcachen när den är äldre än detta." #: src/preferences.py:54 msgid "Events info cache duration" msgstr "Evenemangsinformation cache varaktighet" #: src/preferences.py:55 msgid "Try to update event cache when it's older than this." msgstr "Försök att uppdatera evenemangscachen när den är äldre än detta." #: src/preferences.py:64 msgid "Clear" msgstr "Rensa" #: src/preferences.py:68 msgid "Cached data" msgstr "Cachad data" #: src/preferences.py:85 msgid "Confy has {} of cached data" msgstr "Confy har {} cachad data" #: src/pages/events.py:116 msgid "Talks on {}" msgstr "Föreläsningar på {}" #: src/pages/events.py:128 msgid "{} Track" msgstr "{} Spår" #: src/pages/events.py:135 msgid "No Room" msgstr "Inga rum" #: src/pages/events.py:137 msgid "Room {}" msgstr "Rum {}" #: src/pages/events.py:145 src/mainwindow.blp:166 msgid "Starred" msgstr "Stjärnmärkt" #: src/pages/events.py:152 msgid "Search Talks" msgstr "Sök efter föreläsningar" #: src/pages/info.py:31 src/mainwindow.blp:125 msgid "Event info" msgstr "Evenemangsinformation" #: src/remotes/__init__.py:35 msgid "Unknown schedule format" msgstr "Okänt schemaformat" #: src/remotes/pentabarf.py:54 msgid "Invalid pentabarf format" msgstr "Ogiltigt pentabarf format" #: data/net.kirgroup.confy.desktop.in:3 #: data/net.kirgroup.confy.metainfo.xml.in:4 msgid "Confy" msgstr "Confy" #: data/net.kirgroup.confy.desktop.in:10 msgid "Conference;Organize;" msgstr "Konferens;Organisera;schemalägga;seminarium;möte;" #: data/net.kirgroup.confy.metainfo.xml.in:5 msgid "Fabio Comuni" msgstr "Fabio Comuni" #: data/net.kirgroup.confy.metainfo.xml.in:9 msgid "Confy lets you browse conference schedules." msgstr "Confy låter dig bläddra i konferensscheman." #: data/net.kirgroup.confy.metainfo.xml.in:12 msgid "" "Browse talks by day, track or room. Select the talks you are interested in " "and receive notification when they are about to start. View when two or more " "talks you are interested in overlap." msgstr "" "Bläddra bland föreläsningar efter dag, spår eller rum. Välj de föreläsningar " "du är intresserad av och få ett meddelande när de ska börja. Se när två " "eller flera föredrag som du är intresserad av överlappar varandra." #: data/net.kirgroup.confy.metainfo.xml.in:45 msgid "French tranlsation, thanks to Irénée Thirion" msgstr "Fransk översättning, tack till Irénée Thirion" #: data/net.kirgroup.confy.metainfo.xml.in:46 msgid "Swedish translation, thanks to Luna Jernberg" msgstr "Svensk översättning, tack till Luna Jernberg" #: data/net.kirgroup.confy.metainfo.xml.in:47 msgid "Fix Pentabarf date parsing" msgstr "Fixa Pentabarf datumparsning" #: data/net.kirgroup.confy.metainfo.xml.in:48 msgid "Flatpak: bump Gnome Runtime to verion 44" msgstr "Flatpak: öka Gnome körtid till version 44" #: data/net.kirgroup.confy.metainfo.xml.in:53 msgid "Convert markdown links to html hyperlinks" msgstr "Konvertera markdown länkar till html hyperlänkar" #: data/net.kirgroup.confy.metainfo.xml.in:54 msgid "Don't track visited links in labels" msgstr "Spåra inte besökta länkar i etiketter" #: data/net.kirgroup.confy.metainfo.xml.in:55 msgid "Make labels selectable" msgstr "Gör etiketter valbara" #: data/net.kirgroup.confy.metainfo.xml.in:56 msgid "" "Margin in loading widget: no more loadbar touching screen edges in mobile" msgstr "" "Marginal i laddningswidget: inga fler laddningsfält som rör skärmkanterna på " "mobil" #: data/net.kirgroup.confy.metainfo.xml.in:57 msgid "Event text justified to left" msgstr "Evenemangstext justerad till vänster" #: data/net.kirgroup.confy.metainfo.xml.in:58 msgid "Use symbolic icon in search placeholder" msgstr "Använd symbolisk ikon i sökplatshållaren" #: data/net.kirgroup.confy.metainfo.xml.in:63 msgid "Update metainfo data with input support and display requirement." msgstr "Uppdatera metainfodata med inmatningsstöd och visningskrav." #: data/net.kirgroup.confy.metainfo.xml.in:68 msgid "Update appearance to better conform to Gnome" msgstr "Uppdatera utseendet för att bättre överensstämma med Gnome" #: data/net.kirgroup.confy.metainfo.xml.in:73 msgid "Fix event progressbar for events with zero duration" msgstr "Fixat evenemangsförloppsindikator för händelser med noll varaktighet" #: data/net.kirgroup.confy.metainfo.xml.in:74 msgid "Display events talks datetimes in current timezone" msgstr "Visa evenemang för aktuellt datum och tid i aktuell tidszon" #: data/net.kirgroup.confy.metainfo.xml.in:75 msgid "Declare support for mobile devices in metadata" msgstr "Deklarera stöd för mobila enheter i metadata" #: data/net.kirgroup.confy.metainfo.xml.in:80 msgid "Search talks in schedule and starred view" msgstr "Sök efter föreläsningar i schema och stjärnmärkt vy" #: data/net.kirgroup.confy.metainfo.xml.in:81 msgid "Better page navigation in starred view" msgstr "Bättre sidnavigering i stjärnmärkt vy" #: data/net.kirgroup.confy.metainfo.xml.in:82 msgid "Varius enhancement to UI to better fit GNOME guidelines" msgstr "Diverse förbättring av UI för att bättre passa GNOMEs riktlinjer" #: data/net.kirgroup.confy.metainfo.xml.in:87 msgid "Open urls with default application per file type, if possible." msgstr "Öppna webbadresser med standardprogram per filtyp, om möjligt." #: data/net.kirgroup.confy.metainfo.xml.in:92 msgid "Fix \"next up\" query and notification." msgstr "Fixat \"nästa upp\" fråga och avisering." #: data/net.kirgroup.confy.metainfo.xml.in:93 msgid "Fix text rendering issues with unsupported markup tags." msgstr "Fixade problem med textrendering med kodningstaggar som inte stöds." #: data/net.kirgroup.confy.metainfo.xml.in:98 msgid "Add event progress indicator." msgstr "Lägg till evenemangsförloppsindikator." #: data/net.kirgroup.confy.metainfo.xml.in:99 msgid "" "Fix overlapping events definition: exclude events ending/starting on same " "exact time." msgstr "" "Fixade definition av överlappande evenemang: uteslut evenemang som slutar/" "startar på exakt samma tidpunkt." #: data/net.kirgroup.confy.gschema.xml:8 data/net.kirgroup.confy.gschema.xml:13 msgid "App will auto-update cache (if possible) when it's older than setting." msgstr "" "Programmet kommer automatiskt att uppdatera cachen (om möjligt) när den är " "äldre än inställningen." #: data/net.kirgroup.confy.gschema.xml:12 msgid "Event info cache duration" msgstr "Evenemangsinformation cache varaktighet" #: src/widgets/inputdialog.py:28 msgid "Add Event from URL" msgstr "Lägg till evenemang från URL" #: src/widgets/inputdialog.py:29 msgid "" "Enter URL to event schedule to add it to the list.\n" "Confy supports events in Pentabarf (.xml) or iCal (.ics) format." msgstr "" "Ange URL till evenemangsschemat för att lägga till det i listan.\n" "Confy stöder evenemang i Pentabarf (.xml) eller iCal (.ics) format." #: src/widgets/inputdialog.py:32 msgid "Add" msgstr "Lägg till" #: src/widgets/loadingoverlay.py:37 src/widgets/loadingoverlay.py:42 msgid "Loading…" msgstr "Laddar…" #: src/widgets/loadingoverlay.py:44 msgid "cancel" msgstr "avbryt" #: src/mainwindow.blp:37 msgid "Open an Event to start" msgstr "Öppna ett evenemang vid uppstart" #: src/mainwindow.blp:44 src/mainwindow.blp:203 src/shortcuts.blp:31 #: src/shortcuts.blp:44 msgid "Open Event" msgstr "Öppna evenemang" #: src/mainwindow.blp:133 msgid "Days" msgstr "Dagar" #: src/mainwindow.blp:144 msgid "Tracks" msgstr "Spår" #: src/mainwindow.blp:155 msgid "Rooms" msgstr "Rum" #. separator ? #: src/mainwindow.blp:208 src/openwindow.blp:136 src/shortcuts.blp:14 msgid "Preferences" msgstr "Inställningar" #: src/mainwindow.blp:213 src/openwindow.blp:138 src/shortcuts.blp:18 msgid "Keyboard Shortcuts" msgstr "Tangentbordsgenvägar" #: src/mainwindow.blp:218 src/openwindow.blp:140 msgid "About Confy" msgstr "Om Confy" #: src/openwindow.blp:15 msgid "Events" msgstr "Evenemang" #: src/openwindow.blp:20 src/openwindow.blp:126 src/shortcuts.blp:56 msgid "Add event from URL" msgstr "Lägg till evenemang från URL" #: src/openwindow.blp:27 src/openwindow.blp:56 src/shortcuts.blp:48 msgid "Find event" msgstr "Hitta evenemang" #: src/openwindow.blp:41 msgid "Refresh events list" msgstr "Uppdatera listan med evenemang" #: src/openwindow.blp:51 src/openwindow.blp:132 msgid "Edit events" msgstr "Redigera evenemang" #: src/openwindow.blp:76 msgid "No events yet" msgstr "Inga evenemang än" #: src/openwindow.blp:77 msgid "Add an event with the add button in title bar." msgstr "Lägg till ett evenemang med knappen Lägg till i namnlisten." #: src/openwindow.blp:83 src/pages/events.blp:71 msgid "No matches" msgstr "Inga matchningar" #: src/openwindow.blp:98 msgid "Coming up" msgstr "Kommer upp" #: src/openwindow.blp:108 msgid "Past" msgstr "Förbi" #: src/openwindow.blp:128 msgid "Refresh list" msgstr "Uppdatera lista" #: src/openwindow.blp:130 msgid "Search" msgstr "Sök" #: src/shortcuts.blp:10 msgid "Application" msgstr "Program" #: src/shortcuts.blp:22 msgid "Close" msgstr "Stäng" #: src/shortcuts.blp:27 msgid "Event Window" msgstr "Evenemangs fönster" #: src/shortcuts.blp:35 msgid "Find talk" msgstr "Hitta föreläsning" #: src/shortcuts.blp:39 msgid "Copy talk details to clipboard" msgstr "Kopiera föreläsningsdetaljer till urklipp" #: src/shortcuts.blp:52 msgid "Reload events list" msgstr "Ladda om evenemangslista" #: src/pages/details.blp:106 msgid "Conflicts with" msgstr "Krockar med" #: src/pages/details.blp:139 msgid "Links" msgstr "Länkar" #: src/pages/details.blp:155 msgid "Copy to clipboard" msgstr "Kopiera till urklipp" #: src/pages/events.blp:61 src/pages/list.blp:36 msgid "Nothing starred yet" msgstr "Inget stjärnmärkt ännu" #: src/pages/events.blp:62 src/pages/list.blp:37 msgid "Star a talk to be notified when it's about to start." msgstr "Stjärnmärk en föreläsning för att få ett meddelande när den ska börja." #: src/widgets/eventeditdialog.blp:10 msgid "Edit event" msgstr "Redigera evenemang" #: src/widgets/eventeditdialog.blp:14 msgid "Ok" msgstr "OK" #: src/widgets/eventeditdialog.blp:41 msgid "URL" msgstr "URL" #: src/widgets/eventeditdialog.blp:47 msgid "Title" msgstr "Titel" #: src/widgets/eventeditdialog.blp:52 msgid "Start" msgstr "Start" #: src/widgets/eventeditdialog.blp:56 msgid "End" msgstr "Slut" #: src/widgets/eventeditdialog.blp:60 msgid "Icon URL" msgstr "Ikon-URL" #: src/widgets/loaderpage.blp:10 msgid "Loading..." msgstr "Laddar..." #, fuzzy #~ msgid "Open Conference" #~ msgstr "Redigera konferans" #~ msgid "Show window menu" #~ msgstr "Visa fönstermeny" #~ msgid "Error loading event" #~ msgstr "Fel vid laddning av evenemang" #~ msgid "Go back" #~ msgstr "Gå tillbaka" #~ msgid "Schedule" #~ msgstr "Schema" #~ msgid "Map" #~ msgstr "Karta" #~ msgid "" #~ "Updated event:\n" #~ "{}" #~ msgstr "" #~ "Uppdaterat evenemang:\n" #~ "{}" #~ msgid "Event schedule updated" #~ msgstr "Evenemangsprogram uppdaterat" #~ msgid "Next up: {}" #~ msgstr "Nästa: {}" #~ msgid "at {} in {}" #~ msgstr "på {} i {}" #~ msgid "cache updated" #~ msgstr "cachen uppdaterad" #~ msgid "Room: {}" #~ msgstr "Rum: {}" #~ msgid "Track: {}" #~ msgstr "Spår {}" #~ msgid "Links" #~ msgstr "Länkar" #~ msgid "You don't have any starred talk yet." #~ msgstr "Du har inga stjärnmärkta föreläsningar än." #~ msgid "" #~ "Click on the star button to add a talk to this list and to be reminded " #~ "when they are about to start." #~ msgstr "" #~ "Klicka på stjärnknappen för att lägga till en föreläsning till den här " #~ "listan och för att bli påmind när de ska börja." #~ msgid "{}" #~ msgstr "{}" #~ msgid "Loading…" #~ msgstr "Laddar…" #~ msgid "Schedule URL" #~ msgstr "Schema URL" #~ msgid "%b %a %d %Y" #~ msgstr "%b %a %d %Y" #~ msgid "No cache" #~ msgstr "Ingen cache" #~ msgid "One hour" #~ msgstr "En timme" #~ msgid "One day" #~ msgstr "En dag" #~ msgid "One week" #~ msgstr "En vecka" #~ msgid "Quit" #~ msgstr "Avsluta" #~ msgid "" #~ "Confy lets you organise your visit - select talks to be reminded of (with " #~ "warnings in case of conflicts)." #~ msgstr "" #~ "Confy låter dig organisera ditt besök - välj föreläsningar att påminnas " #~ "om (med varningar i händelse av krockar)." #~ msgid "Conference schedule viewer" #~ msgstr "Konferensschema visare" #~ msgid "Conferences schedule viewer" #~ msgstr "Konferenser schemavisare" confy-0.7.0/python3-icalendar.json000066400000000000000000000037511446165717300170770ustar00rootroot00000000000000{ "name": "python3-icalendar", "buildsystem": "simple", "build-commands": [ "pip3 install --exists-action=i --no-index --find-links=\"file://${PWD}\" --prefix=${FLATPAK_DEST} \"icalendar\"" ], "sources": [ { "type": "file", "url": "https://files.pythonhosted.org/packages/aa/d4/0089d680a610c7b5afda26c1ae588eb363b9050ccf5f33a8c2d1164210f3/setuptools-51.1.2-py3-none-any.whl", "sha256": "67d8af2fc9f33e48f8f4387321700a79b27090a5cff154e5ce1a8c72c2eea54f" }, { "type": "file", "url": "https://files.pythonhosted.org/packages/65/63/39d04c74222770ed1589c0eaba06c05891801219272420b40311cd60c880/wheel-0.36.2-py2.py3-none-any.whl", "sha256": "78b5b185f0e5763c26ca1e324373aadd49182ca90e825f7853f4b2509215dc0e" }, { "type": "file", "url": "https://files.pythonhosted.org/packages/db/6e/2815f7c8561b088ccedc128681e64daac3d6b2e81a9918b007e244dad8b1/setuptools_scm-5.0.1-py2.py3-none-any.whl", "sha256": "62fa535edb31ece9fa65dc9dcb3056145b8020c8c26c0ef1018aef33db95c40d" }, { "type": "file", "url": "https://files.pythonhosted.org/packages/be/ed/5bbc91f03fa4c839c4c7360375da77f9659af5f7086b7a7bdda65771c8e0/python-dateutil-2.8.1.tar.gz", "sha256": "73ebfe9dbf22e832286dafa60473e4cd239f8592f699aa5adaf10050e6e1823c" }, { "type": "file", "url": "https://files.pythonhosted.org/packages/70/44/404ec10dca553032900a65bcded8b8280cf7c64cc3b723324e2181bf93c9/pytz-2020.5.tar.gz", "sha256": "180befebb1927b16f6b57101720075a984c019ac16b1b7575673bea42c6c3da5" }, { "type": "file", "url": "https://files.pythonhosted.org/packages/58/b8/9aa7963f442b2a8bfdfc40eab8bc399c5eaac5711b8919c52122e4903544/icalendar-4.0.7.tar.gz", "sha256": "0fc18d87f66e0b5da84fa731389496cfe18e4c21304e8f6713556b2e8724a7a4" } ] } confy-0.7.0/src/000077500000000000000000000000001446165717300134415ustar00rootroot00000000000000confy-0.7.0/src/__init__.py000066400000000000000000000000001446165717300155400ustar00rootroot00000000000000confy-0.7.0/src/config.py.in000066400000000000000000000001421446165717300156620ustar00rootroot00000000000000APP_VERSION="@VERSION@" APP_NAME="Confy" APP_ID="net.kirgroup.confy" FMT_DAY = _("%A %B %d, %Y") confy-0.7.0/src/confy.css000066400000000000000000000004101446165717300152640ustar00rootroot00000000000000/* default box margin inside a Clamp. That's the main box */ .main-box { margin: 24px 12px; } /* floating toolbar over map */ .map-toolbar { border-radius: 5px; margin: 0 16px 16px 0; } .editbar { background-color: @accent_bg_color; color: @accent_fg_color; } confy-0.7.0/src/confy.gresource.xml000066400000000000000000000024321446165717300172770ustar00rootroot00000000000000 confy.css shortcuts.ui openwindow.ui mainwindow.ui widgets/searchbaroverlay.ui widgets/eventeditdialog.ui widgets/sidebar.ui widgets/loaderpage.ui widgets/pageheaderbar.ui widgets/starbutton.ui pages/info.ui pages/list.ui pages/events.ui pages/details.ui confy-0.7.0/src/confy.in000077500000000000000000000024471446165717300151210ustar00rootroot00000000000000#!@PYTHON@ # confy.in # # Copyright 2020-2022 Fabio Comuni, et al. # # 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 . import os import sys import signal import gettext VERSION = '@VERSION@' pkgdatadir = '@pkgdatadir@' pythondir = '@pythondir@' localedir = '@localedir@' sys.path.insert(1, pythondir) signal.signal(signal.SIGINT, signal.SIG_DFL) gettext.install('confy', localedir) if __name__ == '__main__': import gi from gi.repository import Gio resource = Gio.Resource.load(os.path.join(pkgdatadir, 'confy.gresource')) resource._register() resource = Gio.Resource.load(os.path.join(pkgdatadir, 'confy.data.gresource')) resource._register() from confy import main sys.exit(main.main(VERSION)) confy-0.7.0/src/fetcher.py000066400000000000000000000072031446165717300154350ustar00rootroot00000000000000# fetcher.py # # Copyright 2020-2022 Fabio Comuni, et al. # # 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 . from threading import Thread import os import tempfile import urllib.request from gi.repository import GLib from gi.repository import GObject class DownloadCancelled(Exception): pass class Fetcher(GObject.GObject): """ Fetch source to dest, asyncly. property running (bool, r) download is running fraction (floar, r) download progress 0.0 - 1.0 signals: error (message:str) done (local_file_path:str) """ @GObject.Signal(arg_types=(str,)) def error(self, message): ... @GObject.Signal(arg_types=(str,)) def done(self, local_file_path): ... @GObject.property(type=bool, default=False) def running(self): return self._run @GObject.property(type=GObject.TYPE_DOUBLE) def fraction(self): return self._fraction def __init__(self, source, dest=None, cbk=None): """ download `source` to `dest` `source`: uri `dest`: path. if None, then temp `cbk` : function called when done: `fn(local_file_path)` `cbk` is called before firing `done` signal. If any exception is raised by `cbk`, `error` signal is fired, instead. """ super().__init__() self._run = True self._fraction = 0.0 self._cbk = cbk if dest is None: _, dest = tempfile.mkstemp() Thread(target=self._fetch, args=(source, dest)).start() def _fetch(self, source, dest): try: with urllib.request.urlopen(source, timeout=20) as fsrc, open(dest, "wb") as fdst: total_size = int(fsrc.info().get('Content-Length', 0)) block_size = 8192 dwl_size = 0 # python in runtime is old :) #while chunk := fsrc.read(block_size): chunk = fsrc.read(block_size) while chunk: if not self._run: raise DownloadCancelled("Download cacelled") fdst.write(chunk) if total_size > 0: dwl_size += block_size self._fraction = min(dwl_size, total_size) / total_size GLib.idle_add(self.notify,"fraction") chunk = fsrc.read(block_size) except Exception as e: if os.path.exists(dest): os.unlink(dest) import traceback; traceback.print_exc() GLib.idle_add(self.emit, "error", str(e)) else: GLib.idle_add(self._done, dest) def _done(self, dest): if self._cbk is not None: try: self._cbk(self, dest) except Exception as e: import traceback; traceback.print_exc() GLib.idle_add(self.emit, "error", str(e)) return GLib.idle_add(self.emit, "done", dest) def cancel(self): self._run = False self.notify("running") confy-0.7.0/src/local.py000066400000000000000000000250011446165717300151030ustar00rootroot00000000000000# local.py # # Copyright 2020-2022 Fabio Comuni, et al. # # 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 . import types import os import json import hashlib import urllib.request import sqlite3 import importlib.util import datetime import time from gi.repository import GLib from gi.repository import GObject from .settings import Settings from .fetcher import Fetcher from . import remotes ### init and migration machinery class LocalDBDoesNotExistsException(Exception): pass class LocalDBNotOpen(Exception): pass dbfile = None db = None appdir = None cachedir = None def getDb(): return db def init(app_id:str): """Init paths and open db""" global appdir, cachedir appdir = os.path.join(GLib.get_user_data_dir(), app_id) if not os.path.exists(appdir): os.makedirs(appdir) cachedir = os.path.join(GLib.get_user_cache_dir(), app_id) if not os.path.exists(cachedir): os.makedirs(cachedir) Settings.init(app_id) def import_migration(filename:str) -> types.ModuleType: modulename = os.path.basename(filename).replace(".py", "") spec = importlib.util.spec_from_file_location(modulename, filename) migration = importlib.util.module_from_spec(spec) spec.loader.exec_module(migration) return migration def migrate(): schema = -1 migrated = False try: c = db.execute("SELECT value FROM meta WHERE key='schema'" ) info = c.fetchone() if info is not None: schema = int(info['value']) except Exception as e: print("... " , e) migrationsdir = os.path.join(os.path.dirname(__file__), "migrations") files = sorted([ f for f in os.listdir(migrationsdir) if f.endswith(".py") ]) try: c = db.cursor() for f in files: newschema = int(f.split("_")[0]) if newschema > schema: ## TODO: how to log using glib? print("Migrating to {}".format(f.replace(".py", ""))) import_migration(os.path.join(migrationsdir,f)).up(c) schema = newschema migrated = True except Exception as e: db.rollback() raise e from None db.execute("INSERT OR REPLACE INTO meta (key, value) VALUES ('schema', ?)", (schema,)) db.commit() return migrated # event database def openconf(conf, is_online=True): """Open event database for `conf` conf is a models.Conference After opening, tries to update meta """ def _update_meta(*args): from .models import Meta with Meta() as m: m.title = m.title if m.title else conf.title m.start = m.start if m.start else conf.start m.end = m.end if m.end else conf.end f = opendb(conf.url, is_online) if f is None: _update_meta() else: f.connect("done", _update_meta) return f def existsdb(url): """Check if exists database for `url`""" dbhashname = hashlib.md5(url.encode('utf8')).hexdigest() dbfilename = os.path.join(cachedir, dbhashname+".db") return os.path.exists(dbfilename) def opendb(url, is_online=True): """Open event database for `url` if `is_online`, fetch original pentabarf and update cache return Fetcher instance if downloading, else None """ global dbfile, db dbhashname = hashlib.md5(url.encode('utf8')).hexdigest() dbfilename = os.path.join(cachedir, dbhashname+".db") if not os.path.exists(dbfilename) and not is_online: db = None raise LocalDBDoesNotExistsException(_("Device disconnected and no cached data available.")) print("open db", dbfilename) db = sqlite3.connect(dbfilename, detect_types=sqlite3.PARSE_DECLTYPES|sqlite3.PARSE_COLNAMES) db.row_factory = sqlite3.Row migrated = migrate() dbfile = dbfilename from .models import Meta is_time_to_update = (time.time() - Meta().last_update) > Settings.instance().get_event_cache() if is_online and (migrated or is_time_to_update): return updatedb(url) return None def updatedb(from_url): """Update event cache from schedule url return Fetcher instance """ if db is None: raise LocalDBNotOpen() return remotes.update_schedule(from_url) def close(): """Close db""" global db, dbfile dbfile = None if db is not None: db.close() db = None ## schedules list (from giggity and user defined) def update_menu() -> Fetcher: """Fetch remote menu json""" # TODO: what about user entries shadowing entries from giggity? ggcachefile = os.path.join(cachedir, "ggmenu.json") url = "https://ggt.gaa.st/menu.json" return Fetcher(url, ggcachefile) def open_menu(is_online): """ Update menu cache file if expired or not exists. returns None or Fetcher """ ggcachefile = os.path.join(cachedir, "ggmenu.json") print("menu cache file:", ggcachefile) need_refresh = not os.path.exists(ggcachefile) need_refresh = need_refresh or ((time.time() - os.path.getmtime(ggcachefile)) > Settings.instance().get_list_cache()) if need_refresh and is_online: return update_menu() return None def get_menu(): """ Get menu entries from menu cache and from user menu entries. User entries with same urls as entries from gg cache file shadow the latter (happens when user edit an entry from gg) """ ggcachefile = os.path.join(cachedir, "ggmenu.json") userfile = os.path.join(cachedir, "usermenu.json") schedules = [] if os.path.exists(userfile): with open(userfile, "r") as f: schedules += json.load(f) userurls = [ s['url'] for s in schedules ] if os.path.exists(ggcachefile): with open(ggcachefile, "r") as f: menu = json.load(f) for s in menu['schedules']: if s['url'] not in userurls: schedules.append(s) def _sort_key(elm): start = elm['start'] return datetime.date(*[int(s) for s in start.split("-")]) schedules = sorted(schedules, key=_sort_key, reverse=True) return schedules def _add_user_menu_ready(sender, local_file_path, cbk): userfile = os.path.join(cachedir, "usermenu.json") from .models import Meta m = Meta() item = m.to_json() if m.title is None: m.title = "" m.save() schedules = [] if os.path.exists(userfile): with open(userfile, "r") as f: schedules = json.load(f) schedules.append(item) with open(userfile, "w") as f: json.dump(schedules, f) cbk(m) close() class MenuItemAlreadyExistsException(Exception): def __init__(self, message, obj): super().__init__(message) self.obj = obj def add_user_menu(url, cbk): """ Add and fetch schedule from url. Returns Fetcher or None. When ready calls "cbk({..metadata..})" """ # try to not add same event twice: objs = [ e for e in get_menu() if e['url'] == url ] if len(objs) > 0: raise MenuItemAlreadyExistsException(_("Event already in list"), objs[0]) f = opendb(url, True) # I suppose that we are online at this point.. if f is not None: f.connect("done", _add_user_menu_ready, cbk) else: _add_user_menu_ready(None, None, cbk) return f def update_user_menu(data): """ Update user menu entry data is a dict() """ data['user'] = True userfile = os.path.join(cachedir, "usermenu.json") if os.path.exists(userfile): with open(userfile, "r") as f: schedules = json.load(f) else: schedules = [] _id = None for i, s in enumerate(schedules): if s['url'] == data['url']: _id = i break if _id is None: schedules.append(data) else: schedules[_id] = data with open(userfile, "w") as f: json.dump(schedules, f) def delete_user_menu(data): """ Remove user menu entry `data` is a dict() """ userfile = os.path.join(cachedir, "usermenu.json") if not os.path.exists(userfile): # non dovrei arrivare qui. solo i meta con user=True # posso essere editati, e quindi deve esistere il file raise Exception("User menu file not found. This should not happen.") with open(userfile, "r") as f: schedules = json.load(f) _id = None for i, s in enumerate(schedules): if s['url'] == data['url']: _id = i break if _id is not None: del schedules[_id] with open(userfile, "w") as f: json.dump(schedules, f) # async image fetcher def get_image_async(fileurl, cbk): """ Save a remote image in local cache. Returns Fetcher or None When ready calls "cbk(None, 'localfilename')" """ if fileurl is None: return None localfilename = hashlib.md5(fileurl.encode('utf8')).hexdigest() localdir = os.path.join(cachedir, "images") if not os.path.exists(localdir): os.makedirs(localdir) localfile = os.path.join(localdir, localfilename) if not os.path.exists(localfile): try: return Fetcher(fileurl, localfile, cbk) except Exception: return None cbk(None, localfile) return None # cache handling def get_cache_size(): """get total size of cache files: db and images. skip json menu files""" total_size = 0 for dirpath, dirnames, filenames in os.walk(cachedir): for f in filenames: if not f.endswith(".json"): fp = os.path.join(dirpath, f) # skip if it is symbolic link if not os.path.islink(fp): total_size += os.path.getsize(fp) return total_size def clear_cache(): """remove all files in cachedir except currently opened database and json menu files""" for dirpath, dirnames, filenames in os.walk(cachedir): for f in filenames: if not f.endswith(".json"): fp = os.path.join(dirpath, f) if fp != dbfile: os.remove(fp) confy-0.7.0/src/main.py000066400000000000000000000124761446165717300147510ustar00rootroot00000000000000# main.py # # Copyright 2020-2022 Fabio Comuni, et al. # # 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 . import sys import gi gi.require_version('Gtk', '4.0') gi.require_version('Adw', '1') gi.require_version("Notify", "0.7") from gi.repository import Gtk, Gdk, Gio, GLib, GObject from gi.repository import Adw from gi.repository import Notify from . import local from . import models from .config import APP_NAME, APP_ID, APP_VERSION from .preferences import PreferencesWindow from .config import APP_NAME, APP_ID from .openwindow import OpenWindow from .mainwindow import MainWindow class Application(Gtk.Application): @GObject.Signal def tick(self): """Event fired every minute Used to check for notifications to send and to update events row background """ pass def __init__(self): super().__init__(application_id=APP_ID, flags=Gio.ApplicationFlags.FLAGS_NONE) GLib.set_application_name(APP_NAME) GLib.set_prgname(APP_ID) display = Gdk.Display.get_default() # resource icons in icon theme path icon_theme = Gtk.IconTheme.get_for_display(display) icon_theme.add_resource_path("/net/kirgroup/confy/icons") # custom css css_provider = Gtk.CssProvider() css_provider.load_from_resource("/net/kirgroup/confy/confy.css") Gtk.StyleContext.add_provider_for_display( display, css_provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION) def run(self, argv): self.connect("startup", self.on_startup) self.connect("activate", self.on_activate) self.connect("shutdown", self.on_shutdown) return super().run(argv) def on_startup(self, *_): Adw.init() Notify.init(APP_NAME) local.init(APP_ID) self._add_action('quit', None, ["q",], lambda *args: self.quit()) self._add_action('shortcuts', None, ["question"], self.show_shortcuts) self._add_action('preferences', None, ["comma",], self.show_preferences) self._add_action('about', None, None, self.show_about) self.set_accels_for_action("win.open-conference", ["o",]) self.set_accels_for_action("win.search", ["f",]) self.set_accels_for_action("win.copy", ["c",]) self.set_accels_for_action("win.add-event", ["a"]) self.set_accels_for_action("win.refresh-events", ["r"]) GLib.timeout_add_seconds(30, self._do_tick) def _add_action(self, name, parameter_type, accels, activate_cbk): action = Gio.SimpleAction.new(name, parameter_type) action.connect("activate", activate_cbk) self.add_action(action) if accels is not None: self.set_accels_for_action(F"app.{name}", accels) return action def _do_tick(self): self.emit("tick") return True def open_conf(self, conf): win = self.props.active_window if isinstance(win, OpenWindow): win.close() win = self.props.active_window win.load_conf(conf) win.present() #def start_window(self): # a_win = self.props.active_window # win = OpenWindow(application=self) # if isinstance(a_win, MainWindow): # win.connect("show", lambda *_: a_win.destroy()) # win.present() def on_activate(self, *_): win = self.props.active_window if not win: win = MainWindow(application=self) win.present() def on_shutdown(self, *_): local.close() def show_shortcuts(self, *_): b = Gtk.Builder.new_from_resource("/net/kirgroup/confy/shortcuts.ui") w = b.get_object("shortcuts-win") w.set_transient_for(self.props.active_window) w.props.view_name = None w.show() def show_preferences(self, *args): pref = PreferencesWindow(transient_for=self.props.active_window) pref.show() def show_about(self, *args): Adw.AboutWindow( application_name=APP_NAME, application_icon=APP_ID, version=APP_VERSION, copyright="© 2020-2023 Fabio Comuni, et al.", website="https://confy.kirgroup.net/", developers=["Fabio Comuni", "Evangelos Ribeiro Tzaras", "Sebastian Crane"], # Translators: about dialog text; this string should be replaced by a text crediting yourselves and your translation team, or should be left empty. Do not translate literally! translator_credits=_("translator-credits"), comments=_("Conference schedules viewer"), license_type=Gtk.License.GPL_3_0 ).show() def main(version): app = Application() return app.run(sys.argv) confy-0.7.0/src/mainwindow.blp000066400000000000000000000106341446165717300163200ustar00rootroot00000000000000using Gtk 4.0; using Adw 1; template $ConfyMainWindow : Adw.ApplicationWindow { title: "Confy"; close-request => $_on_close_requested(); Gtk.Stack loader_stack { Gtk.StackPage { name: 'start'; child:Gtk.WindowHandle { Gtk.Box { orientation: vertical; Gtk.HeaderBar { styles ["flat"] [title] Gtk.Label {} [end] MenuButton { menu-model: menu_app; icon-name: "open-menu-symbolic"; primary: true; } } Gtk.ScrolledWindow { hexpand: true; vexpand: true; Adw.StatusPage nomatch_placeholder { icon-name: "net.kirgroup.confy"; title: "Confy"; description: _("Open an Event to start"); vexpand: true; child: Gtk.Button { halign: center; hexpand: false; styles ["suggested-action", "pill"] label: _("Open Event"); action-name: 'win.open-conference'; }; } } } }; } Gtk.StackPage { name: "loader"; child: $ConfyLoaderPage loader {}; } // /page 'loader' Gtk.StackPage { name: "main"; child: Adw.ToastOverlay overlay { Adw.Leaflet subpage_leaflet { can-navigate-back: true; can-unfold: false; Adw.Leaflet leaflet { can-navigate-back: true; Gtk.Box sidebar_box { orientation: vertical; width-request: 250; hexpand-set: true; Adw.HeaderBar { show-end-title-buttons: bind-property leaflet.folded; [start] Gtk.Button { icon-name: "system-search-symbolic"; action-name: "win.search"; } [end] MenuButton button_menu { menu-model: menu_app; icon-name: "open-menu-symbolic"; primary: true; } } Gtk.ScrolledWindow { hscrollbar-policy: never; vexpand: true; $ConfySideBar sidebar { stack: main_stack; page-changed => $_on_page_changed(); } } } // /sidebar_box Adw.LeafletPage { navigatable: false; child: Gtk.Separator {}; } Gtk.Box main_box { orientation: vertical; vexpand: true; $ConfyPageHeaderBar pageheaderbar { show-start-title-buttons: bind-property leaflet.folded; } Gtk.Stack main_stack { Gtk.StackPage { name: "info"; title: _("Event info"); icon-name: "emblem-system-symbolic"; child: $ConfyPageInfo page_info { }; } // page 'info' Gtk.StackPage { name: "days"; title: _("Days"); icon-name: "x-office-calendar-symbolic"; child: $ConfyPageList { model: "days"; row-activated => $_on_pagelist_row_activated(); }; } // page 'days' Gtk.StackPage { name: "tracks"; title: _("Tracks"); icon-name: "format-justify-fill-symbolic"; child: $ConfyPageList { model: "tracks"; row-activated => $_on_pagelist_row_activated(); }; } // page 'tracks' Gtk.StackPage { name: "rooms"; title: _("Rooms"); icon-name: "display-projector-symbolic"; child: $ConfyPageList { model: "rooms"; row-activated => $_on_pagelist_row_activated(); }; } // page 'rooms' Gtk.StackPage { name: "starred"; title: _("Starred"); icon-name: "starred-symbolic"; child: $ConfyPageList { model: "starred"; row-activated => $_on_event_row_activated(); }; } // page 'starred' } // /main-stack } // /main-box }// /leaflet $ConfyPageEvents subpage_events { row-activated => $_on_event_row_activated(); } // /subpage_events $ConfyPageEvents subpage_search_all { model: "search"; row-activated => $_on_event_row_activated(); }// /subpage_search_all} $ConfyPageDetails subpage_details { } // /subpage_details }// /subpage_leaflet };// overlay } // page 'main' } // /loader-stack } menu menu_app { section { item { label: _("Open Event"); action: "win.open-conference"; } item { label: _("Preferences"); action: "app.preferences"; } item { label: _("Keyboard Shortcuts"); action: "app.shortcuts"; } item { label: _("About Confy"); action: "app.about"; } } }confy-0.7.0/src/mainwindow.py000066400000000000000000000235351446165717300161770ustar00rootroot00000000000000from time import time from gi.repository import Gio from gi.repository import GObject from gi.repository import Gtk from gi.repository import Adw from gi.repository import Notify from . import local from . import models from .settings import Settings from .openwindow import OpenWindow from .config import APP_NAME, APP_ID, APP_VERSION from .networkconnectionmonitor import NetworkConnectionMonitor from .widgets import LoaderPage from .widgets import SideBar from .widgets import PageHeaderBar from .pages import PageInfo from .pages import PageList from .pages import PageDetails from .utils import clean_markup @Gtk.Template(resource_path="/net/kirgroup/confy/mainwindow.ui") class MainWindow(Adw.ApplicationWindow): __gtype_name__ = "ConfyMainWindow" @GObject.Signal def conf_updated(self): pass overlay = Gtk.Template.Child() loader_stack = Gtk.Template.Child() loader = Gtk.Template.Child() leaflet = Gtk.Template.Child() subpage_leaflet = Gtk.Template.Child() sidebar_box = Gtk.Template.Child() sidebar = Gtk.Template.Child() main_box = Gtk.Template.Child() pageheaderbar = Gtk.Template.Child() main_stack = Gtk.Template.Child() subpage_events = Gtk.Template.Child() subpage_search_all = Gtk.Template.Child() subpage_details = Gtk.Template.Child() def __init__(self, **kwargs): super().__init__(**kwargs) size = Settings.instance().get_size() self.set_default_size(*size) self._add_action("show-subpage-events",None, lambda *_: self.show_subpage_events()) self._add_action("show-subpage-details",None, lambda *_: self.show_subpage_details()) self._add_action("subpage-back",None, lambda *_: self.subpage_navigate_back()) self._add_action("show-sidebar", None, lambda *_: self.show_sidebar()) self._add_action("show-page", None, lambda *_: self.show_stack()) self._add_action("open-conference", None, self.open_conference) self._add_action("search", None, lambda *_: self.show_search_all()) self._add_action("copy", None, lambda *_: self.copy_details_to_clipboard()) self.nm = NetworkConnectionMonitor() self.nm.connect("notify",self._on_networkconnectionmonitor_notify) def load_conf(self, conf): self.conf = conf self.show_main() self.show_stack() self.main_stack.set_visible_child_name('info') self._init_pages() self.subpage_leaflet.get_page(self.subpage_search_all).set_navigatable(False) self.set_pageheader_title() self.show_loader() self.connect('conf-updated', self._on_conf_updated) try: fetcher = local.openconf(conf, is_online=self.nm.props.isconnected) except Exception as e: self.show_error(e) return else: if fetcher is not None: fetcher.connect("done", self._on_fetcher_done) fetcher.connect("error", self._on_fetcher_error) self.loader.set_fetcher(fetcher) else: self.emit("conf-updated") self.show_main() self.notifications = {} # Check if there are notifications to send Gio.Application.get_default().connect( 'tick', self.check_event_notification ) self.check_event_notification() def _init_pages(self): for p in self.main_stack.get_pages(): child = p.get_child() if hasattr(child, "init"): child.init(self, self.conf) self.connect("conf-updated", self.subpage_events.update) def _on_conf_updated(self, *_): # hide empty pages for p in self.main_stack.get_pages(): child = p.get_child() if p.get_name() in ('days', 'tracks', 'rooms',): p.set_visible(len(list(child.get_objects())) > 0) def _add_action(self, name, parameter_type, activate_cbk): action = Gio.SimpleAction.new(name, parameter_type) action.connect("activate", activate_cbk) self.add_action(action) return action def _on_networkconnectionmonitor_notify(self, *_): ... def _on_fetcher_done(self, *_): self.emit("conf_updated") self.show_main() def _on_fetcher_error(self, fetcher, error): self.show_error(error) def check_event_notification(self, *args): nextup = list(models.Event.nextup(5)) for e in nextup: # fast and stupid clean html #cleanr = re.compile('<.*?>|&([a-z0-9]+|#[0-9]{1,6}|#x[0-9a-f]{1,6});') #title = re.sub(cleanr, '', e.title) title = clean_markup(e.title) self._send_desktop_notification( _("Next up: {}").format(title), _("at {} in {}").format( e.start_in_tz().strftime("%H:%M"), e.room ), f"nextup-{e.id}") e.set_notified(True) def _send_desktop_notification(self, title, body, nid=None): n = Notify.Notification.new(title, body, APP_ID) n.set_timeout(Notify.EXPIRES_NEVER) n.add_action("view", "View", self.on_notification_action, nid) n.show() self.notifications[nid] = n def on_notification_action(self, notification, action, data): print(notification, action, data) if action == "view" and data.startswith("nextup-"): self.present_with_time(time()) eventid = int(data.split("-")[1]) event = models.Event.by_id(eventid) # if we are not on "events" subpage, force it as non navigatable, # we want to be back to where we were print(self.subpage_leaflet.get_visible_child(), self.subpage_events) can_we_go_back_to_events = self.subpage_leaflet.get_visible_child() == self.subpage_events self.show_details(event, can_we_go_back_to_events) def show_start(self): self.loader_stack.set_visible_child_name("start") def show_loader(self): self.loader_stack.set_visible_child_name("loader") def open_conference(self, *_): app = self.get_application() win = OpenWindow(modal=True, transient_for=self, application=app) win.show() def show_error(self, error = None): msg = Adw.MessageDialog( transient_for = self, modal = True, heading = _("Error loading event"), body = str(error) if error else "", ) msg.add_response("ok", _("Ok")) msg.connect("response", self.open_conference) msg.present() def show_main(self): self.loader_stack.set_visible_child_name("main") @Gtk.Template.Callback() def _on_page_changed(self, *_): self.set_pageheader_title() self.show_stack() def set_pageheader_title(self): title = self.main_stack.get_page(self.main_stack.get_visible_child()).get_title() self.pageheaderbar.props.title = title def show_main_leaflet(self): self.subpage_leaflet.set_visible_child(self.leaflet) def show_stack(self): self.leaflet.set_visible_child(self.main_box) def show_sidebar(self): self.leaflet.set_visible_child(self.sidebar_box) def show_subpage_events(self): self.subpage_leaflet.set_visible_child(self.subpage_events) def show_subpage_details(self): self.subpage_leaflet.set_visible_child(self.subpage_details) def subpage_navigate_back(self): self.subpage_leaflet.navigate(Adw.NavigationDirection.BACK) def show_search_all(self): self.subpage_leaflet.get_page(self.subpage_events).set_navigatable(False) self.subpage_search_all.set_value(None) self.subpage_leaflet.set_visible_child(self.subpage_search_all) def show_details(self, event, is_events_navigatable=None): # Se sono sulla pagina "starred" # imposto "subpage_events" come non "navigatable" # così quando l'utente sceglie un evento preferito, viene mandato a # "subpage_details", e quando naviga indietro torna a "leaflet". # # A meno che non ci sia impostato 'is_events_navigatable' come paramentro, # nel qual caso, vince lui. from_starred = self.main_stack.get_visible_child_name() == "starred" from_search_all = self.subpage_leaflet.get_visible_child() == self.subpage_search_all if is_events_navigatable is None: is_events_navigatable = not (from_starred or from_search_all) self.subpage_leaflet.get_page(self.subpage_events).set_navigatable(is_events_navigatable) is_search_all_navigatable = from_search_all self.subpage_leaflet.get_page(self.subpage_search_all).set_navigatable(is_search_all_navigatable) print("subpage event is navigatable", self.subpage_leaflet.get_page(self.subpage_events).get_navigatable()) print("subpage search all is navigatable", self.subpage_leaflet.get_page(self.subpage_search_all).get_navigatable()) self.subpage_details.set_obj(event) self.show_subpage_details() def copy_details_to_clipboard(self): if self.subpage_leaflet.get_visible_child() == self.subpage_details: self.subpage_details.copy_to_clipboard() self.notification_show(_("Event details copied to the clipboard")) @Gtk.Template.Callback() def _on_pagelist_row_activated(self, page): self.subpage_events.set_model(page.get_model()) self.subpage_events.set_value(page.get_value()) self.show_subpage_events() @Gtk.Template.Callback() def _on_event_row_activated(self, page): self.show_details(page.get_value()) @Gtk.Template.Callback() def _on_close_requested(self, *_): size = self.get_default_size() Settings.instance().set_size(size) def notification_show(self, text): t = Adw.Toast() t.set_title(text) self.overlay.add_toast(t) confy-0.7.0/src/meson.build000066400000000000000000000034301446165717300156030ustar00rootroot00000000000000pkgdatadir = join_paths(get_option('prefix'), get_option('datadir'), meson.project_name()) gnome = import('gnome') python = import('python') python3 = python.find_installation('python3') pythondir = python3.get_install_dir() moduledir = join_paths(pythondir, 'confy') subdir('widgets') subdir('pages') subdir('migrations') subdir('remotes') ## blueprint blueprints_src = [ 'openwindow.blp', 'mainwindow.blp', 'shortcuts.blp', ] blueprints_ui = [] foreach b : blueprints_src blueprints_ui += b.replace('.blp', '.ui') endforeach blueprints = custom_target('blueprints', input: blueprints_src, output: blueprints_ui, command: [find_program('blueprint-compiler'), 'batch-compile', '@OUTDIR@', '@CURRENT_SOURCE_DIR@', '@INPUT@'], ) ## /blueprint gnome.compile_resources('confy', 'confy.gresource.xml', dependencies: [blueprints, widgets_blueprints, pages_blueprints], gresource_bundle: true, install: true, install_dir: pkgdatadir, source_dir: 'src/', ) conf = configuration_data() conf.set('PYTHON', python3.path()) conf.set('VERSION', meson.project_version()) conf.set('localedir', join_paths(get_option('prefix'), get_option('localedir'))) conf.set('pkgdatadir', pkgdatadir) conf.set('pythondir', pythondir) configure_file( input: 'confy.in', output: 'confy', configuration: conf, install: true, install_mode: 'rwxr-xr-x', install_dir: get_option('bindir') ) configure_file( input: 'config.py.in', output: 'config.py', configuration: conf, install: true, install_dir: moduledir ) confy_sources = [ '__init__.py', 'main.py', 'openwindow.py', 'mainwindow.py', 'models.py', 'local.py', 'settings.py', 'fetcher.py', 'preferences.py', 'utils.py', 'networkconnectionmonitor.py', ] install_data(confy_sources, install_dir: moduledir) confy-0.7.0/src/migrations/000077500000000000000000000000001446165717300156155ustar00rootroot00000000000000confy-0.7.0/src/migrations/000_initial.py000066400000000000000000000030001446165717300201700ustar00rootroot00000000000000def up(cursor): cursor.execute("""CREATE TABLE IF NOT EXISTS meta ( key TEXT(20) PRIMARY KEY, value TEXT)""") cursor.execute("""CREATE TABLE IF NOT EXISTS persons ( id TEXT(50) PRIMARY KEY, name TEXT)""") cursor.execute("""CREATE TABLE IF NOT EXISTS event_person ( event_id TEXT(50), person_id TEXT(50), FOREIGN KEY(event_id) REFERENCES events(id), FOREIGN KEY(person_id) REFERENCES persons(id))""") cursor.execute("""CREATE TABLE IF NOT EXISTS events ( id TEXT(50) PRIMARY KEY, date DATE, start TIMESTAMP, end TIMESTAMP, room TEXT DEFAULT "", slug TEXT, title TEXT, subtitle TEXT, track TEXT DEFAULT "", type TEXT, abstract TEXT, description TEXT, starred INTEGER(1) DEFAULT 0, notified INTEGER(1) DEFAULT 0)""") cursor.execute("CREATE INDEX IF NOT EXISTS event_date ON events(date)") cursor.execute("CREATE INDEX IF NOT EXISTS event_room ON events(room)") cursor.execute("CREATE INDEX IF NOT EXISTS event_track ON events(track)") cursor.execute("CREATE INDEX IF NOT EXISTS event_starred ON events(starred)") cursor.execute("""CREATE TABLE IF NOT EXISTS links ( event_id TEXT(50), href TEXT, name TEXT, FOREIGN KEY(event_id) REFERENCES events(id))""") cursor.execute("CREATE UNIQUE INDEX IF NOT EXISTS name_event ON links(event_id, name)") def drop(cursor): ## I need this? ... confy-0.7.0/src/migrations/001_event_person_unique.py000066400000000000000000000005421446165717300226450ustar00rootroot00000000000000def up(cursor): cursor.execute("DROP TABLE IF EXISTS event_person") cursor.execute("""CREATE TABLE event_person ( event_id TEXT(50), person_id TEXT(50), FOREIGN KEY(event_id) REFERENCES events(id), FOREIGN KEY(person_id) REFERENCES persons(id), UNIQUE(event_id, person_id))""") def down(cursor): ... confy-0.7.0/src/migrations/002_full_text_search.py000066400000000000000000000002111446165717300220750ustar00rootroot00000000000000def up(cursor): cursor.execute("""CREATE VIRTUAL TABLE fts_event USING FTS5 (event_id, text)""") def down(cursor): ... confy-0.7.0/src/migrations/meson.build000066400000000000000000000002771446165717300177650ustar00rootroot00000000000000confy_migrations_sources = [ '000_initial.py', '001_event_person_unique.py', '002_full_text_search.py', ] install_data(confy_migrations_sources, install_dir: moduledir / 'migrations') confy-0.7.0/src/models.py000066400000000000000000000354431446165717300153070ustar00rootroot00000000000000# models.py # # Copyright 2020-2022 Fabio Comuni, et al. # # 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 . import datetime import time from gi.repository import GObject from dateutil.tz import UTC from . import local from .settings import Settings from .fetcher import Fetcher class ObjectNotFound(Exception): pass ## models def _build_filter(table="", day=None, room=None, track=None, event=None, **kwargs): filterdata = [] wherestm = [] if table != "": table = f"{table}." def __f(col, value): if value is None: wherestm.append(f"{table}{col} is null") else: wherestm.append(f"{table}{col} = ?") filterdata.append(value) if day is not None: __f("date", day.date) if room is not None: __f("room", room.name) if track is not None: __f("track", track.name) if event is not None: __f("id", event.id) for k,v in kwargs.items(): __f(k, v) return (filterdata, wherestm) class Conference: """A conference in menu files (ggmenu.json and usermenu.json)""" def _init(self, obj): self.metadata = {} self.user = False for k, v in obj.items(): setattr(self, k, v) self.start = datetime.date(*[int(s) for s in self.start.split("-")]) self.end = datetime.date(*[int(s) for s in self.end.split("-")]) return self def get_map_links(self): maps = [ l for l in self.metadata.get('links',[]) if l['title']=="Map" ] print("Conference maps links:", maps) return maps def get_map_files(self, cbk): r = [] for link in self.get_map_links(): r.append(local.get_image_async(link['url'], cbk)) return r def get_logo_file(self, cbk): logourl = self.metadata.get('icon', None) return local.get_image_async(logourl, cbk) def __repr__(self): return f"<{self.__class__.__name__} {self.__dict__}>" @classmethod def all(cls): # from giggity menu return [ cls()._init(s) for s in local.get_menu() ] @classmethod def by_url(cls, url): ss = [ s for s in local.get_menu() if url in s['url'] ] if len(ss) == 0: return None return cls()._init(ss[0]) def has_cache(self): """Check if there is local db for this conference""" return local.existsdb(self.url) def get_meta(self): """Return metadata from db. This will close any opened db connection.""" local.close() local.opendb(self.url, False) return Meta() def to_json(self): """Export conference meta as json for user menu""" d = self.__dict__.copy() for k in d: if isinstance(d[k], (datetime.date, datetime.datetime)): d[k] = d[k].strftime("%Y-%m-%d") return d class Meta: """Conference metadata from "meta" table in db""" def __init__(self): _c = local.getDb().execute("SELECT key, value FROM meta") _d = [(row['key'], self._fmtd_value(row['key'], row['value'])) for row in _c] self._data = { 'last_update': 0 } self._data.update(dict(_d)) def _fmtd_value(self, k, v): if k == "start" or k == "end": if v is not None and v != "": if ":" in v: v = datetime.datetime.strptime(v, "%Y-%m-%d %H:%M:%S") else: v = datetime.date(*[int(s) for s in v.split("-")]) else: v = None if k == "last_update": v = float(v) return v def __getattr__(self, name): if name.startswith("_"): return super().__getattr__(name) return self._data.get(name) def __setattr__(self, name, value): if name.startswith("_"): return super().__setattr__(name, value) self._data[name] = value def __enter__(self): return self def __exit__(self, *args): self.save() def __repr__(self): return f"<{self.__class__.__name__} {self.__dict__}>" def save(self): db = local.getDb() if db is None: local.opendb(self.url, False) db = local.getDb() db.executemany("INSERT OR REPLACE INTO meta (key, value) VALUES (?,?)", self._data.items()) db.commit() def to_json(self): """Export conference meta as json for user menu""" return { "url": self.url, "title": self.title if self.title else "", "start": self.start.strftime("%Y-%m-%d"), "end": self.end.strftime("%Y-%m-%d"), "user": True } class Day: def _init(self, data): self.date = data['date'] return self def __repr__(self): return "<{} {!r}>".format(self.__class__.__name__, self.date) def __str__(self): return self.date.strftime("%x") @classmethod def all(cls): for row in local.getDb().execute("SELECT date FROM events GROUP BY date"): yield cls()._init(row) @classmethod def count(cls): for row in local.getDb().execute("SELECT count(DISTINCT date) FROM events"): return row[0] @classmethod def filter(cls, room=None, track=None, event=None): filterdata, wherestm = _build_filter(room=room, track=track, event=event) query = """SELECT date FROM events WHERE {} GROUP BY date""".format(" AND ".join(wherestm)) for row in local.getDb().execute(query, filterdata): yield cls()._init(row) class Room: def _init(self, data): self.name = data['room'] return self def __repr__(self): return "<{} {!r}>".format(self.__class__.__name__, self.name) def __str__(self): return self.name or "- no room -" @classmethod def all(cls): for row in local.getDb().execute("SELECT room FROM events GROUP BY room"): yield cls()._init(row) @classmethod def count(cls): for row in local.getDb().execute("SELECT count(DISTINCT room) FROM events"): return row[0] @classmethod def filter(cls, day=None, track=None, event=None): filterdata, wherestm = _build_filter(day=day, track=track, event=event) query = """SELECT room FROM events WHERE {} GROUP BY room""".format(" AND ".join(wherestm)) for row in local.getDb().execute(query, filterdata): yield cls()._init(row) class Track: def _init(self, data): self.name = data['track'] self.room = list(Room.filter(track=self)) self.date = list(Day.filter(track=self)) return self def __repr__(self): return "<{} {!r} in {!r} @ {}>".format( self.__class__.__name__, self.name, self.room, self.date) def __str__(self): return self.name or "- no track -" @classmethod def all(cls): for row in local.getDb().execute( "SELECT track, room, date FROM events WHERE track != '' GROUP BY track ORDER BY date, track"): yield cls()._init(row) @classmethod def count(cls): for row in local.getDb().execute("SELECT count(DISTINCT track) FROM events"): return row[0] class Person: def _init(self, data): self.id = data['id'] self.name = data['name'] return self def events(self): for row in local.getDb().execute( """SELECT e.* FROM events as e LEFT JOIN event_person AS ep ON e.id = ep.event_id WHERE ep.person_id = ?""", (self.id,)): yield Event()._init(row) def __repr__(self): return "<{} {!r}>".format(self.__class__.__name__, self.name) def __str__(self): return self.name @classmethod def all(cls): for row in local.getDb().execute( "SELECT id, name FROM persons"): yield cls()._init(row) class Link: def _init(self, event, data): self.event = event self.href = data['href'] self.name = data['name'] return self def __repr__(self): return "<{} for {!r} {!r} {!r}>".format( self.__class__.__name__, self.event, self.name, self.href) def __str__(self): return '{}'.format(self.href, self.name) class DbUpdateWatcherObj(GObject.GObject): @GObject.Signal def update(self): ... dbUpdateWatcher = DbUpdateWatcherObj() class Event(GObject.GObject): @GObject.Signal def update(self): ... def _init(self, data): self.id = data['id'] self.date = data['date'] self.start = data['start'] self.end = data['end'] self.room = data['room'] self.slug = data['slug'] self.title = data['title'] self.subtitle = data['subtitle'] or "" self.track = data['track'] self.evtype = data['type'] self.abstract = data['abstract'] or "" self.description = data['description'] or "" self.starred = data['starred'] == 1 self.notified = data['notified'] == 1 return self def set_star(self, starred): local.getDb().execute("UPDATE events SET starred=? WHERE id=?",(starred,self.id,)) local.getDb().commit() self.starred = starred self.emit('update') dbUpdateWatcher.emit('update') def set_notified(self, notified): local.getDb().execute("UPDATE events SET notified=? WHERE id=?",(notified,self.id,)) local.getDb().commit() self.notified = notified self.emit('update') dbUpdateWatcher.emit('update') def start_in_tz(self): return self._dt_in_tz(self.start) def end_in_tz(self): return self._dt_in_tz(self.end) def _dt_in_tz(self, dt): dt = dt.replace(tzinfo=UTC) dt = dt.astimezone(Settings.instance().get_timezone()) return dt def persons(self): #print("event", self.id, "persons()") for row in local.getDb().execute( """SELECT p.id, p.name FROM persons as p LEFT JOIN event_person AS ep ON p.id = ep.person_id WHERE ep.event_id = ?""", (self.id,)): yield Person()._init(row) def links(self): for row in local.getDb().execute( """SELECT href, name FROM links WHERE event_id=?""", (self.id,)): yield Link()._init(self, row) def __repr__(self): return "<{} {!r} in {!r} @ {!r}>".format(self.__class__.__name__, self.title, self.room, self.start) def __str__(self): return self.title def get_conflicts(self): query = """SELECT * FROM events WHERE starred = 1 AND id != ? AND date = ? AND end > ? AND start < ? """ for row in local.getDb().execute(query, (self.id, self.date, self.start, self.end)): yield Event()._init(row) @classmethod def all(cls): row = local.getDb().execute("SELECT count(id) as c FROM events", filterdata).fetchone() yield 0 if row is None else row['c'] for row in local.getDb().execute("SELECT * FROM events"): yield cls()._init(row) @classmethod def by_id(cls, id): row = local.getDb().execute("SELECT * FROM events WHERE id = ?", (id,)).fetchone() if row is None: raise ObjectNotFound("<{} #{}>".format(cls.__name__, id)) return cls()._init(row) @classmethod def filter(cls, day:Day = None, room:Room = None, track:Track = None, **kwargs): filterdata, wherestm = _build_filter("events", day=day, room=room, track=track, **kwargs) query = """SELECT * FROM events WHERE {} ORDER BY start, room""".format(" AND ".join(wherestm)) resultcountquery = query.replace("SELECT *", "SELECT count(events.id) as c") row = local.getDb().execute(resultcountquery, filterdata).fetchone() yield 0 if row is None else row['c'] for row in local.getDb().execute(query, filterdata): yield cls()._init(row) @classmethod def nextup(cls, minutes): """get events starting in next `minutes`""" minutes = min(int(minutes), 30) # some sanity check now = datetime.datetime.now(UTC).replace(tzinfo=None).strftime("%Y-%m-%dT%H:%M:%S.000") # now = "now" # is "now" somehow broken? query = """SELECT * FROM events WHERE starred=1 AND notified=0 AND datetime(start) >= datetime("{1}") AND datetime(start) <= datetime("{1}", "+{0} minutes");""" for row in local.getDb().execute(query.format(minutes, now)): yield cls()._init(row) @classmethod def search(cls, term, starred=False, order_by=None, **filters): """Search events for 'term'""" if starred: filters["starred"] = 1 filterdata, wherestm = _build_filter("events", **filters) if term == "" and len(wherestm) == 0: yield 0 return if term != "": order = ['rank'] if order_by: order = [order_by, 'rank'] wherestm.append("fts_event = ?") filterdata.append(term) query = """SELECT events.* FROM fts_event JOIN events ON events.id = fts_event.event_id WHERE {} GROUP BY events.id ORDER BY {}""" else: order = ['start', 'room'] if order_by: order = [order_by] query = """SELECT events.* FROM events WHERE {} ORDER BY {}""" query = query.format( " AND ".join(wherestm), ", ".join(order) ) resultcountquery = query.replace("SELECT events.*", "SELECT count(events.id) as c") row = local.getDb().execute(resultcountquery, filterdata).fetchone() yield 0 if row is None else row['c'] results = local.getDb().execute(query, filterdata) for row in results: yield cls()._init(row) confy-0.7.0/src/networkconnectionmonitor.py000066400000000000000000000016131446165717300211750ustar00rootroot00000000000000from gi.repository import GObject from gi.repository import Gio class NetworkConnectionMonitor(GObject.Object): def __init__(self): super().__init__() self._isconnected = False self.nm = Gio.NetworkMonitor.get_default() self.nm.connect("network-changed", self.on_network_changed) self.on_network_changed() def on_network_changed(self, *args): _ic = self._isconnected self._isconnected = self.nm.get_connectivity() == Gio.NetworkConnectivity.FULL if (self._isconnected != _ic): #print("NetworkConnectionMonitor.isconnected", self._isconnected) self.notify("isconnected") @GObject.Property def isconnected(self): """The system can reach the global netowrk. Bool, read-only""" #print("NetworkConnectionMonitor.isconnected getter:", self._isconnected) return self._isconnected confy-0.7.0/src/openwindow.blp000066400000000000000000000062101446165717300163300ustar00rootroot00000000000000using Gtk 4.0; using Adw 1; template $ConfyOpenWindow : Adw.ApplicationWindow { icon-name: "net.kirgroup.confy"; default-width: 600; default-height: 400; Adw.ToastOverlay overlay { Gtk.Box { orientation: vertical; Adw.HeaderBar { visible: bind-property template.in_edit inverted; title-widget: Adw.WindowTitle { title: _("Events"); }; [start] Button open_button { icon-name: "list-add-symbolic"; tooltip-text: _("Add event from URL"); action-name: 'win.add-event'; } [start] ToggleButton search_button { icon-name: "system-search-symbolic"; tooltip-text: _("Find event"); active: bind-property searchbar.search-mode-enabled bidirectional; } [end] MenuButton menu_button { menu-model: menu_start; icon-name: "open-menu-symbolic"; primary: true; } [end] Button update_button { icon-name: "view-refresh-symbolic"; tooltip-text: _("Refresh events list"); action-name: 'win.refresh-events'; } } Adw.HeaderBar { styles ['editbar'] visible: bind-property template.in_edit; show-end-title-buttons: false; show-start-title-buttons: false; title-widget: Adw.WindowTitle { title: _("Edit events"); }; [start] ToggleButton { icon-name: "system-search-symbolic"; tooltip-text: _("Find event"); active: bind-property searchbar.search-mode-enabled bidirectional; } [end] Gtk.ToggleButton { label: _("Cancel"); active: bind-property template.in_edit inverted bidirectional; } } $ConfySearchBarOverlay searchbar { show_advanced: false; changed => $on_do_search(); notify::search-mode-enabled => $on_do_search(); } Gtk.Stack stack { Adw.StatusPage empty_placeholder { icon-name: "net.kirgroup.confy"; title: _("No events yet"); description: _("Add an event with the add button in title bar."); vexpand: true; } Adw.StatusPage nomatch_placeholder { icon-name: "system-search-symbolic"; title: _("No matches"); vexpand: true; } Gtk.ScrolledWindow content{ vexpand: true; Adw.Clamp { Gtk.Box { styles ['main-box'] orientation: vertical; spacing: 12; Gtk.Label heading_next { styles ['heading'] halign: start; label: _("Coming up"); } Gtk.ListBox listbox_next { styles ['boxed-list'] margin-bottom: 20; row-activated => $on_activated_next(); } Gtk.Label heading_past{ styles ['heading'] halign: start; label: _("Past"); } Gtk.ListBox listbox_past { styles ['boxed-list'] row-activated => $on_activated_past(); } } } } } } } } menu menu_start { section { item (_("Add event from URL"), "win.add-event") item (_("Refresh list"), "win.refresh-events") item (_("Search"), "win.search") item (_("Edit events"), "win.edit-meta") // separator ? item (_("Preferences"), "app.preferences") item (_("Keyboard Shortcuts"), "app.shortcuts") item (_("About Confy"), "app.about") } } confy-0.7.0/src/openwindow.py000066400000000000000000000245121446165717300162100ustar00rootroot00000000000000import datetime from gi.repository import Gio from gi.repository import GObject from gi.repository import Gtk from gi.repository import Adw from . import local from . import models from .config import APP_NAME, APP_ID, APP_VERSION from .networkconnectionmonitor import NetworkConnectionMonitor from .widgets import InputDialog from .widgets import EventEditDialog from .widgets import SearchBarOverlay from .widgets import LoadingOverlay @Gtk.Template(resource_path="/net/kirgroup/confy/openwindow.ui") class OpenWindow(Adw.ApplicationWindow): __gtype_name__ = "ConfyOpenWindow" overlay = Gtk.Template.Child() searchbar = Gtk.Template.Child() stack = Gtk.Template.Child() empty_placeholder = Gtk.Template.Child() nomatch_placeholder = Gtk.Template.Child() content = Gtk.Template.Child() heading_next = Gtk.Template.Child() listbox_next = Gtk.Template.Child() heading_past = Gtk.Template.Child() listbox_past = Gtk.Template.Child() _in_edit = False @GObject.Property(type=bool, default=False) def in_edit(self): return self._in_edit @in_edit.setter def in_edit(self, value): self._in_edit = value def __init__(self, **kwargs): self.nm = NetworkConnectionMonitor() self.data = [] super().__init__(**kwargs) self.stack.set_visible_child(self.empty_placeholder) fetcher = local.open_menu(self.nm.props.isconnected) if fetcher is not None: self.loading_show(fetcher) fetcher.connect("done", lambda *_: self.update_list()) fetcher.connect("error", lambda s,e: self.notification_show(_("Error loading events list:\n{}").format(e))) else: self.update_list() self._add_action("add-event", None, self.open_custom_url) self._add_action("refresh-events", None, self.update_schedules) # TODO: disable action if there is no user entris in menu self.edit_meta_action = self._add_action("edit-meta", None, lambda *_: self.set_in_edit(not self.props.in_edit)) self._add_action("search", None, lambda *_: self.searchbar.set_search_mode(True)) # can't do this because: Warning: ../glib/gobject/gbinding.c:271: Unable to convert a value of type PyObject to a value of type gboolean #self.nm.bind_property("isconnected", refresh_events_action, "enabled", 0 ) self.nm.connect("notify",self.on_networkconnectionmonitor_notify) self.on_networkconnectionmonitor_notify() def _add_action(self, name, parameter_type, activate_cbk): action = Gio.SimpleAction.new(name, parameter_type) action.connect("activate", activate_cbk) self.add_action(action) return action def set_in_edit(self, value): self.props.in_edit = value @Gtk.Template.Callback() def on_do_search(self, *args): self.update_list() def on_networkconnectionmonitor_notify(self, *args): is_connected = self.nm.props.isconnected self.lookup_action("refresh-events").set_enabled(is_connected) self.lookup_action("add-event").set_enabled(is_connected) def update_schedules(self, *args): def _done(s, f): self.update_list() self.notification_show(_("Events list updated")) def _error(s, e): self.notification_show(_("Error loading events list:\n{}").format(e)) fetcher = local.update_menu() self.loading_show(fetcher) fetcher.connect("done", _done) fetcher.connect("error", _error) def delete_conf(self, conf, cbk=None): def _message_response(dialog, response): if response == "delete": local.delete_user_menu(conf.to_json()) self.update_list() if cbk is not None: cbk(conf) dialog.destroy() message = Adw.MessageDialog(transient_for=self) message.props.heading = _('Delete event "{}"?').format(conf.title) message.props.body = _("Event will be removed from event list and related data will be deleted") message.add_response("cancel", _("Cancel")) message.add_response("delete", _("Delete")) message.set_response_appearance("delete", Adw.ResponseAppearance.DESTRUCTIVE) message.set_default_response("cancel") message.set_close_response("cancel") message.connect("response", _message_response) message.present() def edit_conf(self, conf, ok_cbk=None, del_cbk=None, can_cancel=True, can_delete=False): def _dialog_response(dialog, res): if res == EventEditDialog.OK: conf = d.get_conf() local.update_user_menu(conf.to_json()) if conf.has_cache(): with conf.get_meta() as m: m.title = conf.title m.start = conf.start m.end = conf.end self.update_list() if ok_cbk is not None: ok_cbk(conf) d.destroy() elif res == EventEditDialog.DELETE: self.delete_conf(conf, lambda *_: d.destroy()) else: d.destroy() if conf is None: return d = EventEditDialog(self, conf, can_delete=can_delete, can_cancel=can_cancel) d.connect("response", _dialog_response) d.present() def open_custom_url(self, *args): def _cbk(conf): self.notification_show(_("New event: {}").format(conf.title)) def _error(s, e): self.notification_show(_("Error: {}").format(e)) def _add_menu_ckb(meta): conf = models.Conference.by_url(meta.url) self.edit_conf(conf, can_cancel=False, ok_cbk=_cbk) def _dialog_response(dialog, res): if res == InputDialog.OK: url = dialog.get_text() try: fetcher = local.add_user_menu(url, _add_menu_ckb) if fetcher is not None: fetcher.connect("error", _error) except local.MenuItemAlreadyExistsException as e: # edit existing obj self.notification_show(_("Event already in list")) conf = models.Conference()._init(e.obj) self.edit_conf(conf, can_cancel=True) except Exception as e: import traceback; traceback.print_exc() self.notification_show(_("Error: {}").format(e)) else: if fetcher is not None: self.loading_show(fetcher) dialog.destroy() dialog = InputDialog(self) dialog.connect("response", _dialog_response) dialog.present() def _empty_list(self, listbox): w = listbox.get_last_child() while w: listbox.remove(w) w = listbox.get_last_child() def update_list(self): sb = self.searchbar try: confs = models.Conference.all() # if searchbar is visible and search text is not "", filter confs by title and url if sb.is_searching(): search = sb.entry.get_text().lower() confs = [ conf for conf in confs if search in conf.title.lower() or search in conf.url.lower() ] except Exception as e: self.notification_show(_("Error loading events list:\n{}").format(e)) self._empty_list(self.listbox_next) self._empty_list(self.listbox_past) count = len(confs) if count == 0: if self.searchbar.is_searching(): self.stack.set_visible_child(self.nomatch_placeholder) else: self.stack.set_visible_child(self.empty_placeholder) else: self.stack.set_visible_child(self.content) confs_next = [] confs_past = [] for conf in confs: row = self.build_row(conf) if conf.end < datetime.date.today(): confs_past.append(conf) self.listbox_past.append(row) else: confs_next.append(conf) self.listbox_next.append(row) show_next = len(confs_next) > 0 show_past = len(confs_past) > 0 self.listbox_next.set_visible(show_next) self.heading_next.set_visible(show_next) self.listbox_past.set_visible(show_past) self.heading_past.set_visible(show_past) self.data = [ confs_next, confs_past ] def build_row(self, obj): row = Adw.ActionRow(activatable=True, selectable=False) row.set_title(obj.title) self.bind_property("in-edit", row, "activatable", GObject.BindingFlags.SYNC_CREATE | GObject.BindingFlags.INVERT_BOOLEAN) if obj.user: delete_button = Gtk.Button( icon_name="user-trash-symbolic", valign=Gtk.Align.CENTER, ) delete_button.add_css_class("destructive-action") delete_button.connect("clicked", lambda *_: self.delete_conf(obj)) self.bind_property("in-edit", delete_button, "visible", GObject.BindingFlags.SYNC_CREATE) row.add_suffix(delete_button) edit_button = Gtk.Button( icon_name="document-edit-symbolic", valign=Gtk.Align.CENTER, ) edit_button.add_css_class("suggested-action") edit_button.connect("clicked", lambda *_: self.edit_conf(obj, can_delete=obj.user)) self.bind_property("in-edit", edit_button, "visible", GObject.BindingFlags.SYNC_CREATE) row.add_suffix(edit_button) return row @Gtk.Template.Callback() def on_activated_next(self, listbox, actionrow): idx = actionrow.get_index() obj = self.data[0][idx] self.props.application.open_conf(obj) @Gtk.Template.Callback() def on_activated_past(self, listbox, actionrow): idx = actionrow.get_index() obj = self.data[1][idx] self.props.application.open_conf(obj) def loading_show(self, cancellable): t = LoadingOverlay(cancellable) self.overlay.add_toast(t) def notification_show(self, text): t = Adw.Toast() t.set_title(text) self.overlay.add_toast(t) confy-0.7.0/src/pages/000077500000000000000000000000001446165717300145405ustar00rootroot00000000000000confy-0.7.0/src/pages/__init__.py000066400000000000000000000014531446165717300166540ustar00rootroot00000000000000# pages.py # # Copyright 2020-2023 Fabio Comuni, et al. # # 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 . from .info import PageInfo from .list import PageList from .events import PageEvents from .details import PageDetails confy-0.7.0/src/pages/details.blp000066400000000000000000000060421446165717300166660ustar00rootroot00000000000000using Gtk 4.0; using Adw 1; template $ConfyPageDetails : Gtk.Box { orientation: vertical; hexpand: true; vexpand: true; width-request: 360; Adw.HeaderBar headerbar { title-widget: Adw.WindowTitle windowtitle { title: bind-property template.title; subtitle: bind-property template.authors; }; [start] Gtk.Button { icon-name: "go-previous-symbolic"; action-name: 'win.subpage-back'; } [end] MenuButton { menu-model: menu_details; icon-name: "open-menu-symbolic"; } } Gtk.ScrolledWindow scroll { hexpand: true; vexpand: true; Adw.Clamp { Gtk.Box pagebox { styles ['main-box'] orientation: vertical; spacing: 24; Gtk.Box { orientation: vertical; spacing: 6; Gtk.Label { styles ['title-1'] label: bind-property template.title; wrap: true; halign: start; selectable: true; } Gtk.Label { label: bind-property template.subtitle; visible: bind-property template.has-subtitle; wrap: true; halign: start; selectable: true; } Gtk.Label { styles ['dim-label'] label: bind-property template.authors; visible: bind-property template.has-authors; wrap: true; halign: start; selectable: true; } } Gtk.Box { spacing: 6; Gtk.Box { hexpand: true; orientation: vertical; spacing: 6; Gtk.Label { styles ['caption-heading'] halign: start; label: bind-property template.time; } Gtk.Label { styles ['caption'] halign: start; wrap: true; label: bind-property template.room; } Gtk.Label { styles ['caption'] halign: start; wrap: true; label: bind-property template.track; } } $ConfyStarButton star_button { clicked => $toggle_starred(); } } Gtk.Box { orientation: vertical; spacing: 12; visible: bind-property conflicts_list.visible; Gtk.Label { styles ['heading'] halign: start; label: _("Conflicts with"); } Gtk.ListBox conflicts_list { styles ['boxed-list'] row-activated => $on_conflict_activated(); } } Gtk.Label { halign: start; wrap: true; label: bind-property template.abstract; visible: bind-property template.has-abstract; selectable: true; use-markup: true; } Gtk.Label { halign: start; wrap: true; label: bind-property template.description; visible: bind-property template.has-description; selectable: true; use-markup: true; } Gtk.Box { orientation: vertical; spacing: 12; visible: bind-property links_list.visible; Gtk.Label { styles ['heading'] halign: start; label: _("Links"); } Gtk.ListBox links_list { styles ['boxed-list'] row-activated => $on_link_activated(); } } } } } } menu menu_details { section { item { label: _("Copy to clipboard"); action: "win.copy"; } } }confy-0.7.0/src/pages/details.py000066400000000000000000000143531446165717300165450ustar00rootroot00000000000000# events.py # # Copyright 2020-2023 Fabio Comuni, et al. # # 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 . from gi.repository import GObject from gi.repository import Gdk from gi.repository import Gtk from ..utils import InterruptibleTimeout from ..utils import convert_markdown_links, clean_markup, markup_to_text from ..widgets import EventActionRow from ..widgets import WebLinkActionRow, weblinkactionrowactivated @Gtk.Template(resource_path="/net/kirgroup/confy/pages/details.ui") class PageDetails(Gtk.Box): __gtype_name__ = "ConfyPageDetails" scroll = Gtk.Template.Child() star_button = Gtk.Template.Child() conflicts_list = Gtk.Template.Child() links_list = Gtk.Template.Child() _title = "" @GObject.property(type=str, default="") def title(self): return self._title @title.setter def title(self, v): self._title = v _subtitle = "" @GObject.property(type=str, default="") def subtitle(self): return self._subtitle @subtitle.setter def subtitle(self, v): self._subtitle = v self.notify("has-subtitle") @GObject.property(type=bool, default=False) def has_subtitle(self): return self._subtitle != "" _authors = "" @GObject.property(type=str, default="") def authors(self): return self._authors @authors.setter def authors(self, v): self._authors = v self.notify("has-authors") @GObject.property(type=bool, default=False) def has_authors(self): return self._authors != "" _time = "" @GObject.property(type=str, default="") def time(self): return self._time @time.setter def time(self, v): self._time = v _room = "" @GObject.property(type=str, default="") def room(self): return self._room @room.setter def room(self, v): self._room = v _track = "" @GObject.property(type=str, default="") def track(self): return self._track @track.setter def track(self, v): self._track = v _abstract = "" @GObject.property(type=str, default="") def abstract(self): return self._abstract @abstract.setter def abstract(self, v): self._abstract = v self.notify("has-abstract") @GObject.property(type=bool, default=False) def has_abstract(self): return self._abstract is not None and self._abstract != "" and self._abstract != "None" _description = "" @GObject.property(type=str, default="") def description(self): return self._description @description.setter def description(self, v): self._description = v self.notify("has-description") @GObject.property(type=bool, default=False) def has_description(self): return self._description is not None and self._description != "" and self._description != "None" _handler_id = None obj = None def set_obj(self, obj): if self._handler_id: self.obj.disconnect(self._handler_id) self.obj = obj self._handler_id = obj.connect('update', self._on_obj_update) self.scroll.get_vadjustment().set_value(0) self._on_obj_update() def _on_obj_update(self, *_): self.props.title = clean_markup(self.obj.title) self.props.authors = ", ".join([ clean_markup(str(p)) for p in self.obj.persons()]) self.props.subtitle = clean_markup(self.obj.subtitle) self.props.time = "{}-{}".format( self.obj.start_in_tz().strftime("%A %H:%M"), self.obj.end_in_tz().strftime("%H:%M")) self.props.room = clean_markup(self.obj.room) self.props.track = clean_markup(self.obj.track) self.props.abstract = clean_markup(convert_markdown_links(self.obj.abstract)) self.props.description = clean_markup(convert_markdown_links(self.obj.description)) self._conflicts = conflicts = list(self.obj.get_conflicts()) self.conflicts_list.props.visible = len(conflicts) > 0 w = self.conflicts_list.get_last_child() while w: self.conflicts_list.remove(w) w = self.conflicts_list.get_last_child() for c in conflicts: row = EventActionRow(c) self.conflicts_list.append(row) self._links = links = list(self.obj.links()) self.links_list.props.visible = len(links) > 0 w = self.links_list.get_last_child() while w: self.links_list.remove(w) w = self.links_list.get_last_child() for l in links: row = WebLinkActionRow(l.name, l.href) self.links_list.append(row) self.star_button.props.is_starred = self.obj.starred def copy_to_clipboard(self): cb = Gdk.Display.get_default().get_clipboard() data = [self._title] def _append(txt): if txt != "": data.append(txt) _append(self._subtitle) _append(self._authors) data.append("") _append(self._time) _append(self._room) _append(self._track) data.append("") _append(self._abstract) _append(self._description) data.append("") for l in self._links: data.append(f"{l.name}\n{l.href}\n") text = "\n".join(data) text = markup_to_text(text) print(text) cb.set(text) @Gtk.Template.Callback() def toggle_starred(self, *_): self.obj.set_star(not self.obj.starred) @Gtk.Template.Callback() def on_conflict_activated(self, listbox, row): self.set_obj(row.obj) @Gtk.Template.Callback() def on_link_activated(self, listbox, row): weblinkactionrowactivated(listbox, row) confy-0.7.0/src/pages/events.blp000066400000000000000000000027371446165717300165540ustar00rootroot00000000000000using Gtk 4.0; using Adw 1; template $ConfyPageEvents : Gtk.Box { orientation: vertical; hexpand: true; vexpand: true; width-request: 360; Adw.HeaderBar headerbar { title-widget: Adw.WindowTitle windowtitle { title: bind-property template.title; subtitle: bind-property template.subtitle; }; [start] Gtk.Button { icon-name: "go-previous-symbolic"; action-name: 'win.subpage-back'; } [start] Gtk.ToggleButton search_button { icon-name: "system-search-symbolic"; } //[end] //Gtk.Button { // icon-name: "open-menu-symbolic"; //} } $ConfySearchBarOverlay searchbar { changed => $on_searchbar_entry_changed(); search-mode-enabled: bind-property search_button.active bidirectional; notify::search-mode-enabled => $on_search_mode_changed(); } Gtk.Stack stack { Gtk.StackPage { name: 'list'; child: Gtk.ScrolledWindow scroll { hexpand: true; vexpand: true; Adw.Clamp { Gtk.Box pagebox { styles ['main-box'] orientation: vertical; spacing: 12; } } }; } Gtk.StackPage { name: 'empty_star'; child: Adw.StatusPage { icon-name: "non-starred-symbolic"; title: _("Nothing starred yet"); description: _("Star a talk to be notified when it's about to start."); vexpand: true; }; } Gtk.StackPage { name: 'no_match'; child: Adw.StatusPage nomatch_placeholder { icon-name: "system-search-symbolic"; title: _("No matches"); vexpand: true; }; } } }confy-0.7.0/src/pages/events.py000066400000000000000000000210321446165717300164140ustar00rootroot00000000000000# events.py # # Copyright 2020-2023 Fabio Comuni, et al. # # 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 . from dataclasses import dataclass from gi.repository import GObject from gi.repository import Gtk from .. import models from ..config import FMT_DAY from ..utils import clean_markup from ..utils import InterruptibleTimeout from ..widgets import EventActionRow @dataclass class ListBuilderCtx: lastobj = None listbox = None data = [] guard = None def __repr__(self): return f"" @Gtk.Template(resource_path="/net/kirgroup/confy/pages/events.ui") class PageEvents(Gtk.Box): """Talks list page (called "Events" from pentabarf xml)""" __gtype_name__ = "ConfyPageEvents" stack = Gtk.Template.Child() pagebox = Gtk.Template.Child() search_button = Gtk.Template.Child() searchbar = Gtk.Template.Child() scroll = Gtk.Template.Child() filters = None group_by = None _update_handler_id = None _value = None timeout = InterruptibleTimeout() @GObject.Signal(name="row-activated") def row_activated(self): ... _title = "" @GObject.property(type=str, default="") def title(self): return self._title @title.setter def title(self, v): self._title = v _subtitle = "" @GObject.property(type=str, default="") def subtitle(self): return self._subtitle @subtitle.setter def subtitle(self, v): self._subtitle = v _model = "" @GObject.property(type=str, default="") def model(self): return self._model @model.setter def model(self, v): self._model = v def get_value(self): return self._value def set_model(self, v): self.props.model = v def on_litstbox_activated(self, listbox, row): self._value = row.obj self.emit("row-activated") def set_value(self, obj): print(f"PageEvents: set_value(obj={obj}) model={self._model}") if self._update_handler_id: models.dbUpdateWatcher.disconnect(self._update_handler_id) self._update_handler_id = None self.scroll.get_vadjustment().set_value(0) self.search_button.props.visible = True self.search_button.props.active = False self.searchbar.props.search_mode_enabled = False self.searchbar.props.show_close_button = True if self._model == "days": self.props.title = _("Talks on {}").format(obj.date.strftime(FMT_DAY)) self.props.subtitle = "" self.filters = {'day': obj} self.group_by = None elif self._model == "tracks": subtitle = [] if len(obj.room) == 1 and obj.room[0].name != "": subtitle.append(obj.room[0].name) if len(obj.date) == 1: subtitle.append(obj.date[0].date.strftime(FMT_DAY)) self.props.title = _("{} Track").format(obj) self.props.subtitle = ", ".join(subtitle) self.filters = {'track': obj} self.group_by = "date" elif self._model == "rooms": if obj.name is None: title = _("No Room") else: title = _("Room {}").format(clean_markup(obj.name)) self.props.title = title self.props.subtitle = "" self.filters = {'room': obj} self.group_by = "date" elif self._model == "starred": self.props.title = _("Starred") self.props.subtitle = "" self.filters = {'starred': True} self.group_by = "date" # TODO: or None? self._update_handler_id = models.dbUpdateWatcher.connect("update", self.update) elif self.model == "search": self.props.title = _("Search Talks") self.props.subtitle = "" self.search_button.props.active = True self.search_button.props.visible = False self.searchbar.props.show_close_button = False self.filters = None self.group_by = None else: print(f"PageEvents: set_value: no valid model set '{self._model}'") return self.update() def update(self, *args): count, data = self.get_objects() self.timeout.stop() # empty box w = self.pagebox.get_last_child() while w: self.pagebox.remove(w) w = self.pagebox.get_last_child() if count == 0: self.show_placeholder() else: self.stack.set_visible_child_name('list') ctx = ListBuilderCtx() ctx.data = data self.timeout = InterruptibleTimeout(500, self.build_list, ctx) def build_list(self, timeout, ctx): for idx, obj in enumerate(ctx.data): if timeout.must_stop(): return False header = self.build_header(obj, ctx.lastobj) if header: ctx.listbox = None self.pagebox.append(header) row = self.build_row(obj) if ctx.listbox is None: ctx.listbox = self.build_listbox() self.pagebox.append(ctx.listbox) ctx.listbox.append(row) ctx.lastobj = obj if idx > 10: return True return False def build_listbox(self): lb = Gtk.ListBox(margin_bottom=20) lb.add_css_class("boxed-list") lb.connect("row-activated", self.on_litstbox_activated) return lb def build_header(self, current, before): """ Yes, this is just like a `GtkListBoxUpdateHeaderFunc` But GtkListBox headers aren't gtk-adwaita enough... `current` is current data to be added, `before` is data added before. return a widget for a new header, or None. """ _title = None if self.group_by == "date": if before is None or current.date.strftime(FMT_DAY) != before.date.strftime(FMT_DAY): _title = current.date.strftime(FMT_DAY) elif self.group_by == "track": if before is None or current.track != before.track: _title = current.track elif self.group_by == "room": if before is None or current.room != before.room: _title = current.room else: return None if _title: label = Gtk.Label(label=_title, halign=Gtk.Align.START) label.add_css_class("heading") return label return None @Gtk.Template.Callback() def on_searchbar_entry_changed(self, e): self.update() @Gtk.Template.Callback() def on_search_mode_changed(self, *_): self.update() def get_objects(self): if self.model == "search": term = self.searchbar.entry.get_text() is_starred = self.searchbar.is_starred.get_active() _filters = {} if is_starred: _filters['starred'] = True g = models.Event.search(term, **_filters) return next(g), g if self.filters is None: return 0, [] if self.searchbar.is_searching(): term = self.searchbar.entry.get_text() is_starred = self.searchbar.is_starred.get_active() _filters = self.filters.copy() if is_starred: _filters['starred'] = True g = models.Event.search(term, order_by=self.group_by, **_filters) return next(g), g g = models.Event.filter(**self.filters) return next(g), g def build_row(self, obj): row = EventActionRow(obj) return row def show_placeholder(self): if self._model == "search" or self.searchbar.is_searching(): self.stack.set_visible_child_name('no_match') elif self._model == "starred": self.stack.set_visible_child_name('empty_star') else: self.stack.set_visible_child_name('list') confy-0.7.0/src/pages/info.blp000066400000000000000000000006461446165717300162000ustar00rootroot00000000000000using Gtk 4.0; using Adw 1; template $ConfyPageInfo : Gtk.Box { orientation: vertical; hexpand: true; width-request: 360; Adw.StatusPage statuspage { title: bind-property template.title; description: bind-property template.description; vexpand: false; Adw.Clamp { Gtk.ListBox linkbox { styles ['boxed-list'] row-activated => $on_linkbox_row_activated(); } } } }confy-0.7.0/src/pages/info.py000066400000000000000000000055131446165717300160510ustar00rootroot00000000000000# info.py # # Copyright 2020-2023 Fabio Comuni, et al. # # 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 . from gi.repository import GObject from gi.repository import Gio from gi.repository import Gdk from gi.repository import Gtk from ..config import FMT_DAY from ..widgets import WebLinkActionRow, weblinkactionrowactivated from ..utils import clean_markup @Gtk.Template(resource_path="/net/kirgroup/confy/pages/info.ui") class PageInfo(Gtk.Box): __gtype_name__ = "ConfyPageInfo" page_title = _("Event info") conf = None meta = None statuspage = Gtk.Template.Child() linkbox = Gtk.Template.Child() @GObject.Property(type=str, default="") def title(self): return clean_markup(self.meta.title) if self.meta else "" @GObject.Property(type=str, default="") def description(self): desc = self.meta.venue or "" if self.meta.venue and self.meta.city: desc += "\n" desc += self.meta.city or "" if desc != "": desc += "\n\n" desc += self.meta.start.strftime(FMT_DAY) if self.meta.start != self.meta.end: desc += "\n" + self.meta.end.strftime(FMT_DAY) return clean_markup(desc) def init(self, win, conf): self.conf = conf win.connect("conf-updated", self.update) return self def _set_logo(self, fetcher, logofile): self.statuspage.set_paintable( Gdk.Texture.new_from_file( Gio.File.new_for_path(logofile) ) ) def update(self, *_): self.meta = self.conf.get_meta() self.statuspage.set_icon_name('net.kirgroup.confy-symbolic') fetcher = self.conf.get_logo_file(cbk=self._set_logo) w = self.linkbox.get_last_child() while w: self.linkbox.remove(w) w = self.linkbox.get_last_child() links = self.conf.metadata.get("links", []) self.linkbox.set_visible(len(links) > 0) for link in links: row = WebLinkActionRow(link['title'], link['url']) self.linkbox.append(row) self.notify("title") self.notify("description") @Gtk.Template.Callback() def on_linkbox_row_activated(self, listbox, row): weblinkactionrowactivated(listbox, row) confy-0.7.0/src/pages/list.blp000066400000000000000000000013751446165717300162200ustar00rootroot00000000000000using Gtk 4.0; using Adw 1; template $ConfyPageList : Gtk.Box { orientation: vertical; hexpand: true; vexpand: true; width-request: 360; Gtk.Stack stack { Gtk.StackPage { name: 'list'; child: Gtk.ScrolledWindow { hexpand: true; vexpand: true; Adw.Clamp { Gtk.Box { styles ['main-box'] orientation: vertical; spacing: 12; Gtk.ListBox listbox { styles ['boxed-list'] row-activated => $on_litstbox_activated(); } } } }; } Gtk.StackPage { name: 'empty_star'; child: Adw.StatusPage { icon-name: "non-starred-symbolic"; title: _("Nothing starred yet"); description: _("Star a talk to be notified when it's about to start."); vexpand: true; }; } } }confy-0.7.0/src/pages/list.py000066400000000000000000000107641446165717300160750ustar00rootroot00000000000000# info.py # # Copyright 2020-2023 Fabio Comuni, et al. # # 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 . from gi.repository import GObject from gi.repository import Gtk from gi.repository import Adw from .. import models from ..config import FMT_DAY from ..utils import clean_markup from ..widgets import EventActionRow @Gtk.Template(resource_path="/net/kirgroup/confy/pages/list.ui") class PageList(Gtk.Box): __gtype_name__ = "ConfyPageList" page_title = "" conf = None win = None stack = Gtk.Template.Child() listbox = Gtk.Template.Child() _update_handler_id = None # a quanto pare non posso attaccare nessun tipo di userdata a un ActionRow # quindi per sapere a quale oggetto si riferisce l'ActionRow attivato # mi tocca tenere un bel dizionario. E' brutto? Si. Frega qualcosa? Decisamente no. # La vecchia versione teneva la lista corrente degli oggetti, e ricavava il # selezionato da 'row.get_index()' nell' handler di 'row-activated'. # E' meglio o peggio? boh. _widget_data = {} _value = None def get_value(self): return self._value @GObject.Signal(name="row-activated") def row_activated(self): ... _model = "" @GObject.property(type=str, default="") def model(self): return self._model @model.setter def model(self, v): if self._update_handler_id: models.dbUpdateWatcher.disconnect(self._update_handler_id) _update_handler_id = None if v == "starred": self._update_handler_id = models.dbUpdateWatcher.connect("update", self.update) self._model = v def get_model(self): return self._model def init(self, win, conf): self.conf = conf self.win = win win.connect("conf-updated", self.update) return self def update(self, *_): count, data = self.get_objects() # empty listbox self._widget_data = {} w = self.listbox.get_last_child() while w: self.listbox.remove(w) w = self.listbox.get_last_child() if count == 0: self.show_placeholder() else: self.stack.set_visible_child_name('list') # fill listbox for idx, obj in enumerate(data): row = self.build_row(obj) self._widget_data[row] = obj self.listbox.append(row) def build_row(self, obj): """ Return a widget for data in current listbox """ title = str(obj) subtitle = "" if self._model == "days": title = obj.date.strftime(FMT_DAY) elif self._model == "tracks": subtitle = ", ".join(str(r) for r in obj.room) if self._model == "starred": row = EventActionRow(obj) else: row = Adw.ActionRow( activatable = True, selectable = False, title = clean_markup(title), subtitle = clean_markup(subtitle), ) row.add_suffix( Gtk.Image.new_from_icon_name('go-next-symbolic') ) return row def get_objects(self): if self._model == "days": return models.Day.count(), models.Day.all() elif self._model == "tracks": return models.Track.count(), models.Track.all() elif self._model == "rooms": return models.Room.count(), models.Room.all() elif self._model == "starred": g = models.Event.filter(starred=True) return next(g), g else: return 0, [] @Gtk.Template.Callback() def on_litstbox_activated(self, listbox, row): self._value = self._widget_data[row] self.emit("row-activated") def show_placeholder(self): if self._model == "starred": self.stack.set_visible_child_name('empty_star') else: self.stack.set_visible_child_name('list') confy-0.7.0/src/pages/meson.build000066400000000000000000000012161446165717300167020ustar00rootroot00000000000000## blueprint pages_blueprints_src = [ 'info.blp', 'list.blp', 'events.blp', 'details.blp', ] pages_blueprints_ui = [] foreach b : pages_blueprints_src pages_blueprints_ui += b.replace('.blp', '.ui') endforeach pages_blueprints = custom_target('widget_blueprints', input: pages_blueprints_src, output: pages_blueprints_ui, command: [find_program('blueprint-compiler'), 'batch-compile', '@OUTDIR@', '@CURRENT_SOURCE_DIR@', '@INPUT@'], ) ## /blueprint confy_pages_sources = [ '__init__.py', 'details.py', 'events.py', 'info.py', 'list.py', ] install_data(confy_pages_sources, install_dir: moduledir / 'pages')confy-0.7.0/src/preferences.py000066400000000000000000000056731446165717300163270ustar00rootroot00000000000000# preferences.py # # Copyright 2020-2022 Fabio Comuni, et al. # # 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 . from gi.repository import Gio from gi.repository import Gtk from gi.repository import Adw from .settings import Settings, CacheDuration from . import local def format_size(num): for unit in ['B','KiB','MiB','GiB','TiB','PiB','EiB','ZiB']: if abs(num) < 1024.0: return "%3.1f%s" % (num, unit) num /= 1024.0 return "%.1f%s" % (num, 'Yi') class PreferencesWindow(Adw.PreferencesWindow): def __init__(self, **kwargs): opts = dict( default_height=290, default_width=640, search_enabled=False, ) opts.update(kwargs) super().__init__(**opts) page = Adw.PreferencesPage() group = Adw.PreferencesGroup() listcache = Adw.ComboRow( title=_("Events list cache duration"), subtitle=_("Try to update list cache when it's older than this.")) listcache.set_model(CacheDuration.as_model()) Settings.instance().bind('list-cache', listcache, 'selected', Gio.SettingsBindFlags.DEFAULT) eventcache = Adw.ComboRow( title=_("Events info cache duration"), subtitle=_("Try to update event cache when it's older than this.") ) eventcache.set_model(CacheDuration.as_model()) Settings.instance().bind('event-cache', eventcache, 'selected', Gio.SettingsBindFlags.DEFAULT) group.add(listcache) group.add(eventcache) page.add(group) group = Adw.PreferencesGroup() button = Gtk.Button(label=_("Clear"), valign=Gtk.Align.CENTER, halign=Gtk.Align.END ) button.get_style_context().add_class("list-button") row = Adw.ActionRow( title=_("Cached data")) self._update_space_label(row) row.add_suffix(button) row.set_activatable_widget(button) button.connect("clicked", self._delete_cached_files, row) group.add(row) page.add(group) self.add(page) def _delete_cached_files(self, btn, row): local.clear_cache() self._update_space_label(row) def _update_space_label(self, row): cache_size = local.get_cache_size() occupied_space = format_size(cache_size) row.set_subtitle(_("Confy has {} of cached data").format(occupied_space)) confy-0.7.0/src/remotes/000077500000000000000000000000001446165717300151175ustar00rootroot00000000000000confy-0.7.0/src/remotes/__init__.py000066400000000000000000000026001446165717300172260ustar00rootroot00000000000000# __init__.py # # Copyright 2020-2022 Fabio Comuni, et al. # # 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 . import os from ..fetcher import Fetcher from .exceptions import InvalidFormatException from .pentabarf import import_pentabarf from .ics import import_ics def update_schedule(url:str) -> Fetcher: def _do_load(sender, local_filename:str): print("local conf file:", local_filename) with open(local_filename, "r") as f: content = f.read() if content.strip().startswith("<"): import_pentabarf(content, url) elif content.strip().startswith("BEGIN:VCALENDAR"): import_ics(content, url) else: raise InvalidFormatException(_("Unknown schedule format")) os.remove(local_filename) return Fetcher(url, cbk=_do_load) confy-0.7.0/src/remotes/exceptions.py000066400000000000000000000013541446165717300176550ustar00rootroot00000000000000# exceptions.py # # Copyright 2020-2022 Fabio Comuni, et al. # # 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 . class InvalidFormatException(Exception): pass confy-0.7.0/src/remotes/ics.py000066400000000000000000000103401446165717300162450ustar00rootroot00000000000000# ics.py # # Copyright 2020-2022 Fabio Comuni, et al. # # 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 . import time import html from datetime import datetime, timedelta, timezone from dateutil.tz import UTC from icalendar import Calendar, Event from .exceptions import InvalidFormatException from .. import local from ..models import Meta def import_ics(content:str, url:str): """Import data from ICS all dates will be converted to UTC and stored in db without tzinfo, because sqlite3 driver spits errors otherwise. """ cal = Calendar.from_ical(content) _db = local.getDb() meta_title = None meta_end = datetime(1970,1,1,0,0,0) meta_start = datetime(3100,12,12,23,59,59) for c in cal.walk(): if c.name == "VCALENDAR": meta_title = c.get('X-WR-CALNAME') if c.name == "VEVENT": fulltextsearch = [] eventid = c['UID'] if c.get('DTSTART'): start = c['DTSTART'].dt.astimezone(UTC).replace(tzinfo=None) else: start = c['DTSTAMP'].dt.astimezone(UTC).replace(tzinfo=None) if c.get('DURATION'): end = start + c['DURATION'].dt elif c.get('DTEND'): end = c['DTEND'].dt.astimezone(UTC).replace(tzinfo=None) else: end = start + timedelta(hours=1) evtdate = start.date() room = c.get('LOCATION') slug = None title = c.get('SUMMARY', "") subtitle = None track = None evtype = None abstract = None description = c.get('DESCRIPTION', "") if title == "" and description == "": title = "Untitled event" if title == "" and description != "": title = description[:20] if len(description) > 20: title = title + "…" if room: room = html.unescape(room) if room == "": room = None if start < meta_start: meta_start = start if end > meta_end: meta_end = end fulltextsearch += [ s for s in [title, subtitle, abstract, description, room, track] if s is not None ] links = [] _url = c.get('URL') if _url: links.append((eventid, _url, _url)) _db.execute("""INSERT OR REPLACE INTO events (id, date, start, end, room, slug, title, subtitle, track, type, abstract, description, starred) VALUES (?,?,?,?,?,?,?,?,?,?,?,?, (SELECT starred FROM events WHERE id=?))""", (eventid, evtdate, start, end, room, slug, title, subtitle, track, evtype, abstract, description, eventid)) #_db.executemany("INSERT OR REPLACE INTO persons (id, name) VALUES (?, ?)", persons) #_db.executemany("""INSERT OR REPLACE INTO event_person (event_id, person_id) # VALUES (?, ?) ON CONFLICT DO NOTHING""", # [ (eventid, p[0]) for p in persons ]) _db.executemany("""INSERT OR REPLACE INTO links (event_id, href, name) VALUES (?,?,?)""", links) fulltextsearchstr = ' '.join(fulltextsearch) _db.execute("""INSERT OR REPLACE INTO fts_event (event_id, text) VALUES (?, ?)""", (eventid, fulltextsearchstr)) _db.commit() with Meta() as m: m.url = url m.title = meta_title m.last_update = time.time() # timestamp m.start = meta_start.date() m.end = meta_end.date() confy-0.7.0/src/remotes/meson.build000066400000000000000000000002501446165717300172560ustar00rootroot00000000000000confy_remotes_sources = [ '__init__.py', 'pentabarf.py', 'ics.py', 'exceptions.py', ] install_data(confy_remotes_sources, install_dir: moduledir / 'remotes') confy-0.7.0/src/remotes/pentabarf.py000066400000000000000000000123351446165717300174370ustar00rootroot00000000000000# pentabarf.py # # Copyright 2020-2022 Fabio Comuni, et al. # # 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 . import datetime import time import xml.etree.ElementTree as ET from dateutil.tz import UTC, tzlocal from .exceptions import InvalidFormatException from .. import local from ..models import Meta def _local_to_utc_to_unset(dt): dt = dt.replace(tzinfo=tzlocal()) dt = dt.astimezone(UTC) return dt.replace(tzinfo=None) def _get_text(root, nodename): text = "" if root is not None: node = root.find(nodename) if node is not None: text = node.text return text def import_pentabarf(xmlstr:str, url:str): """Import data from Pentabarf XML As far I can tell, Pentabarf XML doesn't declare timezone. We will import dates in local timezone, then convert to UTC, then remove timezone info to store dates in db (because sqlite3 cries otherwise) """ root = ET.fromstring(xmlstr) if root.tag != "schedule": raise InvalidFormatException(_("Invalid pentabarf format")) econference = root.find("conference") base_url = _get_text(econference, "base_url") with Meta() as m: m.url = url m.last_update = time.time() # timestamp m.title = _get_text(econference, "title") m.start = _get_text(econference, "start") m.end = _get_text(econference, "end") m.venue = _get_text(econference, "venue") m.days = _get_text(econference, "days") m.city = _get_text(econference, "city") _db = local.getDb() for eday in root.iter('day'): date = eday.attrib['date'] for eevent in eday.iter('event'): fulltextsearch = [] eventid = eevent.attrib['id'] tstart = eevent.find('start').text.strip()[:5] start = _local_to_utc_to_unset( datetime.datetime.strptime(date + " " + tstart, "%Y-%m-%d %H:%M") ) end = eevent.find('duration').text.split(":") end = start + datetime.timedelta(hours=int(end[0]), minutes=int(end[1])) evtdate = datetime.datetime.strptime(date, "%Y-%m-%d").date() room = _get_text(eevent, 'room') slug = _get_text(eevent, 'slug') title = _get_text(eevent, 'title') subtitle = _get_text(eevent, 'subtitle') track = _get_text(eevent, 'track') evtype = _get_text(eevent, 'type') abstract = _get_text(eevent, 'abstract') description = _get_text(eevent, 'description') persons = [ (e.attrib.get('id', e.text), e.text) for e in eevent.iter('person') if e.text is not None ] fulltextsearch += [ s for s in [title, subtitle, abstract, description, room, track] if s is not None ] fulltextsearch += [p[1] for p in persons] links = [] for e in eevent.iter('link'): name = e.text href = e.attrib.get('href', False) if not href: href = name if base_url and href.startswith("/"): href = base_url + href links.append((eventid, href, name)) for e in eevent.iter('attachment'): name = e.text if e.attrib.get('type', False): name = '{} ({})'.format(name, e.attrib['type']) href = e.attrib.get('href', False) if not href: href = name if base_url and href.startswith("/"): href = base_url + href links.append((eventid, href, name)) _db.execute("""INSERT OR REPLACE INTO events (id, date, start, end, room, slug, title, subtitle, track, type, abstract, description, starred) VALUES (?,?,?,?,?,?,?,?,?,?,?,?, (SELECT starred FROM events WHERE id=?))""", (eventid, evtdate, start, end, room, slug, title, subtitle, track, evtype, abstract, description, eventid)) _db.executemany("INSERT OR REPLACE INTO persons (id, name) VALUES (?, ?)", persons) _db.executemany("""INSERT OR REPLACE INTO event_person (event_id, person_id) VALUES (?, ?) ON CONFLICT DO NOTHING""", [ (eventid, p[0]) for p in persons ]) _db.executemany("""INSERT OR REPLACE INTO links (event_id, href, name) VALUES (?,?,?)""", links) fulltextsearchstr = ' '.join(fulltextsearch) _db.execute("""INSERT OR REPLACE INTO fts_event (event_id, text) VALUES (?, ?)""", (eventid, fulltextsearchstr)) _db.commit() confy-0.7.0/src/settings.py000066400000000000000000000045041446165717300156560ustar00rootroot00000000000000# settings.py # # Copyright 2020-2022 Fabio Comuni, et al. # # 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 . from enum import IntEnum from gi.repository import Gio from gi.repository import Gtk from dateutil import tz # in secs CACHE_NOCACHE = 0 CACHE_ONE_HOUR = 60 * 60 CACHE_ONE_DAY = 24 * CACHE_ONE_HOUR CACHE_ONE_WEEK = 7 * CACHE_ONE_DAY class CacheDuration(IntEnum): NO_CACHE = 0 ONE_HOUR = 1 ONE_DAY = 2 ONE_WEEK = 3 @classmethod def as_model(cls): labels = [ n.name.replace("_", " ").title() for n in cls ] return Gtk.StringList.new(labels) @classmethod def get_duration(cls, enum_value): return [ CACHE_NOCACHE, CACHE_ONE_HOUR, CACHE_ONE_DAY, CACHE_ONE_WEEK ][enum_value] class Settings(Gio.Settings): _instance = None def __init__(self): """ Init settings """ Gio.Settings.__init__(self) @classmethod def instance(kls): return kls._instance @classmethod def init(kls, app_id): """ Initialize and return a new Settings object """ settings = Gio.Settings.new(app_id) settings.__class__ = Settings kls._instance = settings return settings def get_list_cache(self): return CacheDuration.get_duration(self.get_int('list-cache')) def get_event_cache(self): return CacheDuration.get_duration(self.get_int('event-cache')) def get_timezone(self): return tz.tzlocal() def get_size(self): return (self.get_int('window-width'), self.get_int('window-height')) def set_size(self, size): self.set_int('window-width', size[0]) self.set_int('window-height', size[1]) confy-0.7.0/src/shortcuts.blp000066400000000000000000000022321446165717300161750ustar00rootroot00000000000000using Gtk 4.0; using Adw 1; Gtk.ShortcutsWindow shortcuts-win { modal: true; Gtk.ShortcutsSection { section-name: "shortcuts"; Gtk.ShortcutsGroup { title: _("Application"); Gtk.ShortcutsShortcut { accelerator: "comma"; title: _("Preferences"); } Gtk.ShortcutsShortcut { accelerator: "question"; title: _("Keyboard Shortcuts"); } Gtk.ShortcutsShortcut { accelerator: "Q"; title: _("Close"); } } Gtk.ShortcutsGroup { title: _("Event Window"); Gtk.ShortcutsShortcut { accelerator: "O"; title: _("Open Event"); } Gtk.ShortcutsShortcut { accelerator: "F"; title: _("Find talk"); } Gtk.ShortcutsShortcut { accelerator: "C"; title: _("Copy talk details to clipboard"); } } Gtk.ShortcutsGroup { title: _("Open Event"); Gtk.ShortcutsShortcut { accelerator: "F"; title: _("Find event"); } Gtk.ShortcutsShortcut { accelerator: "R"; title: _("Reload events list"); } Gtk.ShortcutsShortcut { accelerator: "A"; title: _("Add event from URL"); } } } } confy-0.7.0/src/utils.py000066400000000000000000000073151446165717300151610ustar00rootroot00000000000000import re import html from html.parser import HTMLParser from gi.repository import GLib def convert_markdown_links(text): """converts markdown links to html hyperlinks""" return re.sub("\[([^]]+?)\]\(([^)\s]+?)(?:\s.*?)?\)", r'\1', text) def clean_markup(text): """remove unsupported markup from text to use in label""" if text is None: text = "" text = html2pango(text) text = text.replace("\n\n\n", "\n\n") text = text.replace("&", "&") return text.strip() def markup_to_text(text): """return plain text version of markup string""" text = clean_markup(text) text = re.sub(r'', '_', text) text = re.sub(r'', '`', text) text = re.sub(r'', '**', text) text = text.replace("&", "&") # remove all remainig tags text = re.sub(r']*>','', text) return text class InterruptibleTimeout: def __init__(self, intervall=0, callback=None, data=None): self._running = False self._requested_stop = True self._callback = callback if callback: self._running = True self._requested_stop = False if callback(self, data): GLib.timeout_add(intervall, self._on_timeout, data) def _on_timeout(self, data): if self._requested_stop: res = False else: res = self._callback(self, data) self._running = res return res def stop(self): self._requested_stop = True def must_stop(self): return self._requested_stop #pango tags: TAG_MAP = { # pango tags, as is 'b': ('', ''), 'i': ('', ''), 's': ('', ''), 'sub': ('', ''), 'sup': ('', ''), 'big': ('', ''), 'small': ('', ''), 'tt': ('', ''), 'u': ('', ''), # blocks 'address': ('', '\n\n'), 'blockquote': ('', '\n\n'), 'div': ('', '\n\n'), 'footer': ('', '\n\n'), 'header': ('', '\n\n'), #'hr': ('', ''), 'p': ('', '\n\n'), 'pre': ('\n', '\n'), 'h1': ('', '\n\n'), 'h2': ('', '\n\n'), 'h3': ('', '\n\n'), 'h4': ('', '\n\n'), 'h5': ('', '\n\n'), 'h6': ('', '\n\n'), 'td': ('', ''), 'th': ('', ''), 'tr': ('', '\n'), 'dt': ('', ''), 'dd': (' ', '\n'), 'li': ('', '\n'), # inline 'em': ('', ''), 'var': ('', ''), 'kbd': ('', ''), 'code': ('', ''), 'strong': ('', ''), # a 'ins': ('', ''), 'del': ('', ''), 'strike': ('', ''), 'br': ('', '\n'), } class HTMLToPango(HTMLParser): def __init__(self): super().__init__() self.result = [] def a_s(self, tag, attrs): href = attrs.get('href', '') self.result.append(f'') def a_e(self, tag): self.result.append(f'') def handle_starttag(self, tag, attrs): attrs = dict(attrs) if tag in TAG_MAP: self.result.append(TAG_MAP[tag][0]) return f = getattr(self, f"{tag}_s", None) if f: f(tag, attrs) def handle_endtag(self, tag): if tag in TAG_MAP: self.result.append(TAG_MAP[tag][1]) return f = getattr(self, f"{tag}_e", None) if f: f(tag) def handle_data(self, data): self.result.append(data.strip()) def html2pango(text): parser = HTMLToPango() parser.feed(text) return ''.join(parser.result) confy-0.7.0/src/widgets/000077500000000000000000000000001446165717300151075ustar00rootroot00000000000000confy-0.7.0/src/widgets/__init__.py000066400000000000000000000030741446165717300172240ustar00rootroot00000000000000# widgets/__init__.py # # Copyright 2020-2023 Fabio Comuni, et al. # # 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 . from os import path import datetime import html import math import re from dateutil.tz import UTC from gi.repository import GLib from gi.repository import GObject from gi.repository import Gio from gi.repository import Gdk from gi.repository import Gtk from gi.repository import GdkPixbuf from gi.repository import Adw from gi.repository import Graphene from gi.repository import Gsk from ..utils import clean_markup from .eventeditdialog import EventEditDialog from .loaderpage import LoaderPage from .pageheaderbar import PageHeaderBar from .searchbaroverlay import SearchBarOverlay from .sidebar import SideBar from .starbutton import StarButton from .datepickerrow import DatePickerRow from .inputdialog import InputDialog from .loadingoverlay import LoadingOverlay from .eventactionrow import EventActionRow from .weblinkactionrow import WebLinkActionRow, weblinkactionrowactivated confy-0.7.0/src/widgets/datepickerrow.py000066400000000000000000000054621446165717300203330ustar00rootroot00000000000000# widgets/datepickerrow.py # # Copyright 2020-2023 Fabio Comuni, et al. # # 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 . import datetime import re from gi.repository import GLib from gi.repository import GObject from gi.repository import Gtk from gi.repository import Adw class DatePickerRow(Adw.EntryRow): __gtype_name__ = "ConfyDatePickerRow" @GObject.Signal def date_changed(self): ... def __init__(self, **kwargs): self.date = None super().__init__(**kwargs) self.set_selectable(False) self.pop = Gtk.Popover() self.cal = Gtk.Calendar() self.cal.show() self.pop.set_child(self.cal) self.menubutton = Gtk.MenuButton( popover=self.pop, valign=Gtk.Align.CENTER, icon_name="x-office-calendar-symbolic" ) self.menubutton.add_css_class("flat") self.add_suffix(self.menubutton) self.cal.connect("day-selected", self._cal_changed) self.connect("changed", self._entry_changed) self.set_date(None) def get_date(self): return self.date def get_datetime(self): return datetime.datetime.combine(self.date, datetime.time.min) def _set_date(self, date): _date = self.date self.date = date if self.date != _date: self.emit("date_changed") if date is None: lbl = "" gdate = GLib.DateTime.new_now_local() else: lbl = str(date) gdate = GLib.DateTime.new_local(date.year, date.month, date.day, 0, 0, 0) return lbl, gdate def set_date(self, date): lbl, gdate = self._set_date(date) self.cal.select_day(gdate) self.set_text(lbl) def _cal_changed(self, *args): date = self.cal.get_date() date = datetime.date( year=date.get_year(), month=date.get_month(), day=date.get_day_of_month() ) self.set_date(date) def _entry_changed(self, *args): val = self.get_text() if re.match(r'\d\d\d\d-\d\d-\d\d', val): date = datetime.date(*[int(s) for s in val.split("-")]) self._set_date(date) else: self._set_date(None) confy-0.7.0/src/widgets/eventactionrow.py000066400000000000000000000131571446165717300205370ustar00rootroot00000000000000# widgets/eventactionrow.py # # Copyright 2020-2023 Fabio Comuni, et al. # # 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 . import datetime import math from dateutil.tz import UTC from gi.repository import Gio from gi.repository import Gtk from gi.repository import Adw from gi.repository import Graphene from ..utils import clean_markup from ..models import dbUpdateWatcher from .starbutton import StarButton class EventActionRow(Adw.ActionRow): _hid = None obj = None def __init__(self, obj): super().__init__(activatable=True, selectable=False) self.obj = obj self._hid = dbUpdateWatcher.connect('update', self.on_update) self.toggle_btn = StarButton(is_starred = obj.starred) self.toggle_btn.connect("clicked", self.toggle_starred) self.add_suffix(self.toggle_btn) self.on_update() Gio.Application.get_default().connect( "tick", lambda *_: self.queue_draw() ) def __del__(self): if self._hid: dbUpdateWatcher.disconnect(self.hid) def _is_first(self): return self.get_index() == 0 def _is_last(self): p = self.get_parent() if p is None: return True return p.get_last_child() == self def do_snapshot(self, snapshot: Gtk.Snapshot): x = -2 y = -2 w = 10 h = self.get_allocated_height() rect = Graphene.Rect().init(x, y, w, h) cr = snapshot.append_cairo(rect) self._draw(cr, rect) self.snapshot_child(self.get_first_child(), snapshot) def _roundedclippath(self, cr, x, y, w, h, rtop, rbottom): cr.arc(x+rtop, y+rtop, rtop, math.pi, 3*math.pi/2) cr.line_to(x+w, y) cr.line_to(x+w, y+h) cr.line_to(x+w, y+h) #cr.arc(x+w-rtop, y+rtop, rtop, 3*math.pi/2, 0) # top-right round corner #cr.arc(x+w-rbottom, y+h-rbottom, rbottom, 0, math.pi/2) # bottom-right cr.arc(x+rbottom, y+h-rbottom, rbottom, math.pi/2, math.pi) cr.close_path() cr.clip() def _draw(self, cr, rect): """ Draw event progress indicator in widget background. It's a tick line on left border from top whose lenght is relative to the percentage of event time elapsed. We need to handle list round corners. Gtk doesn't clip element like HTML when rendering with "border-radius" value, so our line will overflow the corner. I use the clip path method. It get a top rounded corner if `self` is the first row in the list, and a bottom rounded corner if it's the last. Round radio is defined in code, as I can't find a way to get current widget CSS values. Then a line of required lenght, color and width is drawn from top. Color of the line is widget foreground color with alpha 0.2. Using foreground color make the line work on light and dark theme. """ now = datetime.datetime.now(UTC).replace(tzinfo=None) #now = datetime.datetime(2023, 2, 5, 10, 50, tzinfo=UTC).replace(tzinfo=None) obj = self.obj dur = (obj.end.timestamp() - obj.start.timestamp()) pos = (now.timestamp() - obj.start.timestamp()) if dur > 0: prc = min(max(pos/dur, 0.0), 1.0) else: # not a valid event duration # set prc to 0 if the event is in the future or 1 if in the past prc = int(pos >= 0) if prc == 0: return maxh = rect.get_height() x = rect.get_x() y = rect.get_y() h = maxh * prc w = rect.get_width() # clip at rounded corners rtop = 12 if self._is_first() and self.get_header() is None else 0 rbottom = 12 if self._is_last() else 0 # color # >= gtk 4.10 : self.get_color() color = self.get_style_context().get_color() color.alpha = 0.2 cr.save() # rounded clip path self._roundedclippath(cr, x, y-1, w, maxh+2, rtop, rbottom) # draw line cr.set_source_rgba( color.red, color.green, color.blue, color.alpha ) cr.set_line_width(w) cr.move_to(x, y) cr.line_to(x, h) cr.stroke() cr.restore() def on_update(self, *args): obj = self.obj subtitle = "{}-{}".format( obj.start_in_tz().strftime("%a %H:%M"), obj.end_in_tz().strftime("%H:%M")) if obj.room: subtitle = "{} ({})".format( subtitle, obj.room) if obj.track: subtitle = "{} '{}'".format( subtitle, obj.track) ps = list(obj.persons()) if len(ps) > 0: subtitle = "{} - {}".format( subtitle, ", ".join([str(p) for p in ps])) self.set_title(clean_markup(obj.title)) self.set_subtitle(clean_markup(subtitle)) self.toggle_btn.props.is_starred = self.obj.starred def toggle_starred(self, button): self.obj.set_star(not self.obj.starred) confy-0.7.0/src/widgets/eventeditdialog.blp000066400000000000000000000026021446165717300207550ustar00rootroot00000000000000using Gtk 4.0; using Adw 1; template $ConfyEventEditDialog : Gtk.Dialog { can-focus: false; modal: true; destroy-with-parent: true; default-width: 640; default-height: 380; title: _("Edit event"); [action response=ok] Gtk.Button ok_response { label: _("Ok"); sensitive: bind-property template.can-save; } [action response=cancel] Gtk.Button cancel_response { label: _("Cancel"); visible: bind-property template.can-cancel; } [action response=1] Gtk.Button delete_response { styles ['destructive-action'] label: _("Delete"); visible: bind-property template.can-delete; } Gtk.ScrolledWindow { Adw.Clamp { Gtk.Box { styles ['main-box'] orientation: vertical; Gtk.ListBox { styles ['boxed-list'] Adw.EntryRow entry_url { title: _("URL"); editable: false; changed => $validate_entry_required(); realize => $validate_entry_required(); } Adw.EntryRow entry_title { title: _("Title"); changed => $validate_entry_required(); realize => $validate_entry_required(); } $ConfyDatePickerRow entry_start { title: _("Start"); date_changed => $validate_date_order(); } $ConfyDatePickerRow entry_end { title: _("End"); date_changed => $validate_date_order(); } Adw.EntryRow entry_icon { title: _("Icon URL"); } } } } } }confy-0.7.0/src/widgets/eventeditdialog.py000066400000000000000000000102321446165717300206260ustar00rootroot00000000000000# widgets/eventdialog.py # # Copyright 2020-2023 Fabio Comuni, et al. # # 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 . from gi.repository import GObject from gi.repository import Gtk @Gtk.Template(resource_path="/net/kirgroup/confy/widgets/eventeditdialog.ui") class EventEditDialog(Gtk.Dialog): __gtype_name__ = "ConfyEventEditDialog" CANCEL = Gtk.ResponseType.CANCEL OK = Gtk.ResponseType.OK DELETE = 1 _can_save = False @GObject.property(type=bool, default=False) def can_save(self): return self._can_save @can_save.setter def can_save(self, value): self._can_save = value _can_delete = False @GObject.Property(type=bool, default=False) def can_delete(self): return self._can_delete @can_delete.setter def can_delete(self, value): self._can_delete = value _can_cancel = False @GObject.Property(type=bool, default=False) def can_cancel(self): return self._can_cancel @can_cancel.setter def can_cancel(self, value): self._can_cancel = value entry_url = Gtk.Template.Child() entry_title = Gtk.Template.Child() entry_start = Gtk.Template.Child() entry_end = Gtk.Template.Child() entry_icon = Gtk.Template.Child() def __init__(self, parent, conf, **kwargs): self._err = set() self.conf = conf opts = { 'transient_for': parent, 'use_header_bar': True, } opts.update(kwargs) super().__init__(**opts) self.set_default_response(self.OK) self.connect("response", self.on_response) self.setup_ui() def get_conf(self): return self.conf def _do_ok(self): self.conf.url = self.entry_url.get_text() self.conf.title = self.entry_title.get_text() self.conf.start = self.entry_start.get_date() self.conf.end = self.entry_end.get_date() if self.conf.metadata is None: self.conf.metadata = {} if self.entry_icon.get_text() != "": self.conf.metadata['icon'] = self.entry_icon.get_text() elif 'icon' in self.conf.metadata: del self.conf.metadata['icon'] def on_response(self, dialog, response): if response == self.OK: self._do_ok() @Gtk.Template.Callback() def validate_entry_required(self, entry): if len(entry.get_text()) > 0: entry.remove_css_class("error") if entry in self._err: self._err.remove(entry) else: entry.add_css_class("error") self._err.add(entry) self._update_ok() @Gtk.Template.Callback() def validate_date_order(self, entry): if self.entry_start.get_date() is None or self.entry_end.get_date() is None: entry.add_css_class("error") self._err.add(entry) elif self.entry_start.get_date() > self.entry_end.get_date(): entry.add_css_class("error") self._err.add(entry) else: for e in (self.entry_start, self.entry_end): e.remove_css_class("error") if e in self._err: self._err.remove(e) self._update_ok() def _update_ok(self): self.props.can_save = len(self._err) == 0 def setup_ui(self): self.entry_url.set_text(self.conf.url) self.entry_title.set_text(self.conf.title) self.entry_start.set_date(self.conf.start) self.entry_end.set_date(self.conf.end) if self.conf.metadata is not None: self.entry_icon.set_text(self.conf.metadata.get('icon','')) confy-0.7.0/src/widgets/inputdialog.py000066400000000000000000000030751446165717300200050ustar00rootroot00000000000000# widgets/inputdialog.py # # Copyright 2020-2023 Fabio Comuni, et al. # # 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 . from gi.repository import Gtk from gi.repository import Adw class InputDialog(Adw.MessageDialog): CANCEL = "cancel" OK = "ok" def __init__(self, parent, **kwargs): super().__init__(transient_for=parent) self.props.heading = _("Add Event from URL") self.props.body = _("Enter URL to event schedule to add it to the list.\nConfy supports events in Pentabarf (.xml) or iCal (.ics) format.") self.add_response(self.CANCEL, _("Cancel")) self.add_response(self.OK, _("Add")) self.set_response_appearance(self.OK, Adw.ResponseAppearance.SUGGESTED) self.set_default_response(self.OK) self.set_close_response(self.CANCEL) self.props.extra_child = Gtk.Entry( activates_default = True, editable = True, ) def get_text(self): return self.props.extra_child.get_text() confy-0.7.0/src/widgets/loaderpage.blp000066400000000000000000000007341446165717300177150ustar00rootroot00000000000000using Gtk 4.0; using Adw 1; template $ConfyLoaderPage : Gtk.Box { orientation: vertical; vexpand: true; Adw.StatusPage { icon-name: "net.kirgroup.confy"; title: _("Loading..."); vexpand: true; Adw.Clamp { maximum-size: 400; Gtk.Box { orientation: vertical; spacing: 12; Gtk.ProgressBar progressbar {} Gtk.Button cancel_button { label: _("Cancel"); halign: center; clicked => $on_cancel_button_clicked(); } } } } }confy-0.7.0/src/widgets/loaderpage.py000066400000000000000000000031541446165717300175670ustar00rootroot00000000000000# widgets/loaderpage.py # # Copyright 2020-2023 Fabio Comuni, et al. # # 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 . from gi.repository import GLib from gi.repository import Gtk @Gtk.Template(resource_path="/net/kirgroup/confy/widgets/loaderpage.ui") class LoaderPage(Gtk.Box): """Un'altro cazzo di final wrappato in un minchia di Box""" __gtype_name__ = "ConfyLoaderPage" progressbar = Gtk.Template.Child() cancel_button = Gtk.Template.Child() fetcher = None def __init__(self): super().__init__() GLib.timeout_add(200, self._do_pulse) @Gtk.Template.Callback() def on_cancel_button_clicked(self, *_): if self.fetcher: self.fetcher.cancel() def set_fetcher(self, fetcher): self.fetcher = fetcher self.progressbar.set_fraction(0) fetcher.bind_property("fraction", self.progressbar, "fraction") def _do_pulse(self,*args): if self.progressbar.get_fraction() > 0: return False self.progressbar.pulse() return True confy-0.7.0/src/widgets/loadingoverlay.py000066400000000000000000000035721446165717300205070ustar00rootroot00000000000000# widgets/loadingoverlay.py # # Copyright 2020-2023 Fabio Comuni, et al. # # 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 . from gi.repository import Gtk from gi.repository import Adw def LoadingOverlay(cancellable): """ Questo era una classe, ma, di nuovo, Adw.Toast è final. é un Toast che interrompe il "cancellable" se si pigia sul bottone """ toast = Adw.Toast() toast.set_timeout(0) adw_1_2 = Adw.get_major_version() > 1 or Adw.get_minor_version() > 1 if adw_1_2: ## this need libadwaita >=1.2 box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=20) spinner = Gtk.Spinner.new() spinner.start() label = Gtk.Label(label=_("Loading…")) box.append(spinner) box.append(label) toast.set_custom_title(box) else: toast.set_title(_("Loading…")) toast.set_button_label(_("cancel")) cancellable.connect("done", lambda *_: toast.dismiss()) cancellable.connect("error", lambda *_: toast.dismiss()) if adw_1_2: ## this need libadwaita 1.2 toast.connect("button-clicked", lambda *_: cancellable.cancel()) else: ## for older adw, dismissing the toast will cancell the operation toast.connect("dismissed", lambda *_: cancellable.cancel()) return toast confy-0.7.0/src/widgets/meson.build000066400000000000000000000016571446165717300172620ustar00rootroot00000000000000## blueprint widgets_blueprints_src = [ 'searchbaroverlay.blp', 'eventeditdialog.blp', 'sidebar.blp', 'loaderpage.blp', 'pageheaderbar.blp', 'starbutton.blp', ] widgets_blueprints_ui = [] foreach b : widgets_blueprints_src widgets_blueprints_ui += b.replace('.blp', '.ui') endforeach widgets_blueprints = custom_target('widget_blueprints', input: widgets_blueprints_src, output: widgets_blueprints_ui, command: [find_program('blueprint-compiler'), 'batch-compile', '@OUTDIR@', '@CURRENT_SOURCE_DIR@', '@INPUT@'], ) ## /blueprint confy_widgets_sources = [ '__init__.py', 'searchbaroverlay.py', 'eventeditdialog.py', 'sidebar.py', 'loaderpage.py', 'pageheaderbar.py', 'starbutton.py', 'datepickerrow.py', 'inputdialog.py', 'loadingoverlay.py', 'eventactionrow.py', 'weblinkactionrow.py', ] install_data(confy_widgets_sources, install_dir: moduledir / 'widgets')confy-0.7.0/src/widgets/pageheaderbar.blp000066400000000000000000000012341446165717300203600ustar00rootroot00000000000000using Gtk 4.0; using Adw 1; template $ConfyPageHeaderBar : Gtk.Box { orientation: vertical; hexpand: true; Adw.HeaderBar headerbar { show-start-title-buttons: bind-property template.show-start-title-buttons; show-end-title-buttons: bind-property template.show-end-title-buttons; title-widget: Adw.WindowTitle windowtitle { title: bind-property template.title; subtitle: bind-property template.subtitle; }; [start] Gtk.Button { visible: bind-property template.show-start-title-buttons; icon-name: "go-previous-symbolic"; action-name: 'win.show-sidebar'; } //[end] //Gtk.Button { // icon-name: "open-menu-symbolic"; //} } } confy-0.7.0/src/widgets/pageheaderbar.py000066400000000000000000000036031446165717300202350ustar00rootroot00000000000000# widgets/pageheaderbar.py # # Copyright 2020-2023 Fabio Comuni, et al. # # 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 . from gi.repository import GObject from gi.repository import Gtk @Gtk.Template(resource_path="/net/kirgroup/confy/widgets/pageheaderbar.ui") class PageHeaderBar(Gtk.Box): """Guarda mamma! un'altro box inutile! YAY!""" __gtype_name__ = "ConfyPageHeaderBar" _title = "" @GObject.property(type=str, default="") def title(self): return self._title @title.setter def title(self, v): self._title = v _subtitle = "" @GObject.property(type=str, default="") def subtitle(self): return self._subtitle @subtitle.setter def subtitle(self, v): self._subtitle = v _show_start_title_buttons = True @GObject.property(type=bool, default=True) def show_start_title_buttons(self): return self._show_start_title_buttons @show_start_title_buttons.setter def show_start_title_buttons(self, v): self._show_start_title_buttons = v _show_end_title_buttons = True @GObject.property(type=bool, default=True) def show_end_title_buttons(self): return self._show_end_title_buttons @show_end_title_buttons.setter def show_end_title_buttons(self, v): self._show_end_title_buttons = v confy-0.7.0/src/widgets/searchbaroverlay.blp000066400000000000000000000007531446165717300211470ustar00rootroot00000000000000using Gtk 4.0; using Adw 1; template $ConfySearchBarOverlay : Gtk.Box { Gtk.SearchBar bar { hexpand: true; show-close-button: true; Adw.Clamp { Gtk.Box { spacing: 8; Gtk.SearchEntry entry { can-focus: true; hexpand: true; changed => $send_changed(); } Gtk.ToggleButton is_starred { visible: bind-property template.show_advanced; toggled => $send_changed(); Gtk.Image { icon-name: "starred-symbolic"; } } } } } }confy-0.7.0/src/widgets/searchbaroverlay.py000066400000000000000000000070311446165717300210160ustar00rootroot00000000000000# widgets/searchbaroverlay.py # # Copyright 2020-2023 Fabio Comuni, et al. # # 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 . from gi.repository import GObject from gi.repository import Gtk @Gtk.Template(resource_path="/net/kirgroup/confy/widgets/searchbar.ui") class SearchBarOverlay(Gtk.Box): """ Ora, mi piacerebbe sapere perchè cazzo Gtk.SearchBox è final, che chiaramente significa che non è subclassabile, solo che pare che posso farlo (almeno in PyGObject), ma scazza con il template. In pratica me lo costruisce, ma poi sparisce il child. Quindi sono costretto a wrapparlo in un elemento che posso subclassare. Ma dato che Gtk.Widget non ha child, la cosa più veloce è usare un Box. Così adesso il Box deve calcolare la dimensione dell'unico child che ha, la stracazzo di Gtk.SearchBox. E siccome questa doveva essere una subclass di Gtk.SearchBar, mi aspetto che si comporti come una Gtk.SearchBar e quindi sono costretto a riportare le properties e i metodi che uso nel codice. Bella merda. """ __gtype_name__ = "ConfySearchBarOverlay" bar = Gtk.Template.Child() entry = Gtk.Template.Child() is_starred = Gtk.Template.Child() @GObject.Signal(name="changed") def changed(self): ... _search_mode_enabled = False @GObject.Property(type=bool, default=False) def search_mode_enabled(self): return self._search_mode_enabled @search_mode_enabled.setter def search_mode_enabled(self, value): self._search_mode_enabled = value _show_close_button = False @GObject.Property(type=bool, default=True) def show_close_button(self): return self._show_close_button @show_close_button.setter def show_close_button(self, value): self._show_close_button = value _show_advanced = True @GObject.Property(type=bool, default=True) def show_advanced(self): return self._show_advanced @show_advanced.setter def show_advanced(self, value): self._show_advanced = value def __init__(self, **kwargs): super().__init__(**kwargs) self.bind_property('search-mode-enabled', self.bar, 'search-mode-enabled', GObject.BindingFlags.BIDIRECTIONAL) self.bind_property('show-close-button', self.bar, 'show-close-button', GObject.BindingFlags.BIDIRECTIONAL) self.bar.connect('notify::search-mode-enabled', self._on_search_mode_changed) def _on_search_mode_changed(self, *args): if self.bar.get_search_mode(): self.entry.set_text("") self.is_starred.set_active(False) self.entry.grab_focus() def set_search_mode(self, value): # ma cazzo. self.bar.set_search_mode(value) def is_searching(self): return self.bar.get_search_mode() and (self.entry.get_text() != "" or self.is_starred.get_active()) @Gtk.Template.Callback() def send_changed(self, *_): self.changed.emit() confy-0.7.0/src/widgets/sidebar.blp000066400000000000000000000003151446165717300172160ustar00rootroot00000000000000using Gtk 4.0; using Adw 1; template $ConfySideBar : Gtk.Box { orientation: vertical; hexpand: true; Gtk.ListBox listbox { styles ['navigation-sidebar'] row-activated => $_on_row_activated(); } }confy-0.7.0/src/widgets/sidebar.py000066400000000000000000000064621446165717300171020ustar00rootroot00000000000000# widgets/sidebar.py # # Copyright 2020-2023 Fabio Comuni, et al. # # 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 . from gi.repository import GObject from gi.repository import Gtk from gi.repository import Adw class SideBarRow(Adw.ActionRow): __gtype_name__ = "ConfySideBarRow" _name = None @GObject.property(type=str, default="") def name(self): return self._name @name.setter def name(self, value): self._name = value def __init__(self, **kwargs): super().__init__(**kwargs) self.props.activatable = True; @Gtk.Template(resource_path="/net/kirgroup/confy/widgets/sidebar.ui") class SideBar(Gtk.Box): __gtype_name__ = "ConfySideBar" listbox = Gtk.Template.Child() @GObject.Signal def page_changed(self): ... _stack = None @GObject.property(type=Gtk.Stack) def stack(self): return self._stack @stack.setter def stack(self, obj): if obj != self._stack: # rebuild w = self.listbox.get_last_child() while w: self.listbox.remove(w) w = self.listbox.get_last_child() for p in obj.get_pages(): row = SideBarRow() p.bind_property("name", row, "name", GObject.BindingFlags.SYNC_CREATE) p.bind_property("title", row, "title", GObject.BindingFlags.SYNC_CREATE) p.bind_property("icon-name", row, "icon-name", GObject.BindingFlags.SYNC_CREATE) p.bind_property("visible", row, "visible", GObject.BindingFlags.SYNC_CREATE) self.listbox.append(row) self.listbox.select_row(self.listbox.get_first_child()) self._stack = obj self._stack.connect('notify::visible-child', self._on_stack_page_changed) def __init__(self, **kwargs): super().__init__(**kwargs) self.listbox.set_header_func(self._set_separators) def get_row_by_name(self, name): for i in range(0, 5): row = self.listbox.get_row_at_index(i) if row is None: break if row.props.name == name: break return row def _on_stack_page_changed(self, *_): name = self._stack.get_visible_child_name() row = self.get_row_by_name(name) print(name, row) if row is None: return self.listbox.select_row(row) @Gtk.Template.Callback() def _on_row_activated(self, listbox, row): if self._stack: self._stack.set_visible_child_name(row.props.name) self.emit('page-changed') def _set_separators(self, row, before): if row.props.name == "starred": h = Gtk.Separator() row.set_header(h) confy-0.7.0/src/widgets/starbutton.blp000066400000000000000000000002741446165717300200160ustar00rootroot00000000000000using Gtk 4.0; using Adw 1; template $ConfyStarButton : Gtk.Button { styles ['circular', 'image-button'] valign: center; Gtk.Image { icon-name: bind-property template.icon-name; } }confy-0.7.0/src/widgets/starbutton.py000066400000000000000000000024601446165717300176700ustar00rootroot00000000000000# widgets/starbutton.py # # Copyright 2020-2023 Fabio Comuni, et al. # # 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 . from gi.repository import GObject from gi.repository import Gtk @Gtk.Template(resource_path="/net/kirgroup/confy/widgets/starbutton.ui") class StarButton(Gtk.Button): __gtype_name__ = "ConfyStarButton" _is_starred = False @GObject.Property(type=bool, default=True) def is_starred(self): return _is_starred @is_starred.setter def is_starred(self, v): self._is_starred = v self.notify("icon-name") @GObject.Property(type=str, default="non-starred-symbolic") def icon_name(self): return "starred-symbolic" if self._is_starred else "non-starred-symbolic" confy-0.7.0/src/widgets/weblinkactionrow.py000066400000000000000000000042011446165717300210370ustar00rootroot00000000000000# widgets/weblinkactionrow.py # # Copyright 2020-2023 Fabio Comuni, et al. # # 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 . from os import path import html from gi.repository import Gio from gi.repository import Gtk from gi.repository import Adw from ..utils import clean_markup class WebLinkActionRow(Adw.ActionRow): def __init__(self, title, url, icontype=None, **kwargs): opts = dict(activatable=True, selectable=False) opts.update(kwargs) super().__init__(**opts) self.url = url if title is None: title = path.basename(url) self.set_title(clean_markup(html.unescape(title))) self.set_subtitle(url) #if icontype is None: normurl = url.split("#")[0].split("?")[0] ftype, _ = Gio.content_type_guess(normurl) fmaj, fmin = ftype.split("/") icontype = "text/html" if fmaj in ('text','video', 'audio', 'image'): icontype = ftype if fmin == 'pdf' or 'document' in fmin: icontype = ftype self.content_type = icontype ficon = Gio.content_type_get_icon(icontype) # I have to manage icon by hand.. ouf image = Gtk.Image.new_from_gicon(ficon) image.set_icon_size(Gtk.IconSize.LARGE) self.add_prefix(image) def weblinkactionrowactivated(listbox, actionrow): appinfo = Gio.app_info_get_default_for_type(actionrow.content_type, True) if appinfo is not None: appinfo.launch_uris([actionrow.url], None) else: Gio.app_info_launch_default_for_uri(actionrow.url, None) confy-0.7.0/subprojects/000077500000000000000000000000001446165717300152155ustar00rootroot00000000000000confy-0.7.0/subprojects/blueprint-compiler.wrap000066400000000000000000000002611446165717300217230ustar00rootroot00000000000000[wrap-git] directory = blueprint-compiler url = https://gitlab.gnome.org/jwestman/blueprint-compiler.git revision = main depth = 1 [provide] program_names = blueprint-compiler