Commits

Ali Afshar  committed b4a5c07

Renamed MasterProxy to ProxyGroup

  • Participants
  • Parent commits dcdd5ce

Comments (0)

Files changed (2)

File pygtkhelpers/proxy.py

     return proxy_type(widget)
 
 
-class MasterProxy(gobject.GObject):
-    """A controller to handle multiple proxies, and sub-masters
+class ProxyGroup(gobject.GObject):
+    """A controller to handle multiple proxies, and sub-groups
 
-    A MasterProxy is a bridge to reduce multiple proxies and sub-masters to a
+    A ProxyGroup is a bridge to reduce multiple proxies and sub-groups to a
     single signal based on the key of the individual proxies.
     """
 
         gobject.GObject.__init__(self)
 
     def add_proxy(self, name, proxy):
-        """Add a proxy to this master
+        """Add a proxy to this group
 
         :param name: The name or key of the proxy, which will be emitted with
                      the changed signal
         proxy.connect('changed', self._on_proxy_changed, name)
 
     def add_proxy_for(self, name, widget):
-        """Create a proxy for a widget and add it to this master
+        """Create a proxy for a widget and add it to this group
 
         :param name: The name or key of the proxy, which will be emitted with
                      the changed signal
         proxy = proxy_for(widget)
         self.add_proxy(name, proxy)
 
-    def add_master(self, master):
-        """Add an existing master to this master and proxy its signals
+    def add_group(self, group):
+        """Add an existing group to this group and proxy its signals
 
-        :param master: The MasterProxy instance to add
+        :param group: The ProxyGroup instance to add
         """
-        master.connect('changed', self._on_master_changed)
+        group.connect('changed', self._on_group_changed)
 
     def _on_proxy_changed(self, proxy, value, name):
         self.emit('changed', proxy, name, value)
 
-    def _on_master_changed(self, master, proxy, value, name):
+    def _on_group_changed(self, group, proxy, value, name):
         self.emit('changed', proxy, name, value)
 

File tests/test_masterproxy.py

 
 from pygtkhelpers.test import CheckCalled
 from pygtkhelpers.utils import refresh_gui
-from pygtkhelpers.proxy import MasterProxy, GtkEntryProxy
+from pygtkhelpers.proxy import ProxyGroup, GtkEntryProxy
 
 def test_add_proxy():
-    m = MasterProxy()
+    m = ProxyGroup()
     e = gtk.Entry()
     p = GtkEntryProxy(e)
     m.add_proxy('foo', p)
     assert check.called_count == 2
 
 def test_add_proxy_for():
-    m = MasterProxy()
+    m = ProxyGroup()
     e = gtk.Entry()
     m.add_proxy_for('foo', e)
     check = CheckCalled(m, 'changed')
     refresh_gui()
     assert check.called_count == 1
 
-def add_master():
-    m = MasterProxy()
+def test_add_group():
+    m = ProxyGroup()
     e = gtk.Entry()
     m.add_proxy_for('foo', e)
-    m2 = MasterProxy()
-    m2.add_master(m)
+    m2 = ProxyGroup()
+    m2.add_group(m)
     check = CheckCalled(m2, 'changed')
     e.set_text('a')
     assert check.called_count == 1