wail
wail copied to clipboard
Hook WAIL>Preferences menu into some functionality
It is currently available and causes no UI change.
![screen shot 2019-02-05 at 6 19 29 am](https://user-images.githubusercontent.com/2514780/52270140-07e15680-290e-11e9-8b17-521c99b59b77.png)
Archive Locations: (paths in listbox)
- Pull from current wayback.xml, read into memory, onSave rewrite wayback.xml and some config file external to the application (#199) so it can be re-applied on reinstalls when the wayback.xml may have reverted.
- [ ] Heritrix credentials (username/password for web access)
- [ ] Heritrix crawl job defaults (operatorContactUrl, jobName, description)
- [ ] Automatically crawl URI (checkbox) when encountering a 404 in WAIL's OpenWayback
- [ ] __ MemGator default timeout
- [ ] MemGator user agent (currently set to use default @WebSciDL)
Use wx.StaticBox for scoping within tabs.
Crawler:
- Web Interface Credentials (wx.StaticBox) ** Username: (wx.TextCtrl) ** Password: (wx.TextCtrl(wx.TE_PASSWORD))
- Crawl Attributes ** Operator Contact URL: (wx.TextCtrl) - provide placeholder default ** Job Name: (wx.TextCtrl) - provide placeholder default ** Job Description: (wx.TextCtrl) - provide placeholder default
Aggregator:
- User Agent When Querying Archives: (wx.TextCtrl)
- Default Timeout: (wx.TextCtrl)
Archive locations require interpretation of:
<!-- Customize these basic placeholders. -->
wail.basedir=/Applications/WAIL.app
wayback.basedir.default=/Applications/WAIL.app/bundledApps/tomcat/webapps/ROOT
wayback.url.scheme.default=http
wayback.url.host.default=localhost
wayback.url.port.default=8080
<!-- Environment variables (if present) override defaults. No need to customize these. -->
wayback.basedir=#{ systemEnvironment['WAYBACK_BASEDIR'] ?: '${wayback.basedir.default}' }
wayback.url.scheme=#{ systemEnvironment['WAYBACK_URL_SCHEME'] ?: '${wayback.url.scheme.default}' }
wayback.url.host=#{ systemEnvironment['WAYBACK_URL_HOST'] ?: '${wayback.url.host.default}' }
wayback.url.port=#{ systemEnvironment['WAYBACK_URL_PORT'] ?: '${wayback.url.port.default}' }
<!-- No need to edit this setting unless deploying in a non-ROOT context
or using a load balancer, in which case configure it with the frontend URL prefix. -->
wayback.url.prefix.default=${wayback.url.scheme}://${wayback.url.host}:${wayback.url.port}
<!-- Environment variable (if present) overrides default. No need to customize this. -->
wayback.url.prefix=#{ systemEnvironment['WAYBACK_URL_PREFIX'] ?: '${wayback.url.prefix.default}' }
<!-- Customize or add additional placeholders if needed to use elsewhere.
Check BDBCollection.xml for following placeholders being used. -->
wayback.archivedir.1=${wayback.basedir}/files1/
wayback.archivedir.2=${wayback.basedir}/files2/
Reading log files might be a little more systematic than trying to reinterpret the path building in this XML.
EDIT: the necessary paths are not present in the catalina.out log.
I added some UI elements within sizers in fa0734d but will need to research more on adding and aligning elements (e.g., wx.StaticText) within a wx.StaticBox, as adding a sizer to align the children within the element causes runtime issues.
Despite the work in the issue-343 branch, I recently became aware of wx.PreferencesPage and wx.StockPreferencesPage
From this page:
On macOS, preferences pages named “General” and “Advanced” are commonly used in apps and the OS provides stock icons for them that should be used. Instead of reimplementing this behaviour yourself, you can inherit from wx.StockPreferencesPage and get correct title and icon.
https://docs.wxpython.org/wx.PreferencesEditor.html is the wrapper for these pages that mimics the expected behavior across platforms.
Example usage:
import wx
class GeneralPage(wx.StockPreferencesPage):
def CreateWindow(self, parent):
panel = wx.Panel(parent)
panel.SetMinSize((500, 500))
sz = wx.BoxSizer(wx.VERTICAL)
sz.Add(wx.StaticText(panel, wx.ID_ANY, "General Page"),
wx.SizerFlags(1).TripleBorder())
panel.SetSizer(sz)
return panel
class AdvancedPage(wx.StockPreferencesPage):
def CreateWindow(self, parent):
panel = wx.Panel(parent)
panel.SetMinSize((500, 500))
sz = wx.BoxSizer(wx.VERTICAL)
sz.Add(wx.StaticText(panel, wx.ID_ANY, "Advanced Page"),
wx.SizerFlags(1).TripleBorder())
panel.SetSizer(sz)
return panel
class Preferences(wx.PreferencesEditor):
def __init__(self):
super().__init__()
self.AddPage(GeneralPage(wx.StockPreferencesPage.Kind_General))
self.AddPage(AdvancedPage(wx.StockPreferencesPage.Kind_Advanced))
app = wx.App()
prefs = Preferences()
prefs.Show(None)
app.MainLoop()
These should align with Apple's Human Interface Guidelines (see counter-example).
For the tab icons, we might look to font-awesome to see if anything suitable and vectorized are available. The current approach is relying on scaling down some edited, large bitmaps to fit within the proportions. See 14f850d for an example.