work on README
[lilass.git] / lilass
diff --git a/lilass b/lilass
index b9283ebe93f6897fa47bfde9d1b1076ef1cc769e..6780879570d2cbb1f144882dc32739154cb5ff83 100755 (executable)
--- a/lilass
+++ b/lilass
@@ -78,19 +78,6 @@ def situationByConfig(config):
     # run!
     return screen.ScreenSituation(internalConnectors, config.get('externalConnectors'))
 
     # run!
     return screen.ScreenSituation(internalConnectors, config.get('externalConnectors'))
 
-class ShowLevels(Enum):
-    ONEXTERNAL = ("on-external")
-    ONNEW = ("on-new")
-    ONERROR = ("on-error")
-    def __init__(self, text):
-        # auto numbering
-        cls = self.__class__
-        self._value_ = len(cls.__members__) + 1
-        self.text = text
-    @classmethod
-    def getNames(cls):
-        return list(x.text for x in cls)
-
 # if we run top-level
 if __name__ == "__main__":
     try:
 # if we run top-level
 if __name__ == "__main__":
     try:
@@ -114,6 +101,9 @@ if __name__ == "__main__":
         parser.add_argument("-s", "--silent",
                             dest="silent", action='store_true',
                             help="Prefer to be silent: Opens a UI only if the external screen is not known *and* no default configuration (-r/-e/-i) is given.")
         parser.add_argument("-s", "--silent",
                             dest="silent", action='store_true',
                             help="Prefer to be silent: Opens a UI only if the external screen is not known *and* no default configuration (-r/-e/-i) is given.")
+        parser.add_argument("--no-db",
+                            dest="use_db", action='store_false',
+                            help="Do not use the database of known screens.")
         parser.add_argument("-v", "--verbose",
                             dest="verbose", action='store_true',
                             help="More verbose output on stderr.")
         parser.add_argument("-v", "--verbose",
                             dest="verbose", action='store_true',
                             help="More verbose output on stderr.")
@@ -148,8 +138,9 @@ if __name__ == "__main__":
             # There's an external screen connected that we may want to use.
             # Fetch info about this screen from the database.
             # NOTE: If it is too slow to open the DB twice (reading and saving), we can keep it open all the time
             # There's an external screen connected that we may want to use.
             # Fetch info about this screen from the database.
             # NOTE: If it is too slow to open the DB twice (reading and saving), we can keep it open all the time
-            with database.Database(databaseFilePath) as db:
-                situation.fetchDBInfo(db)
+            if cmdArgs.use_db:
+                with database.Database(databaseFilePath) as db:
+                    situation.fetchDBInfo(db)
             # what to we do?
             have_default_conf = bool(cmdArgs.external_only or cmdArgs.internal_only or cmdArgs.rel_position)
             no_ui = bool(have_default_conf or (situation.previousSetup and cmdArgs.silent))
             # what to we do?
             have_default_conf = bool(cmdArgs.external_only or cmdArgs.internal_only or cmdArgs.rel_position)
             no_ui = bool(have_default_conf or (situation.previousSetup and cmdArgs.silent))
@@ -157,8 +148,10 @@ if __name__ == "__main__":
                 # ask the user what to do
                 setup = frontend.setup(situation)
                 if setup is None: sys.exit(1) # the user canceled
                 # ask the user what to do
                 setup = frontend.setup(situation)
                 if setup is None: sys.exit(1) # the user canceled
-                with database.Database(databaseFilePath) as db:
-                    situation.putDBInfo(db, setup)
+                if cmdArgs.use_db:
+                    # persists this to disk
+                    with database.Database(databaseFilePath) as db:
+                        situation.putDBInfo(db, setup)
             elif situation.previousSetup:
                 # apply the old setup again
                 setup = situation.previousSetup
             elif situation.previousSetup:
                 # apply the old setup again
                 setup = situation.previousSetup