Skip to content

Instantly share code, notes, and snippets.

@techtonik
Last active October 29, 2019 21:40
Show Gist options
  • Select an option

  • Save techtonik/9bfd6b3acac305ee64f2f4ec9ffffdfe to your computer and use it in GitHub Desktop.

Select an option

Save techtonik/9bfd6b3acac305ee64f2f4ec9ffffdfe to your computer and use it in GitHub Desktop.

Revisions

  1. techtonik revised this gist May 6, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion PythonFar.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    https://gist.github.com/techtonik/9bfd6b3acac305ee64f2f4ec9ffffdfe
    https://github.com/techtonik/discovery/tree/master/interface/plugin/farmanager

    1. Download `pygin*.7z` from https://forum.farmanager.com/viewtopic.php?f=8&t=9998
    (I tested with latest pygin_c080105_040517.7z)
  2. techtonik revised this gist May 6, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion PythonFar.md
    Original file line number Diff line number Diff line change
    @@ -9,7 +9,7 @@ https://gist.github.com/techtonik/9bfd6b3acac305ee64f2f4ec9ffffdfe


    Here is an example plugin. Feel free to copy and adapt.
    ```
    ```python
    __title__ = "02fields"
    __author__ = "anatoly techtonik <[email protected]>"
    __license__ = "Public Domain"
  3. techtonik revised this gist May 6, 2017. 1 changed file with 48 additions and 3 deletions.
    51 changes: 48 additions & 3 deletions PythonFar.md
    Original file line number Diff line number Diff line change
    @@ -1,9 +1,54 @@
    https://gist.github.com/techtonik/9bfd6b3acac305ee64f2f4ec9ffffdfe

    1. Download `pygin.7z` from https://forum.farmanager.com/viewtopic.php?f=8&t=9998
    size, sha1 = (379105, 89903f828fdf5668d104690867a8241e80b5d3e6)
    1. Download `pygin*.7z` from https://forum.farmanager.com/viewtopic.php?f=8&t=9998
    (I tested with latest pygin_c080105_040517.7z)
    2. Unpack `pygin.dll` into Adapters/ subdir of your Far directory (%FARHOME%)
    3. Create your plugin in %FARHOME%/Plugins as Python package (dir with `__init__.py`)
    4. Restart, press F11 to see your plugin in the list, F3 to see more info
    5. If something goes wrong, check %TMP%/pygin.log for errors and output


    Here is an example plugin. Feel free to copy and adapt.
    ```
    __title__ = "02fields"
    __author__ = "anatoly techtonik <[email protected]>"
    __license__ = "Public Domain"
    # --- utility functions ---
    import hashlib
    def getuuid(data):
    """Generate UUID from `data` string"""
    if type(data) != bytes:
    data = data.encode('utf-8')
    h = hashlib.sha256(data).hexdigest()[:32].upper()
    for i, pos in enumerate([8, 12, 16, 20]):
    h = h[:i+pos] + '-' + h[i+pos:]
    return h
    # --- plugin interface
    def GetGlobalInfoW(info):
    """ Called by Far Manager, plugin needs to fill the info """
    info["Title"] = __title__ # should be set and non-empty
    info["Author"] = __author__ # should be set and non-empty
    # first string from file comment
    desc = __doc__.strip().splitlines()[0]
    info["Description"] = desc # should be set
    info["Guid"] = getuuid(info["Title"])
    def GetPluginInfoW(info):
    """ Called by Far Manager to add item into Plugin commands menu (F11) """
    info["MenuString"] = __title__
    info["Guid"] = getuuid(info["MenuString"])
    def OpenW(info):
    """ Called by Far Manager when plugin is invoked """
    print("[open] " + __file__)
    ```

    ```
    For Far API refence, see
    https://api.farmanager.com/ru/exported_functions/getglobalinfow.html
  4. techtonik revised this gist Apr 28, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion PythonFar.md
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    https://gist.github.com/techtonik/9bfd6b3acac305ee64f2f4ec9ffffdfe

    1. Download `pygin.7z` from https://forum.farmanager.com/viewtopic.php?f=8&t=9998
    1. Download `pygin.7z` from https://forum.farmanager.com/viewtopic.php?f=8&t=9998
    size, sha1 = (379105, 89903f828fdf5668d104690867a8241e80b5d3e6)
    2. Unpack `pygin.dll` into Adapters/ subdir of your Far directory (%FARHOME%)
    3. Create your plugin in %FARHOME%/Plugins as Python package (dir with `__init__.py`)
  5. techtonik revised this gist Apr 28, 2017. 1 changed file with 5 additions and 3 deletions.
    8 changes: 5 additions & 3 deletions PythonFar.md
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,8 @@
    1. Download pygin.7z from http://forum.farmanager.com/download/file.php?id=7215
    size, sha1 = (327461, 7bfc9cdf6435b8f625134b4b6f95ab6393e34dea)
    2. Unpack pygin.dll into Adapters/ subdir of your Far directory (%FARHOME%)
    https://gist.github.com/techtonik/9bfd6b3acac305ee64f2f4ec9ffffdfe

    1. Download `pygin.7z` from https://forum.farmanager.com/viewtopic.php?f=8&t=9998
    size, sha1 = (379105, 89903f828fdf5668d104690867a8241e80b5d3e6)
    2. Unpack `pygin.dll` into Adapters/ subdir of your Far directory (%FARHOME%)
    3. Create your plugin in %FARHOME%/Plugins as Python package (dir with `__init__.py`)
    ```
  6. techtonik revised this gist Aug 4, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion PythonFar.md
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    1. Download pygin.7z from http://forum.farmanager.com/download/file.php?id=7215
    size, sha1 = (327461, 7bfc9cdf6435b8f625134b4b6f95ab6393e34dea)
    2. Unpack pygin.dll into Adapters/ subdir of your Far directory (%FARHOME%)
    3. Create your plugin in %FARHOME%/Plugins
    3. Create your plugin in %FARHOME%/Plugins as Python package (dir with `__init__.py`)
    ```
    ```
  7. techtonik revised this gist Jul 29, 2016. 1 changed file with 5 additions and 2 deletions.
    7 changes: 5 additions & 2 deletions PythonFar.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,7 @@
    1. Download pygin.7z from http://forum.farmanager.com/download/file.php?id=7215
    size, sha1 = (327461, 7bfc9cdf6435b8f625134b4b6f95ab6393e34dea)

    2. Unpack pygin.dll into Adapters/ subdir of your Far directory
    2. Unpack pygin.dll into Adapters/ subdir of your Far directory (%FARHOME%)
    3. Create your plugin in %FARHOME%/Plugins
    ```
    ```
  8. techtonik revised this gist Jul 29, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion PythonFar.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    1. Download pygin.7z from http://forum.farmanager.com/download/file.php?id=7215
    1. Download pygin.7z from http://forum.farmanager.com/download/file.php?id=7215
    size, sha1 = (327461, 7bfc9cdf6435b8f625134b4b6f95ab6393e34dea)

    2. Unpack pygin.dll into Adapters/ subdir of your Far directory
  9. techtonik renamed this gist Jul 29, 2016. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  10. techtonik created this gist Jul 29, 2016.
    4 changes: 4 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,4 @@
    1. Download pygin.7z from http://forum.farmanager.com/download/file.php?id=7215
    size, sha1 = (327461, 7bfc9cdf6435b8f625134b4b6f95ab6393e34dea)

    2. Unpack pygin.dll into Adapters/ subdir of your Far directory