Skip to content

Commit 8266301

Browse files
authored
Reloading in duplicated, Marked files are loaded, various bug fixes
- Made font more unified and smaller - Files can now be marked in all windows - Marked files are transferred from the search window to a save searched and to a compare or duplicated session - Made buttons in save/compare/duplicate right-clickable and moved them to FF_Menubar.py - Added a seconds need text to compare - Fixed bug in duplicated where one singe duplicated file wouldn't show up - Clicking on menu bar icon now shows file find on windows - If left unchanged creation and modification time edits now update time at midnight - Reloading is now possible in duplicated - Fixed typo in README.md - On Windows File Find now closes after last window was closed
1 parent 329c76c commit 8266301

File tree

12 files changed

+533
-370
lines changed

12 files changed

+533
-370
lines changed

FF_About_UI.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def setup(parent):
7979
version_label = QLabel(about_window)
8080
# Font and Text
8181
version_label.setText(f"v. {FF_Files.VERSION_SHORT} ({FF_Files.VERSION})")
82-
version_label.setFont(QFont(FF_Files.DEFAULT_FONT, FF_Files.SMALLER_FONT_SIZE))
82+
version_label.setFont(FF_Additional_UI.DEFAULT_QT_FONT)
8383
# The command and tooltip
8484
version_label.setToolTip(f"Version: {FF_Files.VERSION_SHORT} Extended Version: {FF_Files.VERSION}")
8585
# Display the Label
@@ -90,7 +90,7 @@ def setup(parent):
9090
# Font and Text
9191
author_label.setText(
9292
"Created by Pixel Master, Copyright © 2022–2025 Pixel Master.\nLicensed under the GNU GPLv3")
93-
author_label.setFont(QFont(FF_Files.DEFAULT_FONT, FF_Files.SMALLER_FONT_SIZE))
93+
author_label.setFont(FF_Additional_UI.DEFAULT_QT_FONT)
9494
# The command and tooltip
9595
author_label.setToolTip(f"Version: {FF_Files.VERSION_SHORT} Extended Version: {FF_Files.VERSION}")
9696
# Display the Label
@@ -102,7 +102,7 @@ def generate_link_button(displayed_text, domain):
102102
link = QPushButton(about_window)
103103
# Font and Text
104104
link.setText(displayed_text)
105-
font = QFont(FF_Files.DEFAULT_FONT, FF_Files.NORMAL_FONT_SIZE)
105+
font = QFont(FF_Files.DEFAULT_FONT, FF_Files.DEFAULT_FONT_SIZE)
106106
font.setUnderline(True)
107107
link.setFont(font)
108108
# The command and tooltip

FF_Additional_UI.py

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@
3030
# keeping a list of all created icons
3131
icons = set()
3232
global app, global_color_scheme
33-
33+
DEFAULT_QT_FONT = QFont(FF_Files.DEFAULT_FONT, FF_Files.DEFAULT_FONT_SIZE)
34+
BOLD_QT_FONT = QFont(FF_Files.DEFAULT_FONT, FF_Files.DEFAULT_FONT_SIZE)
35+
BOLD_QT_FONT.setBold(True)
3436

3537
# Used for entering the directory
3638
class DirectoryEntry(QLineEdit):
@@ -341,11 +343,11 @@ def determine_text(self):
341343
return "none"
342344

343345
# less than four items selected, display all checked items
344-
elif len(all_checked_items) <= 3:
346+
elif len(all_checked_items) < 4:
345347
return ", ".join(all_checked_items)
346348

347-
# less than two item unchecked, display all unchecked ones
348-
elif (len(all_items) - len(all_checked_items)) <= 2:
349+
# less than three item unchecked, display all unchecked ones
350+
elif (len(all_items) - len(all_checked_items)) < 3:
349351
all_unchecked_items = []
350352
for item in all_items:
351353
if item not in all_checked_items:
@@ -415,10 +417,7 @@ def show_info_messagebox(title, text, parent, large=False):
415417
# Title
416418
title_label = QLabel(msg_info)
417419
title_label.setText(title)
418-
# Set font size
419-
font = QFont(FF_Files.DEFAULT_FONT, FF_Files.SMALLER_FONT_SIZE)
420-
font.setBold(True)
421-
title_label.setFont(font)
420+
title_label.setFont(BOLD_QT_FONT)
422421
# Display
423422
layout.addWidget(title_label)
424423

@@ -433,7 +432,7 @@ def show_info_messagebox(title, text, parent, large=False):
433432
msg_info.setWindowTitle(title)
434433
msg_info.show()
435434

436-
FF_Menubar.MenuBar(parent=msg_info, window="info_box", listbox=None)
435+
FF_Menubar.MenuBar(parent=msg_info, window="info_box")
437436

438437
# Return the Value of the Message Box
439438
return msg_info
@@ -535,6 +534,12 @@ def welcome_popups(parent, force_popups=False):
535534
f"{FF_Files.VERSION_SHORT} [{FF_Files.VERSION}]",
536535
parent=parent)
537536

537+
# Resetting time since last notice
538+
popup_dict["last_update_notice"] = time()
539+
540+
# Debug
541+
logging.debug(f"Reset time since last_update_notice to {ctime(popup_dict['last_update_notice'])}")
542+
538543
# If last update notice is older than 40 weeks, inform about possibility of a new update
539544
# time() returns time since the epoch in seconds
540545
elif popup_dict["last_update_notice"] < (time() - (FF_Files.SECONDS_OF_A_WEEK * 40)):

FF_Compare.py

Lines changed: 21 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@
1616
import gc
1717

1818
# PySide6 Gui Imports
19-
from PySide6.QtGui import QFont, Qt
20-
from PySide6.QtCore import QObject, Signal, QThreadPool, QSize
19+
from PySide6.QtGui import Qt
20+
from PySide6.QtCore import QObject, Signal, QThreadPool
2121
from PySide6.QtWidgets import (
22-
QMainWindow, QFileDialog, QListWidget, QLabel, QPushButton, QWidget, QGridLayout, QHBoxLayout, QScrollArea,
22+
QMainWindow, QFileDialog, QListWidget, QLabel, QWidget, QGridLayout, QHBoxLayout, QScrollArea,
2323
QSpacerItem, QSizePolicy)
2424

2525
# Projects Libraries
@@ -32,7 +32,7 @@
3232

3333
# The window
3434
class CompareUi:
35-
def __init__(self, path_of_first_search, cache_file, parent):
35+
def __init__(self, path_of_first_search, cache_file, to_be_marked_files, parent):
3636
# Debug
3737
logging.info("Setting up the Compare_Window")
3838
# Saving time
@@ -76,8 +76,9 @@ def __init__(self, path_of_first_search, cache_file, parent):
7676
self.Compare_Layout.addLayout(self.Bottom_Layout, 11, 0, 1, 2)
7777

7878
# Setting up the menu bar...
79-
menu_bar = FF_Menubar.MenuBar(parent=self.Compare_Window, window="compare",
80-
listbox=None, cache_file_path=cache_file)
79+
menu_bar = FF_Menubar.MenuBar(parent=self.Compare_Window, window="compare", search_path=path_of_first_search,
80+
search_path2=compared_searches.path_of_second_search[0],
81+
cache_file_path=cache_file, bottom_layout=self.Bottom_Layout)
8182
logging.debug("Done building MenuBar\n")
8283

8384
# Set up both list-boxes
@@ -190,26 +191,10 @@ def __init__(self, path_of_first_search, cache_file, parent):
190191
self.Compare_Layout.addWidget(self.removed_files_label1, 1, 1)
191192
self.Compare_Layout.addWidget(self.removed_files_label2, 2, 1)
192193

193-
# Buttons
194-
# Button to open the File in Finder
195-
move_file = self.generate_button("Move / Rename", menu_bar.move_file,
196-
icon=os.path.join(FF_Files.ASSETS_FOLDER, "Move_icon_small.png"))
197-
self.Bottom_Layout.addWidget(move_file)
198-
199-
# Button to move the file to trash
200-
delete_file = self.generate_button("Move to Trash", menu_bar.delete_file,
201-
icon=os.path.join(FF_Files.ASSETS_FOLDER, "Trash_icon_small.png"))
202-
self.Bottom_Layout.addWidget(delete_file)
203-
204-
# Button to open the file
205-
open_file = self.generate_button("Open", menu_bar.open_file,
206-
icon=os.path.join(FF_Files.ASSETS_FOLDER, "Open_icon_small.png"))
207-
self.Bottom_Layout.addWidget(open_file)
208-
209-
# Button to show info about the file
210-
file_info_button = self.generate_button("Info", menu_bar.file_info,
211-
icon=os.path.join(FF_Files.ASSETS_FOLDER, "Info_button_img_small.png"))
212-
self.Bottom_Layout.addWidget(file_info_button)
194+
# Mark the files that need to be marked, reference the two listbox widgets to the menu bar
195+
menu_bar.listbox = self.added_files_listbox
196+
menu_bar.listbox2 = self.removed_files_listbox
197+
menu_bar.mark_marked_files(to_be_marked_files)
213198

214199
# Update search status label
215200
FF_Search.ACTIVE_SEARCH_THREADS -= 1
@@ -230,10 +215,6 @@ def __init__(self, path_of_first_search, cache_file, parent):
230215

231216
time_stamp = time()
232217

233-
# Setting a Font
234-
small_text_font = QFont(FF_Files.DEFAULT_FONT, FF_Files.NORMAL_FONT_SIZE)
235-
small_text_font.setBold(True)
236-
237218
# Top Layout
238219
self.Top_Layout = QHBoxLayout()
239220
self.Top_Layout.setContentsMargins(0, 0, 0, 0)
@@ -243,14 +224,14 @@ def __init__(self, path_of_first_search, cache_file, parent):
243224
time_text = QLabel(self.Compare_Window)
244225
total_time = compared_searches.time_dict["time_after_building_ui"] - compared_searches.time_dict["start_time"]
245226
time_text.setText(f"Time needed: {round(total_time, 3)}s")
246-
time_text.setFont(small_text_font)
227+
time_text.setFont(FF_Additional_UI.BOLD_QT_FONT)
247228
# Displaying
248229
self.Top_Layout.addWidget(time_text)
249230

250231
# Saving time
251232
# Time stat Button
252-
show_time = self.generate_button(None, lambda: show_time_stats(),
253-
icon=os.path.join(FF_Files.ASSETS_FOLDER, "Time_button_img_small.png"))
233+
show_time = menu_bar.generate_button(None, lambda: show_time_stats(),
234+
icon=os.path.join(FF_Files.ASSETS_FOLDER, "Time_button_img_small.png"))
254235
# Resize
255236
show_time.setMaximumSize(50, 50)
256237
# Add to Layout
@@ -295,32 +276,12 @@ def show_time_stats():
295276
# Collect garbage
296277
gc.collect()
297278

298-
# Functions to automate Button
299-
def generate_button(self, text, command, icon=None):
300-
# Define the Button
301-
button = QPushButton(self.Compare_Window)
302-
# Change the Text
303-
button.setText(text)
304-
# Set the command
305-
button.clicked.connect(command)
306-
# Set the icon
307-
if icon is not None:
308-
FF_Additional_UI.UIIcon(icon, button.setIcon)
309-
button.setIconSize(QSize(23, 22))
310-
# Return the value of the Button, to move the Button
311-
return button
312-
313279
# Function for generating the added / removed files labels
314280
def generate_title_label(self, text, text2, light_color, dark_color, length_of_list) -> tuple[QLabel, QLabel]:
315281
# Label 1
316282
label1 = FF_Additional_UI.ColoredLabel(text, self.Compare_Window, light_color, dark_color)
317-
318-
# Defining the font
319-
font1 = QFont(FF_Files.DEFAULT_FONT, FF_Files.NORMAL_FONT_SIZE)
320-
font1.setBold(True)
321-
label1.setFont(font1)
322-
323-
label1.setFixedHeight(FF_Files.NORMAL_FONT_SIZE + 2)
283+
label1.setFont(FF_Additional_UI.BOLD_QT_FONT)
284+
label1.setFixedHeight(FF_Files.DEFAULT_FONT_SIZE + 2)
324285
label1.adjustSize()
325286

326287
# Label 2
@@ -334,19 +295,17 @@ def generate_title_label(self, text, text2, light_color, dark_color, length_of_l
334295
# Set the label to the shortened string
335296
label2.setText(text2_shortened)
336297

337-
# Defining the font
338-
font2 = QFont(FF_Files.DEFAULT_FONT, FF_Files.SMALLER_FONT_SIZE)
339298
# Configure the font
340-
label2.setFont(font2)
299+
label2.setFont(FF_Additional_UI.DEFAULT_QT_FONT)
341300
# Times two because it is two lines and plus two for some extra space
342-
label2.setFixedHeight(FF_Files.SMALLER_FONT_SIZE * 2 + 10)
301+
label2.setFixedHeight(FF_Files.DEFAULT_FONT_SIZE * 2 + 10)
343302

344303
return label1, label2
345304

346305

347306
# The engine
348307
class CompareSearches:
349-
def __init__(self, files_of_first_search: list, path_of_first_search, cache_file, parent):
308+
def __init__(self, files_of_first_search: list, path_of_first_search, cache_file, to_be_marked_files, parent):
350309
# Debug
351310
logging.debug("User pressed Compare Search")
352311

@@ -357,7 +316,8 @@ class SignalsClass(QObject):
357316

358317
self.signals = SignalsClass()
359318
# Connecting the signal to the user-interface class
360-
self.signals.finished.connect(lambda: CompareUi(path_of_first_search, cache_file, parent))
319+
self.signals.finished.connect(
320+
lambda: CompareUi(path_of_first_search, cache_file, to_be_marked_files, parent))
361321

362322
# Thread
363323
comparing_thread = QThreadPool(parent)

0 commit comments

Comments
 (0)