HowToWritePlugins

Attachment 'bluetoothsettings.py'

Download

   1 # Your name, email and other copyright information
   2 
   3 from gi.repository import Gtk #Don't support PyGtk
   4 
   5 from ubuntutweak.gui.containers import TablePack # TablePack is a container to pack any numbers of widgets
   6 from ubuntutweak.modules  import TweakModule # Subclass this Module then it will become a plugin of Ubuntu Tweak
   7 from ubuntutweak.factory import WidgetFactory # Use to create the setting related widget easily
   8 
   9 class BluetoothSettings(TweakModule):
  10     __title__ = _('Bluetooth Settings')
  11     __desc__ = _('Tweak some hidden bluetooth settings')
  12     __icon__ = 'bluetooth' # The icon name, currently don't support path to image
  13     __category__ = 'system' # the category
  14 
  15     __author__ = 'Your Name <your@mail.com>'
  16     __url__ = 'Your home page'
  17     __url_title__ = 'The title of Home page'
  18 
  19     def __init__(self):
  20         TweakModule.__init__(self)
  21 
  22         # WidgetFactory will return a tuple of widgets 
  23         box = TablePack(_("Bluetooth Options"), (
  24                     WidgetFactory.create("CheckButton",
  25                                          label=_('Share Public directory over Bluetooth'),
  26                                          key="/desktop/gnome/file_sharing/bluetooth_enabled",
  27                                          backend='gconf', # GSettings will support in the future
  28                                          enable_reset=True),
  29                     WidgetFactory.create("CheckButton",
  30                                          label=_("Whether to notify about newly received files"),
  31                                          key="/desktop/gnome/file_sharing/bluetooth_notify",
  32                                          backend='gconf',
  33                                          enable_reset=True),
  34                     WidgetFactory.create("CheckButton",
  35                                          label=_("Whether to allow Bluetooth clients to write files."),
  36                                          key="/desktop/gnome/file_sharing/bluetooth_allow_write",
  37                                          backend='gconf',
  38                                          enable_reset=True),
  39                     WidgetFactory.create('ComboBox',
  40                                          label=_('When to accept files sent over Bluetooth'),
  41                                          key='/desktop/gnome/file_sharing/bluetooth_accept_files',
  42                                          enable_reset=True,
  43                                          backend='gconf',
  44                                          texts=[_('Always'), _('Bonded'), _('Ask')],
  45                                          values=["always", "bonded", "ask"]),
  46             ))
  47 
  48         self.add_start(box, False, False, 0)

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.
  • [get | view] (2011-06-01 08:32:14, 64.1 KB) [[attachment:BluetoothSettings-01.png]]
  • [get | view] (2011-06-01 08:33:35, 47.4 KB) [[attachment:BluetoothSettings-02.png]]
  • [get | view] (2011-06-28 09:19:02, 46.9 KB) [[attachment:Ubuntu Tweak 0.6.0 Clip Preference.png]]
  • [get | view] (2011-06-28 09:35:36, 57.7 KB) [[attachment:Ubuntu Tweak 0.6.0 Janitor.png]]
  • [get | view] (2011-06-28 09:32:21, 22.8 KB) [[attachment:Ubuntu Tweak 0.6.0 Tweaks Preferences.png]]
  • [get | view] (2011-06-28 09:22:34, 48.8 KB) [[attachment:Ubuntu Tweak 0.6.0 Tweaks.png]]
  • [get | view] (2011-06-28 09:09:24, 75.2 KB) [[attachment:Ubuntu Tweak 0.6.0.png]]
  • [get | view] (2011-11-15 00:51:01, 2.6 KB) [[attachment:bluetoothsettings.py]]
 All files | Selected Files: delete move to page

You are not allowed to attach a file to this page.