Skip to content

Conversation

@ssweber
Copy link
Collaborator

@ssweber ssweber commented May 16, 2023

See below for up-to-date video.

ssweber added 17 commits May 16, 2023 16:19
I changed to datetime as dt so we can do

isinstance(value, dt.date)

before isinstance(value, date)
or isinstance(value, datetime.date) doesn't work
This fills in sg.Text if it has a fk-relationship
Don't compare it in records_changed
Add an empty col in place of the required_marker
Go ahead and cast the table_value, since we maybe comparing dates, and table_value will be a str since Sqlite stores them as such.
This fills in description_column if col has fk-rels. Also simplified logic
This currently isn't integrated in any auto-logic, but user could do:

# Add a placeholder to the search input
ss.add_placeholder_to(
    win["Orders:search_input"],
    "🔍 Search...",
)

I'll add a video for it.
@ssweber
Copy link
Collaborator Author

ssweber commented May 16, 2023

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.

  • Logo
  • major features bullet points
  • then short video.

@ssweber ssweber changed the title WIP, broken out in commits Enhancements for TableHeadings & CellEdit, also various fixes and new examples May 16, 2023
@PySimpleSQL
Copy link
Owner

PySimpleSQL commented May 29, 2023 via email

@PySimpleSQL
Copy link
Owner

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
Copy link
Collaborator Author

ssweber commented May 29, 2023

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
Copy link
Collaborator Author

ssweber commented May 29, 2023

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

@ssweber
Copy link
Collaborator Author

ssweber commented May 29, 2023

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

@PySimpleSQL
Copy link
Owner

PySimpleSQL commented May 29, 2023 via email

@ssweber
Copy link
Collaborator Author

ssweber commented May 29, 2023

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

@ssweber
Copy link
Collaborator Author

ssweber commented May 29, 2023

Sorry to hear things have been so rough.

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

@PySimpleSQL
Copy link
Owner

PySimpleSQL commented May 29, 2023 via email

@ssweber
Copy link
Collaborator Author

ssweber commented May 29, 2023

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

@PySimpleSQL
Copy link
Owner

PySimpleSQL commented May 29, 2023 via email

@PySimpleSQL
Copy link
Owner

PySimpleSQL commented May 29, 2023 via email

@ssweber
Copy link
Collaborator Author

ssweber commented May 29, 2023

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
Copy link
Collaborator Author

ssweber commented May 29, 2023

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

@ssweber
Copy link
Collaborator Author

ssweber commented May 29, 2023

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
Copy link
Collaborator Author

ssweber commented May 29, 2023

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
Copy link
Collaborator Author

ssweber commented May 29, 2023

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

  • subclassed the Input, put a reference to self.dataset, on key-release update_selectors(self.key), and wrote string to dataset.search_string
  • table_values creates a mask for rows where search_order columns contain dataset.search_string.

@ssweber
Copy link
Collaborator Author

ssweber commented May 30, 2023

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.

@ssweber ssweber closed this May 30, 2023
@ssweber ssweber deleted the wip-logically branch May 30, 2023 13:40
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

Successfully merging this pull request may close these issues.

3 participants