Skip to content

Commit 8b154be

Browse files
committed
Added placeholder logo
1 parent b087219 commit 8b154be

5 files changed

Lines changed: 42 additions & 5 deletions

File tree

core/file_controller.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,9 @@ def save_file(self):
110110
try:
111111
self._write_files(scenario_path, obj_path)
112112
tab.mark_saved()
113+
114+
self.main.show_status_message(f"Successfully saved {tab.project_name}/{tab.module_name}", "info", 5000)
115+
113116
except (FileNotFoundError, PermissionError) as e:
114117
QMessageBox.critical(self.main, "Error", f"Permission denied or path not found when saving files:\n{str(e)}")
115118
return False
@@ -168,6 +171,7 @@ def save_file_as(self, tab):
168171
tab.obj_path = obj_path
169172
tab.project_name = ui.selected_project
170173
tab.mark_saved()
174+
self.main.show_status_message(f"Successfully Saved{project_name}/{new_module_name}", "info", 5000)
171175
return True
172176

173177
except Exception as e:

core/table_controller.py

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from PyQt6.QtCore import QObject, Qt
2-
from PyQt6.QtWidgets import QApplication
2+
from PyQt6.QtWidgets import QApplication, QMessageBox
33

44
from .undo_commands import EditCellCommand, InsertRowsCommand, DeleteRowsCommand
55
from .steps_performed import get_steps_performed
@@ -10,8 +10,9 @@
1010

1111
class TableController(QObject):
1212

13-
def __init__(self, parent, undo_stack):
14-
super().__init__(parent)
13+
def __init__(self, main, undo_stack):
14+
super().__init__(main)
15+
self.main = main
1516
self.undo_stack = undo_stack
1617

1718
def insert_rows(self, model, position, count):
@@ -67,10 +68,39 @@ def paste(self, model, start_index):
6768
if not data:
6869
return
6970

70-
self.undo_stack.beginMacro("Paste")
71+
overwrite = False
72+
7173
start_row = start_index.row()
7274
start_col = start_index.column()
7375

76+
for i, row_data in enumerate(data):
77+
for j, value in enumerate(row_data):
78+
target_row = start_row + i
79+
target_col = start_col + j
80+
if (target_row < model.rowCount() and
81+
target_col < model.columnCount()):
82+
index = model.index(target_row, target_col)
83+
old_value = model.data(index, Qt.ItemDataRole.EditRole)
84+
85+
if old_value is not None and str(old_value) != "" and str(value) != str(old_value):
86+
overwrite = True
87+
break
88+
if overwrite:
89+
break
90+
91+
if overwrite:
92+
reply = QMessageBox.question(
93+
self.main,
94+
"Overwrite existing cells",
95+
"This operation will overwrite existing data. Do you want to proceed?",
96+
QMessageBox.StandardButton.Yes | QMessageBox.StandardButton.No,
97+
QMessageBox.StandardButton.No
98+
)
99+
if reply !=QMessageBox.StandardButton.Yes:
100+
return
101+
102+
self.undo_stack.beginMacro("Paste")
103+
74104
for i, row_data in enumerate(data):
75105
for j, value in enumerate(row_data):
76106
target_row = start_row + i

main.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
1+
import os
12
import sys
23
from ui.window import MainWindow
34
from PyQt6.QtWidgets import QApplication
45
from ui.styles import get_stylesheet
6+
from PyQt6.QtGui import QIcon
57

68
def main():
79
app = QApplication(sys.argv)
810
app.setApplicationName("Test Case Editor")
911
app.setApplicationVersion("0.3.0")
12+
app.setWindowIcon(QIcon("resources/testeditor_logo.png"))
1013
style_sheet = get_stylesheet()
1114
app.setStyleSheet(style_sheet)
1215
editor = MainWindow()

resources/testeditor_logo.png

97.8 KB
Loading

ui/tab.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def __init__(self, module_name, main, project_name=None):
3232
self.table1 = Table(model=self.model1, undo_stack=self.undo_stack, delegate=self.delegate)
3333
self.table2 = Table(model=self.model2, undo_stack=self.undo_stack, delegate=self.delegate)
3434

35-
self.controller = TableController(self, self.undo_stack)
35+
self.controller = TableController(main, self.undo_stack)
3636

3737
self.setup_ui()
3838
self.connect_signals()

0 commit comments

Comments
 (0)