Posts

PyQT - Collapsible Sections

PyQt - Accordion Equivalent

When there are groups of related information that are to be made available for viewing, but is too visually cluttering when shown all at once, one can use the grouping behavior of an accordion or collapsible section to selectively show information.

One native Qt widget that can be used in PyQT is the QtToolBox. This widget offers a vertical list of collapsible containers where only one can be viewed at a time. It behaves similar to a tab view except the the tab and its associated content are bunched together.

Categories: #python
Tags: #pyqt
PyQtgraph - Graphing with a Ui File

PyQtgraph Graph in Native Window

Dedicating a UI file to store the application layout will make for a more organized process when working with PyQt. The Python code will be cleaner if it focuses on creating the dynamic data that will be inserted into the ui file.

To demonstrate this, create a window.ui file.

<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
 <class>MainWindow</class>
 <widget class="QMainWindow" name="MainWindow">
  <property name="windowTitle">
   <string>MainWindow</string>
  </property>
  <widget class="QWidget" name="centralwidget">
     <layout class="QVBoxLayout" name="verticalLayout">
     </layout>
  </widget>
 </widget>
</ui>
Categories: #python #shell
Tags: #cli-tools
fzf - Integrate with Jq for JSON Search

Fzf Search JSON Data

JSON is a ubiquitous data format and searching for content in JSON will come up often enough to warrant a real-time search functionality. jq can be used to query json and fzf can be combined with this tool to fulfill our JSON search capabilities.

Start fzf with jq

echo '' | fzf --preview "jq {q} < us-data.json.json"
Categories: #fzf
Tags: #cli-tools
DITA - Structured Documentation with XML

DITA Setup

DITA stands for Darwin Information Typing Architecture, it is an XML specification that prescribes tags for organizing your documentation content. For Dita to be able to generate a well-defined structure, it suggests a rather prescriptive methods of tag use. The intention of Dita is to promote content reuse so that your documentation project will be more manageable as it scales up in size and complexity.

Getting started with Dita begins with having these prerequisites.

  • Java
  • Text editor
  • DITA-OT
Categories: #documentation
Nuitka and PyQtgraph - Bundle a Python Application into a Standalone Binary

PyQtgraph Standalone Application

Nuitka is a Python compiler that supports the conversion of a Python application to compiled code. It enables you to create a single file executable for convenient distribution.

Prerequisites

You will need a C compiler and a Python version specified in the Nuitka README.md.

Installing Nuitka

python3 -m pip install nuitka
Categories: #python #shell
Tags: #cli-tools
Creating an AppImage from a Binary Executable

Make a Portable Desktop Application without the need for Installation

To create a binary which can be run on many Linux machines, an AppImage can be generated. An AppImage wraps around the files needed to run the application and when executed, doesn't require modifications to your operating system as it is self-contained.

Download the appimage tool executable file from here.

Categories: #shell
Tags: #cli-tools