add methode for font and color on infolabel part one
This commit is contained in:
@@ -227,6 +227,7 @@ class Msg:
|
||||
"warning_not_enough_space": _("WARNING: Not enough space for the backup.\nPlease free up space or choose another location."),
|
||||
"warning_space_over_90_percent": _("WARNING: The storage space will be over 90% full. Backup at your own risk!"),
|
||||
"ready_for_first_backup": _("Everything is ready for your first backup."),
|
||||
"backup_mode": _("Backup Mode"),
|
||||
"backup_mode_info": _("Backup Mode: You can start a backup here."),
|
||||
"restore_mode_info": _("Restore Mode: You can start a restore here."),
|
||||
"advanced_settings_title": _("Advanced Settings"),
|
||||
|
28
main_app.py
28
main_app.py
@@ -450,8 +450,8 @@ class MainApplication(tk.Tk):
|
||||
self.info_checkbox_frame = ttk.Frame(self.content_frame, padding=10)
|
||||
self.info_checkbox_frame.grid(row=3, column=0, sticky="ew")
|
||||
|
||||
self.info_label = ttk.Label(
|
||||
self.info_checkbox_frame, text=Msg.STR["info_text_placeholder"])
|
||||
self.info_label = ttk.Label(self.info_checkbox_frame)
|
||||
self._update_info_label(Msg.STR["backup_mode"]) # Set initial text
|
||||
self.info_label.pack(anchor=tk.W, fill=tk.X, pady=5)
|
||||
|
||||
self.sync_mode_label = ttk.Label(
|
||||
@@ -584,6 +584,9 @@ class MainApplication(tk.Tk):
|
||||
except tk.TclError:
|
||||
pass # App is already destroyed
|
||||
|
||||
def _update_info_label(self, text, color="black"):
|
||||
self.info_label.config(text=text, foreground=color, font=("Helvetica", 14))
|
||||
|
||||
def _process_queue(self):
|
||||
try:
|
||||
for _ in range(100):
|
||||
@@ -651,12 +654,10 @@ class MainApplication(tk.Tk):
|
||||
self.start_cancel_button.config(
|
||||
text=Msg.STR["start"])
|
||||
if status == 'success':
|
||||
self.info_label.config(
|
||||
text=Msg.STR["incremental_size_success"], foreground="#0078d7")
|
||||
self._update_info_label(Msg.STR["incremental_size_success"], color="#0078d7")
|
||||
self.current_file_label.config(text="")
|
||||
else:
|
||||
self.info_label.config(
|
||||
text=Msg.STR["incremental_size_failed"], foreground="#D32F2F")
|
||||
self._update_info_label(Msg.STR["incremental_size_failed"], color="#D32F2F")
|
||||
self.current_file_label.config(text="")
|
||||
|
||||
elif isinstance(message, tuple) and len(message) == 2:
|
||||
@@ -664,14 +665,14 @@ class MainApplication(tk.Tk):
|
||||
|
||||
if message_type == 'progress':
|
||||
self.task_progress["value"] = value
|
||||
self.info_label.config(text=f"Fortschritt: {value}%")
|
||||
self._update_info_label(f"Fortschritt: {value}%")
|
||||
elif message_type == 'file_update':
|
||||
max_len = 120
|
||||
if len(value) > max_len:
|
||||
value = "..." + value[-max_len:]
|
||||
self.current_file_label.config(text=value)
|
||||
elif message_type == 'status_update':
|
||||
self.info_label.config(text=value)
|
||||
self._update_info_label(value)
|
||||
elif message_type == 'progress_mode':
|
||||
self.task_progress.config(mode=value)
|
||||
if value == 'indeterminate':
|
||||
@@ -709,16 +710,13 @@ class MainApplication(tk.Tk):
|
||||
self.next_backup_content_view = 'user'
|
||||
|
||||
if status == 'success':
|
||||
self.info_label.config(
|
||||
text=Msg.STR["backup_finished_successfully"])
|
||||
self._update_info_label(Msg.STR["backup_finished_successfully"])
|
||||
elif status == 'warning':
|
||||
self.info_label.config(
|
||||
text=Msg.STR["backup_finished_with_warnings"])
|
||||
self._update_info_label(Msg.STR["backup_finished_with_warnings"])
|
||||
elif status == 'error':
|
||||
self.info_label.config(
|
||||
text=Msg.STR["backup_failed"])
|
||||
self._update_info_label(Msg.STR["backup_failed"])
|
||||
elif status == 'cancelled':
|
||||
pass
|
||||
self._update_info_label(Msg.STR["backup_mode"])
|
||||
|
||||
self.animated_icon.stop("DISABLE")
|
||||
self.start_cancel_button["text"] = "Start"
|
||||
|
@@ -126,8 +126,7 @@ class Actions:
|
||||
|
||||
self.app.drawing.reset_projection_canvases()
|
||||
|
||||
self.app.info_label.config(
|
||||
text=Msg.STR["please_wait"], foreground="#0078d7")
|
||||
self.app._update_info_label(Msg.STR["please_wait"], color="#0078d7")
|
||||
self.app.task_progress.config(mode="indeterminate")
|
||||
self.app.task_progress.start()
|
||||
self.app.left_canvas_data.update({
|
||||
@@ -240,6 +239,12 @@ class Actions:
|
||||
else:
|
||||
extra_info = Msg.STR["user_restore_info"]
|
||||
|
||||
# Update the info label based on the current mode
|
||||
if self.app.mode == 'backup':
|
||||
self.app._update_info_label(Msg.STR["backup_mode"])
|
||||
elif self.app.mode == 'restore':
|
||||
self.app._update_info_label(Msg.STR["restore"])
|
||||
|
||||
self._start_left_canvas_calculation(
|
||||
button_text, str(folder_path), icon_name, extra_info)
|
||||
self.app._update_sync_mode_display()
|
||||
@@ -519,8 +524,7 @@ class Actions:
|
||||
|
||||
self.app.task_progress.stop()
|
||||
self.app.task_progress.config(mode="determinate", value=0)
|
||||
self.app.info_label.config(
|
||||
text=Msg.STR["incremental_calc_cancelled"], foreground="#E8740C")
|
||||
self.app._update_info_label(Msg.STR["incremental_calc_cancelled"], color="#E8740C")
|
||||
self.app.start_cancel_button.config(text=Msg.STR["start"])
|
||||
self._set_ui_state(True)
|
||||
return
|
||||
@@ -537,14 +541,12 @@ class Actions:
|
||||
delete_path)
|
||||
app_logger.log(
|
||||
Msg.STR["backup_cancelled_and_deleted_msg"])
|
||||
self.app.info_label.config(
|
||||
text=Msg.STR["backup_cancelled_and_deleted_msg"])
|
||||
self.app._update_info_label(Msg.STR["backup_cancelled_and_deleted_msg"])
|
||||
else:
|
||||
self.app.backup_manager.cancel_backup()
|
||||
app_logger.log(
|
||||
"Backup cancelled, but directory could not be deleted (path unknown).")
|
||||
self.app.info_label.config(
|
||||
text="Backup cancelled, but directory could not be deleted (path unknown).")
|
||||
self.app._update_info_label("Backup cancelled, but directory could not be deleted (path unknown).")
|
||||
else:
|
||||
self.app.backup_manager.cancel_backup()
|
||||
if delete_path:
|
||||
@@ -555,17 +557,14 @@ class Actions:
|
||||
shutil.rmtree(delete_path)
|
||||
app_logger.log(
|
||||
Msg.STR["backup_cancelled_and_deleted_msg"])
|
||||
self.app.info_label.config(
|
||||
text=Msg.STR["backup_cancelled_and_deleted_msg"])
|
||||
self.app._update_info_label(Msg.STR["backup_cancelled_and_deleted_msg"])
|
||||
except Exception as e:
|
||||
app_logger.log(f"Error deleting backup directory: {e}")
|
||||
self.app.info_label.config(
|
||||
text=f"Error deleting backup directory: {e}")
|
||||
self.app._update_info_label(f"Error deleting backup directory: {e}")
|
||||
else:
|
||||
app_logger.log(
|
||||
"Backup cancelled, but no path found to delete.")
|
||||
self.app.info_label.config(
|
||||
text="Backup cancelled, but no path found to delete.")
|
||||
self.app._update_info_label("Backup cancelled, but no path found to delete.")
|
||||
|
||||
if hasattr(self.app, 'current_backup_path'):
|
||||
self.app.current_backup_path = None
|
||||
@@ -585,7 +584,7 @@ class Actions:
|
||||
self.app.start_time_label.config(text=f"Start: {start_str}")
|
||||
self.app.end_time_label.config(text="Ende: --:--:--")
|
||||
self.app.duration_label.config(text="Dauer: --:--:--")
|
||||
self.app.info_label.config(text="Backup wird vorbereitet...")
|
||||
self.app._update_info_label("Backup wird vorbereitet...")
|
||||
self.app._update_duration()
|
||||
|
||||
self.app.start_cancel_button["text"] = Msg.STR["cancel_backup"]
|
||||
|
@@ -247,7 +247,6 @@ class Drawing:
|
||||
else:
|
||||
projected_total_percentage = 0
|
||||
|
||||
info_font = (AppConfig.UI_CONFIG["font_family"], 10, "bold")
|
||||
info_messages = []
|
||||
|
||||
# First, check for critical space issues
|
||||
@@ -296,7 +295,7 @@ class Drawing:
|
||||
info_messages.append(Msg.STR["restore_mode_info"])
|
||||
|
||||
self.app.info_label.config(
|
||||
text="\n".join(info_messages), font=info_font)
|
||||
text="\n".join(info_messages), font=("Helvetica", 14))
|
||||
|
||||
self.app.target_size_label.config(
|
||||
text=f"{projected_total_used / (1024**3):.2f} GB / {self.app.destination_total_bytes / (1024**3):.2f} GB")
|
||||
|
@@ -105,7 +105,7 @@ class Navigation:
|
||||
self.app.restore_size_frame_after.grid_remove()
|
||||
self.app.mode_button_icon = self.app.image_manager.get_icon(
|
||||
"forward_extralarge")
|
||||
self.app.info_label.config(text=Msg.STR["backup_mode_info"])
|
||||
self.app._update_info_label(Msg.STR["backup_mode"])
|
||||
self.app.full_backup_cb.config(state="normal")
|
||||
self.app.incremental_cb.config(state="normal")
|
||||
self.app.compressed_cb.config(state="normal")
|
||||
@@ -119,7 +119,7 @@ class Navigation:
|
||||
self.app.restore_size_frame_after.grid()
|
||||
self.app.mode_button_icon = self.app.image_manager.get_icon(
|
||||
"back_extralarge")
|
||||
self.app.info_label.config(text=Msg.STR["restore_mode_info"])
|
||||
self.app._update_info_label(Msg.STR["restore"])
|
||||
self.app.full_backup_cb.config(state='disabled')
|
||||
self.app.incremental_cb.config(state='disabled')
|
||||
self.app.compressed_cb.config(state='disabled')
|
||||
|
Reference in New Issue
Block a user