Commit 7e82cce
committed
Squashed version of inf-wx-begone
commit 90c652e
Author: Infernio <infernio@icloud.com>
Date: Sat Nov 23 05:41:56 2019 +0100
Improve patcher GUI appearance
Adds a bunch of spacing so that the components look less 'squished
together'.
commit abe3630
Author: Infernio <infernio@icloud.com>
Date: Sat Aug 24 20:44:34 2019 +0200
Use the new WebViewer everywhere
Also makes all arrow buttons for all HTML viewers behave correctly and
adds a reload button to all those HTML viewers.
commit ef48ca5
Author: Infernio <infernio@icloud.com>
Date: Sat Aug 24 20:27:12 2019 +0200
Wrap wx.html2.WebView as WebViewer
Nicely hides the html2 import ugliness and can abstract away some
annoyances (e.g. disabling the forward / back buttons, turning file
paths into 'file:' URLs, etc.).
Had to do the reload button using a really ugly hack. Also, until we're
on wx4, everything but the doc browser will have a single annoying
'about:blank' entry in its history (the doc browser takes long enough to
load that it doesn't happen there). On wx4, we can clean those entries
out of the history manually.
Note: I switched StartURL for webbrowser.open - didn't want gui to
import windows.py, that sounded like a really weird dependency.
commit eae9ef8
Author: Infernio <infernio@icloud.com>
Date: Sat Aug 24 17:24:42 2019 +0200
Allow components as parents
Introduces a new method, _AComponent._resolve(), which resolves an
object down to a wx object (returning either the object itself or
_native_widget for components). We then call this method at the wx
boundary when constructing the wx objects, allowing either wx objects
or components as parents.
Can and should be dropped in favor of simply returning _native_widget
for everything once wrapping is completely finished.
commit eac3ec4
Author: Infernio <infernio@icloud.com>
Date: Sat Aug 24 17:04:38 2019 +0200
Rename 'widget' to 'component' everywhere
In terms of terminology, we want to distance ourselves from wx as much
as possible, so that code using the new gui framework immediately looks
different than the previous code using wx.
commit 8b41dd0
Author: Infernio <infernio@icloud.com>
Date: Sat Aug 24 13:13:08 2019 +0200
Make the doc browser fully functional
Back/Forwards buttons are now properly enabled / disabled only when we
actually have a page to go back / forwards to. This prevents the crash
that was previously happening if you tried to go forwards when there was
nothing to go forwards to.
Wrapping WebView would be nice and would allow us to offload some
complexity, as well as bringing the same improvements to the mod
checker.
commit e21788b
Author: Infernio <infernio@icloud.com>
Date: Wed Aug 21 17:25:34 2019 +0200
Wrap all BitmapButton usages
This was way more painful and difficult than I imagined, mostly due to
this code bleeding into balt.DnDStatusBar, which _has_ to be the next
step in wrapping. It's full of _native_widget hacks now :(
Some steps that were needed in the process:
- _AWidget had to learn how to change widget positions, since the
status bar needs to do that to spread out the buttons. Alternatively,
I could have reworked the status bar to use an HLayout, but that
seemed like even more work...
- Button had to learn how to handle right clicks, since the status bar
buttons use that to create custom context menus.
- Button had to learn how to hide borders and resize itself to exactly
match its contents, since status bar buttons use this to create the
illusion that they are 'clickable images'.
- Finally, some utility classes wrapping the more complex abstractions
had to be created (e.g. ClickableImage, ForwardButton, etc.).
On the bright side, the new ImageButton classes are much more powerful
than the old balt.bitmapButton stuff. They behave just like regular
buttons with images on them, meaning that they can even have text AND
images, in one of four different orientations.
Simplify ImageButton hierarchy
Gets rid of ImageButtonL, R, B and T in favor of just ImageButton. We
probably won't need the directions and even if we do, reintroducing them
as a parameter is far smarter and easier.
Drop hacky code in DnDStatusBar
This bug does not seem to happen with wx.Button - in fact, we now get a
double click since the hack fires a second event. I'm *extremely* happy
about being able to drop this, DnDStatusBar is an absolute nightmare, so
any simplification in it is *very* welcome.
commit d75ea9b
Author: Infernio <infernio@icloud.com>
Date: Wed Aug 21 03:35:06 2019 +0200
Rename more parameters to avoid bad names
Fix crash due to missed rename
commit bdf3111
Author: Infernio <infernio@icloud.com>
Date: Wed Aug 21 01:54:22 2019 +0200
Transition EVT_CHECKBOX usages to new event framework
commit c2650fa
Author: Infernio <infernio@icloud.com>
Date: Wed Aug 21 00:15:36 2019 +0200
Delete ToggleButton, replace with CheckBox
Much better from a UI design standpoint, checkboxes are way more
intuitive since you can actually distinguish them from regular buttons.
Also features some slight restructuring to the doc browser GUI to make
it look better with the new checkbox.
commit 9cb5cb6
Author: Infernio <infernio@icloud.com>
Date: Tue Aug 20 23:40:30 2019 +0200
Transition EVT_BUTTON usages to new event framework
Also managed to get rid of all onButClickEventful usages. Turns out that
_every single one_ of those was just using the event to do event.Skip(),
which is of course entirely unneeded with the new event system.
Mention Button events documentation in other button's docstrings
Probably should break all the button classes out into a new file.
commit b165c31
Author: Infernio <infernio@icloud.com>
Date: Sun Aug 18 02:52:32 2019 +0200
Transition EVT_TEXT usages to new event framework
Entirely untested, there are probably tons of loops and whatnot in here
Also revived the maxChars usages, since TextArea now has the max_length
parameter too.
Fix 'Create New Project' cryptically erroring
We already were binding to to this using the new event framework up
above. I really need to get rid of the set_event_hook() stuff, it's one
of nycz's earliest (and therefore crappiest) wrappers.
Add EVT_KILL_FOCUS and EVT_CONTEXT_MENU wrappers
Allows us to swallow a few more event.Skip()'s as well.
Return EventResult.FINISH for bash tags menu
Otherwise the default text menu appears after applying a tag.
Drop unused balt.Events constants
Bad wrapper, we're trying to put it to rest in favor of EventHandler. So
dropping all constants that have been obsoleted by the refactoring thus
far.
commit dab3025
Author: Infernio <infernio@icloud.com>
Date: Wed Aug 21 00:16:07 2019 +0200
Improve Mod Checker button layout
Makes it slightly more intuitive and nicer to look at.
commit de2eb7f
Author: Infernio <infernio@icloud.com>
Date: Sat Aug 17 20:26:43 2019 +0200
Wrap wx.HyperlinkCtrl as gui.HyperlinkLabel
Also restructure the Label hierarchy to base it on a common abstract
class.
commit 7cb3cc9
Author: Infernio <infernio@icloud.com>
Date: Sat Aug 17 19:41:14 2019 +0200
Wrap wx.Colour as gui.Color
Only created it, not using it yet.
commit 964976c
Author: nycz <pyntix@gmail.com>
Date: Sat Jul 1 11:22:55 2017 +0200
Initial version of gui package
Infernio: Had to squash a whole bunch of these together in order to have
the resulting commit not break dev. Introduces a decent first design for
the GUI package featuring layouts, buttons and some text components.
Move layouts to new gui package with fully wrapped classes
The goal is to replace balt with this, fully encapsulating the wx
classes inside.
Add regular buttons to new gui package
The onButClickEventful argument is not yet implemented, but it's only
used in one class (the ColorPicker dialog) so it isn't a massive concern.
It's waiting for better event handling before it can be implemented.
Add ToggleButton and CheckBox to gui, plus more
The main widget API now uses properties instead of getters and setters.
Add text edit fields to gui
Still to do:
* styles (no border, sunken border)
* fonts (mostly monospace)
* event binding (on_lose_focus)
* a lot of documentation
WIP - Add labels to gui
again, this is not even close to done. barely more than a stash
Cleanup some leftovers from nycz's initial work
Rename abstract classes to fit WB style
We use 'A' instead of 'Abstract'. Also renamed Widget to _AWidget since
instantiating that class doesn't seem useful.
Import directly in balt
Leads to slightly cleaner looking code. Also deleted the remnants of the
StaticText class.
Create gui.DeselectAllButton
Make TextCtrl wrappers more consistent
There is no reason for anything but TextArea to ever have a 'wrap'
parameter. However, the 'modified' property is useful for both TextAreas
and TextFields, so let's move it to the abstract class.
Remnants of balt.StaticText -> gui.Label transition
Rename abstract classes in layouts.py to fit
Carry over wx3 SendSizeEventToParent edit
Was the only actually needed one from the wx3 TEMP commit
layouts: Use SetSizer by default
Fixes dialogs opening way too small and not remembering their size
Add docstrings and typing
Also removed some obsolete labels in patcher_dialog.py.
Rename 'text' and 'name', both forbidden names
Get rid of all 'text' usages in the new GUI code
Forbidden name, see wiki.
Get rid of all 'name' usages in the new GUI code
Fobidden name, see wiki. I almost definitely missed some here.
Rename some setter parameters
To avoid forbidden names etc.
Reintroduce support for some missing features
1. Hiding text input borders
Also turns the INI details name back into a read-only text area again
(works better for small screens).
2. StaticText.Rewrap (now Label.rewrap)
Cut out some parts of this that I don't think are needed, but we'll have
to see.
Drop noAutoResize
When in doubt, leave it out - can't find any breakage from not
supporting this, so dropping it.
Remove HideNativeCaret() usage
Doesn't even seem to work, and why are we even doing this in the first
place??
Split into modules earlier
gui/__init__.py should become a central import point, will significantly
reduce commit noise and simplify the API usage (in exchange for a *very*
painful conflict resolution that I'll now have to slug through...).
Notes for these squashed modules:
Move text-related classes into gui/text_components.py
gui/__init__.py is starting to become pretty large and there's no reason
to limit ourselves to one file anyways.
Also randomly noticed that the copyright dates were still from 2015
here.
Move button classes into gui/buttons.py
Since these are going to expand soon (BitmapButton), now felt like a
good time to do it.
Some minor improvements to layouts.py
Fix 'Modified' field not being editable
Got the incorrect assignment (False instead of True), but I dropped the
entire assignment instead. Don't know why it was there in the first
place.
Co-authored-by: Infernio <infernio@icloud.com>
commit 66e6b50
Author: nycz <pyntix@gmail.com>
Date: Thu Jun 29 22:58:14 2017 +0200
More misc wx binning and moving to balt
Making ColorPicker an own class in balt might be a bit much but idk.
Either way, basher.dialogs is clean of wx now.
Infernio: Not quite, still need to wrap ComboBox :(
Under # 190
commit b1f4ab2
Author: nycz <pyntix@gmail.com>
Date: Thu Jun 29 22:38:13 2017 +0200
Replace wx sizers with custom layouts
This removes all traces of wx's sizers except in bash.py.
They are replaced with layouts, a group of classes that
should be abstracted enough to work with not only wx but also other gui
libraries if needed.
The design of the layout API is a mix between wx, qt, and the existing
thin wrappers around the sizers in bash. They are not quite as flexible
as wx's sizers yet, but they should be easier to understand and less
error prone. It's still a WIP however so suggestions for improvements
are very welcome.
Visually, most windows and widgets should not be very different as I
tried to stay with the original design, but in some places there might
be some differences (especially when it comes to spacing and borders).
Infernio: Switched from using SetSizerAndFit by default to using
SetSizer instead to preserve previous behavior.
Infernio: Moved save/cancel buttons back to the left side to keep GUI
look the same.
Under # 190
commit abe8676
Author: Infernio <infernio@icloud.com>
Date: Sun Aug 18 02:29:45 2019 +0200
Create a gui event framework
This is built on top of wx's framework. See the module docstring in
gui/events.py for a detailed walkthrough and discussion of this
framework and its usage.1 parent 6b2b828 commit 7e82cce
22 files changed
Lines changed: 2551 additions & 1420 deletions
File tree
- Mopy
- Docs
- bash
- basher
- gui
- images
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5199 | 5199 | | |
5200 | 5200 | | |
5201 | 5201 | | |
5202 | | - | |
| 5202 | + | |
5203 | 5203 | | |
5204 | | - | |
| 5204 | + | |
5205 | 5205 | | |
5206 | 5206 | | |
5207 | 5207 | | |
| |||
0 commit comments