Lets do some nice Python plugins for Fougerite. Though for that, you might want to use an IDE.
So lets go ahead and download PyCharm. BUT, before Installing it.
PyCharm is one of the best Python IDEs, and It also supports IronPython, which we use on Fougerite.
So what are you going to need? Well, if you are familiar with Python, then you already know that you need to install Python. If you have never heard about Python, until your download finishes, let me give you a small description about Python. I can tell you that It's one of the most flexible, easiest language to handle. It's fast, stable, and good for small applications, and to be used as Scripting languages. Those who started with Java, or JavaScript, C#, C++ (Which contain { }, Alias brackets) might have some problems using It for the first time. I started with Python, I loved It. I know you are going to love It too. Youtube, and Dropbox are also written in Python. For more information about Python, check the wiki. If you would like to get some basic training, then visit this website.
Now that you have downloaded Python, and PyCharm, be sure to install both. You probably think that you finished, well no, not really. You will need IronPython installed, since that will be the SDK, that you will be working on.
So the requirements at the moment are:
Python
PyCharm
IronPython
Now that you have got everything installed, run PyCharm.
A nice window like this should popup. (Might not be black)
Lets go ahead and create a new project.
The next window is important for us, since that will be one of the part, where you define your SDK.
Now, at this time we won't be working with Python, but with IronPython. Select the interpreter, and locate "ipy.exe", It should be in the folder where you installed it.
It should look like this now:
Press OK.
Here we will be having our interface of the IDE. As you can see under the libraries we have IronPython imported. But that's not enough.
Since we are going to create a plugin, not an application, that's the reason why we decided to go with an empty sample project.
Lets create a Directory, but you can also create a (python) package, just like in Java, and create your Python files there. Your call. I'm gonna go ahead and create a directory.
I have created a folder called KillLog, now lets create a py file with the same name.
Yaay, we created a Py file. We got our nice Author sign there, but thats still not enough.
To create a plugin in Fougerite, we need to import clr, and then reference to the Fougerite dll.
And here gets a bit complicated. Well as an example, to show how to use methods in the IDE, I will be using Fougerite's null object method check.
The output will be:
NOTES:
Be sure not to use "from Fougerite import" when running the plugin on your server, cause It will make errors.
So just to be sure and clarify the comments I gave. If you want to use it on a live server, you would need to comment the sys.path, and the referencetofile methods, BUT instead you will HAVE TO use AddReferenceByParticialName.
I hope I did help.
So lets go ahead and download PyCharm. BUT, before Installing it.
PyCharm is one of the best Python IDEs, and It also supports IronPython, which we use on Fougerite.
So what are you going to need? Well, if you are familiar with Python, then you already know that you need to install Python. If you have never heard about Python, until your download finishes, let me give you a small description about Python. I can tell you that It's one of the most flexible, easiest language to handle. It's fast, stable, and good for small applications, and to be used as Scripting languages. Those who started with Java, or JavaScript, C#, C++ (Which contain { }, Alias brackets) might have some problems using It for the first time. I started with Python, I loved It. I know you are going to love It too. Youtube, and Dropbox are also written in Python. For more information about Python, check the wiki. If you would like to get some basic training, then visit this website.
Now that you have downloaded Python, and PyCharm, be sure to install both. You probably think that you finished, well no, not really. You will need IronPython installed, since that will be the SDK, that you will be working on.
So the requirements at the moment are:
Python
PyCharm
IronPython
Now that you have got everything installed, run PyCharm.
A nice window like this should popup. (Might not be black)

Lets go ahead and create a new project.
The next window is important for us, since that will be one of the part, where you define your SDK.

Now, at this time we won't be working with Python, but with IronPython. Select the interpreter, and locate "ipy.exe", It should be in the folder where you installed it.
It should look like this now:

Press OK.
Here we will be having our interface of the IDE. As you can see under the libraries we have IronPython imported. But that's not enough.

Since we are going to create a plugin, not an application, that's the reason why we decided to go with an empty sample project.
Lets create a Directory, but you can also create a (python) package, just like in Java, and create your Python files there. Your call. I'm gonna go ahead and create a directory.

I have created a folder called KillLog, now lets create a py file with the same name.

Yaay, we created a Py file. We got our nice Author sign there, but thats still not enough.
To create a plugin in Fougerite, we need to import clr, and then reference to the Fougerite dll.

Python:
import clr
clr.AddReferenceByPartialName("Fougerite")
Python:
__author__ = 'DreTaX'
import clr
import sys
"""
This method has to be uncommented when you will use the plugin on your live server.
"""
#clr.AddReferenceByPartialName("Fougerite")
"""
The below method in the place where our Fougerite.dll is.
This will define our IDE where to look for the functions
In python we use double \\ when giving paths.
Note: sys.path and clr.AddReferenceToFile is not required when running the plugin on a live server.
When ever you are planning to try the plugin, please COMMENT these two lines.
"""
sys.path.Add("d:\\Python33\\Fougerite\\")
"""
As above, we have given our IDE the path where to look for the libraries.
Now we define which dlls do we need.
"""
clr.AddReferenceToFile("Fougerite.dll")
#This might show errors in your IDE, if it does, just hover your mouse on the red lamp and click to ignore reference.
import Fougerite
# Lets do a simple null check here
notnull = "ImNotNull"
null = None
asd = Fougerite.Util.GetUtil().IsNull(notnull)
asd2 = Fougerite.Util.GetUtil().IsNull(null)
print asd, asd2

NOTES:
Be sure not to use "from Fougerite import" when running the plugin on your server, cause It will make errors.
So just to be sure and clarify the comments I gave. If you want to use it on a live server, you would need to comment the sys.path, and the referencetofile methods, BUT instead you will HAVE TO use AddReferenceByParticialName.

I hope I did help.
Last edited: