I Use This!
Activity Not Available

News

Analyzed 4 months ago. based on code collected 9 months ago.
Posted about 2 years ago by KDE Community
Over 120 individual programs plus dozens of programmer libraries and feature plugins are released simultaneously as part of KDE Gear. Today they all get new bugfix source releases with updated translations, including: kcron: Improve temporary file ... [More] handling, Commit, CVE-2022-24986 kio-extras: SFTP can use random access, Commit, #450198 kontact: Fix Manager Crash when clicking New, Commit, #424252 Distro and app store packagers should update their application packages. 21.12 release notes for information on tarballs and known issues. Package download wiki page 21.12.3 source info page 21.12.3 full changelog [Less]
Posted about 2 years ago by KDE Eco Blog
I am very thankful to the KDE team for inviting me to be a part of this amazing community through their annual program Season of KDE. About Me I am Karanjot Singh. I am a first-year computer science engineering undergraduate from Jaypee Institute of ... [More] Information Technology, Noida, India. I have worked as a developer with various Free and Open-Source Software (FOSS) programs such as Kharagpur Winter of Code in 2021 (KWoC’21). However, this will be my first time contributing to a project with such a large community. I am very passionate about FOSS, solving problems, and improving process efficiency. I enjoy exploring and learning new technologies and building things for socially-useful causes. I also believe that contributing to FOSS is the best way to gain experience in software development. What I Will Be Working On As part of a pioneering sustainability project, KDE Eco has the aim of measuring and driving down the energy consumption of KDE/Free Software. This requires emulating user behaviour, which can be achieved by planning and scripting Standard Usage Scenarios. I will be scripting Standard Usage Scenarios for various applications, with a focus on commonly-used text editors like Kate, KWrite, Vim, Nano, Emacs, Calligra Words, and LibreOffice. I will prepare these usage scenarios with one of many available emulation tools. Below is my SoK’22 Timeline: Motivation Behind Working On The KDE Eco Project I think KDE Eco is a very good initiative for developing resource and energy-efficient Free Software. When someone uses FOSS and discovers that the software is transparent about its energy consumption, that using the software may help prolong the lifespan of hardware and reduce the environmental impact of digitization, this excites me. I always want to be part of something that contributes to future generations and KDE Eco serves that purpose. I also believe that KDE Eco assists me in my journey to become a better software developer. What I Have Learnt So Far When I was beginning with this project, I had three questions. How can we know when software is resource and energy-efficient? How can we measure software’s energy consumption? And does it make a difference? These questions may come into anyone’s mind when thinking about the idea of software efficiency. When you use software, what you see is only the interface you are interacting with. Just tell your phone what you want and things will appear magically — whether it is the information on screen or a package delivered to your doorstep. But the technologies and infrastructure behind it are determined by software engineers who make all of this work. Just imagine: What if we analyzed the energy consumption behind commonly-used software and made it more transparent? What if users could learn how much energy their software requires and could choose the application that might be better for the environment? This would be great!!! The KDE Eco initiatives Free and open source Energy Efficiency Project (FEEP) and Blauer Engel For FOSS (BE4FOSS) are working hard on these issues. As noted by FEEP, the design and implementation of software has a significant impact on the energy consumption of the systems it is part of. With the right tools, it is possible to quantify and drive down energy consumption. This increased efficiency contributes to a more sustainable use of energy as one of the shared resources of our planet. BE4FOSS supports FEEP by collecting and spreading information related to Blauer Engel (BE) eco-certification, the official environmental label awarded by the German government. As stated at the KDE Eco website, obtaining the Blauer Engel label occurs in 3 steps: (1) Measure, (2) Analyze, (3) Certify. MEASURE in dedicated labs, such as at KDAB Berlin ANALYZE using statistical tools such as OSCAR (Open-source Software Consumption Analysis in R) CERTIFY by submitting the report on the fulfilment of the Blauer Engel criteria In SoK'22, I will be preparing Standard Usage Scenarios for various text editors so that the usage scenarios may be used in Step 1 for obtaining BE eco-certification. What I Have Done & Will Be Doing In The Coming Weeks For the past three weeks, I have tested various automation tools, in particular Actiona, xdotool, and GNU Xnee, to decide which of these tools would be best for implementing Standard Usage Scenarios. While using Actiona, I wrote some documentation so that this information will also be beneficial for anyone wanting to contribute to KDE Eco. While trying out xdotool, I came across an issue with memory leak. Running Valgrind on xdotool search, I get more lost memory allocated by XQueryTree. There are probably other places where memory is allocated and not being freed afterwards. I have not done an extensive check. Nevertheless, xdotool gives more control over the system and even with some issues, this is the tool that I found most helpful. I tested GNU Xnee too, which seemed interesting to me as it records the output and stores it in a separate file. Also, it provides a replayer that one can use to automate tasks at whatever speed one wants. In the end, I have decided to prepare all usage scenarios with xdotool, at least initially, as most of the text editors use keyboard functions rather than mouse activity and this will make it easier to adapt the script to different systems. However, after SoK'22 I plan to prepare usage scenarios with Actiona as well so that I can learn the differences between these tools. On a related note, there is also an ongoing discussion about repurposing Standard Usage Scenarios for testing responsiveness and performance on older or lower-end hardware. In the coming weeks, I will additionally be working on fixing an issue that is known for Actiona. The problem is that Actiona emulates user behaviour by storing the position of clicks based on pixel coordinates, which can make transferring a script to another system challenging. For instance, this issue arose recently when preparing a Standard Usage Scenario for GCompris. I came up with a solution of resizing the screen to a minimum screen resolution and including the code at the beginning of the Actiona script. Whenever the script runs in a different system, it automatically resizes to the minimum resolution to match the pixels while making the script. This is just an idea and is not yet tested. I will put aside time for this attempt to fix the problem with the help of the GCompris team. The GitLab repository containing Standard Usage Scenarios in progress (currently GCompris using Actiona) can be found here. Community Bonding ( SoK’22 ) I am thankful to my mentor Joseph P. De Veaugh-Geiss for taking time to help me by providing resources and guidance during the project. I also attended the KDE Eco monthly community meetup on 9 February 2022, where Prof. Dr Stefan Naumann, Achim Guldner, and Christopher Stumpf from Umwelt Campus Birkenfeld lead a discussion on measuring the energy consumption of distributed systems and extending the Blauer Engel award criteria to them. This was an interesting meeting where we discussed problems for automation with mobile applications as well as client-server testing. Joseph also introduced me to the Umwelt Campus researchers who measured the energy consumption of Okular; Emmanuel Charruau, who is working with the GCompris script; and Nicolas Fella, who is currently working with xdotool for his Master’s thesis on the energy consumption of software. Thank you for taking time to read this update. If anyone wants to follow-up on the ideas presented here regarding the pros and cons of different automation tools when implementing Standard Usage Scenarios, there is a GitLab issue at the BE4FOSS repository where we can discuss further. I am also available on KDE’s Matrix instance at drquark:kde.org. [Less]
Posted about 2 years ago by Nuno Pinheiro (pinheiro)
Yeah do you want to help us create O².Most of the design concepts are done, but my C++ QtStyle foomagic is lower than zero ;) so muhhhh heee... do you want to help?Janet extraordinaire yesterday helped a bit and adjusted the old Oxygen painting to do ... [More] a preliminary implementation of the noise O² needs for its background, but that is only the very beginning of what is needed.Also if you have experience in kirigami/plasma, styling.Designers are welcome as well...  If you do......Just made this https://t.me/OxygenSquared for chatty chatty things. [Less]
Posted about 2 years ago by KDAB on Qt
At KDAB, we have been investigating how to integrate Rust with Qt in a safe and idiomatic way. The solution we are currently working on is called CXX-Qt. It’s available in the GitHub and on crates.io. This blog post discusses the journey of CXX-Qt — ... [More] where it started, where it can be used right now, and the future direction of the project. If you would like to get started with code examples, visit our Rust book. Why Rust? Over the past few years, Rust has been gaining popularity in various sectors, from embedded devices to scalable web services. It brings the promise of performance, reliability, and productivity to every sector into which it has been introduced. In addition, Rust is useful from a security perspective due to its memory safety. For instance, a substantial amount of security issues in large-scale C or C++ projects tends to be memory-related. By using Rust, we reduce these kinds of issues while maintaining a level of performance that is on-par with other native languages, like C or C++, and far faster compared to most other memory-safe languages. Where Would Rust Be Useful with Qt? Typical Qt QML applications are composed of multiple parts: C++ plugins that provide models and represent the business logic QML, which defines the layout and components of the GUI JavaScript, for scripting in QML Rust has a rich ecosystem of libraries for (de)serialization, async futures, parsing unsafe inputs, threading, etc. The ability to integrate these Rust libraries into your Qt application makes a compelling story. Therefore, enhancing your C++ plugins and business logic is the most suitable use case for Rust. Due to QML’s fast iteration speed and flexibility, we recommend sticking with it for the layout and components of the GUI. Existing Solutions There are many techniques for combining Rust with Qt, each utilizing different ways to bind between Rust and Qt. We found that most solutions tend to have one or more of these problems: Direct bindings that are not idiomatic to Rust and only provide direct access to the C++ API Calls between C++ and Rust that are unsafe They don’t make use of Rust’s strong multi-threading guarantees or features They don’t have a license that suits the Rust ecosystem The attempt to use Rust for the whole application rather than just a plugin No code generation; developers need to manually define the bindings Our Solution Rather than simply providing bindings for the existing C++ API, CXX-Qt makes use of Qt’s strong object orientation and meta object system. The library allows you to define new QObject subclasses in Rust as a module. These can then be instantiated like any other QObject in QML, or even C++, if needed. Every QObject defined by CXX-Qt is made up of two parts: A C++-based QObject instance that stores and exposes properties and invokable methods A Rust struct that implements any invokables, manages internal state, and handles change requests from properties or background threads CXX-Qt then uses a library called CXX to communicate between Rust and C++. CXX is also being explored by large companies, such as Google, with autocxx. In comparison to normal bindings, CXX creates a bridge between Rust and C++ that is based on a safe subset of the two languages. By using procedural macros, we hide the details of the CXX bridge from you as a developer. We also provide a library of common Qt types that can cross the C++ <-> Rust bridge safely. We furthermore provide mechanisms for Rust background threads to notify and safely update the Qt state on the Qt thread. All of this results in very idiomatic and safe Rust code that can seamlessly interact with existing Qt/C++ and Rust code. The disadvantage of this approach is that we do not provide one-to-one bindings. Therefore, CXX-Qt needs to expose and implement every feature across the bridge. However, as the main focus of our solution is moving a C++ module to Rust, we believe that, for a majority of cases, we will be providing either a QObject or a model to QML and then exposing properties, invokables, and signals on these objects. Current State and Future Direction CXX-Qt is not production-ready or stable and is still a work-in-progress. We welcome any feedback on the direction of the project and features and/or any suggestions you may have. Currently, the existing code is able to perform the following tasks: Define properties and invokables, exposing them onto a QObject Use common Qt types Listen for property changes or handle update requests from background Rust threads In the future, we plan to add the following tasks/features: Other Qt base classes (such as QAbstractItemModel) Stabilize the API of macros and improve the API of Qt types Define and emit signals Expand the documentation to include tutorials and examples If you would like to contribute, the code is available at https://github.com/KDAB/cxx-qt and documentation can be found at https://kdab.github.io/cxx-qt/book. Please feel free to share any suggestions or questions in the blog comments or, if you prefer, send us an email at [email protected]. About KDAB If you like this article and want to read similar material, consider subscribing via our RSS feed. Subscribe to KDAB TV for similar informative short video content. KDAB provides market leading software consulting and development services and training in Qt, C++ and 3D/OpenGL. Contact us. The post CXX-Qt appeared first on KDAB. [Less]
Posted about 2 years ago by Sandro Knauß (hefee)
Since the last summary two month ago we have seen the 21.12.3 patch releases of Kontact, and more than 1200 changes by 35 contributors have been integrated. Around 20 people helped to process nearly 120 merge requests the last 2 months, reviewing and ... [More] finally merging over 80 of them. Calendaring The new notification-based reminder service can now launch KOrganizer or Kalendar respectively to view or edit the corresponding event. The Notifications with geolocation data attached to your event or task will now open your default mapping application. The reminder service is planned to replace the previous dialog-based one for 22.04. The identity management library has been restructured to reduce the runtime dependencies of the reminder daemon as well as other background services. The public holidays list for several countries has been updated. Kalendar The Kalendar team released Kalendar 1.0, our last standalone release before moving to the KDE Gear release service. Slawek Kaplonski worked on some small usability improvements by making for example drag and drop possible for all-day events too and added some animation when using the 'Now' button. Claudi Cambra continued working on making Kalendar more stable by fixing a lot of bugs. He also made many subtle user interface improvements, for example, he added the calendar's color in a few more places in the user interface. Carl Schwan worked on making Kalendar also work with Right-To-Left languages like Arabic or Hebrew and added a progress indicator to the task list. You can find all the changes here. Kleopatra Joey Berkovitz made sure that keys stored on smart cards are fully usable with Kleopatra as soon as Kleopatra has first encountered the smart card. T5782, pim/kleopatra!11 Secret subkeys can now be exported without the secret primary key. This is useful if you want to share the encryption subkey of a shared email address. This is possible from the Details dialog of OpenPGP keys. Settings that are marked as read-only (via KDE's Kiosk support or via global GnuPG options) cannot be changed anymore in the configuration dialog. T5791 One can now easily retrieve all OpenPGP keys that another OpenPGP key was certified with. Additionally, it's now possible to configure Kleopatra to retrieve all certification keys of newly imported keys automatically. T5805 One can now trigger a restart of the background processes (gpg-agent, dirmngr, scdaemon, etc.), e.g. after one has changed their configuration. T5775 Usability and accessibility of Kleopatra's main view, i.e. the certificate list, T5841 and of the OpenPGP key generation T5832 was improved. This is part of the major goal to make Kleopatra fully accessible. T5824 KAlarm Allow calendars and date picker to be shown together in side panel #440250 Cancel sound file playback if audio alarm edit dialog is closed after clicking Try. Fix failure to create a missing calendar file after enabling a resource. Fix crash after Defer is selected in alarm notification message #448212 Fix deleted calendar resources reappearing when KAlarm restarts. Fix auto-close not working for message windows after the timeout period. KMail Laurent Montel finished a new kmail plugin “Open Url With”, that allows to launch specific apps for a specific URL. For example RocketChat can send a notification email when an user wants to speak to you (when ruqola/rocketchat client is down). Now you can directly open ruqola and not firefox, when clicking the URL. Contacts The address formatting code in the KContacts framework has been rewritten and now covers significantly more countries, supports multiple formatting styles (single- or multi-line, domestic or international, postal mail) and scripts other than Latin. This is expected in KF 5.92 and will then subsequently be used in applications. frameworks/kcontacts/!34. Itinerary Itinerary receiving new features, such as manually added train and bus trips or new additional information displayed in the timeline. It can now display the currency conversion rates for your trips. When you use Plasma 5.24 you can now select the default application to open geo links. There is an own bi-monthly blog that you can check out here. One patch highlights Alexander Basov fixed bugs in AppArmor profile usage with Postgres database pim/akonadi!86 Oleg Solovyov fixed a Kontact crash when clicking New. (#424252) Jonathan Marten fixed the wrong identification of MS Word attachments as encrypted data. (#90002) Sandro Knauß fixed "X-Face can break cryptographic signatures" (#439958) Infrastructure A lot of work was put into building KDE PIM libraries and applications successfully with Qt6 and KDE Frameworks 6. Additionally, some libraries get new names for Qt6, like Grantlee is renamed to ktexttemplate. The new name expresses better what the library is used for. Inside kdepim repository names do not necessarily match to the Bugzilla projects/components. In the past the release team has not updated Bugzilla version information for those repositories. Together with the release team we helped to handle the connection repository <-> Bugzilla correctly to get a full list of versions for all Bugzilla products. sysadmin/release-tools!18 The benefits are that we now get more precise metadata on bug reports and users can see and select from the full list of released versions. Additionally we have correct links in Invent to Bugzilla. The technical details about Bugzilla information in the project API can be seen here. Help us make Kontact even better! Check out some of our open junior jobs! They are simple, mostly programming-focused tasks, but they don’t require any deep knowledge or understanding of Kontact, so anyone can work on them. Feel free to pick any task from the list. And/or get in touch with us by email, Matrix #kontact:kde.org or IRC #kontact:libera.chat! We’ll be happy to guide you and answer all your questions. Read more here… [Less]
Posted about 2 years ago by KDE PeerTube
KDE invites you to get your software project certified with Germany's top seal of approval for eco-friendly products: the Blauer Engel eco-label. Software may be immaterial, but it determines the energy consumption of hardware, and making software ... [More] resource efficient is crucial. The Information and Communications Technology (ICT) sector is reported to contribute as much C02 to the environment as the aviation industry -- and the numbers continue to rise. Sustainability, as reflected in the Blauer Engel criteria for software eco-certification, must be considered holistically: user autonomy and transparency, hallmarks of Free and Open-Source Software, are a part of that. In this light, sustainable software follows naturally from KDE's long-standing mission and guiding vision, as well as the talent and capabilities of its community members. Now we want the larger Free Software community to join us. You too can make digital sustainability and energy-efficient Free Software part of our future. Help us live up to our responsibility for this and future generations! Join us at KDE Eco. [Less]
Posted about 2 years ago by Kate
In the last few weeks we had time to nicely improve the general UI of our editor. Naturally, the overall structure of the main window stays the same, with a central splitter area and some tool views around. But if you take a look at the two ... [More] screenshots below that show the last release and the current master branch version, you will spot some differences that in my eyes improve on what we have in a nice way. Kate 21.12.x Kate 22.04 (current master branch state) What are the main differences? URL bar Above the view, you now have some URL bar that allows for easy switching between different files that are close to each other in the file system. Compared to the initial post about this feature, now with LSP working, this even includes symbols for the current file as can be seen below. Naturally, as this is the first version, there is still room for improvements to this UI element. Unified bottom row for tool views and status bar Unlike in 21.12, where you had the status bar of the view inside the central area, it is now combined with the tool view button area at the bottom of your windows. This ensures the status bar is always at the bottom even if you have some tool view open. To ensure maximal space is available, this bottom row now spans the full window width. We tried to minimize the size of the individual elements, too. The tool view titles got shortened and the status bar content got left aligned to have some better visual separation. More to come? This for sure are not the only changes coming for the next 22.04 release. The monthly statistics for merge requests show that we have a good stream of stuff coming in. February 2022 (89 requests) January 2022 (66 requests) Naturally not all stuff is a new feature, but there are nice bug fixes, too. We got even some work done on the macOS platform, nice to see that people start to care about that, too! Thanks to everybody who contributes, each contribution is valuable! I hope more people step up and join. As can be seen in the merge requests, not each change is a big endeavor, but it can make a big difference for our users! Comments? A matching thread for this can be found here on r/KDE. [Less]
Posted about 2 years ago by Dimitris Kardarakos (dkardarakos)
Linux applications with QML and Python? Why not? Python is a popular programming language. QML offers an intuitive way to create user interfaces. Kirigami provides useful UI components and implements UI/UX patterns for mobile and desktop. Let’s fit ... [More] these technologies together and create a simple application. Prerequisites Obviously, we need Python. Most Linux distributions provide a recent Python. In the rare case that you have to install it by yourself, you may find here some tips. For QML and Kirigami, check the Kirigami introduction guide. Between Python and QML there is Qt for Python. It offers Python bindings for Qt, and it consists of: PySide2, so that you can use Qt5 APIs in Python Shiboken2, a binding generator tool which exposes C++ to Python On Ubuntu and the like, python3-pyside2.qtcore, python3-pyside2.qtqml and python3-pyside2.qtwidgets are enough for the code of this article. Different distributions may package or name the various bindings differently. E.g., on postmarketOS, everything we need is found in the py3-pyside2 package. Development Let’s create a simple program to see these technologies in action: a markdown viewer. The UI will be created in QML and the logic in Python. Users will write some markdown text, press a button, and the formatted text will be shown. Nothing fancy. It is recommended to use a virtual environment. The venv module provides support for virtual environments with their own site directories, optionally isolated from system site directories. On Ubuntu flavors and derivatives, it is provided by the python3.8-venv package. Create a directory and a virtual environment for the project: mkdir simple-md-viewer-project cd simple-md-viewer-project python3 -m venv --system-site-packages env/ Activate it using the activate script: source env/bin/activate We can verify that we are working in a virtual environment by checking the VIRTUAL_ENV environment variable. It’s time to write some code. A PySide2/QML application consists, at least, of two files: a file with the QML description of the user interface, and a Python file that loads the QML file. Create a new simplemdviewer directory into simple-md-viewer-project, and add a new simplemdviewer_app.py file in this directory: import os from PySide2.QtGui import QGuiApplication from PySide2.QtCore import QUrl from PySide2.QtQml import QQmlApplicationEngine, qmlRegisterType def main(): """Initializes and manages the application execution""" app = QGuiApplication() engine = QQmlApplicationEngine() base_path = os.path.abspath(os.path.dirname(__file__)) url = QUrl(f'file://{base_path}/qml/main.qml') engine.load(url) if len(engine.rootObjects()) == 0: quit() app.exec_() if __name__ == "__main__": main() simplemdviewer_app.py We have just created a QGuiApplication object that, among others, initializes the application and contains the main event loop. The QQmlApplicationEngine object loads the QML main.qml file. Create a new qml directory in the simplemdviewer one and add a new main.qml file that specifies the UI of the application: import QtQuick 2.12 import QtQuick.Controls 2.12 as Controls import org.kde.kirigami 2.12 as Kirigami import QtQuick.Layouts 1.12 Kirigami.ApplicationWindow { id: root title: qsTr("Simple markdown viewer") minimumWidth: Kirigami.Units.gridUnit * 20 minimumHeight: Kirigami.Units.gridUnit * 20 pageStack.initialPage: initPage Component { id: initPage Kirigami.Page { title: qsTr("Markdown Viewer") ColumnLayout { anchors { top: parent.top left: parent.left right: parent.right } Controls.TextArea { id: sourceArea placeholderText: qsTr("Write here some markdown code") wrapMode: Text.WrapAnywhere Layout.fillWidth: true Layout.minimumHeight: Kirigami.Units.gridUnit * 5 } RowLayout { Layout.fillWidth: true Controls.Button { text: qsTr("Format") onClicked: formattedText.text = sourceArea.text } Controls.Button { text: qsTr("Clear") onClicked: { sourceArea.text = "" formattedText.text = "" } } } Text { id: formattedText textFormat: Text.RichText wrapMode: Text.WordWrap text: sourceArea.text Layout.fillWidth: true Layout.minimumHeight: Kirigami.Units.gridUnit * 5 } } } } } main.qml We have just created a new QML-Kirigami-Python application. Cool. Run it: python3 simplemdviewer_app.py It shows a page split into two sections. On the top one you write some markdown code. Upon clicking on Format, the formated text will be displayed on the bottom of the page. A simple Python QML application At the moment we have not used any Python interesting stuff. In reality, the application can also run as a standalone QML one: qmlscene qml/main.qml It does not format anything; if we click on Format it just spits the unformatted text into a text element. Nothing special OK, let’s add some Python logic: a simple markdown converter in a Python, QObject derivative class. Create a new md_converter.py file in the simplemdviewer directory: from markdown import markdown from PySide2.QtCore import QObject, Signal, Slot, Property class MdConverter(QObject): """A simple markdown converter""" def __init__(self): QObject.__init__(self) self._source_text = '' def readSourceText(self): return self._source_text def setSourceText(self, val): self._source_text = val self.sourceTextChanged.emit() @Signal def sourceTextChanged(self): pass @Slot(result=str) def mdFormat(self): return markdown(self._source_text) sourceText = Property(str, readSourceText, setSourceText, notify=sourceTextChanged) md_converter.py The MdConverter class contains the source_text member variable. The sourceText property exposes source_text to the QML system through the readSouceText getter and the setSourceText setter functions. When setting the sourceText, the sourceTextChanged signal is emitted to let QML know that the property has changed. The mdFormat function returns the markdown formatted text and it has been declared as Slot so as to be invokable by the QML code. The markdown Python package takes care of formatting. Let’s install it in our virtual environment. Execute: pip install markdown It is time to register the new MdConverter type. Update the simplemdviewer_app.py file to: import os from PySide2.QtGui import QGuiApplication from PySide2.QtCore import QUrl from PySide2.QtQml import QQmlApplicationEngine, qmlRegisterType from md_converter import MdConverter def main(): """Initializes and manages the application execution""" app = QGuiApplication() engine = QQmlApplicationEngine() qmlRegisterType(MdConverter, 'org.mydomain.simplemdviewer', 1, 0, 'MdConverter') base_path = os.path.abspath(os.path.dirname(__file__)) url = QUrl(f'file://{base_path}/qml/main.qml') engine.load(url) if len(engine.rootObjects()) == 0: quit() app.exec_() if __name__ == "__main__": main() simplemdviewer_app.py The qmlRegisterType function has registered the MdCoverter type in the QML system, in the library org.mydomain.simplemdviewer, version 1.0. Change the qml/main.qml file to: import QtQuick 2.12 import QtQuick.Controls 2.12 as Controls import org.kde.kirigami 2.12 as Kirigami import QtQuick.Layouts 1.12 import org.mydomain.simplemdviewer 1.0 Kirigami.ApplicationWindow { id: root title: qsTr("Simple markdown viewer") minimumWidth: Kirigami.Units.gridUnit * 20 minimumHeight: Kirigami.Units.gridUnit * 20 pageStack.initialPage: initPage Component { id: initPage Kirigami.Page { title: qsTr("Markdown Viewer") MdConverter { id: mdconverter sourceText: sourceArea.text } ColumnLayout { anchors { top: parent.top left: parent.left right: parent.right } Controls.TextArea { id: sourceArea placeholderText: qsTr("Write here some markdown code") wrapMode: Text.WrapAnywhere Layout.fillWidth: true Layout.minimumHeight: Kirigami.Units.gridUnit * 5 } RowLayout { Layout.fillWidth: true Controls.Button { text: qsTr("Format") onClicked: formattedText.text = mdconverter.mdFormat() } Controls.Button { text: qsTr("Clear") onClicked: { sourceArea.text = "" formattedText.text = "" } } } Text { id: formattedText textFormat: Text.RichText wrapMode: Text.WordWrap Layout.fillWidth: true Layout.minimumHeight: Kirigami.Units.gridUnit * 5 } } } } } main.qml The updated QML code: imports the org.mydomain.simplemdviewer library creates an MdConverter object updates the onClicked signal handler of the Format button to call the mdFormat function of the converter object Change directory to simplemdviewer and execute: python3 simplemdviewer_app.py Play with adding some markdown text: Simple Markdown viewer in action Hooray. Package the application To distribute the application to the users we have to package it. We are going to use the setuptools library. Create an empty __init__.py file in the simplemdviewer directory. This file is required to import a directory as a package. The project structure should look like this: simple-md-viewer-project/ ├── env └── simplemdviewer ├── __init__.py ├── md_converter.py ├── qml │   └── main.qml └── simplemdviewer_app.py Create a pyproject.toml file in the simple-md-viewer-project directory, to tell build tools what is needed to build our project: [build-system] requires = ["setuptools", "wheel"] build-backend = "setuptools.build_meta" pyproject.toml Time to add the configuration file for setuptools. Create a setup.py into the simple-md-viewer-project directory: from setuptools import setup setup() setup.py Add a new setup.cfg file into the simple-md-viewer-project directory: [metadata] name = org.mydomain.simplemdviewer version = 0.1 url = https://mydomain.org/simplemdviewer author= Example Author author_email = [email protected] maintainer = Example Author maintainer_email = [email protected] description = A simple markdown viewer long_description = file: README.md long_description_content_type = text/markdown classifiers = Development Status :: 5 - Production/Stable License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+) Intended Audience :: End Users/Desktop Topic :: Utilities Programming Language :: Python Operating System :: POSIX :: Linux keywords= viewer converter markdown [options] packages = simplemdviewer include_package_data = True install_requires = requests importlib; python_version >= "3.8" markdown setup.cfg In the metadata section we have provided information about the application. The options section contains the project dependencies and the import package that our distribution package is going to provide. There is a lot of options and classifiers available. For more details on dependencies management in setuptools, check here. It is good to have a README.md file as well. Create a README.md file in the simple-md-viewer-project directory: # Simple Markdown Viewer A simple markdown viewer created with Kirigami, QML and Python README.md Another important piece is the license of our project. Create a LICENCE.txt file and add the text of the license of our project. Apart from the Python stuff, we have to add the QML code to the distribution package as well. Create a MANIFEST.in file in the simple-md-viewer-project directory, and add: include simplemdviewer/qml/*.qml MANIFEST.in Some last pieces and we are ready to build. We are going to add: the appstream metadata to be used by the software centers a desktop entry file to add the application to the application launcher an application icon Create a new org.mydomain.simplemdviewer.desktop file into the simple-md-viewer-project directory: [Desktop Entry] Version=0.1 Type=Application Name=Simple Markdown Viewer Name[x-test]=xxSimple Markdown Viewerxx GenericName=Markdown Viewer GenericName[x-test]=xxMarkdown Viewerxx Comment=A simple markdown viewer application Comment[x-test]=xxA simple markdown viewer applicationxx Exec=simplemdviewer Icon=org.mydomain.simplemdviewer Terminal=false Categories=Office; X-KDE-FormFactor=desktop;tablet;handset; org.mydomain.simplemdviewer.desktop Add a new org.mydomain.simplemdviewer.metainfo.xml file into the simple-md-viewer-project directory: org.mydomain.simplemdviewer CC0-1.0 GPL-3.0+ Simple Markdown Viewer A simple markdown viewer application Simple Markdown Viewer is a showcase application for QML with Python development https://mydomain.org/simplemdviewer First release simplemdviewer org.mydomain.simplemdviewer.metainfo.xml For our tutorial the well known markdown icon is OK. Get the markdown icon and save it as org.mydomain.simplemdviewer.svg into the simple-md-viewer-project directory. Now we have to let setup.cfg know about the new files. Let’s also provide an easy way to open the application from the console by just typing simplemdviewer. Update the setup.cfg to: [metadata] name = org.mydomain.simplemdviewer version = 0.1 url = https://mydomain.org/simplemdviewer author= Example Author author_email = [email protected] maintainer = Example Author maintainer_email = [email protected] description = A simple markdown viewer long_description = file: README.md long_description_content_type = text/markdown classifiers = Development Status :: 5 - Production/Stable License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+) Intended Audience :: End Users/Desktop Topic :: Utilities Programming Language :: Python Operating System :: POSIX :: Linux keywords= viewer converter markdown [options] packages = simplemdviewer include_package_data = True install_requires = requests importlib; python_version >= "3.8" markdown [options.data_files] share/applications = org.mydomain.simplemdviewer.desktop share/icons/hicolor/scalable/apps = org.mydomain.simplemdviewer.svg share/metainfo = org.mydomain.simplemdviewer.metainfo.xml [options.entry_points] console_scripts = simplemdviewer = simplemdviewer.simplemdviewer_app:main setup.cfg (updated) Last step is to tinker with the way we import modules. Update the simplemdviewer_app.py file to: import os from PySide2.QtGui import QGuiApplication from PySide2.QtCore import QUrl from PySide2.QtQml import QQmlApplicationEngine, qmlRegisterType from simplemdviewer.md_converter import MdConverter def main(): """Initializes and manages the application execution""" app = QGuiApplication() engine = QQmlApplicationEngine() qmlRegisterType(MdConverter, 'org.mydomain.simplemdviewer', 1, 0, 'MdConverter') base_path = os.path.abspath(os.path.dirname(__file__)) url = QUrl(f'file://{base_path}/qml/main.qml') engine.load(url) if len(engine.rootObjects()) == 0: quit() app.exec_() if __name__ == "__main__": main() simplemdviewer_app.py (updated) Create a __main__.py file into the simplemdviewer directory: from . import simplemdviewer_app simplemdviewer_app.main() This last step will facilitate the excecution of the package during development. Execute from inside the simple-md-viewer-project a last check before packaging: python3 -m simplemdviewer It’s time to generate the distribution package for our import package. Make sure that the latest version of build is installed: python3 -m pip install --upgrade build Execute from inside the simple-md-viewer-project directory: python3 -m build As soon as the build completes, two archives will be created in the dist directory: the org.mydomain.simplemdviewer-0.1.tar.gz source archive the org.mydomain.simplemdviewer-0.1-py3-none-any.whl built distribution package Install the package into the virtual environment: python3 -m pip install dist/org.mydomain.simplemdviewer-0.1.tar.gz Run: simplemdviewer At this point we can tag and release the source code. The Linux distributions will package it and the application will be added to their software repositories. Well done. We can also take care of distributing it. Although the PyPI is probably the standard way to distribute a Python package, I believe that Flatpak is more compatible with the Linux applications ecoystem. Create an org.mydomain.simplemdviewer.json file in the simple-md-viewer-project directory: { "id": "org.mydomain.simplemdviewer", "runtime": "org.kde.Platform", "runtime-version": "5.15", "sdk": "org.kde.Sdk", "command": "simplemdviewer", "finish-args": [ "--share=ipc", "--socket=fallback-x11", "--socket=wayland", "--device=dri", "--socket=pulseaudio" ], "modules": [ "python3-markdown.json", { "name": "PySide2", "buildsystem": "cmake-ninja", "builddir": true, "config-opts": [ "-DCMAKE_BUILD_TYPE=Release", "-DBUILD_TESTS=OFF" ], "sources": [ { "type": "archive", "url": "https://download.qt.io/official_releases/QtForPython/pyside2/PySide2-5.15.2-src/pyside-setup-opensource-src-5.15.2.tar.xz", "sha256": "b306504b0b8037079a8eab772ee774b9e877a2d84bab2dbefbe4fa6f83941418" }, { "type": "shell", "commands": [ "mkdir -p /app/include/qt5tmp && cp -R /usr/include/Qt* /app/include/qt5tmp # https://bugreports.qt.io/broswse/PYSIDE-787", "sed -i 's|--include-paths=|--include-paths=/app/include/qt5tmp:|' sources/pyside2/cmake/Macros/PySideModules.cmake" ] } ] }, { "name": "simplemdviewer", "buildsystem" : "simple", "build-commands" : [ "python3 setup.py build", "python3 setup.py install --prefix=/app --root=/" ], "sources": [ { "type": "archive", "path": "dist/org.mydomain.simplemdviewer-0.1.tar.gz" } ] } ] } org.mydomain.simplemdviewer.json This file reads that we use the markdown module and the build info is provided by the python3-markdown.json manifest file. We are going to create this manifest using flatpak-pip-generator. Get the flatpak-pip-generator, save it into the env/bin/ directory, and run: python3 env/bin/flatpak-pip-generator markdown Install org.kde.Sdk and org.kde.Platform, version 5.15, from flathub: flatpak install org.kde.Platform/x86_64/5.15 org.kde.Sdk/x86_64/5.15 Install the flatpak-builder package using the package manager of your distribution and run: flatpak-builder --verbose --force-clean flatpak-build-dir org.mydomain.simplemdviewer.json Test the flatpak build: flatpak-builder --env=QT_QPA_PLATFORM=wayland --run flatpak-build-dir org.mydomain.simplemdviewer.json simplemdviewer Build the flatpak bundle: flatpak-builder --install-deps-from=flathub flatpak-build-dir --repo=simplemdviewer-master --force-clean --ccache org.mydomain.simplemdviewer.json flatpak build-bundle simplemdviewer-master simplemdviewer.flatpak org.mydomain.simplemdviewer Now we can either distribute simplemdviewer.flatpak directly to the users, or submit the application to a flatpak repository, e.g., on flathub. Great. I suggest that you also consider: Signing the source archive with a detached signature Providing copyright and licensing information for each file with reuse The code of the article can be found here. If you have found this article interesting, share it with your friends on your favorite social platform. I hope this platform is Mastodon. Happy hacking. [Less]
Posted about 2 years ago by Nate Graham
Well, I know I said Plasma 5.24 was a smooth release, and it mostly has been! But nonetheless all of you have found various bugs afflicting your varied and diverse use cases, and we’ve been working hard to fix them this week. Some very important ... [More] multi-monitor fixes and long-term improvements also landed which should be welcome for people with often-docked laptops. 15-Minute Bugs Resolved Current number of bugs: 80, down from 83. Current list of bugs You will no longer see an unnecessary “Connection Activated” notification right after you log in (me: Nate Graham, Plasma 5.24.2) Mappings of desktops and panels in multi-screen setups should now be much more robust since invalid screen entries won’t be added to it under certain circumstances anymore (Plasma 5.24.3, Marco Martin) Fixed one of the most common cases of Plasma crashing on launch in the Plasma Wayland session when you have a multi-monitor setup (Marco Martin, Plasma 5.25) New Features Skanpage now lets you share scanned documents (including multi-page PDFs) using the standard KDE sharing system (Alexander Stippich, Skanpage 22.04). If you haven’t checked out Skanpage yet, give it a whirl. It’s really nice! You can now change your user avatar to be a plain abstract “user” icon in front of a colored background of your choice (Jan Blackquill, Plasma 5.25): Added a bunch of new web search queries (Thiago Sueto, Frameworks 5.92). If you don’t know about KRunner’s web search capabilities, you can learn about it here! Bugfixes & Performance Improvements Using Ark to extract Zip archives with empty folders no longer causes those folders to have their “last accessed” dates set to sometime in the future (Albert Astals Cid, Ark 21.12.3) Ark can now successfully create multi-part 7zip archives whose individual parts are each under 1Mb (Max Brazhnikov, Ark 21.12.3) Kate once again always jumps to the previously-open tab when the current tab is closed (Waqar Ahmed, Kate 22.04) Dolphin’s main view now handles right-to-left languages properly (Jan Blackquill, Dolphin 22.04) Fixed a visual glitch in Dolphin’s main view that could be triggered by zooming (Eugene Popov, Dolphin 22.04) In the Plasma Wayland session, fixed one of the ways that KWin could crash when you enable a disabled external monitor (Xaver Hugl, Plasma 5.24.2) System Settings no longer sometimes crashes when you change a monitor’s refresh rate (Marek Beleščiak, Plasma 5.24.2) Fixed one of the ways that Plasma could crash when undocking a docked laptop (Aleix Pol Gonzalez, Plasma 5.24.2) Fixed another way your panel could disappear when screens are added, removed, or wake up from sleep (Marco Martin, Plasma 5.24.2) Deleting a non-active user in System Settings’ Users page no longer causes the UI to break (Nicolas Fella, Plasma 5.24.2) When using Panel Spacer applets to center another applet on a panel, it no longer flickers and wobbles around when one of the applets on the other side of either of the spacers changes in size (Martin Seher, Plasma 5.24.2) The Virtual Desktop Pager applet no longer lets app icons visually overflow the space they are contained within when used on a short panel, and now shows window outlines correctly when you’re using Qt scaling on X11 (Fushan Wen, Plasma 5.24.2) Fixed a big recent regression in multi-monitor+multi-GPU setups in the Plasma Wayland session (Xaver Hugl, Plasma 5.24.3) Right-clicking on a System Tray app icon no longer causes the right-clicked app to get activated when left-clicking other Task Manager items (Ismael Asensio, Plasma 5.24.3) You can once again apply changes to System Settings’ Touchpad page (Fabian Vogt, Plasma 5.24.3) The plasma_session process no longer leaks a bunch of memory (David Edmundson, Plasma 5.24.3) Adjusting the backlight of your screen now always works when using certain types of multi-GPU systems (Xingang Li, Plasma 5.24.3) Discover no longer occasionally displays app or firmware text styling incorrectly (Tobias Fella, Plasma 5.24.3) File dialogs are now faster to open when their initial view is a network location (Kai Uwe Broulik, Plasma 5.24.3) System Settings’ Firewall page no longer always tells you that the default policy is “Allow” regardless of what the system’s actual default policy is (Lucas Biaggi, Plasma 5.25) In the Plasma Wayland session, launching DBus-activatable GTK3 apps now works (Nicolas Fella, Frameworks 5.92) User Interface Improvements Elisa’s playlist has been mostly rewritten to use standard Kirigami components which fixes multiple bugs such as touch scrolling being broken and rearranging playlist songs being unreliable, halves the number of lines of code, simplifies the implementation, and improves the presentation (Tranter Madi, Elisa 22.04): Kate’s quick search bar (invoked with Ctrl+F) no longer replaces the status bar while it’s visible (Waqar Ahmed, Kate 22.04) Added tooltips and exhaustive expanded help text to Gwenview’s “Fit” and “Show Thumbnails” buttons (Felix Ernst, Gwenview 22.04) Your name no longer gets elided on the login screen when it’s more than about 11 characters long and there is more than one user account on the system (me: Nate Graham, Plasma 5.24.3) When you’re using offline updates, and an offline update has failed to complete, and Discover shows you a notification with the option to “Repair System”, clicking on that button now provides you some feedback about what it’s doing, and also tells you when the repair operation succeeds or fails ( Aleix Pol Gonzalez, Plasma 5.25) Discover now shows a message in the app when you are running an old unsupported version of your distro, and bugs you to upgrade (Aleix Pol Gonzalez, Plasma 5.25) Breeze-themed tab bars now have better contrast with dark color schemes (Jan Blackquill, Plasma 5.25): Kirigami FormLayout section headers are now bold, to make them visually stand out from the content in their sections (me: Nate Graham, Frameworks 5.92): …And everything else This blog only covers the tip of the iceberg! Tons of KDE apps whose development I don’t have time to follow aren’t represented here, and I also don’t mention backend refactoring, improved test coverage, and other changes that are generally not user-facing. If you’re hungry for more, check out https://planet.kde.org, where you can find more news from other KDE contributors. How You Can Help Please consider donating to UNICEF or another reputable relief organization working to provide humanitarian aid right now in Ukraine, where several prominent KDE contributors live–not to mention 43 million other people who have suddenly found themselves in a warzone. When the world is on fire, always be a helper. If you’re a developer, check out our 15-Minute Bug Initiative. Working on these issues makes a big difference quickly! Otherwise, have a look at https://community.kde.org/Get_Involved to discover ways to be part of a project that really matters. Each contributor makes a huge difference in KDE; you are not a number or a cog in a machine! You don’t have to already be a programmer, either. I wasn’t when I got started. Try it, you’ll like it! We don’t bite! Finally, consider making a tax-deductible donation to the KDE e.V. foundation. [Less]
Posted about 2 years ago by Mellow Clamour | flyingcakes - planet-kde
Hey! This is my third post for SoK 2022. Let's go through what I've done since my last post, and what I plan to do next. Packaging I had already submitted a good number of packages to Flathub early on, because I had time, and didn't want my schedule ... [More] to become too packed all of a sudden later on. One month into Season of KDE, and almost every high priority and medium priority packages have been submitted. Most have been accepted to Flathub, while some are awaiting review. I'll list down the submissions accepted after my last post. New packages on Flathub Ikona Flathub listing : https://flathub.org/apps/details/org.kde.Ikona Repo : https://github.com/flathub/org.kde.Ikona Pull request : https://github.com/flathub/flathub/pull/2829 KUIViewer Flathub listing : https://flathub.org/apps/details/org.kde.kuiviewer Repo : https://github.com/flathub/org.kde.kuiviewer Pull request : https://github.com/flathub/flathub/pull/2838 KRDC Flathub listing : https://flathub.org/apps/details/org.kde.krdc Repo : https://github.com/flathub/org.kde.krdc Pull request : https://github.com/flathub/flathub/pull/2859 Updates to existing packages Update Akregator to 21.12.2 : https://github.com/flathub/org.kde.akregator/pull/1 Minor updates to KRename : https://github.com/flathub/org.kde.krename/pull/1 Upstream appdata patches Skanlite : https://invent.kde.org/graphics/skanlite/-/merge_requests/29 Heaptrack : https://invent.kde.org/sdk/heaptrack/-/merge_requests/10 KWave : https://invent.kde.org/multimedia/kwave/-/merge_requests/8 Ikona : https://invent.kde.org/sdk/ikona/-/merge_requests/8 Pending submissions There are 5 packages currently under review. Skanlite seems to be in limbo for now, since I don't have a scanner to test it. Arranging for one is possible, but it won't be a long term solution if I am to maintain the package. Zanshin has issues with the migrator, which blocks starting the application. I've put it on the back-burner for the time being. Nota is mostly done. It uses a custom implementation for file picker, which means it can not use portal. We could have it as a beta package for now. I might look into patching the source code to use Qt file picker so that Nota can utilize portals. This again is a task for later. Kwave needs a minor fix to make one of its dependencies play well with aarch64. Otherwise, it is done. Heaptrack needs to be updated with extra permissions. I'll get this done soon. Rest of the packages Kile isn't detecting Texlive during runtime, which has become a mystery movie now. I'm hopeful to fix it pretty soon. KAlarm relies on KAuth for certain features, which cannot be run inside Flatpak environment. While I could come up with the relevant patches to CMake files, so as to not build KAuth, the application itself needs some patching to disable those features when running inside Flatpak environment. K3b has the same issues as KAlarm. Again, I have made the patches for build, but I'm yet to patch the source code to disable those features. I plan to work on KAlarm and K3b source code during the second week of March if we decide to make them a priority. With majority of the packaging work done, I should thank all the reviewers who vetted my submissions to Flathub, especially Hubert Figuière who has been helpful and patient even when I seem to do stupid mistakes :) Plans for the next milestone As I mentioned at the beginning, packaging work is almost sorted out, barring a couple of apps here and there. This leaves me with about a month and a half to work on other things I planned to. I am playing around with Flatpak External Data Checker, which can bring about some automation in the update process. I'm still in the "exploration phase" for this tool. While there are multiple ways I could use it for KDE Flatpak manifests, I want to take up the one that best suits the release process KDE has. Taking my leave for this post. I hope to publish more updates and improvements in my next one! [Less]