Skip to content
This repository was archived by the owner on Oct 11, 2024. It is now read-only.

Commit a53df47

Browse files
committed
Fix to #40
1 parent 557a91a commit a53df47

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

sgtk_menu/grid.py

+10-4
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,7 @@ def __init__(self):
230230
self.connect('draw', self.draw) # transparency
231231
self.screen_dimensions = (0, 0) # parent screen dimensions (obtained outside)
232232
self.search_phrase = ''
233+
self.grid_favs = None
233234
# Credits for transparency go to KurtJacobson:
234235
# https://gist.github.com/KurtJacobson/374c8cb83aee4851d39981b9c7e2c22c
235236
screen = self.get_screen()
@@ -266,6 +267,9 @@ def __init__(self):
266267
hbox_s = Gtk.HBox()
267268
hbox_s.pack_start(self.sep1, True, False, 0)
268269
vbox.pack_start(hbox_s, False, True, 20)
270+
else:
271+
self.grid_favs = None
272+
self.sep1 = None
269273

270274
self.hbox1 = Gtk.HBox()
271275
self.grid_apps = ApplicationGrid(all_apps, columns=args.c)
@@ -294,8 +298,9 @@ def search_items(self, item, event):
294298
update = False
295299
# search box only accepts alphanumeric characters, space and backspace
296300
if event.string and event.string.isalnum() or event.string == ' ':
297-
self.grid_favs.hide()
298-
self.sep1.get_parent().hide()
301+
if self.grid_favs:
302+
self.grid_favs.hide()
303+
self.sep1.get_parent().hide()
299304
update = True
300305
self.search_phrase += event.string
301306
self.search_box.set_text(self.search_phrase)
@@ -314,8 +319,9 @@ def search_items(self, item, event):
314319

315320
if not self.search_phrase:
316321
filtered_items_list = []
317-
self.grid_favs.show()
318-
self.sep1.get_parent().show()
322+
if self.grid_favs:
323+
self.grid_favs.show()
324+
self.sep1.get_parent().show()
319325

320326
if update:
321327
if len(self.search_phrase) > 0:

0 commit comments

Comments
 (0)