#hazzy Logs
May 17 2020
#hazzy Calendar
12:40 PM hazzy-m: Lcvette I wish, trying to keep drunken idiots from drowning
12:48 PM roguish[m]: hazzy: impossible. think Darwin....
01:08 PM TurBoss: hello
01:52 PM JamesW[m]: Morning all
01:53 PM TurBoss: hello JW
01:55 PM JamesW[m]: Start of another working week
01:55 PM TurBoss: me still on sunday
01:56 PM TurBoss: you are too fast
02:02 PM JamesW[m]: 6;52am here. Radio alarm kicked in.
02:02 PM hazzy-m: JamesW: Morning
02:02 PM TurBoss: hazzy: hello
02:02 PM TurBoss: makes sense to create a INI plugin so rules can use INI options?
02:03 PM hazzy-m: TurBoss: Yes, absolutely!
02:03 PM JamesW[m]: Many of the standard ini options are already exposed via status
02:03 PM TurBoss: coo
02:03 PM TurBoss: l
02:03 PM hazzy-m: there should be a branch with a start of an INI plugin
02:04 PM TurBoss: checking
02:06 PM TurBoss: found
02:07 PM hazzy-m: might not be the best
02:09 PM JamesW[m]: hazzy: is there rule trigger which fires after the UI is fully loaded? So rules that need to fire once UI is fully in place using info that is static from ini values will trigger?
02:12 PM hazzy-m: JamesW: no there is not, but that might be useful
02:14 PM JamesW[m]: Ah - next project. Would also compliment an ini channel
02:16 PM JamesW[m]: Or the work on the ini value plugin/channel needs to have its trigger option operate in that way.
02:18 PM JamesW[m]: Cose that is the wall I hit trying to help Lcvette. There is data in status to drive a rule to set the number axis visible in the ui. Problem is getting a trigger to have it fire. Triggering on itself has it either never firing or firing while UI is still loading and so not making the change.
02:39 PM JamesW[m]: It might be a quirk of the stacked widget. Cose while the rule pattern doesnt work for setting the stacked widget page, seems to behave when using to make a widget visible/hidden. I use that approach for showing/hiding my A axis on my BF20 gui.
02:53 PM hazzy-m: it might depend on when the widget is initialized, and whether the status values change
02:53 PM hazzy-m: one problem with an INI plugin is how much should it make available?
02:54 PM hazzy-m: it would make sense for it to read in all the values from the current INI file and make them available
02:54 PM hazzy-m: but what should happen in designer?
02:54 PM JamesW[m]: hazzy: yup. Exactly the problem .
02:54 PM hazzy-m: when there is no INI in the enviroment
02:55 PM JamesW[m]: You probbaly need a way to spec default values in yaml
02:56 PM JamesW[m]: ?
02:59 PM JamesW[m]: Or have the ini plugin not read everything but read based on a spec in yaml. Whivh means the ui goes looking for what it wants and th designer has an opportunity to set a default for any missing items.
03:00 PM JamesW[m]: Heck, that almost sounds sensible. Lol
03:01 PM hazzy-m: yes, there definitely needs to be an easy way to spec defaults, and add 'handlers'
03:04 PM JamesW[m]: Really comes down to how tightly coupled you want a particular gui design to be to a particular ini shape.
03:06 PM JamesW[m]: If you use yaml as the spec layer you can define ini entries to load and a default if missing.
03:07 PM JamesW[m]: Having in yaml makes it easier for the designer to tweak the defaults for their design/purpose.
04:37 PM Not-944e: [02qtpyvcp] 07KurtJacobson pushed 031 commit to 03VKBRebase [+0/-0/±1] 13https://git.io/JfEqz
04:37 PM Not-944e: [02qtpyvcp] 07KurtJacobson 03734fa94 - fix import
06:10 PM Lcvette: :o
06:13 PM Lcvette: What's that vlb rebase hazzy?
06:13 PM Lcvette: What are you doing in there?
06:16 PM JamesW[m]: VKB - is virtual keyboard I think
06:17 PM JamesW[m]: guys mentioned it a few days ago
06:43 PM Lcvette: Yes, i have avkb branch, just wondering what he's doing in there
06:44 PM Lcvette: Lol
06:44 PM Lcvette: :D
06:44 PM Lcvette: Turboss Wenatchee doing?
06:44 PM Lcvette: Working on ini thing?
07:11 PM TurBoss: yo
07:12 PM TurBoss: I duno how to start
07:12 PM hazzy-m: Lcvette: just updates to make it work on master
07:13 PM hazzy-m: You should update to the rebased branch
07:13 PM * hazzy-m uploaded a video: video_01a811f.mp4 < https://matrix.org/_matrix/media/r0/download/matrix.org/zuMDsBlnLoVsVAvZAJBYnGDr >
07:14 PM hazzy-m: Same VKBs, just work with master
07:15 PM JamesW[m]: oh that is slick
07:16 PM TurBoss: cool
07:16 PM TurBoss: hazzy: any points on how to start the ini plugin?
07:23 PM JamesW[m]: hazzy: a variation of the above, is there a way I can do a single shot force update to either selected or all data channels in the status plugin?
07:24 PM JamesW[m]: e.g. if I wanted to force status:axis to update (recheck it's state and publish a change event even though it has not changed).
07:25 PM JamesW[m]: been reading through the plugin.py and status.py
07:25 PM JamesW[m]: I kind of have a feel for what is happening but just not quite clicked yet
07:27 PM Lcvette: hazzy: great!
07:28 PM hazzy-m: JamesW: you could force an update by clearing the value in the status.old dictionary
07:28 PM Lcvette: Are you looking at where it pops up when activated?
07:29 PM JamesW[m]: oh - and the polling event will react to that?
07:29 PM Lcvette: Or adding a label/linec edit at the tip of the vkb to see what your typing?
07:29 PM hazzy-m: status.old['axes'] = None
07:29 PM Lcvette: * Or adding a label/lineedit at the tip of the vkb to see what your typing?
07:29 PM hazzy-m: JamesW: yes, on the next cycle (50ms) it will update
07:30 PM JamesW[m]: cool - so would be trivial to expose that as a standard method
07:30 PM hazzy-m: Yes, probably a good idea
07:31 PM JamesW[m]: I'll do some more reading to make sure I am clear on what it happening. Will be easier know I know what to look for.
07:31 PM JamesW[m]: might sprinkle some print state,emts about so can see what is going on.
07:32 PM JamesW[m]: But a generic force_update(channel) type method could be useful.
07:33 PM JamesW[m]: I could then plonk that in a suitable initialise method to drive and update post the plugin class init and after the gui is all in place
07:34 PM JamesW[m]: which should (fingers crossed) allow good use of rules being able to adjust display as part of start up values in status,.
07:34 PM JamesW[m]: If info plugin makes it redundant then small change and easy to delet
07:34 PM JamesW[m]: off to play :D
07:39 PM JamesW[m]: poop - that key errors
07:42 PM JamesW[m]: hmmm ... think it might be axis_mask
07:42 PM JamesW[m]: ah! typo. idiot
07:44 PM JamesW[m]: WORKS!!!
07:44 PM JamesW[m]: wicked
07:44 PM TurBoss: hurray!
07:45 PM * TurBoss sent a long message: < https://matrix.org/_matrix/media/r0/download/matrix.org/dvYDVPlNOwHSvGgciPVGqIqi >
07:45 PM TurBoss: also hurray
07:46 PM hazzy-m: TurBoss: how did you do that?
07:46 PM hazzy-m: Sweet!
07:46 PM JamesW[m]: so the brutal way to force any items that are static in nature on the status plugin's class init but which you want to force an update event so gui rules to drive initial layout fire is to add any static items like axes or axis_mask ti the inialize() method with a self.old['xxxxx'] = None
07:46 PM TurBoss: python ConfigParser
07:46 PM TurBoss: :P
07:47 PM JamesW[m]: what's that doing TurBoss?
07:47 PM TurBoss: gets ini sections
07:48 PM * TurBoss sent a long message: < https://matrix.org/_matrix/media/r0/download/matrix.org/EunhossnoNTpaSzhCETvOMKS >
07:48 PM JamesW[m]: nice - rocking along
07:49 PM Lcvette: Turboss that's awesome!
07:49 PM JamesW[m]: so the think to be aware of is that you need to force a one of update even in the Initalise() method so that the GUI can react
07:49 PM JamesW[m]: * so the think to be aware of is that you need to force a one off update even in the Initalise() method so that the GUI can react
07:49 PM Lcvette: JamesW: I'm lost?..lol
07:50 PM Lcvette: You guys are taking code
07:50 PM JamesW[m]: TurBoss: should know what I mean
07:50 PM TurBoss: not sure... sorry
07:50 PM TurBoss: me sometime is idiot
07:50 PM JamesW[m]: I just proved the pattern on my dev box. Getting a rule using status:axes as the trigger channel to drive a statcked widget page display.
07:51 PM TurBoss: * me sometimes is idiot
07:52 PM JamesW[m]: TurBoss: when a plugin loads all its data at the start it is not driving an update even that widget rules can trigger off. In the initialise() method where an update timer is normally setup you need to reset all the channels you want refreshed to None
07:52 PM Lcvette: /o\
07:53 PM JamesW[m]: this forces an update event to fire that the gui rules that are listening to that event will operate off.
07:54 PM JamesW[m]: I think you only need one so a single shot update event should do the job. Given the ini file can not change post start up no need to have it continually polled
07:56 PM JamesW[m]: Obviously for many things in the Status plugin their data is changing so the update events are firing often. But status:axes never changes as it is loaded from ini. So if you want a rule to react to that value on gui start you need to force that event in some manner. That was what I was asking hazzy about a little further up the conversaions timeline
07:57 PM TurBoss: ahhhhh
07:57 PM JamesW[m]: I just proved it worked on my dev box by putting self.status{'axes'] = None in the status.py iniitlasie() method. The rule I had on a stacked widget then recognised the trigger event and change the displated page correctly on startup. Before then it didnt work
07:57 PM JamesW[m]: cose the trigger event for the rule never happened
07:58 PM TurBoss: you mean that by default if someting is static doesn't trigger the rule?
07:58 PM TurBoss: sorry my english is not very fluid
07:59 PM JamesW[m]: looks that way. OR if the an event is triggered it is happening before the gui is loaded
07:59 PM JamesW[m]: * looks that way. OR if the event is triggered it is happening before the gui is loaded
07:59 PM TurBoss: ohhhhh
07:59 PM JamesW[m]: either way the effect is the same
07:59 PM TurBoss: yup
08:00 PM * JamesW[m] sent a long message: < https://matrix.org/_matrix/media/r0/download/matrix.org/ZFskePprJaUXKqbRlSNFuAZo >
08:00 PM TurBoss: so maybe initialise is called to early?
08:00 PM JamesW[m]: here is the tweaked method from status.py
08:00 PM JamesW[m]: you can see my additio at the bottom
08:01 PM TurBoss: yes I see
08:01 PM TurBoss: so now there is a change
08:01 PM JamesW[m]: this was my proof hack :)
08:01 PM TurBoss: and triggers the rule
08:01 PM JamesW[m]: correct
08:01 PM JamesW[m]: the timer event will see the change and force and update
08:01 PM JamesW[m]: * the timer event will see the change and force an update
08:02 PM TurBoss: maybe do it for all old elements
08:02 PM TurBoss: with a loop
08:02 PM TurBoss: so thats the status .py file correct?
08:02 PM JamesW[m]: no for yout ini plugin you might not need an on going timer as the values are not changing. But you will to force one update event across the board
08:03 PM JamesW[m]: correct - status.py
08:04 PM JamesW[m]: sorry - enough yacking by me. Hopefully I've not confused things too much
08:04 PM TurBoss: if we don't need the ini plugin I can drop it
08:04 PM JamesW[m]: that would be a hazzy question
08:04 PM JamesW[m]: I do not think everything is in the status plugin
08:05 PM TurBoss: ok
08:06 PM TurBoss: JamesW: does this make any sense?
08:06 PM * TurBoss sent a long message: < https://matrix.org/_matrix/media/r0/download/matrix.org/hOJSSyrsPWeoMLEpkamszvDP >
08:07 PM TurBoss: or maybe init the dictionary with None by default
08:07 PM JamesW[m]: That would definitely force everything to update on mass
08:07 PM JamesW[m]: Not sure about killing the dictionary
08:08 PM JamesW[m]: The key reset looks good though
08:08 PM JamesW[m]: A single shot, update everything after gui load.
08:09 PM TurBoss: we have the postgui call somewhere
08:09 PM JamesW[m]: for Hal? Or something else?
08:10 PM TurBoss: add somethin next to it to trigger the reset
08:10 PM TurBoss: anyway I thinw I'm messing
08:26 PM JamesW[m]: would be careful on that loop TurBoss: I just tried it and got errors on gui startup. Think need to be careful what things are getting reset in that manner
08:27 PM TurBoss: ok
08:30 PM JamesW[m]: it might be there are more complex data structures under the key which need to be intack for the updating channel to work with
08:30 PM JamesW[m]: in some cases
08:32 PM JamesW[m]: for you ini plugin you will have visibility of that so can decide on what is the best path .
08:35 PM TurBoss: having issues trying to read the ini
08:35 PM TurBoss: with duplicated options like halfile
09:37 PM hazzy-m: TurBoss: yes, I remember the multiple entries got me before
09:38 PM hazzy-m: a workaround might be to get the INI sections and options with ConfigParser, and then use linuxcnc.ini to find the actual values ...
09:38 PM TurBoss: py3 can handle
09:38 PM TurBoss: :/
09:38 PM hazzy-m: not very neat, but should work
09:38 PM hazzy-m: Oh, nice!
09:38 PM TurBoss: oki
09:39 PM hazzy-m: I noticed there are a lot of changes in the Py3 ConfigParser, tripped me up win working on hazzy since I was reading the wring docs lol
09:40 PM TurBoss: lul
09:45 PM * TurBoss sent a long message: < https://matrix.org/_matrix/media/r0/download/matrix.org/SYGtxuusxGiuvAWglLAOItnF >
09:45 PM TurBoss: got this
09:46 PM TurBoss: the last item of halfile list is wrong
09:49 PM Not-944e: [02qtpyvcp] 07TurBoss pushed 031 commit to 03ini_plugin [+1/-0/±0] 13https://git.io/JfEcN
09:49 PM Not-944e: [02qtpyvcp] 07TurBoss 03467e6d4 - try 1
09:49 PM Not-944e: [02qtpyvcp] 07TurBoss created branch 03ini_plugin - 13https://git.io/fhCou
09:54 PM TurBoss: got it
09:55 PM Not-944e: [02qtpyvcp] 07TurBoss pushed 031 commit to 03ini_plugin [+0/-0/±1] 13https://git.io/JfECn
09:55 PM Not-944e: [02qtpyvcp] 07TurBoss 03407381b - get all duplicate options correctly
10:06 PM hazzy-m: sweet!
10:07 PM hazzy-m: I don't think you even need to use a data channel
10:07 PM hazzy-m: override the DataPlugin's getChannel method to return a the value from the dictionary
10:07 PM hazzy-m: the values will never change, so no need to emit signals
10:07 PM TurBoss: ok
10:07 PM hazzy-m: hmm..
10:08 PM JamesW[m]: really?
10:08 PM JamesW[m]: how will that trigger a rule?
10:08 PM hazzy-m: there needs to be some way to convert numeric values to int and float
10:09 PM TurBoss: JW not sure yet xD
10:09 PM hazzy-m: JamesW: when a rule is initialized the value returned by the getChannel method is emited to perform the initial update
10:10 PM * TurBoss sent a long message: < https://matrix.org/_matrix/media/r0/download/matrix.org/rMFENeZWIcRISGwlUgQzrkLG >
10:10 PM hazzy-m: so it should not be necessary for each INI items to be able to emit signals, I think
10:10 PM hazzy-m: TurBoss: yet
10:10 PM JamesW[m]: <hazzy-m "JamesW: when a rule is initializ"> Ok - but then why do rules that adjust the GUI based on a static value not work on GUI load?
10:11 PM JamesW[m]: cose it looks like the rule iitialise happens before gui is in place. At least that is the way it looks based on what is happening
10:11 PM hazzy-m: getChannel should return a tuple containing the channels value and a reference to a value getter method, or (None, None)
10:13 PM hazzy-m: JamesW: I need to investigate further why the initial update is not working for the stacked widget, I think it might be because you can't change the current page before the widget is shown
10:13 PM JamesW[m]: ok - all can I do is reference what wrote several hours ago as to the beahviours I was seeing and what tweak (status['axes']=none) got thr right behaviour
10:14 PM hazzy-m: Yes, that was very clear description of the problem, and I have been mulling over why it might be happening
10:15 PM TurBoss: 🤔
10:15 PM hazzy-m: TurBoss: https://github.com/kcjengr/qtpyvcp/blob/master/qtpyvcp/plugins/settings.py#L23
10:15 PM hazzy-m: example
10:15 PM TurBoss: cool thanks
10:16 PM hazzy-m: it's been a long day, and early work day tomorrow
10:16 PM * hazzy-m must sleep
10:16 PM hazzy-m: gn8
10:17 PM TurBoss: n8
10:25 PM JamesW[m]: nite
10:40 PM Lcvette: Nite
10:40 PM Lcvette: o/