HowToWritePlugins
|
Size: 3444
Comment:
|
Size: 3489
Comment: page was renamed from UbuntuTweak/Plugin
|
| Deletions are marked like this. | Additions are marked like this. |
| Line 1: | Line 1: |
| ## page was renamed from UbuntuTweak/Plugin |
Intro
Ubuntu Tweak Plugin is a simple python script which use the API from Ubuntu Tweak. It is easy to write it then integrate with Ubuntu Tweak.
Currently the API is not stable yet, but I hope you can start to write something and get some feedback to me. So I can improve Ubuntu Tweak.
Overview
t As you can see of the screenshot, it consists of two parts: 1. Tweaks, 2. Admins (And Jantor will be added soon)
If your plugin is doing some tweaks, you should add it to "Tweaks", if it is doing some other tasks (backup, update and so on), it can be put under "Admins"
Let's start with an example.
Example 1
In the first example, I will add a tweaks to do something of bluetooth.
If you've ran Ubuntu Tweak 0.6 before, some folder will be created under $HOME/.config/ubuntu-tweak, they are "tweaks", "admins". These are the user plugin folders.
Create a file named "bluetoothsettings.py" under $HOME/.config/ubuntu-tweak/tweaks/, fill with these contents:
# Your name, email and other copyright information
from gi.repository import Gtk, GConf
from ubuntutweak.gui.containers import TablePack
from ubuntutweak.modules import TweakModule
from ubuntutweak.factory import WidgetFactory
class BluetoothSettings(TweakModule):
__title__ = _('Bluetooth Settings')
__desc__ = _('Tweak some hidden bluetooth settings')
__icon__ = 'bluetooth'
__category__ = 'system'
__author__ = 'Your Name <your@mail.com>'
__url__ = 'Your home page'
__url_title__ = 'The title of Home page'
def __init__(self):
TweakModule.__init__(self)
box = TablePack(_("Bluetooth Options"), (
WidgetFactory.create("CheckButton",
label=_('Share Public directory over Bluetooth'),
key="/desktop/gnome/file_sharing/bluetooth_enabled",
backend=GConf,
enable_reset=True),
WidgetFactory.create("CheckButton",
label=_("Whether to notify about newly received files"),
key="/desktop/gnome/file_sharing/bluetooth_notify",
backend=GConf,
enable_reset=True),
WidgetFactory.create("CheckButton",
label=_("Whether to allow Bluetooth clients to write files."),
key="/desktop/gnome/file_sharing/bluetooth_allow_write",
backend=GConf,
enable_reset=True),
WidgetFactory.create('ComboBox',
label=_('When to accept files sent over Bluetooth'),
key='/desktop/gnome/file_sharing/bluetooth_accept_files',
enable_reset=True,
backend=GConf,
texts=[_('Always'), _('Bonded'), _('Ask')],
values=["always", "bonded", "ask"]),
))
self.add_start(box, False, False, 0)UbuntuTweak/HowToWritePlugins (last edited 2011-11-15 00:49:32 by 64)