Template:Codeextralink

From FreeCAD Documentation
Revision as of 22:16, 5 January 2019 by Mario52 (talk | contribs) (delete the balise <code>Addon_Installer</code> for testing)

Temporary code for external macro link. Do not use this code. This code is used exclusively by Addon_Installer.


##This code is copied instead of the original macro code

##to guide the user to the offline download page

##Use it if the code of the macro is larger than 64 KB and cannot be included in the wiki

##or if the RAW code url is extra wiki location

import PySide

from PySide import QtGui ,QtCore

diag = QtGui.QMessageBox(QtGui.QMessageBox.Information,u"Information",
    "This macro must by downloaded with this link" + "\n"
    " " + "\n"
    "{{{1}}}" + "\n"
    " " + "\n"
    "Quit this window for access in the download page" )

diag.setWindowFlags(PySide.QtCore.Qt.WindowStaysOnTopHint)

diag.setWindowModality(QtCore.Qt.ApplicationModal)

diag.exec_()

import webbrowser 

webbrowser.open("{{{1}}}")
<class="rawcodeurl"><a href="{{{1}}}">raw code</a>



Use this template in the documentation page for the macros included in macros recipes.

When the code of the macro is too large to be hosted on the wiki, the code can be hosted somewhere else, and the raw link to it will be used with this template.

Usage:

{{Codeextralink|Raw macro address}}

Example:

{{Codeextralink|https://gist.githubusercontent.com/mario52a/3ec67a3711202dab69592ce53b938924/raw/3f7a5914bc5dfa66d10971a67356b5b4273ceea4/Macro_Connect_And_Sweep.FCMacro}}

Result:

Temporary code for external macro link. Do not use this code. This code is used exclusively by Addon_Installer.


##This code is copied instead of the original macro code

##to guide the user to the offline download page

##Use it if the code of the macro is larger than 64 KB and cannot be included in the wiki

##or if the RAW code url is extra wiki location

import PySide

from PySide import QtGui ,QtCore

diag = QtGui.QMessageBox(QtGui.QMessageBox.Information,u"Information",
    "This macro must by downloaded with this link" + "\n"
    " " + "\n"
    "https://gist.githubusercontent.com/mario52a/3ec67a3711202dab69592ce53b938924/raw/3f7a5914bc5dfa66d10971a67356b5b4273ceea4/Macro_Connect_And_Sweep.FCMacro" + "\n"
    " " + "\n"
    "Quit this window for access in the download page" )

diag.setWindowFlags(PySide.QtCore.Qt.WindowStaysOnTopHint)

diag.setWindowModality(QtCore.Qt.ApplicationModal)

diag.exec_()

import webbrowser 

webbrowser.open("https://gist.githubusercontent.com/mario52a/3ec67a3711202dab69592ce53b938924/raw/3f7a5914bc5dfa66d10971a67356b5b4273ceea4/Macro_Connect_And_Sweep.FCMacro")