machawk1 / wail

:whale2: Web Archiving Integration Layer: One-Click User Instigated Preservation
https://matkelly.com/wail
MIT License
345 stars 32 forks source link

Hook WAIL>Preferences menu into some functionality #343

Open machawk1 opened 5 years ago

machawk1 commented 5 years ago

It is currently available and causes no UI change.

screen shot 2019-02-05 at 6 19 29 am
machawk1 commented 5 years ago

Archive Locations: (paths in listbox)

Use wx.StaticBox for scoping within tabs.

Crawler:

Aggregator:

machawk1 commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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

machawk1 commented 2 years ago

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.