2013-03-02 16:22:06 +00:00
rainmeter-python
================
2013-03-02 19:28:14 +00:00
Plugin for Rainmeter enabling Python 3 scripting
Installation
------------
2013-03-02 23:18:09 +00:00
Binaries: [x86-32 ](http://www.jblume.com/rainmeter-python/x86/Python.dll ) and [x86-64 ](http://www.jblume.com/rainmeter-python/x64/Python.dll )
Simply copy the appropriate file to the 'Plugins' folder of your Rainmeter installation.
2013-03-02 19:28:14 +00:00
For this plugin to function, you need to install the Python 3.3 distribution matching your Rainmeter's architecture.
The corresponding 'python33.dll' needs to be in your DLL search path; all standard installers of Python 3.3 automatically put the DLL into your System32 directory, so this should normally be the case.
2013-03-02 22:36:48 +00:00
Example (Simple)
2013-03-02 19:28:14 +00:00
-------
```ini
[Measure]
Measure=Plugin
Plugin=Plugins\Python.dll
PythonHome=c:\Python33
ScriptPath=default.py
ClassName=Measure
2013-03-02 22:36:48 +00:00
UpdateDivider=1
2013-03-02 19:28:14 +00:00
```
```python
class Measure:
def Reload(self, rm, maxValue):
rm.RmLog(rm.LOG_NOTICE, "Reload called")
def Update(self):
return 1.0
def GetString(self):
return 'Test'
def ExecuteBang(self, args):
pass
def Finalize(self):
pass
```
2013-03-02 22:36:48 +00:00
Example (IMAP Unread Mail Count)
-------
```ini
[Measure]
Measure=Plugin
Plugin=Plugins\Python.dll
ScriptPath=IMAP.py
PythonHome=c:\Python33
UpdateDivider=60
Username=username
Password=password
Host=mail.com
```
```python
import imaplib
class Measure:
def Reload(self, nm, maxValue):
self.host = nm.RmReadString('Host', 'example.com', False)
self.username = nm.RmReadString('Username', 'user', False)
self.password = nm.RmReadString('Password', 'pass', False)
def Update(self):
con = imaplib.IMAP4(self.host)
con.starttls()
con.login(self.username, self.password)
con.select('INBOX', True)
_, msgnums = con.search(None, '(UNSEEN)')
return float(len(msgnums[0].split()))
```