Merge pull request #1 from ConnyOnny/master
[lilass.git] / screen.py
index a543fea49b195b4dbe0769672c84a228a8dbae50..d567912d6c952691263bf7d1e289b0dd47b09a86 100644 (file)
--- a/screen.py
+++ b/screen.py
@@ -36,11 +36,16 @@ def processOutputIt(*args):
 
 class RelativeScreenPosition(Enum):
     '''Represents the relative position of the external screen to the internal one'''
-    LEFT      = 0
-    RIGHT     = 1
-    ABOVE     = 2
-    BELOW     = 3
-    MIRROR    = 4
+    LEFT      = ("left of")
+    RIGHT     = ("right of")
+    ABOVE     = ("above")
+    BELOW     = ("below")
+    MIRROR    = ("same as")
+    def __init__(self, text):
+        # auto numbering
+        cls = self.__class__
+        self._value_ = len(cls.__members__)
+        self.text = text
 
 
 class Resolution:
@@ -126,18 +131,19 @@ class ScreenSituation:
            just choose any remaining connector.'''
         # which connectors are there?
         self._getXrandrInformation()
-        print(self.connectors)
         # figure out which is the internal connector
         self.internalConnector = self._findAvailableConnector(internalConnectorNames)
         if self.internalConnector is None:
-            raise Exception("Could not automatically find internal connector, please use ~/.dsl.conf to specify it manually.")
-        print(self.internalConnector)
+            raise Exception("Could not automatically find internal connector, please use (or fix) ~/.dsl.conf to specify it manually.")
+        print("Detected internal connector:",self.internalConnector)
         # and the external one
         if externalConnectorNames is None:
             externalConnectorNames = list(self.connectors.keys())
             externalConnectorNames.remove(self.internalConnector)
         self.externalConnector = self._findAvailableConnector(externalConnectorNames)
-        print(self.externalConnector)
+        if self.internalConnector == self.externalConnector:
+            raise Exception("Internal and external connector are the same. This must not happen. Please fix ~/.dsl.conf.");
+        print("Detected external connector:",self.externalConnector)
     
     # Run xrandr and fill the dict of connector names mapped to lists of available resolutions.
     def _getXrandrInformation(self):