Renamed "shelf" to "metadata database" in the UI.
authorJoel Rosdahl <joel@rosdahl.net>
Sun, 8 Aug 2004 12:11:24 +0000 (12:11 +0000)
committerJoel Rosdahl <joel@rosdahl.net>
Sun, 8 Aug 2004 12:11:24 +0000 (12:11 +0000)
src/cmdline/kofoto
src/gkofoto/gkofoto/controller.py
src/gkofoto/gkofoto/main.py
src/lib/kofoto/clientenvironment.py
src/lib/kofoto/config.py

index 1596abf..3fa9461 100755 (executable)
@@ -50,6 +50,9 @@ def displayHelp():
         "    -h, --help                       Display this help.\n"
         "        --configfile FILE            Use configuration file FILE instead of the\n"
         "                                     default (%s).\n"
+        "        --database DATABASE          Use the metadata database DATABASE instead\n"
+        "                                     of the default (specified in the\n"
+        "                                     configuration file).\n"
         "        --gencharenc ENC             Generate HTML pages with character\n"
         "                                     encoding ENC instead of the default\n"
         "                                     (taken from locale settings).\n"
@@ -57,9 +60,8 @@ def displayHelp():
         "    -l, --location LOCATION          Add/register to location LOCATION.\n"
         "                                     Default: last.\n"
         "        --no-act                     Do everything which is supposed to be done,\n"
-        "                                     but don't commit any changes to the shelf.\n"
-        "        --shelf SHELF                Use the shelf SHELF instead of the default\n"
-        "                                     (specified in the configuration file).\n"
+        "                                     but don't commit any changes to the\n"
+        "                                     database.\n"
         "    -t, --type TYPE                  Use album type TYPE when creating an album\n"
         "                                     or output type TYPE when generating output.\n"
         "    -v, --verbose                    Be verbose (and slower).\n"
@@ -67,8 +69,8 @@ def displayHelp():
         "\n"
         "Commands:\n"
         "\n"
-        "    For shelfs\n"
-        "    ==========\n"
+        "    For databases\n"
+        "    =============\n"
         "    check                            Find missing images and print some\n"
         "                                     statistics.\n"
         "    create-album TAG                 Create an empty, unlinked album with tag\n"
@@ -681,13 +683,13 @@ def main(argv):
         optlist, args = getopt.gnu_getopt(
             argv[1:],
             "hl:t:vV",
-            ["configfile=",
+            ["database=",
+             "configfile=",
              "gencharenc=",
              "help",
              "ids",
              "location=",
              "no-act",
-             "shelf=",
              "type=",
              "verbose",
              "version"])
@@ -706,6 +708,8 @@ def main(argv):
     for opt, optarg in optlist:
         if opt == "--configfile":
             configFileLocation = os.path.expanduser(env.to_l(optarg))
+        elif opt == "--database":
+            shelfLocation = env.to_l(optarg)
         elif opt == "--gencharenc":
             genCharEnc = str(optarg)
         elif opt in ("-h", "--help"):
@@ -722,8 +726,6 @@ def main(argv):
                 except ValueError:
                     printErrorAndExit("Invalid location: \"%s\"\n" %
                                       env.to_l(optarg))
-        elif opt == "--shelf":
-            shelfLocation = env.to_l(optarg)
         elif opt in ("-t", "--type"):
             env.type = optarg
         elif opt in ("-v", "--verbose"):
@@ -732,7 +734,7 @@ def main(argv):
             sys.stdout.write("%s\n" % env.version)
             sys.exit(0)
         elif opt == "--no-act":
-            sys.stdout.write("no-act: No changes will be commited to the shelf!\n")
+            sys.stdout.write("no-act: No changes will be commited to the database!\n")
             env.noAct = True
 
     if len(args) == 0:
@@ -752,15 +754,15 @@ def main(argv):
     try:
         env.shelf.begin()
     except ShelfNotFoundError, x:
-        printErrorAndExit("Could not open shelf \"%s\".\n" % (
+        printErrorAndExit("Could not open metadata database \"%s\".\n" % (
             env.shelfLocation))
     except ShelfLockedError, x:
         printErrorAndExit(
-            "Could not open shelf \"%s\".\n" % env.shelfLocation +
+            "Could not open metadata database \"%s\".\n" % env.shelfLocation +
             "Another process is locking it.\n")
     except UnsupportedShelfError, filename:
         printErrorAndExit(
-            "Could not read shelf file %s (too new shelf format?).\n" %
+            "Could not read metadata database file %s (too new database format?).\n" %
             filename)
     try:
         env.gencharenc = genCharEnc
@@ -785,7 +787,7 @@ def main(argv):
         commandTable[args[0]](env, args[1:])
         if env.noAct:
             env.shelf.rollback()
-            printOutput("no-act: All changes to the shelf have been revoked!\n")
+            printOutput("no-act: All changes to the database have been revoked!\n")
         else:
             env.shelf.commit()
         sys.exit(0)
index 6ae19d7..9bc9091 100644 (file)
@@ -14,7 +14,7 @@ class Controller:
                 env.shelf.begin()
             except ShelfLockedError, e:
                 env.startupNotices += [
-                    "Error: Could not open shelf \"%s\"." % e +
+                    "Error: Could not open metadata database \"%s\"." % e +
                     " Another process is locking it.\n"]
                 setupOk = False
         if env.startupNotices:
index dbd492a..e5dd7b8 100644 (file)
@@ -13,23 +13,23 @@ def main(bindir, argv):
         help="use configuration file CONFIGFILE instead of the default (%s)" % (
             DEFAULT_CONFIGFILE_LOCATION),
         default=None)
+    parser.add_option(
+        "--database",
+        type="string",
+        dest="database",
+        help="use metadata database DATABASE instead of the default (specified in the configuration file)",
+        default=None)
     parser.add_option(
         "--debug",
         action="store_true",
         help="print debug messages to stdout",
         default=False)
-    parser.add_option(
-        "--shelf",
-        type="string",
-        dest="shelf",
-        help="use shelf SHELF instead of the default (specified in the configuration file)",
-        default=None)
     options, args = parser.parse_args(argv[1:])
 
     if len(args) != 0:
         parser.error("incorrect number of arguments")
 
     setupOk = env.setup(
-        bindir, options.debug, options.configfile, options.shelf)
+        bindir, options.debug, options.configfile, options.database)
     env.controller = Controller()
     env.controller.start(setupOk)
index 5215de9..c110007 100644 (file)
@@ -67,7 +67,7 @@ class ClientEnvironment(object):
         A missing configuration file will be created iff
         createMissingConfigFile is true.
 
-        A missing shelf will be created iff createMissingShel is true.
+        A missing shelf will be created iff createMissingShelf is true.
         """
 
         if configFileLocation == None:
@@ -116,7 +116,7 @@ class ClientEnvironment(object):
 
         if shelfLocation == None:
             self.__shelfLocation = self.unicodeToLocalizedString(
-                os.path.expanduser(self.config.get("shelf", "location")))
+                os.path.expanduser(self.config.get("database", "location")))
         else:
             self.__shelfLocation = shelfLocation
 
@@ -128,13 +128,13 @@ class ClientEnvironment(object):
                     self.shelf.create()
                 except FailedWritingError, self.shelfLocation:
                     raise BadShelfError, \
-                        ("Could not create shelf file %s.\n" % (
+                        ("Could not create metadata database \"%s\".\n" % (
                              self.shelfLocation),
                          self.shelfLocation)
-                self._writeInfo("Created shelf \"%s\".\n" % self.shelfLocation)
+                self._writeInfo("Created metadata database \"%s\".\n" % self.shelfLocation)
             else:
                 raise MissingShelfError, \
-                    ("Could not open shelf \"%s\"" % self.shelfLocation,
+                    ("Could not open metadata database \"%s\"" % self.shelfLocation,
                      self.shelfLocation)
 
         self.__imageCache = ImageCache(
index 7e6d950..0dcaa99 100644 (file)
@@ -23,14 +23,14 @@ if sys.platform.startswith("win"):
     DEFAULT_CONFIGFILE_LOCATION = os.path.join(
         "~", "KofotoData", "config.ini")
     DEFAULT_SHELF_LOCATION = os.path.join(
-        "~", "KofotoData", "shelf.db")
+        "~", "KofotoData", "metadata.db")
     DEFAULT_IMAGECACHE_LOCATION = os.path.join(
         "~", "KofotoData", "ImageCache")
 else:
     DEFAULT_CONFIGFILE_LOCATION = os.path.join(
         "~", ".kofoto", "config")
     DEFAULT_SHELF_LOCATION = os.path.join(
-        "~", ".kofoto", "shelf")
+        "~", ".kofoto", "metadata")
     DEFAULT_IMAGECACHE_LOCATION = os.path.join(
         "~", ".kofoto", "imagecache")
 
@@ -92,7 +92,7 @@ class Config(ConfigParser):
             if function and not function(value):
                 raise BadConfigurationValueError, (section, key, value)
 
-        checkConfigurationItem("shelf", "location", None)
+        checkConfigurationItem("database", "location", None)
         checkConfigurationItem("image cache", "location", None)
         checkConfigurationItem(
             "image cache", "use_orientation_attribute", None)
@@ -110,10 +110,10 @@ def createConfigTemplate(filename):
 
 ######################################################################
 ## General configuration
-[shelf]
+[database]
 
-# Default location of the shelf. This is where information about
-# albums, images, categories, etc., is stored.
+# Default location of the metadata database. This is where information
+# about albums, images, categories, etc., is stored.
 location = %s
 
 ######################################################################