Skip to content

Just an idea - qka - interactively add a phrase #46

@xircon

Description

@xircon

Python is not my favourite, but something like this:

qka ()
{
	echo -n "Enter Shortcut: "
	read scut
	echo -n "Enter Phrase  : "
	read phrase
	cmd="qk add -n '$scut' -p '$phrase'"
	eval $cmd
}

Which I have been using for a while. I am trying to force myself to learn python:

#!/usr/bin/env python
from dearpygui import core, simple
import os

wid=500
hgt=150

core.set_main_window_size(wid, hgt)

core.add_additional_font("SourceCodePro-Bold.otf", 25, "")

def save_callback(sender, data):

    # Store Data to variables:
    tSC = core.get_value("##scut")
    tPH = core.get_value("##phrase")

    cmd = "qk add -n "+"'"+tSC+"' -p "+"'"+tPH+"'"
    print(cmd)
    os.system(cmd)

    # Clear previous input data:
    tSC = core.set_value("##scut", "")
    tPH = core.set_value("##phrase", "")

with simple.window("Quikey - Add Phrase"):

    core.add_text("Shortcut:")
    core.add_same_line()
    core.add_input_text("##scut")

    core.add_text("phrase  :")
    core.add_same_line()
    core.add_input_text("##phrase")

    core.add_button("Save", callback=save_callback)

# Run the script:
core.start_dearpygui(primary_window="Quikey - Add Phrase")

Been playing with dearpygui, it is great for quick prototypes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions