From 04377ca956d87d255ba12b5ea47c0b79f4f47fd5 Mon Sep 17 00:00:00 2001 From: Andreas Huber Date: Sun, 22 Jan 2023 19:05:58 +0100 Subject: [PATCH] remove old highlightingdialog --- locales/de_DE/LC_MESSAGES/messages.mo | Bin 4688 -> 4529 bytes locales/de_DE/LC_MESSAGES/messages.po | 180 +++++++++++---------- locales/messages.pot | 154 +++++++++--------- src/mainwindow.py | 9 -- src/ui/bigtext/bigtext.py | 4 +- src/ui/bigtext/highlightingdialog.py | 201 ------------------------ src/ui/bigtext/newhighlightingdialog.py | 5 +- src/ui/colorbutton.py | 2 +- 8 files changed, 170 insertions(+), 385 deletions(-) delete mode 100644 src/ui/bigtext/highlightingdialog.py diff --git a/locales/de_DE/LC_MESSAGES/messages.mo b/locales/de_DE/LC_MESSAGES/messages.mo index da4957c6461691022cd8486b44b49100b7f87bec..3e103b80f290fe5fae3bd36e3d3ff311af40b878 100644 GIT binary patch delta 1868 zcmXw)e@vBC7{`yu1uhpZa1F>HyLL@OxOMMUOQ;m++7J1WYq+&={sF#ocpcak2Ce8y zTeY#M$!pR4L;he(aVu-ORnx6nYtwYj>G;QjHfLL7D(cF$Y1ZfaayWaR^Ld_g-t#=q zdCqz7y|CizNMw=)b)Q=Mu(gjtRpJL2B)&O|A_tf43$xa~YwZB#(R?LT;2O9X)m5tQFzR0I_=;hROT~K4(H&T@IF+a0n$e`??JAM z`50<^6snTr@G0s!41e`{>rERn)nY(3j-L5MaC?JTG))&3fK-6upd$s zGX$0RFx0yJc6{89AAzdaF{pLl+xat4@h(F7pDCdJa(JDAr{Eo^OBcnf93-Ivv{`mQ zIoJbLp|_y|j6jui3@(R9p%Od?<^K}Yy5Haf@J~o6^KS-4mnENcmcbB|9fvxrTBu9c z0(F+JLIq0M`FEfKjzXzftn)^USz#$WtnXj#86=6U zLLNtSNotS=M6C&F@wEBfJZE(sjoR~wjxT}en6y(>;Yma-J`e9`^yxiZhQh1_ZPP~L!><9{v7>36sJQ|@{HRrkC62Dc)x-t7$3 z7q5xN;?YDR9Ivg5t*ws5j~@?|W>vO29nS8KbeFT&F^%b-l+zt2ALV^#)#6&`*i9s~J)Myip64MurDaFJDABf^h{fhDT-wp{OadQ9jn=^Oj zoU>=y<4y9wsQ4k&-U5Ix=Q>){)) z7@mOz@I2K1PoUP%S$o0SKSEXFIxHf-`NO`*p$u}g5o+UBYqvrL+6#HiAe~A&3YB=u z&c6ybV!vhIzX!E%7OEm&LLK2Z*1ihU$XugS=D$M){ujz|F=ffm(kSa!t&6 zD90D<`;Vb2_yybo7vNp+FQ|1J2qM1~Q1R+if1O1O7HdqqebEC|iGxrMM__1`G0#Cc zm?4`AI181~w~!*5@1X+y1hwxMJHKq_H7UP2Q2WXYslPUEW&+=)4k|zk)O%&(~!q}V0j5@|Geb_B&Jz{3UnQ+^viHF%qNHvtxq#hpk^os?QjF^g>oI85acWdM{~X4&)nXiJI~7=@ZH2zTW~J#=j~ zwv^l`3?EMULs2j3xd}HGl$Gx8*rWWCDJSNQjHMhhn{*kuiInTiy%vkO37>RhjmC>b wydz%3ccW30bffO!lt-xPqN?C%X;njCW_Qp3>^3hoz3enN`x5cz_s2)ge;p{0} of data." msgstr "Du hast {0} selektiert." -#: src/ui/bigtext/bigtext.py:336 +#: src/ui/bigtext/bigtext.py:401 msgid "Copy {0} to Clipboard" msgstr "Kopiere {0} in die Zwischenablage" -#: src/ui/bigtext/bigtext.py:338 +#: src/ui/bigtext/bigtext.py:403 msgid "Write to File" msgstr "Schreibe in Datei" -#: src/ui/bigtext/bigtext.py:360 +#: src/ui/bigtext/bigtext.py:425 msgid "Save File" msgstr "Speichere Datei" -#: src/ui/bigtext/highlightingdialog.py:23 +#: src/ui/bigtext/newhighlightingdialog.py:20 msgid "Manage Highlighting" msgstr "Hervorhebungen Verwalten" -#: src/ui/bigtext/highlightingdialog.py:35 -msgid "Add" -msgstr "Hinzufügen" +#: src/ui/bigtext/newhighlightingdialog.py:29 +msgid "New" +msgstr "Neu" -#: src/ui/bigtext/highlightingdialog.py:39 -msgid "Update" -msgstr "Aktualisieren" - -#: src/ui/bigtext/highlightingdialog.py:43 +#: src/ui/bigtext/newhighlightingdialog.py:33 msgid "Remove" msgstr "Entfernen" -#: src/ui/bigtext/highlightingdialog.py:47 +#: src/ui/bigtext/newhighlightingdialog.py:37 msgid "Up" msgstr "Hoch" -#: src/ui/bigtext/highlightingdialog.py:51 +#: src/ui/bigtext/newhighlightingdialog.py:41 msgid "Down" msgstr "Runter" -#: src/ui/bigtext/highlightingdialog.py:59 -msgid "Query:" -msgstr "Suche:" - -#: src/ui/bigtext/highlightingdialog.py:63 -msgid "Ignore Case" -msgstr "Groß-/Kleinschreibung ignorieren" - -#: src/ui/bigtext/highlightingdialog.py:68 -msgid "Regular Expression" -msgstr "Regulärer Ausdruck" - -#: src/ui/bigtext/highlightingdialog.py:73 +#: src/ui/bigtext/newhighlightingdialog.py:143 msgid "Hit Background:" msgstr "Trefferhintergrund:" -#: src/ui/bigtext/highlightingdialog.py:78 +#: src/ui/bigtext/newhighlightingdialog.py:145 +msgid "Hit Background" +msgstr "Trefferhintergrund" + +#: src/ui/bigtext/newhighlightingdialog.py:150 +msgid "Ignore Case" +msgstr "Groß-/Kleinschreibung ignorieren" + +#: src/ui/bigtext/newhighlightingdialog.py:156 msgid "Line Background:" msgstr "Zeilenhintergrund:" -#: src/ui/bigtext/highlightingdialog.py:142 -msgid "unsaved changes" -msgstr "Nicht Gespeicherte Änderungen" +#: src/ui/bigtext/newhighlightingdialog.py:158 +msgid "Line Background" +msgstr "Zeilenhintergrund" -#: src/ui/bigtext/highlightingdialog.py:143 -msgid "You have unsaved changes." -msgstr "Du hast nicht gespeicherte Änderungen." +#: src/ui/bigtext/newhighlightingdialog.py:163 +msgid "Regular Expression" +msgstr "Regulärer Ausdruck" -#: src/ui/colorbutton.py:18 +#: src/ui/colorbutton.py:20 msgid "Strawberry Cream" msgstr "Strawberry Cream" -#: src/ui/colorbutton.py:19 +#: src/ui/colorbutton.py:21 msgid "Pale Crimson" msgstr "Pale Crimson" -#: src/ui/colorbutton.py:21 +#: src/ui/colorbutton.py:23 msgid "Broken Buttercup" -msgstr "Pale Crimson" +msgstr "Broken Buttercup" -#: src/ui/colorbutton.py:22 +#: src/ui/colorbutton.py:24 msgid "Passion Fruit Sugar" msgstr "Passion Fruit Sugar" -#: src/ui/colorbutton.py:24 +#: src/ui/colorbutton.py:26 msgid "Sunrise Yellow" msgstr "Sonnenaufganggelb" -#: src/ui/colorbutton.py:25 +#: src/ui/colorbutton.py:27 msgid "Magical Mustard" msgstr "Magischer Senf" -#: src/ui/colorbutton.py:27 +#: src/ui/colorbutton.py:29 msgid "Trendy Green" msgstr "Trendiges Grün" -#: src/ui/colorbutton.py:28 +#: src/ui/colorbutton.py:30 msgid "Garden Of Sweden" msgstr "Garten von Schweden" -#: src/ui/colorbutton.py:30 +#: src/ui/colorbutton.py:32 msgid "Light Sky Blue" msgstr "Helles Himmelsblau" -#: src/ui/colorbutton.py:31 +#: src/ui/colorbutton.py:33 msgid "True Blue" msgstr "Echtes Blau" -#: src/ui/colorbutton.py:33 +#: src/ui/colorbutton.py:35 msgid "Fairy Topia" msgstr "Fairy Topia" -#: src/ui/colorbutton.py:34 +#: src/ui/colorbutton.py:36 msgid "Magenta Bachiego" msgstr "Magenta Bachiego" -#: src/ui/colorbutton.py:36 +#: src/ui/colorbutton.py:38 msgid "Breeze of Mist" msgstr "Nebelbriese" -#: src/ui/colorbutton.py:37 +#: src/ui/colorbutton.py:39 msgid "Light Grey" msgstr "Helles Grau" -#: src/ui/colorbutton.py:38 +#: src/ui/colorbutton.py:40 msgid "Grey" msgstr "Grau" -#: src/ui/colorbutton.py:44 +#: src/ui/colorbutton.py:46 msgid "transparent" msgstr "Transparent" -#: src/ui/colorbutton.py:51 -msgid "custom" -msgstr "individuell" +#~ msgid "Add" +#~ msgstr "Hinzufügen" + +#~ msgid "Update" +#~ msgstr "Aktualisieren" + +#~ msgid "Query:" +#~ msgstr "Suche:" + +#~ msgid "unsaved changes" +#~ msgstr "Nicht Gespeicherte Änderungen" + +#~ msgid "You have unsaved changes." +#~ msgstr "Du hast nicht gespeicherte Änderungen." + +#~ msgid "custom" +#~ msgstr "individuell" #~ msgid "&Find In Files" #~ msgstr "In &Dateien Suchen" diff --git a/locales/messages.pot b/locales/messages.pot index 01b7844..edb514b 100644 --- a/locales/messages.pot +++ b/locales/messages.pot @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2022-08-25 19:21+0200\n" +"POT-Creation-Date: 2023-01-22 18:59+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -15,40 +15,36 @@ msgstr "" "Generated-By: pygettext.py 1.5\n" -#: src/mainwindow.py:34 src/plugins/krowlog/aboutdialog.py:24 +#: src/mainwindow.py:32 src/plugins/krowlog/aboutdialog.py:28 #: src/plugins/krowlogplugin.py:85 msgid "KrowLog" msgstr "" -#: src/mainwindow.py:42 src/plugins/openfileplugin.py:30 +#: src/mainwindow.py:40 src/plugins/openfileplugin.py:30 msgid "Open &Recent" msgstr "" -#: src/mainwindow.py:64 +#: src/mainwindow.py:58 msgid "&File" msgstr "" -#: src/mainwindow.py:65 +#: src/mainwindow.py:59 msgid "&Settings" msgstr "" -#: src/mainwindow.py:66 +#: src/mainwindow.py:60 msgid "&Window" msgstr "" -#: src/mainwindow.py:67 +#: src/mainwindow.py:61 msgid "&Help" msgstr "" -#: src/mainwindow.py:99 src/ui/bigtext/bigtext.py:188 -msgid "&Highlighter" -msgstr "" - -#: src/mainwindow.py:106 +#: src/mainwindow.py:93 msgid "Highlight &Searches" msgstr "" -#: src/mainwindow.py:114 +#: src/mainwindow.py:101 msgid "Open Tab on Save As File" msgstr "" @@ -76,31 +72,31 @@ msgstr "" msgid "Files Browser" msgstr "" -#: src/plugins/krowlog/aboutdialog.py:19 +#: src/plugins/krowlog/aboutdialog.py:23 msgid "About KrowLog" msgstr "" -#: src/plugins/krowlog/aboutdialog.py:29 +#: src/plugins/krowlog/aboutdialog.py:33 msgid "Version: {0}" msgstr "" -#: src/plugins/krowlog/aboutdialog.py:44 +#: src/plugins/krowlog/aboutdialog.py:48 msgid "About" msgstr "" -#: src/plugins/krowlog/aboutdialog.py:45 +#: src/plugins/krowlog/aboutdialog.py:49 msgid "License" msgstr "" -#: src/plugins/krowlog/aboutdialog.py:58 +#: src/plugins/krowlog/aboutdialog.py:62 msgid "Log file viewer" msgstr "" -#: src/plugins/krowlog/aboutdialog.py:59 +#: src/plugins/krowlog/aboutdialog.py:63 msgid "(c) 2022 Andreas Huber" msgstr "" -#: src/plugins/krowlog/aboutdialog.py:60 +#: src/plugins/krowlog/aboutdialog.py:64 msgid "License: LGPL v3" msgstr "" @@ -140,31 +136,35 @@ msgstr "" msgid "E&xit" msgstr "" -#: src/plugins/logfile/filterwidget.py:149 +#: src/plugins/logfile/filterwidget.py:156 msgid "Cancel" msgstr "" -#: src/plugins/logfile/filterwidget.py:155 +#: src/plugins/logfile/filterwidget.py:162 msgid "save query" msgstr "" -#: src/plugins/logfile/filterwidget.py:160 +#: src/plugins/logfile/filterwidget.py:167 msgid "ignore case" msgstr "" -#: src/plugins/logfile/filterwidget.py:164 +#: src/plugins/logfile/filterwidget.py:171 msgid "regex" msgstr "" -#: src/plugins/logfile/filterwidget.py:251 +#: src/plugins/logfile/filterwidget.py:259 msgid "({hits} lines)" msgstr "" -#: src/plugins/logfileplugin.py:26 +#: src/plugins/logfileplugin.py:35 src/ui/bigtext/bigtext.py:240 +msgid "&Highlighter" +msgstr "" + +#: src/plugins/logfileplugin.py:43 msgid "File not found" msgstr "" -#: src/plugins/logfileplugin.py:27 +#: src/plugins/logfileplugin.py:44 msgid "'{0}' is not a file or cannot be opened" msgstr "" @@ -184,155 +184,143 @@ msgstr "" msgid "Open File" msgstr "" -#: src/ui/bigtext/bigtext.py:171 +#: src/ui/bigtext/bigtext.py:223 msgid "&Copy to Clipboard" msgstr "" -#: src/ui/bigtext/bigtext.py:177 +#: src/ui/bigtext/bigtext.py:229 msgid "Copy to &File" msgstr "" -#: src/ui/bigtext/bigtext.py:182 +#: src/ui/bigtext/bigtext.py:234 msgid "Select &All" msgstr "" -#: src/ui/bigtext/bigtext.py:332 +#: src/ui/bigtext/bigtext.py:396 msgid "data selection" msgstr "" -#: src/ui/bigtext/bigtext.py:333 +#: src/ui/bigtext/bigtext.py:397 msgid "You have selected {0} of data." msgstr "" -#: src/ui/bigtext/bigtext.py:336 +#: src/ui/bigtext/bigtext.py:401 msgid "Copy {0} to Clipboard" msgstr "" -#: src/ui/bigtext/bigtext.py:338 +#: src/ui/bigtext/bigtext.py:403 msgid "Write to File" msgstr "" -#: src/ui/bigtext/bigtext.py:360 +#: src/ui/bigtext/bigtext.py:425 msgid "Save File" msgstr "" -#: src/ui/bigtext/highlightingdialog.py:23 +#: src/ui/bigtext/newhighlightingdialog.py:20 msgid "Manage Highlighting" msgstr "" -#: src/ui/bigtext/highlightingdialog.py:35 -msgid "Add" +#: src/ui/bigtext/newhighlightingdialog.py:29 +msgid "New" msgstr "" -#: src/ui/bigtext/highlightingdialog.py:39 -msgid "Update" -msgstr "" - -#: src/ui/bigtext/highlightingdialog.py:43 +#: src/ui/bigtext/newhighlightingdialog.py:33 msgid "Remove" msgstr "" -#: src/ui/bigtext/highlightingdialog.py:47 +#: src/ui/bigtext/newhighlightingdialog.py:37 msgid "Up" msgstr "" -#: src/ui/bigtext/highlightingdialog.py:51 +#: src/ui/bigtext/newhighlightingdialog.py:41 msgid "Down" msgstr "" -#: src/ui/bigtext/highlightingdialog.py:59 -msgid "Query:" -msgstr "" - -#: src/ui/bigtext/highlightingdialog.py:63 -msgid "Ignore Case" -msgstr "" - -#: src/ui/bigtext/highlightingdialog.py:68 -msgid "Regular Expression" -msgstr "" - -#: src/ui/bigtext/highlightingdialog.py:73 +#: src/ui/bigtext/newhighlightingdialog.py:143 msgid "Hit Background:" msgstr "" -#: src/ui/bigtext/highlightingdialog.py:78 +#: src/ui/bigtext/newhighlightingdialog.py:145 +msgid "Hit Background" +msgstr "" + +#: src/ui/bigtext/newhighlightingdialog.py:150 +msgid "Ignore Case" +msgstr "" + +#: src/ui/bigtext/newhighlightingdialog.py:156 msgid "Line Background:" msgstr "" -#: src/ui/bigtext/highlightingdialog.py:142 -msgid "unsaved changes" +#: src/ui/bigtext/newhighlightingdialog.py:158 +msgid "Line Background" msgstr "" -#: src/ui/bigtext/highlightingdialog.py:143 -msgid "You have unsaved changes." +#: src/ui/bigtext/newhighlightingdialog.py:163 +msgid "Regular Expression" msgstr "" -#: src/ui/colorbutton.py:18 +#: src/ui/colorbutton.py:20 msgid "Strawberry Cream" msgstr "" -#: src/ui/colorbutton.py:19 +#: src/ui/colorbutton.py:21 msgid "Pale Crimson" msgstr "" -#: src/ui/colorbutton.py:21 +#: src/ui/colorbutton.py:23 msgid "Broken Buttercup" msgstr "" -#: src/ui/colorbutton.py:22 +#: src/ui/colorbutton.py:24 msgid "Passion Fruit Sugar" msgstr "" -#: src/ui/colorbutton.py:24 +#: src/ui/colorbutton.py:26 msgid "Sunrise Yellow" msgstr "" -#: src/ui/colorbutton.py:25 +#: src/ui/colorbutton.py:27 msgid "Magical Mustard" msgstr "" -#: src/ui/colorbutton.py:27 +#: src/ui/colorbutton.py:29 msgid "Trendy Green" msgstr "" -#: src/ui/colorbutton.py:28 +#: src/ui/colorbutton.py:30 msgid "Garden Of Sweden" msgstr "" -#: src/ui/colorbutton.py:30 +#: src/ui/colorbutton.py:32 msgid "Light Sky Blue" msgstr "" -#: src/ui/colorbutton.py:31 +#: src/ui/colorbutton.py:33 msgid "True Blue" msgstr "" -#: src/ui/colorbutton.py:33 +#: src/ui/colorbutton.py:35 msgid "Fairy Topia" msgstr "" -#: src/ui/colorbutton.py:34 +#: src/ui/colorbutton.py:36 msgid "Magenta Bachiego" msgstr "" -#: src/ui/colorbutton.py:36 +#: src/ui/colorbutton.py:38 msgid "Breeze of Mist" msgstr "" -#: src/ui/colorbutton.py:37 +#: src/ui/colorbutton.py:39 msgid "Light Grey" msgstr "" -#: src/ui/colorbutton.py:38 +#: src/ui/colorbutton.py:40 msgid "Grey" msgstr "" -#: src/ui/colorbutton.py:44 +#: src/ui/colorbutton.py:46 msgid "transparent" msgstr "" -#: src/ui/colorbutton.py:51 -msgid "custom" -msgstr "" - diff --git a/src/mainwindow.py b/src/mainwindow.py index b6a2743..a7c41a8 100644 --- a/src/mainwindow.py +++ b/src/mainwindow.py @@ -12,7 +12,6 @@ from src.plugins.domain.menucontribution import MenuContribution, sort_menu_cont from src.plugins.domain.raction import RAction from src.plugins.domain.rmenu import RMenu from src.settings.settingsstore import SettingsStore -from src.ui.bigtext.highlightingdialog import HighlightingDialog from src.ui.tabs import Tabs from src.util.urlutils import url_is_file @@ -50,7 +49,6 @@ class MainWindow(QMainWindow): menu_bar = QMenuBar() menu_contributions: [MenuContribution] = PluginRegistry.execute_flat_map("get_menu_contributions") - menu_contributions.append(MenuContribution("settings", action=self._action_highlighter())) menu_contributions.append(MenuContribution("settings", action=self._action_highlight_search_terms())) menu_contributions.append(MenuContribution("settings", action=self._action_new_tab())) @@ -91,13 +89,6 @@ class MainWindow(QMainWindow): action = raction.to_qaction(qmenu) qmenu.addAction(action) - def _action_highlighter(self): - manage = RAction( - _("&Old Highlighter"), - action=lambda: HighlightingDialog(self.settings).exec() - ) - return manage - def _action_highlight_search_terms(self): highlight_search_terms = RAction(_("Highlight &Searches")) highlight_search_terms.set_checkable(True) diff --git a/src/ui/bigtext/bigtext.py b/src/ui/bigtext/bigtext.py index b3a3c36..b85c736 100644 --- a/src/ui/bigtext/bigtext.py +++ b/src/ui/bigtext/bigtext.py @@ -13,9 +13,9 @@ from src.ui.ScaledScrollBar import ScaledScrollBar from src.ui.bigtext.highlight_regex import HighlightRegex from src.ui.bigtext.highlight_selection import HighlightSelection from src.ui.bigtext.highlighted_range import HighlightedRange -from src.ui.bigtext.highlightingdialog import HighlightingDialog from src.ui.bigtext.line import Line from src.ui.bigtext.logFileModel import LogFileModel +from src.ui.bigtext.newhighlightingdialog import NewHighlightingDialog from src.ui.icon import Icon from src.ui.rangeslider import RangeSlider from src.util.conversion import humanbytes @@ -239,7 +239,7 @@ class InnerBigText(QWidget): manage_highlighting = QAction( _("&Highlighter"), self, - triggered=lambda: HighlightingDialog(self.model.settings).exec()) + triggered=lambda: NewHighlightingDialog(self.model.settings).exec()) manage_highlighting.setShortcut("CTRL+H") menu.addAction(manage_highlighting) diff --git a/src/ui/bigtext/highlightingdialog.py b/src/ui/bigtext/highlightingdialog.py deleted file mode 100644 index c1d0df0..0000000 --- a/src/ui/bigtext/highlightingdialog.py +++ /dev/null @@ -1,201 +0,0 @@ -from PySide6.QtWidgets import QDialog, QLineEdit, QLabel, QGridLayout, QCheckBox, QListWidget, QListWidgetItem, \ - QPushButton, QDialogButtonBox, QMessageBox, QSizePolicy - -from src.ui.bigtext.highlight_regex import HighlightRegex -from src.ui.bigtext.highlighting import Highlighting -from src.ui.colorbutton import ColorButton -from src.ui.hbox import HBox -from src.settings.settings import Settings - -from src.i18n import _ -from src.ui.icon import Icon - - -class PayloadItem(QListWidgetItem): - def __init__(self, text: str, payload=None): - super(PayloadItem, self).__init__(text) - self.payload = payload - - -class HighlightingDialog(QDialog): - def __init__(self, settings: Settings): - super(HighlightingDialog, self).__init__() - self.setWindowTitle(_("Manage Highlighting")) - self.setModal(True) - self._settings = settings - - form_grid = QGridLayout(self) - self.layout = form_grid - - row = 0 - self.list = QListWidget(self) - form_grid.addWidget(self.list, row, 0, 1, 2) - - row = row + 1 - self.btn_add = QPushButton(Icon.fromTheme("list-add"), _("Add")) - self.btn_add.setSizePolicy(QSizePolicy(QSizePolicy.Policy.Fixed, QSizePolicy.Policy.Fixed)) - self.btn_add.pressed.connect(self._add) - - self.btn_update = QPushButton(Icon.fromTheme("stock_edit"), _("Update")) - self.btn_update.setSizePolicy(QSizePolicy(QSizePolicy.Policy.Fixed, QSizePolicy.Policy.Fixed)) - self.btn_update.pressed.connect(self._update) - - self.btn_delete = QPushButton(Icon.fromTheme("list-remove"), _("Remove")) - self.btn_delete.setSizePolicy(QSizePolicy(QSizePolicy.Policy.Fixed, QSizePolicy.Policy.Fixed)) - self.btn_delete.pressed.connect(self._delete) - - self.btn_move_up = QPushButton(Icon.fromTheme("go-up"), _("Up")) - self.btn_move_up.setSizePolicy(QSizePolicy(QSizePolicy.Policy.Fixed, QSizePolicy.Policy.Fixed)) - self.btn_move_up.pressed.connect(self._move_up) - - self.btn_move_down = QPushButton(Icon.fromTheme("go-down"), _("Down")) - self.btn_move_down.setSizePolicy(QSizePolicy(QSizePolicy.Policy.Fixed, QSizePolicy.Policy.Fixed)) - self.btn_move_down.pressed.connect(self._move_down) - button_box = HBox(self.btn_update, self.btn_add, self.btn_delete, self.btn_move_up, self.btn_move_down) - form_grid.addWidget(button_box, row, 0, 1, 2) - - row = row + 1 - self.query = QLineEdit(self) - form_grid.addWidget(QLabel(_("Query:")), row, 0) - form_grid.addWidget(self.query, row, 1) - - row = row + 1 - self.ignore_case = QCheckBox(_("Ignore Case")) - self.ignore_case.setChecked(True) - form_grid.addWidget(self.ignore_case, row, 0, 1, 2) - - row = row + 1 - self.is_regex = QCheckBox(_("Regular Expression")) - self.is_regex.setChecked(True) - form_grid.addWidget(self.is_regex, row, 0, 1, 2) - - row = row + 1 - form_grid.addWidget(QLabel(_("Hit Background:")), row, 0) - self.hit_background_color = ColorButton("ccb400") - form_grid.addWidget(self.hit_background_color, row, 1) - - row = row + 1 - form_grid.addWidget(QLabel(_("Line Background:")), row, 0) - self.line_background_color = ColorButton("fff080") - form_grid.addWidget(self.line_background_color, row, 1) - - row = row + 1 - self.buttons = QDialogButtonBox() - self.buttons.setStandardButtons(QDialogButtonBox.StandardButton.Cancel | QDialogButtonBox.StandardButton.Ok) - self.buttons.accepted.connect(self._save) - self.buttons.rejected.connect(self.close) - form_grid.addWidget(self.buttons, row, 0, 1, 2) - - self._load_existing_hightlighters() - self.list.setCurrentItem(None) - self._selection_changed() - self.list.itemSelectionChanged.connect(self._selection_changed) - - def _add(self): - highlighter = HighlightRegex( - self.query.text(), - self.ignore_case.isChecked(), - self.is_regex.isChecked(), - self.hit_background_color.color, - self.line_background_color.color - ) - item = PayloadItem(self.query.text(), highlighter) - item.setBackground(highlighter.hit_background_brush()) - self.list.addItem(item) - self.list.setCurrentItem(item) - - def _update(self): - item: PayloadItem = self.list.currentItem() - highlighter: HighlightRegex = item.payload - - highlighter.query = self.query.text() - highlighter.ignore_case = self.ignore_case.isChecked() - highlighter.is_regex = self.is_regex.isChecked() - highlighter.hit_background_color = self.hit_background_color.color - highlighter.line_background_color = self.line_background_color.color - - item.setText(self.query.text()) - item.setBackground(highlighter.hit_background_brush()) - - def _delete(self): - index = self.list.selectedIndexes()[0] - selected_index = index.row() - self.list.takeItem(selected_index) - - def _move_up(self): - index = self.list.currentIndex() - selected_index = index.row() - item = self.list.takeItem(selected_index) - self.list.insertItem(selected_index - 1, item) - self.list.setCurrentIndex(index.siblingAtRow(selected_index - 1)) - - def _move_down(self): - index = self.list.selectedIndexes()[0] - selected_index = index.row() - item = self.list.takeItem(selected_index) - self.list.insertItem(selected_index + 1, item) - self.list.setCurrentIndex(index.sibling(selected_index + 1, 0)) - - def _save(self): - - if self._is_dirty(): - unsaved = QMessageBox(QMessageBox.Icon.Question, _("unsaved changes"), - _("You have unsaved changes.")) - unsaved.setStandardButtons(QMessageBox.Cancel | QMessageBox.StandardButton.Discard) - result = unsaved.exec() - if result == QMessageBox.StandardButton.Cancel: - return - - highlighters = [] - for index in range(0, self.list.count()): - item: PayloadItem = self.list.item(index) - highlighters.append(item.payload) - Highlighting.write_config(self._settings, highlighters) - self.close() - - def _selection_changed(self): - if len(self.list.selectedIndexes()) == 0: - self.btn_update.setDisabled(True) - self.btn_delete.setDisabled(True) - self.btn_move_up.setDisabled(True) - self.btn_move_down.setDisabled(True) - if len(self.list.selectedIndexes()) == 1: - selected_index = self.list.selectedIndexes()[0].row() - self.btn_update.setDisabled(False) - self.btn_delete.setDisabled(False) - self.btn_move_up.setDisabled(selected_index == 0) - self.btn_move_down.setDisabled(selected_index + 1 >= self.list.count()) - - item: PayloadItem = self.list.item(selected_index) - highlighter: HighlightRegex = item.payload - self.query.setText(highlighter.query) - self.ignore_case.setChecked(highlighter.ignore_case) - self.is_regex.setChecked(highlighter.is_regex) - self.hit_background_color.set_color(highlighter.hit_background_color) - self.line_background_color.set_color(highlighter.line_background_color) - - def _is_dirty(self): - if len(self.list.selectedIndexes()) == 0: - dirty = False - if len(self.list.selectedIndexes()) == 1: - item: PayloadItem = self.list.currentItem() - highlighter: HighlightRegex = item.payload - dirty = self.query.text() != highlighter.query \ - or self.ignore_case.isChecked() != highlighter.ignore_case \ - or self.is_regex.isChecked() != highlighter.is_regex \ - or self.hit_background_color.color != highlighter.hit_background_color \ - or self.line_background_color.color != highlighter.line_background_color - else: - dirty = False - return dirty - - def _load_existing_hightlighters(self): - highlighters: [HighlightRegex] = Highlighting.read_config(self._settings) - first_item = None - for highlighter in highlighters: - item = PayloadItem(str(highlighter.query)) - item.payload = highlighter - item.setBackground(highlighter.hit_background_brush()) - self.list.addItem(item) - if not first_item: - first_item = item diff --git a/src/ui/bigtext/newhighlightingdialog.py b/src/ui/bigtext/newhighlightingdialog.py index bf5ca6c..e026d84 100644 --- a/src/ui/bigtext/newhighlightingdialog.py +++ b/src/ui/bigtext/newhighlightingdialog.py @@ -19,7 +19,7 @@ class NewHighlightingDialog(QDialog): super(NewHighlightingDialog, self).__init__() self.setWindowTitle(_("Manage Highlighting")) self.setModal(True) - self.setMinimumWidth(700) + self.setMinimumWidth(720) self.setMinimumHeight(600) self._settings = settings @@ -117,7 +117,8 @@ class NewHighlightingDialog(QDialog): self.list.setCurrentItem(item) def _new_highlighter(self): - highlight_regex = HighlightRegex("", ignore_case=True, is_regex=True, hit_background_color="ccb400") + highlight_regex = HighlightRegex("", ignore_case=True, is_regex=True, hit_background_color="ccb400", + line_background_color="fff080") self._add_highlight_regex_to_list(highlight_regex, select=True) diff --git a/src/ui/colorbutton.py b/src/ui/colorbutton.py index 58f4a7d..6c16701 100644 --- a/src/ui/colorbutton.py +++ b/src/ui/colorbutton.py @@ -50,7 +50,7 @@ class ColorButton(QWidget): if color == color_name or color == color_value: self.color_drop_down.setCurrentIndex(self.color_drop_down.count() - 1) - self.btn_color_picker = QPushButton(QIcon.fromTheme("color-picker"), _("")) + self.btn_color_picker = QPushButton(QIcon.fromTheme("color-picker"), "") self.layout.addWidget(self.btn_color_picker) self.btn_color_picker.pressed.connect(self._update_color) self.btn_color_picker.setSizePolicy(QSizePolicy(QSizePolicy.Policy.Fixed, QSizePolicy.Policy.Fixed))