Skip to content

Commit e547a22

Browse files
committed
fix locale and styling
1 parent 11c64f9 commit e547a22

File tree

2 files changed

+19
-43
lines changed

2 files changed

+19
-43
lines changed

kgr_toolbox.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@ def __init__(self, iface):
2222
self.plugin_dir = os.path.dirname(__file__)
2323

2424
# Initialize locale
25-
locale = QSettings().value('locale/userLocale')[0:2]
25+
locale_setting = QSettings().value('locale/userLocale', 'en')
26+
if locale_setting:
27+
locale = str(locale_setting)[0:2]
28+
else:
29+
locale = 'en'
2630
locale_path = os.path.join(
2731
self.plugin_dir,
2832
'i18n',

tabs/truncate_tab.py

Lines changed: 14 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def __init__(self, database_name, table_count, excluded_tables, parent=None):
2222
self.table_count = table_count
2323
self.excluded_tables = excluded_tables
2424

25-
self.setWindowTitle("⚠️ TRUNCATE TABLES - WARNING")
25+
self.setWindowTitle("TRUNCATE TABLES - WARNING")
2626
self.setModal(True)
2727
self.setMinimumSize(500, 400)
2828

@@ -32,28 +32,7 @@ def setup_ui(self):
3232
"""Setup the dialog UI."""
3333
layout = QVBoxLayout()
3434

35-
# Warning header
36-
warning_frame = QFrame()
37-
warning_frame.setStyleSheet("""
38-
QFrame {
39-
background-color: #fff3e0;
40-
border-radius: 5px;
41-
padding: 10px;
42-
}
43-
""")
44-
warning_layout = QVBoxLayout(warning_frame)
45-
46-
# Large warning icon and text
47-
warning_label = QLabel("⚠️ DANGER: TABLE TRUNCATION")
48-
warning_font = QFont()
49-
warning_font.setPointSize(16)
50-
warning_font.setBold(True)
51-
warning_label.setFont(warning_font)
52-
warning_label.setAlignment(Qt.AlignCenter)
53-
warning_label.setStyleSheet("color: #e65100;")
54-
warning_layout.addWidget(warning_label)
55-
56-
layout.addWidget(warning_frame)
35+
5736

5837
# Operation information
5938
info_label = QLabel("You are about to TRUNCATE TABLES in the following database:")
@@ -64,24 +43,23 @@ def setup_ui(self):
6443
details_frame = QFrame()
6544
details_frame.setStyleSheet("""
6645
QFrame {
67-
background-color: #f3e5f5;
6846
border-radius: 5px;
6947
padding: 10px;
7048
margin: 10px 0;
7149
}
7250
""")
7351
details_layout = QVBoxLayout(details_frame)
7452

75-
db_name_label = QLabel(f"📂 Database: {self.database_name}")
53+
db_name_label = QLabel(f"Database: {self.database_name}")
7654
db_name_label.setStyleSheet("font-weight: bold; font-size: 16px; color: #4a148c;")
7755
details_layout.addWidget(db_name_label)
7856

79-
tables_label = QLabel(f"📊 Tables to truncate: {self.table_count}")
57+
tables_label = QLabel(f"Tables to truncate: {self.table_count}")
8058
tables_label.setStyleSheet("font-weight: bold; font-size: 14px; color: #6a1b9a;")
8159
details_layout.addWidget(tables_label)
8260

8361
if self.excluded_tables:
84-
excluded_label = QLabel(f"🛡️ Excluded tables: {', '.join(self.excluded_tables)}")
62+
excluded_label = QLabel(f"Excluded tables: {', '.join(self.excluded_tables)}")
8563
excluded_label.setStyleSheet("font-weight: bold; font-size: 12px; color: #388e3c;")
8664
details_layout.addWidget(excluded_label)
8765

@@ -93,7 +71,7 @@ def setup_ui(self):
9371
warning_text.setMaximumHeight(120)
9472
warning_text.setStyleSheet("background-color: #ffebee;")
9573
warning_text.setPlainText(
96-
"⚠️ WARNING: This action will DELETE ALL DATA from the selected tables!\n\n"
74+
"WARNING: This action will DELETE ALL DATA from the selected tables!\n\n"
9775
"• ALL rows in the affected tables will be permanently removed\n"
9876
"• Table structure (columns, indexes, constraints) will remain intact\n"
9977
"• This operation cannot be undone\n"
@@ -105,10 +83,10 @@ def setup_ui(self):
10583
button_layout = QHBoxLayout()
10684
button_layout.setContentsMargins(0, 20, 0, 0)
10785

108-
self.cancel_button = QPushButton("Cancel")
86+
self.cancel_button = QPushButton("Cancel")
10987
self.cancel_button.setStyleSheet("""
11088
QPushButton {
111-
background-color: #4caf50;
89+
background-color: #666;
11290
color: white;
11391
font-weight: bold;
11492
padding: 10px 20px;
@@ -121,10 +99,10 @@ def setup_ui(self):
12199
""")
122100
self.cancel_button.clicked.connect(self.reject)
123101

124-
self.truncate_button = QPushButton("🗑️ TRUNCATE TABLES")
102+
self.truncate_button = QPushButton("TRUNCATE TABLES")
125103
self.truncate_button.setStyleSheet("""
126104
QPushButton {
127-
background-color: #ff9800;
105+
background-color: #ff0000;
128106
color: white;
129107
font-weight: bold;
130108
padding: 10px 20px;
@@ -244,17 +222,11 @@ def setup_ui(self):
244222
# Truncate section
245223
truncate_group = QGroupBox("Truncate Operation")
246224
truncate_layout = QVBoxLayout(truncate_group)
247-
248-
# Warning text
249-
warning_text = QLabel("⚠️ WARNING: Truncation will permanently delete all data from the selected tables!")
250-
warning_text.setStyleSheet("color: #f44336; font-weight: bold; font-size: 14px;")
251-
warning_text.setWordWrap(True)
252-
truncate_layout.addWidget(warning_text)
253-
254-
self.truncate_btn = QPushButton("🗑️ Truncate Tables")
225+
226+
self.truncate_btn = QPushButton("Truncate Tables")
255227
self.truncate_btn.setStyleSheet("""
256228
QPushButton {
257-
background-color: #ff9800;
229+
background-color: #e50000;
258230
color: white;
259231
font-weight: bold;
260232
padding: 12px 24px;
@@ -263,7 +235,7 @@ def setup_ui(self):
263235
font-size: 14px;
264236
}
265237
QPushButton:hover {
266-
background-color: #f57c00;
238+
background-color: #ff0000;
267239
}
268240
QPushButton:disabled {
269241
background-color: #cccccc;

0 commit comments

Comments
 (0)