Package list mirage / 49702b0
Update ConfigParser save code for Python 3 Thomas Ross 2 years ago
1 changed file(s) with 31 addition(s) and 31 deletion(s). Raw diff Collapse all Expand all
14961496 def save_settings(self):
14971497 conf = configparser.ConfigParser(interpolation=None)
14981498 conf.add_section("window")
1499 conf.set("window", "w", self.window.get_allocation().width)
1500 conf.set("window", "h", self.window.get_allocation().height)
1501 conf.set("window", "toolbar", self.toolbar_show)
1502 conf.set("window", "statusbar", self.statusbar_show)
1503 conf.set("window", "thumbpane", self.thumbpane_show)
1499 conf.set("window", "w", str(self.window.get_allocation().width))
1500 conf.set("window", "h", str(self.window.get_allocation().height))
1501 conf.set("window", "toolbar", str(self.toolbar_show))
1502 conf.set("window", "statusbar", str(self.statusbar_show))
1503 conf.set("window", "thumbpane", str(self.thumbpane_show))
15041504 conf.add_section("prefs")
1505 conf.set("prefs", "simple-bgcolor", self.simple_bgcolor)
1506 conf.set("prefs", "bgcolor-red", self.bgcolor.red)
1507 conf.set("prefs", "bgcolor-green", self.bgcolor.green)
1508 conf.set("prefs", "bgcolor-blue", self.bgcolor.blue)
1509 conf.set("prefs", "open_all", self.open_all_images)
1510 conf.set("prefs", "hidden", self.open_hidden_files)
1511 conf.set("prefs", "use_last_dir", self.use_last_dir)
1505 conf.set("prefs", "simple-bgcolor", str(self.simple_bgcolor))
1506 conf.set("prefs", "bgcolor-red", str(self.bgcolor.red))
1507 conf.set("prefs", "bgcolor-green", str(self.bgcolor.green))
1508 conf.set("prefs", "bgcolor-blue", str(self.bgcolor.blue))
1509 conf.set("prefs", "open_all", str(self.open_all_images))
1510 conf.set("prefs", "hidden", str(self.open_hidden_files))
1511 conf.set("prefs", "use_last_dir", str(self.use_last_dir))
15121512 conf.set("prefs", "last_dir", self.last_dir)
15131513 conf.set("prefs", "fixed_dir", self.fixed_dir)
1514 conf.set("prefs", "open_mode", self.open_mode)
1515 conf.set("prefs", "last_mode", self.last_mode)
1516 conf.set("prefs", "listwrap_mode", self.listwrap_mode)
1517 conf.set("prefs", "slideshow_delay", int(self.slideshow_delay))
1518 conf.set("prefs", "slideshow_random", self.slideshow_random)
1519 conf.set("prefs", "zoomquality", self.zoomvalue)
1520 conf.set("prefs", "quality_save", int(self.quality_save))
1521 conf.set("prefs", "disable_screensaver", self.disable_screensaver)
1522 conf.set("prefs", "slideshow_in_fullscreen", self.slideshow_in_fullscreen)
1523 conf.set("prefs", "confirm_delete", self.confirm_delete)
1524 conf.set("prefs", "preloading_images", self.preloading_images)
1525 conf.set("prefs", "savemode", self.savemode)
1526 conf.set("prefs", "start_in_fullscreen", self.start_in_fullscreen)
1527 conf.set("prefs", "thumbsize", self.thumbnail_size)
1528 conf.set("prefs", "screenshot_delay", self.screenshot_delay)
1514 conf.set("prefs", "open_mode", str(self.open_mode))
1515 conf.set("prefs", "last_mode", str(self.last_mode))
1516 conf.set("prefs", "listwrap_mode", str(self.listwrap_mode))
1517 conf.set("prefs", "slideshow_delay", str(int(self.slideshow_delay)))
1518 conf.set("prefs", "slideshow_random", str(self.slideshow_random))
1519 conf.set("prefs", "zoomquality", str(self.zoomvalue))
1520 conf.set("prefs", "quality_save", str(int(self.quality_save)))
1521 conf.set("prefs", "disable_screensaver", str(self.disable_screensaver))
1522 conf.set("prefs", "slideshow_in_fullscreen", str(self.slideshow_in_fullscreen))
1523 conf.set("prefs", "confirm_delete", str(self.confirm_delete))
1524 conf.set("prefs", "preloading_images", str(self.preloading_images))
1525 conf.set("prefs", "savemode", str(self.savemode))
1526 conf.set("prefs", "start_in_fullscreen", str(self.start_in_fullscreen))
1527 conf.set("prefs", "thumbsize", str(self.thumbnail_size))
1528 conf.set("prefs", "screenshot_delay", str(self.screenshot_delay))
15291529 conf.add_section("actions")
1530 conf.set("actions", "num_actions", len(self.action_names))
1530 conf.set("actions", "num_actions", str(len(self.action_names)))
15311531 for i in range(len(self.action_names)):
15321532 conf.set("actions", "names[" + str(i) + "]", self.action_names[i])
15331533 conf.set("actions", "commands[" + str(i) + "]", self.action_commands[i])
15341534 conf.set("actions", "shortcuts[" + str(i) + "]", self.action_shortcuts[i])
1535 conf.set("actions", "batch[" + str(i) + "]", self.action_batch[i])
1535 conf.set("actions", "batch[" + str(i) + "]", str(self.action_batch[i]))
15361536 conf.add_section("recent")
1537 conf.set("recent", "num_recent", len(self.recentfiles))
1537 conf.set("recent", "num_recent", str(len(self.recentfiles)))
15381538 for i in range(len(self.recentfiles)):
1539 conf.set("recent", "num[" + str(i) + "]", len(self.recentfiles[i]))
1539 conf.set("recent", "num[" + str(i) + "]", str(len(self.recentfiles[i])))
15401540 conf.set("recent", "urls[" + str(i) + ",0]", self.recentfiles[i])
15411541 if not os.path.exists(self.config_dir):
15421542 os.makedirs(self.config_dir)