add config file comments, minor JS refactoring
[ppt-control.git] / ppt_control / ppt_control.py
index e5a38c145c88338418bbc1d296ef77184f3d03c1..45e0611333fac488d1ba6ada4a2a3fffb01b32fa 100755 (executable)
@@ -514,12 +514,14 @@ class Presentation:
     def export(self, slide):\r
         """\r
         Export a relatively low-resolution image of a slide using PowerPoint's built-in export \r
-        function. The cache destination is set in the config.\r
+        function. The cache destination is set in the config. The slide is not exported if it has \r
+        a non-stale cached file.\r
         """\r
         destination = config.prefs["Main"]["cache"] + "\\" + self.presentation.Name + "\\" + str(slide) + "." + config.prefs["Main"]["cache_format"].lower()\r
         logger.debug("Exporting slide {} of {}".format(slide, self.presentation.Name))\r
         os.makedirs(os.path.dirname(destination), exist_ok=True)\r
-        if not os.path.exists(destination) or time.time() - os.path.getmtime(destination) > config.prefs.getint("Main", "cache_timeout"):\r
+        if not os.path.exists(destination) or (config.prefs.getint("Main", "cache_timeout") > 0 and \r
+                time.time() - os.path.getmtime(destination) > config.prefs.getint("Main", "cache_timeout")):\r
             if slide <= self.slide_total():\r
                 attempts = 0\r
                 while attempts < 3:\r
@@ -731,10 +733,9 @@ def start_interface():
     if config.prefs["Main"]["logging"] == "debug":\r
         log_level = logging.DEBUG\r
     elif config.prefs["Main"]["logging"] == "info":\r
-        log_level = logging.CRITICAL\r
+        log_level = logging.INFO\r
     else:\r
         log_level = logging.WARNING\r
-    log_level = logging.DEBUG\r
 \r
     log_formatter = logging.Formatter("%(asctime)s [%(threadName)-12.12s] [%(levelname)-7.7s]  %(message)s")\r
     logger = logging.getLogger("ppt-control")\r
@@ -774,7 +775,6 @@ def start_interface():
     icon = MyIcon(PKG_NAME)\r
     icon.icon = Image.open(os.path.dirname(os.path.realpath(__file__)) + r'''\static\icons\ppt.ico''')\r
     icon.title = "{} {}".format(PKG_NAME, PKG_VERSION)\r
-    #refresh_menu(icon)\r
     icon.visible = True\r
     icon.run(setup=start_server)\r
 \r