Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Sep 13 12:43
    Danesprite labeled #357
  • Sep 13 12:43
    Danesprite assigned #357
  • Sep 13 12:43
    Danesprite opened #357
  • Sep 13 12:29

    Danesprite on doc-changes

    (compare)

  • Sep 13 12:29

    Danesprite on master

    Make mention of AGPL v3 license… Merge pull request #356 from di… (compare)

  • Sep 13 12:29
    Danesprite closed #356
  • Sep 13 12:29
    Danesprite closed #355
  • Sep 12 13:27
    Danesprite labeled #356
  • Sep 12 13:27
    Danesprite labeled #356
  • Sep 12 13:27
    Danesprite opened #356
  • Sep 12 13:27
    Danesprite assigned #356
  • Sep 12 13:22

    Danesprite on doc-changes

    Make mention of AGPL v3 license… (compare)

  • Sep 12 12:53
    Danesprite commented #355
  • Sep 12 12:28
    Danesprite commented #355
  • Sep 12 12:16
    Danesprite assigned #355
  • Sep 12 12:16
    Danesprite labeled #355
  • Sep 12 12:16
    Danesprite labeled #355
  • Sep 08 05:04
    Danesprite commented #354
  • Sep 07 09:17
    Danesprite commented #354
  • Sep 07 09:12
    Danesprite labeled #354
LexiconCode
@LexiconCode
Is there a way to pass a parameter through function context?
Dane Finlay
@Danesprite

Is there a way to pass a parameter through function context?

Well, you can pass default values FuncContext(function, text=""). What is your use case?

Dane Finlay
@Danesprite
@LexiconCode Ah, okay then. You could have a get_grid_mode_context() function for this:
def get_grid_mode_context(grid):
    return FuncContext(lambda: get_grid_mode(grid))
LexiconCode
@LexiconCode
Thanks!
Dane Finlay
@Danesprite
:+1:
LexiconCode
@LexiconCode

Working with function context I had a thought. This could be true all context Classes.
Perhaps it could be a mode parameter to the base Context classes. Based on the type of mode dictates when that context is processed.
timer (Seconds)
call Something similar to get_engine().process_grammars_context() But just for those that are call not all Context and it would only be processed when the function is called.
utterance - The default mode - process every utterance

With timer and call It might allow for functions that you normally would not want to process per utterance due to performance reasons.

LexiconCode
@LexiconCode
Although I acknowledge though these features could be created with function context to achieve similar functionality.
Dane Finlay
@Danesprite
You could implement this with a few Context sub-classes to be used instead. It seems unnecessarily complex to me.
DanKaplanSES
@DanKaplanSES
I have never ever ever been able to train DNS to correct a word or phrase if, when I say it, the list of corrections doesn't include that word as a choice. Is this just the way DNS works? I don't understand the point of "spell that" since it's never done anything useful that I can notice
Dane Finlay
@Danesprite
@tieTYT It sounds like this is just the way DNS works and you have to train misrecognised words separately using "train word".
Hawkeye Parker
@haughki
@tieTYT You might try asking over at https://www.knowbrainer.com/forums/forum/index.cfm. Lot of hardcore dragon users over there. When I add a new word to the vocabulary, I always train it, but I have no clear sense that it really helps. I gave up on "spell that" a long time ago.
DanKaplanSES
@DanKaplanSES

@tieTYT It sounds like this is just the way DNS works and you have to train misrecognised words separately using "train word".

Does that usually fix the problem? Let me give an example, I've never been able to get Dragon to type Eva's. Even after training.

I can get it to say Eva, but Eva's comes out as even as
LexiconCode
@LexiconCode

@tieTYT It sounds like this is just the way DNS works and you have to train misrecognised words separately using "train word".

Does that usually fix the problem? Let me give an example, I've never been able to get Dragon to type Eva's. Even after training.

Did you try dictating it and training it in a sentence rather than an individual word?

DanKaplanSES
@DanKaplanSES
The former, yes. When you say training, you mean training a whole phrase in train word?
If yes, do you add this whole phrase to your vocabulary editor?
LexiconCode
@LexiconCode
Oh I meant to say the correct that Instead of the train word No as a individual word but the surrounding sentence gives Dragon correct that the context of how and when It should be recognized. I've only found the train word to be effective for small changes in pronunciation. For words that sound similar I've had to train them as well.
DanKaplanSES
@DanKaplanSES
ah. Well, as i said above, I have never ever ever been able to train DNS to correct a word or phrase if, when I say it, the list of corrections doesn't include that word as a choice.
And that is often the case with sentences
DanKaplanSES
@DanKaplanSES
I trained a sentence without adding it to the vocabulary editor, and that seems to have fixed it when I say the sentence now?
LexiconCode
@LexiconCode

I trained a sentence without adding it to the vocabulary editor, and that seems to have fixed it when I say the sentence now?

I don't think I've ever tried that. Not sure

Dane Finlay
@Danesprite

I think some of you in this channel might like this example command module. It demonstrates window movement with Dragonfly's Window.move() method, including its optional argument for animating window movement.

https://github.com/dictation-toolbox/dragonfly/blob/master/dragonfly/examples/_window_movement_example.py

The available commands are as follows:

  • move [this] window here [animated]
  • center [this] window here [animated]
  • move notepad [window] here [animated]
  • center notepad [window] here [animated]
LexiconCode
@LexiconCode
With BringApp Is there a way to manipulate the window after its open. For example maybe you want the window maximized?
BringApp(editor, 'test_text.txt', focus_after_start=True).execute()
Obviously I could do this in multiple steps but it be nice to have a one-liner :)
BringApp(editor,'test_text.txt', filter_func=lambda window: window.maximize(), focus_after_start=True).execute()
However filter_func is obviously not meant for the purpose described above.
Dane Finlay
@Danesprite
@LexiconCode I would just add an action on the end. If you want to do this more than once, you can define it earlier with one extra line.
maximize_window = Function(lambda: Window.get_foreground().maximize())

action = BringApp(editor, 'test_text.txt', focus_after_start=True) + maximize_window
action.execute()
LexiconCode
@LexiconCode

@LexiconCode I would just add an action on the end. If you want to do this more than once, you can define it earlier with one extra line.

ok that what thought.

Dane Finlay
@Danesprite
We could add an extra argument, but this is flexible and already works.
Dane Finlay
@Danesprite

@/all Dragonfly2 version 0.32.0 has now been released. This version mainly includes bug fixes. There are also a few improvements to the clipboard toolkit. All notable changes are listed in the changelog here: https://dragonfly2.readthedocs.io/en/stable/changelog.html

You can upgrade by running pip install --upgrade dragonfly2.

LexiconCode
@LexiconCode

We could add an extra argument, but this is flexible and already works.

I wouldn't mind mind submitting a PR for BringApp To add an argument post_func that allows for function to be run if BringApp is successful. I could do that in a couple days.
However if you don't think it's worth it's time I will stick with your suggestion :-)

Dane Finlay
@Danesprite
You could add this in a subclass of BringApp if you really need it. I would be against adding a post_func argument because adding an action on the end is a simpler general solution. It is also better for handling exceptions or action failures.
LexiconCode
@lexicon-code:matrix.org
[m]
:point_up: Edit: Both of these options seem too have race condition after BringApp. Is there a better way to do this without adding the pause?
def launch_editor3(editor='notepad'):
    # if editer is closed get_matching_windows IndexError: list index out of range
    # if editer open background not maximized it will maximize
    # if editer open minimized it will maximize
    from dragonfly import BringApp, Function, Window
    BringApp(editor, 'test_text.txt', focus_after_start=True).execute()
    editor = Window.get_matching_windows(title='test_text', executable=editor)[0] # IndexError: list index out of range
    if not editor.is_maximized:
        editor.maximize()

def launch_editor2(editor='notepad'):
    # if editer is closed it will maximize
    # if editer open in background not maximized it will not maximize
    # if editer open minimized it will maximize
    from dragonfly import BringApp, Function, Window
    BringApp(editor, 'test_text.txt', focus_after_start=True).execute()
    Function(lambda: Window.get_foreground().maximize()).execute()
David Zurow
@daanzu
@lexicon-code:matrix.org Unfortunately, I think this is an unavoidable result of the windows API not being synchronous. You either have to poll, or write complicated event watching.
LexiconCode
@lexicon-code:matrix.org
[m]
@daanzu: thanks what I figured.
Jaan Altosaar
@altosaar

I had a question about dragonfly -- curious how you all solve problems like saying "right four" which becomes "right for" often (when trying to move the cursor right four times). The same thing happens when saying "enter" and a few other words.

Do you have any advice on navigating this - is there a way to help Dragon(fly) recognize "right four" instead of "right for"?

David Zurow
@daanzu
@altosaar Maybe I am misunderstanding, but dragonfly handle this naturally with the grammars you define. If your grammar only defines "right four" and not "right for", the former is what will be recognized. If you define both, then that is ambiguous and somewhat undefined, although the kaldi backend allows you to specify a weight to assign to help determine which is recognized.
Ryan Hileman
@lunixbochs
@Danesprite the talon dragonfly backend looks pretty good on my end at this point, just updated the PR and did a new Talon beta release
Ryan Hileman
@lunixbochs
I'm planning to release this talon beta to public soon, so it would be nice to get some confirmation from your end that dragonfly seems to be overall working first
Dane Finlay
@Danesprite

@altosaar @daanzu I have noticed DNS recognises my commands like this sometimes.

Dragonfly's English-language integers were changed a little while ago to include alternatives "to" and "too" for the number "two". I think it was a mistake to add these, however, and will be removing them in a future version because they are confusing.

Maybe you have noticed this behaviour @lunixbochs?

Dane Finlay
@Danesprite
@lunixbochs Thanks for that. I'll review the changes shortly and do some testing on my end. Sorry I've been a bit slow with that PR.
Ryan Hileman
@lunixbochs
dragon doesn't do that for me, but I have had other issues with dragon integers
David Zurow
@daanzu
@Danesprite Strange, thanks for the info. The joys of dealing with DNS. :wink: For what it's worth, having those words should be neither a help nor a hindrance for the Kaldi backend.
Dane Finlay
@Danesprite

Yes, DNS certainly has its issues. It is good that Kaldi doesn't have this or certain other issues. Those alternatives for 2 are annoying when you want to type the word number "two". My mistake for not thinking the changes through.

I notice that SAPI 5 has a slightly different, but related problem recognising Dragonfly's "oh" alternative for "zero".

Dane Finlay
@Danesprite

I wonder if anyone in this channel would be interested in my enabling Dragonfly's X11 integration to work remotely, e.g. via SSH forwarding. I haven't actually tested it, but I suspect it may work in some environments if the required programs are available locally. Certainly it could be made to work more nicely on Windows and macOS.

It is rather late here, but it seems to me this is an alternative way of achieving what Aenea does: communing with the remote X11 server directly.

Dane Finlay
@Danesprite
I would only be willing to do this for X11 because it already allows this sort of thing. Windows remote desktop, for instance, would be an entirely different matter, I think.
I would be interested in your thoughts on this, @shervinemami, if you have time. :-)
Shervin Emami
@shervinemami
Aenea is still part of my daily setup, so yeah I'm happy to give it a try.
Dane Finlay
@Danesprite

Mine too, at least on my Linux box. I'll see what I can do.

I think this has the potential to be less brittle than Aenea and, perhaps, easier to set up. Much more so if Dragonfly used python-xlib for everything. It would also be much more flexible than Aenea in certain scenarios.

Shervin Emami
@shervinemami
These days I use Aenea in a strange way, I only use it for transferring control & commands between my Windows VM & Linux, I don't use grammars in Aenea anymore.
Dane Finlay
@Danesprite
Oh, okay then. I guess that is related to your use of Autokey shortcuts for the actions?
Shervin Emami
@shervinemami
Oh wow, I looked through my scripts and realised that I don't actually use Aenea anymore! About a year ago I was confident enough about KaldiAG that I ported all my Aenea grammars & plugins to be KaldiAG & AutoHotKey/DNS based, so it could work without an Aenea server. I totally forgot! No wonder I rarely experience crashes these days 😆 At the time, I did also setup
samVanDerStoop
@samVanDerStoop
Hi All, Im very new to dragonfly, trying to get the BringApp action to work but it fails to open the directory when I pass it BringApp("explorer", r"C:\DT\natlink\src\natlinkpy\MacroSystem"). I read it passes to subprocess.Popen so I tried to replicate it in cmd and use subprocess.Popen(["explorer", r"C:\DT\natlink\src\natlinkpy\MacroSystem"]) directly and that DID work. Anyone know what I might be doing wrong with BringApp? I tried passing my args in a list and Ive succesfully used other rules in the grammerfile, but so far no luck with BringApp..