
Learn to prototype a cross-platform Python GUI tool with PySide and PyQt, wiring the data model to the interface and enabling drag-and-drop and system tray integration.
Download Python at:
https://www.python.org/downloads/
Explore hundreds of pre-made PI site and pikelets examples with the cutesie demo py file, and mock up your gooey using the designer layout tool.
Design a tool to manage workspaces, each holding apps and documents, with add, remove, and launch actions, using a combo box for workspace selection and a list widget for apps.
Follow the reading flow from left to right, top to bottom. Minimize dead space and prioritize frequently used workspace and app actions in a compact, editable gui with drag-and-drop deletion.
Download Qt.py at:
https://github.com/mottosso/Qt.py
Review the starting code for a Python tool development project using PySide and PyQt. Examine the initial file structure, author and version metadata, and the import and widget packaging scaffolding.
Plan the ui by referencing the final ui, focusing on the workspace combo box inside the group box and the apps widgets, and apply a minimum viable product approach.
Explore building a PySide and PyQt graphical user interface by importing modules and naming the class, using uppercase first letters and underscores for class names, via launcher file.
Initialize the interface constructor by calling super, create a system icon provider for file, folder, and trash icons, and use a relative image path to source icons.
Learn to structure a PySide PyQt GUI by building a vertical layout with widgets, setting the window title and icon, removing minimize/maximize buttons, and resizing for a compact tool.
Create a workspace combobox inside a group box, attach a vertical layout to that group box, and pass the group box into the layout to set its layout, streamlining code.
Set up the app portion using q list widget from the cutesie widgets module, passing keyword arguments to customize colors and drag-and-drop to reorder apps, then return apps list widget.
Learn to run a pyside/pyqt tool by creating a main guard, initializing the application and queue, handling system arguments, and displaying a basic window with icon and title.
Explore the model view controller and mvvm patterns, where the model holds data, the view presents the graphical user interface, and the controller links user input to the model.
Plan data models by organizing workspaces in an ordered dictionary, each with apps that include icon and file paths, and store workspace order in a list for saving.
Create a portable Linux/unix start file, import a collections dictionary and os, define a class holding an ordered workspaces dictionary with get and delete methods, plus Python 3.0 list tweaks.
Set up data handling by importing platform, subprocess, and web browser, and using a default dictionary with a lambda to map Windows to start and Mac/Linux to open, reducing branching.
Demonstrate get apps names function, get app icon, add app, and delete app functions to manage apps via the workspace dictionary and apps list widget.
Reorder apps detects changes, stores updates in a temporary dictionary, and overwrites the original order. Run app uses path checks and subprocess to launch apps or documents across platforms.
Instantiate the model, bind backend data to the GUI using Qt bindings, and visualize data in the GUI, while prioritizing rapid testing to deliver a minimum viable product.
Connect the workspace combo box to the workspace_changed handler via a setup_connections function, centralizing widget connections and enabling actions such as button presses or app clicks.
Define a function to populate the workspace combo box by clearing it and converting a list of strings into auto-created items, using an efficient bulk approach over a for loop.
Public function returns the current combo box selection with a docstring; implement a workspaces change function and a testing function to populate the model.
Implement a function to refresh the apps list widget when the workspace changes and update popular workspaces accordingly.
Connect apps list widget to run app function, then populate list for selected workspace by clearing items, creating app entries with icons or defaults, and setting text.
Avoid unnecessary if and else statements to reduce branching and potential errors; instead, leverage dictionaries to handle logic, using available information to streamline decision paths.
Implement a run app function to launch applications or open files via the t-p launcher model, de-select items, and keep the tool open for launching multiple apps quickly.
Explore testing workflows by adding workspaces and app paths, launching through a combo box, validating updates to the applets widget, and preparing tools to edit them.
Add an edit button to the user interface by updating the setup function, inserting lines in header between header and app sections, overriding the button size, and setting its text.
Design a PySide and PyQt layout with an add button that opens a qmenu for workspace or file options and a flat delete button with a trash icon.
Implement edit functionality to hide and show the add and delete buttons and make the queue push button checkable, using a boolean-keyed dictionary to map actions and simplify connections.
Toggle edit mode to enable or disable app launching and arrange apps. Show or hide add and delete buttons and connect signals for editing.
Hey, fellow programmer! Interested in creating python tools to make your life easier? Want to take your scripts to the next level? Let me teach you how!
This series will walk you through the creation of a custom tool to launch other applications and documents with ease. Whether you know just the basics of python programming or an expert curious about PySide or PyQt, this series will be perfect for you!
The tool we develop will work on:
In this series you'll learn how to:
At the end of this series, you'll be well prepared to create you own tools!
If you have any questions, feel free to message me directly! Thanks for being awesome!