Python GUIs: PyQt6 Book: 파이썬과 Qt6로 GUI 애플리케이션 만들기

Planet Python - Thu, 2023-05-04 05:00

I am very happy to announce that my Python GUI programming book Create GUI Applications with Python & Qt6 / PyQt6 Edition is now available in Korean from Acorn Publishing

It's more than a little mind-blowing to see a book I've written translated into another language -- not least one I cannot remotely understand! When I started writing this book a few years ago I could never have imagined it would end up on book shelves in Korea, never mind in Korean. This is just fantastic.

파이썬과 Qt6로 GUI 애플리케이션 만들기 파이썬 애플리케이션 제작 실습 가이드

If you're in Korea, you can also pick up a copy at any of the following bookstores: Kyobobook, YES24 or Aladin

Thanks again to Acorn Publishing for translating my book and making it available to readers in Korea.

For more, see the complete PyQt6 tutorial.

Categories: FLOSS Project Planets

LN Webworks: Drupal Websites are Not Good in Terms of Design: The Common Myth

Planet Drupal - Thu, 2023-05-04 04:01

According to research, around 2 billion websites run on Drupal globally. Such a massive appeal has made Drupal the leading content management system (CMS) worldwide. It has captivated the hearts of eminent enterprises with its 42,650 modules and 2,900 themes. As a Drupal Web development company, you can leverage Drupal's top-notch security features to provide your clients with unparalleled cybersecurity. Over the years, the crucible of cutting-edge advancements has forged Drupal’s features to make it unmatchable. It doesn’t matter whether it is a basic website or a content-heavy website, Drupal is packed with capabilities to handle them all.

Categories: FLOSS Project Planets

SoK 2023 Selenium-ST-API KDE Eco Power Measurement Proof Of Concept: Achieving Three KDE Goals With One Stone!

Planet KDE - Wed, 2023-05-03 20:00
Why Use Selenium-AT-SPI

Last year, Okular, KDE's advanced document reader, became the first software product ever to receive the Blue Angel eco-label. This certification recognises Okular as having a sustainable software design.

The certification process involves measuring the power consumption of the software executing repetitive actions that simulate human use. For Okular's certification, this was done using scripts written in Actiona. At KDE Eco, we also tried to use the GUI tool Actiona to make these tests, but it was not flexible enough because it required adding a simple action to open a window, entering a click location, validating your input, and so on. This process was very tedious. We then developed a Python tool based on xdotool and called it KdeEcoTest, which was able to record any user action and translate it into text script. The advantage of using text-based scripts over creating GUI actions is that it is much quicker and you can easily copy/paste/modify any interesting part of the test. This is much more efficient time-wise, but it was not enough.

Figure : KdeEcoTest does not work if the software GUI elements locations are modified. (Image from Emmanuel Charruau published under a CC-BY-4.0 license.)

The main problem with this approach, which is based on the location of mouse clicks, is that if the software GUI changes (e.g., resizing GUI elements, changing screen resolution), the tool will click outside the elements to be tested, and then it does not work.

We needed a tool able to access the GUI element itself, and this is exactly the solution that Harald Sitter posted one day on KDE Planet.

What Is Selenium-AT-SPI

Selenium-AT-SPI is a modification of the Selenium webdriver. The Selenium webdriver is used to automate tests on browsers, accessing HTML elements using its ID or name. It is able to click on elements, enter text into input fields, and more. Selenium-AT-SPI does the same but for Qt programs, accessing the GUI element through its QML accessibility properties. The tested software interface can be modified, resized, and tested on different screen resolutions. As long as the GUI elements are still present, the test will still work.

Nitin's Work

Nitin Tejuja SoK's task was to use Selenium-AT-SPI, still a work in progress, to reproduce a minute-long script created with KdeEcoTest to test several activities of the educational software GCompris. His work was very efficient, as after a month Nitin was able to:

  • run Selenium-AT-SPI,
  • write an installation guide for Selenium-AT-SPI,
  • compile and run GCompris, and
  • modify GCompris QML code to have access to its components (GUI elements).

A few modifications to Selenium-AT-SPI allowed the last problems to be solved (adding slider access and handling UTF-8 character problems) and Selenium-AT-SPI is now able to emulate all the activities needed for the next Blue Angel eco-label.

Video: Replication of KdeEcoTest script for GCompris. (Video from Nitin Tejuja published under a CC-BY-SA-4.0 license.)

To help you quickly use Selenium-AT-SPI for your own project, Nitin is working on updating the KDE Eco Handbook with a full step-by-step Selenium-AT-SPI installation and usage guide, explaining how to add accessibility to QML and how to write a Selenium script in Python.

The handbook can be found here.

Once the handbook is updated you will be able to find the guide under "Part IV: Selenium-AT-SPI".

His journey through the SoK 2023 can be found in the following three blog posts:

Achieving Three KDE Goals

Before finishing, I would like to explain the title of this entry and why we "achieved three KDE goals with one stone!"

Selenium-AT-SPI is used here to automate actions in order to measure power consumption and improve it, helping to reach one of our goals: Sustainable Software.

It can be used as unit testing to check if all the accessibility code we add is working, which will help us reach another goal: KDE For All.

Finally, by being able to fully automate internal application testing, we can improve the quality of our applications and this contributes to our third goal: Automate And Systematize Internal Processes.

Categories: FLOSS Project Planets

Valhalla's Things: Linen Slippers

Planet Debian - Wed, 2023-05-03 20:00
Posted on May 4, 2023

I hate going out to buy shoes. Even more so I hate buying home shoes, which is what I spend most of my life in, also because no matter what I buy they seem to disintegrate after a season or so. So, obviously, I’ve been on a quest to make my own.

As a side note, going barefoot (with socks) would only move the wear issue to the socks, so it’s not really a solution, and going bare barefoot on ceramic floors is not going to happen, kaythanksbye.

For the winter I’m trying to make knit and felted slippers; I’ve had partial success, and they should be pretty easy to mend (I’ve just had to do the first mend, with darning and needle felting, and it seems to have worked nicely).

For the summer, I’ve been thinking of something sewn, and with the warm season approaching (and the winter slippers needing urgent repairs) I decided it was time to work on them.

I already had a shaped (left/right) pattern for a sole from my hiking sandals attempts (a topic for another post), so I started by drafting a front upper, and then I started to have espadrille feeling and decided that a heel guard was needed.

As for fabric, looking around in the most easily accessible part of the Stash I’ve found the nice heavyweight linen I’m using for my Augusta Stays, of which I still have a lot and which looked almost perfect except for one small detail: it’s very white.

I briefly thought about dyeing, but I wanted to start sewing NOW to test the pattern, so, yeah, maybe it will happen one day, or maybe I’ll have patchy dust-grey slippers. If I’ll ever have a place where I can do woad dyeing a blue pair will happen, however.

Contrary to the typical espadrillas I decided to have a full lining, and some padding between the lining and the sole, using cotton padding leftovers from my ironing board.

To add some structure I also decided to add a few rows of cording (and thus make the uppers in two layers of fabric), to help prevent everything from collapsing flat.

As for the sole, that’s something that is still causing me woes: I do have some rubber sole sheets (see “hiking sandals” above), but I suspect that they require glueing, which I’m not sure would work well with the natural fabric uppers and will probably make repairs harder to do.

In the past I tried to make some crocheted rope soles and they were a big failure: they felt really nice on the foot, but they also self-destroyed in a matter of weeks, which is not really the kind of sole I’m looking for.

Now I have some ~ 3 mm twine that feels much harsher on the hands while working it (and would probably feel harsher on the feet, but that’s what the lining and padding are for), so I hope it may be a bit more resistant, and I tried to make a braided rope sole.

Of course, I have published the pattern and instructions for the slippers as well as those for the braided rope sole as #FreeSoftWear.

Now what is left is trying everything under daily use, and I hope I will have updates on this at the end of the season, rather than soon :D

Categories: FLOSS Project Planets

The Drop Times: A Passionate Farmer Who Found Drupal by Chance | Interview with Shani Maurya | Midcamp23

Planet Drupal - Wed, 2023-05-03 12:57
TDT reached out to Shani Maurya to interview him on his journey with Drupal and to ask a few questions about his session and what he thinks about implementing Drupal Camps in India
Categories: FLOSS Project Planets

Real Python: Efficient String Concatenation in Python

Planet Python - Wed, 2023-05-03 10:00

String concatenation is a common operation in programming. It involves joining two or more strings to create a single new string. You’ll find several tools and techniques for concatenating strings in Python, each with its own pros and cons.

In this tutorial, you’ll go through the most common tools and techniques for concatenating strings. You’ll also code examples for each of them, which will help you choose the best option for your specific problems.

In this tutorial, you’ll:

  • Understand what string concatenation is and why it’s useful
  • Concatenate two strings using the concatenation operators, + and +=
  • Efficiently concatenate multiple strings using the .join() method
  • Explore alternative concatenation techniques like string literals, StringIO, and print()

To get the most out of this tutorial, you should have a basic understanding of Python, especially its built-in string data type.

Free Download: Click here to download your sample code to learn how to efficiently concatenate strings in Python.

Doing String Concatenation With Python’s Plus Operator (+)

String concatenation is a pretty common operation consisting of joining two or more strings together end to end to build a final string. Perhaps the quickest way to achieve concatenation is to take two separate strings and combine them with the plus operator (+), which is known as the concatenation operator in this context:

>>>>>> "Hello, " + "Pythonista!" 'Hello, Pythonista!' >>> head = "String Concatenation " >>> tail = "is Fun in Python!" >>> head + tail 'String Concatenation is Fun in Python!'

Using the concatenation operator to join two strings provides a quick solution for concatenating only a few strings.

For a more realistic example, say you have an output line that will print an informative message based on specific criteria. The beginning of the message might always be the same. However, the end of the message will vary depending on different criteria. In this situation, you can take advantage of the concatenation operator:

>>>>>> def age_group(age): ... if 0 <= age <= 9: ... result = "a Child!" ... elif 9 < age <= 18: ... result = "an Adolescent!" ... elif 19 < age <= 65: ... result = "an Adult!" ... else: ... result = "in your Golden Years!" ... print("You are " + result) ... >>> age_group(29) You are an Adult! >>> age_group(14) You are an Adolescent! >>> age_group(68) You are in your Golden Years!

In the above example, age_group() prints a final message constructed with a common prefix and the string resulting from the conditional statement. In this type of use case, the plus operator is your best option for quick string concatenation in Python.

The concatenation operator has an augmented version that provides a shortcut for concatenating two strings together. The augmented concatenation operator (+=) has the following syntax:

string += other_string

This expression will concatenate the content of string with the content of other_string. It’s equivalent to saying string = string + other_string.

Here’s a short example of how the augmented concatenation operator works in practice:

>>>>>> word = "Py" >>> word += "tho" >>> word += "nis" >>> word += "ta" >>> word 'Pythonista'

In this example, every augmented assignment adds a new syllable to the final word using the += operator. This concatenation technique can be useful when you have several strings in a list or any other iterable and want to concatenate them in a for loop:

>>>>>> def concatenate(iterable, sep=" "): ... sentence = iterable[0] ... for word in iterable[1:]: ... sentence += (sep + word) ... return sentence ... >>> concatenate(["Hello,", "World!", "I", "am", "a", "Pythonista!"]) 'Hello, World! I am a Pythonista!'

Inside the loop, you use the augmented concatenation operator to quickly concatenate several strings in a loop. Later you’ll learn about .join(), which is an even better way to concatenate a list of strings.

Python’s concatenation operators can only concatenate string objects. If you use them with a different data type, then you get a TypeError:

>>>>>> "The result is: " + 42 Traceback (most recent call last): ... TypeError: can only concatenate str (not "int") to str >>> "Your favorite fruits are: " + ["apple", "grape"] Traceback (most recent call last): ... TypeError: can only concatenate str (not "list") to str Read the full article at https://realpython.com/python-string-concatenation/ »

[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short & sweet Python Trick delivered to your inbox every couple of days. >> Click here to learn more and see examples ]

Categories: FLOSS Project Planets

Python for Beginners: Working With TOML Files in Python

Planet Python - Wed, 2023-05-03 09:00

We use different configuration file formats to store configuration data for our software systems. In this article, we will discuss how to work with TOML configuration files in Python.

Table of Contents
  1. What is The TOML File Format?
  2. Create a TOML Configuration File in Python
  3. Read a TOML File in Python
  4. Update a TOML file in Python
  5. Advantages of Using TOML File Format
  6. Conclusion
What is The TOML File Format?

TOML stands for Tom’s Obvious, Minimal Language. It is a file format used for storing configuration data. TOML file format is easy to read and parse by both humans and machines. It was designed to be a more readable alternative to other configuration file formats like JSON and XML.

TOML files are structured using key-value pairs. Here, keys are separated from their values by an equals sign, and each key-value pair is separated from the next by a new line. We use Tables to group related key-value pairs together, which are indicated by square brackets.

A sample TOML file will be as follows.

[employee] name = "John Doe" age = 35 [job] title = "Software Engineer" department = "IT" years_of_experience = 10 [address] street = "123 Main St." city = "San Francisco" state = "CA" zip = 94102

The above TOML file contains three tables: employee, job, and address. All the tables have several key-value pairs associated with them. 

  • The name key in the employee table has a value of "John Doe", and the age key has a value of 35. 
  • The job table has three keys: title, department, and years_of_experience, which respectively have the values "Software Engineer", "IT", and 10. 
  • The address table has four keys: street, city, state, and zip, which respectively have the values "123 Main St.", "San Francisco", "CA", and 94102.

Looking at the structure, you can observe that the TOML file format is somewhat similar to the INI file format. However, the naming conventions are different for the elements in the file.

Having discussed the basic structure of a TOML file, let us discuss how to create, read, and edit a toml file in Python. For this task, we will use the toml module. You can install the toml module by executing the following command in the command-line terminal.

pip install toml Create a TOML Configuration File in Python

To create a toml configuration file, we will use the dump() method defined in the toml module. The syntax for the dump() method is as follows.

toml.dump(python_obj, file_ptr,)

Here, python_obj is the Python object whose data we want to store in the configuration file. The parameter file_ptr takes a file pointer as its input argument. After execution, the dump() method writes the data to the file referred to by file_ptr.

To create a toml file in Python, we will use the following steps.

  • First, we will create an empty toml file. For this, we will open a file in write mode using the open() function. The open() function takes the filename as its first input argument and the Python literal “w” as its second input argument. After execution, it returns a file pointer.
  • Next, we will create a Python dictionary with all the data that we need to convert to the toml format. 
  • After creating the dictionary, we will use the dump() function to write the data to the toml file. For this, we will pass the dictionary as the first input argument and the file pointer as the second input argument to the dump() method.
  • Finally, we will close the toml file using the close() method.

After executing the above steps, we can easily create a toml configuration file in Python. You can observe this in the following example.

import toml file=open("employee.toml","w") data_dict={ "employee": { "name": "John Doe", "age": 35 }, "job": { "title": "Software Engineer", "department": "IT", "years_of_experience": 10 }, "address": { "street": "123 Main St.", "city": "San Francisco", "state": "CA", "zip": 94102 } } toml.dump(data_dict,file) file.close()

The output file looks as follows.

TOML File Output

Instead of creating a file, we can also create a toml string. For this, we will use the dumps() function defined in the toml module. The dumps() method takes the Python dictionary as its input argument and returns a toml string. You can observe this in the following example.

import toml data_dict={ "employee": { "name": "John Doe", "age": 35 }, "job": { "title": "Software Engineer", "department": "IT", "years_of_experience": 10 }, "address": { "street": "123 Main St.", "city": "San Francisco", "state": "CA", "zip": 94102 } } print("The data dictionary is:") print(data_dict) toml_string=toml.dumps(data_dict) print("The toml string is:") print(toml_string)


The data dictionary is: {'employee': {'name': 'John Doe', 'age': 35}, 'job': {'title': 'Software Engineer', 'department': 'IT', 'years_of_experience': 10}, 'address': {'street': '123 Main St.', 'city': 'San Francisco', 'state': 'CA', 'zip': 94102}} The toml string is: [employee] name = "John Doe" age = 35 [job] title = "Software Engineer" department = "IT" years_of_experience = 10 [address] street = "123 Main St." city = "San Francisco" state = "CA" zip = 94102 Read a TOML File in Python

To read a toml file in Python, we can use the load() method defined in the toml module. The load() method takes the file name of the toml file as its input argument and returns a Python dictionary containing the data from the file. You can observe this in the following example.

import toml data=toml.load("employee.toml") print("The data from toml file is:") print(data)


The data from toml file is: {'employee': {'name': 'John Doe', 'age': 35}, 'job': {'title': 'Software Engineer', 'department': 'IT', 'years_of_experience': 10}, 'address': {'street': '123 Main St.', 'city': 'San Francisco', 'state': 'CA', 'zip': 94102}}

Instead of a file, you can also read a toml string. For this, you can use the loads() method defined in the toml module. The loads() method takes the toml string as its input and returns a Python dictionary containing the data from the input string. You can observe this in the following example.

import toml toml_string="""[employee] name = "John Doe" age = 35 [job] title = "Software Engineer" department = "IT" years_of_experience = 10 [address] street = "123 Main St." city = "San Francisco" state = "CA" zip = 94102""" print("The toml string is:") print(toml_string) data=toml.loads(toml_string) print("The data from toml string is:") print(data)


The toml string is: [employee] name = "John Doe" age = 35 [job] title = "Software Engineer" department = "IT" years_of_experience = 10 [address] street = "123 Main St." city = "San Francisco" state = "CA" zip = 94102 The data from toml string is: {'employee': {'name': 'John Doe', 'age': 35}, 'job': {'title': 'Software Engineer', 'department': 'IT', 'years_of_experience': 10}, 'address': {'street': '123 Main St.', 'city': 'San Francisco', 'state': 'CA', 'zip': 94102}} Update a TOML file in Python

To add, update, or delete data from a toml configuration file, we can use the following steps.

  • First, we will read the configuration file into a Python dictionary using the load() method.
  • Then, we will modify the dictionary as per the requirements to add, update, or delete data from the configuration file.
  • Finally, we will write the dictionary back to the toml file using the dump() method.

By using the above steps, you can easily edit, update and delete data from a toml configuration file in Python.

Advantages of Using TOML File Format

There are many configuration file formats like yaml,xml, json, ini, and other file formats apart from the toml file format. Then, why should some use the toml file format? Following are some of the advantages of using the toml file format for storing configuration files.

  1. Easy to read and write: TOML files are designed to be easy for humans to read and write. It has a simple, intuitive, and unambiguous syntax. This makes it easy to create and edit configuration files without needing specialized tools or knowledge.
  2. Less error-prone: The TOML format is less error-prone than other formats because it enforces strict rules for key-value pairs, data types, and nesting. This reduces the risk of syntax errors, typos, and other mistakes that can cause problems in your code.
  3. More flexible: TOML supports a wider range of data types and structures than other formats, including arrays, tables, and inline tables. This makes it more flexible and adaptable to different use cases and scenarios.
  4. Cross-language compatibility: TOML has libraries and tools available for many programming languages, including Python, Ruby, Rust, and more. This makes it easy to work with TOML files across different platforms and programming languages.

In this article, we have discussed how to work with toml configuration files in Python. We discussed how to create, read, and update toml configuration files. We also discussed the advantages of toml file format over some other file formats. 

To learn more about Python programming, you can read this article on the Python finally keyword. You might also like this article on custom JSON encoders in Python.

I hope you enjoyed reading this article. Stay tuned for more informative articles. 

Happy Learning!

The post Working With TOML Files in Python appeared first on PythonForBeginners.com.

Categories: FLOSS Project Planets

Django Weblog: Django security releases issued: 4.2.1, 4.1.9, and 3.2.19

Planet Python - Wed, 2023-05-03 08:59

In accordance with our security release policy, the Django team is issuing Django 4.2.1, Django 4.1.9, and Django 3.2.19. These releases addresses the security issue detailed below. We encourage all users of Django to upgrade as soon as possible.

CVE-2023-31047: Potential bypass of validation when uploading multiple files using one form field

Uploading multiple files using one form field has never been supported by forms.FileField or forms.ImageField as only the last uploaded file was validated. Unfortunately, Uploading multiple files topic suggested otherwise.

In order to avoid the vulnerability, ClearableFileInput and FileInput` form widgets now raise ValueError when the multiple HTML attribute is set on them. To prevent the exception and keep the old behavior, set allow_multiple_selected to True.

For more details on using the new attribute and handling of multiple files through a single field, see Uploading multiple files.

Thanks Moataz Al-Sharida and nawaik for reports.

This issue has severity "low" according to the Django security policy.

Affected supported versions
  • Django main branch
  • Django 4.2
  • Django 4.1
  • Django 3.2

Patches to resolve the issue have been applied to Django's main branch and the 4.2, 4.1, and 3.2 release branches. The patches may be obtained from the following changesets:

The following releases have been issued:

The PGP key ID used for this release is Mariusz Felisiak: 2EF56372BA48CD1B.

General notes regarding security reporting

As always, we ask that potential security issues be reported via private email to security@djangoproject.com, and not via Django's Trac instance or the django-developers list. Please see our security policies for further information.

Categories: FLOSS Project Planets

John Goerzen: Martha the Pilot

Planet Debian - Wed, 2023-05-03 08:18

Martha, now 5, can’t remember a time when she didn’t fly periodically. She’s come along in our airplane in short flights to a nearby restaurant and long ones to Michigan and South Dakota. All this time, she’s been riding in the back seat next to Laura.

Martha has been talking excitedly about riding up front next to me. She wants to “be my co-pilot”. I promised to give her an airplane wing pin when she did — one I got from a pilot of a commercial flight when I was a kid. Of course, safety was first, so I wanted to be sure she was old enough to fly there without being a distraction.

Last weekend, the moment finally arrived. She was so excited! She brought along her “Claire bear” aviator, one that I bought for her at an airport a little while back. She buckled in two of her dolls in the back seat.

And then up we went!

Martha was so proud when we landed! We went to Stearman Field, just a short 10-minute flight away, and parked the plane right in front of the restaurant.

We flew back, and Martha thought we should get a photo of her standing on the wing by the door. Great idea!

She was happily jabbering about the flight all the way home. She told us several times about the pin she got, watching out the window, watching all the screens in the airplane, and also that she didn’t get sick at all despite some turbulence.

And, she says, “Now just you and I can go flying!”

Yes, that’s something I’m looking forward to!

Categories: FLOSS Project Planets

Lucas Cimon: Pylint strict base configuration

Planet Python - Wed, 2023-05-03 07:21

Pylint is a great static code analyser for Python code. I have been using it for several years, in various projects, and it's simple to use yet very powerful.

I even contributed to Pylint by submitting a new rule a few years ago : implicit-str-concat.

For an introduction to Pylint, you …

Categories: FLOSS Project Planets

KDE ISO Image Writer 1.0.0

Planet KDE - Wed, 2023-05-03 06:52

KDE ISO Image Writer 1.0.0 is out for users.

  • Adds udisks2 support
  • Packaged for Windows, AppImage, Snap and Flatpak

AppImage – x86_64

sha256: 2654d8cc8334d1e1db9a396679b606ca7073ae06d273d7e8a085d665d96f8b5e

Windows – win64

sha256: 467aefa7a893b323932c858c8bc6f3b6574c8d6f830e48e140d13941787393c6


sha256: a69022303ec1beb6b7b4f0d68e59e4199d3c9868767cb9eb23c6dd1999e06a5d

Categories: FLOSS Project Planets

LN Webworks: How AI is Shaping the Future of Content Management and the Web?

Planet Drupal - Wed, 2023-05-03 06:45

Artificial intelligence is a highly potent technology that has revolutionized the world. As AI continues to gain traction, it's only natural that content management systems (CMS) like Drupal will integrate with this technology. CMS like Drupal can leverage AI-powered tools to provide more personalized content. AI is serving as an empowering center for smart data-driven decision-making, automation, enhancing customer experience, minimizing human errors, and analyzing upcoming trends. If we look into the current state of affairs, artificial intelligence is slithering into the world of content management as well. Experts believe that the future of AI is that it will get so deeply embedded into content management that everything will be driven by it.

Categories: FLOSS Project Planets

ComputerMinds.co.uk: Removing invalid query string parameters passed to a view

Planet Drupal - Wed, 2023-05-03 05:52

As a Drupal site administrator, you may notice in the website logs that there might be a large number of repeated log messages along the lines of "An illegal choice has been detected. Please contact the site administrator." We recently had this problem on a Drupal site that was upgraded from Drupal 7 to Drupal 9 which featured a product search that was built using Views.

Due to slight differences in the way in which the view and facets were built in the Drupal 9 site, this resulted in slightly different URLs being used when the user would filter the search results. For a standard site user who would be interacting with the form elements to filter the view, this was not a problem. However, search engines that had indexed these older URLs from the Drupal 7 site were still trying to crawl the search page regularly, with (what are now) invalid query string parameters.

At the times when the search engines were crawling these pages, this would result in hundreds if not thousands of log messages being logged. Although not anything that would directly impact the users of the site, it’s not ideal to have so many log messages polluting the site logs. Having so many log messages makes it harder to track down and find actual more pressing issues that may need to be addressed.

It makes sense to try and eliminate the cause of this issue and stop so many error messages from being logged. This can be easily accomplished by the following snippet of code which uses hook_views_pre_build().

use Drupal\views\ViewExecutable; /** * Implements hook_views_pre_build(). */ function my_module_views_pre_build(ViewExecutable $view) { if ($view->id() === 'my_view_name') { /** @var \Symfony\Component\HttpFoundation\Request $request */ $request = $view->getRequest(); /** @var \Drupal\Core\Http\InputBag $query */ $query = $request->query; if ($sort_by = $query->get('sort_by')) { // Compare to the list of allowed values to see if it's valid. // If it's not, then remove the sort_by from the query completely. $view_sorts = $view->sort; if (!isset($view_sorts[$sort_by])) { $query->remove('sort_by'); } } } }


Let's quickly break down the code example above. For a custom module named my_module, we are implementing the hook_views_pre_build hook inside of the my_module.module file. We then check the view ID of our view to see if it’s the one we are trying to target and then get the HTTP request object from the view, checking the query string values of the request.

The query string value we are interested in (which was causing the error messages) is named sort_by. We get the list of allowed sort values from the view and then compare this to the value in the query string. If the value trying to be used isn’t a valid value for our view, we then unset this from the query.

Of course, if you were looking to target a particular display of the view and not all of them then you’d need to add some additional logic to check the current_display of the view. For example, change the line:

if ($view->id() === 'my_view_name') {  


if ($view->id() === 'my_view_name' && $view->current_display === 'page_1') {  

which will restrict the code block to only run for the page_1 display.



Categories: FLOSS Project Planets

New Video by Ramon Miranda:

Planet KDE - Wed, 2023-05-03 04:42

In this fifth video on creating brush presets in Krita, Ramon goes in depth with the masked brush feature!


The post New Video by Ramon Miranda: appeared first on Krita.

Categories: FLOSS Project Planets

LN Webworks: Free Drupal 9 Themes for Building Media and Publishing Websites

Planet Drupal - Wed, 2023-05-03 03:45

Did you know that eminent news and media networks such as Al Jazeera, The Economist, the Walt Disney Company, CBS, Time Inc., and Viacom rely on Drupal 9 to support their magnificent websites? The right Drupal 9 theme can help you create an engaging and functional media and publishing websites that stands out in a competitive landscape. If you also run a media and publishing company, this revelation might leave you startled. You may begin to ponder why the top players in the media industry are so invested in Drupal.

Categories: FLOSS Project Planets

Make Drupal Easy: The latest innovations in Drupal

Planet Drupal - Wed, 2023-05-03 02:39

Drupal is an open-source content management system that powers millions of websites around the world. It is known for its flexibility, scalability, and security. Drupal is used by organizations of all sizes, from small businesses to large enterprises and government agencies.

Categories: FLOSS Project Planets

Evolving Web: Maximizing and Evidencing the ROI of Your UX Design Project

Planet Drupal - Wed, 2023-05-03 02:31

UX (user experience) design is a powerful way to create valuable relationships with site users. You know it, we know it, and you need only glance at big brands to confirm they know it too. But can you prove it?

While gut instinct and anecdotal evidence are valuable, they aren’t enough if you want to be data-driven, scale results and persuade stakeholders. To get the insights you need, it’s important to track and demonstrate return on investment (ROI). ROI measures performance by comparing what you put in with what you get out.

Measuring the ROI of design can be tricky. This is because design’s impact on the bottom line is often indirect and hard to separate from the successes of other business areas, such as sales and marketing. But where there’s a will there’s a way. As design leaders, we’re no stranger to channeling creative energy and strategic thinking into problem solving.

This guide offers practical advice and best practices to help you track the ROI of your design projects. It covers:

Leaders need to track and demonstrate the ROI of UX design to make a strong business case for investing in it. 

Calculating ROI and Choosing the Right KPIs

The conventional way of calculating ROI is using monetary values: 

ROI = net income / cost of investment x 100

This is particularly appropriate in industries where quick conversions and a straightforward sales funnel are the norm, such as the FMCG industry. 

But for many organizations, the user’s journey to conversion is longer and more convoluted. It may happen over weeks, months or even years with a multitude of touchpoints along the way. What’s more—generating profit isn’t always the goal of a project. For example, it could be to raise awareness, influence opinions, provide public services, or give back to the community. 

A better way to demonstrate the ‘returns’ of your design efforts can be to use a Key Performance Indicator (KPI). This is a quantifiable measure used to gauge impact, set goals, and determine success. KPIs can look like anything from newsletter registrations or petition signatures to support calls or customer ratings.

  • Choose KPIs that align with your organization’s strategic objectives—such as increasing conversions, entering new markets, building brand awareness, accelerating time-to-market, or reducing overheads. 
  • Avoid superficial ‘vanity metrics’ that don’t reflect your design efforts or distract you from measuring real business successes. 
  • Consider how KPIs can help you get internal support for your project. Involve important stakeholders in the UX discovery and pick KPIs they care about.
  • Consider assigning a dollar value to your KPIs to help you estimate the ROI in monetary terms. 

KPIs example: Evolving Web collaborated with OCAD University on the redesign of its admissions website. OCAD U’s primary goal was to increase applications by making the admissions process more engaging and easier to follow. Therefore, an important KPIs was the number of applicants. Applicants increased by 15% within a few weeks of the launch, demonstrating the project’s considerable success.

Maximizing the ROI of Your Design Project

Tracking and analyzing KPIs helps you to identify what’s working and what isn’t. This allows you to make adjustments to realize the full potential of your current design project and future ones. You can also draw on industry best practices to inform your design strategy from the get-go.

At Evolving Web, we draw on Design Thinking: an iterative and collaborative process that puts users at the forefront of a project. It consists of five core stages: empathize, define, ideate, prototype, and test the design. According to a model developed by Forrester, Design Thinking brings an impressive median ROI of 229% per project. At an organizational level, the model demonstrated that a mature Design Thinking practice can achieve an ROI of between 71% and 107%.

Another best practice we draw on is design systems: a set of standards, style guides, and components used to unify a brand's experience. A design system enables designers to reuse core elements, meaning they don’t have to reinvent the wheel and can focus on more complex tasks. It reduces unnecessary labour hours and leads to better performing designs—both of which have a positive impact on ROI.

Productivity dips while a new design system is ramped up, but exceeds standard levels once the system is firmly in place. Credit: Callahan (2021.)

10 Statistics That Make a Strong Business Case for UX Design

Need some cold, hard data to back up your ideas? We’ve gathered 10 persuasive facts and figures that’ll help you make a compelling business case for investing in UX design. 

  1. Users’ first impressions of a website are 94% design-related (Adobe.)
  2. 75% of users judge a company's credibility based on its website design (Stanford University.) 
  3. 94% of people said that web design was the major reason they mistrusted or rejected a website (Rareform New Media.)
  4. 59% would rather read beautifully designed content instead of something plain and simple (Adobe.) 
  5. 38% of people would leave a site if its content or layout was unattractive (Adobe.)
  6. 39% of people will stop engaging with a site if images take too long to load (Akamai.)
  7. Consumers use an average of 5 different devices per person—and 8 out of 10 will leave a website if the content doesn’t display well on their device (Adobe.)
  8. Google started giving preferences to responsive websites in its search engine results pages in 2015 (Google.)
  9. Decreasing mobile site load times by one tenth of a second can increase conversion rates by 8-10% (Google.)
  10. Conversions can fall by up to 20% for every extra second a mobile page takes to load (Google.)
Make the Most of Your Next Design Project With an Agency Partner

Evolving Web has spent more than 15 years empowering organizations to create deeper connections through valuable digital experiences. Our Design Team harnesses research, strategy, and innovation to unleash the creative potential in every project—no matter its size. Partner with us and you’ll gain the confidence, wisdom, and support to take your digital design to the next level.

//--> //-->

+ more awesome articles by Evolving Web
Categories: FLOSS Project Planets

PyCoder’s Weekly: Issue #575 (May 2, 2023)

Planet Python - Tue, 2023-05-02 15:30

#575 – MAY 2, 2023
View in Browser »

Python Classes: The Power of Object-Oriented Programming

In this tutorial, you’ll learn how to create and use full-featured classes in your Python code. Classes provide a great way to solve complex programming problems by approaching them through models that represent real-world objects.

Talk Python To Me: Live From PyCon 2023

Talk Python to Me interviews a host of people at PyCon US 2023. Guests include Mario Munoz, Nick Muoh, Chris Williams, Ray McLendon, and Sean Tibor all talking about their experience at the conference.

What is a Saga in Microservices

Have you ever wondered what exactly is a saga? And what constitutes a long-running process? Watch this on-demand webinar to get a deep dive into the mechanics of sagas and explore how they can be used to manage long-running processes →
TEMPORAL sponsor

Creating a Mastodon Bot With Python

“With a Mastodon bot, you can automate tasks such as posting updates, replying to mentions, or even creating interactive chatbots.” This tutorial teaches you how to build such a bot.

PEP 713: Callable Modules


PEP 712: “Converter” Parameter for dataclasses.field


Program—PyCon AU 2023


urllib3 v2.0.0 Is Now Generally Available


Discussions As if There Weren’t Enough Packaging Tools: Rye


Python Jobs Software Engineer - Backend/Python (100% Remote) (Anywhere)


More Python Jobs >>>

Articles & Tutorials Using Python’s assert to Debug and Test Your Code

In this course, you’ll learn how to use Python’s assert statement to document, debug, and test code in development. You’ll learn how assertions might be disabled in production code, so you shouldn’t use them to validate data. You’ll also learn about a few common pitfalls of assertions in Python.

Sync or Async? Unpacking the Mysteries of Django Signals

Django signals provide a powerful way to trigger actions when specific events occur, but are they asynchronous or synchronous? In this article, we’ll explore the answer to this question and discuss the pros and cons of using Django signals in your web applications.

Auth. Built for Devs, By Devs

FusionAuth is the auth platform that makes developers’ lives awesome. You’ll get all the features your Python app needs like login, registration, user management, SSO, MFA, and more. Plus a customizable, scalable solution that is 100% free for unlimited users →

Debugging a Mixed Python and C Language Stack

Debugging is difficult. Debugging across multiple languages is especially challenging, and debugging across devices often requires a team with varying skill. This article describes the process one team uses to debug across a mixed Python/C stack.

Validating User Input With Tkinter Apps

When writing GUI applications you often need to accept data from users. Reliable applications need to validate the input. This article outlines some strategies for dealing with it in the world of Tkinter GUI programming.

PyTorch Performance Features and How They Interact

PyTorch in 2023 is a complex beast, with many great performance features hidden away. This article goes through a series of empirically tested tuning techniques and settings in all combinations.

How to Build Your Own Raspberry Pi Watch

Using a 1.28-inch TFT display and a watch board, these folks were able to make a wearable out of the Raspberry Pi RP2040. Read on for where they found the parts and how they did it.

All of Your Data, from Python or Any Other Application, in Real-Time

Connect, Integrate & Automate your data from any other application or tool in real-time, on-premise or cloud, with simple data access to more than 250 cloud applications and data sources. Learn more at cdata.com

Wall Street’s Transition From Excel to Python

Excel isn’t going away, but increasingly financial institutions are turning to Python for their calculation needs. Learn why and what tools are involved.

eCharts for Python

Apache eCharts is a web-based charting library built using TypeScript. This post shows you how to use eCharts through a Python wrapper.

Projects & Code msgspec: Write/Validate JSON, MessagePack, YAML, & TOML

GITHUB.COM/JCRIST • Shared by Jim Crist-Harif

python-build-standalone: Redistributable Builds of Python


polyfactory: Factories for Mock Data Generation


markdown-code-runner: Execute Markdown Code Blocks


griptape: Python Framework for AI Workflows and Pipelines


Events STL Python

May 3, 2023

Weekly Real Python Office Hours Q&A (Virtual)

May 3, 2023

Canberra Python Meetup

May 4, 2023

PyDelhi User Group Meetup

May 6, 2023

IndyPy Monthly Meetup

May 9, 2023

JupyterCon 2023

May 10 to May 13, 2023

Happy Pythoning!
This was PyCoder’s Weekly Issue #575.
View in Browser »

[ Subscribe to 🐍 PyCoder’s Weekly 💌 – Get the best Python news, articles, and tutorials delivered to your inbox once a week >> Click here to learn more ]

Categories: FLOSS Project Planets

March/April in KDE PIM

Planet KDE - Tue, 2023-05-02 14:00

Here's our bi-monthly update from KDE's personal information management applications team, covering progress made in the months of March and April 2023.

Since the last report, 38 people contributed approximately 1700 code changes, focusing on bugfixes and improvements for the 23.04 release, as well as preparing for the transition to Qt 6.

KDE PIM Sprint

On the first weekend of April, a few of us met in Toulouse for the first post-pandemic KDE PIM Sprint. Kevin has published a report with details on everything we did.

Transition to Qt 6/KDE Frameworks 6

Shortly after the KDE PIM sprint in Toulouse, the switch to Qt 6 and KF6 entered its final phase with the creation of the kf6 porting branches in the KDE PIM repositories. The aim is to publish a first release based on that towards the end of the year. See the corresponding blog post for more details.

The master branches are used for the remaining Qt 5 based releases.

We fixed some bugs in the kf6 builds, and now kmail/knotes/akregator/etc. can be used. That said, it’s still experimental, and a lot of crashes were reported.

Sandro started updating the kdepim-docker image to support Qt6/KF6 variant. You can now build a Qt6 one with build.sh -q 6 and run it with run.sh -q 6.


The contact editor was completely redesigned and allows setting a lot more contact information than previously available.

It is also now possible to set custom reminder time.

We fixed various small bugs in the UI and a major bug in the IncidenceOccurenceModel which caused a crash and affected many users.

We now have more unit tests in many places, thanks to Anant Verma and Joshua Goins.

During the KDE PIM sprint, we managed to significantly reduce the number of libraries we link against which should improve slightly the startup time and reduce the number of dependencies.


The search field to filter the collections in the left sidebar now works again, and it's now possible to copy events from read-only calendars (415774). Besides, KOrganizer won't crash when you drag an event outside of the events view (461413), and adding a new iCal calendar should now sync properly (425460).

Shared calendar infrastructure

Invitations are now displayed correctly when toggling the search collections in the left sidebar of both Kalendar and Korganizer. Akonadi-Search now has some unit tests for the calendar indexer and the code base was modernized.

The initial calendar setup, which configured the default calendar and the search collections for invitations, was moved from Korganizer to Akonadi Calendar which allows both Kalendar and Korganizer to make use of it.


The SQLite support was improved by enabling the WAL mode and disabling shared cache mode. We also removed old legacy code implemented to support ancient versions of SQLite. The intention was to remove the custom fork of the QSQLITE SQL driver that we had for over a decade, and make SQLite the default database backend in the near future. FreeBSD has already switched.

Moreover, we fixed 3 important high profile bugs in these last two months:

  • The MySQL backend runs mysql_upgrade which should ensure the database internal structure is up to date and fix various issues were the logs were quickly filled up with warnings. (456983 and a few similar bug reports)

  • A potential crash on shutdown has been fixed (462692), as well as a curious race condition that was causing instabilities in our test suite.

  • Jiří Paleček fixed a bug caused by an invalid range iteration which caused various errors (468343 and a few similar bug reports).


Itinerary received support for numerous additional travel document and ticket formats, as well as additional ways to guide you to the right spot on a railway platform. See it's own summary post for more details.


Interactions with phone numbers for calls and SMSs now behave like anywhere else on the system, and now actually work for contact data shown inside KMail.

Text input and understanding

We released version 1.3.0 of KTextAddons. A new library called textemoji was created which allows to select a unicode font emoji. Originally we used a code from kpimtextedit, and it extracted and split as Core/Widgets. This library can be used in the future in QML too, and this widget supports custom emojis too.

Autocorrection was split between code/widget too, so that it can be used with QML.


We rewrote undo send notification. Now we can show "to" info and "title info".

If the de-vs compliance mode is active in GnuPG, then the compliance state is now shown in verification and decryption results and when selecting keys (T6343).

Additionally we fixed these bugs:

  • Bug 466931, where Custom Message Aggregation Modes were not shown in Message List preferences until a restart.
  • Bug 468801, in which we removed an unused warning, "unknown mimetype «text/x-moz-deleted»", from org.kde.pim.mimetreeparser.
  • Bug 467034, in which libksieve/src/kmanagesieve/session.cpp was assigning passwords to usernames and they were geting logged.
  • Bug 467291, in which switching Folder List layout caused messages in the message list to disappear.

g10 Code, the company which funds the development of Kleopatra and improvements in a few other KDE applications, is becoming a Patron of KDE!

In technical news, when moving a decrypted archive to its final destination, you can now see the progress is shown (T6373), and checking certificates for compliance was unified (T6380).

The notepad now remembers the certificates that were last used when signing/encrypting the entered text (T6415). Also, when signing or encrypting files, Kleopatra now shows hints if the selected certificates are about to expire soon (T6330), and The default expiration time of certifications can now be configured (T6452).

Kleopatra no longer offers encryption-only OpenPGP certificates as signing certificates (T6456), and some problems with Unicode characters in error messages where fixed on Windows (T5960).

Categories: FLOSS Project Planets