dmroeder / pylogix

Read/Write data from Allen Bradley Compact/Control Logix PLC's
Apache License 2.0
598 stars 182 forks source link

Bug fix and additional updates to 81_simple_gui.py file #161

Closed GitHubDragonFly closed 3 years ago

GitHubDragonFly commented 3 years ago

Short description of change

Bug fix + new feature + additional error checking

Types of changes

What is the change?

What does it fix/add?

Bug that was introduced by using comma for separating multiple tags

Test Configuration

TheFern2 commented 3 years ago

Actually this brings up a good point. I think the UI itself should have information about how to read multiple tags either above the input box or a instructions pop up.

At first glance it might not be too obvious that multiple tag read is supported through the ui.

GitHubDragonFly commented 3 years ago

The label above the listbox states "Tag(s) to Read".

I have just made the following changes for further clarification:

Users should be able to edit the file and see the comments.

GitHubDragonFly commented 3 years ago

Another comment could possibly be added to the file, similar to this:

See the screenshots here: https://github.com/dmroeder/pylogix/issues/156

GitHubDragonFly commented 3 years ago

All together, this example app is intended to be used for quick testing.

Anybody looking for any prolonged usage would probably need to modify the app to their liking.

GitHubDragonFly commented 3 years ago

If you want more description visible on the GUI then consider changing the text of the label above the listbox, which now states "Tag(s) to Read" but can be changed to anything else, maybe "Single tag or Multiple tags separated by semicolon".

TheFern2 commented 3 years ago

Yeah I'll see how it looks when I get power back, but I think just a quick example(s) like on the comment would be better on the UI. We're on rotating blackouts in Texas right now.

GitHubDragonFly commented 3 years ago

There are 2 new checkboxes added to allow saving tags list and tag(s) values to separate files within the app's folder.

TheFern2 commented 3 years ago

Thanks for the PR, a couple of bugs:

image

image

image

Some improvements that the GUI could benefit from, these are not bugs and are optional, as long as bugs are fixed we can merge PR:

GitHubDragonFly commented 3 years ago

This app does nothing else but pass tag(s) to the library for reading, and this is based on the examples you have in the repo.

1) It reads STRING values for me 2) Complex tags not being allowed to be packed in a list is the library issue 3) Save tags list checkbox does work since it is set to put a check mark after the tooltip is shown (just click the tooltip or outside of it and look at the checkbox).

Here is what I can suggest:

TheFern2 commented 3 years ago

This app does nothing else but pass tag(s) to the library for reading, and this is based on the examples you have in the repo.

1. It reads STRING values for me

2. Complex tags not being allowed to be packed in a list is the library issue

3. Save tags list checkbox does work since it is set to put a check mark after the tooltip is shown (just click the tooltip or outside of it and look at the checkbox).

Here is what I can suggest:

* If there is an exception thrown while reading then it should now show in the tag value list box

* If there is no exception and no value showing then it normally means that tag is incorrect or not supported

* You need to consider updating your lgx_comm.py file and take a look at the error I posted here: #156

* The mentioned error seems to be randomly happening, dependent on when the "Stop Update" is clicked, probably not letting the library process the last request.

Fair enough on the complex tags, I actually don't use them much on my projects, but I thought they were implemented on lists. I was able to read Strings not unsure what happened earlier. Error handling is much better now. Only issue remaining is the checkbox, see video below I clicked all over and nothing. I am on Linux, so it could be an OS issue, but the other two checkboxes seem to check just fine.

https://www.dropbox.com/s/ui6m76br87ccek0/2021-02-19_15-13-17.mov?dl=0

GitHubDragonFly commented 3 years ago

Try swapping the bottom 2 lines in this function:

def save_tags_list(event, chbSaveTags): if checkVarSaveTags.get() == 0: popup_menu_save_tags_list.post(event.x_root, event.y_root) checkVarSaveTags.set(1)

It should set a check mark before it pops up the tooltip. If that doesn't work then Linux just doesn't support setting the state of the tkinter checkbox programmatically. The only solution for this would be to remove the binding and not show the tooltip (users would need to be aware that tags list is saved only after the checkbox is checked and later the Get Tags button is clicked).

You also seem to be getting those errors I mentioned displayed in the tag value box. If you try updating the lgx_comm.py file with the solution I mentioned then you will know if it works or not.

GitHubDragonFly commented 3 years ago

Here is another possible solution:

replace checkVarSaveTags.set(1) with chbSaveTags.select()

GitHubDragonFly commented 3 years ago

This last commit seems to work properly in Linux.

GitHubDragonFly commented 3 years ago

This last commit is an attempt to eliminate those odd errors causing the exception thrown when reading tags.

You might not need to make any changes to the lgx_comm.py file after all.

TheFern2 commented 3 years ago

This last commit is an attempt to eliminate those odd errors causing the exception thrown when reading tags.

You might not need to make any changes to the lgx_comm.py file after all.

Awesome everything looks good, thanks for the hard work. Lots of people will benefit from this GUI for quick testing for sure. :+1: