Closed greyelf closed 10 years ago
I asked about this in Issue: 102 - Determination of required file paths for platform Darwin but received no feedback. The locations that files are sourced from within the OSX version of Twine is inconsistent:
Location of script files: scriptPath = os.path.realpath(os.path.dirname(sys.argv[0]))
NOTE: This value is accessed by the rest of the application via the app.getPath() method.
Location of header directories: NOTE: The Header file itself is within a sub-directory named based on the StoryFormat
StoryFrame Menus:
First Check: app.getPath() + os.sep + 'targets' + os.sep
Second Check: re.sub('[^/]+.app/.*', '', app.getPath()) + os.sep + 'targets' + os.sep
TiddyWiki toHtml method:
Default: re.sub('[^/]+.app/.*', '', app.getPath()) + os.sep + 'targets' + os.sep
Otherwise: app.getPath() + os.sep + 'targets' + os.sep
Location of Footer files: app.getPath() + os.sep + 'targets' + os.sep
NOTE: The Footer file itself is within a sub-directory named based on the StoryFormat
Location of Engine files: app.getPath() + os.sep + 'targets' + os.sep
Location of the App's Icon: 'icons' + os.sep + 'app.ico'
NOTE: Found based on the current working directory of the Application, may be different to scriptPath icons directory.
Location of other Icons: app.getPath() + os.sep + 'icons' + os.sep
So as you can see:
My assumptions (which could be wrong due to no feedback):
Either way all this is contained within two methods within app.py: determinePaths() and loadTargetHeaders(), so it should be simple to change
Currently there is a situation where some Story Authors are choosing not to upgrade to the latest official Twine 1.4.1, and are instead using a modified version of Twine 1.3.6 alpha due to it offering better supporting their Story Format header of choice. (SugarCube)
Some of features in the modified version could be added to the office version but others are specific to the SugarCube header.
Because the different Headers (Jonah, Sugarcane, SugarCube, etc) support different features/default macros, there appears to be a need for the ability to allow the Header Authors to influence/change how the Twine GUI works depending on the Header (Story Format) selected.
This would reduce the amount of hard-wiring required to support a feature that is not common to all Headers.
Contained within this branch is a very basic example of a Header class system, which allows a Header Author to supply a Python class file along with their "header.html" file, this class could contain code that changes the application.
The basic example allows Header Authors to do the following:
Other functionality like, which macros also behave as links and need highlighting, can be added as needed.