release for 1.6.0
This commit is contained in:
@@ -56,9 +56,8 @@ recent_projects =
|
||||
|
||||
[View]
|
||||
status_bar = true
|
||||
left_top = 0
|
||||
left_bottom = 0
|
||||
right = 0
|
||||
main_h_ratio = 0.5778
|
||||
left_v_ratio = 0.30
|
||||
|
||||
[Options]
|
||||
show_welcome_dialog = false
|
||||
@@ -520,6 +519,7 @@ class MainApplication(QMainWindow):
|
||||
self.folder_paths = []
|
||||
self.section_widget = None
|
||||
self.first_run = True
|
||||
self.show_status_bar = False
|
||||
self.is_2d_bypass = False
|
||||
self.incompatible_save_bypass = False
|
||||
self.missing_events_bypass = False
|
||||
@@ -710,6 +710,9 @@ class MainApplication(QMainWindow):
|
||||
self.main_h_splitter.setSizes([600, 400])
|
||||
self.left_v_splitter.setSizes([300, 700])
|
||||
|
||||
self.main_h_splitter.splitterMoved.connect(self.save_splitter_ratios)
|
||||
self.left_v_splitter.splitterMoved.connect(self.save_splitter_ratios)
|
||||
|
||||
self.progress_update_signal.connect(self.update_file_progress)
|
||||
self.update_window_title()
|
||||
self.update_sections(0)
|
||||
@@ -781,11 +784,13 @@ class MainApplication(QMainWindow):
|
||||
edit_menu.addAction(make_action(name, shortcut, slot, icon=icon))
|
||||
|
||||
# View menu
|
||||
# TODO: Pretty this like the rest of the menus?
|
||||
|
||||
self.view_actions = {}
|
||||
|
||||
view_menu = menu_bar.addMenu("View")
|
||||
toggle_statusbar_action = make_action("Toggle Status Bar", checkable=True, checked=True, slot=None)
|
||||
toggle_statusbar_action = make_action("Toggle Status Bar", "", self.toggle_statusbar, True, True, resource_path("icons/short_text_24dp_1F1F1F.svg"))
|
||||
view_menu.addAction(toggle_statusbar_action)
|
||||
toggle_statusbar_action.toggled.connect(self.statusbar.setVisible)
|
||||
self.view_actions["statusbar"] = toggle_statusbar_action
|
||||
|
||||
# Reset Layout Action
|
||||
view_menu.addSeparator()
|
||||
@@ -1083,20 +1088,19 @@ class MainApplication(QMainWindow):
|
||||
|
||||
self.is_saved = not (files_dirty or params_dirty or meta_dirty)
|
||||
self.update_window_title()
|
||||
|
||||
|
||||
def reset_window_layout(self):
|
||||
"""
|
||||
Snaps all draggable splitters back to their default proportional positions.
|
||||
"""
|
||||
total_width = self.main_h_splitter.width()
|
||||
left_w = int(total_width * 26 / 45)
|
||||
right_w = total_width - left_w
|
||||
self.main_h_splitter.setSizes([left_w, right_w])
|
||||
self.main_h_ratio = 26 / 45
|
||||
self.left_v_ratio = 0.30
|
||||
|
||||
total_height = self.left_v_splitter.height()
|
||||
top_h = int(total_height * 0.30)
|
||||
bottom_h = total_height - top_h
|
||||
self.left_v_splitter.setSizes([top_h, bottom_h])
|
||||
self.apply_splitter_ratios()
|
||||
|
||||
self._update_config_setting("View", "main_h_ratio", round(self.main_h_ratio, 4))
|
||||
self._update_config_setting("View", "left_v_ratio", round(self.left_v_ratio, 4))
|
||||
|
||||
self.statusBar().showMessage("Window layout has been reset to default.", 3000)
|
||||
|
||||
@@ -1133,39 +1137,44 @@ class MainApplication(QMainWindow):
|
||||
self.top_left_widget.paste() # Trigger paste
|
||||
self.statusbar.showMessage("Pasted from clipboard") # Show status message
|
||||
|
||||
def _update_config_setting(self, key, value):
|
||||
def _update_config_setting(self, group, key, value):
|
||||
"""Helper to update memory configuration and save to disk."""
|
||||
# configparser expects string values
|
||||
file_cfg.set("Preferences", key, str(value).lower())
|
||||
file_cfg.set(group, key, str(value).lower())
|
||||
try:
|
||||
with open(cfg_path, "w") as f:
|
||||
file_cfg.write(f)
|
||||
except Exception as e:
|
||||
print(f"Warning: Could not save setting '{key}' to disk: {e}")
|
||||
|
||||
def toggle_statusbar(self, checked):
|
||||
self.show_status_bar = checked
|
||||
self._update_config_setting("View", "status_bar", checked)
|
||||
self.statusbar.setVisible(checked)
|
||||
|
||||
def is_2d_bypass_func(self, checked):
|
||||
self.is_2d_bypass = checked
|
||||
self._update_config_setting("2d_data_bypass", checked)
|
||||
self._update_config_setting("Preferences", "2d_data_bypass", checked)
|
||||
|
||||
def incompatable_save_bypass_func(self, checked):
|
||||
self.incompatible_save_bypass = checked
|
||||
self._update_config_setting("incompatible_save_bypass", checked)
|
||||
self._update_config_setting("Preferences", "incompatible_save_bypass", checked)
|
||||
|
||||
def missing_events_bypass_func(self, checked):
|
||||
self.missing_events_bypass = checked
|
||||
self._update_config_setting("missing_events_bypass", checked)
|
||||
self._update_config_setting("Preferences", "missing_events_bypass", checked)
|
||||
|
||||
def analysis_clearing_bypass_func(self, checked):
|
||||
self.analysis_clearing_bypass = checked
|
||||
self._update_config_setting("analysis_clearing_bypass", checked)
|
||||
self._update_config_setting("Preferences", "analysis_clearing_bypass", checked)
|
||||
|
||||
def folding_bypass_func(self, checked):
|
||||
self.folding_bypass = checked
|
||||
self._update_config_setting("folding_bypass", checked)
|
||||
self._update_config_setting("Preferences", "folding_bypass", checked)
|
||||
|
||||
def advanced_parameters_func(self, checked):
|
||||
self.advanced_parameters = checked
|
||||
self._update_config_setting("advanced_parameters", checked)
|
||||
self._update_config_setting("Preferences", "advanced_parameters", checked)
|
||||
self.update_sections(0)
|
||||
|
||||
def about_window(self):
|
||||
@@ -1275,6 +1284,10 @@ class MainApplication(QMainWindow):
|
||||
self.folding_bypass = file_cfg.getboolean("Preferences", "folding_bypass", fallback=False)
|
||||
self.advanced_parameters = file_cfg.getboolean("Preferences", "advanced_parameters", fallback=False)
|
||||
|
||||
self.show_status_bar = file_cfg.getboolean("View", "status_bar", fallback=False)
|
||||
self.main_h_ratio = file_cfg.getfloat("View", "main_h_ratio", fallback=26 / 45)
|
||||
self.left_v_ratio = file_cfg.getfloat("View", "left_v_ratio", fallback=0.30)
|
||||
|
||||
# 2. Sync the UI Menu checkmarks visually
|
||||
if hasattr(self, 'pref_actions'):
|
||||
self.pref_actions["2d_data_bypass"].setChecked(self.is_2d_bypass)
|
||||
@@ -1284,6 +1297,9 @@ class MainApplication(QMainWindow):
|
||||
self.pref_actions["folding_bypass"].setChecked(self.folding_bypass)
|
||||
self.pref_actions["advanced_parameters"].setChecked(self.advanced_parameters)
|
||||
|
||||
if hasattr(self, 'view_actions'):
|
||||
self.view_actions["statusbar"].setChecked(self.show_status_bar)
|
||||
|
||||
if self.advanced_parameters:
|
||||
self.update_sections(0)
|
||||
|
||||
@@ -1293,7 +1309,45 @@ class MainApplication(QMainWindow):
|
||||
if hasattr(self, 'recent_projects_menu'):
|
||||
self.project_manager.update_recent_projects_menu()
|
||||
|
||||
|
||||
QTimer.singleShot(0, self.apply_splitter_ratios)
|
||||
|
||||
|
||||
def save_splitter_ratios(self):
|
||||
"""Calculates current splitter ratios and saves them via _update_config_setting."""
|
||||
# Calculate main horizontal splitter ratio
|
||||
if hasattr(self, 'main_h_splitter'):
|
||||
h_sizes = self.main_h_splitter.sizes()
|
||||
h_total = sum(h_sizes)
|
||||
if h_total > 0:
|
||||
self.main_h_ratio = round(h_sizes[0] / h_total, 4)
|
||||
self._update_config_setting("View", "main_h_ratio", self.main_h_ratio)
|
||||
|
||||
# Calculate left vertical splitter ratio
|
||||
if hasattr(self, 'left_v_splitter'):
|
||||
v_sizes = self.left_v_splitter.sizes()
|
||||
v_total = sum(v_sizes)
|
||||
if v_total > 0:
|
||||
self.left_v_ratio = round(v_sizes[0] / v_total, 4)
|
||||
self._update_config_setting("View", "left_v_ratio", self.left_v_ratio)
|
||||
|
||||
|
||||
def apply_splitter_ratios(self):
|
||||
"""Applies saved ratio positions to main_h_splitter and left_v_splitter."""
|
||||
if hasattr(self, 'main_h_splitter'):
|
||||
print("Splitter actual width:", self.main_h_splitter.width())
|
||||
total_width = self.main_h_splitter.width()
|
||||
if total_width > 0:
|
||||
left_w = int(total_width * self.main_h_ratio)
|
||||
right_w = total_width - left_w
|
||||
self.main_h_splitter.setSizes([left_w, right_w])
|
||||
|
||||
if hasattr(self, 'left_v_splitter'):
|
||||
total_height = self.left_v_splitter.height()
|
||||
if total_height > 0:
|
||||
top_h = int(total_height * self.left_v_ratio)
|
||||
bottom_h = total_height - top_h
|
||||
self.left_v_splitter.setSizes([top_h, bottom_h])
|
||||
|
||||
|
||||
def restore_sections_from_config(self, config):
|
||||
"""
|
||||
@@ -1639,6 +1693,9 @@ class MainApplication(QMainWindow):
|
||||
if key_to_delete:
|
||||
del self.bubble_widgets[key_to_delete]
|
||||
|
||||
if hasattr(self, 'button1') and not self.bubble_widgets:
|
||||
self.button1.setVisible(False)
|
||||
|
||||
# Remove from selected_paths
|
||||
if hasattr(self, 'selected_paths'):
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user