Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
xircon opened this issue Nov 22, 2020 · 2 comments
Open

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

xircon opened this issue Nov 22, 2020 · 2 comments

Comments

@xircon
Copy link

xircon commented Nov 22, 2020

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.

@bostrt
Copy link
Owner

bostrt commented Nov 22, 2020

Phrase addition is partially interactive already (your default editor is used to add phrase contents) but I think adding interactivity for the key/shortcut isn't out of the question. I'll look into that for 0.1.4 upcoming.

@xircon xircon closed this as completed Nov 22, 2020
@bostrt
Copy link
Owner

bostrt commented Nov 23, 2020

I'll leave this open to track the feature until its completed.

@bostrt bostrt reopened this Nov 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants