Feeds

PyCharm: PyCharm 2024.1 EAP 6: In-editor Code Review

Planet Python - Wed, 2024-02-21 17:26

Our new EAP build for PyCharm 2024.1 is now available for you to download!

This new build is packed with a bunch of updates to the integration with version control systems.

You can download the new version from our website, update directly from the IDE or via the free Toolbox App, or use snaps for Ubuntu.

Download PyCharm 2024.1 EAP

Version control systems In-editor code review

PyCharm 2024.1 EAP 6 introduces a more streamlined and agile code review workflow for both GitHub and GitLab users. Authors and reviewers can now seamlessly interact directly within the editor, thanks to the implementation of the Review Mode.

Once the pull/merge request branch is checked out, the review mode is automatically enabled. When you open a source file related to the pull/merge request, either from a diff or from the Project tool window, you’ll notice purple controls on the gutter, indicating changes made to the lines of code and available for the code review workflow. For both authors and reviewers, clicking on these markers reveals a popup showing the original code, making it easier to understand the change. Use the icons in the gutter to discuss changes: click the + icon appearing on hover to start a new discussion or the Message icon to open or hide existing comments where you can reply, react, and resolve threads.

You can use the widget in the editor’s upper right corner to see only unresolved discussions or turn off the review mode completely. You can also toggle review mode from VCS widget.

Preventing large file commits to repositories

To prevent instances where the version control system rejects pushes due to files exceeding size limits, we’ve introduced a mechanism that prohibits the committing of such files. The IDE will now perform a pre-commit check and notify you about the restriction hence saving time on reverting your rejected commits and enhancing the repository management. 

Allow unrelated histories merge option 

We’ve enhanced the Merge into dialog with the addition of the Allow unrelated histories option. When selected from the dropdown menu, this option enables the merge operation to proceed even if the two branches being merged have no common history.

Support for reactions on code review comments 

PyCharm 2024.1 EAP 6 brings support for reactions on review comments for GitHub Pull Requests and GitLab Merge Requests. You can now select from a set of emojis to use as a reaction to your code review comments, enhancing your collaboration process. 

CI checks suite statuses in the Git tool window 

We’ve introduced a new column in the Log tab of the Git tool window, allowing you to easily review the results of GitHub commit checks performed by your CI system. Simply click on it to view the full details of the CI checks. 

Create pull/merge requests from push notifications

After successfully pushing your changes to the version control system, the IDE will now prompt a single notification to inform you about the successful push and suggest an action to create a pull/merge request.

Branch filter for the History tab of the Git tool window

We’ve revamped the user experience for file history in the Git tool window. First, the Show all branches button has been replaced with a branch filter, enabling you to review changes made to a file within a designated branch. Additionally, we’ve adjusted the toolbar orientation, positioning it horizontally for improved usability. 

Stash tab in the Commit tool window

For users who rely on stashes to store temporary uncommitted changes, we’ve introduced a dedicated tab within the Commit tool window for convenient access. If you utilize both stashes and shelves, you have the option to enable a combined Stashes and Shelves tab via a corresponding checkbox in Settings/Preferences | Version Control | Git.  

Visual indicators for pending updates

We’ve introduced visual indicators to hint about pending updates within your code review workflow. When there are changes requiring your attention, a dot badge will appear on the tool window icon. Additionally, unseen pull requests will be marked with a blue dot, ensuring you don’t miss updates in your code review process.

These are the most notable updates for this week. For the full list of implemented changes, refer to the release notes

Take the new features for a test drive, share your feedback with us via X (formerly Twitter) or in the comments below, and stay tuned for more updates! If you spot a bug, report it to our issue tracker.

Categories: FLOSS Project Planets

Niels Thykier: Expanding on the Language Server (LSP) support for debian/control

Planet Debian - Wed, 2024-02-21 16:15

I have spent some more time on improving my language server for debian/control. Today, I managed to provide the following features:

  • The X- style prefixes for field names are now understood and handled. This means the language server now considers XC-Package-Type the same as Package-Type.

  • More diagnostics:

    • Fields without values now trigger an error marker
    • Duplicated fields now trigger an error marker
    • Fields used in the wrong paragraph now trigger an error marker
    • Typos in field names or values now trigger a warning marker. For field names, X- style prefixes are stripped before typo detection is done.
    • The value of the Section field is now validated against a dataset of known sections and trigger a warning marker if not known.
  • The "on-save trim end of line whitespace" now works. I had a logic bug in the server side code that made it submit "no change" edits to the editor.

  • The language server now provides "hover" documentation for field names. There is a small screenshot of this below. Sadly, emacs does not support markdown or, if it does, it does not announce the support for markdown. For now, all the documentation is always in markdown format and the language server will tag it as either markdown or plaintext depending on the announced support.

  • The language server now provides quick fixes for some of the more trivial problems such as deprecated fields or typos of fields and values.

  • Added more known fields including the XS-Autobuild field for non-free packages along with a link to the relevant devref section in its hover doc.

This covers basically all my known omissions from last update except spellchecking of the Description field.

Spellchecking

Personally, I feel spellchecking would be a very welcome addition to the current feature set. However, reviewing my options, it seems that most of the spellchecking python libraries out there are not packaged for Debian, or at least not other the name I assumed they would be.

The alternative is to pipe the spellchecking to another program like aspell list. I did not test this fully, but aspell list does seem to do some input buffering that I cannot easily default (at least not in the shell). Though, either way, the logic for this will not be trivial and aspell list does not seem to include the corrections either. So best case, you would get typo markers but no suggestions for what you should have typed. Not ideal.

Additionally, I am also concerned with the performance for this feature. For d/control, it will be a trivial matter in practice. However, I would be reusing this for d/changelog which is 99% free text with plenty of room for typos. For a regular linter, some slowness is acceptable as it is basically a batch tool. However, for a language server, this potentially translates into latency for your edits and that gets annoying.

While it is definitely on my long term todo list, I am a bit afraid that it can easily become a time sink. Admittedly, this does annoy me, because I wanted to cross off at least one of Otto's requested features soon.

On wrap-and-sort support

The other obvious request from Otto would be to automate wrap-and-sort formatting. Here, the problem is that "we" in Debian do not agree on the one true formatting of debian/control. In fact, I am fairly certain we do not even agree on whether we should all use wrap-and-sort. This implies we need a style configuration.

However, if we have a style configuration per person, then you get style "ping-pong" for packages where the co-maintainers do not all have the same style configuration. Additionally, it is very likely that you are a member of multiple packaging teams or groups that all have their own unique style. Ergo, only having a personal config file is doomed to fail.

The only "sane" option here that I can think of is to have or support "per package" style configuration. Something that would be committed to git, so the tooling would automatically pick up the configuration. Obviously, that is not fun for large packaging teams where you have to maintain one file per package if you want a consistent style across all packages. But it beats "style ping-pong" any day of the week.

Note that I am perfectly open to having a personal configuration file as a fallback for when the "per package" configuration file is absent.

The second problem is the question of which format to use and what to name this file. Since file formats and naming has never been controversial at all, this will obviously be the easy part of this problem. But the file should be parsable by both wrap-and-sort and the language server, so you get the same result regardless of which tool you use. If we do not ensure this, then we still have the style ping-pong problem as people use different tools.

This also seems like time sink with no end. So, what next then...?

What next?

On the language server front, I will have a look at its support for providing semantic hints to the editors that might be used for syntax highlighting. While I think most common Debian editors have built syntax highlighting already, I would like this language server to stand on its own. I would like us to be in a situation where we do not have implement yet another editor extension for Debian packaging files. At least not for editors that support the LSP spec.

On a different front, I have an idea for how we go about relationship related substvars. It is not directly related to this language server, except I got triggered by the language server "missing" a diagnostic for reminding people to add the magic Depends: ${misc:Depends}[, ${shlibs:Depends}] boilerplate. The magic boilerplate that you have to write even though we really should just fix this at a tooling level instead. Energy permitting, I will formulate a proposal for that and send it to debian-devel.

Beyond that, I think I might start adding support for another file. I also need to wrap up my python-debian branch, so I can get the position support into the Debian soon, which would remove one papercut for using this language server.

Finally, it might be interesting to see if I can extract a "batch-linter" version of the diagnostics and related quickfix features. If nothing else, the "linter" variant would enable many of you to get a "mini-Lintian" without having to do a package build first.

Categories: FLOSS Project Planets

ImageX: Mastering Content Structure with Ease Thanks to Drupal’s Revamped Field UI

Planet Drupal - Wed, 2024-02-21 15:11

Authored by: Nadiia Nykolaichuk.

Whatever specific kinds of content your website needs — articles, news, testimonials, products, user profiles, events — fields help organize them into predefined structures or templates. This ensures consistency in how all items of a certain type are displayed and managed, and gives you ultimate flexibility in content modeling.

Categories: FLOSS Project Planets

Drupal.org blog: Updating how contributors accept the Git Terms of Service

Planet Drupal - Wed, 2024-02-21 14:24

We’re streamlining the git terms of service acceptance process, by moving it into our GitLab instance.

When you next use git.drupalcode.org, you will be asked to accept terms of service. The terms of service aren't changing, but how we ask you to accept them is. You can always review the current Drupal Git Contributor Agreement & Repository Usage Policy

You will need to accept these terms before pushing code to git.drupalcode.org or continuing while logged in.

www.drupal.org had been the place where we recorded acceptance of these terms. Now we are leaning on GitLab to take over this functionality. Instead of migrating who had previously accepted, we're taking the opportunity to remind everyone of these terms.

As we're improving developer tools on Drupal.org, working to migrate issues to GitLab, and update www.drupal.org, this change makes it easier to get a git.drupalcode.org account, and simplifies our codebase.

For more background, see #3230072: Streamline Git Access Agreement/username assignment and #3227737: [Meta] GitLab Acceleration Initiative

Categories: FLOSS Project Planets

The Drop Times: The Future of Open Source, Digital Government and Drupal at FOSDEM

Planet Drupal - Wed, 2024-02-21 14:09
Mike Gifford shares his first-hand insights from FOSDEM'24, the eminent open-source conference, shedding light on the significant discussions around open-source solutions in government, digital public goods, and the evolving role of open-source in societal advancement. Gain unique perspectives on the intersection of open-source technology and public good initiatives, as well as the impact of open source on government innovation. Delve into discussions on web accessibility, sustainability, and the application of open source in governmental projects, presented with real-world examples from various government agencies. Explore the emergence of Open Website Alliance and the impact of AI on the broader community.
Categories: FLOSS Project Planets

Acquia Developer Portal Blog: Automated Bot Traffic - Strategies to Handle and Manage It

Planet Drupal - Wed, 2024-02-21 11:04

In the enterprise realm, automation stands as a transformative force, offering a dual-edged sword of efficiency gains and emergent challenges. Its implementation is reshaping industry norms, potentially redefining the operational paradigms of the business world.

Categories: FLOSS Project Planets

Acquia Developer Portal Blog: DrupalCon EUR 2023 - Day 3

Planet Drupal - Wed, 2024-02-21 11:04

So that’s it, DrupalCon Lille 2023 has come to a close - for me at least. I’m currently sitting in the train heading home. Now’s the perfect time to reflect on what’s been an amazing three days. And it really has been amazing! Lille has been the perfect host city, providing great brasseries with great beer and lots of food with lots of melted cheese all over it - who could ask for more? And this DrupalCon has provided me with so many opportunities to learn, to talk, to listen and to have fun. 2023 has been a vintage year.

Categories: FLOSS Project Planets

Acquia Developer Portal Blog: DrupalCon EUR 2023 - Day 2

Planet Drupal - Wed, 2024-02-21 11:04

DrupalCon Lille Day 2 has already proven to be a unique day at DrupalCon! I’ve been lucky enough to attend “a few” DrupalCons in my day (I’ve been to every North American DrupalCon since Denver in 2012) but this is only my second European DrupalCon. And today for the first time at a DrupalCon (or tech conference) I listened to a keynote from a retired helicopter pilot. 

Categories: FLOSS Project Planets

Acquia Developer Portal Blog: DrupalCon EUR 2023 - Day 1

Planet Drupal - Wed, 2024-02-21 11:04

DrupalCon Europe 2023 started off today with over 1200 attendees in Lille, France! The energy in the building was amazing to see. Attendees started off exploring booths and took a chance at the Acquia claw machine to get some swag as the event kicked off with a welcome brunch in the exhibition area. It was great to meet old friends and new folks excited for what the week holds.

Categories: FLOSS Project Planets

Tag1 Consulting: Gander: The Sustainability Impact of Automating Performance Testing

Planet Drupal - Wed, 2024-02-21 10:11
Introduction In the ever-evolving landscape of modern technology, a critical conversation has been unfolding around the environmental impact of our digital advancements. The spotlight has more recently been sharply focused on the primary offending sectors like cryptocurrency and artificial intelligence, revealing a concerning narrative about their substantial energy consumption and carbon footprint. This narrative also extends to the broader tech realm, encompassing the vast and intricate web of digital solutions we have all come to rely on. Amidst this backdrop, the IT sector, including software development, is becoming increasingly recognized for its significant carbon footprint. Recent estimates suggest that its CO2 emissions are around 4% of global totals, comparable to the aviation industry. This alarming statistic underscores the urgent need for sustainable practices within the sector. Organizations like the Green Software Foundation and The Green Web Foundation are at the forefront of addressing these challenges. They are leading the way in developing standards and best practices for greener software development. Their focus on software efficiency and energy-aware design is crucial in reshaping how the industry approaches sustainability. Drupal is a leading open-source CMS that[ powers 1%... Read more michaelemeyers Wed, 02/21/2024 - 07:11
Categories: FLOSS Project Planets

Real Python: How to Read User Input From the Keyboard in Python

Planet Python - Wed, 2024-02-21 09:00

You may often want to make your Python programs more interactive by responding dynamically to input from the user. Learning how to read user input from the keyboard unlocks exciting possibilities and can make your code far more useful.

The ability to gather input from the keyboard with Python allows you to build programs that can respond uniquely based on the preferences, decisions, or data provided by different users. By fetching input and assigning it to variables, your code can react to adjustable conditions rather than just executing static logic flows. This personalizes programs to individual users.

The input() function is the simplest way to get keyboard data from the user in Python. When called, it asks the user for input with a prompt that you specify, and it waits for the user to type a response and press the Enter key before continuing. This response string is returned by input() so you can save it to a variable or use it directly.

Using only Python, you can start building interactive programs that accept customizable data from the user right within the terminal. Taking user input is an essential skill that unlocks more dynamic Python coding and allows you to elevate simple scripts into personalized applications.

Get Your Code: Click here to download the free sample code that shows you how to get user input from the keyboard with Python.

How to Read Keyboard Input in Python With input()

You can create robust and interactive programs by taking advantage of input(). It opens up possibilities for creating scripts that respond dynamically based on adjustable conditions, personalized data, and real-time decision-making from the user. It is an ideal option when you want to read keyboard input with Python.

Getting started is straightforward. Just launch the Python interpreter shell, and you can immediately utilize input() for basic interactivity.

To try it, first open your terminal and launch the Python REPL by typing python and hitting Enter. This will display the familiar >>> Python prompt indicating the REPL is ready. Use input(), passing any string in the parentheses:

Python >>> input("What is your name? ") What is your name? Vincent 'Vincent' Copied!

Once you execute the code, the string that you specified in input() will be rendered on screen, and you’ll be able to type in any response. Your response will also print to the screen once you press Enter. This is because the REPL automatically prints return values—in this case, the value returned by input().

The best practice when using input() is to assign it to a variable that you can use later in your code. For example, you can ask the user to type in their name. Assign input() to the name variable:

Python >>> name = input("What is your name? ") What is your name? Vincent Copied!

This prints the prompt What is your name? and pauses, waiting for keyboard input. After the user types a name and presses Enter, the text string is stored in the name variable. This time, your input won’t automatically print in the REPL, because a variable stores the value instead.

You can now use the variable in any part of your code in the same session, like printing a personalized greeting:

Python >>> print(f"Hello there, {name}!") Hello there, Vincent! Copied!

Your program reacted based on the custom name that you provided. It used the name that you gave in the input() request.

This is the essential pattern when working with Python keyboard input:

  1. Call input() with a prompt explaining what to enter.
  2. Assign the result to a descriptively named variable.
  3. Use that variable later in your code.

By following this template, you can start building all types of interactive scripts tailored to custom data from different users. Your programs can gather input of all types, such as names, numbers, and lists, making it quite handy in processing data from your users.

NOTE: Using input() processes all inputs as string literals, the users’ input isn’t executed as code. However, you should be wary of users’ inputs and assess them before executing them in your program, using them in database queries, or otherwise trusting them.

This is just the initial step that you can take in using input() in your interactive program. There are other modifications that you can make to ensure that the function takes in all manner of data types.

Reading Specific Data Types With the Input Function

The general rule for input() is that it collects textual input and delivers strings. Your code often needs numbers, Booleans or other data types instead. For example, maybe you need to get integers for math operations, floats for calculations with decimals, or Booleans for logical conditions.

As input() returns strings, you need to convert all the input into the targeted desired data type before using it in your code. If you ask for numerical input, the outcome will still be returned as a string:

Read the full article at https://realpython.com/python-keyboard-input/ »

[ 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

Robin Wilson: How to fix GeoPandas drop_duplicates on geometry column not getting rid of all duplicates?

Planet Python - Wed, 2024-02-21 08:28

I use GeoPandas for a lot of my vector GIS data manipulation in Python.

I had a situation the other day where I ended up with duplicates of some geometries in my GeoDataFrame, and I wanted to remove them. The simple way to do this is to use the underlying pandas method drop_duplicates on the geometry column, like:

gdf.drop_duplicates('geometry')

However, even after running this I still had some duplicate geometries present. I couldn’t quite believe this, so checked multiple times and then started examining the geometries themselves.

What I found was that my duplicates were technically different geometries, but they looked the same when viewing them on a map. That’s because my geometries were LineStrings and I had two copies of the geometry: one with co-ordinates listed in the order left-to-right, and one in the order right-to-left.

This is illustrated in the image below: both lines look the same, but one line has the individual vertex co-ordinates in order from left-to-right and one has the same co-ordinates in order from right-to-left.

These two geometries will show as the same when using the geometry.equals() method, but won’t be picked up by drop_duplicates. That’s because drop_duplicates just serialises the geometry to Well-Known Binary and compares those to check for equality.

I started implementing various complex (and computationally-intensive) ways to deal with this, and then posted an issue on the GeoPandas Github page. Someone there gave me a simple solution which I want to share with you.

All you need to do is run gdf.normalize() first. So, the full code would be:

gdf.normalize() gdf.drop_duplicates('geometry')

The normalize() method puts the vertices into a standard order so that they can be compared easily. This works for vertex order in lines and polygons, and ring orders in complex polygons.

Categories: FLOSS Project Planets

Drupal Core News: Drupal 11 is now open for development, Drupal 10.3.x is branched

Planet Drupal - Wed, 2024-02-21 07:10

Starting today, the Drupal 11.x branch is used for building the next major Drupal version, Drupal 11. This means that major version specific changes can now happen on the Drupal 11.x branch. This includes dependency and requirements updates and removal of deprecated API and extensions. Details are available in the allowed changes during Drupal core release cycle document.

Drupal 11 is planned to be released either on the week of June 17, week of July 29 or week of December 9, 2024, depending on when beta requirements are completed.

A 10.3.x branch was created to work on the upcoming minor version. Drupal 10.3.0 will be released on the week of June 17, 2024.

Issues should remain targeted at the 11.x branch and will be backported when appropriate.

Categories: FLOSS Project Planets

Oxygen Icons 6 Released

Planet KDE - Wed, 2024-02-21 05:20

Oxygen Icons is an icon theme for use with any XDG compliant app and desktop.

It is part of KDE Frameworks 6 but is now released independently to save on resources.

This 6.0.0 release requires to be built with extra-cmake-modules from KF 6 which is not yet released, distros may want to wait until next week before building it.

Distros which ship this version can drop the version released as part of KDE Frameworks 5.

sha256: 28ec182875dcc15d9278f45ced11026aa392476f1f454871b9e2c837008e5774

URL: https://download.kde.org/stable/oxygen-icons/

Signed by E0A3EB202F8E57528E13E72FD7574483BB57B18D Jonathan Esk-Riddell <jr@jriddell.org>
https://jriddell.org/esk-riddell.gpg

Categories: FLOSS Project Planets

LN Webworks: Why Drupal is the best choice for Every Industry: All you need to know

Planet Drupal - Wed, 2024-02-21 04:56

Businesses need to adapt to the digital world to survive nowadays, no matter what industry they're in. They have to be online and be able to handle any changes quickly. That's where Drupal comes in. Drupal is a popular platform for building websites and managing online content. It's been around for twenty years and has become a big deal in Drupal web development

Today, we're going to talk about how Drupal is used in different industries and why it's so popular. 

Categories: FLOSS Project Planets

KDSOAP WS-Discovery Client 0.4.0

Planet KDE - Wed, 2024-02-21 04:44

This project is creating a WS-Discovery client library based on the KDSoap library.

The name is short for Klarälvdalens Datakonsult AB Simple Object Access Protocol Web Services Addressing Discovery Client.

It is used by the SMB KIO worker from kio-extras.

kio-extras will have two releases as part of KDE’s 6th Megarelease, one for Qt 5 and one for Qt 6. Distros should build and ship both versions of kio-extras but the Qt5 build should use the internal static copy of kdsoap-ws-discovery-client so does not need to be built separately. The Qt 6 build of kio-extras does need this external build of kdsoap-ws-discovery-client. Distros will need an up to date copy of KDSoap library.

There are no changes compared to 0.3.0 but this one is released as stable ahead of KDE Gear 24.02.

SHA 256: 2cd247c013e75f410659bac372aff93d22d71c5a54c059e137b9444af8b3427a
URL: https://download.kde.org/stable/kdsoap-ws-discovery-client/
Signed by E0A3EB202F8E57528E13E72FD7574483BB57B18D Jonathan Esk-Riddell <jr@jriddell.org>
https://jriddell.org/esk-riddell.gpg

Categories: FLOSS Project Planets

Introducing Support For KdeEcoTest On Windows

Planet KDE - Tue, 2024-02-20 19:00

KdeEcoTest is an emulation tool aimed at emulating user activity when measuring the energy consumption of an application. You can read more about work on KdeEcoTest at this SoK23 and this SoK24 blog post. Check out the KDE Eco handbook for more details about measuring software's energy consumption.

Figure : KDE Eco logo.

One of the main goals of the KDE Eco project for Season of KDE 2024 is to extend KdeEcoTest so it can run on both Windows and GNU/Linux (X11 & Wayland). This enables energy consumption measurements of a single application across different platforms, such as Okular in X11 vs. Wayland vs. Windows.

This also makes it possible to compare Okular with a proprietary application like Adobe Acrobat. Comparisons with proprietary software are possible because KdeEcoTest can create usage scenario scripts without requiring access to the source code of the software being tested!

I have taken the task of extending support for Windows.

Getting Started: Platform Abstraction Layer

The primary function of KdeEcoTest is to emulate user behavior. Why do we need an abstraction layer for this?

  1. Think about simulating keyboard shortcuts. We'll need to change many parts of the code. But if we have an abstraction layer, we can add new features easily. Just add a function to the right module.
  2. Currently, we have 3 modules for 3 different platforms, namely, Wayland, X11, and Windows. If a fourth platform needs to be added, one can simply extend the base handler class and implement the abstract functions.
  3. This abstraction layer ensures that the same script can be used for testing across several different platforms.

During the first two weeks of SoK'24, Athul Raj K and I worked on understanding the code base and creating the abstraction layer. The layer provides two interfaces to access the underlying methods for taking window or input actions, a WindowHandler and an InputHandler (which have platform specific implementations).

Figure : Running a Standard Usage Scenario script on the Windows Platform for GCompris prepared with KdeEcoTest. Initial Task: pywin32 For Windows Management

pywin32 is a python module that provides access to many of the Windows APIs. This is used to perform window management actions for the Windows platform. Special thanks to Emmanuel for pointing out this wonderful module which has made it very convenient to extend KdeEcoTest support to Windows.

Win32 is an application programming interface (API) developed by Microsoft. It is dedicated to 32-bit Windows operating systems. Using this API, developers benefit from a set of functions for creating Windows applications using programming languages such as C, C++, and Visual Basic. They are able to control and manipulate various aspects of the Windows operating system. ctypes is a Python library for calling functions from shared libraries (DLLs) with a syntax similar to C. Pywin32 uses ctypes to use win32 functions.

During the first week, I explored the module to find the required functions and tested them out on a Windows machine. In the third week of Sok'24, I integrated the functions in the KdeEcoTest codebase. Now, the same test scripts that were used to test on X11 also run on Windows! The WindowActionHandler of win32 module under core/Handlers/win32.py handles the window management functions for Windows platforms.

class WindowActionHandler(BaseWindowActionHandler): @classmethod def GetHandler(cls): return cls() @staticmethod def GetActiveWindow(): # returns the handle of the currently active window win_id = win32gui.GetForegroundWindow() return win_id @staticmethod def GetwindowLocation(win_id): # returns active window loaction -> {"x": start_x, "y":start_y} start_x, start_y, end_x, end_y = win32gui.GetWindowRect(win_id) location = namedtuple("location", ["x", "y"]) return location(start_x, start_y) @staticmethod def GetWindowGeometry(win_id): # returns active window geometry -> {"width": width, "height": height} start_x, start_y, end_x, end_y = win32gui.GetWindowRect(win_id) width = end_x - start_x height = end_y - start_y geometry = namedtuple("geometry", ["width", "height"]) # return {"width": width, "height": height} return geometry(width, height) @staticmethod def SelectWindow(): # returns the window handle of the window selected by user x, y = win32gui.GetCursorPos() win_id = win32gui.WindowFromPoint((x, y)) return win_id @staticmethod def WindowMove(win_id,win_posx:int, win_posy:int): # relocates active window to specified loaction current_size = WindowActionHandler.GetWindowGeometry(win_id) win32gui.SetWindowPos(win_id, win32con.HWND_TOP, win_posx, win_posy, current_size.width, current_size.height, win32con.SWP_SHOWWINDOW) @staticmethod def ResizeWindow(win_id,n_height:int,n_width:int): # resizes active window to specified dimensions current_position = WindowActionHandler.GetwindowLocation(win_id) win32gui.SetWindowPos(win_id, win32con.HWND_TOP, current_position.x, current_position.y, n_width, n_height, win32con.SWP_SHOWWINDOW) @staticmethod def WindowFocus(win_id): # brings the window to top(focus) win32gui.SetActiveWindow(win_id) win32gui.SetForegroundWindow(win_id) A Minor Setback: Adding Support For Input Actions

pywin32 also provides support for simulating mouse actions such as left clicks as well as keyboard key presses. However, I am not yet able to create a proper listener for input actions of the user. The module does not provide a default listener, although it does provide a function win32api.GetAsyncKeyState() which can be used as a listener inside an infinite loop. Running an infinite while-loop results in unnecessary resource utilization of processor and main memory, which slows down the tool and affects the results of the test cases.

For these reasons, pynput has been chosen instead, which works across all the targeted platforms.

The class InputActionHandler bundles all the pynput handlers required for emulating the user input activities

class InputActionHandler(BaseInputActionHandler): @classmethod def GetHandler(cls): return cls() def __init__(self) -> None: super().__init__() self.mouse = mouse.Controller() self.mouse_listener = mouse.Listener self.mouse_buttons = mouse.Button self.keyboard = keyboard.Controller() self.keyboard_listener = keyboard.Listener self.keyboard_keys = keyboard.Key Looking Forward

Currently, I am working on testing the accuracy of mouse pointers using the 9 point calibration testing. This can also be used to check window size inaccuracy caused by window decorations such as the title bar on Windows.

I also plan to replace pynput with pywin32 if I can find or develop a proper listener for user actions.

I would like to thank the project mentors Emmanuel Charrau and Joseph P. De Veaugh-Geiss for their amazing support and guidance. Also, I am thankful to Athul Raj K, my fellow contributor in SoK'24, for his support and collaboration during this Season of KDE.

Categories: FLOSS Project Planets

Release GCompris 4.0

Planet KDE - Tue, 2024-02-20 18:00

Today we are releasing GCompris version 4.0.

This version adds translations for 3 more languages: Bulgarian, Galician and Swahili.

It contains 190 activities, including 8 new ones:

  • "Grammar classes" is an activity to learn to identify words grammatical classes, one class at a time.
  • "Grammar analysis" is similar to the previous one, but with several classes requested for each sentence.
  • "Calcudoku" is an arithmetic game where the goal is to fill a grid with numbers according to specific rules.
  • With "Guess 24", using the 4 given numbers and the operators, find the number 24!
  • In "Frieze", reproduce and complete the different friezes.
  • "Read a graduated line" is an activity where you need to find a value represented on a graduated line.
  • In "Use a graduated line", place the given value on the graduated line.
  • In "Adjacent numbers", learn which numbers come before or after the given sequence.

It contains bug fixes and graphics improvements on multiple activities.

One major milestone has been reached with this version: after almost 9 years of work, the task of reworking all the graphics to fit the guidelines has been completed!

It is fully translated in the following languages:

  • Arabic
  • Bulgarian
  • Breton
  • Catalan
  • Catalan (Valencian)
  • Greek
  • Spanish
  • Basque
  • French
  • Galician
  • Croatian
  • Hungarian
  • Italian
  • Lithuanian
  • Malayalam
  • Dutch
  • Polish
  • Brazilian Portuguese
  • Romanian
  • Slovenian
  • Turkish
  • Ukrainian

It is also partially translated in the following languages:

  • Azerbaijani (97%)
  • Belarusian (86%)
  • Czech (94%)
  • German (95%)
  • UK English (95%)
  • Esperanto (99%)
  • Estonian (95%)
  • Finnish (94%)
  • Hebrew (95%)
  • Indonesian (95%)
  • Macedonian (90%)
  • Norwegian Nynorsk (95%)
  • Portuguese (95%)
  • Russian (95%)
  • Slovak (83%)
  • Albanian (99%)
  • Swedish (95%)
  • Swahili (99%)
  • Chinese Traditional (95%)

You can find packages of this new version for GNU/Linux, Windows, Android, Raspberry Pi and macOS on the download page. This update will also be available soon in the Android Play store, the F-Droid repository and the Windows store.

Thank you all,
Timothée & Johnny

Categories: FLOSS Project Planets

Kubuntu Graphic Design Contest

Planet KDE - Tue, 2024-02-20 16:21
Announcing the Kubuntu Graphic Design Contest: Shape the Future of Kubuntu

We’re thrilled to unveil an extraordinary opportunity for creatives and enthusiasts within and beyond the Kubuntu community

The Kubuntu Graphic Design Contest.

This competition invites talented designers to play a pivotal role in shaping the next generation of the Kubuntu brand. It’s your chance to leave a lasting mark on one of the most beloved Linux distributions in the world.

What We’re Looking For:

The contest centers on reimagining and modernizing the Kubuntu brand, including the logo, colour palette, fonts, and the default desktop environment for the upcoming Kubuntu 24.04 release. We’re seeking innovative designs that reflect the essence of Kubuntu while resonating with both current users and newcomers.

Guidelines:

Inspiration: Contestants are encouraged to review the current brand and styles of kubuntu.org, kde.org, and ubuntu.com to understand the foundational elements of our visual identity.

Creativity and Modernity: Your submission should propose a fresh, modern look and feel for the Kubuntu brand and its supporting marketing materials. Think outside the box to create something truly unique.

Cohesion: While innovation is key, entries should maintain a cohesive relationship with the broader KDE and Ubuntu ecosystems, ensuring a seamless user experience across platforms.

How to Participate:

The contest is open now! We welcome designers from all backgrounds to contribute their vision for Kubuntu’s future.

Multiple entries are allowed, giving you ample opportunity to showcase your creativity.

Submission Deadline: All entries must be submitted by 23:59 on Sunday, 31st March.

Prizes:

Winner will have the honour of seeing their design become the face of Kubuntu 24.04, receiving recognition across our platforms and within the global open-source community.

First Prize:

  • Global recognition of your design as the new face of Kubuntu.
  • A trophy and certificate.
  • A Kubuntu LTS optimized and validated computer: the Kubuntu Focus Ir14 Laptop or the Kubuntu Focus NX MiniPC with 32 GB of RAM – over a $1,000 value.
  • Kubuntu Focus branded merchandise up to $50 USD shipped.

Second Prize:

  • Your runner up entry featured on kubuntu.org.
  • A trophy and certificate.
  • Kubuntu Focus branded merchandise up to $50 USD shipped.

Third Prize:

Join the Contest:

This is more than a competition; it’s a chance to contribute to a project that powers the computers of millions around the world. Whether you’re a seasoned designer or a passionate amateur, we invite you to bring your vision to life and help define the future of Kubuntu.

For more details on how to submit your designs and contest rules, visit our contest page.

Let’s create something extraordinary together. Your design could be the next symbol of Kubuntu’s innovation and community spirit.

Apply now: Contest Page
Categories: FLOSS Project Planets

TechBeamers Python: 10 Python Tricky Coding Exercises

Planet Python - Tue, 2024-02-20 15:09

Hello dear Python coding buddies. It’s time to get your brain in action and solve some challenging problems. We have worked out 10 Python tricky coding exercises to be done using loops. These would require you to brainstorm, think at multiple levels, and test your coding grit to solve. However, a coding solution is provided […]

The post 10 Python Tricky Coding Exercises appeared first on TechBeamers.

Categories: FLOSS Project Planets

Pages