Worked more on search and replace plugin; updated image

This commit is contained in:
itdominator 2023-10-11 00:05:55 -05:00
parent dcc1253db6
commit 198f483863
5 changed files with 32 additions and 12 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 795 KiB

After

Width:  |  Height:  |  Size: 822 KiB

View File

@ -28,8 +28,8 @@ class Plugin(PluginBase):
self.use_regex = False self.use_regex = False
self.use_case_sensitive = False self.use_case_sensitive = False
self.use_selection_only_scan = False self.use_only_in_selection = False
self.use_fuzzy_search = False self.use_whole_word_search = False
self.highlight_color = "#FBF719" self.highlight_color = "#FBF719"
self.text_color = "#000000" self.text_color = "#000000"
@ -81,11 +81,11 @@ class Plugin(PluginBase):
self._set_find_options_lbl() self._set_find_options_lbl()
def tggle_selection_only_scan(self, widget): def tggle_selection_only_scan(self, widget):
self.use_selection_only_scan = not widget.get_active() self.use_only_in_selection = not widget.get_active()
self._set_find_options_lbl() self._set_find_options_lbl()
def tggle_fuzzy_search(self, widget): def tggle_whole_word_search(self, widget):
self.use_fuzzy_search = not widget.get_active() self.use_whole_word_search = not widget.get_active()
self._set_find_options_lbl() self._set_find_options_lbl()
def _set_find_options_lbl(self): def _set_find_options_lbl(self):
@ -111,6 +111,9 @@ class Plugin(PluginBase):
buffer.remove_tag_by_name("search_tag", buffer.get_start_iter(), buffer.get_end_iter()) buffer.remove_tag_by_name("search_tag", buffer.get_start_iter(), buffer.get_end_iter())
return search_tag return search_tag
def find_next_entry(self, widget, eve, use_data = None):
...
def search_for_string(self, widget): def search_for_string(self, widget):
query = widget.get_text() query = widget.get_text()
buffer = self._active_src_view.get_buffer() buffer = self._active_src_view.get_buffer()
@ -153,14 +156,14 @@ class Plugin(PluginBase):
def find_next(self): def find_next(self, widget):
... ...
def find_all(self): def find_all(self, widget):
... ...
def replace_next(self): def replace(self, widget):
... ...
def replace_all(self): def replace_all(self, widget):
... ...

View File

@ -7,6 +7,16 @@
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="stock">gtk-close</property> <property name="stock">gtk-close</property>
</object> </object>
<object class="GtkImage" id="only-in-selection">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="pixbuf">../../icons/only-in-selection.png</property>
</object>
<object class="GtkImage" id="whole-word">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="pixbuf">../../icons/whole-word.png</property>
</object>
<object class="GtkPopover" id="search_replace_dialog"> <object class="GtkPopover" id="search_replace_dialog">
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="modal">False</property> <property name="modal">False</property>
@ -92,12 +102,13 @@
</child> </child>
<child> <child>
<object class="GtkToggleButton"> <object class="GtkToggleButton">
<property name="label" translatable="yes">togglebutton</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">True</property> <property name="can-focus">True</property>
<property name="focus-on-click">False</property> <property name="focus-on-click">False</property>
<property name="receives-default">True</property> <property name="receives-default">True</property>
<property name="tooltip-text" translatable="yes">Only In Selection</property> <property name="tooltip-text" translatable="yes">Only In Selection</property>
<property name="image">only-in-selection</property>
<property name="always-show-image">True</property>
<signal name="toggled" handler="tggle_selection_only_scan" swapped="no"/> <signal name="toggled" handler="tggle_selection_only_scan" swapped="no"/>
</object> </object>
<packing> <packing>
@ -108,13 +119,14 @@
</child> </child>
<child> <child>
<object class="GtkToggleButton"> <object class="GtkToggleButton">
<property name="label" translatable="yes">togglebutton</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">True</property> <property name="can-focus">True</property>
<property name="focus-on-click">False</property> <property name="focus-on-click">False</property>
<property name="receives-default">True</property> <property name="receives-default">True</property>
<property name="tooltip-text" translatable="yes">Whole Word</property> <property name="tooltip-text" translatable="yes">Whole Word</property>
<signal name="toggled" handler="tggle_fuzzy_search" swapped="no"/> <property name="image">whole-word</property>
<property name="always-show-image">True</property>
<signal name="toggled" handler="tggle_whole_word_search" swapped="no"/>
</object> </object>
<packing> <packing>
<property name="expand">True</property> <property name="expand">True</property>
@ -176,6 +188,7 @@
<property name="margin-bottom">5</property> <property name="margin-bottom">5</property>
<property name="placeholder-text" translatable="yes">Find in current buffer</property> <property name="placeholder-text" translatable="yes">Find in current buffer</property>
<signal name="changed" handler="search_for_string" swapped="no"/> <signal name="changed" handler="search_for_string" swapped="no"/>
<signal name="key-release-event" handler="find_next_entry" swapped="no"/>
</object> </object>
<packing> <packing>
<property name="left-attach">0</property> <property name="left-attach">0</property>
@ -211,6 +224,7 @@
<property name="margin-end">5</property> <property name="margin-end">5</property>
<property name="margin-top">5</property> <property name="margin-top">5</property>
<property name="margin-bottom">5</property> <property name="margin-bottom">5</property>
<signal name="clicked" handler="replace_all" swapped="no"/>
</object> </object>
<packing> <packing>
<property name="left-attach">9</property> <property name="left-attach">9</property>
@ -229,6 +243,7 @@
<property name="margin-end">10</property> <property name="margin-end">10</property>
<property name="margin-top">5</property> <property name="margin-top">5</property>
<property name="margin-bottom">5</property> <property name="margin-bottom">5</property>
<signal name="clicked" handler="replace" swapped="no"/>
</object> </object>
<packing> <packing>
<property name="left-attach">8</property> <property name="left-attach">8</property>
@ -245,6 +260,7 @@
<property name="margin-end">5</property> <property name="margin-end">5</property>
<property name="margin-top">5</property> <property name="margin-top">5</property>
<property name="margin-bottom">5</property> <property name="margin-bottom">5</property>
<signal name="clicked" handler="find_all" swapped="no"/>
</object> </object>
<packing> <packing>
<property name="left-attach">9</property> <property name="left-attach">9</property>
@ -261,6 +277,7 @@
<property name="margin-end">5</property> <property name="margin-end">5</property>
<property name="margin-top">5</property> <property name="margin-top">5</property>
<property name="margin-bottom">5</property> <property name="margin-bottom">5</property>
<signal name="clicked" handler="find_next" swapped="no"/>
</object> </object>
<packing> <packing>
<property name="left-attach">8</property> <property name="left-attach">8</property>

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB