PySimpleSQL / pysimplesql

SQLite3 binding for PySimpleGUI
GNU Lesser General Public License v3.0
45 stars 16 forks source link

Enhancements for TableHeadings & CellEdit, Placeholders, autocomplete combo, various fixes and new examples #313

Closed ssweber closed 1 year ago

ssweber commented 1 year ago

See below for up-to-date video.

ssweber commented 1 year ago

This fixes most of the things I saw when building the “orders.py” sqlite example.

I tried to break them out in comments, but if there’s something you’d like explained or changed, let me know!

I’d like your thoughts on the order example, in general, and if you’re OK on using it (in an annotated video) in the readme.

ssweber commented 1 year ago

Here's a video of all this functionality put together:

https://github.com/PySimpleSQL/pysimplesql/assets/57631333/59560e1a-9daa-4c43-aae6-45c4ffd9a699

ssweber commented 1 year ago

I cleaned up quick_editor as well. This one doesn't show it, but I added fk sg.combos and checkboxes automatically,

https://github.com/PySimpleSQL/pysimplesql/assets/57631333/ccd5f2a3-9bb9-4a91-a53b-9cc483ce6e94

ssweber commented 1 year ago

I’m feeling pretty good about how things are shaping up. It makes for a great presentation of features! I’m going to take a stab at subclassing sg.Combo to integrate an Autocomplete combobox tomorrow, but then I should be all clear to knocking out the readme 🚀

ssweber commented 1 year ago

@PySimpleSQL, I'm sure you're slammed on another 100+ hour week, but you'll get a kick out of this autocomplete combobox:

https://github.com/PySimpleSQL/pysimplesql/assets/57631333/d7aa82f7-0868-4df3-9740-56a9152d0a3d

ssweber commented 1 year ago

I'm pretty much done here. I'll move onto the Readme.

ssweber commented 1 year ago

Here's the new Input placeholder behavior (I didn't rewrite the Multiline yet)

https://github.com/PySimpleSQL/pysimplesql/assets/57631333/97527b08-021d-4cdc-9312-23fd7bcb9e02

PySimpleSQL commented 1 year ago

Regarding the new search - does it wrap around like the original version? I'm hoping to get a chance to actually test it tonight, I just figured I would ask while I was thinking about it

On Tue, May 16, 2023 at 5:24 PM ssweber @.***> wrote:

Forgot I videoed that in #312 https://github.com/PySimpleSQL/pysimplesql/issues/312

— Reply to this email directly, view it on GitHub https://github.com/PySimpleSQL/pysimplesql/pull/313#issuecomment-1550372245, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQX2REU3GH7EECJ4S3ILQ53XGPV7HANCNFSM6AAAAAAYEFTDIU . You are receiving this because you are subscribed to this thread.Message ID: @.***>

PySimpleSQL commented 1 year ago

I pulled your WIP branch. Unfortunately, nothing at all is working for me. I wonder if there are some cross-platform issues happening, since I'm running Linux.

/home/jondecker76/PycharmProjects/pysimplesql/venv/bin/python /home/jondecker76/PycharmProjects/pysimplesql/examples/SQLite_examples/journal_external.py ***** pysimplesql update from develop to 2.3.0 (released 2023-02-04 00:19:56) available! Be sure to run pip3 install pysimplesql --upgrade ***** INFO:pysimplesql.pysimplesql:Opening database: Journal.db INFO:pysimplesql.pysimplesql:Automatically generating dataset for each table in the sqlite database INFO:pysimplesql.pysimplesql:Automatically adding foreign key relationships INFO:pysimplesql.pysimplesql:Requerying all datasets INFO:pysimplesql.pysimplesql:Executing query: SELECT "Journal".* FROM "Journal" LEFT JOIN "Mood" ON "Journal"."mood_id"="Mood"."id" ORDER BY "title" ASC None INFO:pysimplesql.pysimplesql:Executing query: SELECT "Mood".* FROM "Mood" ORDER BY "name" ASC None INFO:pysimplesql.pysimplesql:Binding Window to Form INFO:pysimplesql.pysimplesql:Automapping elements Traceback (most recent call last): File "/home/jondecker76/PycharmProjects/pysimplesql/examples/SQLite_examples/journal_external.py", line 31, in <module> frm = ss.Form(driver, bind_window=win) # <=== Here is the magic! File "/home/jondecker76/PycharmProjects/pysimplesql/pysimplesql/pysimplesql.py", line 3007, in __init__ self.bind(self.window) File "/home/jondecker76/PycharmProjects/pysimplesql/pysimplesql/pysimplesql.py", line 3051, in bind self.auto_map_elements(win) File "/home/jondecker76/PycharmProjects/pysimplesql/pysimplesql/pysimplesql.py", line 3419, in auto_map_elements element.add_placeholder( File "/home/jondecker76/PycharmProjects/pysimplesql/pysimplesql/pysimplesql.py", line 5305, in add_placeholder self._add_binds() File "/home/jondecker76/PycharmProjects/pysimplesql/pysimplesql/pysimplesql.py", line 5425, in _add_binds self.binds[event] = widget.bind(event, disable_placeholder_select, "+") File "/usr/lib/python3.10/tkinter/__init__.py", line 1421, in bind return self._bind(('bind', self._w), sequence, func, add) File "/usr/lib/python3.10/tkinter/__init__.py", line 1375, in _bind self.tk.call(what + (sequence, cmd)) _tkinter.TclError: bad event type or keysym "/"

I'm going to keep combing through all of your updates so I can try to catch up.

ssweber commented 1 year ago

really good to hear from you! I was starting to worry and miss your feedback.

If you’d like, just comment out the “add_placeholder” call in auto_map_elements, there must be something different on Linux/ or your version of tkinter.

The “new search” still starts with the first search order column, then second, etc until it finds a match. I just reworked it to map the description column.

ssweber commented 1 year ago

Looks like it doesn’t like this bind <Control-/> - we could delete that, very unusually for someone to use that over ctrl-a

ssweber commented 1 year ago

GitHub doesn’t like me posting it. Let’s try this again <Control-/>

PySimpleSQL commented 1 year ago

Yeah, sorry about not checking in. Its been pretty rough. Things are starting to clear up at work, so that will help a lot

I commented out lines 3590-3593 as well as lines24 and 5425 and can get the examples to run.

I tried testing the search but didn't have any luck as of yet

On Sun, May 28, 2023 at 9:47 PM ssweber @.***> wrote:

GitHub doesn’t like me posting it. Let’s try this again

— Reply to this email directly, view it on GitHub https://github.com/PySimpleSQL/pysimplesql/pull/313#issuecomment-1566374636, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQX2REQ2EQ773B6U7ZQIDZDXIP5ZRANCNFSM6AAAAAAYEFTDIU . You are receiving this because you were mentioned.Message ID: @.***>

ssweber commented 1 year ago

Weird! Ok, looks like I need to get a Linux / alternative Python versions to test with setup going.

ssweber commented 1 year ago

Sorry to hear things have been so rough.

Do you like the functionality as videoed? I will have some time tomorrow to debug

PySimpleSQL commented 1 year ago

Yes, your demo is awesome. I definitely like the way it looks and operates.

Hopefully it won't take much to get things running well on Linux as well. I'm sure it's something simple

On Sun, May 28, 2023 at 10:02 PM ssweber @.***> wrote:

Sorry to hear things have been so rough.

Do you like the functionality as videoed? I will have some time tomorrow to debug

— Reply to this email directly, view it on GitHub https://github.com/PySimpleSQL/pysimplesql/pull/313#issuecomment-1566385537, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQX2REVPXKEDAEFHWTSFL23XIP7SBANCNFSM6AAAAAAYEFTDIU . You are receiving this because you were mentioned.Message ID: @.***>

ssweber commented 1 year ago

Awesome. Ok I’m off for the night. If you figure it out great, otherwise I’ll look into it tomorrow. 😄

PySimpleSQL commented 1 year ago

Regarding the error on line 5424, I replaced "" with "" and that now works with Linux (and I would think it would work with Windows too).

I'll mess around a little more tonight on the other issue. I'm pretty far behind, so I'm going to have to get familiar with the new additions

On Sun, May 28, 2023 at 10:12 PM ssweber @.***> wrote:

Awesome. Ok I’m off for the night. If you figure it out great, otherwise I’ll look into it tomorrow. 😄

— Reply to this email directly, view it on GitHub https://github.com/PySimpleSQL/pysimplesql/pull/313#issuecomment-1566394964, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQX2REQBLZRZXFJJINM7RELXIQAZ7ANCNFSM6AAAAAAYEFTDIU . You are receiving this because you were mentioned.Message ID: @.***>

PySimpleSQL commented 1 year ago

Putting this here for reference:

Line 3590 is the other issue with an AttributeError: 'Input' object has no attribute 'add_placeholder'

Traceback (most recent call last): File "/home/jondecker76/PycharmProjects/pysimplesql/examples/SQLite_examples/journal_external.py", line 31, in frm = ss.Form(driver, bind_window=win) # <=== Here is the magic! File "/home/jondecker76/PycharmProjects/pysimplesql/pysimplesql/pysimplesql.py", line 3007, in init self.bind(self.window) File "/home/jondecker76/PycharmProjects/pysimplesql/pysimplesql/pysimplesql.py", line 3052, in bind self.auto_map_events(win) File "/home/jondecker76/PycharmProjects/pysimplesql/pysimplesql/pysimplesql.py", line 3590, in auto_map_events self.window[search_box].add_placeholder( AttributeError: 'Input' object has no attribute 'add_placeholder'

Process finished with exit code 1

On Sun, May 28, 2023 at 10:15 PM Jon Decker @.***> wrote:

Regarding the error on line 5424, I replaced "" with "" and that now works with Linux (and I would think it would work with Windows too).

I'll mess around a little more tonight on the other issue. I'm pretty far behind, so I'm going to have to get familiar with the new additions

On Sun, May 28, 2023 at 10:12 PM ssweber @.***> wrote:

Awesome. Ok I’m off for the night. If you figure it out great, otherwise I’ll look into it tomorrow. 😄

— Reply to this email directly, view it on GitHub https://github.com/PySimpleSQL/pysimplesql/pull/313#issuecomment-1566394964, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQX2REQBLZRZXFJJINM7RELXIQAZ7ANCNFSM6AAAAAAYEFTDIU . You are receiving this because you were mentioned.Message ID: @.***>

ssweber commented 1 year ago

Sorry to waste your time. That’s fixed now, and it seems tkinter on windows is happy with the Control-slash too!

I was only testing on the orders.py example, which uses an image for the search button, so I forgot to change the other layout else to use the subclassed Input instead of sg.Input. I really need to learn my lesson on testing with the other examples!

we probably should rename Combo -> AutocompleteCombo, and Input/Multiline to EnhancedInput/EnhancedMline for debugging purposes.

Thoughts on names for Input/Multiline? Right now they are only enhanced to support placeholders, but I’ll want to add type/length ability in the future. (eg only allow a two-digit int, a float, add dashes in-between dates as you type, etc)

ssweber commented 1 year ago

I tested the journal-internal, and it seems like search is working as intended, but let me know 😅

ssweber commented 1 year ago

I’m sorry, no, I didn’t understand how search worked before: “Successive calls will search from the current position, and wrap around back to the beginning.” I will either revert, and add back in the description-column mapping, or see how to accomplish using new method.

Need to read a bit more carefully

ssweber commented 1 year ago

Honestly, maybe what I’ll do is fix that, and then do a fresh pull request that again try’s to consolidate the different changes. I’ve rewritten things several times in this branch, so it’s not very clean anymore

ssweber commented 1 year ago

Let me know if you like #320 better than what we have now. I think we’d make a @property DataSet.filtered_rows, that tables/combo/listbox/slider selectors would get their rows from.

for the filter example I

ssweber commented 1 year ago

Tomorrow I’ll try to get up an easier-to-review PR, without all the in-between rewrites, and no code-reorganizing.

…as well as make sure I got search right this time.