summaryrefslogtreecommitdiff
path: root/portato/gui
diff options
context:
space:
mode:
Diffstat (limited to 'portato/gui')
-rw-r--r--portato/gui/windows/main.py38
1 files changed, 17 insertions, 21 deletions
diff --git a/portato/gui/windows/main.py b/portato/gui/windows/main.py
index cbb5bf1..103b792 100644
--- a/portato/gui/windows/main.py
+++ b/portato/gui/windows/main.py
@@ -1192,6 +1192,15 @@ class MainWindow (Window):
self.show_package(cp = cp, version = version, queue = self.queue)
+ def _jump_check_search (self, model, pos, elsef):
+ try:
+ row = model[pos]
+ except IndexError: # position not in model
+ debug("Position is too large for model")
+ return True
+ else:
+ return elsef(row)
+
def jump_to_pkg (self, name = None, pos = "0"):
if isinstance(pos, int):
pos = str(pos)
@@ -1200,15 +1209,7 @@ class MainWindow (Window):
model = self.pkgList.get_model()
if name:
- search = False
- try:
- row = model[pos]
- except IndexError: # position not in model
- search = True
- else:
- search = (row[col] != name)
-
- if search:
+ if self._jump_check_search(model, pos, lambda r: r[col] != name):
debug("Pkg path does not match. Searching...")
for cname, path in ((x[col], x.path) for x in model):
if cname == name:
@@ -1235,15 +1236,7 @@ class MainWindow (Window):
else:
sname = None
- search = False
- try:
- row = model[pos]
- except IndexError: # position not in model
- search = True
- else:
- search = (row[col] != name)
-
- if sname is None and search: # need to search in normal list
+ if sname is None and self._jump_check_search(model, pos, lambda r: r[col] != name): # need to search in normal list
debug("Cat path does not match. Searching...")
for cname, path in ((x[col], x.path) for x in model):
if cname == name:
@@ -1251,17 +1244,20 @@ class MainWindow (Window):
break
elif sname: # the collapse case
- row = model[pos.split(":")[0]]
+ p = pos.split(":")[0]
no_match = False
- if row[col] != sname[0]: # first part does not match :(
+
+ if self._jump_check_search(model, p, lambda r: r[col] != sname[0]):
debug("First part of cat path does not match. Searching...")
no_match = True
for r in model:
if r[col] == sname[0]:
row = r
break
+ else:
+ row = model[p]
- if no_match or model[pos][col] != sname[1]:
+ if no_match or self._jump_check_search(model, pos, lambda r: r[col] != sname[1]):
debug("Second part of cat path does not match. Searching...")
for cname, path in ((x[col], x.path) for x in row.iterchildren()):
if cname == sname[1]: # found second
'/dotfiles.git/commit/.xinitrc?id=41b3d07ef66c77f16179810c693db98734cca87a&follow=1'>Put ssh-agent into the i3 environment.René 'Necoro' Neumann1-0/+1 2020-02-17Update cci: stgit now uses python3René 'Necoro' Neumann1-1/+1 2020-02-17Revert "Local Changes"René 'Necoro' Neumann2-5/+3 2020-02-17Update vundleRené 'Necoro' Neumann1-0/+0 2020-02-17Enable secondary screen in urxvtRené 'Necoro' Neumann1-0/+1 2020-02-17Local ChangesRené 'Necoro' Neumann2-3/+5 2018-06-10[i3] Replace icons by font awesomeRené 'Necoro' Neumann24-149/+13 2018-06-10[i3] Remove obsolete pidgin stuffRené 'Necoro' Neumann2-36/+0 2018-06-10[zsh] Remove obsolete isabelle functionsRené 'Necoro' Neumann2-112/+0 2018-06-10Misc changesRené 'Necoro' Neumann3-0/+7 2018-06-10[git] Update email addressRené 'Necoro' Neumann1-1/+1 2018-06-10Enhance cci scriptRené 'Necoro' Neumann1-15/+12 2017-11-18Some windows setupRené 'Necoro' Neumann2-1/+6 2017-10-08[zsh] Use zcalc instead of bcRené 'Necoro' Neumann1-5/+4 2017-10-08[zsh] CalculatorRené 'Necoro' Neumann1-0/+8 2017-10-08Some vim changes.René 'Necoro' Neumann4-28/+17 2017-10-08Delete old stuff.René 'Necoro' Neumann5-71/+1