Skip to content

Commit 7e82cce

Browse files
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

Mopy/Docs/Wrye Bash Advanced Readme.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5199,9 +5199,9 @@ <h3 class="clearfb" id="tools-docs">Doc Browser <a class="back2top" href="#conte
51995199
<figcaption class="tools-docs-figcap">Wrye Bash's Doc Browser.</figcaption>
52005200
</figure>
52015201
<p>The Doc Browser allows you to quickly and easily scan through your mods' documentation. The supported document types are: text files, HTML files and MHT files (HTML archives). To display the Doc Browser, double click any plugin in the main list of the Mods tab.
5202-
<p>When you double-click a plugin, Wrye Bash will open the Doc Browser and attempt to determine which document to associate with it. If it can determine one, it will display it. Otherwise, a blank page will be displayed. To associate a document with a plugin, use the <q>Set Doc...</q> button in the Doc Browser. To disassociate a document with a plugin, use the <q>Forget Doc...</q> button in the Doc Browser.
5202+
<p>When you double-click a plugin, Wrye Bash will open the Doc Browser and attempt to determine which document to associate with it. If it can determine one, it will display it. Otherwise, a blank page will be displayed. To associate a document with a plugin, use the <q>Set Doc...</q> button in the Doc Browser. To disassociate a document with a plugin, use the <q>Forget Doc</q> button in the Doc Browser.
52035203
<p>You can also rename an associated document using the <q>Rename Doc...</q> button to select a new name and/or location. The document will be renamed and/or moved to this location.
5204-
<p>You can edit a document by clicking the <q>Edit Doc...</q> button. The document can then be edited in the viewing window. To finish editing, click the <q>Edit Doc...</q> button again. Changes are automatically saved when you select a new plugin, close the Doc Browser or finish editing.
5204+
<p>You can edit a document by ticking the <q>Allow Editing</q> checkbox. The document can then be edited in the viewing window. To finish editing, uncheck the <q>Allow Editing</q> checkbox again. Changes are automatically saved when you select a new plugin, close the Doc Browser or finish editing.
52055205
<p>A document can be opened in its default external editor by clicking the <q>Open Doc...</q> button.
52065206
<p>A new document can be created for a plugin by clicking the <q>Set Doc...</q> button and choosing a new filename. This creates a document using a blank template that you can then edit. The default template is <code>Data\Docs\My Readme Template</code> if it exists, or if not, <code>Data\Docs\Bash Readme Template.txt</code>. The latter is written in Wrye wiki text format, which will be displayed as HTML when the Doc Browser is not in edit mode.
52075207
<p>To view a different document, select a different plugin in the list on the left of the Doc Browser or in the Mods tab.

0 commit comments

Comments
 (0)