changed setting loading
|
@ -15,6 +15,7 @@ class Window:
|
|||
self.id = ""
|
||||
self.name = ""
|
||||
self.nickname = ""
|
||||
self.isHidden = False
|
||||
self.views = []
|
||||
|
||||
self.generate_id()
|
||||
|
|
|
@ -13,14 +13,13 @@ class WindowController:
|
|||
def __init__(self):
|
||||
USER_HOME = path.expanduser('~')
|
||||
CONFIG_PATH = USER_HOME + "/.config/pyfm"
|
||||
self.config_file = CONFIG_PATH + "/session.json"
|
||||
self.session_file = CONFIG_PATH + "/session.json"
|
||||
|
||||
self.active_window_id = ""
|
||||
self.active_tab_id = ""
|
||||
self.windows = []
|
||||
|
||||
|
||||
|
||||
def set_active_data(self, wid, tid):
|
||||
self.active_window_id = str(wid)
|
||||
self.active_tab_id = str(tid)
|
||||
|
@ -111,8 +110,8 @@ class WindowController:
|
|||
print(f"\nID: {window.id}")
|
||||
print(f"Name: {window.name}")
|
||||
print(f"Nickname: {window.nickname}")
|
||||
print(f"Is Hidden: {window.isHidden}")
|
||||
print(f"View Count: {window.get_views_count()}")
|
||||
|
||||
print("\n-------------------------\n")
|
||||
|
||||
|
||||
|
@ -150,16 +149,17 @@ class WindowController:
|
|||
"ID": window.id,
|
||||
"Name": window.name,
|
||||
"Nickname": window.nickname,
|
||||
"isHidden": window.isHidden,
|
||||
'views': views
|
||||
}
|
||||
}
|
||||
]
|
||||
)
|
||||
|
||||
with open(self.config_file, 'w') as outfile:
|
||||
with open(self.session_file, 'w') as outfile:
|
||||
json.dump(windows, outfile, separators=(',', ':'), indent=4)
|
||||
|
||||
def load_state(self):
|
||||
if path.isfile(self.config_file):
|
||||
with open(self.config_file) as infile:
|
||||
if path.isfile(self.session_file):
|
||||
with open(self.session_file) as infile:
|
||||
return json.load(infile)
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
# System import
|
||||
import json
|
||||
import os
|
||||
from os import path
|
||||
|
||||
|
@ -11,17 +12,12 @@ from os import path
|
|||
|
||||
class Settings:
|
||||
logger = None
|
||||
lock_folder = False
|
||||
go_past_home = True
|
||||
|
||||
GTK_ORIENTATION = 1 # HORIZONTAL (0) VERTICAL (1)
|
||||
ABS_THUMBS_PTH = None # Used for thumbnail generation and is set by passing in
|
||||
REMUX_FOLDER = None # Used for Remuxed files and is set by passing in
|
||||
FFMPG_THUMBNLR = None # Used for thumbnail generator binary and is set by passing in
|
||||
HIDE_HIDDEN_FILES = True
|
||||
|
||||
USER_HOME = path.expanduser('~')
|
||||
CONFIG_PATH = USER_HOME + "/.config/pyfm"
|
||||
CONFIG_PATH = USER_HOME + "/.config/shellfm"
|
||||
CONFIG_FILE = CONFIG_PATH + "/settings.json"
|
||||
|
||||
GTK_ORIENTATION = 1 # HORIZONTAL (0) VERTICAL (1)
|
||||
DEFAULT_ICONS = CONFIG_PATH + "/icons"
|
||||
DEFAULT_ICON = DEFAULT_ICONS + "/text.png"
|
||||
FFMPG_THUMBNLR = CONFIG_PATH + "/ffmpegthumbnailer" # Thumbnail generator binary
|
||||
|
@ -36,17 +32,42 @@ class Settings:
|
|||
VIDEO_ICON_WH = [128, 64]
|
||||
SYS_ICON_WH = [56, 56]
|
||||
|
||||
subpath = "" # modify 'home' folder path
|
||||
locked_folders = "venv::::flasks".split("::::")
|
||||
mplayer_options = "-quiet -really-quiet -xy 1600 -geometry 50%:50%".split()
|
||||
music_app = "/opt/deadbeef/bin/deadbeef"
|
||||
media_app = "mpv"
|
||||
image_app = "mirage"
|
||||
office_app = "libreoffice"
|
||||
pdf_app = "evince"
|
||||
text_app = "leafpad"
|
||||
file_manager_app = "spacefm"
|
||||
remux_folder_max_disk_usage = "8589934592"
|
||||
# CONTAINER_ICON_WH = [128, 128]
|
||||
# VIDEO_ICON_WH = [96, 48]
|
||||
# SYS_ICON_WH = [96, 96]
|
||||
|
||||
subpath = ""
|
||||
go_past_home = None
|
||||
lock_folder = None
|
||||
locked_folders = None
|
||||
mplayer_options = None
|
||||
music_app = None
|
||||
media_app = None
|
||||
image_app = None
|
||||
office_app = None
|
||||
pdf_app = None
|
||||
text_app = None
|
||||
file_manager_app = None
|
||||
remux_folder_max_disk_usage = None
|
||||
|
||||
if path.isfile(CONFIG_FILE):
|
||||
with open(CONFIG_FILE) as infile:
|
||||
settings = json.load(infile)["settings"]
|
||||
|
||||
subpath = settings["base_of_home"]
|
||||
HIDE_HIDDEN_FILES = True if settings["hide_hidden_files"] == "true" else False
|
||||
go_past_home = True if settings["go_past_home"] == "true" else False
|
||||
lock_folder = True if settings["lock_folder"] == "true" else False
|
||||
locked_folders = settings["locked_folders"].split("::::")
|
||||
mplayer_options = settings["mplayer_options"].split()
|
||||
music_app = settings["music_app"]
|
||||
media_app = settings["media_app"]
|
||||
image_app = settings["image_app"]
|
||||
office_app = settings["office_app"]
|
||||
pdf_app = settings["pdf_app"]
|
||||
text_app = settings["text_app"]
|
||||
file_manager_app = settings["file_manager_app"]
|
||||
remux_folder_max_disk_usage = settings["remux_folder_max_disk_usage"]
|
||||
|
||||
# Filters
|
||||
fvideos = ('.mkv', '.avi', '.flv', '.mov', '.m4v', '.mpg', '.wmv', '.mpeg', '.mp4', '.webm')
|
||||
|
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 858 B After Width: | Height: | Size: 858 B |
Before Width: | Height: | Size: 850 B After Width: | Height: | Size: 850 B |
Before Width: | Height: | Size: 702 B After Width: | Height: | Size: 702 B |
Before Width: | Height: | Size: 925 B After Width: | Height: | Size: 925 B |
Before Width: | Height: | Size: 882 B After Width: | Height: | Size: 882 B |
Before Width: | Height: | Size: 707 B After Width: | Height: | Size: 707 B |
Before Width: | Height: | Size: 798 B After Width: | Height: | Size: 798 B |
Before Width: | Height: | Size: 989 B After Width: | Height: | Size: 989 B |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
"settings": {
|
||||
"base_of_home": "",
|
||||
"hide_hidden_files": "true",
|
||||
"go_past_home": "true",
|
||||
"lock_folder": "false",
|
||||
"locked_folders": "venv::::flasks",
|
||||
"mplayer_options": "-quiet -really-quiet -xy 1600 -geometry 50%:50%",
|
||||
"music_app": "/opt/deadbeef/bin/deadbeef",
|
||||
"media_app": "mpv",
|
||||
"image_app": "mirage",
|
||||
"office_app": "libreoffice",
|
||||
"pdf_app": "evince",
|
||||
"text_app": "leafpad",
|
||||
"file_manager_app": "spacefm",
|
||||
"remux_folder_max_disk_usage": "8589934592"
|
||||
}
|
||||
}
|