Merge pull request #128 from kra-mo/windows-logging-fix

Windows fixes
This commit is contained in:
Geoffrey Coulaud
2023-07-01 18:29:47 +02:00
committed by GitHub
2 changed files with 8 additions and 4 deletions

View File

@@ -88,16 +88,20 @@ class SessionFileHandler(StreamHandler):
# If uncompressed, compress # If uncompressed, compress
if not path.name.endswith(".xz"): if not path.name.endswith(".xz"):
new_path = path.with_suffix(path.suffix + ".xz") compressed_path = path.with_suffix(path.suffix + ".xz")
with ( with (
lzma.open( lzma.open(
new_path, "wt", format=FORMAT_XZ, preset=PRESET_DEFAULT compressed_path,
"wt",
format=FORMAT_XZ,
preset=PRESET_DEFAULT,
encoding="utf-8",
) as lzma_file, ) as lzma_file,
open(path, "r", encoding="utf-8") as original_file, open(path, "r", encoding="utf-8") as original_file,
): ):
lzma_file.write(original_file.read()) lzma_file.write(original_file.read())
path.unlink() path.unlink()
path = new_path path = compressed_path
# Rename with new number suffix # Rename with new number suffix
new_number = self.get_path_number(path) + 1 new_number = self.get_path_number(path) + 1

View File

@@ -143,7 +143,7 @@ class PreferencesWindow(Adw.PreferencesWindow):
source = source_class() source = source_class()
if not source.is_available: if not source.is_available:
expander_row = getattr(self, f"{source.id}_expander_row") expander_row = getattr(self, f"{source.id}_expander_row")
expander_row.remove() expander_row.set_visible(False)
else: else:
self.init_source_row(source) self.init_source_row(source)