~ubuntu-branches/ubuntu/lucid/exaile/lucid

« back to all changes in this revision

Viewing changes to plugins/minimode/minimodeprefs.py

  • Committer: Bazaar Package Importer
  • Author(s): Andrew Starr-Bochicchio
  • Date: 2010-02-12 19:51:01 UTC
  • mfrom: (1.1.11 upstream)
  • Revision ID: james.westby@ubuntu.com-20100212195101-8jt3tculxcl92e6v
Tags: 0.3.1~b1-0ubuntu1
* New upstream release.
* Adjust exaile.install for new plugins.
* debian/control:
 - Drop unneeded python-dev Build-Dep.
 - Bump Standards-Version to 3.8.4 
* debian/rules: No empty po files to delete.

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
 
22
22
name = _('Mini Mode')
23
23
basedir = os.path.dirname(os.path.realpath(__file__))
24
 
glade = os.path.join(basedir, "minimodeprefs_pane.glade")
25
 
 
26
 
def get_workarea_size():
27
 
    """
28
 
        Returns the height and width of the work area
29
 
    """
30
 
    rootwindow = gtk.gdk.get_default_root_window()
31
 
    workarea = gtk.gdk.atom_intern('_NET_WORKAREA')
32
 
 
33
 
    return rootwindow.property_get(workarea)[2][2:4] # W,H
 
24
ui = os.path.join(basedir, "minimodeprefs_pane.ui")
34
25
 
35
26
class AlwaysOnTopPreference(widgets.CheckPrefsItem):
36
27
    name = 'plugin/minimode/always_on_top'
48
39
    name = 'plugin/minimode/display_window_decorations'
49
40
    default = True
50
41
 
51
 
class HorizontalPositionPreference(widgets.SpinPrefsItem):
52
 
    name = 'plugin/minimode/horizontal_position'
53
 
    default = 10
54
 
    def __init__(self, prefs, widget):
55
 
        """
56
 
            Sets the maximum value to the highest
57
 
            possible horizontal position
58
 
        """
59
 
        width, height = get_workarea_size()
60
 
        widget.set_range(0, width)
61
 
        widgets.SpinPrefsItem.__init__(self, prefs, widget)
62
 
        event.add_callback(self._on_setting_change, 'option_set')
63
 
 
64
 
    def _on_setting_change(self, event, settings_manager, option):
65
 
        """
66
 
            Handles changed position triggered by
67
 
            moving the mini mode window
68
 
        """
69
 
        if option == self.name:
70
 
            value = settings.get_option(option, self.default)
71
 
            self.widget.set_value(value)
72
 
 
73
 
class VerticalPositionPreference(widgets.SpinPrefsItem):
74
 
    name = 'plugin/minimode/vertical_position'
75
 
    default = 10
76
 
    def __init__(self, prefs, widget):
77
 
        """
78
 
            Sets the maximum value to the highest
79
 
            possible vertical position
80
 
        """
81
 
        width, height = get_workarea_size()
82
 
        widget.set_range(0, height)
83
 
        widgets.SpinPrefsItem.__init__(self, prefs, widget)
84
 
        event.add_callback(self._on_setting_change, 'option_set')
85
 
 
86
 
    def _on_setting_change(self, event, settings_manager, option):
87
 
        """
88
 
            Handles changed position triggered by
89
 
            moving the mini mode window
90
 
        """
91
 
        if option == self.name:
92
 
            value = settings.get_option(option, self.default)
93
 
            self.widget.set_value(value)
94
 
 
95
42
class SelectedControlsPreference(widgets.SelectionListPrefsItem):
96
43
    name = 'plugin/minimode/selected_controls'
97
44
    available_title = _('Available controls')