Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Dengler <martin@martindengler.com>2008-07-19 16:48:29 (GMT)
committer Martin Dengler <martin@martindengler.com>2008-07-19 16:48:29 (GMT)
commit40306308325448fe85c2a78ad243aa179fd1b37f (patch)
tree83db0d1ead8d9e5de99aba1734dd463fd5eba514
parent3b1c3a4794ed33ff4f1be7a0ebc101bde6b2f178 (diff)
#7249 consistent ordering of frame devices
-rw-r--r--src/view/devices/battery.py3
-rw-r--r--src/view/devices/network/mesh.py3
-rw-r--r--src/view/devices/network/wired.py3
-rw-r--r--src/view/devices/network/wireless.py3
-rw-r--r--src/view/devices/speaker.py3
-rw-r--r--src/view/frame/devicestray.py10
6 files changed, 23 insertions, 2 deletions
diff --git a/src/view/devices/battery.py b/src/view/devices/battery.py
index 403e1e8..07fe09b 100644
--- a/src/view/devices/battery.py
+++ b/src/view/devices/battery.py
@@ -34,6 +34,9 @@ _STATUS_DISCHARGING = 1
_STATUS_FULLY_CHARGED = 2
class DeviceView(TrayIcon):
+
+ FRAME_POSITION_RELATIVE = 1000
+
def __init__(self, model):
TrayIcon.__init__(self, icon_name=_ICON_NAME,
xo_color=profile.get_color())
diff --git a/src/view/devices/network/mesh.py b/src/view/devices/network/mesh.py
index bcdc0b2..1d115e9 100644
--- a/src/view/devices/network/mesh.py
+++ b/src/view/devices/network/mesh.py
@@ -30,6 +30,9 @@ from hardware import hardwaremanager
from view.frame.frameinvoker import FrameWidgetInvoker
class DeviceView(TrayIcon):
+
+ FRAME_POSITION_RELATIVE = 400
+
def __init__(self, model):
TrayIcon.__init__(self, icon_name='network-mesh')
diff --git a/src/view/devices/network/wired.py b/src/view/devices/network/wired.py
index dc83a08..6843e0d 100644
--- a/src/view/devices/network/wired.py
+++ b/src/view/devices/network/wired.py
@@ -17,6 +17,9 @@
from view.devices import deviceview
class DeviceView(deviceview.DeviceView):
+
+ FRAME_POSITION_RELATIVE = 300
+
def __init__(self, model):
deviceview.DeviceView.__init__(self, model)
self.props.icon_name = 'network-wired'
diff --git a/src/view/devices/network/wireless.py b/src/view/devices/network/wireless.py
index 985a1f8..a339928 100644
--- a/src/view/devices/network/wireless.py
+++ b/src/view/devices/network/wireless.py
@@ -33,6 +33,9 @@ from view.frame.frameinvoker import FrameWidgetInvoker
_ICON_NAME = 'network-wireless'
class DeviceView(TrayIcon):
+
+ FRAME_POSITION_RELATIVE = 300
+
def __init__(self, model):
TrayIcon.__init__(self, icon_name=_ICON_NAME)
self._model = model
diff --git a/src/view/devices/speaker.py b/src/view/devices/speaker.py
index e01a179..f785940 100644
--- a/src/view/devices/speaker.py
+++ b/src/view/devices/speaker.py
@@ -32,6 +32,9 @@ from view.frame.frameinvoker import FrameWidgetInvoker
_ICON_NAME = 'speaker'
class DeviceView(TrayIcon):
+
+ FRAME_POSITION_RELATIVE = 800
+
def __init__(self, model):
TrayIcon.__init__(self,
icon_name=_ICON_NAME,
diff --git a/src/view/frame/devicestray.py b/src/view/frame/devicestray.py
index f180cba..b4ec8ca 100644
--- a/src/view/frame/devicestray.py
+++ b/src/view/frame/devicestray.py
@@ -41,7 +41,14 @@ class DevicesTray(tray.HTray):
def _add_device(self, device):
try:
view = deviceview.create(device)
- self.add_item(view)
+ index = 0
+ for item in self.get_children():
+ index = self.get_item_index(item)
+ view_pos = getattr(view, "FRAME_POSITION_RELATIVE", -1)
+ item_pos = getattr(item, "FRAME_POSITION_RELATIVE", 0)
+ if view_pos < item_pos:
+ break
+ self.add_item(view, index=index)
view.show()
self._device_icons[device.get_id()] = view
except Exception, message:
@@ -57,4 +64,3 @@ class DevicesTray(tray.HTray):
def __device_disappeared_cb(self, model, device):
self._remove_device(device)
-