wail icon indicating copy to clipboard operation
wail copied to clipboard

Hook WAIL>Preferences menu into some functionality

Open machawk1 opened this issue 5 years ago • 8 comments

It is currently available and causes no UI change.

screen shot 2019-02-05 at 6 19 29 am

machawk1 avatar Feb 05 '19 11:02 machawk1

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)

machawk1 avatar Feb 05 '19 11:02 machawk1

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/

machawk1 avatar Aug 29 '19 01:08 machawk1

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.

machawk1 avatar Aug 29 '19 01:08 machawk1

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.

machawk1 avatar May 11 '20 16:05 machawk1

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.

machawk1 avatar Jul 13 '21 23:07 machawk1

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()

machawk1 avatar Jul 14 '21 13:07 machawk1

These should align with Apple's Human Interface Guidelines (see counter-example).

machawk1 avatar Jul 16 '21 22:07 machawk1

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.

machawk1 avatar Sep 09 '21 14:09 machawk1